]> gitweb.stoutner.com Git - PrivacyBrowserPC.git/blobdiff - src/windows/BrowserWindow.cpp
Fix download notification not clearing on Xfce. https://redmine.stoutner.com/issues...
[PrivacyBrowserPC.git] / src / windows / BrowserWindow.cpp
index 6347ec404cadf44203b22dc6d0867663714cc00c..b5d062bb997f1863380c1d628ca6318968313cfb 100644 (file)
@@ -75,6 +75,7 @@ BrowserWindow::BrowserWindow(bool firstWindow) : KXmlGuiWindow()
     // Add the custom actions.
     QAction *newTabActionPointer = actionCollectionPointer->addAction(QLatin1String("new_tab"));
     QAction *newWindowActionPointer = actionCollectionPointer->addAction(QLatin1String("new_window"));
+    QAction *reloadAndBypassCacheActionPointer = actionCollectionPointer->addAction(QLatin1String("reload_and_bypass_cache"));
     userAgentPrivacyBrowserActionPointer = actionCollectionPointer->addAction(QLatin1String("user_agent_privacy_browser"));
     userAgentWebEngineDefaultActionPointer = actionCollectionPointer->addAction(QLatin1String("user_agent_webengine_default"));
     userAgentFirefoxLinuxActionPointer = actionCollectionPointer->addAction(QLatin1String("user_agent_firefox_linux"));
@@ -150,6 +151,7 @@ BrowserWindow::BrowserWindow(bool firstWindow) : KXmlGuiWindow()
     // Set the action text.
     newTabActionPointer->setText(i18nc("New tab action", "New Tab"));
     newWindowActionPointer->setText(i18nc("New window action", "New Window"));
+    reloadAndBypassCacheActionPointer->setText(i18nc("Reload and bypass cache action", "Reload and Bypass Cache"));
     userAgentPrivacyBrowserActionPointer->setText(userAgentHelperPointer->PRIVACY_BROWSER_TRANSLATED);
     userAgentWebEngineDefaultActionPointer->setText(userAgentHelperPointer->WEB_ENGINE_DEFAULT_TRANSLATED);
     userAgentFirefoxLinuxActionPointer->setText(userAgentHelperPointer->FIREFOX_LINUX_TRANSLATED);
@@ -176,6 +178,7 @@ BrowserWindow::BrowserWindow(bool firstWindow) : KXmlGuiWindow()
     // 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")));
+    reloadAndBypassCacheActionPointer->setIcon(QIcon::fromTheme(QLatin1String("view-refresh")));
     userAgentPrivacyBrowserActionPointer->setIcon(QIcon(":/icons/privacy-mode.svg"));
     userAgentWebEngineDefaultActionPointer->setIcon(QIcon::fromTheme(QLatin1String("qtlogo"), QIcon::fromTheme(QLatin1String("user-group-properties"),
                                                                                                                QIcon::fromTheme(QLatin1String("contact-new")))));
@@ -207,6 +210,7 @@ BrowserWindow::BrowserWindow(bool firstWindow) : KXmlGuiWindow()
     // Create the key sequences.
     QKeySequence ctrlTKeySequence = QKeySequence(i18nc("The open new tab key sequence.", "Ctrl+T"));
     QKeySequence ctrlNKeySequence = QKeySequence(i18nc("The open new window key sequence.", "Ctrl+N"));
+    QKeySequence ctrlF5KeySequence = QKeySequence(i18nc("The reload and bypass cache key sequence.", "Ctrl+F5"));
     QKeySequence ctrlShiftPKeySequence = QKeySequence(i18nc("The print preview key sequence.", "Ctrl+Shift+P"));
     QKeySequence ctrlAltPKeySequence = QKeySequence(i18nc("The Privacy Browser user agent key sequence.", "Ctrl+Alt+P"));
     QKeySequence ctrlAltWKeySequence = QKeySequence(i18nc("The WebEngine Default user agent key sequence.", "Ctrl+Alt+W"));
@@ -231,6 +235,7 @@ BrowserWindow::BrowserWindow(bool firstWindow) : KXmlGuiWindow()
     // Set the action key sequences.
     actionCollectionPointer->setDefaultShortcut(newTabActionPointer, ctrlTKeySequence);
     actionCollectionPointer->setDefaultShortcut(newWindowActionPointer, ctrlNKeySequence);
+    actionCollectionPointer->setDefaultShortcut(reloadAndBypassCacheActionPointer, ctrlF5KeySequence);
     actionCollectionPointer->setDefaultShortcut(printPreviewActionPointer, ctrlShiftPKeySequence);
     actionCollectionPointer->setDefaultShortcut(userAgentPrivacyBrowserActionPointer, ctrlAltPKeySequence);
     actionCollectionPointer->setDefaultShortcut(userAgentWebEngineDefaultActionPointer, ctrlAltWKeySequence);
