X-Git-Url: https://gitweb.stoutner.com/?a=blobdiff_plain;f=src%2Fwindows%2FDomainSettingsWindow.cpp;fp=src%2Fwindows%2FDomainSettingsWindow.cpp;h=af4b3e7a42e6a99a5d4d83e7cf7f87570d41d3e3;hb=0a7bcc3ab2d2a1015f29293fc9c527c1448a86cf;hp=0000000000000000000000000000000000000000;hpb=8f52378069b5b638dd832d1435e58e1596cc9798;p=PrivacyBrowserPC.git diff --git a/src/windows/DomainSettingsWindow.cpp b/src/windows/DomainSettingsWindow.cpp new file mode 100644 index 0000000..af4b3e7 --- /dev/null +++ b/src/windows/DomainSettingsWindow.cpp @@ -0,0 +1,72 @@ +/* + * 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 "DomainSettingsWindow.h" +#include "views/DomainSettingsView.h" + +// KDE Frameworks headers. +#include +#include + +DomainSettingsWindow::DomainSettingsWindow() : KXmlGuiWindow() +{ + // Instantiate the domain settings view pointer. + DomainSettingsView *domainSettingsViewPointer = new DomainSettingsView(this); + + // Set the domain settings view as the central widget. + setCentralWidget(domainSettingsViewPointer); + + // Set the object name. + this->setObjectName(QStringLiteral("domain_settings")); + + // Set the window title. + setCaption(i18nc("The Domain Settings window title", "Domain Settings")); + + // Get a handle for the action collection. + KActionCollection *actionCollectionPointer = this->actionCollection(); + + // Add the custom actions. + QAction *addDomainActionPointer = actionCollectionPointer->addAction(QStringLiteral("add_domain")); + QAction *deleteDomainActionPointer = actionCollectionPointer->addAction(QStringLiteral("delete_domain")); + QAction *okActionPointer = actionCollectionPointer->addAction(QStringLiteral("ok")); + QAction *applyActionPointer = actionCollectionPointer->addAction(QStringLiteral("apply")); + QAction *cancelActionPointer = actionCollectionPointer->addAction(QStringLiteral("cancel")); + + // Set the action text. + addDomainActionPointer->setText(i18nc("Add domain toolbar button", "Add Domain")); + deleteDomainActionPointer->setText(i18nc("Delete domain toolbar button", "Delete Domain")); + okActionPointer->setText(i18nc("OK toolbar button", "OK")); + applyActionPointer->setText(i18nc("Apply toolbar button", "Apply")); + cancelActionPointer->setText(i18nc("Cancel toolbar button", "Cancel")); + + // Set the action icons. + addDomainActionPointer->setIcon(QIcon::fromTheme(QStringLiteral("document-new"))); + deleteDomainActionPointer->setIcon(QIcon::fromTheme(QStringLiteral("delete"))); + okActionPointer->setIcon(QIcon::fromTheme(QStringLiteral("dialog-ok"))); + applyActionPointer->setIcon(QIcon::fromTheme(QStringLiteral("dialog-ok-apply"))); + cancelActionPointer->setIcon(QIcon::fromTheme(QStringLiteral("dialog-cancel"))); + + // Connect the button signals. + connect(addDomainActionPointer, SIGNAL(triggered()), domainSettingsViewPointer, SLOT(addDomain())); + connect(deleteDomainActionPointer, SIGNAL(triggered()), domainSettingsViewPointer, SLOT(deleteDomain())); + + // Setup the GUI without a status bar based on the domain_settings_ui.rc file. + setupGUI(StandardWindowOption::ToolBar | StandardWindowOption::Keys | StandardWindowOption::Save | StandardWindowOption::Create, ("domain_settings_ui.rc")); +}