void MainWindow::actionAboutApplication() { WebBackend *backend = WebBackendsManager::getBackend(); QString about = tr("<b>Otter %1</b><br>Web browser controlled by the user, not vice-versa.").arg(QApplication::applicationVersion()); about.append(QLatin1String("<br><br>") + tr("Web backend: %1 %2.").arg(backend->getTitle()).arg(backend->getEngineVersion()) + QLatin1String("<br><br>")); if (QSslSocket::supportsSsl()) { about.append(tr("SSL library version: %1.").arg(QSslSocket::sslLibraryVersionString())); } else { about.append(tr("SSL library not available.")); } QMessageBox::about(this, QLatin1String("Otter"), about); }
void MainWindow::triggerAction(int identifier, const QVariantMap ¶meters) { switch (identifier) { case ActionsManager::NewWindowAction: emit requestedNewWindow(false, false, QUrl()); break; case ActionsManager::NewWindowPrivateAction: emit requestedNewWindow(true, false, QUrl()); break; case ActionsManager::OpenAction: { const QUrl url = QFileDialog::getOpenFileUrl(this, tr("Open File")); if (url.isValid()) { m_windowsManager->open(url); } } break; case ActionsManager::ClosePrivateTabsPanicAction: if (SessionsManager::isPrivate()) { Application::getInstance()->close(); } else { const QList<MainWindow*> windows = SessionsManager::getWindows(); for (int i = 0; i < windows.count(); ++i) { if (windows[i]->getWindowsManager()->isPrivate()) { windows[i]->close(); } else { windows[i]->getWindowsManager()->triggerAction(ActionsManager::ClosePrivateTabsAction); } } } break; case ActionsManager::MaximizeTabAction: case ActionsManager::MinimizeTabAction: case ActionsManager::RestoreTabAction: case ActionsManager::AlwaysOnTopTabAction: case ActionsManager::MaximizeAllAction: case ActionsManager::MinimizeAllAction: case ActionsManager::RestoreAllAction: case ActionsManager::CascadeAllAction: case ActionsManager::TileAllAction: m_workspace->triggerAction(identifier, parameters); break; case ActionsManager::CloseWindowAction: close(); break; case ActionsManager::SessionsAction: { SessionsManagerDialog dialog(this); dialog.exec(); } break; case ActionsManager::SaveSessionAction: { SaveSessionDialog dialog(this); dialog.exec(); } break; case ActionsManager::GoToPageAction: { OpenAddressDialog dialog(this); connect(&dialog, SIGNAL(requestedLoadUrl(QUrl,WindowsManager::OpenHints)), m_windowsManager, SLOT(open(QUrl,WindowsManager::OpenHints))); connect(&dialog, SIGNAL(requestedOpenBookmark(BookmarksItem*,WindowsManager::OpenHints)), m_windowsManager, SLOT(open(BookmarksItem*,WindowsManager::OpenHints))); connect(&dialog, SIGNAL(requestedSearch(QString,QString,WindowsManager::OpenHints)), m_windowsManager, SLOT(search(QString,QString,WindowsManager::OpenHints))); dialog.exec(); } break; case ActionsManager::GoToHomePageAction: { const QString homePage = SettingsManager::getValue(QLatin1String("Browser/HomePage")).toString(); if (!homePage.isEmpty()) { m_windowsManager->open(QUrl(homePage), WindowsManager::CurrentTabOpen); } } break; case ActionsManager::BookmarksAction: { const QUrl url(QLatin1String("about:bookmarks")); if (!SessionsManager::hasUrl(url, true)) { m_windowsManager->open(url); } } break; case ActionsManager::AddBookmarkAction: addBookmark(QUrl(), QString(), QString(), true); break; case ActionsManager::QuickBookmarkAccessAction: { OpenBookmarkDialog dialog(this); connect(&dialog, SIGNAL(requestedOpenBookmark(BookmarksItem*)), m_windowsManager, SLOT(open(BookmarksItem*))); dialog.exec(); } break; case ActionsManager::WorkOfflineAction: SettingsManager::setValue(QLatin1String("Network/WorkOffline"), parameters); break; case ActionsManager::FullScreenAction: if (isFullScreen()) { restoreWindowState(); } else { storeWindowState(); showFullScreen(); } break; case ActionsManager::ShowTabSwitcherAction: if (!m_tabSwitcher) { m_tabSwitcher = new TabSwitcherWidget(m_windowsManager, this); } m_tabSwitcher->raise(); m_tabSwitcher->resize(size()); m_tabSwitcher->show(TabSwitcherWidget::ActionReason); break; case ActionsManager::ShowMenuBarAction: { ToolBarDefinition definition = ToolBarsManager::getToolBarDefinition(ToolBarsManager::MenuBar); definition.visibility = (parameters.value(QLatin1String("isChecked")).toBool() ? AlwaysVisibleToolBar : AlwaysHiddenToolBar); ToolBarsManager::setToolBar(definition); } break; case ActionsManager::ShowTabBarAction: { ToolBarDefinition definition = ToolBarsManager::getToolBarDefinition(ToolBarsManager::TabBar); definition.visibility = (parameters.value(QLatin1String("isChecked")).toBool() ? AlwaysVisibleToolBar : AlwaysHiddenToolBar); ToolBarsManager::setToolBar(definition); } break; case ActionsManager::ShowSidebarAction: SettingsManager::setValue(QLatin1String("Sidebar/Visible"), parameters.value(QLatin1String("isChecked")).toBool()); break; case ActionsManager::OpenPanelAction: if (m_sidebar && m_sidebar->getCurrentPanel()) { m_windowsManager->open(m_sidebar->getCurrentPanel()->getUrl(), WindowsManager::NewTabOpen); } break; case ActionsManager::ClosePanelAction: SettingsManager::setValue(QLatin1String("Sidebar/CurrentPanel"), QString()); break; case ActionsManager::ShowErrorConsoleAction: m_ui->consoleDockWidget->setVisible(parameters.value(QLatin1String("isChecked")).toBool()); break; case ActionsManager::LockToolBarsAction: ToolBarsManager::setToolBarsLocked(parameters.value(QLatin1String("isChecked")).toBool()); break; case ActionsManager::ContentBlockingAction: { ContentBlockingDialog dialog(this); dialog.exec(); } break; case ActionsManager::HistoryAction: { const QUrl url(QLatin1String("about:history")); if (!SessionsManager::hasUrl(url, true)) { m_windowsManager->open(url); } } break; case ActionsManager::ClearHistoryAction: { ClearHistoryDialog dialog(SettingsManager::getValue(QLatin1String("History/ManualClearOptions")).toStringList(), false, this); dialog.exec(); } break; case ActionsManager::NotesAction: { const QUrl url(QLatin1String("about:notes")); if (!SessionsManager::hasUrl(url, true)) { m_windowsManager->open(url); } } break; case ActionsManager::TransfersAction: { const QUrl url(QLatin1String("about:transfers")); if (!SessionsManager::hasUrl(url, true)) { m_windowsManager->open(url); } } break; case ActionsManager::CookiesAction: { const QUrl url(QLatin1String("about:cookies")); if (!SessionsManager::hasUrl(url, true)) { m_windowsManager->open(url); } } break; case ActionsManager::PreferencesAction: { PreferencesDialog dialog(QLatin1String("general"), this); dialog.exec(); } break; case ActionsManager::SwitchApplicationLanguageAction: { LocaleDialog dialog(this); dialog.exec(); } break; case ActionsManager::CheckForUpdatesAction: { UpdateCheckerDialog *dialog = new UpdateCheckerDialog(this); dialog->show(); } break; case ActionsManager::DiagnosticReportAction: { ReportDialog *dialog = new ReportDialog(this); dialog->show(); } break; case ActionsManager::AboutApplicationAction: { WebBackend *backend = AddonsManager::getWebBackend(); QString about = tr("<b>Otter %1</b><br>Web browser controlled by the user, not vice-versa.").arg(Application::getInstance()->getFullVersion()); about.append(QLatin1String("<br><br>") + tr("Web backend: %1 %2.").arg(backend->getTitle()).arg(backend->getEngineVersion()) + QLatin1String("<br><br>")); if (QSslSocket::supportsSsl()) { about.append(tr("SSL library version: %1.").arg(QSslSocket::sslLibraryVersionString())); } else { about.append(tr("SSL library not available.")); } QMessageBox::about(this, QLatin1String("Otter"), about); } break; case ActionsManager::AboutQtAction: Application::getInstance()->aboutQt(); break; case ActionsManager::ExitAction: Application::getInstance()->close(); break; default: m_windowsManager->triggerAction(identifier, parameters); break; } }