From efed1601e5f6e79d746866d55d625d777b64a248 Mon Sep 17 00:00:00 2001 From: Soren Stoutner Date: Mon, 17 Apr 2023 11:50:14 -0700 Subject: [PATCH] Fix missing icons on Gnome. https://redmine.stoutner.com/issues/993 --- src/dialogs/SaveDialog.cpp | 2 +- src/dialogs/SaveDialog.h | 2 +- src/icons/privacybrowser-symbolic.svg | 2 +- src/icons/sc-apps-privacybrowser.svg | 42 +++++---- src/ui.rcs/browserwindowui.rc | 4 +- src/widgets/TabWidget.cpp | 46 +++++++--- src/widgets/TabWidget.h | 3 +- src/windows/BrowserWindow.cpp | 127 ++++++++++++++++++++------ 8 files changed, 158 insertions(+), 70 deletions(-) diff --git a/src/dialogs/SaveDialog.cpp b/src/dialogs/SaveDialog.cpp index f1c1d99..5e96916 100644 --- a/src/dialogs/SaveDialog.cpp +++ b/src/dialogs/SaveDialog.cpp @@ -113,7 +113,7 @@ SaveDialog::SaveDialog(QUrl &url, QString &mimeTypeString, int totalBytes, QStri void SaveDialog::showFilePicker() { // Show the file picker dialog. - emit useNativeDownloader(downloadUrl, suggestedFileName); + emit useNativeKdeDownloader(downloadUrl, suggestedFileName); // Close the dialog. reject(); diff --git a/src/dialogs/SaveDialog.h b/src/dialogs/SaveDialog.h index 1f4ae2e..a3ce841 100644 --- a/src/dialogs/SaveDialog.h +++ b/src/dialogs/SaveDialog.h @@ -36,7 +36,7 @@ public: signals: // The signals. - void useNativeDownloader(QUrl &downloadUrl, QString &suggestedFileName); + void useNativeKdeDownloader(QUrl &downloadUrl, QString &suggestedFileName); private Q_SLOTS: // The private slots. diff --git a/src/icons/privacybrowser-symbolic.svg b/src/icons/privacybrowser-symbolic.svg index 099237d..9649f6f 100644 --- a/src/icons/privacybrowser-symbolic.svg +++ b/src/icons/privacybrowser-symbolic.svg @@ -29,4 +29,4 @@ You should have received a copy of the GNU General Public License along with Privacy Browser PC. If not, see . - This copyright notice is moved to the bottom of the file to make Gnome's SVG parser happy.--> + This copyright notice is moved to the bottom of the file to make Gnome's SVG parser happy. --> diff --git a/src/icons/sc-apps-privacybrowser.svg b/src/icons/sc-apps-privacybrowser.svg index a9b4e7e..19bf69f 100644 --- a/src/icons/sc-apps-privacybrowser.svg +++ b/src/icons/sc-apps-privacybrowser.svg @@ -1,25 +1,5 @@ - - @@ -45,3 +25,25 @@ d="m 127.92021,-183.78553 c -44.041614,0 -79.705747,35.74391 -79.705747,79.78553 0,44.041617 35.664133,79.785537 79.705747,79.785537 44.1214,0 79.86533,-35.74392 79.86533,-79.785537 0,-44.04162 -35.74393,-79.78553 -79.86533,-79.78553 z m 55.29138,47.87132 h -23.53674 c -2.55313,-9.9732 -6.22326,-19.54746 -11.0104,-28.40365 14.68055,5.02648 26.88773,15.23903 34.54714,28.40365 z M 128,-167.50929 c 6.6222,9.57427 11.80825,20.18574 15.23903,31.59508 h -30.47807 c 3.43078,-11.40934 8.61684,-22.02081 15.23904,-31.59508 z M 66.245993,-88.042889 C 64.969425,-93.149168 64.171571,-98.494798 64.171571,-104 c 0,-5.5052 0.797855,-10.85083 2.074422,-15.95711 h 26.96751 c -0.63829,5.26585 -1.117,10.5317 -1.117,15.95711 0,5.425417 0.47872,10.691263 1.117,15.957111 z m 6.542412,15.957108 H 96.32514 c 2.553137,9.973191 6.22327,19.547449 11.0104,28.403644 C 92.655006,-48.708619 80.44782,-58.841391 72.788405,-72.085781 Z M 96.32514,-135.91421 H 72.788405 c 7.659415,-13.2444 19.866601,-23.37717 34.547135,-28.40365 -4.78713,8.85619 -8.457263,18.43045 -11.0104,28.40365 z M 128,-40.49071 c -6.6222,-9.574268 -11.80826,-20.185747 -15.23904,-31.595071 h 30.47807 C 139.80825,-60.676457 134.6222,-50.064978 128,-40.49071 Z m 18.66982,-47.552179 h -37.33964 c -0.71801,-5.265848 -1.27656,-10.531694 -1.27656,-15.957111 0,-5.42541 0.55854,-10.77105 1.27656,-15.95711 h 37.33964 c 0.71811,5.18606 1.27656,10.5317 1.27656,15.95711 0,5.425417 -0.55844,10.691263 -1.27656,15.957111 z m 1.99463,44.360752 c 4.78714,-8.856195 8.45727,-18.430453 11.0104,-28.403644 h 23.53674 c -7.65941,13.164605 -19.86659,23.377162 -34.54714,28.403644 z m 14.12204,-44.360752 c 0.63828,-5.265848 1.117,-10.531694 1.117,-15.957111 0,-5.42541 -0.47871,-10.69126 -1.117,-15.95711 h 26.96752 c 1.27656,5.10628 2.07441,10.45191 2.07441,15.95711 0,5.505202 -0.79784,10.850832 -2.07441,15.957111 z" /> + + diff --git a/src/ui.rcs/browserwindowui.rc b/src/ui.rcs/browserwindowui.rc index 186b784..12eb32d 100644 --- a/src/ui.rcs/browserwindowui.rc +++ b/src/ui.rcs/browserwindowui.rc @@ -38,7 +38,7 @@ On-The-Fly Settings - + @@ -54,7 +54,7 @@ - + diff --git a/src/widgets/TabWidget.cpp b/src/widgets/TabWidget.cpp index 76ff617..cbb84b3 100644 --- a/src/widgets/TabWidget.cpp +++ b/src/widgets/TabWidget.cpp @@ -49,6 +49,22 @@ QString TabWidget::webEngineDefaultUserAgent = QLatin1String(""); // Construct the class. TabWidget::TabWidget(QWidget *parent) : QWidget(parent) { + // Create a QProcess to check if KDE is running. + QProcess *checkIfRunningKdeQProcessPointer = new QProcess(); + + // Create an argument string list that contains `ksmserver` (KDE Session Manager). + QStringList argument = QStringList(QLatin1String("ksmserver")); + + // Run `pidof` to check for the presence of `ksmserver`. + checkIfRunningKdeQProcessPointer->start(QLatin1String("pidof"), argument); + + // Monitor any standard output. + connect(checkIfRunningKdeQProcessPointer, &QProcess::readyReadStandardOutput, [this] + { + // If there is any standard output, `ksmserver` is running. + isRunningKde = true; + }); + // Instantiate the user agent helper. userAgentHelperPointer = new UserAgentHelper(); @@ -169,7 +185,7 @@ PrivacyWebEngineView* TabWidget::addTab(const bool removeUrlLineEditFocus, const QWebEngineSettings *webEngineSettingsPointer = webEnginePagePointer->settings(); // Update the URL line edit when the URL changes. - connect(privacyWebEngineViewPointer, &PrivacyWebEngineView::urlChanged, [privacyWebEngineViewPointer, this] (const QUrl &newUrl) + connect(privacyWebEngineViewPointer, &PrivacyWebEngineView::urlChanged, [this, privacyWebEngineViewPointer] (const QUrl &newUrl) { // Only update the UI if this is the current tab. if (privacyWebEngineViewPointer == currentPrivacyWebEngineViewPointer) @@ -198,7 +214,7 @@ PrivacyWebEngineView* TabWidget::addTab(const bool removeUrlLineEditFocus, const }); // Connect the loading favorite icon movie to the tab icon. - connect(loadingFavoriteIconMoviePointer, &QMovie::frameChanged, [privacyWebEngineViewPointer, this] + connect(loadingFavoriteIconMoviePointer, &QMovie::frameChanged, [this, privacyWebEngineViewPointer] { // Get the index for this tab. int tabIndex = qTabWidgetPointer->indexOf(privacyWebEngineViewPointer); @@ -209,7 +225,7 @@ PrivacyWebEngineView* TabWidget::addTab(const bool removeUrlLineEditFocus, const }); // Update the icon when it changes. - connect(privacyWebEngineViewPointer, &PrivacyWebEngineView::iconChanged, [privacyWebEngineViewPointer, this] (const QIcon &newFavoriteIcon) + connect(privacyWebEngineViewPointer, &PrivacyWebEngineView::iconChanged, [this, privacyWebEngineViewPointer] (const QIcon &newFavoriteIcon) { // Store the favorite icon in the privacy web engine view. if (newFavoriteIcon.isNull()) @@ -228,7 +244,7 @@ PrivacyWebEngineView* TabWidget::addTab(const bool removeUrlLineEditFocus, const }); // Update the progress bar and the favorite icon when a load is started. - connect(privacyWebEngineViewPointer, &PrivacyWebEngineView::loadStarted, [privacyWebEngineViewPointer, this] () + connect(privacyWebEngineViewPointer, &PrivacyWebEngineView::loadStarted, [this, privacyWebEngineViewPointer] () { // Set the privacy web engine view to be loading. privacyWebEngineViewPointer->isLoading = true; @@ -245,7 +261,7 @@ PrivacyWebEngineView* TabWidget::addTab(const bool removeUrlLineEditFocus, const }); // Update the progress bar when a load progresses. - connect(privacyWebEngineViewPointer, &PrivacyWebEngineView::loadProgress, [privacyWebEngineViewPointer, this] (const int progress) + connect(privacyWebEngineViewPointer, &PrivacyWebEngineView::loadProgress, [this, privacyWebEngineViewPointer] (const int progress) { // Store the load progress. privacyWebEngineViewPointer->loadProgressInt = progress; @@ -256,7 +272,7 @@ PrivacyWebEngineView* TabWidget::addTab(const bool removeUrlLineEditFocus, const }); // Update the progress bar when a load finishes. - connect(privacyWebEngineViewPointer, &PrivacyWebEngineView::loadFinished, [privacyWebEngineViewPointer, this] () + connect(privacyWebEngineViewPointer, &PrivacyWebEngineView::loadFinished, [this, privacyWebEngineViewPointer] () { // Set the privacy web engine view to be not loading. privacyWebEngineViewPointer->isLoading = false; @@ -294,7 +310,7 @@ PrivacyWebEngineView* TabWidget::addTab(const bool removeUrlLineEditFocus, const }); // Display HTTP Ping blocked dialogs. - connect(privacyWebEngineViewPointer, &PrivacyWebEngineView::displayHttpPingBlockedDialog, [privacyWebEngineViewPointer, this] (const QString &httpPingUrl) + connect(privacyWebEngineViewPointer, &PrivacyWebEngineView::displayHttpPingBlockedDialog, [this, privacyWebEngineViewPointer] (const QString &httpPingUrl) { // Only display the HTTP Ping blocked dialog if this is the current tab. if (privacyWebEngineViewPointer == currentPrivacyWebEngineViewPointer) @@ -391,7 +407,7 @@ PrivacyWebEngineView* TabWidget::addTab(const bool removeUrlLineEditFocus, const webEngineSettingsPointer->setAttribute(QWebEngineSettings::PluginsEnabled, true); // Update the cookies action. - connect(privacyWebEngineViewPointer, &PrivacyWebEngineView::updateCookiesAction, [privacyWebEngineViewPointer, this] (const int numberOfCookies) + connect(privacyWebEngineViewPointer, &PrivacyWebEngineView::updateCookiesAction, [this, privacyWebEngineViewPointer] (const int numberOfCookies) { // Update the cookie action if the specified privacy WebEngine view is the current privacy WebEngine view. if (privacyWebEngineViewPointer == currentPrivacyWebEngineViewPointer) @@ -587,7 +603,7 @@ void TabWidget::findText(const QString &text) const void TabWidget::findTextFinished(const QWebEngineFindTextResult &findTextResult) { - // Update the find text UI if it wasn't simply wiping the current find text selection. Otherwise the UI temporarially flashes `0/0`. + // Update the find text UI if it wasn't simply wiping the current find text selection. Otherwise the UI temporarily flashes `0/0`. if (wipingCurrentFindTextSelection) // The current selection is being wiped. { // Reset the flag. @@ -799,8 +815,8 @@ void TabWidget::showSaveDialog(QWebEngineDownloadItem *webEngineDownloadItemPoin QString suggestedFileName = webEngineDownloadItemPointer->suggestedFileName(); int totalBytes = webEngineDownloadItemPointer->totalBytes(); - // Check to see if local storage (cookies) is enabled. - if (currentPrivacyWebEngineViewPointer->localStorageEnabled) // Local storage (cookies) is enabled. Use WebEngine's downloader. + // Check to see if Privacy Browser is not running KDE or if local storage (cookies) is enabled. + if (!isRunningKde || currentPrivacyWebEngineViewPointer->localStorageEnabled) // KDE is not running or local storage (cookies) is enabled. Use WebEngine's downloader. { // Instantiate the save dialog. SaveDialog *saveDialogPointer = new SaveDialog(downloadUrl, mimeTypeString, totalBytes); @@ -818,7 +834,7 @@ void TabWidget::showSaveDialog(QWebEngineDownloadItem *webEngineDownloadItemPoin if (downloadDirectory == QLatin1String("System Download Directory")) downloadDirectory = QStandardPaths::writableLocation(QStandardPaths::DownloadLocation); - // Display a save file dialog. + // Get a file path from the file picker. QString saveFilePath = QFileDialog::getSaveFileName(this, i18nc("Save file dialog caption", "Save File"), downloadDirectory + QLatin1Char('/') + suggestedFileName); // Process the save file path. @@ -938,14 +954,14 @@ void TabWidget::showSaveDialog(QWebEngineDownloadItem *webEngineDownloadItemPoin webEngineDownloadItemPointer->cancel(); } } - else // Local storage (cookies) is disabled. Use KDE's native downloader. + else // KDE is running and local storage (cookies) is disabled. Use KDE's native downloader. // This must use the show command to launch a separate dialog which cancels WebEngine's automatic background download of the file to a temporary location. { // Instantiate the save dialog. `true` instructs it to use the native downloader SaveDialog *saveDialogPointer = new SaveDialog(downloadUrl, mimeTypeString, totalBytes, suggestedFileName, true); // Connect the save button. - connect(saveDialogPointer, SIGNAL(useNativeDownloader(QUrl &, QString &)), this, SLOT(useNativeDownloader(QUrl &, QString &))); + connect(saveDialogPointer, SIGNAL(useNativeKdeDownloader(QUrl &, QString &)), this, SLOT(useNativeKdeDownloader(QUrl &, QString &))); // Show the dialog. saveDialogPointer->show(); @@ -1057,7 +1073,7 @@ void TabWidget::updateUiWithTabSettings() emit hideProgressBar(); } -void TabWidget::useNativeDownloader(QUrl &downloadUrl, QString &suggestedFileName) +void TabWidget::useNativeKdeDownloader(QUrl &downloadUrl, QString &suggestedFileName) { // Get the download directory. QString downloadDirectory = Settings::downloadLocation(); diff --git a/src/widgets/TabWidget.h b/src/widgets/TabWidget.h index 578206c..f0efc1d 100644 --- a/src/widgets/TabWidget.h +++ b/src/widgets/TabWidget.h @@ -123,7 +123,7 @@ private Q_SLOTS: void showSaveDialog(QWebEngineDownloadItem *downloadItemPointer); void updateUiFromWebEngineView(const PrivacyWebEngineView *privacyWebEngineViewPointer) const; void updateUiWithTabSettings(); - void useNativeDownloader(QUrl &downloadUrl, QString &suggestedFileName); + void useNativeKdeDownloader(QUrl &downloadUrl, QString &suggestedFileName); private: // The private variables. @@ -134,6 +134,7 @@ private: QWebEngineProfile *currentWebEngineProfilePointer; QWebEngineSettings *currentWebEngineSettingsPointer; QIcon defaultFavoriteIcon = QIcon::fromTheme(QStringLiteral("globe")); + bool isRunningKde = false; QMovie *loadingFavoriteIconMoviePointer; QString searchEngineUrl; QTabWidget *qTabWidgetPointer; diff --git a/src/windows/BrowserWindow.cpp b/src/windows/BrowserWindow.cpp index fcca8e8..6347ec4 100644 --- a/src/windows/BrowserWindow.cpp +++ b/src/windows/BrowserWindow.cpp @@ -172,30 +172,36 @@ BrowserWindow::BrowserWindow(bool firstWindow) : KXmlGuiWindow() findCaseSensitiveActionPointer->setText(i18nc("Find Case Sensitive action", "Find Case Sensitive")); hideFindTextActionPointer->setText(i18nc("Hide Find Text action", "Hide Find Text")); - // Set the action icons. + // Set the action icons. Gnome doesn't contain some of the icons that KDE has. + // The toolbar icons don't pick up unless the size is explicit, probably because the toolbar ends up being an intermediate size. newTabActionPointer->setIcon(QIcon::fromTheme(QLatin1String("tab-new"))); newWindowActionPointer->setIcon(QIcon::fromTheme(QLatin1String("window-new"))); - userAgentPrivacyBrowserActionPointer->setIcon(QIcon(":/icons/privacy-mode")); - userAgentWebEngineDefaultActionPointer->setIcon(QIcon::fromTheme(QLatin1String("user-group-properties"))); - userAgentFirefoxLinuxActionPointer->setIcon(QIcon::fromTheme(QLatin1String("firefox-esr"))); - userAgentChromiumLinuxActionPointer->setIcon(QIcon::fromTheme(QLatin1String("chromium"))); - userAgentFirefoxWindowsActionPointer->setIcon(QIcon::fromTheme(QLatin1String("firefox-esr"))); - userAgentChromeWindowsActionPointer->setIcon(QIcon::fromTheme(QLatin1String("chromium"))); - userAgentEdgeWindowsActionPointer->setIcon(QIcon::fromTheme(QLatin1String("user-group-properties"))); - userAgentSafariMacosActionPointer->setIcon(QIcon::fromTheme(QLatin1String("user-group-properties"))); - userAgentCustomActionPointer->setIcon(QIcon::fromTheme(QLatin1String("user-group-properties"))); - searchEngineMojeekActionPointer->setIcon(QIcon::fromTheme(QLatin1String("search"))); - searchEngineMonoclesActionPointer->setIcon(QIcon::fromTheme(QLatin1String("search"))); - searchEngineMetagerActionPointer->setIcon(QIcon::fromTheme(QLatin1String("search"))); - searchEngineGoogleActionPointer->setIcon(QIcon::fromTheme(QLatin1String("im-google"))); - searchEngineBingActionPointer->setIcon(QIcon::fromTheme(QLatin1String("search"))); - searchEngineYahooActionPointer->setIcon(QIcon::fromTheme(QLatin1String("im-yahoo"))); - searchEngineCustomActionPointer->setIcon(QIcon::fromTheme(QLatin1String("search"))); - zoomFactorActionPointer->setIcon(QIcon::fromTheme(QLatin1String("zoom"))); - domainSettingsActionPointer->setIcon(QIcon::fromTheme(QLatin1String("settings-configure"))); - cookiesActionPointer->setIcon(QIcon::fromTheme(QLatin1String("preferences-web-browser-cookies"))); - domStorageActionPointer->setIcon(QIcon::fromTheme(QLatin1String("code-class"))); - findCaseSensitiveActionPointer->setIcon(QIcon::fromTheme(QLatin1String("format-text-lowercase"))); + userAgentPrivacyBrowserActionPointer->setIcon(QIcon(":/icons/privacy-mode.svg")); + userAgentWebEngineDefaultActionPointer->setIcon(QIcon::fromTheme(QLatin1String("qtlogo"), QIcon::fromTheme(QLatin1String("user-group-properties"), + QIcon::fromTheme(QLatin1String("contact-new"))))); + userAgentFirefoxLinuxActionPointer->setIcon(QIcon::fromTheme(QLatin1String("firefox-esr"), QIcon::fromTheme(QLatin1String("user-group-properties"), + QIcon::fromTheme(QLatin1String("contact-new"))))); + userAgentChromiumLinuxActionPointer->setIcon(QIcon::fromTheme(QLatin1String("chromium"), QIcon::fromTheme(QLatin1String("user-group-properties"), + QIcon::fromTheme(QLatin1String("contact-new"))))); + userAgentFirefoxWindowsActionPointer->setIcon(QIcon::fromTheme(QLatin1String("firefox-esr"), QIcon::fromTheme(QLatin1String("user-group-properties"), + QIcon::fromTheme(QLatin1String("contact-new"))))); + userAgentChromeWindowsActionPointer->setIcon(QIcon::fromTheme(QLatin1String("chromium"), QIcon::fromTheme(QLatin1String("user-group-properties"), + QIcon::fromTheme(QLatin1String("contact-new"))))); + userAgentEdgeWindowsActionPointer->setIcon(QIcon::fromTheme(QLatin1String("user-group-properties"), QIcon::fromTheme(QLatin1String("contact-new")))); + userAgentSafariMacosActionPointer->setIcon(QIcon::fromTheme(QLatin1String("user-group-properties"), QIcon::fromTheme(QLatin1String("contact-new")))); + userAgentCustomActionPointer->setIcon(QIcon::fromTheme(QLatin1String("user-group-properties"), QIcon::fromTheme(QLatin1String("contact-new")))); + searchEngineMojeekActionPointer->setIcon(QIcon::fromTheme(QLatin1String("edit-find"))); + searchEngineMonoclesActionPointer->setIcon(QIcon::fromTheme(QLatin1String("edit-find"))); + searchEngineMetagerActionPointer->setIcon(QIcon::fromTheme(QLatin1String("edit-find"))); + searchEngineGoogleActionPointer->setIcon(QIcon::fromTheme(QLatin1String("im-google"), QIcon::fromTheme(QLatin1String("edit-find")))); + searchEngineBingActionPointer->setIcon(QIcon::fromTheme(QLatin1String("edit-find"))); + searchEngineYahooActionPointer->setIcon(QIcon::fromTheme(QLatin1String("im-yahoo"), QIcon::fromTheme(QLatin1String("edit-find")))); + searchEngineCustomActionPointer->setIcon(QIcon::fromTheme(QLatin1String("edit-find"))); + zoomFactorActionPointer->setIcon(QIcon::fromTheme(QLatin1String("zoom-fit-best"))); + domainSettingsActionPointer->setIcon(QIcon::fromTheme(QLatin1String("settings-configure"), QIcon::fromTheme(QLatin1String("preferences-desktop")))); + cookiesActionPointer->setIcon(QIcon::fromTheme(QLatin1String("preferences-web-browser-cookies"), QIcon::fromTheme(QLatin1String("appointment-new")))); + domStorageActionPointer->setIcon(QIcon::fromTheme(QLatin1String("code-class"), QIcon(QLatin1String("/usr/share/icons/gnome/32x32/actions/gtk-unindent-ltr.png")))); + findCaseSensitiveActionPointer->setIcon(QIcon::fromTheme(QLatin1String("format-text-lowercase"), QIcon::fromTheme(QLatin1String("/usr/share/icons/gnome/32x32/apps/fonts.png")))); hideFindTextActionPointer->setIcon(QIcon::fromTheme(QLatin1String("window-close-symbolic"))); // Create the key sequences. @@ -788,9 +794,24 @@ void BrowserWindow::showSettingsDialog() // Instantiate a settings config dialog from the settings.kcfg file. configDialogPointer = new KConfigDialog(this, QLatin1String("settings"), kConfigSkeletonPointer); + // Create a settings icon string. + QString settingsIconString; + + // Get a settings icon that matches the theme. + if (QIcon::hasThemeIcon("breeze-settings")) + { + // KDE uses breeze-settings. + settingsIconString = QLatin1String("breeze-settings"); + } + else + { + // Gnome uses preferences-desktop. + settingsIconString = QLatin1String("preferences-desktop"); + } + // Add the settings widgets as config dialog pages. - configDialogPointer->addPage(privacySettingsWidgetPointer, i18nc("Settings tab title", "Privacy"), QLatin1String("privacy-browser")); - configDialogPointer->addPage(generalSettingsWidgetPointer, i18nc("Settings tab title", "General"), QLatin1String("breeze-settings")); + configDialogPointer->addPage(privacySettingsWidgetPointer, i18nc("Settings tab title", "Privacy"), QLatin1String("privacybrowser")); + configDialogPointer->addPage(generalSettingsWidgetPointer, i18nc("Settings tab title", "General"), settingsIconString); configDialogPointer->addPage(spellCheckSettingsWidgetPointer, i18nc("Settings tab title", "Spell Check"), QLatin1String("tools-check-spelling")); // Get handles for the buttons. @@ -1006,9 +1027,9 @@ void BrowserWindow::updateJavaScriptAction(const bool &isEnabled) // Set the icon according to the status. if (javaScriptEnabled) - javaScriptActionPointer->setIcon(QIcon(QStringLiteral(":/icons/javascript-warning"))); + javaScriptActionPointer->setIcon(QIcon(QLatin1String(":/icons/javascript-warning.svg"))); else - javaScriptActionPointer->setIcon(QIcon(QStringLiteral(":/icons/privacy-mode"))); + javaScriptActionPointer->setIcon(QIcon(QLatin1String(":/icons/privacy-mode.svg"))); // Set the action checked status. javaScriptActionPointer->setChecked(javaScriptEnabled); @@ -1022,11 +1043,11 @@ void BrowserWindow::updateLocalStorageAction(const bool &isEnabled) // Update the local storage status. localStorageEnabled = isEnabled; - // Update the icon. + // Update the icon. On Gnome, the toolbar icons don't pick up unless the size is explicit, probably because the toolbar ends up being an intermediate size. if (localStorageEnabled) - localStorageActionPointer->setIcon(QIcon::fromTheme(QStringLiteral("disk-quota-high"))); + localStorageActionPointer->setIcon(QIcon::fromTheme(QLatin1String("disk-quota-high"), QIcon(QLatin1String("/usr/share/icons/gnome/32x32/actions/filesaveas.png")))); else - localStorageActionPointer->setIcon(QIcon::fromTheme(QStringLiteral("disk-quota"))); + localStorageActionPointer->setIcon(QIcon::fromTheme(QLatin1String("disk-quota"), QIcon(QLatin1String("/usr/share/icons/gnome/32x32/apps/kfm.png")))); // Set the action checked status. localStorageActionPointer->setChecked(localStorageEnabled); @@ -1045,6 +1066,9 @@ void BrowserWindow::updateSearchEngineActions(const QString &searchEngine, const // Check the Mojeek user agent action. searchEngineMojeekActionPointer->setChecked(true); + // Update the search engine menu action icon. + searchEngineMenuActionPointer->setIcon(QIcon::fromTheme(QLatin1String("edit-find"))); + // Update the search engine menu action text. searchEngineMenuActionPointer->setText(i18nc("The main search engine menu action", "Search Engine - Mojeek")); } @@ -1053,6 +1077,9 @@ void BrowserWindow::updateSearchEngineActions(const QString &searchEngine, const // Check the Monocles user agent action. searchEngineMonoclesActionPointer->setChecked(true); + // Update the search engine menu action icon. + searchEngineMenuActionPointer->setIcon(QIcon::fromTheme(QLatin1String("edit-find"))); + // Update the search engine menu action text. searchEngineMenuActionPointer->setText(i18nc("The main search engine menu action", "Search Engine - Monocles")); } @@ -1061,6 +1088,9 @@ void BrowserWindow::updateSearchEngineActions(const QString &searchEngine, const // Check the MetaGer user agent action. searchEngineMetagerActionPointer->setChecked(true); + // Update the search engine menu action icon. + searchEngineMenuActionPointer->setIcon(QIcon::fromTheme(QLatin1String("edit-find"))); + // Update the search engine menu action text. searchEngineMenuActionPointer->setText(i18nc("The main search engine menu action", "Search Engine - MetaGer")); } @@ -1069,6 +1099,9 @@ void BrowserWindow::updateSearchEngineActions(const QString &searchEngine, const // Check the Google user agent action. searchEngineGoogleActionPointer->setChecked(true); + // Update the search engine menu action icon. + searchEngineMenuActionPointer->setIcon(QIcon::fromTheme(QLatin1String("im-google"), QIcon::fromTheme(QLatin1String("edit-find")))); + // Update the search engine menu action text. searchEngineMenuActionPointer->setText(i18nc("The main search engine menu action", "Search Engine - Google")); } @@ -1077,6 +1110,9 @@ void BrowserWindow::updateSearchEngineActions(const QString &searchEngine, const // Check the Bing user agent action. searchEngineBingActionPointer->setChecked(true); + // Update the search engine menu action icon. + searchEngineMenuActionPointer->setIcon(QIcon::fromTheme(QLatin1String("edit-find"))); + // Update the search engine menu action text. searchEngineMenuActionPointer->setText(i18nc("The main search engine menu action", "Search Engine - Bing")); } @@ -1085,6 +1121,9 @@ void BrowserWindow::updateSearchEngineActions(const QString &searchEngine, const // Check the Yahoo user agent action. searchEngineYahooActionPointer->setChecked(true); + // Update the search engine menu action icon. + searchEngineMenuActionPointer->setIcon(QIcon::fromTheme(QLatin1String("im-yahoo"), QIcon::fromTheme(QLatin1String("edit-find")))); + // Update the search engine menu action text. searchEngineMenuActionPointer->setText(i18nc("The main search engine menu action", "Search Engine - Yahoo")); } @@ -1093,6 +1132,9 @@ void BrowserWindow::updateSearchEngineActions(const QString &searchEngine, const // Check the user agent. searchEngineCustomActionPointer->setChecked(true); + // Update the search engine menu action icon. + searchEngineMenuActionPointer->setIcon(QIcon::fromTheme(QLatin1String("edit-find"))); + // Update the search engine menu action text. searchEngineMenuActionPointer->setText(i18nc("The main search engine menu action", "Search Engine - Custom")); @@ -1134,6 +1176,9 @@ void BrowserWindow::updateUserAgentActions(const QString &userAgent, const bool // Check the Privacy Browser user agent action. userAgentPrivacyBrowserActionPointer->setChecked(true); + // Update the user agent menu action icon. + userAgentMenuActionPointer->setIcon(QIcon(":/icons/privacy-mode.svg")); + // Update the user agent menu action text. userAgentMenuActionPointer->setText(i18nc("The main user agent menu action", "User Agent - Privacy Browser")); } @@ -1142,6 +1187,9 @@ void BrowserWindow::updateUserAgentActions(const QString &userAgent, const bool // check the WebEngine default user agent action. userAgentWebEngineDefaultActionPointer->setChecked(true); + // Update the user agent menu action icon. + userAgentMenuActionPointer->setIcon(QIcon::fromTheme(QLatin1String("qtlogo"), QIcon::fromTheme(QLatin1String("user-group-properties"), QIcon::fromTheme(QLatin1String("contact-new"))))); + // Update the user agent menu action text. userAgentMenuActionPointer->setText(i18nc("The main user agent menu action", "User Agent - WebEngine default")); } @@ -1150,6 +1198,9 @@ void BrowserWindow::updateUserAgentActions(const QString &userAgent, const bool // Check the Firefox on Linux user agent action. userAgentFirefoxLinuxActionPointer->setChecked(true); + // Update the user agent menu action icon. + userAgentMenuActionPointer->setIcon(QIcon::fromTheme(QLatin1String("firefox-esr"), QIcon::fromTheme(QLatin1String("user-group-properties"), QIcon::fromTheme(QLatin1String("contact-new"))))); + // Update the user agent menu action text. userAgentMenuActionPointer->setText(i18nc("The main user agent menu action", "User Agent - Firefox on Linux")); } @@ -1158,6 +1209,9 @@ void BrowserWindow::updateUserAgentActions(const QString &userAgent, const bool // Check the Chromium on Linux user agent action. userAgentChromiumLinuxActionPointer->setChecked(true); + // Update the user agent menu action icon. + userAgentMenuActionPointer->setIcon(QIcon::fromTheme(QLatin1String("chromium"), QIcon::fromTheme(QLatin1String("user-group-properties"), QIcon::fromTheme(QLatin1String("contact-new"))))); + // Update the user agent menu action text. userAgentMenuActionPointer->setText(i18nc("The main user agent menu action", "User Agent - Chromium on Linux")); } @@ -1166,6 +1220,9 @@ void BrowserWindow::updateUserAgentActions(const QString &userAgent, const bool // Check the Firefox on Windows user agent action. userAgentFirefoxWindowsActionPointer->setChecked(true); + // Update the user agent menu action icon. + userAgentMenuActionPointer->setIcon(QIcon::fromTheme(QLatin1String("firefox-esr"), QIcon::fromTheme(QLatin1String("user-group-properties"), QIcon::fromTheme(QLatin1String("contact-new"))))); + // Update the user agent menu action text. userAgentMenuActionPointer->setText(i18nc("The main user agent menu action", "User Agent - Firefox on Windows")); } @@ -1174,6 +1231,9 @@ void BrowserWindow::updateUserAgentActions(const QString &userAgent, const bool // Check the Chrome on Windows user agent action. userAgentChromeWindowsActionPointer->setChecked(true); + // Update the user agent menu action icon. + userAgentMenuActionPointer->setIcon(QIcon::fromTheme(QLatin1String("chromium"), QIcon::fromTheme(QLatin1String("user-group-properties"), QIcon::fromTheme(QLatin1String("contact-new"))))); + // Update the user agent menu action text. userAgentMenuActionPointer->setText(i18nc("The main user agent menu action", "User Agent - Chrome on Windows")); } @@ -1182,6 +1242,9 @@ void BrowserWindow::updateUserAgentActions(const QString &userAgent, const bool // Check the Edge on Windows user agent action. userAgentEdgeWindowsActionPointer->setChecked(true); + // Update the user agent menu action icon. + userAgentMenuActionPointer->setIcon(QIcon::fromTheme(QLatin1String("user-group-properties"), QIcon::fromTheme(QLatin1String("contact-new")))); + // Update the user agent menu action text. userAgentMenuActionPointer->setText(i18nc("The main user agent menu action", "User Agent - Edge on Windows")); } @@ -1190,6 +1253,9 @@ void BrowserWindow::updateUserAgentActions(const QString &userAgent, const bool // Check the Safari on macOS user agent action. userAgentSafariMacosActionPointer->setChecked(true); + // Update the user agent menu action icon. + userAgentMenuActionPointer->setIcon(QIcon::fromTheme(QLatin1String("user-group-properties"), QIcon::fromTheme(QLatin1String("contact-new")))); + // Update the user agent menu action text. userAgentMenuActionPointer->setText(i18nc("The main user agent menu action", "User Agent - Safari on macOS")); } @@ -1198,6 +1264,9 @@ void BrowserWindow::updateUserAgentActions(const QString &userAgent, const bool // Check the user agent. userAgentCustomActionPointer->setChecked(true); + // Update the user agent menu action icon. + userAgentMenuActionPointer->setIcon(QIcon::fromTheme(QLatin1String("user-group-properties"), QIcon::fromTheme(QLatin1String("contact-new")))); + // Update the user agent menu action text. userAgentMenuActionPointer->setText(i18nc("The main user agent menu action", "User Agent - Custom")); -- 2.45.2