Commit 0d9f11c1 authored by Laurent Montel's avatar Laurent Montel 😁
Browse files

Implement it

parent f64f7a91
......@@ -18,8 +18,10 @@
*/
#include "checkbeforesendconfigurewidgettest.h"
#include "../checkbeforesendconfigurewidget.h"
#include <QTest>
#include <QVBoxLayout>
#include <QCheckBox>
CheckBeforeSendConfigureWidgetTest::CheckBeforeSendConfigureWidgetTest(QObject *parent)
: QObject(parent)
......@@ -32,4 +34,14 @@ CheckBeforeSendConfigureWidgetTest::~CheckBeforeSendConfigureWidgetTest()
}
void CheckBeforeSendConfigureWidgetTest::shouldHaveDefaultValue()
{
CheckBeforeSendConfigureWidget w;
QVBoxLayout *vboxlayout = w.findChild<QVBoxLayout *>(QStringLiteral("mainlayout"));
QVERIFY(vboxlayout);
QCheckBox *mCheckPlainTextMail = w.findChild<QCheckBox *>(QStringLiteral("checkplaintext"));
QVERIFY(mCheckPlainTextMail);
}
QTEST_MAIN(CheckBeforeSendConfigureWidgetTest)
......@@ -29,9 +29,8 @@ public:
explicit CheckBeforeSendConfigureWidgetTest(QObject *parent = Q_NULLPTR);
~CheckBeforeSendConfigureWidgetTest();
signals:
public slots:
private Q_SLOTS:
void shouldHaveDefaultValue();
};
#endif // CHECKBEFORESENDCONFIGUREWIDGETTEST_H
......@@ -20,6 +20,9 @@
#include "checkbeforesendconfigurewidget.h"
#include <KLocalizedString>
#include <QVBoxLayout>
#include <QCheckBox>
#include <KConfigGroup>
#include <KSharedConfig>
CheckBeforeSendConfigureWidget::CheckBeforeSendConfigureWidget(QWidget *parent)
: MessageComposer::PluginEditorCheckBeforeSendConfigureWidget(parent)
......@@ -27,6 +30,9 @@ CheckBeforeSendConfigureWidget::CheckBeforeSendConfigureWidget(QWidget *parent)
QVBoxLayout *mainLayout = new QVBoxLayout(this);
mainLayout->setObjectName(QStringLiteral("mainlayout"));
mCheckPlainTextMail = new QCheckBox(i18n("Send as PlainText"), this);
mCheckPlainTextMail->setObjectName(QStringLiteral("checkplaintext"));
mainLayout->addWidget(mCheckPlainTextMail);
}
CheckBeforeSendConfigureWidget::~CheckBeforeSendConfigureWidget()
......@@ -37,12 +43,17 @@ CheckBeforeSendConfigureWidget::~CheckBeforeSendConfigureWidget()
void CheckBeforeSendConfigureWidget::loadSettings()
{
KConfigGroup grp(KSharedConfig::openConfig(), "Check Before Send");
mCheckPlainTextMail->setChecked(grp.readEntry("SendPlainText", false));
}
void CheckBeforeSendConfigureWidget::saveSettings()
{
KConfigGroup grp(KSharedConfig::openConfig(), "Check Before Send");
grp.writeEntry("SendPlainText", mCheckPlainTextMail->isChecked());
}
void CheckBeforeSendConfigureWidget::resetSettings()
{
mCheckPlainTextMail->setChecked(false);
}
......@@ -23,6 +23,7 @@
#include <QWidget>
#include <MessageComposer/PluginEditorCheckBeforeSendConfigureWidget>
class QCheckBox;
class CheckBeforeSendConfigureWidget : public MessageComposer::PluginEditorCheckBeforeSendConfigureWidget
{
Q_OBJECT
......@@ -33,6 +34,9 @@ public:
void loadSettings() Q_DECL_OVERRIDE;
void saveSettings() Q_DECL_OVERRIDE;
void resetSettings() Q_DECL_OVERRIDE;
private:
QCheckBox *mCheckPlainTextMail;
};
#endif // CHECKBEFORESENDCONFIGUREWIDGET_H
......@@ -19,10 +19,14 @@
#include "checkbeforesendinterface.h"
#include <KConfigGroup>
#include <KSharedConfig>
CheckBeforeSendInterface::CheckBeforeSendInterface(QObject *parent)
: MessageComposer::PluginEditorCheckBeforeSendInterface(parent)
: MessageComposer::PluginEditorCheckBeforeSendInterface(parent),
mSendPlainText(false)
{
reloadConfig();
}
CheckBeforeSendInterface::~CheckBeforeSendInterface()
......@@ -33,11 +37,16 @@ CheckBeforeSendInterface::~CheckBeforeSendInterface()
bool CheckBeforeSendInterface::exec(const MessageComposer::PluginEditorCheckBeforeSendParams &params)
{
//TODO
if (mSendPlainText) {
if (params.isHtmlMail()) {
return false;
}
}
return true;
}
void CheckBeforeSendInterface::reloadConfig()
{
//TODO
KConfigGroup grp(KSharedConfig::openConfig(), "Check Before Send");
mSendPlainText = grp.readEntry("SendPlainText", false);
}
......@@ -33,6 +33,8 @@ public:
public Q_SLOTS:
void reloadConfig() Q_DECL_OVERRIDE;
private:
bool mSendPlainText;
};
#endif // CHECKBEFORESENDINTERFACE_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