X-Git-Url: https://gitweb.stoutner.com/?a=blobdiff_plain;f=src%2Fbrowserwindow.cpp;fp=src%2Fbrowserwindow.cpp;h=0000000000000000000000000000000000000000;hb=05800bafb963a10f291d2a9604dc90cd7ac37c7b;hp=baf9fe90655ec809e1999c4b4f59b0f5eaca783e;hpb=a65c9f31cc84f245da08642cefefe7a17fa941ce;p=PrivacyBrowserPC.git diff --git a/src/browserwindow.cpp b/src/browserwindow.cpp deleted file mode 100644 index baf9fe9..0000000 --- a/src/browserwindow.cpp +++ /dev/null @@ -1,102 +0,0 @@ -/* - * Copyright © 2022 Soren Stoutner . - * - * This file is part of Privacy Browser PC . - * - * Privacy Browser PC is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * Privacy Browser PC is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with Privacy Browser PC. If not, see . - */ - -// Application headers. -#include "browserwindow.h" -#include "settings.h" -#include "ui_settingsprivacy.h" -#include "ui_settingsgeneral.h" - -// KDE Frameworks headers. -#include -#include - -// Qt framework headers. -#include - -BrowserWindow::BrowserWindow() : KXmlGuiWindow() -{ - // Instantiate the main view pointer. - mainViewPointer = new MainView(this); - - // Set the main view as the central widget. - setCentralWidget(mainViewPointer); - - // Get a handle for the action collectoin. - KActionCollection *actionCollectionPointer = this->actionCollection(); - - // Add the standard actions. - KStandardAction::openNew(this, SLOT(fileNew()), actionCollectionPointer); - KStandardAction::quit(qApp, SLOT(closeAllWindows()), actionCollectionPointer); - KStandardAction::preferences(this, SLOT(settingsConfigure()), actionCollectionPointer); - - // Update the status bar with the URL when a link is hovered. - connect(mainViewPointer, SIGNAL(linkHovered(QString)), this, SLOT(updateStatusBar(QString))); - - // Setup the GUI based on the privacybrowserui.rc file. - setupGUI(); -} - -void BrowserWindow::fileNew() -{ - // Display a new instance of Privacy Browser. - (new BrowserWindow)->show(); -} - -void BrowserWindow::settingsConfigure() -{ - // Check to make sure the dialog box isn't already displayed. - if (!KConfigDialog::exists(QStringLiteral("settings"))) - { - // Create the settings widgets. - QWidget *privacySettingsWidgetPointer = new QWidget; - QWidget *generalSettingsWidgetPointer = new QWidget; - - // Instantiate the settings UI. - Ui::PrivacySettings privacySettingsUi; - Ui::GeneralSettings generalSettingsUi; - - // Setup the UI to display the settings widgets. - privacySettingsUi.setupUi(privacySettingsWidgetPointer); - generalSettingsUi.setupUi(generalSettingsWidgetPointer); - - // Instantiate a settings config dialog from the settings.kcfg file. - KConfigDialog *configDialogPointer = new KConfigDialog(this, QStringLiteral("settings"), Settings::self()); - - // Add the settings widgets as config dialog pages. - configDialogPointer->addPage(privacySettingsWidgetPointer, i18nc("@title:tab", "Privacy"), QStringLiteral("privacy-browser")); - configDialogPointer->addPage(generalSettingsWidgetPointer, i18nc("@title:tab", "General"), QStringLiteral("breeze-settings")); - - // Delete the config dialog when it is closed. - configDialogPointer->setAttribute(Qt::WA_DeleteOnClose); - - // Make it so. - configDialogPointer->show(); - - // Apply the settings when they are updated. - connect(configDialogPointer, SIGNAL(settingsChanged(QString)), mainViewPointer, SLOT(applyApplicationSettings())); - connect(configDialogPointer, SIGNAL(settingsChanged(QString)), mainViewPointer, SLOT(applyDomainSettings())); - } -} - -void BrowserWindow::updateStatusBar(const QString &statusBarMessage) -{ - // Display the status bar message. - statusBar()->showMessage(statusBarMessage); -}