Members of the KDE Community are recommended to subscribe to the kde-community mailing list at https://mail.kde.org/mailman/listinfo/kde-community to allow them to participate in important discussions and receive other important announcements

Commit dae764c3 authored by Laurent Montel's avatar Laurent Montel 😁

Allow to load/save settings

parent 44c64368
......@@ -105,6 +105,7 @@ set(libmessageviewer_widgets_SRCS
widgets/eventedit.cpp
widgets/openattachmentfolderwidget.cpp
widgets/eventdatetimewidget.cpp
widgets/gravatarconfigwidget.cpp
)
set(libmessageviewer_header_SRCS
......
/*
Copyright (c) 2015 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, version 2, as
published by the Free Software Foundation.
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; if not, write to the Free Software Foundation, Inc.,
51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*/
#include "gravatarconfigwidget.h"
#include <QVBoxLayout>
#include <KLocalizedString>
#include <QCheckBox>
#include "settings/globalsettings.h"
#include "pimcommon/widgets/configureimmutablewidgetutils.h"
using namespace MessageViewer;
using namespace PimCommon::ConfigureImmutableWidgetUtils;
GravatarConfigWidget::GravatarConfigWidget(QWidget *parent)
: QWidget(parent)
{
QVBoxLayout *mainLayout = new QVBoxLayout;
setLayout(mainLayout);
mainLayout->setMargin(0);
//KF5 add i18n
mEnableGravatarSupport = new QCheckBox(QLatin1String("Enable Gravatar Support"));
mEnableGravatarSupport->setObjectName(QLatin1String("gravatarcheckbox"));
mainLayout->addWidget(mEnableGravatarSupport);
}
GravatarConfigWidget::~GravatarConfigWidget()
{
}
void GravatarConfigWidget::save()
{
saveCheckBox(mEnableGravatarSupport, MessageViewer::GlobalSettings::self()->gravatarSupportEnabledItem());
}
void GravatarConfigWidget::doLoadFromGlobalSettings()
{
loadWidget(mEnableGravatarSupport, MessageViewer::GlobalSettings::self()->gravatarSupportEnabledItem());
}
void GravatarConfigWidget::doResetToDefaultsOther()
{
const bool bUseDefaults = MessageViewer::GlobalSettings::self()->useDefaults( true );
loadWidget(mEnableGravatarSupport, MessageViewer::GlobalSettings::self()->gravatarSupportEnabledItem());
GlobalSettings::self()->useDefaults( bUseDefaults );
}
/*
Copyright (c) 2015 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, version 2, as
published by the Free Software Foundation.
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; if not, write to the Free Software Foundation, Inc.,
51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*/
#ifndef GRAVATARCONFIGWIDGET_H
#define GRAVATARCONFIGWIDGET_H
#include <QWidget>
#include "messageviewer_export.h"
class QCheckBox;
namespace MessageViewer {
class MESSAGEVIEWER_EXPORT GravatarConfigWidget : public QWidget
{
Q_OBJECT
public:
explicit GravatarConfigWidget(QWidget *parent = 0);
~GravatarConfigWidget();
void save();
void doLoadFromGlobalSettings();
void doResetToDefaultsOther();
private:
QCheckBox *mEnableGravatarSupport;
};
}
#endif // GRAVATARCONFIGWIDGET_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