Commit a1c1fea5 authored by Laurent Montel's avatar Laurent Montel 😁
Browse files

Start to split koprefsdialog

parent 7003dd4a
......@@ -61,6 +61,8 @@ install(TARGETS
set(kcm_korganizer_PART_SRCS
kcmdesignerfields.cpp
koprefsuserfeedback.cpp
koprefsdesignerfields.cpp
korganizer_debug.cpp
prefs/koprefsdialog.cpp
widgets/kitemiconcheckcombo.cpp
......
/*
This file is part of KOrganizer.
Copyright (c) 2000,2001,2002,2003 Cornelius Schumacher <schumacher@kde.org>
Copyright (C) 2003-2004 Reinhold Kainhofer <reinhold@kainhofer.com>
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; if not, write to the Free Software Foundation, Inc.,
51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
As a special exception, permission is given to link this program
with any edition of Qt, and distribute the resulting executable,
without including the source code for Qt in the source distribution.
*/
#include "koprefsdesignerfields.h"
#include <CalendarSupport/KCalPrefs>
#include <QStandardPaths>
extern "C"
{
Q_DECL_EXPORT KCModule *create_korgdesignerfields(QWidget *parent, const char *)
{
return new KOPrefsDesignerFields(parent);
}
}
KOPrefsDesignerFields::KOPrefsDesignerFields(QWidget *parent)
: KCMDesignerFields(parent)
{
}
QString KOPrefsDesignerFields::localUiDir()
{
const QString dir
= QStandardPaths::writableLocation(QStandardPaths::GenericDataLocation) + uiPath();
return dir;
}
QString KOPrefsDesignerFields::uiPath()
{
return QStringLiteral("/korganizer/designer/event/");
}
void KOPrefsDesignerFields::writeActivePages(const QStringList &activePages)
{
CalendarSupport::KCalPrefs::instance()->setActiveDesignerFields(activePages);
CalendarSupport::KCalPrefs::instance()->save();
}
QStringList KOPrefsDesignerFields::readActivePages()
{
return CalendarSupport::KCalPrefs::instance()->activeDesignerFields();
}
QString KOPrefsDesignerFields::applicationName()
{
return QStringLiteral("KORGANIZER");
}
KOPrefsDesignerFields::KOPrefsDesignerFields()
{
}
/*
This file is part of KOrganizer.
Copyright (c) 2000,2001,2002,2003 Cornelius Schumacher <schumacher@kde.org>
Copyright (C) 2003-2004 Reinhold Kainhofer <reinhold@kainhofer.com>
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; if not, write to the Free Software Foundation, Inc.,
51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
As a special exception, permission is given to link this program
with any edition of Qt, and distribute the resulting executable,
without including the source code for Qt in the source distribution.
*/
#ifndef KOPREFSDESIGNERFIELDS_H
#define KOPREFSDESIGNERFIELDS_H
#include "kcmdesignerfields.h"
#include "kcm_korganizer_export.h"
class KCM_KORGANIZER_EXPORT KOPrefsDesignerFields : public KCMDesignerFields
{
public:
explicit KOPrefsDesignerFields(QWidget *parent = nullptr);
protected:
Q_REQUIRED_RESULT QString localUiDir() override;
Q_REQUIRED_RESULT QString uiPath() override;
void writeActivePages(const QStringList &) override;
Q_REQUIRED_RESULT QStringList readActivePages() override;
Q_REQUIRED_RESULT QString applicationName() override;
};
#endif // KOPREFSDESIGNERFIELDS_H
......@@ -1745,87 +1745,3 @@ Q_DECL_EXPORT KCModule *create_korganizerconfigplugins(QWidget *parent, const ch
////////////////////////////////////////////////////////////////////////////////
////////////////////////////////////////////////////////////////////////////////
extern "C"
{
Q_DECL_EXPORT KCModule *create_korgdesignerfields(QWidget *parent, const char *)
{
return new KOPrefsDesignerFields(parent);
}
}
KOPrefsDesignerFields::KOPrefsDesignerFields(QWidget *parent)
: KCMDesignerFields(parent)
{
}
QString KOPrefsDesignerFields::localUiDir()
{
const QString dir
= QStandardPaths::writableLocation(QStandardPaths::GenericDataLocation) + uiPath();
return dir;
}
QString KOPrefsDesignerFields::uiPath()
{
return QStringLiteral("/korganizer/designer/event/");
}
void KOPrefsDesignerFields::writeActivePages(const QStringList &activePages)
{
CalendarSupport::KCalPrefs::instance()->setActiveDesignerFields(activePages);
CalendarSupport::KCalPrefs::instance()->save();
}
QStringList KOPrefsDesignerFields::readActivePages()
{
return CalendarSupport::KCalPrefs::instance()->activeDesignerFields();
}
QString KOPrefsDesignerFields::applicationName()
{
return QStringLiteral("KORGANIZER");
}
#ifdef WITH_KUSERFEEDBACK
extern "C"
{
Q_DECL_EXPORT KCModule *create_korguserfeeback(QWidget *parent, const char *)
{
return new KOPrefsUserFeedBack(parent);
}
}
KOPrefsUserFeedBack::KOPrefsUserFeedBack(QWidget *parent, const QVariantList &args)
: KCModule(parent, args)
{
KAboutData *about = new KAboutData(QStringLiteral("KCMUserFeedBack"),
i18n("KCMUserFeedBack"),
QString(),
i18n("KOrganizer Configure User FeedBack"),
KAboutLicense::LGPL,
i18n("(c) 2020 Laurent Montel"));
about->addAuthor(i18n("Laurent Montel"), QString(), QStringLiteral("montel@kde.org"));
setAboutData(about);
QVBoxLayout *layout = new QVBoxLayout(this);
layout->setContentsMargins(0, 0, 0, 0);
mUserFeedbackWidget = new KUserFeedback::FeedbackConfigWidget(this);
connect(mUserFeedbackWidget, &KUserFeedback::FeedbackConfigWidget::configurationChanged, this, &KOPrefsUserFeedBack::markAsChanged);
layout->addWidget(mUserFeedbackWidget);
mUserFeedbackWidget->setFeedbackProvider(UserFeedBackManager::self()->userFeedbackProvider());
}
void KOPrefsUserFeedBack::load()
{
mUserFeedbackWidget->setFeedbackProvider(UserFeedBackManager::self()->userFeedbackProvider());
}
void KOPrefsUserFeedBack::save()
{
UserFeedBackManager::self()->userFeedbackProvider()->setTelemetryMode(mUserFeedbackWidget->telemetryMode());
UserFeedBackManager::self()->userFeedbackProvider()->setSurveyInterval(mUserFeedbackWidget->surveyInterval());
}
#endif
......@@ -193,34 +193,6 @@ private:
QSet<QString> mDecorationsAtAgendaViewBottom;
};
class KCM_KORGANIZER_EXPORT KOPrefsDesignerFields : public KCMDesignerFields
{
public:
explicit KOPrefsDesignerFields(QWidget *parent = nullptr);
protected:
Q_REQUIRED_RESULT QString localUiDir() override;
Q_REQUIRED_RESULT QString uiPath() override;
void writeActivePages(const QStringList &) override;
Q_REQUIRED_RESULT QStringList readActivePages() override;
Q_REQUIRED_RESULT QString applicationName() override;
};
#ifdef WITH_KUSERFEEDBACK
namespace KUserFeedback {
class FeedbackConfigWidget;
}
class KCM_KORGANIZER_EXPORT KOPrefsUserFeedBack : public KCModule
{
public:
explicit KOPrefsUserFeedBack(QWidget *parent = nullptr, const QVariantList &args = QVariantList());
protected:
void load() override;
void save() override;
private:
KUserFeedback::FeedbackConfigWidget *mUserFeedbackWidget = nullptr;
};
#endif
#endif
/*
This file is part of KOrganizer.
Copyright (c) 2000,2001,2002,2003 Cornelius Schumacher <schumacher@kde.org>
Copyright (C) 2003-2004 Reinhold Kainhofer <reinhold@kainhofer.com>
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; if not, write to the Free Software Foundation, Inc.,
51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
As a special exception, permission is given to link this program
with any edition of Qt, and distribute the resulting executable,
without including the source code for Qt in the source distribution.
*/
#include "koprefsuserfeedback.h"
#ifdef WITH_KUSERFEEDBACK
extern "C"
{
Q_DECL_EXPORT KCModule *create_korguserfeeback(QWidget *parent, const char *)
{
return new KOPrefsUserFeedBack(parent);
}
}
KOPrefsUserFeedBack::KOPrefsUserFeedBack(QWidget *parent, const QVariantList &args)
: KCModule(parent, args)
{
KAboutData *about = new KAboutData(QStringLiteral("KCMUserFeedBack"),
i18n("KCMUserFeedBack"),
QString(),
i18n("KOrganizer Configure User FeedBack"),
KAboutLicense::LGPL,
i18n("(c) 2020 Laurent Montel"));
about->addAuthor(i18n("Laurent Montel"), QString(), QStringLiteral("montel@kde.org"));
setAboutData(about);
QVBoxLayout *layout = new QVBoxLayout(this);
layout->setContentsMargins(0, 0, 0, 0);
mUserFeedbackWidget = new KUserFeedback::FeedbackConfigWidget(this);
connect(mUserFeedbackWidget, &KUserFeedback::FeedbackConfigWidget::configurationChanged, this, &KOPrefsUserFeedBack::markAsChanged);
layout->addWidget(mUserFeedbackWidget);
mUserFeedbackWidget->setFeedbackProvider(UserFeedBackManager::self()->userFeedbackProvider());
}
void KOPrefsUserFeedBack::load()
{
mUserFeedbackWidget->setFeedbackProvider(UserFeedBackManager::self()->userFeedbackProvider());
}
void KOPrefsUserFeedBack::save()
{
UserFeedBackManager::self()->userFeedbackProvider()->setTelemetryMode(mUserFeedbackWidget->telemetryMode());
UserFeedBackManager::self()->userFeedbackProvider()->setSurveyInterval(mUserFeedbackWidget->surveyInterval());
}
#endif
/*
This file is part of KOrganizer.
Copyright (c) 2000,2001,2002,2003 Cornelius Schumacher <schumacher@kde.org>
Copyright (C) 2003-2004 Reinhold Kainhofer <reinhold@kainhofer.com>
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; if not, write to the Free Software Foundation, Inc.,
51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
As a special exception, permission is given to link this program
with any edition of Qt, and distribute the resulting executable,
without including the source code for Qt in the source distribution.
*/
#ifndef KOPREFSUSERFEEDBACK_H
#define KOPREFSUSERFEEDBACK_H
#include <KCModule>
#include "kcm_korganizer_export.h"
#ifdef WITH_KUSERFEEDBACK
namespace KUserFeedback {
class FeedbackConfigWidget;
}
class KCM_KORGANIZER_EXPORT KOPrefsUserFeedBack : public KCModule
{
public:
explicit KOPrefsUserFeedBack(QWidget *parent = nullptr, const QVariantList &args = QVariantList());
protected:
void load() override;
void save() override;
private:
KUserFeedback::FeedbackConfigWidget *mUserFeedbackWidget = nullptr;
};
#endif
#endif // KOPREFSUSERFEEDBACK_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