Commit 8d30b98c authored by Christoph Cullmann's avatar Christoph Cullmann 🐮
Browse files

initial KUserFeedback::Provider setup

parent 7399c193
......@@ -48,6 +48,13 @@ if(KF5Activities_FOUND)
target_link_libraries(kate-lib PUBLIC KF5::Activities)
endif()
# optional KUserFeedback integration
find_package(KUserFeedback)
if (TARGET KUserFeedbackCore)
target_link_libraries(kate-lib PUBLIC KUserFeedbackCore)
target_compile_definitions(kate-lib PUBLIC -DWITH_KUSERFEEDBACKCORE)
endif()
ki18n_wrap_ui(UI_SOURCES ui/sessionconfigwidget.ui session/katesessionmanagedialog.ui)
target_sources(kate-lib PRIVATE ${UI_SOURCES})
......
......@@ -32,6 +32,13 @@
#include <KWindowInfo>
#include <kwindowsystem_version.h>
#ifdef WITH_KUSERFEEDBACKCORE
#include <KUserFeedback/ApplicationVersionSource>
#include <KUserFeedback/PlatformInfoSource>
#include <KUserFeedback/ScreenInfoSource>
#include <KUserFeedback/QtVersionSource>
#endif
#include <QApplication>
#include <QCommandLineParser>
#include <QFileInfo>
......@@ -68,6 +75,30 @@ KateApp::KateApp(const QCommandLineParser &args)
* handle mac os x like file open request via event filter
*/
qApp->installEventFilter(this);
#ifdef WITH_KUSERFEEDBACKCORE
/**
* defaults, inspired by plasma
*/
m_userFeedbackProvider.setProductIdentifier(QStringLiteral("org.kde.kate"));
m_userFeedbackProvider.setFeedbackServer(QUrl(QStringLiteral("https://telemetry.kde.org/")));
m_userFeedbackProvider.setSubmissionInterval(7);
m_userFeedbackProvider.setApplicationStartsUntilEncouragement(5);
m_userFeedbackProvider.setEncouragementDelay(30);
/**
* add some feedback providers
*/
m_userFeedbackProvider.addDataSource(new KUserFeedback::ApplicationVersionSource);
m_userFeedbackProvider.addDataSource(new KUserFeedback::PlatformInfoSource);
m_userFeedbackProvider.addDataSource(new KUserFeedback::ScreenInfoSource);
m_userFeedbackProvider.addDataSource(new KUserFeedback::QtVersionSource);
/**
* default is no feedback!
*/
m_userFeedbackProvider.setTelemetryMode(KUserFeedback::Provider::TelemetryMode(KSharedConfig::openConfig()->group("General").readEntry("TelemetryMode", int(KUserFeedback::Provider::NoTelemetry))));
#endif
}
KateApp::~KateApp()
......
......@@ -24,6 +24,10 @@
#include <ktexteditor/application.h>
#ifdef WITH_KUSERFEEDBACKCORE
#include <KUserFeedback/Provider>
#endif
#include "kateappadaptor.h"
#include "katedocmanager.h"
#include "katemainwindow.h"
......@@ -85,6 +89,17 @@ public:
return &m_wrapper;
}
#ifdef WITH_KUSERFEEDBACKCORE
/**
* Get our global user feedback provider
* @return user feedback provider
*/
KUserFeedback::Provider &userFeedbackProvider()
{
return m_userFeedbackProvider;
}
#endif
/**
* kate init
*/
......@@ -380,6 +395,13 @@ private:
* session manager
*/
KateSessionManager m_sessionManager;
#ifdef WITH_KUSERFEEDBACKCORE
/**
* user feedback provider
*/
KUserFeedback::Provider m_userFeedbackProvider;
#endif
};
#endif
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