Commit 65b22a65 authored by Laurent Montel's avatar Laurent Montel 😁
Browse files

Improve dkim menu

parent 9ce865a6
...@@ -18,6 +18,7 @@ ...@@ -18,6 +18,7 @@
*/ */
#include "dkimviewermenutest.h" #include "dkimviewermenutest.h"
#include "dkim-verify/dkimviewermenu.h"
#include <QTest> #include <QTest>
QTEST_MAIN(DKIMViewerMenuTest) QTEST_MAIN(DKIMViewerMenuTest)
DKIMViewerMenuTest::DKIMViewerMenuTest(QObject *parent) DKIMViewerMenuTest::DKIMViewerMenuTest(QObject *parent)
...@@ -25,3 +26,9 @@ DKIMViewerMenuTest::DKIMViewerMenuTest(QObject *parent) ...@@ -25,3 +26,9 @@ DKIMViewerMenuTest::DKIMViewerMenuTest(QObject *parent)
{ {
} }
void DKIMViewerMenuTest::shouldHaveDefaultValues()
{
MessageViewer::DKIMViewerMenu menu;
QVERIFY(menu.menu());
}
...@@ -28,6 +28,8 @@ class DKIMViewerMenuTest : public QObject ...@@ -28,6 +28,8 @@ class DKIMViewerMenuTest : public QObject
public: public:
explicit DKIMViewerMenuTest(QObject *parent = nullptr); explicit DKIMViewerMenuTest(QObject *parent = nullptr);
~DKIMViewerMenuTest() = default; ~DKIMViewerMenuTest() = default;
private Q_SLOTS:
void shouldHaveDefaultValues();
}; };
#endif // DKIMVIEWERMENUTEST_H #endif // DKIMVIEWERMENUTEST_H
...@@ -19,14 +19,33 @@ ...@@ -19,14 +19,33 @@
#include "dkimviewermenu.h" #include "dkimviewermenu.h"
#include <QMenu>
#include <KLocalizedString>
using namespace MessageViewer; using namespace MessageViewer;
DKIMViewerMenu::DKIMViewerMenu(QObject *parent) DKIMViewerMenu::DKIMViewerMenu(QObject *parent)
: QObject(parent) : QObject(parent)
{ {
initialize();
} }
DKIMViewerMenu::~DKIMViewerMenu() DKIMViewerMenu::~DKIMViewerMenu()
{ {
delete mMenu;
}
QMenu *DKIMViewerMenu::menu() const
{
return mMenu;
}
void DKIMViewerMenu::initialize()
{
mMenu = new QMenu;
QAction *checkSignature = mMenu->addAction(i18n("Recheck DKIM Signature"));
connect(checkSignature, &QAction::triggered, this, &DKIMViewerMenu::recheckSignature);
QAction *updateDKIMKey = mMenu->addAction(i18n("Update DKIM key"));
connect(updateDKIMKey, &QAction::triggered, this, &DKIMViewerMenu::updateDKimKey);
//TODO add more
} }
...@@ -22,6 +22,7 @@ ...@@ -22,6 +22,7 @@
#include <QObject> #include <QObject>
#include "messageviewer_private_export.h" #include "messageviewer_private_export.h"
class QMenu;
namespace MessageViewer { namespace MessageViewer {
class MESSAGEVIEWER_TESTS_EXPORT DKIMViewerMenu : public QObject class MESSAGEVIEWER_TESTS_EXPORT DKIMViewerMenu : public QObject
{ {
...@@ -29,6 +30,15 @@ class MESSAGEVIEWER_TESTS_EXPORT DKIMViewerMenu : public QObject ...@@ -29,6 +30,15 @@ class MESSAGEVIEWER_TESTS_EXPORT DKIMViewerMenu : public QObject
public: public:
explicit DKIMViewerMenu(QObject *parent = nullptr); explicit DKIMViewerMenu(QObject *parent = nullptr);
~DKIMViewerMenu(); ~DKIMViewerMenu();
QMenu *menu() const;
Q_SIGNALS:
void recheckSignature();
void updateDKimKey();
private:
void initialize();
QMenu *mMenu = nullptr;
}; };
} }
......
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