Commit ac2b9ead authored by Christoph Cullmann's avatar Christoph Cullmann

Merge branch 'userfeedback' into HEAD

parents 8a0cf44a b0daeb86
......@@ -46,6 +46,13 @@ if(KF5Activities_FOUND)
target_link_libraries(kate-lib PUBLIC KF5::Activities)
endif()
# optional KUserFeedback integration
find_package(KUserFeedback)
if (TARGET KUserFeedbackWidgets)
target_link_libraries(kate-lib PUBLIC KUserFeedbackWidgets)
target_compile_definitions(kate-lib PUBLIC -DWITH_KUSERFEEDBACK)
endif()
ki18n_wrap_ui(UI_SOURCES ui/sessionconfigwidget.ui session/katesessionmanagedialog.ui)
target_sources(kate-lib PRIVATE ${UI_SOURCES})
......
......@@ -32,6 +32,15 @@
#include <KWindowInfo>
#include <kwindowsystem_version.h>
#ifdef WITH_KUSERFEEDBACK
#include <KUserFeedback/ApplicationVersionSource>
#include <KUserFeedback/PlatformInfoSource>
#include <KUserFeedback/QtVersionSource>
#include <KUserFeedback/ScreenInfoSource>
#include <KUserFeedback/StartCountSource>
#include <KUserFeedback/UsageTimeSource>
#endif
#include <QApplication>
#include <QCommandLineParser>
#include <QFileInfo>
......@@ -68,6 +77,33 @@ KateApp::KateApp(const QCommandLineParser &args)
* handle mac os x like file open request via event filter
*/
qApp->installEventFilter(this);
#ifdef WITH_KUSERFEEDBACK
/**
* 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
*/
// software version info
m_userFeedbackProvider.addDataSource(new KUserFeedback::ApplicationVersionSource);
m_userFeedbackProvider.addDataSource(new KUserFeedback::QtVersionSource);
// info about the machine
m_userFeedbackProvider.addDataSource(new KUserFeedback::PlatformInfoSource);
m_userFeedbackProvider.addDataSource(new KUserFeedback::ScreenInfoSource);
// usage info
m_userFeedbackProvider.addDataSource(new KUserFeedback::StartCountSource);
m_userFeedbackProvider.addDataSource(new KUserFeedback::UsageTimeSource);
#endif
}
KateApp::~KateApp()
......
......@@ -24,6 +24,10 @@
#include <ktexteditor/application.h>
#ifdef WITH_KUSERFEEDBACK
#include <KUserFeedback/Provider>
#endif
#include "kateappadaptor.h"
#include "katedocmanager.h"
#include "katemainwindow.h"
......@@ -85,6 +89,17 @@ public:
return &m_wrapper;
}
#ifdef WITH_KUSERFEEDBACK
/**
* 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_KUSERFEEDBACK
/**
* user feedback provider
*/
KUserFeedback::Provider m_userFeedbackProvider;
#endif
};
#endif
......@@ -233,6 +233,23 @@ KateConfigDialog::KateConfigDialog(KateMainWindow *parent, KTextEditor::View *vi
}
// END Plugins page
#ifdef WITH_KUSERFEEDBACK
// KUserFeedback Config
page = new QFrame(this);
vlayout = new QVBoxLayout(page);
vlayout->setContentsMargins(0, 0, 0, 0);
vlayout->setSpacing(0);
m_userFeedbackWidget = new KUserFeedback::FeedbackConfigWidget(page);
m_userFeedbackWidget->setFeedbackProvider(&KateApp::self()->userFeedbackProvider());
connect(m_userFeedbackWidget, &KUserFeedback::FeedbackConfigWidget::configurationChanged, this, &KateConfigDialog::slotChanged);
vlayout->addWidget(m_userFeedbackWidget);
item = addSubPage(applicationItem, page, i18n("User Feedback"));
item->setHeader(i18n("User Feedback"));
item->setIcon(QIcon::fromTheme(QStringLiteral("preferences-desktop-locale")));
#endif
// editor widgets from kwrite/kwdialog
m_editorPage = addPage(new QWidget, i18n("Editor Component"));
m_editorPage->setIcon(QIcon::fromTheme(QStringLiteral("accessories-text-editor")));
......@@ -387,6 +404,12 @@ void KateConfigDialog::slotApply()
KateSessionManager *sessionmanager = KateApp::self()->sessionManager();
KConfig *sessionConfig = sessionmanager->activeSession()->config();
KateApp::self()->pluginManager()->writeConfig(sessionConfig);
#ifdef WITH_KUSERFEEDBACK
// set current active mode + write back the config for future starts
KateApp::self()->userFeedbackProvider().setTelemetryMode(m_userFeedbackWidget->telemetryMode());
KateApp::self()->userFeedbackProvider().setSurveyInterval(m_userFeedbackWidget->surveyInterval());
#endif
}
for (PluginPageListItem *plugin : qAsConst(m_pluginPages)) {
......
......@@ -31,6 +31,10 @@
#include <KPageDialog>
#ifdef WITH_KUSERFEEDBACK
#include <KUserFeedback/FeedbackConfigWidget>
#endif
class QCheckBox;
class QComboBox;
class QSpinBox;
......@@ -102,6 +106,10 @@ private:
KPageWidgetItem *m_editorPage;
void addEditorPages();
#ifdef WITH_KUSERFEEDBACK
KUserFeedback::FeedbackConfigWidget *m_userFeedbackWidget = nullptr;
#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