Commit 3a4b6d5a authored by Ingo Klöcker's avatar Ingo Klöcker
Browse files

Remove unused CryptoConfigDialog

GnuPG-bug-id: 5404
parent c6a70cbc
......@@ -60,7 +60,6 @@ set(libkleo_ui_common_SRCS
ui/filenamerequester.cpp
ui/messagebox.cpp
ui/cryptoconfigmodule.cpp
ui/cryptoconfigdialog.cpp
ui/directoryserviceswidget.cpp
ui/progressbar.cpp
ui/progressdialog.cpp
......@@ -187,7 +186,6 @@ ecm_generate_headers(libkleo_CamelCase_utils_HEADERS
ecm_generate_headers(libkleo_CamelCase_ui_HEADERS
HEADER_NAMES
CryptoConfigDialog
CryptoConfigModule
DNAttributeOrderConfigWidget
DirectoryServicesWidget
......
/*
cryptoconfigdialog.h
This file is part of kgpgcertmanager
SPDX-FileCopyrightText: 2004 Klarälvdalens Datakonsult AB
SPDX-License-Identifier: GPL-2.0-or-later
*/
#include "cryptoconfigdialog.h"
#include "cryptoconfigmodule.h"
#include <KLocalizedString>
#include <KAcceleratorManager>
#include <QDialogButtonBox>
#include <QPushButton>
#include <KGuiItem>
#include <QVBoxLayout>
Kleo::CryptoConfigDialog::CryptoConfigDialog(QGpgME::CryptoConfig *config, QWidget *parent)
: QDialog(parent)
{
setWindowTitle(i18nc("@title:window", "Configure GnuPG Backend"));
auto mainLayout = new QVBoxLayout(this);
mButtonBox = new QDialogButtonBox(QDialogButtonBox::Ok | QDialogButtonBox::Cancel | QDialogButtonBox::RestoreDefaults | QDialogButtonBox::Apply, this);
QPushButton *okButton = mButtonBox->button(QDialogButtonBox::Ok);
okButton->setShortcut(Qt::CTRL | Qt::Key_Return);
auto user1Button = new QPushButton(this);
mButtonBox->addButton(user1Button, QDialogButtonBox::ActionRole);
connect(mButtonBox, &QDialogButtonBox::accepted, this, &CryptoConfigDialog::accept);
connect(mButtonBox, &QDialogButtonBox::rejected, this, &CryptoConfigDialog::reject);
okButton->setDefault(true);
setModal(true);
KGuiItem::assign(user1Button, KGuiItem(i18n("&Reset")));
mMainWidget = new CryptoConfigModule(config, this);
mainLayout->addWidget(mMainWidget);
mainLayout->addWidget(mButtonBox);
connect(mMainWidget, &CryptoConfigModule::changed, this, &CryptoConfigDialog::slotChanged);
mButtonBox->button(QDialogButtonBox::Apply)->setEnabled(false);
if (mMainWidget->hasError()) {
mButtonBox->button(QDialogButtonBox::RestoreDefaults)->setVisible(false);
user1Button->setVisible(false);
mButtonBox->button(QDialogButtonBox::Apply)->setVisible(false);
okButton->setVisible(false);
}
// Automatically assign accelerators
KAcceleratorManager::manage(this);
connect(user1Button, &QPushButton::clicked, this, &CryptoConfigDialog::slotUser1);
connect(mButtonBox->button(QDialogButtonBox::Cancel), &QPushButton::clicked, this, &CryptoConfigDialog::slotCancel);
connect(okButton, &QPushButton::clicked, this, &CryptoConfigDialog::slotOk);
connect(mButtonBox->button(QDialogButtonBox::RestoreDefaults), &QPushButton::clicked, this, &CryptoConfigDialog::slotDefault);
connect(mButtonBox->button(QDialogButtonBox::Apply), &QPushButton::clicked, this, &CryptoConfigDialog::slotApply);
}
void Kleo::CryptoConfigDialog::slotOk()
{
slotApply();
accept();
}
void Kleo::CryptoConfigDialog::slotCancel()
{
mMainWidget->cancel();
reject();
}
void Kleo::CryptoConfigDialog::slotDefault()
{
mMainWidget->defaults();
slotChanged();
}
void Kleo::CryptoConfigDialog::slotApply()
{
mMainWidget->save();
mButtonBox->button(QDialogButtonBox::Apply)->setEnabled(false);
}
void Kleo::CryptoConfigDialog::slotUser1() // reset
{
mMainWidget->reset();
mButtonBox->button(QDialogButtonBox::Apply)->setEnabled(false);
}
void Kleo::CryptoConfigDialog::slotChanged()
{
mButtonBox->button(QDialogButtonBox::Apply)->setEnabled(true);
}
/*
cryptoconfigdialog.h
This file is part of kgpgcertmanager
SPDX-FileCopyrightText: 2004 Klarälvdalens Datakonsult AB
SPDX-License-Identifier: GPL-2.0-or-later
*/
#pragma once
#include "kleo_export.h"
#include <QDialog>
class QDialogButtonBox;
namespace QGpgME
{
class CryptoConfig;
} // namespace QGpgME
namespace Kleo
{
class CryptoConfigModule;
/**
* Simple QDialog wrapper around CryptoConfigModule
*/
class KLEO_EXPORT CryptoConfigDialog : public QDialog
{
Q_OBJECT
public:
explicit CryptoConfigDialog(QGpgME::CryptoConfig *config, QWidget *parent = nullptr);
protected Q_SLOTS:
void slotOk();
void slotCancel();
void slotDefault();
void slotApply();
void slotUser1(); // reset
public Q_SLOTS:
void slotChanged();
private:
CryptoConfigModule *mMainWidget = nullptr;
QDialogButtonBox *mButtonBox = nullptr;
};
}
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment