Skip to content
This repository has been archived by the owner on May 10, 2018. It is now read-only.

Commit

Permalink
Fix saving new icons in database
Browse files Browse the repository at this point in the history
Regression from 38bf9d2
  • Loading branch information
nowrep committed Dec 20, 2016
1 parent c7fa310 commit 3a9e050
Show file tree
Hide file tree
Showing 3 changed files with 18 additions and 3 deletions.
14 changes: 11 additions & 3 deletions src/lib/tools/iconprovider.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -44,10 +44,18 @@ void IconProvider::saveIcon(WebView* view)
return;
}

static const char *ignoredSchemes[] = { "qupzilla", "ftp", "file", "view-source" };
for (unsigned i = 0; i < sizeof(ignoredSchemes) / sizeof(ignoredSchemes[0]); ++i)
if (view->url().scheme() == ignoredSchemes[i])
const QStringList ignoredSchemes = {
QStringLiteral("qupzilla"),
QStringLiteral("ftp"),
QStringLiteral("file"),
QStringLiteral("view-source")
};

for (const QString &scheme : ignoredSchemes) {
if (view->url().scheme() == scheme) {
return;
}
}

BufferedIcon item;
item.first = view->url();
Expand Down
6 changes: 6 additions & 0 deletions src/lib/webengine/webview.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,7 @@ WebView::WebView(QWidget* parent)
connect(this, &QWebEngineView::loadStarted, this, &WebView::slotLoadStarted);
connect(this, &QWebEngineView::loadProgress, this, &WebView::slotLoadProgress);
connect(this, &QWebEngineView::loadFinished, this, &WebView::slotLoadFinished);
connect(this, &QWebEngineView::iconChanged, this, &WebView::slotIconChanged);
connect(this, &QWebEngineView::urlChanged, this, &WebView::slotUrlChanged);

m_currentZoomLevel = zoomLevels().indexOf(100);
Expand Down Expand Up @@ -384,6 +385,11 @@ void WebView::slotLoadFinished(bool ok)
mApp->history()->addHistoryEntry(this);
}

void WebView::slotIconChanged()
{
IconProvider::instance()->saveIcon(this);
}

void WebView::slotUrlChanged(const QUrl &url)
{
Q_UNUSED(url)
Expand Down
1 change: 1 addition & 0 deletions src/lib/webengine/webview.h
Original file line number Diff line number Diff line change
Expand Up @@ -112,6 +112,7 @@ protected slots:
void slotLoadStarted();
void slotLoadProgress(int progress);
void slotLoadFinished(bool ok);
void slotIconChanged();
void slotUrlChanged(const QUrl &url);

// Context menu slots
Expand Down

0 comments on commit 3a9e050

Please sign in to comment.