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);
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"));
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"));
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")))));
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"));
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);
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()));
// 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()));
// Get all the folder URLs.
QList<QString> *folderUrlsListPointer = BookmarksDatabase::getAllFolderUrls(folderId);
- // Open the URLs in new tabs. `true` removes the URL line edit focus, `false` does not load a background tab.
+ // Open the URLs in new tabs. `true` removes the URL line edit focus, `true` opens the new tabs in an adjacent tab. `false` does not load a background tab.
for (QString url : *folderUrlsListPointer)
- tabWidgetPointer->addTab(true, false, url);
+ tabWidgetPointer->addTab(true, true, false, url);
}
);
// Get all the folder URLs.
QList<QString> *folderUrlsListPointer = BookmarksDatabase::getAllFolderUrls(folderId);
- // Open the URLs in new tabs. `true` removes the URL line edit focus, `true` loads a background tab.
+ // Open the URLs in new tabs. `true` removes the URL line edit focus, `true` opens the new tabs in an adjacent tab. `true` loads a background tab.
for (QString url : *folderUrlsListPointer)
- tabWidgetPointer->addTab(true, true, url);
+ tabWidgetPointer->addTab(true, true, true, url);
}
);
// Get a count of the folder URLs.
const int folderUrls = folderUrlsListPointer->count();
- // Load all the other URLs. `true` removes the URL line edit focus, `true` loads a background tab.
+ // Load all the other URLs. `true` removes the URL line edit focus, `false` does not load the new tabs in adjacent tabs. `true` loads a background tab.
for (int i = 1; i < folderUrls; ++i)
- browserWindowPointer->tabWidgetPointer->addTab(true, true, folderUrlsListPointer->value(i));
+ browserWindowPointer->tabWidgetPointer->addTab(true, false, true, folderUrlsListPointer->value(i));
// Show the new browser window.
browserWindowPointer->show();
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.
// Get the bookmark.
BookmarkStruct *bookmarkStructPointer = BookmarksDatabase::getBookmark(databaseId);
- // Open the bookmark in a new tab. `true` removes the URL line edit focus, `false` does not load a background tab.
- tabWidgetPointer->addTab(true, false, bookmarkStructPointer->url);
+ // Open the bookmark in a new tab. `true` removes the URL line edit focus, `true` opens the new tab in an adjacent tab. `false` does not load a background tab.
+ tabWidgetPointer->addTab(true, true, false, bookmarkStructPointer->url);
}
);
// Get the bookmark.
BookmarkStruct *bookmarkStructPointer = BookmarksDatabase::getBookmark(databaseId);
- // Open the bookmark in a new tab. `true` removes the URL line edit focus, `true` loads a background tab.
- tabWidgetPointer->addTab(true, true, bookmarkStructPointer->url);
+ // Open the bookmark in a new tab. `true` removes the URL line edit focus, `true` opens the new tab in an adjacent tab. `true` loads a background tab.
+ tabWidgetPointer->addTab(true, true, true, bookmarkStructPointer->url);
}
);
connect(cookiesDialogPointer, SIGNAL(deleteCookie(QNetworkCookie)), tabWidgetPointer, SLOT(deleteCookieFromStore(QNetworkCookie)));
}
-void BrowserWindow::showDownloadLocationBrowseDialog() const
+void BrowserWindow::showDownloadDirectoryBrowseDialog() const
{
- // Get the current download location.
- QString currentDownloadLocation = downloadLocationComboBoxPointer->currentText();
+ // Get the current download directory.
+ QString currentDownloadDirectory = downloadDirectoryComboBoxPointer->currentText();
// Resolve the system download directory if specified.
- if (currentDownloadLocation == QStringLiteral("System Download Directory"))
- currentDownloadLocation = QStandardPaths::writableLocation(QStandardPaths::DownloadLocation);
+ if (currentDownloadDirectory == QStringLiteral("System Download Directory"))
+ currentDownloadDirectory = QStandardPaths::writableLocation(QStandardPaths::DownloadLocation);
- // Get the new download location.
- QString newDownloadLocation = QFileDialog::getExistingDirectory(configDialogPointer, i18nc("Select download location dialog caption", "Select Download Location"), currentDownloadLocation);
+ // Get the new download directory.
+ QString newDownloadDirectory = QFileDialog::getExistingDirectory(configDialogPointer, i18nc("Select download directory dialog caption", "Select Download Directory"),
+ currentDownloadDirectory);
- // Populate the download location combo box according to the new download location.
- if (newDownloadLocation == QStandardPaths::writableLocation(QStandardPaths::DownloadLocation)) // The default download location was selected.
+ // Populate the download directory combo box according to the new download location.
+ if (newDownloadDirectory == QStandardPaths::writableLocation(QStandardPaths::DownloadLocation)) // The default download location was selected.
{
// Populate the download location with the default text.
- downloadLocationComboBoxPointer->setCurrentText("System Download Directory");
+ downloadDirectoryComboBoxPointer->setCurrentText("System Download Directory");
}
- else if (newDownloadLocation != QStringLiteral("")) // A different directory was selected.
+ else if (newDownloadDirectory != QStringLiteral("")) // A different directory was selected.
{
// Populate the download location.
- downloadLocationComboBoxPointer->setCurrentText(newDownloadLocation);
+ downloadDirectoryComboBoxPointer->setCurrentText(newDownloadDirectory);
}
}
// 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()
userAgentLabelPointer = privacySettingsUi.userAgentLabel;
QComboBox *searchEngineComboBoxPointer = generalSettingsUi.kcfg_searchEngine;
searchEngineLabelPointer = generalSettingsUi.searchEngineLabel;
- downloadLocationComboBoxPointer = generalSettingsUi.kcfg_downloadLocation;
+ downloadDirectoryComboBoxPointer = generalSettingsUi.kcfg_downloadDirectory;
QPushButton *browseButtonPointer = generalSettingsUi.browseButton;
QListWidget *spellCheckListWidgetPointer = spellCheckSettingsUi.spellCheckListWidget;
connect(userAgentComboBoxPointer, SIGNAL(currentTextChanged(const QString)), this, SLOT(updateUserAgentLabel(const QString)));
connect(searchEngineComboBoxPointer, SIGNAL(currentTextChanged(const QString)), this, SLOT(updateSearchEngineLabel(const QString)));
- // Connect the download location directory browse button.
- connect(browseButtonPointer, SIGNAL(clicked()), this, SLOT(showDownloadLocationBrowseDialog()));
+ // Connect the download directory directory browse button.
+ connect(browseButtonPointer, SIGNAL(clicked()), this, SLOT(showDownloadDirectoryBrowseDialog()));
// Create a dictionaries QDir from the `QTWEBENGINE_DICTIONARIES_PATH` environment variable.
QDir dictionariesDir = QDir(qEnvironmentVariable("QTWEBENGINE_DICTIONARIES_PATH"));
url = url.prepend(QLatin1String("view-source:"));
}
- // Add the new tab. `true` removes the URL line edit focus, `false` does not open a background tab.
- tabWidgetPointer->addTab(true, false, url);
+ // Add the new tab. `true` removes the URL line edit focus, `true` opens the new tab in an adjacent tab. `false` does not open a background tab.
+ tabWidgetPointer->addTab(true, true, false, url);
}
void BrowserWindow::updateBookmarkedAction() const