From 2055621f2ae5ebe210d45175be2d8a99fb56d697 Mon Sep 17 00:00:00 2001 From: nowrep Date: Sun, 22 Apr 2012 20:51:28 +0200 Subject: [PATCH] Show star icon in completer when item is from bookmarks. - IconProvider has no longer static members - new macro qIconProvider for accessing IconProvider instance --- bin/themes/chrome/main.css | 6 +++ bin/themes/default/main.css | 6 +++ bin/themes/linux/main.css | 6 +++ bin/themes/mac/main.css | 6 +++ bin/themes/windows/main.css | 6 +++ src/lib/app/mainapplication.cpp | 5 +-- src/lib/app/mainapplication.h | 2 - src/lib/app/qupzilla.cpp | 20 +++++----- src/lib/autofill/autofillnotification.cpp | 2 +- src/lib/bookmarks/bookmarksmanager.cpp | 6 +-- src/lib/bookmarks/bookmarksmodel.cpp | 2 +- src/lib/bookmarks/bookmarkstoolbar.cpp | 18 ++++----- .../bookmarksimport/bookmarksimportdialog.cpp | 4 +- src/lib/downloads/downloaditem.cpp | 4 +- .../completer/locationcompleterdelegate.cpp | 16 ++++++-- .../completer/locationcompletermodel.cpp | 5 ++- src/lib/navigation/locationbar.cpp | 4 +- src/lib/navigation/navigationbar.cpp | 4 +- src/lib/opensearch/searchenginesmanager.cpp | 6 +-- src/lib/other/clearprivatedata.cpp | 2 +- src/lib/other/sourceviewer.cpp | 2 +- src/lib/other/sourceviewersearch.cpp | 6 +-- src/lib/popupwindow/popuplocationbar.cpp | 2 +- src/lib/rss/rssmanager.cpp | 6 +-- src/lib/rss/rssnotification.cpp | 2 +- src/lib/sidebar/bookmarkssidebar.cpp | 4 +- src/lib/tools/docktitlebarwidget.cpp | 2 +- src/lib/tools/iconprovider.cpp | 29 ++++++++++---- src/lib/tools/iconprovider.h | 39 ++++++++++++------- src/lib/webview/searchtoolbar.cpp | 6 +-- src/lib/webview/tabbar.cpp | 4 +- src/lib/webview/tabbedwebview.cpp | 2 +- src/lib/webview/tabwidget.cpp | 2 +- src/lib/webview/webpage.cpp | 8 ++-- src/lib/webview/webview.cpp | 16 ++++---- 35 files changed, 163 insertions(+), 97 deletions(-) diff --git a/bin/themes/chrome/main.css b/bin/themes/chrome/main.css index 1ffff80c3..9998f9dbb 100644 --- a/bin/themes/chrome/main.css +++ b/bin/themes/chrome/main.css @@ -113,6 +113,12 @@ qproperty-multiIcon: url(images/tabbar-addtab.png); } +/*IconProvider*/ +IconProvider +{ + qproperty-bookmarkIcon: url(images/star-a.png); +} + /*LocationBar*/ #locationbar { diff --git a/bin/themes/default/main.css b/bin/themes/default/main.css index b587cd830..9612ab5c4 100644 --- a/bin/themes/default/main.css +++ b/bin/themes/default/main.css @@ -123,6 +123,12 @@ background: url(images/transp.png); } +/*IconProvider*/ +IconProvider +{ + qproperty-bookmarkIcon: url(images/star.png); +} + /*LocationBar*/ #locationbar { diff --git a/bin/themes/linux/main.css b/bin/themes/linux/main.css index 82f95baf3..a47f719eb 100644 --- a/bin/themes/linux/main.css +++ b/bin/themes/linux/main.css @@ -106,6 +106,12 @@ background: url(images/transp.png); } +/*IconProvider*/ +IconProvider +{ + qproperty-bookmarkIcon: url(images/star-a.png); +} + /*LocationBar*/ #locationbar { diff --git a/bin/themes/mac/main.css b/bin/themes/mac/main.css index d2bca1db8..b03093490 100644 --- a/bin/themes/mac/main.css +++ b/bin/themes/mac/main.css @@ -108,6 +108,12 @@ qproperty-multiIcon: url(images/tabbar-addtab.png); } +/*IconProvider*/ +IconProvider +{ + qproperty-bookmarkIcon: url(images/star-a.png); +} + /*LocationBar*/ #locationbar { diff --git a/bin/themes/windows/main.css b/bin/themes/windows/main.css index d402088d8..3dbd04257 100644 --- a/bin/themes/windows/main.css +++ b/bin/themes/windows/main.css @@ -118,6 +118,12 @@ qproperty-multiIcon: url(images/tabbar-addtab.png); } +/*IconProvider*/ +IconProvider +{ + qproperty-bookmarkIcon: url(images/star-a.png); +} + /*LocationBar*/ #locationbar { diff --git a/src/lib/app/mainapplication.cpp b/src/lib/app/mainapplication.cpp index e5cc7999c..3cb33a4c2 100644 --- a/src/lib/app/mainapplication.cpp +++ b/src/lib/app/mainapplication.cpp @@ -78,7 +78,6 @@ MainApplication::MainApplication(int &argc, char** argv) , m_autofill(0) , m_networkCache(new QNetworkDiskCache(this)) , m_desktopNotifications(0) - , m_iconProvider(new IconProvider(this)) , m_searchEnginesManager(0) , m_dbWriter(new DatabaseWriter(this)) , m_isClosing(false) @@ -348,7 +347,7 @@ void MainApplication::loadSettings() m_websettings->setFontSize(QWebSettings::MinimumLogicalFontSize, settings.value("MinimumLogicalFontSize", m_websettings->fontSize(QWebSettings::MinimumLogicalFontSize)).toInt()); settings.endGroup(); - m_websettings->setWebGraphic(QWebSettings::DefaultFrameIconGraphic, IconProvider::emptyWebIcon().pixmap(16, 16)); + m_websettings->setWebGraphic(QWebSettings::DefaultFrameIconGraphic, qIconProvider->emptyWebIcon().pixmap(16, 16)); m_websettings->setWebGraphic(QWebSettings::MissingImageGraphic, QPixmap()); // Allows to load files from qrc: scheme in qupzilla: pages @@ -612,7 +611,7 @@ void MainApplication::saveSettings() m_networkmanager->saveCertificates(); m_plugins->c2f_saveSettings(); m_plugins->speedDial()->saveSettings(); - m_iconProvider->saveIconsToDatabase(); + qIconProvider->saveIconsToDatabase(); AdBlockManager::instance()->save(); QFile::remove(currentProfilePath() + "WebpageIcons.db"); diff --git a/src/lib/app/mainapplication.h b/src/lib/app/mainapplication.h index be1f8aa72..1d37a907f 100644 --- a/src/lib/app/mainapplication.h +++ b/src/lib/app/mainapplication.h @@ -95,7 +95,6 @@ public: SearchEnginesManager* searchEnginesManager(); QNetworkDiskCache* networkCache() { return m_networkCache; } DesktopNotificationsFactory* desktopNotifications(); - IconProvider* iconProvider() { return m_iconProvider; } DatabaseWriter* dbWriter() { return m_dbWriter; } #ifdef Q_WS_MAC @@ -139,7 +138,6 @@ private: AutoFillModel* m_autofill; QNetworkDiskCache* m_networkCache; DesktopNotificationsFactory* m_desktopNotifications; - IconProvider* m_iconProvider; SearchEnginesManager* m_searchEnginesManager; DatabaseWriter* m_dbWriter; diff --git a/src/lib/app/qupzilla.cpp b/src/lib/app/qupzilla.cpp index ad5e4b8ae..4cb61bff3 100644 --- a/src/lib/app/qupzilla.cpp +++ b/src/lib/app/qupzilla.cpp @@ -361,10 +361,10 @@ void QupZilla::setupMenu() m_actionShowFullScreen->setCheckable(true); m_actionShowFullScreen->setShortcut(QKeySequence("F11")); connect(m_actionShowFullScreen, SIGNAL(triggered(bool)), this, SLOT(fullScreen(bool))); - m_actionStop = new QAction(IconProvider::standardIcon(QStyle::SP_BrowserStop), tr("&Stop"), this); + m_actionStop = new QAction(qIconProvider->standardIcon(QStyle::SP_BrowserStop), tr("&Stop"), this); connect(m_actionStop, SIGNAL(triggered()), this, SLOT(stop())); m_actionStop->setShortcut(QKeySequence("Esc")); - m_actionReload = new QAction(IconProvider::standardIcon(QStyle::SP_BrowserReload), tr("&Reload"), this); + m_actionReload = new QAction(qIconProvider->standardIcon(QStyle::SP_BrowserReload), tr("&Reload"), this); connect(m_actionReload, SIGNAL(triggered()), this, SLOT(reload())); m_actionReload->setShortcut(QKeySequence("F5")); QAction* actionEncoding = new QAction(tr("Character &Encoding"), this); @@ -402,9 +402,9 @@ void QupZilla::setupMenu() * History Menu * ****************/ m_menuHistory = new Menu(tr("Hi&story")); - m_menuHistory->addAction(IconProvider::standardIcon(QStyle::SP_ArrowBack), tr("&Back"), this, SLOT(goBack()))->setShortcut(QKeySequence("Ctrl+Left")); - m_menuHistory->addAction(IconProvider::standardIcon(QStyle::SP_ArrowForward), tr("&Forward"), this, SLOT(goNext()))->setShortcut(QKeySequence("Ctrl+Right")); - m_menuHistory->addAction(IconProvider::fromTheme("go-home"), tr("&Home"), this, SLOT(goHome()))->setShortcut(QKeySequence("Alt+Home")); + m_menuHistory->addAction(qIconProvider->standardIcon(QStyle::SP_ArrowBack), tr("&Back"), this, SLOT(goBack()))->setShortcut(QKeySequence("Ctrl+Left")); + m_menuHistory->addAction(qIconProvider->standardIcon(QStyle::SP_ArrowForward), tr("&Forward"), this, SLOT(goNext()))->setShortcut(QKeySequence("Ctrl+Right")); + m_menuHistory->addAction(qIconProvider->fromTheme("go-home"), tr("&Home"), this, SLOT(goHome()))->setShortcut(QKeySequence("Alt+Home")); m_menuHistory->addAction(QIcon(":/icons/menu/history.png"), tr("Show &All History"), this, SLOT(showHistoryManager()))->setShortcut(QKeySequence("Ctrl+Shift+H")); m_menuHistory->addSeparator(); connect(m_menuHistory, SIGNAL(aboutToShow()), this, SLOT(aboutToShowHistoryMenu())); @@ -429,7 +429,7 @@ void QupZilla::setupMenu() m_menuBookmarks = new Menu(tr("&Bookmarks")); m_menuBookmarks->addAction(tr("Bookmark &This Page"), this, SLOT(bookmarkPage()))->setShortcut(QKeySequence("Ctrl+D")); m_menuBookmarks->addAction(tr("Bookmark &All Tabs"), this, SLOT(bookmarkAllTabs())); - m_menuBookmarks->addAction(IconProvider::fromTheme("user-bookmarks"), tr("Organize &Bookmarks"), this, SLOT(showBookmarksManager()))->setShortcut(QKeySequence("Ctrl+Shift+O")); + m_menuBookmarks->addAction(qIconProvider->fromTheme("user-bookmarks"), tr("Organize &Bookmarks"), this, SLOT(showBookmarksManager()))->setShortcut(QKeySequence("Ctrl+Shift+O")); m_menuBookmarks->addSeparator(); connect(m_menuBookmarks, SIGNAL(aboutToShow()), this, SLOT(aboutToShowBookmarksMenu())); @@ -739,7 +739,7 @@ void QupZilla::aboutToShowBookmarksMenu() while (query.next()) { QString title = query.value(0).toString(); const QUrl &url = query.value(1).toUrl(); - const QIcon &icon = IconProvider::iconFromImage(QImage::fromData(query.value(2).toByteArray())); + const QIcon &icon = qIconProvider->iconFromImage(QImage::fromData(query.value(2).toByteArray())); if (title.length() > 40) { title.truncate(40); title += ".."; @@ -759,7 +759,7 @@ void QupZilla::aboutToShowBookmarksMenu() while (query.next()) { QString title = query.value(0).toString(); const QUrl &url = query.value(1).toUrl(); - const QIcon &icon = IconProvider::iconFromImage(QImage::fromData(query.value(2).toByteArray())); + const QIcon &icon = qIconProvider->iconFromImage(QImage::fromData(query.value(2).toByteArray())); if (title.length() > 40) { title.truncate(40); title += ".."; @@ -789,7 +789,7 @@ void QupZilla::aboutToShowBookmarksMenu() while (query2.next()) { QString title = query2.value(0).toString(); const QUrl &url = query2.value(1).toUrl(); - const QIcon &icon = IconProvider::iconFromImage(QImage::fromData(query2.value(2).toByteArray())); + const QIcon &icon = qIconProvider->iconFromImage(QImage::fromData(query2.value(2).toByteArray())); if (title.length() > 40) { title.truncate(40); title += ".."; @@ -1789,7 +1789,7 @@ bool QupZilla::quitApp() dialog.setText(tr("There are still %1 open tabs and your session won't be stored. \nAre you sure to quit QupZilla?").arg(m_tabWidget->count())); dialog.setCheckBoxText(tr("Don't ask again")); dialog.setWindowTitle(tr("There are still open tabs")); - dialog.setIcon(IconProvider::standardIcon(QStyle::SP_MessageBoxWarning)); + dialog.setIcon(qIconProvider->standardIcon(QStyle::SP_MessageBoxWarning)); if (dialog.exec() != QDialog::Accepted) { return false; } diff --git a/src/lib/autofill/autofillnotification.cpp b/src/lib/autofill/autofillnotification.cpp index 73727f8a8..c4db2d168 100644 --- a/src/lib/autofill/autofillnotification.cpp +++ b/src/lib/autofill/autofillnotification.cpp @@ -33,7 +33,7 @@ AutoFillNotification::AutoFillNotification(const QUrl &url, const QByteArray &da setAttribute(Qt::WA_DeleteOnClose); ui->setupUi(widget()); ui->label->setText(tr("Do you want QupZilla to remember the password for %1 on %2?").arg(user, url.host())); - ui->closeButton->setIcon(IconProvider::standardIcon(QStyle::SP_DialogCloseButton)); + ui->closeButton->setIcon(qIconProvider->standardIcon(QStyle::SP_DialogCloseButton)); connect(ui->remember, SIGNAL(clicked()), this, SLOT(remember())); connect(ui->never, SIGNAL(clicked()), this, SLOT(never())); diff --git a/src/lib/bookmarks/bookmarksmanager.cpp b/src/lib/bookmarks/bookmarksmanager.cpp index 5a071426c..0b41c57d1 100644 --- a/src/lib/bookmarks/bookmarksmanager.cpp +++ b/src/lib/bookmarks/bookmarksmanager.cpp @@ -308,7 +308,7 @@ void BookmarksManager::refreshTable() QUrl url = query.value(1).toUrl(); int id = query.value(2).toInt(); QString folder = query.value(3).toString(); - QIcon icon = IconProvider::iconFromImage(QImage::fromData(query.value(4).toByteArray())); + QIcon icon = qIconProvider->iconFromImage(QImage::fromData(query.value(4).toByteArray())); QTreeWidgetItem* item = new QTreeWidgetItem(); if (folder == "bookmarksMenu") { folder = _bookmarksMenu; @@ -350,7 +350,7 @@ void BookmarksManager::refreshTable() QString title = query2.value(0).toString(); QUrl url = query2.value(1).toUrl(); int id = query2.value(2).toInt(); - QIcon icon = IconProvider::iconFromImage(QImage::fromData(query2.value(3).toByteArray())); + QIcon icon = qIconProvider->iconFromImage(QImage::fromData(query2.value(3).toByteArray())); QTreeWidgetItem* item = new QTreeWidgetItem(newItem); item->setText(0, title); @@ -378,7 +378,7 @@ void BookmarksManager::addBookmark(const BookmarksModel::Bookmark &bookmark) item->setText(0, bookmark.title); item->setText(1, bookmark.url.toEncoded()); item->setData(0, Qt::UserRole + 10, bookmark.id); - item->setIcon(0, IconProvider::iconFromImage(bookmark.image)); + item->setIcon(0, qIconProvider->iconFromImage(bookmark.image)); item->setToolTip(0, bookmark.title); item->setToolTip(1, bookmark.url.toEncoded()); item->setFlags(item->flags() | Qt::ItemIsEditable); diff --git a/src/lib/bookmarks/bookmarksmodel.cpp b/src/lib/bookmarks/bookmarksmodel.cpp index b30339653..f263641e6 100644 --- a/src/lib/bookmarks/bookmarksmodel.cpp +++ b/src/lib/bookmarks/bookmarksmodel.cpp @@ -161,7 +161,7 @@ bool BookmarksModel::saveBookmark(const QUrl &url, const QString &title, const Q QImage image = icon.pixmap(16, 16).toImage(); if (image.isNull()) { - image = IconProvider::emptyWebImage(); + image = qIconProvider->emptyWebImage(); } if (!isFolder(folder)) { diff --git a/src/lib/bookmarks/bookmarkstoolbar.cpp b/src/lib/bookmarks/bookmarkstoolbar.cpp index ede5d5c8a..9765a56e1 100644 --- a/src/lib/bookmarks/bookmarkstoolbar.cpp +++ b/src/lib/bookmarks/bookmarkstoolbar.cpp @@ -74,7 +74,7 @@ void BookmarksToolbar::customContextMenuRequested(const QPoint &pos) QMenu menu; menu.addAction(tr("&Bookmark Current Page"), p_QupZilla, SLOT(bookmarkPage())); menu.addAction(tr("Bookmark &All Tabs"), p_QupZilla, SLOT(bookmarkAllTabs())); - menu.addAction(IconProvider::fromTheme("user-bookmarks"), tr("&Organize Bookmarks"), p_QupZilla, SLOT(showBookmarksManager())); + menu.addAction(qIconProvider->fromTheme("user-bookmarks"), tr("&Organize Bookmarks"), p_QupZilla, SLOT(showBookmarksManager())); menu.addSeparator(); QAction act(tr("Show Most &Visited"), this); act.setCheckable(true); @@ -107,11 +107,11 @@ void BookmarksToolbar::showBookmarkContextMenu(const QPoint &pos) QVariant buttonPointer = qVariantFromValue((void*) button); QMenu menu; - menu.addAction(IconProvider::fromTheme("go-next"), tr("Move right"), this, SLOT(moveRight()))->setData(buttonPointer); - menu.addAction(IconProvider::fromTheme("go-previous"), tr("Move left"), this, SLOT(moveLeft()))->setData(buttonPointer); + menu.addAction(qIconProvider->fromTheme("go-next"), tr("Move right"), this, SLOT(moveRight()))->setData(buttonPointer); + menu.addAction(qIconProvider->fromTheme("go-previous"), tr("Move left"), this, SLOT(moveLeft()))->setData(buttonPointer); menu.addAction(tr("Edit bookmark"), this, SLOT(editBookmark()))->setData(buttonPointer); menu.addSeparator(); - menu.addAction(IconProvider::fromTheme("list-remove"), tr("Remove bookmark"), this, SLOT(removeButton()))->setData(buttonPointer); + menu.addAction(qIconProvider->fromTheme("list-remove"), tr("Remove bookmark"), this, SLOT(removeButton()))->setData(buttonPointer); //Prevent choosing first option with double rightclick QPoint position = button->mapToGlobal(pos); @@ -404,7 +404,7 @@ void BookmarksToolbar::addBookmark(const BookmarksModel::Bookmark &bookmark) ToolButton* button = new ToolButton(this); button->setText(title); button->setData(v); - button->setIcon(IconProvider::iconFromImage(bookmark.image)); + button->setIcon(qIconProvider->iconFromImage(bookmark.image)); button->setToolButtonStyle(m_toolButtonStyle); button->setToolTip(bookmark.url.toEncoded()); button->setAutoRaise(true); @@ -471,7 +471,7 @@ void BookmarksToolbar::bookmarkEdited(const BookmarksModel::Bookmark &before, co button->setText(title); button->setData(v); - button->setIcon(IconProvider::iconFromImage(after.image)); + button->setIcon(qIconProvider->iconFromImage(after.image)); button->setToolTip(after.url.toEncoded()); return; } @@ -502,7 +502,7 @@ void BookmarksToolbar::refreshBookmarks() ToolButton* button = new ToolButton(this); button->setText(title); button->setData(v); - button->setIcon(IconProvider::iconFromImage(bookmark.image)); + button->setIcon(qIconProvider->iconFromImage(bookmark.image)); button->setToolButtonStyle(m_toolButtonStyle); button->setToolTip(bookmark.url.toEncoded()); button->setAutoRaise(true); @@ -565,7 +565,7 @@ void BookmarksToolbar::aboutToShowFolderMenu() title += ".."; } - Action* act = new Action(IconProvider::iconFromImage(b.image), title); + Action* act = new Action(qIconProvider->iconFromImage(b.image), title); act->setData(b.url); connect(act, SIGNAL(triggered()), p_QupZilla, SLOT(loadActionUrl())); connect(act, SIGNAL(middleClicked()), p_QupZilla, SLOT(loadActionUrlInNewNotSelectedTab())); @@ -588,7 +588,7 @@ void BookmarksToolbar::dropEvent(QDropEvent* e) QString title = mime->text(); QUrl url = mime->urls().at(0); - QIcon icon = IconProvider::iconFromImage(qvariant_cast(mime->imageData())); + QIcon icon = qIconProvider->iconFromImage(qvariant_cast(mime->imageData())); m_bookmarksModel->saveBookmark(url, title, icon, "bookmarksToolbar"); } diff --git a/src/lib/bookmarksimport/bookmarksimportdialog.cpp b/src/lib/bookmarksimport/bookmarksimportdialog.cpp index 4650bf43a..fdae48daa 100644 --- a/src/lib/bookmarksimport/bookmarksimportdialog.cpp +++ b/src/lib/bookmarksimport/bookmarksimportdialog.cpp @@ -103,7 +103,7 @@ void BookmarksImportDialog::startFetchingIcons() m_fetcher = new BookmarksImportIconFetcher(); m_fetcher->moveToThread(m_fetcherThread); - QIcon defaultIcon = IconProvider::emptyWebIcon(); + QIcon defaultIcon = qIconProvider->emptyWebIcon(); QIcon folderIcon = style()->standardIcon(QStyle::SP_DirIcon); QHash hash; @@ -267,7 +267,7 @@ void BookmarksImportDialog::addExportedBookmarks() db.transaction(); foreach(const Bookmark & b, m_exportedBookmarks) { - model->saveBookmark(b.url, b.title, IconProvider::iconFromImage(b.image), b.folder); + model->saveBookmark(b.url, b.title, qIconProvider->iconFromImage(b.image), b.folder); } db.commit(); diff --git a/src/lib/downloads/downloaditem.cpp b/src/lib/downloads/downloaditem.cpp index 09812b0c6..626904fef 100644 --- a/src/lib/downloads/downloaditem.cpp +++ b/src/lib/downloads/downloaditem.cpp @@ -65,7 +65,7 @@ DownloadItem::DownloadItem(QListWidgetItem* item, QNetworkReply* reply, const QS ui->setupUi(this); setMaximumWidth(525); - ui->button->setPixmap(IconProvider::standardIcon(QStyle::SP_BrowserStop).pixmap(20, 20)); + ui->button->setPixmap(qIconProvider->standardIcon(QStyle::SP_BrowserStop).pixmap(20, 20)); ui->fileName->setText(m_fileName); ui->downloadInfo->setText(tr("Remaining time unavailable")); ui->fileIcon->setPixmap(fileIcon); @@ -338,7 +338,7 @@ void DownloadItem::customContextMenuRequested(const QPoint &pos) menu.addAction(tr("Go to Download Page"), this, SLOT(goToDownloadPage()))->setEnabled(!m_downloadPage.isEmpty()); menu.addAction(QIcon::fromTheme("edit-copy"), tr("Copy Download Link"), this, SLOT(copyDownloadLink())); menu.addSeparator(); - menu.addAction(IconProvider::standardIcon(QStyle::SP_BrowserStop), tr("Cancel downloading"), this, SLOT(stop()))->setEnabled(m_downloading); + menu.addAction(qIconProvider->standardIcon(QStyle::SP_BrowserStop), tr("Cancel downloading"), this, SLOT(stop()))->setEnabled(m_downloading); menu.addAction(QIcon::fromTheme("list-remove"), tr("Clear"), this, SLOT(clear()))->setEnabled(!m_downloading); if (m_downloading || ui->downloadInfo->text().startsWith(tr("Cancelled")) || ui->downloadInfo->text().startsWith(tr("Error"))) { diff --git a/src/lib/navigation/completer/locationcompleterdelegate.cpp b/src/lib/navigation/completer/locationcompleterdelegate.cpp index 827d137dc..a71a7c714 100644 --- a/src/lib/navigation/completer/locationcompleterdelegate.cpp +++ b/src/lib/navigation/completer/locationcompleterdelegate.cpp @@ -17,6 +17,7 @@ * ============================================================ */ #include "locationcompleterdelegate.h" #include "locationcompleterview.h" +#include "iconprovider.h" #include #include @@ -49,20 +50,20 @@ void LocationCompleterDelegate::paint(QPainter* painter, const QStyleOptionViewI int leftPosition = m_padding * 2; int rightPosition = opt.rect.right() - m_padding; -// if (m_view->ignoreSelectedFlag()) { -// if (opt.state.testFlag(QStyle::State_MouseOver)) { + opt.state &= ~QStyle::State_MouseOver; + if (m_view->hoveredIndex() == index) { opt.state |= QStyle::State_Selected; } else { opt.state &= ~QStyle::State_Selected; } -// } const QPalette::ColorRole colorRole = opt.state & QStyle::State_Selected ? QPalette::HighlightedText : QPalette::Text; const QPalette::ColorRole colorLinkRole = opt.state & QStyle::State_Selected ? QPalette::HighlightedText : QPalette::Link; // Draw background + painter->fillRect(opt.rect, Qt::white); style->drawPrimitive(QStyle::PE_PanelItemViewItem, &opt, painter, w); // Draw icon @@ -87,6 +88,15 @@ void LocationCompleterDelegate::paint(QPainter* painter, const QStyleOptionViewI const QString &link = opt.fontMetrics.elidedText(index.data(Qt::DisplayRole).toString(), Qt::ElideRight, linkRect.width()); painter->setFont(opt.font); style->drawItemText(painter, linkRect, Qt::TextSingleLine | Qt::AlignLeft, opt.palette, true, link, colorLinkRole); + + // Draw star to bookmark items + if (index.data(Qt::UserRole + 1).toBool()) { + const QPixmap starPixmap = qIconProvider->bookmarkIcon(); + QSize starSize = starPixmap.size(); + QPoint pos(rightPosition - starSize.width(), opt.rect.top() + m_padding); + QRect starRect(pos, starSize); + painter->drawPixmap(starRect, starPixmap); + } } QSize LocationCompleterDelegate::sizeHint(const QStyleOptionViewItem &option, const QModelIndex &index) const diff --git a/src/lib/navigation/completer/locationcompletermodel.cpp b/src/lib/navigation/completer/locationcompletermodel.cpp index 25c8550db..368557331 100644 --- a/src/lib/navigation/completer/locationcompletermodel.cpp +++ b/src/lib/navigation/completer/locationcompletermodel.cpp @@ -57,9 +57,10 @@ void LocationCompleterModel::refreshCompletions(const QString &string) QStandardItem* item = new QStandardItem(); const QUrl &url = query.value(0).toUrl(); + item->setIcon(qIconProvider->iconFromImage(QImage::fromData(query.value(2).toByteArray()))); item->setText(url.toEncoded()); item->setData(query.value(1), Qt::UserRole); - item->setIcon(IconProvider::iconFromImage(QImage::fromData(query.value(2).toByteArray()))); + item->setData(QVariant(true), Qt::UserRole + 1); // From bookmarks appendRow(item); urlList.append(url); @@ -84,6 +85,7 @@ void LocationCompleterModel::refreshCompletions(const QString &string) item->setIcon(_iconForUrl(url)); item->setText(url.toEncoded()); item->setData(query.value(1), Qt::UserRole); + item->setData(QVariant(false), Qt::UserRole + 1); appendRow(item); } @@ -103,6 +105,7 @@ void LocationCompleterModel::showMostVisited() item->setIcon(_iconForUrl(url)); item->setText(url.toEncoded()); item->setData(query.value(1), Qt::UserRole); + item->setData(QVariant(false), Qt::UserRole + 1); appendRow(item); } diff --git a/src/lib/navigation/locationbar.cpp b/src/lib/navigation/locationbar.cpp index f951b2755..b8a9b5751 100644 --- a/src/lib/navigation/locationbar.cpp +++ b/src/lib/navigation/locationbar.cpp @@ -41,7 +41,7 @@ #include LocationBar::LocationBar(QupZilla* mainClass) - : LineEdit() + : LineEdit(mainClass) , p_QupZilla(mainClass) , m_webView(0) , m_menu(new QMenu(this)) @@ -240,7 +240,7 @@ void LocationBar::siteIconChanged() void LocationBar::clearIcon() { - m_siteIcon->setIcon(IconProvider::emptyWebIcon()); + m_siteIcon->setIcon(qIconProvider->emptyWebIcon()); } void LocationBar::setPrivacy(bool state) diff --git a/src/lib/navigation/navigationbar.cpp b/src/lib/navigation/navigationbar.cpp index 3a04e0139..59e1e52bd 100644 --- a/src/lib/navigation/navigationbar.cpp +++ b/src/lib/navigation/navigationbar.cpp @@ -205,7 +205,7 @@ void NavigationBar::aboutToShowHistoryBackMenu() if (item.isValid() && lastUrl != item.url()) { QString title = titleForUrl(item.title(), item.url()); - const QIcon &icon = iconForPage(item.url(), IconProvider::standardIcon(QStyle::SP_ArrowBack)); + const QIcon &icon = iconForPage(item.url(), qIconProvider->standardIcon(QStyle::SP_ArrowBack)); Action* act = new Action(icon, title); act->setData(i); connect(act, SIGNAL(triggered()), this, SLOT(goAtHistoryIndex())); @@ -242,7 +242,7 @@ void NavigationBar::aboutToShowHistoryNextMenu() if (item.isValid() && lastUrl != item.url()) { QString title = titleForUrl(item.title(), item.url()); - const QIcon &icon = iconForPage(item.url(), IconProvider::standardIcon(QStyle::SP_ArrowForward)); + const QIcon &icon = iconForPage(item.url(), qIconProvider->standardIcon(QStyle::SP_ArrowForward)); Action* act = new Action(icon, title); act->setData(i); connect(act, SIGNAL(triggered()), this, SLOT(goAtHistoryIndex())); diff --git a/src/lib/opensearch/searchenginesmanager.cpp b/src/lib/opensearch/searchenginesmanager.cpp index a29c8a959..b98f677fd 100644 --- a/src/lib/opensearch/searchenginesmanager.cpp +++ b/src/lib/opensearch/searchenginesmanager.cpp @@ -35,7 +35,7 @@ QIcon SearchEnginesManager::iconForSearchEngine(const QUrl &url) { - QIcon ic = IconProvider::iconFromImage(mApp->iconProvider()->iconForDomain(url)); + QIcon ic = qIconProvider->iconFromImage(qIconProvider->iconForDomain(url)); if (ic.isNull()) { ic = QIcon(":icons/menu/search-icon.png"); } @@ -65,7 +65,7 @@ void SearchEnginesManager::loadSettings() while (query.next()) { Engine en; en.name = query.value(0).toString(); - en.icon = IconProvider::iconFromBase64(query.value(1).toByteArray()); + en.icon = qIconProvider->iconFromBase64(query.value(1).toByteArray()); en.url = query.value(2).toString(); en.shortcut = query.value(3).toString(); en.suggestionsUrl = query.value(4).toString(); @@ -407,7 +407,7 @@ void SearchEnginesManager::saveSettings() foreach(const Engine & en, m_allEngines) { query.prepare("INSERT INTO search_engines (name, icon, url, shortcut, suggestionsUrl, suggestionsParameters) VALUES (?, ?, ?, ?, ?, ?)"); query.bindValue(0, en.name); - query.bindValue(1, IconProvider::iconToBase64(en.icon)); + query.bindValue(1, qIconProvider->iconToBase64(en.icon)); query.bindValue(2, en.url); query.bindValue(3, en.shortcut); query.bindValue(4, en.suggestionsUrl); diff --git a/src/lib/other/clearprivatedata.cpp b/src/lib/other/clearprivatedata.cpp index 160575947..82103fc6b 100644 --- a/src/lib/other/clearprivatedata.cpp +++ b/src/lib/other/clearprivatedata.cpp @@ -85,7 +85,7 @@ void ClearPrivateData::clearCache() void ClearPrivateData::clearIcons() { mApp->webSettings()->clearIconDatabase(); - mApp->iconProvider()->clearIconDatabase(); + qIconProvider->clearIconDatabase(); } void ClearPrivateData::clearFlash() diff --git a/src/lib/other/sourceviewer.cpp b/src/lib/other/sourceviewer.cpp index 7689893d5..3510d4f21 100644 --- a/src/lib/other/sourceviewer.cpp +++ b/src/lib/other/sourceviewer.cpp @@ -94,7 +94,7 @@ SourceViewer::SourceViewer(QWebFrame* frame, const QString &selectedHtml) m_actionPaste->setShortcut(QKeySequence("Ctrl+V")); QMenu* menuView = new QMenu(tr("View")); - menuView->addAction(IconProvider::standardIcon(QStyle::SP_BrowserReload), tr("Reload"), this, SLOT(reload()))->setShortcut(QKeySequence("F5")); + menuView->addAction(qIconProvider->standardIcon(QStyle::SP_BrowserReload), tr("Reload"), this, SLOT(reload()))->setShortcut(QKeySequence("F5")); menuView->addSeparator(); menuView->addAction(tr("Editable"), this, SLOT(setTextEditable()))->setCheckable(true); menuView->addAction(tr("Word Wrap"), this, SLOT(setTextWordWrap()))->setCheckable(true); diff --git a/src/lib/other/sourceviewersearch.cpp b/src/lib/other/sourceviewersearch.cpp index ca97f87ac..fe5e240df 100644 --- a/src/lib/other/sourceviewersearch.cpp +++ b/src/lib/other/sourceviewersearch.cpp @@ -31,11 +31,11 @@ SourceViewerSearch::SourceViewerSearch(SourceViewer* parent) { setAttribute(Qt::WA_DeleteOnClose); ui->setupUi(widget()); - ui->closeButton->setIcon(IconProvider::standardIcon(QStyle::SP_DialogCloseButton)); + ui->closeButton->setIcon(qIconProvider->standardIcon(QStyle::SP_DialogCloseButton)); - ui->next->setIcon(IconProvider::standardIcon(QStyle::SP_ArrowForward)); + ui->next->setIcon(qIconProvider->standardIcon(QStyle::SP_ArrowForward)); - ui->previous->setIcon(IconProvider::standardIcon(QStyle::SP_ArrowBack)); + ui->previous->setIcon(qIconProvider->standardIcon(QStyle::SP_ArrowBack)); ui->lineEdit->setFocus(); connect(ui->closeButton, SIGNAL(clicked()), this, SLOT(hide())); connect(ui->lineEdit, SIGNAL(textEdited(QString)), this, SLOT(next())); diff --git a/src/lib/popupwindow/popuplocationbar.cpp b/src/lib/popupwindow/popuplocationbar.cpp index 82f3ad84b..07bacd30e 100644 --- a/src/lib/popupwindow/popuplocationbar.cpp +++ b/src/lib/popupwindow/popuplocationbar.cpp @@ -45,7 +45,7 @@ PopupLocationBar::PopupLocationBar(QWidget* parent) , m_view(0) { m_siteIcon = new PopupSiteIcon(this); - m_siteIcon->setIcon(IconProvider::emptyWebIcon()); + m_siteIcon->setIcon(qIconProvider->emptyWebIcon()); m_siteIcon->setFixedSize(20, 26); addWidget(m_siteIcon, LineEdit::LeftSide); diff --git a/src/lib/rss/rssmanager.cpp b/src/lib/rss/rssmanager.cpp index ebcfbd2eb..8a4861c04 100644 --- a/src/lib/rss/rssmanager.cpp +++ b/src/lib/rss/rssmanager.cpp @@ -49,7 +49,7 @@ RSSManager::RSSManager(QupZilla* mainClass, QWidget* parent) m_reloadButton = new QToolButton(this); m_reloadButton->setAutoRaise(true); m_reloadButton->setToolTip(tr("Reload")); - m_reloadButton->setIcon(IconProvider::standardIcon(QStyle::SP_BrowserReload)); + m_reloadButton->setIcon(qIconProvider->standardIcon(QStyle::SP_BrowserReload)); ui->tabWidget->setCornerWidget(m_reloadButton); @@ -85,7 +85,7 @@ void RSSManager::refreshTable() while (query.next()) { QUrl address = query.value(0).toUrl(); QString title = query.value(1).toString(); - QIcon icon = IconProvider::iconFromImage(QImage::fromData(query.value(2).toByteArray())); + QIcon icon = qIconProvider->iconFromImage(QImage::fromData(query.value(2).toByteArray())); TreeWidget* tree = new TreeWidget(); tree->setHeaderLabel(tr("News")); tree->setContextMenuPolicy(Qt::CustomContextMenu); @@ -385,7 +385,7 @@ bool RSSManager::addRssFeed(const QUrl &url, const QString &title, const QIcon & if (!query.next()) { QImage image = icon.pixmap(16, 16).toImage(); - if (image == IconProvider::emptyWebImage()) { + if (image == qIconProvider->emptyWebImage()) { image.load(":icons/other/feed.png"); } diff --git a/src/lib/rss/rssnotification.cpp b/src/lib/rss/rssnotification.cpp index 52b870f98..8577aebd7 100644 --- a/src/lib/rss/rssnotification.cpp +++ b/src/lib/rss/rssnotification.cpp @@ -27,7 +27,7 @@ RSSNotification::RSSNotification(QString host, QWidget* parent) { setAttribute(Qt::WA_DeleteOnClose); ui->setupUi(widget()); - ui->closeButton->setIcon(IconProvider::standardIcon(QStyle::SP_DialogCloseButton)); + ui->closeButton->setIcon(qIconProvider->standardIcon(QStyle::SP_DialogCloseButton)); ui->label->setText(QupZilla::tr("You have successfully added RSS feed \"%1\".").arg(host)); connect(ui->pushButton, SIGNAL(clicked()), mApp->getWindow(), SLOT(showRSSManager())); diff --git a/src/lib/sidebar/bookmarkssidebar.cpp b/src/lib/sidebar/bookmarkssidebar.cpp index c9511195c..ca49eac77 100644 --- a/src/lib/sidebar/bookmarkssidebar.cpp +++ b/src/lib/sidebar/bookmarkssidebar.cpp @@ -131,7 +131,7 @@ void BookmarksSideBar::addBookmark(const BookmarksModel::Bookmark &bookmark) item->setText(0, bookmark.title); item->setText(1, bookmark.url.toEncoded()); item->setData(0, Qt::UserRole + 10, bookmark.id); - item->setIcon(0, IconProvider::iconFromImage(bookmark.image)); + item->setIcon(0, qIconProvider->iconFromImage(bookmark.image)); item->setToolTip(0, bookmark.url.toEncoded()); if (bookmark.folder != "unsorted") { @@ -244,7 +244,7 @@ void BookmarksSideBar::refreshTable() QUrl url = query.value(1).toUrl(); int id = query.value(2).toInt(); QString folder = query.value(3).toString(); - QIcon icon = IconProvider::iconFromImage(QImage::fromData(query.value(4).toByteArray())); + QIcon icon = qIconProvider->iconFromImage(QImage::fromData(query.value(4).toByteArray())); QTreeWidgetItem* item; if (folder == "bookmarksMenu") { folder = _bookmarksMenu; diff --git a/src/lib/tools/docktitlebarwidget.cpp b/src/lib/tools/docktitlebarwidget.cpp index 88c40bf3a..e716922a8 100644 --- a/src/lib/tools/docktitlebarwidget.cpp +++ b/src/lib/tools/docktitlebarwidget.cpp @@ -22,7 +22,7 @@ DockTitleBarWidget::DockTitleBarWidget(const QString &title, QWidget* parent) : QWidget(parent) { setupUi(this); - closeButton->setIcon(QIcon(IconProvider::standardIcon(QStyle::SP_DialogCloseButton).pixmap(16, 16))); + closeButton->setIcon(QIcon(qIconProvider->standardIcon(QStyle::SP_DialogCloseButton).pixmap(16, 16))); label->setText(title); connect(closeButton, SIGNAL(clicked()), parent, SLOT(close())); diff --git a/src/lib/tools/iconprovider.cpp b/src/lib/tools/iconprovider.cpp index 08aa96fc4..7ef2f40b6 100644 --- a/src/lib/tools/iconprovider.cpp +++ b/src/lib/tools/iconprovider.cpp @@ -23,10 +23,10 @@ #include #include -QImage IconProvider::m_emptyWebImage; +IconProvider* IconProvider::s_instance = 0; -IconProvider::IconProvider(QObject* parent) - : QObject(parent) +IconProvider::IconProvider(QWidget* parent) + : QWidget(parent) { m_timer = new QTimer(this); m_timer->setInterval(10 * 1000); @@ -35,6 +35,15 @@ IconProvider::IconProvider(QObject* parent) connect(m_timer, SIGNAL(timeout()), this, SLOT(saveIconsToDatabase())); } +IconProvider *IconProvider::instance() +{ + if (!s_instance) { + s_instance = new IconProvider; + } + + return s_instance; +} + void IconProvider::saveIcon(WebView* view) { if (mApp->webSettings()->testAttribute(QWebSettings::PrivateBrowsingEnabled)) { @@ -210,6 +219,16 @@ QImage IconProvider::emptyWebImage() return m_emptyWebImage; } +QPixmap IconProvider::bookmarkIcon() +{ + return m_bookmarkIcon; +} + +void IconProvider::setBookmarkIcon(const QPixmap &pixmap) +{ + m_bookmarkIcon = pixmap; +} + QIcon IconProvider::iconFromImage(const QImage &image) { if (m_emptyWebImage.isNull()) { @@ -245,7 +264,3 @@ QByteArray IconProvider::iconToBase64(const QIcon &icon) buffer.close(); return bArray.toBase64(); } - -IconProvider::~IconProvider() -{ -} diff --git a/src/lib/tools/iconprovider.h b/src/lib/tools/iconprovider.h index 69291ad00..6674d221a 100644 --- a/src/lib/tools/iconprovider.h +++ b/src/lib/tools/iconprovider.h @@ -18,9 +18,10 @@ #ifndef ICONPROVIDER_H #define ICONPROVIDER_H -#define _iconForUrl(url) IconProvider::iconFromImage(mApp->iconProvider()->iconForUrl(url)) +#define qIconProvider IconProvider::instance() +#define _iconForUrl(url) qIconProvider->iconFromImage(qIconProvider->iconForUrl(url)) -#include +#include #include #include #include @@ -32,12 +33,16 @@ class QIcon; class WebView; -class QT_QUPZILLA_EXPORT IconProvider : public QObject +// Needs to be QWidget subclass, otherwise qproperty- setting won't work +class QT_QUPZILLA_EXPORT IconProvider : public QWidget { Q_OBJECT + Q_PROPERTY(QPixmap bookmarkIcon READ bookmarkIcon WRITE setBookmarkIcon) + public: - explicit IconProvider(QObject* parent = 0); - ~IconProvider(); + explicit IconProvider(QWidget* parent = 0); + + static IconProvider* instance(); void clearIconDatabase(); @@ -45,16 +50,19 @@ public: QImage iconForUrl(const QUrl &url); QImage iconForDomain(const QUrl &url); - static QIcon iconFromImage(const QImage &image); + QIcon iconFromImage(const QImage &image); - static QIcon iconFromBase64(const QByteArray &data); - static QByteArray iconToBase64(const QIcon &icon); + QIcon iconFromBase64(const QByteArray &data); + QByteArray iconToBase64(const QIcon &icon); - static QIcon standardIcon(QStyle::StandardPixmap icon); - static QIcon fromTheme(const QString &icon); + QIcon standardIcon(QStyle::StandardPixmap icon); + QIcon fromTheme(const QString &icon); - static QIcon emptyWebIcon(); - static QImage emptyWebImage(); + QIcon emptyWebIcon(); + QImage emptyWebImage(); + + QPixmap bookmarkIcon(); + void setBookmarkIcon(const QPixmap &pixmap); signals: @@ -69,9 +77,12 @@ private: QImage image; }; - static QImage m_emptyWebImage; - QList m_iconBuffer; + static IconProvider* s_instance; + QImage m_emptyWebImage; + QPixmap m_bookmarkIcon; + + QList m_iconBuffer; }; #endif // ICONPROVIDER_H diff --git a/src/lib/webview/searchtoolbar.cpp b/src/lib/webview/searchtoolbar.cpp index de7165a3f..8964fec45 100644 --- a/src/lib/webview/searchtoolbar.cpp +++ b/src/lib/webview/searchtoolbar.cpp @@ -33,9 +33,9 @@ SearchToolBar::SearchToolBar(QupZilla* mainClass, QWidget* parent) setAttribute(Qt::WA_DeleteOnClose); ui->setupUi(widget()); - ui->closeButton->setIcon(IconProvider::standardIcon(QStyle::SP_DialogCloseButton)); - ui->next->setIcon(IconProvider::standardIcon(QStyle::SP_ArrowForward)); - ui->previous->setIcon(IconProvider::standardIcon(QStyle::SP_ArrowBack)); + ui->closeButton->setIcon(qIconProvider->standardIcon(QStyle::SP_DialogCloseButton)); + ui->next->setIcon(qIconProvider->standardIcon(QStyle::SP_ArrowForward)); + ui->previous->setIcon(qIconProvider->standardIcon(QStyle::SP_ArrowBack)); connect(ui->closeButton, SIGNAL(clicked()), this, SLOT(hide())); connect(ui->lineEdit, SIGNAL(textChanged(QString)), this, SLOT(findNext())); diff --git a/src/lib/webview/tabbar.cpp b/src/lib/webview/tabbar.cpp index 806b81aa7..b649d329b 100644 --- a/src/lib/webview/tabbar.cpp +++ b/src/lib/webview/tabbar.cpp @@ -138,10 +138,10 @@ void TabBar::contextMenuRequested(const QPoint &position) return; } if (p_QupZilla->weView(m_clickedTab)->isLoading()) { - menu.addAction(IconProvider::standardIcon(QStyle::SP_BrowserStop), tr("&Stop Tab"), this, SLOT(stopTab())); + menu.addAction(qIconProvider->standardIcon(QStyle::SP_BrowserStop), tr("&Stop Tab"), this, SLOT(stopTab())); } else { - menu.addAction(IconProvider::standardIcon(QStyle::SP_BrowserReload), tr("&Reload Tab"), this, SLOT(reloadTab())); + menu.addAction(qIconProvider->standardIcon(QStyle::SP_BrowserReload), tr("&Reload Tab"), this, SLOT(reloadTab())); } menu.addAction(tr("&Duplicate Tab"), this, SLOT(duplicateTab())); diff --git a/src/lib/webview/tabbedwebview.cpp b/src/lib/webview/tabbedwebview.cpp index aaf73d4d0..9a188070a 100644 --- a/src/lib/webview/tabbedwebview.cpp +++ b/src/lib/webview/tabbedwebview.cpp @@ -196,7 +196,7 @@ void TabbedWebView::showIcon() QIcon icon_ = icon(); if (icon_.isNull()) { - icon_ = IconProvider::emptyWebIcon(); + icon_ = qIconProvider->emptyWebIcon(); } m_tabWidget->setTabIcon(tabIndex(), icon_); diff --git a/src/lib/webview/tabwidget.cpp b/src/lib/webview/tabwidget.cpp index cc671647b..dbf354fc8 100644 --- a/src/lib/webview/tabwidget.cpp +++ b/src/lib/webview/tabwidget.cpp @@ -280,7 +280,7 @@ int TabWidget::addView(QNetworkRequest req, const QString &title, const Qz::NewT locBar->setWebView(webView); setTabText(index, title); - setTabIcon(index, IconProvider::emptyWebIcon()); + setTabIcon(index, qIconProvider->emptyWebIcon()); if (openFlags & Qz::NT_SelectedTab) { setCurrentIndex(index); diff --git a/src/lib/webview/webpage.cpp b/src/lib/webview/webpage.cpp index c09047c64..28af5c855 100644 --- a/src/lib/webview/webpage.cpp +++ b/src/lib/webview/webpage.cpp @@ -304,7 +304,7 @@ void WebPage::handleUnknownProtocol(const QUrl &url) dialog.setText(text); dialog.setCheckBoxText(tr("Remember my choice for this protocol")); dialog.setWindowTitle(tr("External Protocol Request")); - dialog.setIcon(IconProvider::standardIcon(QStyle::SP_MessageBoxQuestion)); + dialog.setIcon(qIconProvider->standardIcon(QStyle::SP_MessageBoxQuestion)); switch (dialog.exec()) { case QDialog::Accepted: @@ -654,8 +654,8 @@ bool WebPage::extension(Extension extension, const ExtensionOption* option, Exte QString errString = file.readAll(); errString.replace("%TITLE%", tr("Failed loading page")); - errString.replace("%IMAGE%", qz_pixmapToByteArray(IconProvider::standardIcon(QStyle::SP_MessageBoxWarning).pixmap(45, 45))); - errString.replace("%FAVICON%", qz_pixmapToByteArray(IconProvider::standardIcon(QStyle::SP_MessageBoxWarning).pixmap(16, 16))); + errString.replace("%IMAGE%", qz_pixmapToByteArray(qIconProvider->standardIcon(QStyle::SP_MessageBoxWarning).pixmap(45, 45))); + errString.replace("%FAVICON%", qz_pixmapToByteArray(qIconProvider->standardIcon(QStyle::SP_MessageBoxWarning).pixmap(16, 16))); errString.replace("%BOX-BORDER%", "qrc:html/box-border.png"); errString.replace("%HEADING%", errorString); @@ -771,7 +771,7 @@ void WebPage::javaScriptAlert(QWebFrame* originatingFrame, const QString &msg) dialog.setWindowTitle(title); dialog.setText(msg); dialog.setCheckBoxText(tr("Prevent this page from creating additional dialogs")); - dialog.setIcon(IconProvider::standardIcon(QStyle::SP_MessageBoxInformation)); + dialog.setIcon(qIconProvider->standardIcon(QStyle::SP_MessageBoxInformation)); dialog.exec(); m_blockAlerts = dialog.isChecked(); diff --git a/src/lib/webview/webview.cpp b/src/lib/webview/webview.cpp index 5bb894336..bac3f348a 100644 --- a/src/lib/webview/webview.cpp +++ b/src/lib/webview/webview.cpp @@ -352,7 +352,7 @@ void WebView::slotIconChanged() m_siteIcon = icon(); m_siteIconUrl = url(); - mApp->iconProvider()->saveIcon(this); + qIconProvider->saveIcon(this); } } @@ -613,8 +613,8 @@ void WebView::createContextMenu(QMenu* menu, const QWebHitTestResult &hitTest, c pageAction(QWebPage::Paste)->setIcon(QIcon::fromTheme("edit-paste")); pageAction(QWebPage::SelectAll)->setIcon(QIcon::fromTheme("edit-select-all")); - m_actionReload = new QAction(IconProvider::standardIcon(QStyle::SP_BrowserReload), tr("&Reload"), this); - m_actionStop = new QAction(IconProvider::standardIcon(QStyle::SP_BrowserStop), tr("S&top"), this); + m_actionReload = new QAction(qIconProvider->standardIcon(QStyle::SP_BrowserReload), tr("&Reload"), this); + m_actionStop = new QAction(qIconProvider->standardIcon(QStyle::SP_BrowserStop), tr("S&top"), this); connect(m_actionReload, SIGNAL(triggered()), this, SLOT(reload())); connect(m_actionStop, SIGNAL(triggered()), this, SLOT(stop())); @@ -698,11 +698,11 @@ void WebView::createPageContextMenu(QMenu* menu, const QPoint &pos) QWebFrame* frameAtPos = page()->frameAt(pos); QAction* action = menu->addAction(tr("&Back"), this, SLOT(back())); - action->setIcon(IconProvider::standardIcon(QStyle::SP_ArrowBack)); + action->setIcon(qIconProvider->standardIcon(QStyle::SP_ArrowBack)); action->setEnabled(history()->canGoBack()); action = menu->addAction(tr("&Forward"), this, SLOT(forward())); - action->setIcon(IconProvider::standardIcon(QStyle::SP_ArrowForward)); + action->setIcon(qIconProvider->standardIcon(QStyle::SP_ArrowForward)); action->setEnabled(history()->canGoForward()); menu->addAction(m_actionReload); @@ -715,7 +715,7 @@ void WebView::createPageContextMenu(QMenu* menu, const QPoint &pos) frameMenu->addAction(tr("Show &only this frame"), this, SLOT(loadClickedFrame())); frameMenu->addAction(QIcon(":/icons/menu/popup.png"), tr("Show this frame in new &tab"), this, SLOT(loadClickedFrameInNewTab())); frameMenu->addSeparator(); - frameMenu->addAction(IconProvider::standardIcon(QStyle::SP_BrowserReload), tr("&Reload"), this, SLOT(reloadClickedFrame())); + frameMenu->addAction(qIconProvider->standardIcon(QStyle::SP_BrowserReload), tr("&Reload"), this, SLOT(reloadClickedFrame())); frameMenu->addAction(QIcon::fromTheme("document-print"), tr("Print frame"), this, SLOT(printClickedFrame())); frameMenu->addSeparator(); frameMenu->addAction(QIcon::fromTheme("zoom-in"), tr("Zoom &in"), this, SLOT(clickedFrameZoomIn())); @@ -728,7 +728,7 @@ void WebView::createPageContextMenu(QMenu* menu, const QPoint &pos) } menu->addSeparator(); - menu->addAction(IconProvider::fromTheme("user-bookmarks"), tr("Book&mark page"), this, SLOT(bookmarkLink())); + menu->addAction(qIconProvider->fromTheme("user-bookmarks"), tr("Book&mark page"), this, SLOT(bookmarkLink())); menu->addAction(QIcon::fromTheme("document-save"), tr("&Save page as..."), this, SLOT(downloadPage())); menu->addAction(QIcon::fromTheme("edit-copy"), tr("&Copy page link"), this, SLOT(copyLinkToClipboard()))->setData(url()); menu->addAction(QIcon::fromTheme("mail-message-new"), tr("Send page link..."), this, SLOT(sendPageByMail())); @@ -757,7 +757,7 @@ void WebView::createLinkContextMenu(QMenu* menu, const QWebHitTestResult &hitTes menu->addAction(QIcon(":/icons/menu/popup.png"), tr("Open link in new &tab"), this, SLOT(openUrlInBackgroundTab()))->setData(hitTest.linkUrl()); menu->addAction(QIcon::fromTheme("window-new"), tr("Open link in new &window"), this, SLOT(openUrlInNewWindow()))->setData(hitTest.linkUrl()); menu->addSeparator(); - menu->addAction(IconProvider::fromTheme("user-bookmarks"), tr("B&ookmark link"), this, SLOT(bookmarkLink()))->setData(hitTest.linkUrl()); + menu->addAction(qIconProvider->fromTheme("user-bookmarks"), tr("B&ookmark link"), this, SLOT(bookmarkLink()))->setData(hitTest.linkUrl()); menu->addAction(QIcon::fromTheme("document-save"), tr("&Save link as..."), this, SLOT(downloadUrlToDisk()))->setData(hitTest.linkUrl()); menu->addAction(QIcon::fromTheme("mail-message-new"), tr("Send link..."), this, SLOT(sendLinkByMail()))->setData(hitTest.linkUrl()); menu->addAction(QIcon::fromTheme("edit-copy"), tr("&Copy link address"), this, SLOT(copyLinkToClipboard()))->setData(hitTest.linkUrl());