X-Git-Url: https://gitweb.stoutner.com/?p=PrivacyBrowserPC.git;a=blobdiff_plain;f=src%2Fwindows%2FBrowserWindow.cpp;fp=src%2Fwindows%2FBrowserWindow.cpp;h=99fc2fac5f92d8f9a3d628d678443426ac822e26;hp=2eb4ab14fab687edc954e65d421be2beed5de5f2;hb=37e86f9f1e43c3cf67d4d6a5f0f21a66e1df23fc;hpb=e5ec85accb02116b08c33b574805c132475d90bc diff --git a/src/windows/BrowserWindow.cpp b/src/windows/BrowserWindow.cpp index 2eb4ab1..99fc2fa 100644 --- a/src/windows/BrowserWindow.cpp +++ b/src/windows/BrowserWindow.cpp @@ -77,7 +77,7 @@ BrowserWindow::BrowserWindow(bool firstWindow, QString *initialUrlStringPointer) KStandardAction::quit(qApp, SLOT(closeAllWindows()), actionCollectionPointer); zoomInActionPointer = KStandardAction::zoomIn(this, SLOT(incrementZoom()), actionCollectionPointer); zoomOutActionPointer = KStandardAction::zoomOut(this, SLOT(decrementZoom()), actionCollectionPointer); - KStandardAction::redisplay(this, SLOT(refresh()), actionCollectionPointer); + refreshActionPointer = KStandardAction::redisplay(this, SLOT(refresh()), actionCollectionPointer); fullScreenActionPointer = KStandardAction::fullScreen(this, SLOT(toggleFullScreen()), this, actionCollectionPointer); QAction *backActionPointer = KStandardAction::back(this, SLOT(back()), actionCollectionPointer); QAction *forwardActionPointer = KStandardAction::forward(this, SLOT(forward()), actionCollectionPointer); @@ -94,6 +94,7 @@ BrowserWindow::BrowserWindow(bool firstWindow, QString *initialUrlStringPointer) QAction *saveArchiveActionPointer = actionCollectionPointer->addAction(QLatin1String("save_archive")); zoomDefaultActionPointer = actionCollectionPointer->addAction(QLatin1String("zoom_default")); QAction *reloadAndBypassCacheActionPointer = actionCollectionPointer->addAction(QLatin1String("reload_and_bypass_cache")); + stopActionPointer = actionCollectionPointer->addAction(QLatin1String("stop")); viewSourceActionPointer = actionCollectionPointer->addAction(QLatin1String("view_source")); viewSourceInNewTabActionPointer = actionCollectionPointer->addAction(QLatin1String("view_source_in_new_tab")); developerToolsActionPointer = actionCollectionPointer->addAction(QLatin1String("developer_tools")); @@ -179,6 +180,7 @@ BrowserWindow::BrowserWindow(bool firstWindow, QString *initialUrlStringPointer) saveArchiveActionPointer->setText(i18nc("Save archive action", "Save Archive")); zoomDefaultActionPointer->setText(i18nc("Zoom default action", "Zoom Default")); reloadAndBypassCacheActionPointer->setText(i18nc("Reload and bypass cache action", "Reload and Bypass Cache")); + stopActionPointer->setText(i18nc("Stop action", "Stop")); viewSourceActionPointer->setText(i18nc("View source action", "View Source")); viewSourceInNewTabActionPointer->setText(i18nc("View source in new tab action", "View Source in New Tab")); developerToolsActionPointer->setText(i18nc("Developer tools action", "Developer Tools")); @@ -212,12 +214,14 @@ BrowserWindow::BrowserWindow(bool firstWindow, QString *initialUrlStringPointer) saveArchiveActionPointer->setIcon(QIcon::fromTheme(QLatin1String("document-save"))); zoomDefaultActionPointer->setIcon(QIcon::fromTheme(QLatin1String("zoom-fit-best"))); reloadAndBypassCacheActionPointer->setIcon(QIcon::fromTheme(QLatin1String("view-refresh"))); + stopActionPointer->setIcon(QIcon::fromTheme(QLatin1String("process-stop"))); viewSourceActionPointer->setIcon(QIcon::fromTheme(QLatin1String("view-choose"), QIcon::fromTheme(QLatin1String("accessories-text-editor")))); viewSourceInNewTabActionPointer->setIcon(QIcon::fromTheme(QLatin1String("view-choose"), QIcon::fromTheme(QLatin1String("accessories-text-editor")))); developerToolsActionPointer->setIcon(QIcon::fromTheme(QLatin1String("add-subtitle"), QIcon::fromTheme("system-run"))); domStorageActionPointer->setIcon(QIcon::fromTheme(QLatin1String("code-class"), QIcon(QLatin1String("/usr/share/icons/gnome/32x32/actions/gtk-unindent-ltr.png")))); - userAgentPrivacyBrowserActionPointer->setIcon(QIcon(":/icons/privacy-mode.svg")); - userAgentWebEngineDefaultActionPointer->setIcon(QIcon::fromTheme(QLatin1String("qtlogo"), QIcon::fromTheme(QLatin1String("user-group-properties"), QIcon::fromTheme(QLatin1String("contact-new"))))); + userAgentPrivacyBrowserActionPointer->setIcon(QIcon(QLatin1String(":/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"))))); @@ -248,6 +252,7 @@ BrowserWindow::BrowserWindow(bool firstWindow, QString *initialUrlStringPointer) QKeySequence ctrlAKeySequence = QKeySequence(i18nc("The save archive key sequence.", "Ctrl+A")); QKeySequence ctrl0KeySequence = QKeySequence(i18nc("The zoom default key sequence.", "Ctrl+0")); QKeySequence ctrlF5KeySequence = QKeySequence(i18nc("The reload and bypass cache key sequence.", "Ctrl+F5")); + QKeySequence ctrlShiftXKeySequence = QKeySequence(i18nc("The stop key sequence.", "Ctrl+Shift+X")); QKeySequence ctrlUKeySequence = QKeySequence(i18nc("The view source key sequence.", "Ctrl+U")); QKeySequence ctrlShiftUKeySequence = QKeySequence(i18nc("The view source in new tab key sequence.", "Ctrl+Shift+U")); QKeySequence f12KeySequence = QKeySequence(i18nc("The developer tools key sequence.", "F12")); @@ -284,6 +289,7 @@ BrowserWindow::BrowserWindow(bool firstWindow, QString *initialUrlStringPointer) actionCollectionPointer->setDefaultShortcut(saveArchiveActionPointer, ctrlAKeySequence); actionCollectionPointer->setDefaultShortcut(zoomDefaultActionPointer, ctrl0KeySequence); actionCollectionPointer->setDefaultShortcut(reloadAndBypassCacheActionPointer, ctrlF5KeySequence); + actionCollectionPointer->setDefaultShortcut(stopActionPointer, ctrlShiftXKeySequence); actionCollectionPointer->setDefaultShortcut(viewSourceActionPointer, ctrlUKeySequence); actionCollectionPointer->setDefaultShortcut(viewSourceInNewTabActionPointer, ctrlShiftUKeySequence); actionCollectionPointer->setDefaultShortcut(developerToolsActionPointer, f12KeySequence); @@ -320,6 +326,7 @@ BrowserWindow::BrowserWindow(bool firstWindow, QString *initialUrlStringPointer) connect(saveArchiveActionPointer, SIGNAL(triggered()), tabWidgetPointer, SLOT(saveArchive())); connect(zoomDefaultActionPointer, SIGNAL(triggered()), this, SLOT(zoomDefault())); connect(reloadAndBypassCacheActionPointer, SIGNAL(triggered()), this, SLOT(reloadAndBypassCache())); + connect(stopActionPointer, SIGNAL(triggered()), tabWidgetPointer, SLOT(stop())); connect(viewSourceActionPointer, SIGNAL(triggered()), this, SLOT(toggleViewSource())); connect(viewSourceInNewTabActionPointer, SIGNAL(triggered()), this, SLOT(toggleViewSourceInNewTab())); connect(developerToolsActionPointer, SIGNAL(triggered()), this, SLOT(toggleDeveloperTools())); @@ -501,7 +508,7 @@ BrowserWindow::BrowserWindow(bool firstWindow, QString *initialUrlStringPointer) // Update the progress bar. connect(tabWidgetPointer, SIGNAL(showProgressBar(const int)), this, SLOT(showProgressBar(const int))); - connect(tabWidgetPointer, SIGNAL(hideProgressBar()), progressBarPointer, SLOT(hide())); + connect(tabWidgetPointer, SIGNAL(hideProgressBar()), this, SLOT(hideProgressBar())); // Update the URL line edit focus. connect(tabWidgetPointer, SIGNAL(clearUrlLineEditFocus()), this, SLOT(clearUrlLineEditFocus())); @@ -979,6 +986,20 @@ void BrowserWindow::home() const tabWidgetPointer->home(); } +void BrowserWindow::hideProgressBar() const +{ + // Hide the progress bar. + progressBarPointer->hide(); + + // Disable and hide the stop action. + stopActionPointer->setEnabled(false); + stopActionPointer->setVisible(false); + + // Enable and show the refresh action. + refreshActionPointer->setEnabled(true); + refreshActionPointer->setVisible(true); +} + void BrowserWindow::incrementZoom() { // Update the current zoom factor. @@ -1489,6 +1510,14 @@ void BrowserWindow::showProgressBar(const int &progress) const // Show the progress bar. progressBarPointer->show(); + + // Disable and hide the refresh action. + refreshActionPointer->setEnabled(false); + refreshActionPointer->setVisible(false); + + // Enable and show the stop action. + stopActionPointer->setEnabled(true); + stopActionPointer->setVisible(true); } void BrowserWindow::showSettingsDialog()