Commit b173a45d authored by Laurent Montel's avatar Laurent Montel 😁
Browse files

Improve configure dialogbox

parent ad7ed139
......@@ -33,48 +33,43 @@
#include <QPushButton>
SieveEditorConfigureDialog::SieveEditorConfigureDialog(QWidget *parent)
: QDialog(parent)
: KPageDialog(parent)
{
setWindowTitle(i18nc("@title:window", "Configure"));
QVBoxLayout *mainLayout = new QVBoxLayout(this);
QDialogButtonBox *buttonBox = new QDialogButtonBox(QDialogButtonBox::Ok | QDialogButtonBox::Cancel, this);
QPushButton *okButton = buttonBox->button(QDialogButtonBox::Ok);
okButton->setDefault(true);
okButton->setShortcut(Qt::CTRL | Qt::Key_Return);
connect(buttonBox, &QDialogButtonBox::accepted, this, &SieveEditorConfigureDialog::accept);
connect(buttonBox, &QDialogButtonBox::rejected, this, &SieveEditorConfigureDialog::reject);
setFaceType(KPageDialog::List);
mTabWidget = new QTabWidget(this);
mTabWidget->setObjectName(QStringLiteral("tabwidget"));
buttonBox()->setStandardButtons(QDialogButtonBox::Ok| QDialogButtonBox::Cancel);
//Server page
QWidget *w = new QWidget;
mTabWidget->addTab(w, i18n("Sieve Server"));
connect(buttonBox(), &QDialogButtonBox::accepted, this, &SieveEditorConfigureDialog::accept);
connect(buttonBox(), &QDialogButtonBox::rejected, this, &SieveEditorConfigureDialog::reject);
QVBoxLayout *layout = new QVBoxLayout;
w->setLayout(layout);
//Server page
QWidget *serverConfigureWiget = new QWidget;
QVBoxLayout *layout = new QVBoxLayout(serverConfigureWiget);
mServerWidget = new SieveEditorConfigureServerWidget;
layout->addWidget(mServerWidget);
mCloseWallet = new QCheckBox(i18n("Close wallet when close application"));
layout->addWidget(mCloseWallet);
KPageWidgetItem *serverPageWidgetPage = new KPageWidgetItem(serverConfigureWiget, i18n("Sieve Server"));
serverPageWidgetPage->setIcon(QIcon::fromTheme(QStringLiteral("network-workgroup")));
addPage(serverPageWidgetPage);
//Editor page
QWidget *editorWidget = new QWidget;
editorWidget->setObjectName(QStringLiteral("editorwidget"));
mTabWidget->addTab(editorWidget, i18n("Editor"));
layout = new QVBoxLayout;
editorWidget->setLayout(layout);
layout = new QVBoxLayout(editorWidget);
mWrapText = new QCheckBox(i18n("Wrap Text"));
mWrapText->setObjectName(QStringLiteral("wraptext"));
layout->addWidget(mWrapText);
layout->addStretch(100);
KPageWidgetItem *editorPageWidgetPage = new KPageWidgetItem(editorWidget, i18n("Editor"));
editorPageWidgetPage->setIcon(QIcon::fromTheme(QStringLiteral("accessories-text-editor")));
addPage(editorPageWidgetPage);
mainLayout->addWidget(mTabWidget);
mainLayout->addWidget(buttonBox);
loadServerSieveConfig();
readConfig();
}
......
......@@ -20,11 +20,10 @@
#ifndef SIEVEEDITORCONFIGUREDIALOG_H
#define SIEVEEDITORCONFIGUREDIALOG_H
#include <QDialog>
#include <KPageDialog>
class QCheckBox;
class QTabWidget;
class SieveEditorConfigureServerWidget;
class SieveEditorConfigureDialog : public QDialog
class SieveEditorConfigureDialog : public KPageDialog
{
Q_OBJECT
public:
......@@ -40,7 +39,6 @@ private:
SieveEditorConfigureServerWidget *mServerWidget = nullptr;
QCheckBox *mCloseWallet = nullptr;
QCheckBox *mWrapText = nullptr;
QTabWidget *mTabWidget = nullptr;
};
#endif // SIEVEEDITORCONFIGUREDIALOG_H
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