Commit 39a7ef7e authored by Laurent Montel's avatar Laurent Montel 😁

Move code

parent 92d22b2b
......@@ -11,11 +11,11 @@ macro(add_kmail_confirmaddress_unittest _source _additional)
target_link_libraries( ${_name} Qt5::Test KF5::IconThemes KF5::MessageComposer KF5::I18n KF5::PimCommon)
endmacro ()
add_kmail_confirmaddress_unittest(confirmaddressplugintest.cpp "../confirmaddressplugin.cpp;../confirmaddressinterface.cpp;../confirmaddressconfigurewidget.cpp;../confirmaddressdialog.cpp;../confirmaddresswidget.cpp")
add_kmail_confirmaddress_unittest(confirmaddressplugintest.cpp "../confirmaddressplugin.cpp;../confirmaddressinterface.cpp;../confirmaddressconfigurewidget.cpp;../confirmaddressdialog.cpp;../confirmaddresswidget.cpp;../confirmaddressconfiguretab.cpp")
add_kmail_confirmaddress_unittest(confirmaddressinterfacetest.cpp "../confirmaddressinterface.cpp;../confirmaddressconfigurewidget.cpp;../confirmaddressdialog.cpp;../confirmaddresswidget.cpp")
add_kmail_confirmaddress_unittest(confirmaddressinterfacetest.cpp "../confirmaddressinterface.cpp;../confirmaddressconfigurewidget.cpp;../confirmaddressdialog.cpp;../confirmaddresswidget.cpp;../confirmaddressconfiguretab.cpp")
add_kmail_confirmaddress_unittest(confirmaddressconfigurewidgettest.cpp "../confirmaddressconfigurewidget.cpp")
add_kmail_confirmaddress_unittest(confirmaddressconfigurewidgettest.cpp "../confirmaddressconfigurewidget.cpp;../confirmaddressconfiguretab.cpp")
add_kmail_confirmaddress_unittest(confirmaddressdialogtest.cpp "../confirmaddressdialog.cpp;../confirmaddresswidget.cpp")
......
......@@ -19,12 +19,11 @@
#include "confirmaddressconfigurewidgettest.h"
#include "../confirmaddressconfigurewidget.h"
#include "../confirmaddressconfiguretab.h"
#include <QTest>
#include <QVBoxLayout>
#include <QCheckBox>
#include <QGroupBox>
#include <PimCommon/SimpleStringlistEditor>
ConfirmAddressConfigureWidgetTest::ConfirmAddressConfigureWidgetTest(QObject *parent)
: QObject(parent)
......@@ -46,19 +45,8 @@ void ConfirmAddressConfigureWidgetTest::shouldHaveDefaultValue()
QCheckBox *enable = w.findChild<QCheckBox *>(QStringLiteral("enable"));
QVERIFY(enable);
QGroupBox *groupBoxDomainName = w.findChild<QGroupBox *>(QStringLiteral("groupboxdomainname"));
QVERIFY(groupBoxDomainName);
QLayout *layoutDomainName = w.findChild<QVBoxLayout *>(QStringLiteral("layoutdomainname"));
QVERIFY(layoutDomainName);
PimCommon::SimpleStringListEditor *mDomainNameListEditor = w.findChild<PimCommon::SimpleStringListEditor *>(QStringLiteral("domainnamelisteditor"));
QVERIFY(mDomainNameListEditor);
QGroupBox *groupBoxWhiteList = w.findChild<QGroupBox *>(QStringLiteral("groupboxwhitelist"));
QVERIFY(groupBoxWhiteList);
QLayout *layoutWhiteList = w.findChild<QVBoxLayout *>(QStringLiteral("layoutwhitelist"));
QVERIFY(layoutWhiteList);
PimCommon::SimpleStringListEditor *mWhiteListEditor = w.findChild<PimCommon::SimpleStringListEditor *>(QStringLiteral("whitelisteditor"));
QVERIFY(mWhiteListEditor);
ConfirmAddressConfigureTab *mConfirmAddressConfigureTab = w.findChild<ConfirmAddressConfigureTab *>(QStringLiteral("confirmaddresstab"));
QVERIFY(mConfirmAddressConfigureTab);
}
QTEST_MAIN(ConfirmAddressConfigureWidgetTest)
......@@ -32,9 +32,31 @@ ConfirmAddressConfigureTab::ConfirmAddressConfigureTab(QWidget *parent)
mTabWidget = new QTabWidget(this);
mTabWidget->setObjectName(QStringLiteral("tabwidget"));
mainLayout->addWidget(mTabWidget);
initTab();
}
ConfirmAddressConfigureTab::~ConfirmAddressConfigureTab()
{
}
void ConfirmAddressConfigureTab::loadSettings()
{
}
void ConfirmAddressConfigureTab::saveSettings()
{
}
void ConfirmAddressConfigureTab::resetSettings()
{
}
void ConfirmAddressConfigureTab::initTab()
{
//TODO
}
......@@ -30,10 +30,16 @@ class ConfirmAddressConfigureTab : public QWidget
public:
explicit ConfirmAddressConfigureTab(QWidget *parent = Q_NULLPTR);
~ConfirmAddressConfigureTab();
void loadSettings();
void saveSettings();
void resetSettings();
Q_SIGNALS:
void configureChanged();
private:
void initTab();
QTabWidget *mTabWidget;
};
......
......@@ -72,3 +72,9 @@ ConfirmAddressConfigureTabWidget::~ConfirmAddressConfigureTabWidget()
{
}
void ConfirmAddressConfigureTabWidget::resetSettings()
{
mDomainNameListEditor->setStringList({});
mWhiteListEditor->setStringList({});
}
......@@ -33,6 +33,8 @@ public:
explicit ConfirmAddressConfigureTabWidget(QWidget *parent = Q_NULLPTR);
~ConfirmAddressConfigureTabWidget();
void resetSettings();
Q_SIGNALS:
void configureChanged();
......
......@@ -17,15 +17,13 @@
Boston, MA 02110-1301, USA.
*/
#include "confirmaddressconfiguretab.h"
#include "confirmaddressconfigurewidget.h"
#include <KLocalizedString>
#include <QCheckBox>
#include <QVBoxLayout>
#include <QLabel>
#include <QGroupBox>
#include <KConfigGroup>
#include <KSharedConfig>
#include <PimCommon/SimpleStringlistEditor>
ConfirmAddressConfigureWidget::ConfirmAddressConfigureWidget(QWidget *parent)
: MessageComposer::PluginEditorCheckBeforeSendConfigureWidget(parent)
......@@ -38,42 +36,9 @@ ConfirmAddressConfigureWidget::ConfirmAddressConfigureWidget(QWidget *parent)
vboxlayout->addWidget(mEnable);
connect(mEnable, &QCheckBox::clicked, this, &ConfirmAddressConfigureWidget::slotEnableChanged);
QGroupBox *groupBoxDomainName = new QGroupBox(i18n("Accepted Domain Name"), this);
groupBoxDomainName->setObjectName(QStringLiteral("groupboxdomainname"));
vboxlayout->addWidget(groupBoxDomainName);
QLayout *layoutDomainName = new QVBoxLayout(groupBoxDomainName);
layoutDomainName->setObjectName(QStringLiteral("layoutdomainname"));
PimCommon::SimpleStringListEditor::ButtonCode buttonCode =
static_cast<PimCommon::SimpleStringListEditor::ButtonCode>(PimCommon::SimpleStringListEditor::Add | PimCommon::SimpleStringListEditor::Remove | PimCommon::SimpleStringListEditor::Modify);
mDomainNameListEditor =
new PimCommon::SimpleStringListEditor(groupBoxDomainName, buttonCode,
i18n("A&dd..."), i18n("Re&move"),
i18n("Mod&ify..."),
i18n("Enter new domain name:"));
mDomainNameListEditor->setObjectName(QStringLiteral("domainnamelisteditor"));
connect(mDomainNameListEditor, &PimCommon::SimpleStringListEditor::changed,
this, &ConfirmAddressConfigureWidget::configureChanged);
layoutDomainName->addWidget(mDomainNameListEditor);
QGroupBox *groupBoxWhiteList = new QGroupBox(i18n("White List Address"), this);
groupBoxWhiteList->setObjectName(QStringLiteral("groupboxwhitelist"));
vboxlayout->addWidget(groupBoxWhiteList);
QLayout *layoutWhiteList = new QVBoxLayout(groupBoxWhiteList);
layoutWhiteList->setObjectName(QStringLiteral("layoutwhitelist"));
buttonCode =
static_cast<PimCommon::SimpleStringListEditor::ButtonCode>(PimCommon::SimpleStringListEditor::Add | PimCommon::SimpleStringListEditor::Remove | PimCommon::SimpleStringListEditor::Modify);
mWhiteListEditor =
new PimCommon::SimpleStringListEditor(groupBoxWhiteList, buttonCode,
i18n("A&dd..."), i18n("Re&move"),
i18n("Mod&ify..."),
i18n("Enter new email name:"));
mWhiteListEditor->setObjectName(QStringLiteral("whitelisteditor"));
layoutWhiteList->addWidget(mWhiteListEditor);
connect(mWhiteListEditor, &PimCommon::SimpleStringListEditor::changed,
this, &ConfirmAddressConfigureWidget::configureChanged);
mConfirmAddressConfigureTab = new ConfirmAddressConfigureTab(this);
mConfirmAddressConfigureTab->setObjectName(QStringLiteral("confirmaddresstab"));
vboxlayout->addWidget(mConfirmAddressConfigureTab);
}
ConfirmAddressConfigureWidget::~ConfirmAddressConfigureWidget()
......@@ -83,25 +48,27 @@ ConfirmAddressConfigureWidget::~ConfirmAddressConfigureWidget()
void ConfirmAddressConfigureWidget::loadSettings()
{
#if 0
KConfigGroup grp(KSharedConfig::openConfig(), "Confirm Address");
mEnable->setChecked(grp.readEntry("Enabled", false));
mDomainNameListEditor->setStringList(grp.readEntry("Domains", QStringList()));
mWhiteListEditor->setStringList(grp.readEntry("Emails", QStringList()));
#endif
}
void ConfirmAddressConfigureWidget::saveSettings()
{
#if 0
KConfigGroup grp(KSharedConfig::openConfig(), "Confirm Address");
grp.writeEntry("Enabled", mEnable->isChecked());
grp.writeEntry("Domains", mDomainNameListEditor->stringList());
grp.writeEntry("Emails", mWhiteListEditor->stringList());
#endif
}
void ConfirmAddressConfigureWidget::resetSettings()
{
mDomainNameListEditor->setStringList({});
mWhiteListEditor->setStringList({});
mEnable->setChecked(false);
//TODO
}
void ConfirmAddressConfigureWidget::slotEnableChanged(bool state)
......
......@@ -23,11 +23,7 @@
#include <QWidget>
#include <MessageComposer/PluginEditorCheckBeforeSendConfigureWidget>
class QCheckBox;
namespace PimCommon
{
class SimpleStringListEditor;
}
class ConfirmAddressConfigureTab;
class ConfirmAddressConfigureWidget : public MessageComposer::PluginEditorCheckBeforeSendConfigureWidget
{
Q_OBJECT
......@@ -44,8 +40,7 @@ private Q_SLOTS:
private:
QCheckBox *mEnable;
PimCommon::SimpleStringListEditor *mDomainNameListEditor;
PimCommon::SimpleStringListEditor *mWhiteListEditor;
ConfirmAddressConfigureTab *mConfirmAddressConfigureTab;
};
#endif // CONFIRMADDRESSCONFIGUREWIDGET_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