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

Improve configure dialogbox

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