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 6efdee12 authored by Laurent Montel's avatar Laurent Montel 😁

Use new widget

parent 75b74dde
......@@ -69,7 +69,7 @@ find_package(KF5Prison ${KF5_MIN_VERSION} CONFIG REQUIRED)
find_package(KF5Holidays ${KF5_MIN_VERSION} CONFIG REQUIRED)
set(MAILCOMMON_LIB_VERSION "5.10.40")
set(GRAVATAR_LIB_VERSION "5.10.40")
set(GRAVATAR_LIB_VERSION "5.10.41")
set(PIMCOMMON_LIB_VERSION "5.10.45")
set(GRANTLEETHEME_LIB_VERSION "5.10.40")
set(CALENDARSUPPORT_LIB_VERSION "5.10.40")
......
......@@ -20,7 +20,8 @@
#include "gravatarconfiguresettingspluginwidgettest.h"
#include "../gravatarconfiguresettingspluginwidget.h"
#include "kdepimtest_layout.h"
#include <Gravatar/GravatarConfigWidget>
#include <Gravatar/GravatarConfigureSettingsWidget>
#include <QCheckBox>
#include <QTest>
#include <QVBoxLayout>
......@@ -39,6 +40,11 @@ void GravatarConfigureSettingsPluginWidgetTest::shouldHaveDefaultValue()
QVERIFY(mainLayout);
KdepimTestLayout::checkContentsMargins(0, mainLayout);
Gravatar::GravatarConfigWidget *mGravatarConfigWidget = w.findChild<Gravatar::GravatarConfigWidget *>(QStringLiteral("gravatarconfigwidget"));
QCheckBox *mEnableGravatarSupport = w.findChild<QCheckBox *>(QStringLiteral("gravatarcheckbox"));
QVERIFY(mEnableGravatarSupport);
QVERIFY(!mEnableGravatarSupport->isChecked());
QVERIFY(!mEnableGravatarSupport->text().isEmpty());
Gravatar::GravatarConfigureSettingsWidget *mGravatarConfigWidget = w.findChild<Gravatar::GravatarConfigureSettingsWidget *>(QStringLiteral("gravatarconfigwidget"));
QVERIFY(mGravatarConfigWidget);
}
......@@ -18,18 +18,35 @@
*/
#include "gravatarconfiguresettingspluginwidget.h"
#include <QVBoxLayout>
#include <Gravatar/GravatarConfigWidget>
#include <Gravatar/GravatarConfigureSettingsWidget>
#include <Gravatar/GravatarCache>
#include <PimCommon/ConfigureImmutableWidgetUtils>
#include <KLocalizedString>
#include <gravatar/gravatarsettings.h>
#include <QCheckBox>
#include <QVBoxLayout>
using namespace PimCommon::ConfigureImmutableWidgetUtils;
GravatarConfigureSettingsPluginWidget::GravatarConfigureSettingsPluginWidget(QWidget *parent)
: MessageViewer::MessageViewerConfigureSettingsPluginWidget(parent)
{
QVBoxLayout *mainLayout = new QVBoxLayout(this);
mainLayout->setObjectName(QStringLiteral("mainlayout"));
mainLayout->setContentsMargins(0, 0, 0, 0);
mGravatarConfigWidget = new Gravatar::GravatarConfigWidget(this);
mEnableGravatarSupport = new QCheckBox(i18n("Enable Gravatar Support"));
mEnableGravatarSupport->setObjectName(QStringLiteral("gravatarcheckbox"));
mEnableGravatarSupport->setChecked(false);
mainLayout->addWidget(mEnableGravatarSupport);
mGravatarConfigWidget = new Gravatar::GravatarConfigureSettingsWidget(this);
mGravatarConfigWidget->setObjectName(QStringLiteral("gravatarconfigwidget"));
mainLayout->addWidget(mGravatarConfigWidget);
connect(mEnableGravatarSupport, &QCheckBox::clicked, mGravatarConfigWidget, &Gravatar::GravatarConfigureSettingsWidget::setEnabled);
}
GravatarConfigureSettingsPluginWidget::~GravatarConfigureSettingsPluginWidget()
......@@ -38,15 +55,23 @@ GravatarConfigureSettingsPluginWidget::~GravatarConfigureSettingsPluginWidget()
void GravatarConfigureSettingsPluginWidget::loadSettings()
{
mGravatarConfigWidget->doLoadFromGlobalSettings();
loadWidget(mEnableGravatarSupport, Gravatar::GravatarSettings::self()->gravatarSupportEnabledItem());
mGravatarConfigWidget->load();
}
void GravatarConfigureSettingsPluginWidget::saveSettings()
{
saveCheckBox(mEnableGravatarSupport, Gravatar::GravatarSettings::self()->gravatarSupportEnabledItem());
if (!mEnableGravatarSupport->isChecked()) {
Gravatar::GravatarCache::self()->clearAllCache();
}
mGravatarConfigWidget->save();
}
void GravatarConfigureSettingsPluginWidget::resetSettings()
{
mGravatarConfigWidget->doResetToDefaultsOther();
const bool bUseDefaults = Gravatar::GravatarSettings::self()->useDefaults(true);
loadSettings();
Gravatar::GravatarSettings::self()->useDefaults(bUseDefaults);
mGravatarConfigWidget->slotRestoreDefault();
}
......@@ -21,8 +21,9 @@
#define GRAVATARCONFIGURESETTINGSPLUGINWIDGET_H
#include <MessageViewer/MessageViewerConfigureSettingsPluginWidget>
class QCheckBox;
namespace Gravatar {
class GravatarConfigWidget;
class GravatarConfigureSettingsWidget;
}
class GravatarConfigureSettingsPluginWidget : public MessageViewer::MessageViewerConfigureSettingsPluginWidget
{
......@@ -36,7 +37,8 @@ public:
void resetSettings() override;
private:
Gravatar::GravatarConfigWidget *mGravatarConfigWidget = nullptr;
Gravatar::GravatarConfigureSettingsWidget *mGravatarConfigWidget = nullptr;
QCheckBox *mEnableGravatarSupport = nullptr;
};
#endif // GRAVATARCONFIGURESETTINGSPLUGINWIDGET_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