mirror of
https://invent.kde.org/network/falkon.git
synced 2024-12-20 10:46:35 +01:00
Global file url cleanup + load support for qrc: scheme
- rather then prepending file:// or file:/// on windows, use Qt functions QUrl::fromLocalFile and QUrl::toLocalFile - WebView support for loading files from qrc: scheme
This commit is contained in:
parent
79f825c173
commit
7205c73eca
@ -41,7 +41,7 @@ int HistoryModel::addHistoryEntry(const QString &url, QString &title)
|
||||
if (!m_isSaving) {
|
||||
return -2;
|
||||
}
|
||||
if (url.startsWith("file://") || url.startsWith("qupzilla:") || title.contains(tr("Failed loading page")) || url.isEmpty() || url.contains("about:blank")) {
|
||||
if (url.startsWith("file:") || url.startsWith("qupzilla:") || title.contains(tr("Failed loading page")) || url.isEmpty() || url.contains("about:blank")) {
|
||||
return -1;
|
||||
}
|
||||
if (title == "") {
|
||||
|
@ -86,11 +86,7 @@ QString SpeedDial::initialScript()
|
||||
}
|
||||
}
|
||||
else {
|
||||
#ifdef Q_WS_X11
|
||||
imgSource.prepend("file://");
|
||||
#else
|
||||
imgSource.prepend("file:///");
|
||||
#endif
|
||||
imgSource = QUrl::fromLocalFile(imgSource).toString();
|
||||
}
|
||||
|
||||
m_initialScript.append(QString("addBox('%1', '%2', '%3');\n").arg(url, title, imgSource));
|
||||
@ -150,12 +146,7 @@ void SpeedDial::thumbnailCreated(const QPixmap &image)
|
||||
continue;
|
||||
}
|
||||
|
||||
#ifdef Q_WS_X11
|
||||
fileName.prepend("file://");
|
||||
#else
|
||||
fileName.prepend("file:///");
|
||||
#endif
|
||||
|
||||
fileName = QUrl::fromLocalFile(fileName).toString();
|
||||
frame->evaluateJavaScript(QString("setImageToUrl('%1', '%2');").arg(url, fileName));
|
||||
}
|
||||
}
|
||||
|
@ -99,7 +99,7 @@ void WebView::slotIconChanged()
|
||||
{
|
||||
m_siteIcon = icon();
|
||||
|
||||
if (url().toString().contains("file://") || title().contains(tr("Failed loading page"))) {
|
||||
if (url().scheme() == "file" || title().contains(tr("Failed loading page"))) {
|
||||
return;
|
||||
}
|
||||
|
||||
@ -834,7 +834,7 @@ void WebView::load(const QUrl &url)
|
||||
return;
|
||||
}
|
||||
|
||||
if (url.scheme() == "data") {
|
||||
if (url.scheme() == "data" || url.scheme() == "qrc") {
|
||||
QWebView::load(url);
|
||||
m_aboutToLoadUrl = url;
|
||||
return;
|
||||
@ -846,13 +846,9 @@ void WebView::load(const QUrl &url)
|
||||
return;
|
||||
}
|
||||
|
||||
#ifdef Q_WS_WIN
|
||||
if (QFile::exists(url.path().mid(1))) // From QUrl(file:///C:/Bla/ble/foo.html it returns
|
||||
// /C:/Bla/ble/foo.html ... so we cut first char
|
||||
#else
|
||||
if (QFile::exists(url.path()))
|
||||
#endif
|
||||
if (QFile::exists(url.toLocalFile())) {
|
||||
QWebView::load(url);
|
||||
}
|
||||
else {
|
||||
SearchEngine engine = mApp->searchEnginesManager()->activeEngine();
|
||||
QString urlString = engine.url.replace("%s", url.toString());
|
||||
|
Loading…
Reference in New Issue
Block a user