File indexing completed on 2024-12-01 04:36:38
0001 /* 0002 SPDX-FileCopyrightText: 2020-2024 Laurent Montel <montel@kde.org> 0003 0004 SPDX-License-Identifier: LGPL-2.0-or-later 0005 */ 0006 0007 #include "configureuserfeedbackwidget.h" 0008 #include <QVBoxLayout> 0009 0010 #if HAVE_KUSERFEEDBACK 0011 #include "userfeedback/userfeedbackmanager.h" 0012 #include <KUserFeedback/FeedbackConfigWidget> 0013 #include <KUserFeedback/Provider> 0014 #endif 0015 0016 ConfigureUserFeedbackWidget::ConfigureUserFeedbackWidget(QWidget *parent) 0017 : QWidget(parent) 0018 #if HAVE_KUSERFEEDBACK 0019 , mUserFeedbackWidget(new KUserFeedback::FeedbackConfigWidget(this)) 0020 #endif 0021 { 0022 auto userFeedBackLayout = new QVBoxLayout(this); 0023 userFeedBackLayout->setObjectName(QStringLiteral("userFeedBackLayout")); 0024 userFeedBackLayout->setContentsMargins({}); 0025 #if HAVE_KUSERFEEDBACK 0026 mUserFeedbackWidget->setObjectName(QStringLiteral("mUserFeedbackWidget")); 0027 userFeedBackLayout->addWidget(mUserFeedbackWidget); 0028 #endif 0029 } 0030 0031 ConfigureUserFeedbackWidget::~ConfigureUserFeedbackWidget() = default; 0032 0033 void ConfigureUserFeedbackWidget::save() 0034 { 0035 #if HAVE_KUSERFEEDBACK 0036 // set current active mode + write back the config for future starts 0037 UserFeedBackManager::self()->userFeedbackProvider()->setTelemetryMode(mUserFeedbackWidget->telemetryMode()); 0038 UserFeedBackManager::self()->userFeedbackProvider()->setSurveyInterval(mUserFeedbackWidget->surveyInterval()); 0039 #endif 0040 } 0041 0042 void ConfigureUserFeedbackWidget::load() 0043 { 0044 #if HAVE_KUSERFEEDBACK 0045 mUserFeedbackWidget->setFeedbackProvider(UserFeedBackManager::self()->userFeedbackProvider()); 0046 #endif 0047 } 0048 0049 #include "moc_configureuserfeedbackwidget.cpp"