File indexing completed on 2024-12-22 04:55:32
0001 /* 0002 SPDX-FileCopyrightText: 2020-2024 Laurent Montel <montel@kde.org> 0003 0004 SPDX-License-Identifier: GPL-2.0-or-later 0005 */ 0006 0007 #include "kaddressbook_config_userfeedback.h" 0008 #include <KAboutData> 0009 #include <KLocalizedString> 0010 #include <KPluginFactory> 0011 #include <QHBoxLayout> 0012 #ifdef WITH_KUSERFEEDBACK 0013 #include "userfeedback/userfeedbackmanager.h" 0014 #include <KUserFeedback/FeedbackConfigWidget> 0015 #endif 0016 0017 using namespace KAddressBook; 0018 0019 K_PLUGIN_CLASS_WITH_JSON(KCMKaddressbookUserFeedBackConfig, "kaddressbook_config_userfeedback.json") 0020 0021 KCMKaddressbookUserFeedBackConfig::KCMKaddressbookUserFeedBackConfig(QObject *parent, const KPluginMetaData &data) 0022 : KCModule(parent, data) 0023 , mUserFeedbackWidget(new KUserFeedback::FeedbackConfigWidget(widget())) 0024 { 0025 auto lay = new QHBoxLayout(widget()); 0026 lay->setContentsMargins({}); 0027 connect(mUserFeedbackWidget, &KUserFeedback::FeedbackConfigWidget::configurationChanged, this, &KCMKaddressbookUserFeedBackConfig::markAsChanged); 0028 0029 lay->addWidget(mUserFeedbackWidget); 0030 mUserFeedbackWidget->setFeedbackProvider(UserFeedBackManager::self()->userFeedbackProvider()); 0031 } 0032 0033 void KCMKaddressbookUserFeedBackConfig::save() 0034 { 0035 UserFeedBackManager::self()->userFeedbackProvider()->setTelemetryMode(mUserFeedbackWidget->telemetryMode()); 0036 UserFeedBackManager::self()->userFeedbackProvider()->setSurveyInterval(mUserFeedbackWidget->surveyInterval()); 0037 } 0038 0039 void KCMKaddressbookUserFeedBackConfig::load() 0040 { 0041 mUserFeedbackWidget->setFeedbackProvider(UserFeedBackManager::self()->userFeedbackProvider()); 0042 } 0043 0044 void KCMKaddressbookUserFeedBackConfig::defaults() 0045 { 0046 // FIXME ? 0047 mUserFeedbackWidget->setFeedbackProvider(UserFeedBackManager::self()->userFeedbackProvider()); 0048 } 0049 0050 #include "kaddressbook_config_userfeedback.moc" 0051 0052 #include "moc_kaddressbook_config_userfeedback.cpp"