@@ -255,6 +260,7 @@ BrowserWindow::BrowserWindow(bool firstWindow) : KXmlGuiWindow()
     // Execute the actions.
     connect(newTabActionPointer, SIGNAL(triggered()), tabWidgetPointer, SLOT(addTab()));
     connect(newWindowActionPointer, SIGNAL(triggered()), this, SLOT(newWindow()));
+    connect(reloadAndBypassCacheActionPointer, SIGNAL(triggered()), this, SLOT(reloadAndBypassCache()));
     connect(zoomFactorActionPointer, SIGNAL(triggered()), this, SLOT(getZoomFactorFromUser()));
     connect(cookiesActionPointer, SIGNAL(triggered()), this, SLOT(showCookiesDialog()));
     connect(domainSettingsActionPointer, SIGNAL(triggered()), this, SLOT(showDomainSettingsDialog()));
@@ -339,7 +345,8 @@ BrowserWindow::BrowserWindow(bool firstWindow) : KXmlGuiWindow()
     findTextLineEditPointer->setClearButtonEnabled(true);
 
     // Add an edit or add domain settings action to the URL line edit.
-    QAction *addOrEditDomainSettingsActionPointer = urlLineEditPointer->addAction(QIcon::fromTheme("settings-configure"), QLineEdit::TrailingPosition);
+    QAction *addOrEditDomainSettingsActionPointer = urlLineEditPointer->addAction(QIcon::fromTheme("settings-configure", QIcon::fromTheme(QLatin1String("preferences-desktop"))),
+                                                                                  QLineEdit::TrailingPosition);
 
     // Add or edit the current domain settings.
     connect(addOrEditDomainSettingsActionPointer, SIGNAL(triggered()), this, SLOT(addOrEditDomainSettings()));
@@ -457,17 +464,11 @@ void BrowserWindow::addOrEditDomainSettings() const
         domainSettingsDialogPointer = new DomainSettingsDialog(DomainSettingsDialog::EDIT_DOMAIN, currentDomainSettingsName);
     }
 
-    // Set the dialog window title.
-    domainSettingsDialogPointer->setWindowTitle(i18nc("The domain settings dialog title", "Domain Settings"));
-
-    // Set the modality.
-    domainSettingsDialogPointer->setWindowModality(Qt::WindowModality::WindowModal);;
+    // Reload the tabs when domain settings are updated.
+    connect(domainSettingsDialogPointer, SIGNAL(domainSettingsUpdated()), tabWidgetPointer, SLOT(applyDomainSettingsAndReload()));
 
     // Show the dialog.
     domainSettingsDialogPointer->show();
-
-    // Reload the tabs when domain settings are updated.
-    connect(domainSettingsDialogPointer, SIGNAL(domainSettingsUpdated()), tabWidgetPointer, SLOT(applyDomainSettingsAndReload()));
 }
 
 void BrowserWindow::back() const
@@ -634,6 +635,15 @@ void BrowserWindow::refresh() const
     tabWidgetPointer->refresh();
 }
 
+void BrowserWindow::reloadAndBypassCache() const
+{
+    // Remove the focus from the URL line edit.
+    urlLineEditPointer->clearFocus();
+
+    // Refresh the web page.
+    tabWidgetPointer->refresh();
+}
+
 void BrowserWindow::showCookiesDialog()
 {
     // Remove the focus from the URL line edit.
@@ -684,11 +694,11 @@ void BrowserWindow::showDomainSettingsDialog() const
     // Instantiate the domain settings dialog.
     DomainSettingsDialog *domainSettingsDialogPointer = new DomainSettingsDialog();
 
-    // Show the dialog.
-    domainSettingsDialogPointer->show();
-
     // Reload the tabs when domain settings are updated.
     connect(domainSettingsDialogPointer, SIGNAL(domainSettingsUpdated()), tabWidgetPointer, SLOT(applyDomainSettingsAndReload()));
+
+    // Show the dialog.
+    domainSettingsDialogPointer->show();
 }
 
 void BrowserWindow::showFindTextActions() const
@@ -1045,7 +1055,7 @@ void BrowserWindow::updateLocalStorageAction(const bool &isEnabled)
 
     // 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(QLatin1String("disk-quota-high"), QIcon(QLatin1String("/usr/share/icons/gnome/32x32/actions/filesaveas.png"))));
+        localStorageActionPointer->setIcon(QIcon::fromTheme(QLatin1String("disk-quota-high"), QIcon(QLatin1String("/usr/share/icons/gnome/32x32/actions/document-save-as.png"))));
     else
         localStorageActionPointer->setIcon(QIcon::fromTheme(QLatin1String("disk-quota"), QIcon(QLatin1String("/usr/share/icons/gnome/32x32/apps/kfm.png"))));