QAction *forwardActionPointer = KStandardAction::forward(this, SLOT(forward()), actionCollectionPointer);
KStandardAction::home(this, SLOT(home()), actionCollectionPointer);
KStandardAction::preferences(this, SLOT(showSettingsDialog()), actionCollectionPointer);
- KStandardAction::find(this, SLOT(focusFindLineEdit()), actionCollectionPointer);
- QAction *findNextActionPointer = KStandardAction::findNext(this, SLOT(findNext()), actionCollectionPointer);
- KStandardAction::findPrev(this, SLOT(findPrevious()), actionCollectionPointer);
+ KStandardAction::find(this, SLOT(showFindTextActions()), actionCollectionPointer);
+ findNextActionPointer = KStandardAction::findNext(this, SLOT(findNext()), actionCollectionPointer);
+ findPreviousActionPointer = KStandardAction::findPrev(this, SLOT(findPrevious()), actionCollectionPointer);
// Add the custom actions.
- userAgentPrivacyBrowserActionPointer = actionCollectionPointer->addAction(QStringLiteral("user_agent_privacy_browser"));
- userAgentWebEngineDefaultActionPointer = actionCollectionPointer->addAction(QStringLiteral("user_agent_webengine_default"));
- userAgentFirefoxLinuxActionPointer = actionCollectionPointer->addAction(QStringLiteral("user_agent_firefox_linux"));
- userAgentChromiumLinuxActionPointer = actionCollectionPointer->addAction(QStringLiteral("user_agent_chromium_linux"));
- userAgentFirefoxWindowsActionPointer = actionCollectionPointer->addAction(QStringLiteral("user_agent_firefox_windows"));
- userAgentChromeWindowsActionPointer = actionCollectionPointer->addAction(QStringLiteral("user_agent_chrome_windows"));
- userAgentEdgeWindowsActionPointer = actionCollectionPointer->addAction(QStringLiteral("user_agent_edge_windows"));
- userAgentSafariMacosActionPointer = actionCollectionPointer->addAction(QStringLiteral("user_agent_safari_macos"));
- userAgentCustomActionPointer = actionCollectionPointer->addAction(QStringLiteral("user_agent_custom"));
- zoomFactorActionPointer = actionCollectionPointer->addAction(QStringLiteral("zoom_factor"));
- searchEngineMojeekActionPointer = actionCollectionPointer->addAction(QStringLiteral("search_engine_mojeek"));
- searchEngineMonoclesActionPointer = actionCollectionPointer->addAction(QStringLiteral("search_engine_monocles"));
- searchEngineMetagerActionPointer = actionCollectionPointer->addAction(QStringLiteral("search_engine_metager"));
- searchEngineGoogleActionPointer = actionCollectionPointer->addAction(QStringLiteral("search_engine_google"));
- searchEngineBingActionPointer = actionCollectionPointer->addAction(QStringLiteral("search_engine_bing"));
- searchEngineYahooActionPointer = actionCollectionPointer->addAction(QStringLiteral("search_engine_yahoo"));
- searchEngineCustomActionPointer = actionCollectionPointer->addAction(QStringLiteral("search_engine_custom"));
- QAction *domainSettingsActionPointer = actionCollectionPointer->addAction(QStringLiteral("domain_settings"));
- cookiesActionPointer = actionCollectionPointer->addAction(QStringLiteral("cookies"));
- javaScriptActionPointer = actionCollectionPointer->addAction(QStringLiteral("javascript"));
- localStorageActionPointer = actionCollectionPointer->addAction(QStringLiteral("local_storage"));
- domStorageActionPointer = actionCollectionPointer->addAction(QStringLiteral("dom_storage"));
- findCaseSensitiveActionPointer = actionCollectionPointer->addAction(QStringLiteral("find_case_sensitive"));
+ userAgentPrivacyBrowserActionPointer = actionCollectionPointer->addAction(QLatin1String("user_agent_privacy_browser"));
+ userAgentWebEngineDefaultActionPointer = actionCollectionPointer->addAction(QLatin1String("user_agent_webengine_default"));
+ userAgentFirefoxLinuxActionPointer = actionCollectionPointer->addAction(QLatin1String("user_agent_firefox_linux"));
+ userAgentChromiumLinuxActionPointer = actionCollectionPointer->addAction(QLatin1String("user_agent_chromium_linux"));
+ userAgentFirefoxWindowsActionPointer = actionCollectionPointer->addAction(QLatin1String("user_agent_firefox_windows"));
+ userAgentChromeWindowsActionPointer = actionCollectionPointer->addAction(QLatin1String("user_agent_chrome_windows"));
+ userAgentEdgeWindowsActionPointer = actionCollectionPointer->addAction(QLatin1String("user_agent_edge_windows"));
+ userAgentSafariMacosActionPointer = actionCollectionPointer->addAction(QLatin1String("user_agent_safari_macos"));
+ userAgentCustomActionPointer = actionCollectionPointer->addAction(QLatin1String("user_agent_custom"));
+ zoomFactorActionPointer = actionCollectionPointer->addAction(QLatin1String("zoom_factor"));
+ searchEngineMojeekActionPointer = actionCollectionPointer->addAction(QLatin1String("search_engine_mojeek"));
+ searchEngineMonoclesActionPointer = actionCollectionPointer->addAction(QLatin1String("search_engine_monocles"));
+ searchEngineMetagerActionPointer = actionCollectionPointer->addAction(QLatin1String("search_engine_metager"));
+ searchEngineGoogleActionPointer = actionCollectionPointer->addAction(QLatin1String("search_engine_google"));
+ searchEngineBingActionPointer = actionCollectionPointer->addAction(QLatin1String("search_engine_bing"));
+ searchEngineYahooActionPointer = actionCollectionPointer->addAction(QLatin1String("search_engine_yahoo"));
+ searchEngineCustomActionPointer = actionCollectionPointer->addAction(QLatin1String("search_engine_custom"));
+ QAction *domainSettingsActionPointer = actionCollectionPointer->addAction(QLatin1String("domain_settings"));
+ cookiesActionPointer = actionCollectionPointer->addAction(QLatin1String("cookies"));
+ javaScriptActionPointer = actionCollectionPointer->addAction(QLatin1String("javascript"));
+ localStorageActionPointer = actionCollectionPointer->addAction(QLatin1String("local_storage"));
+ domStorageActionPointer = actionCollectionPointer->addAction(QLatin1String("dom_storage"));
+ findCaseSensitiveActionPointer = actionCollectionPointer->addAction(QLatin1String("find_case_sensitive"));
+ hideFindTextActionPointer = actionCollectionPointer->addAction(QLatin1String("hide_find_actions"));
// Create the action groups
QActionGroup *userAgentActionGroupPointer = new QActionGroup(this);
localStorageActionPointer->setText(i18nc("The Local Storage action", "Local Storage"));
domStorageActionPointer->setText(i18nc("DOM Storage action", "DOM Storage"));
findCaseSensitiveActionPointer->setText(i18nc("Find Case Sensitive action", "Find Case Sensitive"));
+ hideFindTextActionPointer->setText(i18nc("Hide Find Text action", "Hide Find Text"));
// Set the action icons.
userAgentPrivacyBrowserActionPointer->setIcon(QIcon(":/icons/privacy-mode"));
- userAgentWebEngineDefaultActionPointer->setIcon(QIcon::fromTheme(QStringLiteral("user-group-properties")));
- userAgentFirefoxLinuxActionPointer->setIcon(QIcon::fromTheme(QStringLiteral("firefox-esr")));
- userAgentChromiumLinuxActionPointer->setIcon(QIcon::fromTheme(QStringLiteral("chromium")));
- userAgentFirefoxWindowsActionPointer->setIcon(QIcon::fromTheme(QStringLiteral("firefox-esr")));
- userAgentChromeWindowsActionPointer->setIcon(QIcon::fromTheme(QStringLiteral("chromium")));
- userAgentEdgeWindowsActionPointer->setIcon(QIcon::fromTheme(QStringLiteral("user-group-properties")));
- userAgentSafariMacosActionPointer->setIcon(QIcon::fromTheme(QStringLiteral("user-group-properties")));
- userAgentCustomActionPointer->setIcon(QIcon::fromTheme(QStringLiteral("user-group-properties")));
- searchEngineMojeekActionPointer->setIcon(QIcon::fromTheme(QStringLiteral("search")));
- searchEngineMonoclesActionPointer->setIcon(QIcon::fromTheme(QStringLiteral("search")));
- searchEngineMetagerActionPointer->setIcon(QIcon::fromTheme(QStringLiteral("search")));
- searchEngineGoogleActionPointer->setIcon(QIcon::fromTheme(QStringLiteral("im-google")));
- searchEngineBingActionPointer->setIcon(QIcon::fromTheme(QStringLiteral("search")));
- searchEngineYahooActionPointer->setIcon(QIcon::fromTheme(QStringLiteral("im-yahoo")));
- searchEngineCustomActionPointer->setIcon(QIcon::fromTheme(QStringLiteral("search")));
- zoomFactorActionPointer->setIcon(QIcon::fromTheme(QStringLiteral("zoom")));
- domainSettingsActionPointer->setIcon(QIcon::fromTheme(QStringLiteral("settings-configure")));
- cookiesActionPointer->setIcon(QIcon::fromTheme(QStringLiteral("preferences-web-browser-cookies")));
- domStorageActionPointer->setIcon(QIcon::fromTheme(QStringLiteral("code-class")));
- findCaseSensitiveActionPointer->setIcon(QIcon::fromTheme(QStringLiteral("format-text-lowercase")));
+ 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")));
+ hideFindTextActionPointer->setIcon(QIcon::fromTheme(QLatin1String("window-close-symbolic")));
// Update the on-the-fly menus.
connect(tabWidgetPointer, SIGNAL(updateUserAgentActions(QString, bool)), this, SLOT(updateUserAgentActions(QString, bool)));
// Connect the find text actions.
connect(findCaseSensitiveActionPointer, SIGNAL(triggered()), this, SLOT(toggleFindCaseSensitive()));
+ connect(hideFindTextActionPointer, SIGNAL(triggered()), this, SLOT(hideFindTextActions()));
- // Setup the GUI based on the browser_window_ui.rc file.
+ // Setup the GUI based on the browserwindowui.rc file.
setupGUI(StandardWindowOption::Default, ("browserwindowui.rc"));
// Get lists of the actions' associated widgets.
searchEngineMenuActionPointer = searchEngineMenuPointer->menuAction();
// Get handles for the toolbars.
- navigationToolBarPointer = toolBar(QStringLiteral("navigation_toolbar"));
- urlToolBarPointer = toolBar(QStringLiteral("url_toolbar"));
+ navigationToolBarPointer = toolBar(QLatin1String("navigation_toolbar"));
+ urlToolBarPointer = toolBar(QLatin1String("url_toolbar"));
// Create the line edits.
urlLineEditPointer = new KLineEdit();
findTextLineEditPointer->setMinimumWidth(200);
findTextLineEditPointer->setMaximumWidth(350);
- // Set the placehold text.
+ // Set the place holder text.
urlLineEditPointer->setPlaceholderText(i18nc("The URL line edit placeholder text", "URL or Search Terms"));
findTextLineEditPointer->setPlaceholderText(i18nc("The find line edit placeholder text", "Find Text"));
findTextLabelPointer = new QLabel();
// Set the default label text.
- findTextLabelPointer->setText(QStringLiteral(" ") + i18nc("Default find results.", "0/0") + QStringLiteral(" "));
+ findTextLabelPointer->setText(QLatin1String(" ") + i18nc("Default find results.", "0/0") + QLatin1String(" "));
// Insert the widgets into the toolbars.
urlToolBarPointer->insertWidget(javaScriptActionPointer, urlLineEditPointer);
- urlToolBarPointer->insertWidget(findNextActionPointer, findTextLineEditPointer);
- urlToolBarPointer->insertWidget(findNextActionPointer, findTextLabelPointer);
+ findTextLineEditActionPointer = urlToolBarPointer->insertWidget(findNextActionPointer, findTextLineEditPointer);
+ findTextLabelActionPointer = urlToolBarPointer->insertWidget(findNextActionPointer, findTextLabelPointer);
+
+ // Initially hide the find text actions.
+ hideFindTextActions();
// Load a new URL from the URL line edit.
connect(urlLineEditPointer, SIGNAL(returnKeyPressed(const QString)), this, SLOT(loadUrlFromLineEdit(const QString)));
void BrowserWindow::escape() const
{
- // Process the excape according to the status of the browser.
+ // Process the escape according to the status of the browser.
if (fullScreenActionPointer->isChecked()) // Full screen browsing is enabled.
{
// Exit full screen browsing.
tabWidgetPointer->findPrevious(findString);
}
-void BrowserWindow::focusFindLineEdit() const
-{
- // Set the focus on the find line edit.
- findTextLineEditPointer->setFocus();
-
- // Select all the text in the find line edit.
- findTextLineEditPointer->selectAll();
-}
-
void BrowserWindow::forward() const
{
// Remove the focus from the URL line edit.
}
}
+void BrowserWindow::hideFindTextActions() const
+{
+ // Hide the find text actions.
+ findTextLineEditActionPointer->setVisible(false);
+ findTextLabelActionPointer->setVisible(false);
+ findNextActionPointer->setVisible(false);
+ findPreviousActionPointer->setVisible(false);
+ findCaseSensitiveActionPointer->setVisible(false);
+ hideFindTextActionPointer->setVisible(false);
+}
+
void BrowserWindow::home() const
{
// Remove the focus from the URL line edit.
connect(domainSettingsDialogPointer, SIGNAL(domainSettingsUpdated()), tabWidgetPointer, SLOT(applyDomainSettingsAndReload()));
}
+void BrowserWindow::showFindTextActions() const
+{
+ // Show the find text actions.
+ findTextLineEditActionPointer->setVisible(true);
+ findTextLabelActionPointer->setVisible(true);
+ findNextActionPointer->setVisible(true);
+ findPreviousActionPointer->setVisible(true);
+ findCaseSensitiveActionPointer->setVisible(true);
+ hideFindTextActionPointer->setVisible(true);
+
+ // Set the focus on the find line edit.
+ findTextLineEditPointer->setFocus();
+
+ // Select all the text in the find line edit.
+ findTextLineEditPointer->selectAll();
+}
+
void BrowserWindow::showProgressBar(const int &progress) const
{
// Set the progress bar value.