From cbe1897336dab19aacdab557c36228902a60bbb5 Mon Sep 17 00:00:00 2001 From: Montel Laurent Date: Thu, 25 Aug 2016 07:31:32 +0200 Subject: [PATCH 1/7] Add test/autotests for filteractionmissingidentitydialog --- src/filter/autotests/CMakeLists.txt | 5 +++ .../filteractionmissingidentitydialogtest.cpp | 40 +++++++++++++++++++ .../filteractionmissingidentitydialogtest.h | 35 ++++++++++++++++ src/filter/tests/CMakeLists.txt | 11 +++++ .../filteractionmissingidentitydialoggui.cpp | 39 ++++++++++++++++++ 5 files changed, 130 insertions(+) create mode 100644 src/filter/autotests/filteractionmissingidentitydialogtest.cpp create mode 100644 src/filter/autotests/filteractionmissingidentitydialogtest.h create mode 100644 src/filter/tests/filteractionmissingidentitydialoggui.cpp diff --git a/src/filter/autotests/CMakeLists.txt b/src/filter/autotests/CMakeLists.txt index a2d5914..a838283 100644 --- a/src/filter/autotests/CMakeLists.txt +++ b/src/filter/autotests/CMakeLists.txt @@ -250,3 +250,8 @@ add_mailcommon_filter_test(filteractionmissingtagdialogtest filteractionmissingtagdialogtest.cpp ../dialog/filteractionmissingtagdialog.cpp ) + +add_mailcommon_filter_test(filteractionmissingidentitydialogtest + filteractionmissingidentitydialogtest.cpp + ../dialog/filteractionmissingidentitydialog.cpp + ) diff --git a/src/filter/autotests/filteractionmissingidentitydialogtest.cpp b/src/filter/autotests/filteractionmissingidentitydialogtest.cpp new file mode 100644 index 0000000..f39bfbe --- /dev/null +++ b/src/filter/autotests/filteractionmissingidentitydialogtest.cpp @@ -0,0 +1,40 @@ +/* + Copyright (C) 2016 Laurent Montel + + This library is free software; you can redistribute it and/or + modify it under the terms of the GNU Library General Public + License as published by the Free Software Foundation; either + version 2 of the License, or (at your option) any later version. + + This library 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 + Library General Public License for more details. + + You should have received a copy of the GNU Library General Public License + along with this library; see the file COPYING.LIB. If not, write to + the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, + Boston, MA 02110-1301, USA. +*/ + +#include "filteractionmissingidentitydialogtest.h" +#include "../filter/dialog/filteractionmissingidentitydialog.h" +#include + +FilterActionMissingIdentityDialogTest::FilterActionMissingIdentityDialogTest(QObject *parent) + : QObject(parent) +{ + +} + +FilterActionMissingIdentityDialogTest::~FilterActionMissingIdentityDialogTest() +{ + +} + +void FilterActionMissingIdentityDialogTest::shouldHaveDefaultValue() +{ + +} + +QTEST_MAIN(FilterActionMissingIdentityDialogTest) diff --git a/src/filter/autotests/filteractionmissingidentitydialogtest.h b/src/filter/autotests/filteractionmissingidentitydialogtest.h new file mode 100644 index 0000000..c8a804e --- /dev/null +++ b/src/filter/autotests/filteractionmissingidentitydialogtest.h @@ -0,0 +1,35 @@ +/* + Copyright (C) 2016 Laurent Montel + + This library is free software; you can redistribute it and/or + modify it under the terms of the GNU Library General Public + License as published by the Free Software Foundation; either + version 2 of the License, or (at your option) any later version. + + This library 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 + Library General Public License for more details. + + You should have received a copy of the GNU Library General Public License + along with this library; see the file COPYING.LIB. If not, write to + the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, + Boston, MA 02110-1301, USA. +*/ + +#ifndef FILTERACTIONMISSINGIDENTITYDIALOGTEST_H +#define FILTERACTIONMISSINGIDENTITYDIALOGTEST_H + +#include + +class FilterActionMissingIdentityDialogTest : public QObject +{ + Q_OBJECT +public: + explicit FilterActionMissingIdentityDialogTest(QObject *parent = Q_NULLPTR); + ~FilterActionMissingIdentityDialogTest(); +private Q_SLOTS: + void shouldHaveDefaultValue(); +}; + +#endif // FILTERACTIONMISSINGIDENTITYDIALOGTEST_H diff --git a/src/filter/tests/CMakeLists.txt b/src/filter/tests/CMakeLists.txt index ae39c27..e651c46 100644 --- a/src/filter/tests/CMakeLists.txt +++ b/src/filter/tests/CMakeLists.txt @@ -95,3 +95,14 @@ target_link_libraries(filteractionmissingtagdialoggui KF5::I18n KF5::Completion ) + +set(filteractionmissingidentitydialoggui_SRCS filteractionmissingidentitydialoggui.cpp ../../../autotests/dummykernel.cpp ../dialog/filteractionmissingidentitydialog.cpp) +add_executable(filteractionmissingidentitydialoggui ${filteractionmissingidentitydialoggui_SRCS}) +ecm_mark_as_test(filteractionmissingidentitydialoggui) +target_link_libraries(filteractionmissingidentitydialoggui + Qt5::Core + Qt5::Gui + KF5::MailCommon + KF5::I18n + KF5::Completion +) diff --git a/src/filter/tests/filteractionmissingidentitydialoggui.cpp b/src/filter/tests/filteractionmissingidentitydialoggui.cpp new file mode 100644 index 0000000..fbd0ae0 --- /dev/null +++ b/src/filter/tests/filteractionmissingidentitydialoggui.cpp @@ -0,0 +1,39 @@ +/* + Copyright (C) 2016 Laurent Montel + + This library is free software; you can redistribute it and/or + modify it under the terms of the GNU Library General Public + License as published by the Free Software Foundation; either + version 2 of the License, or (at your option) any later version. + + This library 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 + Library General Public License for more details. + + You should have received a copy of the GNU Library General Public License + along with this library; see the file COPYING.LIB. If not, write to + the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, + Boston, MA 02110-1301, USA. +*/ + +#include +#include +#include "../../../autotests/dummykernel.h" +#include "../kernel/mailkernel.h" +#include "../filter/dialog/filteractionmissingidentitydialog.h" + +int main(int argc, char **argv) +{ + QApplication app(argc, argv); + QStandardPaths::setTestModeEnabled(true); + DummyKernel *kernel = new DummyKernel(0); + CommonKernel->registerKernelIf(kernel); //register KernelIf early, it is used by the Filter classes + CommonKernel->registerSettingsIf(kernel); //SettingsIf is used in FolderTreeWidget + + MailCommon::FilterActionMissingIdentityDialog *w = new MailCommon::FilterActionMissingIdentityDialog(QStringLiteral("filename")); + w->exec(); + app.exec(); + delete w; + return 0; +} From ec9c0b76a63d76431abf690fa3ddfad7ef4c39b7 Mon Sep 17 00:00:00 2001 From: Montel Laurent Date: Thu, 25 Aug 2016 07:44:47 +0200 Subject: [PATCH 2/7] Fix layout. Remove double margin --- .../filteractionmissingidentitydialog.cpp | 24 +++++++++---------- 1 file changed, 11 insertions(+), 13 deletions(-) diff --git a/src/filter/dialog/filteractionmissingidentitydialog.cpp b/src/filter/dialog/filteractionmissingidentitydialog.cpp index 4dc39d3..29b6b35 100644 --- a/src/filter/dialog/filteractionmissingidentitydialog.cpp +++ b/src/filter/dialog/filteractionmissingidentitydialog.cpp @@ -42,8 +42,16 @@ FilterActionMissingIdentityDialog::FilterActionMissingIdentityDialog(const QStri setWindowTitle(i18n("Select Identity")); QVBoxLayout *mainLayout = new QVBoxLayout(this); - QWidget *mainWidget = new QWidget(this); - mainLayout->addWidget(mainWidget); + QLabel *label = new QLabel(this); + label->setObjectName(QStringLiteral("label")); + label->setText(i18n("Filter identity is missing. " + "Please select an identity to use with filter \"%1\"", + filtername)); + label->setWordWrap(true); + mainLayout->addWidget(label); + mComboBoxIdentity = new KIdentityManagement::IdentityCombo(KernelIf->identityManager(), this); + mComboBoxIdentity->setObjectName(QStringLiteral("comboboxidentity")); + mainLayout->addWidget(mComboBoxIdentity); QDialogButtonBox *buttonBox = new QDialogButtonBox(QDialogButtonBox::Ok | QDialogButtonBox::Cancel, this); buttonBox->setObjectName(QStringLiteral("buttonbox")); @@ -55,17 +63,7 @@ FilterActionMissingIdentityDialog::FilterActionMissingIdentityDialog(const QStri connect(buttonBox, &QDialogButtonBox::rejected, this, &FilterActionMissingIdentityDialog::reject); mainLayout->addWidget(buttonBox); okButton->setDefault(true); - QVBoxLayout *lay = new QVBoxLayout(mainWidget); - QLabel *label = new QLabel(this); - label->setObjectName(QStringLiteral("label")); - label->setText(i18n("Filter identity is missing. " - "Please select an identity to use with filter \"%1\"", - filtername)); - label->setWordWrap(true); - lay->addWidget(label); - mComboBoxIdentity = new KIdentityManagement::IdentityCombo(KernelIf->identityManager(), this); - mComboBoxIdentity->setObjectName(QStringLiteral("comboboxidentity")); - lay->addWidget(mComboBoxIdentity); + readConfig(); } From 9a8a5bb53ea37957e5f0ae60e082987ec8eda31b Mon Sep 17 00:00:00 2001 From: Montel Laurent Date: Thu, 25 Aug 2016 07:52:28 +0200 Subject: [PATCH 3/7] Add autotest --- src/filter/autotests/CMakeLists.txt | 1 + .../filteractionmissingidentitydialogtest.cpp | 24 +++++++++++++++++++ .../filteractionmissingidentitydialogtest.h | 1 + 3 files changed, 26 insertions(+) diff --git a/src/filter/autotests/CMakeLists.txt b/src/filter/autotests/CMakeLists.txt index a838283..3197788 100644 --- a/src/filter/autotests/CMakeLists.txt +++ b/src/filter/autotests/CMakeLists.txt @@ -254,4 +254,5 @@ add_mailcommon_filter_test(filteractionmissingtagdialogtest add_mailcommon_filter_test(filteractionmissingidentitydialogtest filteractionmissingidentitydialogtest.cpp ../dialog/filteractionmissingidentitydialog.cpp + ../../../autotests/dummykernel.cpp ) diff --git a/src/filter/autotests/filteractionmissingidentitydialogtest.cpp b/src/filter/autotests/filteractionmissingidentitydialogtest.cpp index f39bfbe..968fbc6 100644 --- a/src/filter/autotests/filteractionmissingidentitydialogtest.cpp +++ b/src/filter/autotests/filteractionmissingidentitydialogtest.cpp @@ -19,7 +19,12 @@ #include "filteractionmissingidentitydialogtest.h" #include "../filter/dialog/filteractionmissingidentitydialog.h" +#include "../../autotests/dummykernel.h" +#include "../../kernel/mailkernel.h" +#include +#include #include +#include FilterActionMissingIdentityDialogTest::FilterActionMissingIdentityDialogTest(QObject *parent) : QObject(parent) @@ -32,9 +37,28 @@ FilterActionMissingIdentityDialogTest::~FilterActionMissingIdentityDialogTest() } +void FilterActionMissingIdentityDialogTest::initTestCase() +{ + DummyKernel *kernel = new DummyKernel(0); + CommonKernel->registerKernelIf(kernel); //register KernelIf early, it is used by the Filter classes + CommonKernel->registerSettingsIf(kernel); //SettingsIf is used in FolderTreeWidget +} + void FilterActionMissingIdentityDialogTest::shouldHaveDefaultValue() { + MailCommon::FilterActionMissingIdentityDialog dlg(QStringLiteral("filename")); + QVERIFY(dlg.isModal()); + QVERIFY(!dlg.windowTitle().isEmpty()); + + QLabel *label = dlg.findChild(QStringLiteral("label")); + QVERIFY(label); + QVERIFY(!label->text().isEmpty()); + + KIdentityManagement::IdentityCombo *mComboBoxIdentity = dlg.findChild(QStringLiteral("comboboxidentity")); + QVERIFY(mComboBoxIdentity); + QDialogButtonBox *buttonBox = dlg.findChild(QStringLiteral("buttonbox")); + QVERIFY(buttonBox); } QTEST_MAIN(FilterActionMissingIdentityDialogTest) diff --git a/src/filter/autotests/filteractionmissingidentitydialogtest.h b/src/filter/autotests/filteractionmissingidentitydialogtest.h index c8a804e..e85f962 100644 --- a/src/filter/autotests/filteractionmissingidentitydialogtest.h +++ b/src/filter/autotests/filteractionmissingidentitydialogtest.h @@ -29,6 +29,7 @@ public: explicit FilterActionMissingIdentityDialogTest(QObject *parent = Q_NULLPTR); ~FilterActionMissingIdentityDialogTest(); private Q_SLOTS: + void initTestCase(); void shouldHaveDefaultValue(); }; From 2c3425fcea78a35bd78c3d1d2e612ddda43c63f6 Mon Sep 17 00:00:00 2001 From: Montel Laurent Date: Thu, 25 Aug 2016 08:11:47 +0200 Subject: [PATCH 4/7] Fix layout --- .../dialog/selectthunderbirdfilterfilesdialog.cpp | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/src/filter/dialog/selectthunderbirdfilterfilesdialog.cpp b/src/filter/dialog/selectthunderbirdfilterfilesdialog.cpp index 658e7e0..b9af869 100644 --- a/src/filter/dialog/selectthunderbirdfilterfilesdialog.cpp +++ b/src/filter/dialog/selectthunderbirdfilterfilesdialog.cpp @@ -32,22 +32,22 @@ SelectThunderbirdFilterFilesDialog::SelectThunderbirdFilterFilesDialog(const QSt : QDialog(parent) { setWindowTitle(i18n("Select thunderbird filter files")); + setModal(true); + QVBoxLayout *mainLayout = new QVBoxLayout(this); + + mSelectFilterFilesWidget = new MailCommon::SelectThunderbirdFilterFilesWidget(defaultSettingPath, this); + mainLayout->addWidget(mSelectFilterFilesWidget); + QDialogButtonBox *buttonBox = new QDialogButtonBox(QDialogButtonBox::Ok | QDialogButtonBox::Cancel, this); - QVBoxLayout *mainLayout = new QVBoxLayout; - setLayout(mainLayout); QPushButton *okButton = buttonBox->button(QDialogButtonBox::Ok); okButton->setDefault(true); okButton->setShortcut(Qt::CTRL | Qt::Key_Return); connect(buttonBox, &QDialogButtonBox::accepted, this, &SelectThunderbirdFilterFilesDialog::accept); connect(buttonBox, &QDialogButtonBox::rejected, this, &SelectThunderbirdFilterFilesDialog::reject); - okButton->setDefault(true); - setModal(true); - mSelectFilterFilesWidget = new MailCommon::SelectThunderbirdFilterFilesWidget(defaultSettingPath, this); connect(mSelectFilterFilesWidget, &MailCommon::SelectThunderbirdFilterFilesWidget::enableOkButton, okButton, &QPushButton::setEnabled); - mainLayout->addWidget(mSelectFilterFilesWidget); + okButton->setEnabled(false); mainLayout->addWidget(buttonBox); readConfig(); - okButton->setEnabled(false); } SelectThunderbirdFilterFilesDialog::~SelectThunderbirdFilterFilesDialog() From b18f9b4a9ca30097f43316464d19a385f88a323c Mon Sep 17 00:00:00 2001 From: Montel Laurent Date: Thu, 25 Aug 2016 08:13:46 +0200 Subject: [PATCH 5/7] Remove duplicate line --- src/filter/dialog/filteractionmissingaccountdialog.cpp | 1 - src/filter/dialog/filteractionmissingargumentdialog.cpp | 1 - src/filter/dialog/filteractionmissingidentitydialog.cpp | 1 - src/filter/dialog/filteractionmissingsoundurldialog.cpp | 1 - src/filter/dialog/filteractionmissingtagdialog.cpp | 1 - src/filter/dialog/filteractionmissingtemplatedialog.cpp | 1 - src/filter/dialog/filteractionmissingtransportdialog.cpp | 1 - src/filter/filterselectiondialog.cpp | 3 +-- src/filter/invalidfilters/invalidfilterdialog.cpp | 1 - src/folder/accountconfigorderdialog.cpp | 1 - src/tag/addtagdialog.cpp | 1 - 11 files changed, 1 insertion(+), 12 deletions(-) diff --git a/src/filter/dialog/filteractionmissingaccountdialog.cpp b/src/filter/dialog/filteractionmissingaccountdialog.cpp index 068d27b..5e9cab6 100644 --- a/src/filter/dialog/filteractionmissingaccountdialog.cpp +++ b/src/filter/dialog/filteractionmissingaccountdialog.cpp @@ -62,7 +62,6 @@ FilterActionMissingAccountDialog::FilterActionMissingAccountDialog(const QString connect(buttonBox, &QDialogButtonBox::accepted, this, &FilterActionMissingAccountDialog::accept); connect(buttonBox, &QDialogButtonBox::rejected, this, &FilterActionMissingAccountDialog::reject); mainLayout->addWidget(buttonBox); - okButton->setDefault(true); readConfig(); } diff --git a/src/filter/dialog/filteractionmissingargumentdialog.cpp b/src/filter/dialog/filteractionmissingargumentdialog.cpp index 101d542..c565c05 100644 --- a/src/filter/dialog/filteractionmissingargumentdialog.cpp +++ b/src/filter/dialog/filteractionmissingargumentdialog.cpp @@ -92,7 +92,6 @@ FilterActionMissingCollectionDialog::FilterActionMissingCollectionDialog( connect(buttonBox, &QDialogButtonBox::accepted, this, &FilterActionMissingCollectionDialog::accept); connect(buttonBox, &QDialogButtonBox::rejected, this, &FilterActionMissingCollectionDialog::reject); mainLayout->addWidget(buttonBox); - mOkButton->setDefault(true); mOkButton->setEnabled(false); readConfig(); } diff --git a/src/filter/dialog/filteractionmissingidentitydialog.cpp b/src/filter/dialog/filteractionmissingidentitydialog.cpp index 29b6b35..8f8824e 100644 --- a/src/filter/dialog/filteractionmissingidentitydialog.cpp +++ b/src/filter/dialog/filteractionmissingidentitydialog.cpp @@ -57,7 +57,6 @@ FilterActionMissingIdentityDialog::FilterActionMissingIdentityDialog(const QStri buttonBox->setObjectName(QStringLiteral("buttonbox")); QPushButton *okButton = buttonBox->button(QDialogButtonBox::Ok); - okButton->setDefault(true); okButton->setShortcut(Qt::CTRL | Qt::Key_Return); connect(buttonBox, &QDialogButtonBox::accepted, this, &FilterActionMissingIdentityDialog::accept); connect(buttonBox, &QDialogButtonBox::rejected, this, &FilterActionMissingIdentityDialog::reject); diff --git a/src/filter/dialog/filteractionmissingsoundurldialog.cpp b/src/filter/dialog/filteractionmissingsoundurldialog.cpp index ee471b3..37eb716 100644 --- a/src/filter/dialog/filteractionmissingsoundurldialog.cpp +++ b/src/filter/dialog/filteractionmissingsoundurldialog.cpp @@ -64,7 +64,6 @@ FilterActionMissingSoundUrlDialog::FilterActionMissingSoundUrlDialog(const QStri connect(buttonBox, &QDialogButtonBox::rejected, this, &FilterActionMissingSoundUrlDialog::reject); mainLayout->addWidget(buttonBox); - okButton->setDefault(true); readConfig(); } diff --git a/src/filter/dialog/filteractionmissingtagdialog.cpp b/src/filter/dialog/filteractionmissingtagdialog.cpp index 97c6176..93b0f65 100644 --- a/src/filter/dialog/filteractionmissingtagdialog.cpp +++ b/src/filter/dialog/filteractionmissingtagdialog.cpp @@ -71,7 +71,6 @@ FilterActionMissingTagDialog::FilterActionMissingTagDialog( QDialogButtonBox *buttonBox = new QDialogButtonBox(QDialogButtonBox::Ok | QDialogButtonBox::Cancel, this); buttonBox->setObjectName(QStringLiteral("buttonbox")); QPushButton *okButton = buttonBox->button(QDialogButtonBox::Ok); - okButton->setDefault(true); okButton->setShortcut(Qt::CTRL | Qt::Key_Return); QPushButton *user1Button = new QPushButton(this); user1Button->setObjectName(QStringLiteral("addtag")); diff --git a/src/filter/dialog/filteractionmissingtemplatedialog.cpp b/src/filter/dialog/filteractionmissingtemplatedialog.cpp index 5afe7f2..5bc6f63 100644 --- a/src/filter/dialog/filteractionmissingtemplatedialog.cpp +++ b/src/filter/dialog/filteractionmissingtemplatedialog.cpp @@ -61,7 +61,6 @@ FilterActionMissingTemplateDialog::FilterActionMissingTemplateDialog( connect(buttonBox, &QDialogButtonBox::accepted, this, &FilterActionMissingTemplateDialog::accept); connect(buttonBox, &QDialogButtonBox::rejected, this, &FilterActionMissingTemplateDialog::reject); mainLayout->addWidget(buttonBox); - okButton->setDefault(true); readConfig(); } diff --git a/src/filter/dialog/filteractionmissingtransportdialog.cpp b/src/filter/dialog/filteractionmissingtransportdialog.cpp index 4b7b3b6..3c0d545 100644 --- a/src/filter/dialog/filteractionmissingtransportdialog.cpp +++ b/src/filter/dialog/filteractionmissingtransportdialog.cpp @@ -57,7 +57,6 @@ FilterActionMissingTransportDialog::FilterActionMissingTransportDialog(const QSt connect(buttonBox, &QDialogButtonBox::accepted, this, &FilterActionMissingTransportDialog::accept); connect(buttonBox, &QDialogButtonBox::rejected, this, &FilterActionMissingTransportDialog::reject); mainLayout->addWidget(buttonBox); - okButton->setDefault(true); readConfig(); } diff --git a/src/filter/filterselectiondialog.cpp b/src/filter/filterselectiondialog.cpp index f3f0600..57dc482 100644 --- a/src/filter/filterselectiondialog.cpp +++ b/src/filter/filterselectiondialog.cpp @@ -39,11 +39,10 @@ FilterSelectionDialog::FilterSelectionDialog(QWidget *parent) QVBoxLayout *top = new QVBoxLayout; setLayout(top); mOkButton = buttonBox->button(QDialogButtonBox::Ok); - mOkButton->setDefault(true); mOkButton->setShortcut(Qt::CTRL | Qt::Key_Return); + mOkButton->setDefault(true); connect(buttonBox, &QDialogButtonBox::accepted, this, &FilterSelectionDialog::accept); connect(buttonBox, &QDialogButtonBox::rejected, this, &FilterSelectionDialog::reject); - mOkButton->setDefault(true); filtersListWidget = new QListWidget(this); KListWidgetSearchLine *searchLine = new KListWidgetSearchLine(this, filtersListWidget); diff --git a/src/filter/invalidfilters/invalidfilterdialog.cpp b/src/filter/invalidfilters/invalidfilterdialog.cpp index c5b7713..a999da3 100644 --- a/src/filter/invalidfilters/invalidfilterdialog.cpp +++ b/src/filter/invalidfilters/invalidfilterdialog.cpp @@ -36,7 +36,6 @@ InvalidFilterDialog::InvalidFilterDialog(QWidget *parent) QVBoxLayout *mainLayout = new QVBoxLayout; setLayout(mainLayout); QPushButton *okButton = buttonBox->button(QDialogButtonBox::Ok); - okButton->setDefault(true); okButton->setShortcut(Qt::CTRL | Qt::Key_Return); connect(buttonBox, &QDialogButtonBox::accepted, this, &QDialog::accept); connect(buttonBox, &QDialogButtonBox::rejected, this, &QDialog::reject); diff --git a/src/folder/accountconfigorderdialog.cpp b/src/folder/accountconfigorderdialog.cpp index f0d1315..ce9aa0d 100644 --- a/src/folder/accountconfigorderdialog.cpp +++ b/src/folder/accountconfigorderdialog.cpp @@ -72,7 +72,6 @@ AccountConfigOrderDialog::AccountConfigOrderDialog(QWidget *parent) okButton->setDefault(true); okButton->setShortcut(Qt::CTRL | Qt::Key_Return); connect(buttonBox, &QDialogButtonBox::rejected, this, &AccountConfigOrderDialog::reject); - okButton->setDefault(true); QWidget *page = new QWidget(this); mainLayout->addWidget(page); diff --git a/src/tag/addtagdialog.cpp b/src/tag/addtagdialog.cpp index 3bc1b44..69c55e1 100644 --- a/src/tag/addtagdialog.cpp +++ b/src/tag/addtagdialog.cpp @@ -58,7 +58,6 @@ AddTagDialog::AddTagDialog(const QList &actions, QWidget *p QVBoxLayout *mainLayout = new QVBoxLayout; setLayout(mainLayout); d->mOkButton = buttonBox->button(QDialogButtonBox::Ok); - d->mOkButton->setDefault(true); d->mOkButton->setShortcut(Qt::CTRL | Qt::Key_Return); connect(buttonBox, &QDialogButtonBox::accepted, this, &AddTagDialog::slotSave); connect(buttonBox, &QDialogButtonBox::rejected, this, &AddTagDialog::reject); From d4f5a3a8cf157483c1dccb994561026671801ca4 Mon Sep 17 00:00:00 2001 From: Montel Laurent Date: Thu, 25 Aug 2016 08:15:26 +0200 Subject: [PATCH 6/7] Add parent. --- src/tag/addtagdialog.cpp | 20 +++++++++++--------- 1 file changed, 11 insertions(+), 9 deletions(-) diff --git a/src/tag/addtagdialog.cpp b/src/tag/addtagdialog.cpp index 69c55e1..848f45d 100644 --- a/src/tag/addtagdialog.cpp +++ b/src/tag/addtagdialog.cpp @@ -54,20 +54,22 @@ AddTagDialog::AddTagDialog(const QList &actions, QWidget *p { setModal(true); setWindowTitle(i18n("Add Tag")); - QDialogButtonBox *buttonBox = new QDialogButtonBox(QDialogButtonBox::Ok | QDialogButtonBox::Cancel); - QVBoxLayout *mainLayout = new QVBoxLayout; - setLayout(mainLayout); - d->mOkButton = buttonBox->button(QDialogButtonBox::Ok); - d->mOkButton->setShortcut(Qt::CTRL | Qt::Key_Return); - connect(buttonBox, &QDialogButtonBox::accepted, this, &AddTagDialog::slotSave); - connect(buttonBox, &QDialogButtonBox::rejected, this, &AddTagDialog::reject); - d->mOkButton->setDefault(true); + QVBoxLayout *mainLayout = new QVBoxLayout(this); + d->mTagWidget = new MailCommon::TagWidget(actions, this); + mainLayout->addWidget(d->mTagWidget); connect(d->mTagWidget->tagNameLineEdit(), &KLineEdit::textChanged, this, &AddTagDialog::slotTagNameChanged); + + QDialogButtonBox *buttonBox = new QDialogButtonBox(QDialogButtonBox::Ok | QDialogButtonBox::Cancel, this); + d->mOkButton->setShortcut(Qt::CTRL | Qt::Key_Return); + d->mOkButton = buttonBox->button(QDialogButtonBox::Ok); + connect(buttonBox, &QDialogButtonBox::accepted, this, &AddTagDialog::slotSave); + connect(buttonBox, &QDialogButtonBox::rejected, this, &AddTagDialog::reject); + d->mOkButton->setDefault(true); d->mOkButton->setEnabled(false); - mainLayout->addWidget(d->mTagWidget); + mainLayout->addWidget(buttonBox); } From 34f8fd6225faf59a2e00dc39aeb0e683b41023fb Mon Sep 17 00:00:00 2001 From: Montel Laurent Date: Thu, 25 Aug 2016 08:16:15 +0200 Subject: [PATCH 7/7] Set directly parent to layout --- src/tag/tagwidget.cpp | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/src/tag/tagwidget.cpp b/src/tag/tagwidget.cpp index a753c3b..bf36cb6 100644 --- a/src/tag/tagwidget.cpp +++ b/src/tag/tagwidget.cpp @@ -73,8 +73,7 @@ TagWidget::TagWidget(const QList &actionCollections, QWidge : QWidget(parent), d(new MailCommon::TagWidgetPrivate) { - QGridLayout *settings = new QGridLayout; - setLayout(settings); + QGridLayout *settings = new QGridLayout(this); //Stretcher layout for adding some space after the label QVBoxLayout *spacer = new QVBoxLayout();