Commit 019a733a authored by Laurent Montel's avatar Laurent Montel 😁
Browse files

implement userfeedback

parent ec563041
......@@ -61,12 +61,8 @@ set(QT_REQUIRED_VERSION "5.12.0")
option(KDEPIM_ENTERPRISE_BUILD "Enable features specific to the enterprise branch, which are normally disabled. Also, it disables many components not needed for Kontact such as the Kolab client." FALSE)
find_package(Qt5 ${QT_REQUIRED_VERSION} CONFIG REQUIRED DBus Gui Widgets Test UiTools)
option(KDEPIM_KUSERFEEDBACK "Enable user feedback support (experimental)" FALSE)
if (KDEPIM_KUSERFEEDBACK)
#Optional
find_package(KUserFeedback)
set_package_properties(KUserFeedback PROPERTIES DESCRIPTION "User Feedback lib" TYPE OPTIONAL PURPOSE "Allow to send Telemetry Information (optional). It can be disable in apps.")
endif()
find_package(KUserFeedback)
set_package_properties(KUserFeedback PROPERTIES DESCRIPTION "User Feedback lib" TYPE OPTIONAL PURPOSE "Allow to send Telemetry Information (optional). It can be disable in apps.")
if (TARGET KUserFeedbackWidgets)
add_definitions(-DWITH_KUSERFEEDBACK)
......
......@@ -18,6 +18,12 @@ add_subdirectory(kconf_update)
########### next target ###############
set(korganizer_userfeedback_LIB)
if (TARGET KUserFeedbackWidgets)
set(korganizer_userfeedback_LIB KUserFeedbackWidgets)
endif()
set(korganizer_common_SRCS)
if (ECM_VERSION VERSION_LESS "5.68.0")
ecm_qt_declare_logging_category(korganizer_common_SRCS HEADER korganizer_debug.h IDENTIFIER KORGANIZER_LOG CATEGORY_NAME org.kde.pim.korganizer)
......@@ -54,6 +60,7 @@ target_link_libraries(korganizer
KF5::PimCommonAkonadi
KF5::Crash
KF5::WindowSystem
${korganizer_userfeedback_LIB}
)
install(TARGETS
......@@ -87,6 +94,7 @@ target_link_libraries(kcm_korganizer
KF5::PimCommon
KF5::AkonadiWidgets
KF5::WindowSystem
${korganizer_userfeedback_LIB}
)
install(TARGETS
......@@ -246,10 +254,6 @@ qt5_add_dbus_interfaces(korganizerprivate_LIB_SRCS
add_library(korganizerprivate ${korganizerprivate_LIB_SRCS})
generate_export_header(korganizerprivate BASE_NAME korganizerprivate)
set(korganizer_userfeedback_LIB)
if (TARGET KUserFeedbackWidgets)
set(korganizer_userfeedback_LIB KUserFeedbackWidgets)
endif()
target_link_libraries(korganizerprivate
PUBLIC
......
......@@ -7,6 +7,7 @@ install(FILES
korganizer_configplugins.desktop
korganizer_configtime.desktop
korganizer_configviews.desktop
korganizer_userfeedback.desktop
DESTINATION ${KDE_INSTALL_KSERVICES5DIR}
)
[Desktop Entry]
Icon=preferences-other
Type=Service
X-KDE-ServiceTypes=KCModule
X-KDE-ModuleType=Library
X-KDE-Library=kcm_korganizer
X-KDE-FactoryName=korguserfeeback
X-KDE-HasReadOnlyMode=false
X-KDE-ParentApp=korganizer
X-KDE-ParentComponents=korganizer,kontact_korganizerplugin
X-KDE-CfgDlgHierarchy=KOrganizer
X-KDE-Weight=600
Name=UserFeedBack
Comment=KOrganizer UserFeedBack Configuration
X-KDE-Keywords=korganizer,userfeedback
......@@ -102,7 +102,9 @@ void KODialogManager::showOptionsDialog()
modules.append(QStringLiteral("korganizer_configfreebusy.desktop"));
modules.append(QStringLiteral("korganizer_configplugins.desktop"));
modules.append(QStringLiteral("korganizer_configdesignerfields.desktop"));
#ifdef WITH_KUSERFEEDBACK
modules.append(QStringLiteral("korganizer_userfeedback.desktop"));
#endif
// add them all
const QStringList::iterator mitEnd(modules.end());
for (QStringList::iterator mit = modules.begin(); mit != mitEnd; ++mit) {
......
......@@ -46,6 +46,12 @@
#include <KSharedConfig>
#include <QLabel>
#include <QStatusBar>
#ifdef WITH_KUSERFEEDBACK
#include <KUserFeedback/NotificationPopup>
#include <KUserFeedback/Provider>
#include "userfeedback/userfeedbackmanager.h"
#endif
KOrganizer::KOrganizer() : KParts::MainWindow()
, KOrg::MainWindow()
......@@ -63,6 +69,12 @@ KOrganizer::KOrganizer() : KParts::MainWindow()
mActionManager = new ActionManager(this, mCalendarView, this, this, false, menuBar());
(void)new KOrganizerIfaceImpl(mActionManager, this, QStringLiteral("IfaceImpl"));
#ifdef WITH_KUSERFEEDBACK
KUserFeedback::NotificationPopup *userFeedBackNotificationPopup = new KUserFeedback::NotificationPopup(this);
userFeedBackNotificationPopup->setFeedbackProvider(UserFeedBackManager::self()->userFeedbackProvider());
#endif
}
KOrganizer::~KOrganizer()
......
......@@ -80,6 +80,12 @@
#include <QStandardPaths>
#include <QLocale>
#include <QTimeEdit>
#include <KAboutData>
#ifdef WITH_KUSERFEEDBACK
#include <KUserFeedback/FeedbackConfigWidget>
#include "userfeedback/userfeedbackmanager.h"
#endif
KOPrefsDialogMain::KOPrefsDialogMain(QWidget *parent)
: KPrefsModule(KOPrefs::instance(), parent)
......@@ -1570,3 +1576,46 @@ 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()
{
}
void KOPrefsUserFeedBack::save()
{
UserFeedBackManager::self()->userFeedbackProvider()->setTelemetryMode(mUserFeedbackWidget->telemetryMode());
UserFeedBackManager::self()->userFeedbackProvider()->setSurveyInterval(mUserFeedbackWidget->surveyInterval());
}
#endif
......@@ -156,11 +156,28 @@ public:
explicit KOPrefsDesignerFields(QWidget *parent = nullptr);
protected:
QString localUiDir() override;
QString uiPath() override;
Q_REQUIRED_RESULT QString localUiDir() override;
Q_REQUIRED_RESULT QString uiPath() override;
void writeActivePages(const QStringList &) override;
QStringList readActivePages() override;
QString applicationName() 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
......@@ -22,10 +22,11 @@
#define USERFEEDBACKMANAGER_H
#include <QObject>
#include "korganizer_core_export.h"
namespace KUserFeedback {
class Provider;
}
class UserFeedBackManager : public QObject
class KORGANIZER_CORE_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