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

Now code is in messageviewer

parent ba2a7ee5
......@@ -76,7 +76,7 @@ set(LIBKLEO_LIB_VERSION "5.13.40")
set(AKONADI_LIB_VERSION "5.13.40")
set(INCIDENCEEDITOR_LIB_VERSION "5.13.40")
set(KTNEF_LIB_VERSION "5.13.40")
set(MESSAGELIB_LIB_VERSION "5.13.50")
set(MESSAGELIB_LIB_VERSION "5.13.52")
set(AKONADICALENDAR_LIB_VERSION "5.13.40")
set(CALENDAR_UTILS_VERSION "5.13.40")
set(KPIMTEXTEDIT_LIB_VERSION "5.13.40")
......
......@@ -20,11 +20,6 @@ set(dkimverifyconfigure_SRCS
dkimkeyrecordwidget.cpp
dkimadvancedwidget.cpp
dkimpolicywidget.cpp
dkimruledialog.cpp
dkimrulewidget.cpp
dkimmanageruleswidget.cpp
dkimmanagerulesdialog.cpp
dkimmanagerulescombobox.cpp
dkimauthenticationverifiedserverwidget.cpp
dkimauthenticationverifiedserverdialog.cpp
)
......
......@@ -14,10 +14,5 @@ add_messageviewer_dkim_verify_unittest(dkimgeneralwidgettest.cpp)
add_messageviewer_dkim_verify_unittest(dkimkeyrecordwidgettest.cpp)
add_messageviewer_dkim_verify_unittest(dkimadvancedwidgettest.cpp)
add_messageviewer_dkim_verify_unittest(dkimpolicywidgettest.cpp)
add_messageviewer_dkim_verify_unittest(dkimruledialogtest.cpp)
add_messageviewer_dkim_verify_unittest(dkimrulewidgettest.cpp)
add_messageviewer_dkim_verify_unittest(dkimmanagerulesdialogtest.cpp)
add_messageviewer_dkim_verify_unittest(dkimmanageruleswidgettest.cpp)
add_messageviewer_dkim_verify_unittest(dkimmanagerulescomboboxtest.cpp)
add_messageviewer_dkim_verify_unittest(dkimauthenticationverifiedserverwidgettest.cpp)
add_messageviewer_dkim_verify_unittest(dkimauthenticationverifiedserverdialogtest.cpp)
/*
Copyright (C) 2019-2020 Laurent Montel <montel@kde.org>
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 "dkimmanagerulescomboboxtest.h"
#include "dkimmanagerulescombobox.h"
#include <QTest>
QTEST_MAIN(DKIMManageRulesComboBoxTest)
DKIMManageRulesComboBoxTest::DKIMManageRulesComboBoxTest(QObject *parent)
: QObject(parent)
{
}
void DKIMManageRulesComboBoxTest::shouldHaveDefaultValues()
{
DKIMManageRulesComboBox w;
QVERIFY(w.count() > 0);
}
void DKIMManageRulesComboBoxTest::shouldChangeIndex()
{
DKIMManageRulesComboBox w;
w.setCurrentIndex(1);
QCOMPARE(w.ruleType(), MessageViewer::DKIMRule::RuleType::CanBeSigned);
}
/*
Copyright (C) 2019-2020 Laurent Montel <montel@kde.org>
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 DKIMMANAGERULESCOMBOBOXTEST_H
#define DKIMMANAGERULESCOMBOBOXTEST_H
#include <QObject>
class DKIMManageRulesComboBoxTest : public QObject
{
Q_OBJECT
public:
explicit DKIMManageRulesComboBoxTest(QObject *parent = nullptr);
~DKIMManageRulesComboBoxTest() = default;
private Q_SLOTS:
void shouldHaveDefaultValues();
void shouldChangeIndex();
};
#endif // DKIMMANAGERULESCOMBOBOXTEST_H
/*
Copyright (C) 2019-2020 Laurent Montel <montel@kde.org>
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 "dkimmanagerulesdialogtest.h"
#include "dkimmanagerulesdialog.h"
#include "dkimmanageruleswidget.h"
#include <QDialogButtonBox>
#include <QTest>
#include <QVBoxLayout>
QTEST_MAIN(DKIMManageRulesDialogTest)
DKIMManageRulesDialogTest::DKIMManageRulesDialogTest(QObject *parent)
: QObject(parent)
{
}
void DKIMManageRulesDialogTest::shouldHaveDefaultValues()
{
DKIMManageRulesDialog w;
QVERIFY(!w.windowTitle().isEmpty());
QVBoxLayout *mainLayout = w.findChild<QVBoxLayout *>(QStringLiteral("mainlayout"));
QVERIFY(mainLayout);
DKIMManageRulesWidget *mRulesWidget = w.findChild<DKIMManageRulesWidget *>(QStringLiteral("mRulesWidget"));
QVERIFY(mRulesWidget);
QDialogButtonBox *buttonBox = w.findChild<QDialogButtonBox *>(QStringLiteral("buttonBox"));
QVERIFY(buttonBox);
QCOMPARE(buttonBox->standardButtons(), {QDialogButtonBox::Ok | QDialogButtonBox::Cancel});
}
/*
Copyright (C) 2019-2020 Laurent Montel <montel@kde.org>
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 DKIMMANAGERULESDIALOGTEST_H
#define DKIMMANAGERULESDIALOGTEST_H
#include <QObject>
class DKIMManageRulesDialogTest : public QObject
{
Q_OBJECT
public:
explicit DKIMManageRulesDialogTest(QObject *parent = nullptr);
~DKIMManageRulesDialogTest() = default;
private Q_SLOTS:
void shouldHaveDefaultValues();
};
#endif // DKIMMANAGERULESDIALOGTEST_H
/*
Copyright (C) 2019-2020 Laurent Montel <montel@kde.org>
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 "dkimmanageruleswidgettest.h"
#include "dkimmanageruleswidget.h"
#include <KTreeWidgetSearchLine>
#include <QTest>
#include <QTreeWidget>
#include <QVBoxLayout>
QTEST_MAIN(DKIMManageRulesWidgetTest)
DKIMManageRulesWidgetTest::DKIMManageRulesWidgetTest(QObject *parent)
: QObject(parent)
{
}
void DKIMManageRulesWidgetTest::shouldHaveDefaultValues()
{
DKIMManageRulesWidget w;
QVBoxLayout *mainLayout = w.findChild<QVBoxLayout *>(QStringLiteral("mainLayout"));
QVERIFY(mainLayout);
QCOMPARE(mainLayout->contentsMargins(), QMargins(0, 0, 0, 0));
QTreeWidget *mTreeWidget = w.findChild<QTreeWidget *>(QStringLiteral("treewidget"));
QVERIFY(mTreeWidget);
QVERIFY(!mTreeWidget->rootIsDecorated());
QVERIFY(mTreeWidget->alternatingRowColors());
KTreeWidgetSearchLine *searchLineEdit = w.findChild<KTreeWidgetSearchLine *>(QStringLiteral("searchlineedit"));
QVERIFY(searchLineEdit->isClearButtonEnabled());
}
/*
Copyright (C) 2019-2020 Laurent Montel <montel@kde.org>
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 DKIMMANAGERULESWIDGETTEST_H
#define DKIMMANAGERULESWIDGETTEST_H
#include <QObject>
class DKIMManageRulesWidgetTest : public QObject
{
Q_OBJECT
public:
explicit DKIMManageRulesWidgetTest(QObject *parent = nullptr);
~DKIMManageRulesWidgetTest() = default;
private Q_SLOTS:
void shouldHaveDefaultValues();
};
#endif // DKIMMANAGERULESWIDGETTEST_H
/*
Copyright (C) 2019-2020 Laurent Montel <montel@kde.org>
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 "dkimruledialogtest.h"
#include "dkimruledialog.h"
#include "dkimrulewidget.h"
#include <QDialogButtonBox>
#include <QTest>
#include <QVBoxLayout>
QTEST_MAIN(DKIMRuleDialogTest)
DKIMRuleDialogTest::DKIMRuleDialogTest(QObject *parent)
: QObject(parent)
{
}
void DKIMRuleDialogTest::shouldHaveDefaultValues()
{
DKIMRuleDialog dlg;
QVERIFY(!dlg.windowTitle().isEmpty());
QVBoxLayout *mainLayout = dlg.findChild<QVBoxLayout *>(QStringLiteral("mainlayout"));
QVERIFY(mainLayout);
DKIMRuleWidget *rulewidget = dlg.findChild<DKIMRuleWidget *>(QStringLiteral("rulewidget"));
QVERIFY(rulewidget);
QDialogButtonBox *buttonBox = dlg.findChild<QDialogButtonBox *>(QStringLiteral("buttonBox"));
QVERIFY(buttonBox);
QCOMPARE(buttonBox->standardButtons(), {QDialogButtonBox::Ok | QDialogButtonBox::Cancel});
}
/*
Copyright (C) 2019-2020 Laurent Montel <montel@kde.org>
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 DKIMRULEDIALOGTEST_H
#define DKIMRULEDIALOGTEST_H
#include <QObject>
class DKIMRuleDialogTest : public QObject
{
Q_OBJECT
public:
explicit DKIMRuleDialogTest(QObject *parent = nullptr);
~DKIMRuleDialogTest() = default;
private Q_SLOTS:
void shouldHaveDefaultValues();
};
#endif // DKIMRULEDIALOGTEST_H
/*
Copyright (C) 2019-2020 Laurent Montel <montel@kde.org>
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 "dkimrulewidgettest.h"
#include "dkimrulewidget.h"
#include <QCheckBox>
#include <QFormLayout>
#include <QLineEdit>
#include <QTest>
#include <dkimmanagerulescombobox.h>
QTEST_MAIN(DKIMRuleWidgetTest)
DKIMRuleWidgetTest::DKIMRuleWidgetTest(QObject *parent)
: QObject(parent)
{
}
void DKIMRuleWidgetTest::shouldHaveDefaultValues()
{
DKIMRuleWidget w;
QVERIFY(!w.rule().isValid());
QFormLayout *layout = w.findChild<QFormLayout *>(QStringLiteral("layout"));
QCOMPARE(layout->contentsMargins(), QMargins(0, 0, 0, 0));
QCheckBox *mEnabled = w.findChild<QCheckBox *>(QStringLiteral("enabled"));
QVERIFY(mEnabled);
QVERIFY(!mEnabled->text().isEmpty());
QVERIFY(!mEnabled->isChecked());
QLineEdit *mDomain = w.findChild<QLineEdit *>(QStringLiteral("domain"));
QVERIFY(mDomain);
QVERIFY(mDomain->text().isEmpty());
QVERIFY(mDomain->isClearButtonEnabled());
QLineEdit *mListId = w.findChild<QLineEdit *>(QStringLiteral("listid"));
QVERIFY(mListId);
QVERIFY(mListId->text().isEmpty());
QVERIFY(mListId->isClearButtonEnabled());
QLineEdit *mFrom = w.findChild<QLineEdit *>(QStringLiteral("from"));
QVERIFY(mFrom);
QVERIFY(mFrom->text().isEmpty());
QVERIFY(mFrom->isClearButtonEnabled());
QLineEdit *mSignatureDomainIdentifier = w.findChild<QLineEdit *>(QStringLiteral("signaturedomainidentifier"));
QVERIFY(mSignatureDomainIdentifier);
QVERIFY(mSignatureDomainIdentifier->text().isEmpty());
QVERIFY(mSignatureDomainIdentifier->isClearButtonEnabled());
DKIMManageRulesComboBox *mRuleType = w.findChild<DKIMManageRulesComboBox *>(QStringLiteral("ruletype"));
QVERIFY(mRuleType);
}
/*
Copyright (C) 2019-2020 Laurent Montel <montel@kde.org>
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 DKIMRULEWIDGETTEST_H
#define DKIMRULEWIDGETTEST_H
#include <QObject>
class DKIMRuleWidgetTest : public QObject
{
Q_OBJECT
public:
explicit DKIMRuleWidgetTest(QObject *parent = nullptr);
~DKIMRuleWidgetTest() = default;
private Q_SLOTS:
void shouldHaveDefaultValues();
};
#endif // DKIMRULEWIDGETTEST_H
/*
Copyright (C) 2019-2020 Laurent Montel <montel@kde.org>
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 "dkimmanagerulescombobox.h"
#include <KLocalizedString>
DKIMManageRulesComboBox::DKIMManageRulesComboBox(QWidget *parent)
: QComboBox(parent)
{
init();
}
DKIMManageRulesComboBox::~DKIMManageRulesComboBox()
{
}
void DKIMManageRulesComboBox::init()
{
addItem(i18n("Must be signed"), QVariant::fromValue(MessageViewer::DKIMRule::RuleType::MustBeSigned));
addItem(i18n("Can be signed"), QVariant::fromValue(MessageViewer::DKIMRule::RuleType::CanBeSigned));
addItem(i18n("Ignore if not signed"), QVariant::fromValue(MessageViewer::DKIMRule::RuleType::IgnoreEmailNotSigned));
}
MessageViewer::DKIMRule::RuleType DKIMManageRulesComboBox::ruleType() const
{
return currentData().value<MessageViewer::DKIMRule::RuleType>();
}
void DKIMManageRulesComboBox::setRuleType(MessageViewer::DKIMRule::RuleType type)
{
const int index = findData(QVariant::fromValue(type));
if (index != -1) {
setCurrentIndex(index);
}
}
/*
Copyright (C) 2019-2020 Laurent Montel <montel@kde.org>
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 DKIMMANAGERULESCOMBOBOX_H
#define DKIMMANAGERULESCOMBOBOX_H
#include "dkimconfigure_private_export.h"
#include <MessageViewer/DKIMRule>
#include <QComboBox>
class LIBDKIMVERIFYCONFIGURE_TESTS_EXPORT DKIMManageRulesComboBox : public QComboBox
{
Q_OBJECT
public:
explicit DKIMManageRulesComboBox(QWidget *parent = nullptr);
~DKIMManageRulesComboBox();
Q_REQUIRED_RESULT MessageViewer::DKIMRule::RuleType ruleType() const;
void setRuleType(MessageViewer::DKIMRule::RuleType type);
private:
void init();
};
#endif // DKIMMANAGERULESCOMBOBOX_H
/*
Copyright (C) 2019-2020 Laurent Montel <montel@kde.org>
This library is free software; you can redistribute it and/or