QAction *newTabActionPointer = actionCollectionPointer->addAction(QLatin1String("new_tab"));
QAction *newWindowActionPointer = actionCollectionPointer->addAction(QLatin1String("new_window"));
QAction *saveArchiveActionPointer = actionCollectionPointer->addAction(QLatin1String("save_archive"));
+ QAction *openWithFirefoxActionPointer = actionCollectionPointer->addAction(QLatin1String("open_with_firefox"));
+ QAction *openWithChromiumActionPointer = actionCollectionPointer->addAction(QLatin1String("open_with_chromium"));
zoomDefaultActionPointer = actionCollectionPointer->addAction(QLatin1String("zoom_default"));
QAction *reloadAndBypassCacheActionPointer = actionCollectionPointer->addAction(QLatin1String("reload_and_bypass_cache"));
stopActionPointer = actionCollectionPointer->addAction(QLatin1String("stop"));
newTabActionPointer->setText(i18nc("New tab action", "New Tab"));
newWindowActionPointer->setText(i18nc("New window action", "New Window"));
saveArchiveActionPointer->setText(i18nc("Save archive action", "Save Archive"));
+ openWithFirefoxActionPointer->setText(i18nc("Open with Firefox action", "Open With Firefox"));
+ openWithChromiumActionPointer->setText(i18nc("Open with Chromium action", "Open With Chromium"));
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"));
newTabActionPointer->setIcon(QIcon::fromTheme(QLatin1String("tab-new")));
newWindowActionPointer->setIcon(QIcon::fromTheme(QLatin1String("window-new")));
saveArchiveActionPointer->setIcon(QIcon::fromTheme(QLatin1String("document-save")));
+ openWithFirefoxActionPointer->setIcon(QIcon::fromTheme(QLatin1String("firefox-esr")));
+ openWithChromiumActionPointer->setIcon(QIcon::fromTheme(QLatin1String("chromium")));
zoomDefaultActionPointer->setIcon(QIcon::fromTheme(QLatin1String("zoom-fit-best")));
reloadAndBypassCacheActionPointer->setIcon(QIcon::fromTheme(QLatin1String("view-refresh")));
stopActionPointer->setIcon(QIcon::fromTheme(QLatin1String("process-stop")));
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 ctrlAKeySequence = QKeySequence(i18nc("The save archive key sequence.", "Ctrl+A"));
+ QKeySequence altFKeySequence = QKeySequence(i18nc("The open with Firefox key sequence.", "Alt+F"));
+ QKeySequence altCKeySequence = QKeySequence(i18nc("The open with Chromium key sequence.", "Alt+C"));
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"));
actionCollectionPointer->setDefaultShortcut(newTabActionPointer, ctrlTKeySequence);
actionCollectionPointer->setDefaultShortcut(newWindowActionPointer, ctrlNKeySequence);
actionCollectionPointer->setDefaultShortcut(saveArchiveActionPointer, ctrlAKeySequence);
+ actionCollectionPointer->setDefaultShortcut(openWithFirefoxActionPointer, altFKeySequence);
+ actionCollectionPointer->setDefaultShortcut(openWithChromiumActionPointer, altCKeySequence);
actionCollectionPointer->setDefaultShortcut(zoomDefaultActionPointer, ctrl0KeySequence);
actionCollectionPointer->setDefaultShortcut(reloadAndBypassCacheActionPointer, ctrlF5KeySequence);
actionCollectionPointer->setDefaultShortcut(stopActionPointer, ctrlShiftXKeySequence);
connect(newTabActionPointer, SIGNAL(triggered()), tabWidgetPointer, SLOT(addTab()));
connect(newWindowActionPointer, SIGNAL(triggered()), this, SLOT(newWindow()));
connect(saveArchiveActionPointer, SIGNAL(triggered()), tabWidgetPointer, SLOT(saveArchive()));
+ connect(openWithFirefoxActionPointer, SIGNAL(triggered()), this, SLOT(openWithFirefox()));
+ connect(openWithChromiumActionPointer, SIGNAL(triggered()), this, SLOT(openWithChromium()));
connect(zoomDefaultActionPointer, SIGNAL(triggered()), this, SLOT(zoomDefault()));
connect(reloadAndBypassCacheActionPointer, SIGNAL(triggered()), this, SLOT(reloadAndBypassCache()));
connect(stopActionPointer, SIGNAL(triggered()), tabWidgetPointer, SLOT(stop()));
// Setup the GUI based on the browserwindowui.rc file.
setupGUI(StandardWindowOption::Default, ("browserwindowui.rc"));
+ // Check if other browsers are installed.
+ int firefoxExitCodeInt = system("firefox -v > /dev/null 2> /dev/null");
+ int chromiumExitCodeInt = system("chromium --version > /dev/null 2> /dev/null");
+
+ // Set the open with other browser actions visibility.
+ openWithFirefoxActionPointer->setVisible(firefoxExitCodeInt == 0);
+ openWithChromiumActionPointer->setVisible(chromiumExitCodeInt == 0);
+
// Get lists of the actions' associated widgets.
QList<QWidget*> userAgentAssociatedWidgetsPointerList = userAgentPrivacyBrowserActionPointer->associatedWidgets();
QList<QWidget*> searchEngineAssociatedWidgetsPointerList = searchEngineMojeekActionPointer->associatedWidgets();
browserWindowPointer->show();
}
+void BrowserWindow::openWithChromium() const
+{
+ // Open the current URL in Chromium
+ QProcess::startDetached("chromium", QStringList(urlLineEditPointer->text()));
+}
+
+void BrowserWindow::openWithFirefox() const
+{
+ // Open the current URL in Firefox.
+ QProcess::startDetached("firefox-esr", QStringList(urlLineEditPointer->text()));
+}
+
void BrowserWindow::populateBookmarksInAllWindows() const
{
// Get a list of all the registered service names.