checkbeforesendconfigurewidget.cpp 2 KB
Newer Older
Laurent Montel's avatar
Laurent Montel committed
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
/*
   Copyright (C) 2016 Montel Laurent <montel@kde.org>

   This program is free software; you can redistribute it and/or
   modify it under the terms of the GNU General Public
   License as published by the Free Software Foundation; either
   version 2 of the License, or (at your option) any later version.

   This program 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
   General Public License for more details.

   You should have received a copy of the GNU General Public License
   along with this program; see the file COPYING.  If not, write to
   the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
   Boston, MA 02110-1301, USA.
*/

#include "checkbeforesendconfigurewidget.h"
#include <KLocalizedString>
#include <QVBoxLayout>
Laurent Montel's avatar
Laurent Montel committed
23
24
25
#include <QCheckBox>
#include <KConfigGroup>
#include <KSharedConfig>
Laurent Montel's avatar
Laurent Montel committed
26
27
28
29

CheckBeforeSendConfigureWidget::CheckBeforeSendConfigureWidget(QWidget *parent)
    : MessageComposer::PluginEditorCheckBeforeSendConfigureWidget(parent)
{
Laurent Montel's avatar
Laurent Montel committed
30
31
    QVBoxLayout *mainLayout = new QVBoxLayout(this);
    mainLayout->setObjectName(QStringLiteral("mainlayout"));
Laurent Montel's avatar
Laurent Montel committed
32

Laurent Montel's avatar
Laurent Montel committed
33
34
35
    mCheckPlainTextMail = new QCheckBox(i18n("Send as PlainText"), this);
    mCheckPlainTextMail->setObjectName(QStringLiteral("checkplaintext"));
    mainLayout->addWidget(mCheckPlainTextMail);
Laurent Montel's avatar
Laurent Montel committed
36
    mainLayout->addStretch(1);
Laurent Montel's avatar
Laurent Montel committed
37
38
39
40
41
42
43
44
45
46
}

CheckBeforeSendConfigureWidget::~CheckBeforeSendConfigureWidget()
{

}


void CheckBeforeSendConfigureWidget::loadSettings()
{
Laurent Montel's avatar
Laurent Montel committed
47
48
    KConfigGroup grp(KSharedConfig::openConfig(), "Check Before Send");
    mCheckPlainTextMail->setChecked(grp.readEntry("SendPlainText", false));
Laurent Montel's avatar
Laurent Montel committed
49
50
51
52
}

void CheckBeforeSendConfigureWidget::saveSettings()
{
Laurent Montel's avatar
Laurent Montel committed
53
54
    KConfigGroup grp(KSharedConfig::openConfig(), "Check Before Send");
    grp.writeEntry("SendPlainText", mCheckPlainTextMail->isChecked());
Laurent Montel's avatar
Laurent Montel committed
55
56
57
58
}

void CheckBeforeSendConfigureWidget::resetSettings()
{
Laurent Montel's avatar
Laurent Montel committed
59
    mCheckPlainTextMail->setChecked(false);
Laurent Montel's avatar
Laurent Montel committed
60
}