Commit 92d22b2b authored by Laurent Montel's avatar Laurent Montel 😁

Move widgets

parent c6f24e81
......@@ -21,7 +21,8 @@
#include "../confirmaddressconfiguretabwidget.h"
#include <QTest>
#include <QVBoxLayout>
#include <QTabWidget>
#include <QGroupBox>
#include <PimCommon/SimpleStringlistEditor>
ConfirmAddressConfigureTabWidgetTest::ConfirmAddressConfigureTabWidgetTest(QObject *parent)
: QObject(parent)
......@@ -36,6 +37,20 @@ ConfirmAddressConfigureTabWidgetTest::~ConfirmAddressConfigureTabWidgetTest()
void ConfirmAddressConfigureTabWidgetTest::shouldHaveDefaultValue()
{
ConfirmAddressConfigureTabWidget w;
QGroupBox *groupBoxDomainName = w.findChild<QGroupBox *>(QStringLiteral("groupboxdomainname"));
QVERIFY(groupBoxDomainName);
QVBoxLayout *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);
QVBoxLayout *layoutWhiteList = w.findChild<QVBoxLayout *>(QStringLiteral("layoutwhitelist"));
QVERIFY(layoutWhiteList);
PimCommon::SimpleStringListEditor *mWhiteListEditor = w.findChild<PimCommon::SimpleStringListEditor *>(QStringLiteral("whitelisteditor"));
QVERIFY(mWhiteListEditor);
}
QTEST_MAIN(ConfirmAddressConfigureTabWidgetTest)
......@@ -19,11 +19,53 @@
#include "confirmaddressconfiguretabwidget.h"
#include <KLocalizedString>
#include <QGroupBox>
#include <QVBoxLayout>
#include <PimCommon/SimpleStringlistEditor>
ConfirmAddressConfigureTabWidget::ConfirmAddressConfigureTabWidget(QWidget *parent)
: QWidget(parent)
{
QVBoxLayout *mainLayout = new QVBoxLayout(this);
mainLayout->setObjectName(QStringLiteral("mainlayout"));
mainLayout->setMargin(0);
QGroupBox *groupBoxDomainName = new QGroupBox(i18n("Accepted Domain Name"), this);
groupBoxDomainName->setObjectName(QStringLiteral("groupboxdomainname"));
mainLayout->addWidget(groupBoxDomainName);
QVBoxLayout *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, &ConfirmAddressConfigureTabWidget::configureChanged);
layoutDomainName->addWidget(mDomainNameListEditor);
QGroupBox *groupBoxWhiteList = new QGroupBox(i18n("White List Address"), this);
groupBoxWhiteList->setObjectName(QStringLiteral("groupboxwhitelist"));
mainLayout->addWidget(groupBoxWhiteList);
QVBoxLayout *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, &ConfirmAddressConfigureTabWidget::configureChanged);
}
ConfirmAddressConfigureTabWidget::~ConfirmAddressConfigureTabWidget()
......
......@@ -21,6 +21,10 @@
#define CONFIRMADDRESSCONFIGURETABWIDGET_H
#include <QWidget>
namespace PimCommon
{
class SimpleStringListEditor;
}
class QTabWidget;
class ConfirmAddressConfigureTabWidget : public QWidget
{
......@@ -31,6 +35,10 @@ public:
Q_SIGNALS:
void configureChanged();
private:
PimCommon::SimpleStringListEditor *mDomainNameListEditor;
PimCommon::SimpleStringListEditor *mWhiteListEditor;
};
#endif // CONFIRMADDRESSCONFIGURETABWIDGET_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