Commit 5f13d4c0 authored by Laurent Montel's avatar Laurent Montel 😁
Browse files

Add config userfeedback

parent 9e510ed5
......@@ -138,6 +138,7 @@ target_link_libraries(kaddressbook
KF5::KontactInterface
kaddressbookprivate
KF5::Crash
${kaddressbook_userfeedback_LIB}
)
install(TARGETS kaddressbook ${KDE_INSTALL_TARGETS_DEFAULT_ARGS})
......
......@@ -30,3 +30,26 @@ kcoreaddons_desktop_to_json(kaddressbook_config_plugins kaddressbook_config_plug
install(FILES kaddressbook_config_plugins.desktop DESTINATION ${KDE_INSTALL_KSERVICES5DIR})
install(TARGETS kaddressbook_config_plugins DESTINATION ${KDE_INSTALL_PLUGINDIR})
##################################################
if (TARGET KUserFeedbackWidgets)
set(kcm_config_userfeedback_SRCS
kaddressbook_config_userfeedback.cpp
)
add_library(kaddressbook_config_userfeedback MODULE ${kcm_config_userfeedback_SRCS})
target_link_libraries(kaddressbook_config_userfeedback
KF5::KCMUtils
KF5::I18n
KF5::PimCommon
kaddressbookprivate
KF5::XmlGui
KF5::KaddressbookImportExport
KUserFeedbackWidgets
)
kcoreaddons_desktop_to_json(kaddressbook_config_userfeedback kaddressbook_config_userfeedback.desktop SERVICE_TYPES kcmodule.desktop)
install(FILES kaddressbook_config_userfeedback.desktop DESTINATION ${KDE_INSTALL_KSERVICES5DIR})
install(TARGETS kaddressbook_config_userfeedback DESTINATION ${KDE_INSTALL_PLUGINDIR})
endif()
......@@ -40,7 +40,7 @@ KCMKaddressbookPluginsConfig::KCMKaddressbookPluginsConfig(QWidget *parent, cons
KAboutData *about = new KAboutData(QStringLiteral("kcmakrpluginsconfig"),
i18n("Configure Plugins"),
QString(), QString(), KAboutLicense::GPL,
i18n("(c), 2016-2019 Laurent Montel"));
i18n("(c), 2016-2020 Laurent Montel"));
about->addAuthor(i18n("Laurent Montel"), QString(), QStringLiteral("montel@kde.org"));
......
/*
Copyright (C) 2020 Laurent Montel <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 "kaddressbook_config_userfeedback.h"
#include <KAboutData>
#include <KPluginFactory>
#include <KLocalizedString>
#include <QHBoxLayout>
#ifdef WITH_KUSERFEEDBACK
#include <KUserFeedback/FeedbackConfigWidget>
#include "userfeedback/userfeedbackmanager.h"
#endif
using namespace KAddressBook;
K_PLUGIN_FACTORY(KCMKaddressbookUserFeedBackConfigFactory, registerPlugin<KCMKaddressbookUserFeedBackConfig>();
)
KCMKaddressbookUserFeedBackConfig::KCMKaddressbookUserFeedBackConfig(QWidget *parent, const QVariantList &args)
: KCModule(parent, args)
{
QHBoxLayout *lay = new QHBoxLayout(this);
lay->setContentsMargins(0, 0, 0, 0);
KAboutData *about = new KAboutData(QStringLiteral("kcmaddressbookuserfeedbackconfig"),
i18n("Configure User FeedBack"),
QString(), QString(), KAboutLicense::GPL,
i18n("(c), 2020 Laurent Montel"));
about->addAuthor(i18n("Laurent Montel"), QString(), QStringLiteral("montel@kde.org"));
setAboutData(about);
mUserFeedbackWidget = new KUserFeedback::FeedbackConfigWidget(this);
connect(mUserFeedbackWidget, &KUserFeedback::FeedbackConfigWidget::configurationChanged, this, &KCMKaddressbookUserFeedBackConfig::markAsChanged);
lay->addWidget(mUserFeedbackWidget);
mUserFeedbackWidget->setFeedbackProvider(UserFeedBackManager::self()->userFeedbackProvider());
}
void KCMKaddressbookUserFeedBackConfig::save()
{
UserFeedBackManager::self()->userFeedbackProvider()->setTelemetryMode(mUserFeedbackWidget->telemetryMode());
UserFeedBackManager::self()->userFeedbackProvider()->setSurveyInterval(mUserFeedbackWidget->surveyInterval());
}
void KCMKaddressbookUserFeedBackConfig::load()
{
}
void KCMKaddressbookUserFeedBackConfig::defaults()
{
}
#include "kaddressbook_config_userfeedback.moc"
[Desktop Entry]
Icon=preferences-other
Type=Service
X-KDE-ServiceTypes=KCModule
X-KDE-Library=kaddressbook_config_userfeedback
X-KDE-ParentApp=kaddressbook
X-KDE-ParentComponents=kaddressbook,kaddressbook_config_userfeedback
X-KDE-CfgDlgHierarchy=KAddressBook
X-KDE-Weight=250
Name=User FeedBack
X-KDE-Keywords=kaddressbook, configure, settings, userfeedback
/*
Copyright (C) 2020 Laurent Montel <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.
*/
#ifndef KCM_Kaddressbook_Config_Plugins_H
#define KCM_Kaddressbook_Config_Plugins_H
#include <KCModule>
#include <QVariant>
namespace KUserFeedback {
class FeedbackConfigWidget;
}
namespace KAddressBook {
class KCMKaddressbookUserFeedBackConfig : public KCModule
{
Q_OBJECT
public:
KCMKaddressbookUserFeedBackConfig(QWidget *parent, const QVariantList &args);
void load() override;
void save() override;
void defaults() override;
private:
KUserFeedback::FeedbackConfigWidget *mUserFeedbackWidget = nullptr;
};
}
#endif // KCM_Kaddressbook_Config_Plugins_H
......@@ -375,6 +375,9 @@ void MainWidget::configure()
dlg->addModule(QStringLiteral("akonadicontact_actions.desktop"));
dlg->addModule(QStringLiteral("kcmldap.desktop"));
dlg->addModule(QStringLiteral("kaddressbook_config_plugins.desktop"));
#ifdef WITH_KUSERFEEDBACK
dlg->addModule(QStringLiteral("kaddressbook_config_userfeedback.desktop"));
#endif
dlg->exec();
delete dlg;
......
......@@ -33,6 +33,11 @@
#include <KMessageBox>
#include <QMenuBar>
#include <QPointer>
#ifdef WITH_KUSERFEEDBACK
#include <KUserFeedback/NotificationPopup>
#include <KUserFeedback/Provider>
#include "userfeedback/userfeedbackmanager.h"
#endif
MainWindow::MainWindow()
: KXmlGuiWindow(nullptr)
......@@ -53,6 +58,10 @@ MainWindow::MainWindow()
mHideMenuBarAction->setChecked(Settings::self()->showMenuBar());
slotToggleMenubar(true);
#ifdef WITH_KUSERFEEDBACK
KUserFeedback::NotificationPopup *userFeedBackNotificationPopup = new KUserFeedback::NotificationPopup(this);
userFeedBackNotificationPopup->setFeedbackProvider(UserFeedBackManager::self()->userFeedbackProvider());
#endif
}
MainWindow::~MainWindow()
......
......@@ -22,10 +22,12 @@
#define USERFEEDBACKMANAGER_H
#include <QObject>
#include "kaddressbook_export.h"
namespace KUserFeedback {
class Provider;
}
class UserFeedBackManager : public QObject
class KADDRESSBOOK_EXPORT UserFeedBackManager : public QObject
{
Q_OBJECT
public:
......
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