File indexing completed on 2024-12-22 04:45:43

0001 /*
0002    SPDX-FileCopyrightText: 2022-2024 Laurent Montel <montel@kde.org>
0003 
0004    SPDX-License-Identifier: LGPL-2.0-or-later
0005 */
0006 
0007 #include "troubleshootsettingswidget.h"
0008 #include <KLocalizedString>
0009 #include <QCheckBox>
0010 #include <QFormLayout>
0011 
0012 TroubleshootSettingsWidget::TroubleshootSettingsWidget(RocketChatAccount *account, QWidget *parent)
0013     : SettingsWidgetBase(account, parent)
0014     , mDisableNotifications(new QCheckBox(i18n("Disable Notifications"), this))
0015     , mDisablePresenceBroadcast(new QCheckBox(i18n("Disable Presence Broadcast"), this))
0016     , mDisableInstanceBroadcast(new QCheckBox(i18n("Disable Instance Broadcast"), this))
0017     , mDisableSessionsMonitor(new QCheckBox(i18n("Disable Sessions Monitor"), this))
0018     , mDisableLivechatActivityMonitor(new QCheckBox(i18n("Disable Livechat Activity Monitor"), this))
0019     , mDisableStatisticsGenerator(new QCheckBox(i18n("Disable Statistics Generator"), this))
0020     , mDisableDataExporterProcessor(new QCheckBox(i18n("Disable Data Exporter Processor"), this))
0021     , mDisableWorkspaceSync(new QCheckBox(i18n("Disable Workspace Sync"), this))
0022 {
0023     mDisableNotifications->setObjectName(QStringLiteral("mDisableNotifications"));
0024     mMainLayout->addWidget(mDisableNotifications);
0025     mDisableNotifications->setToolTip(
0026         i18n("This setting completely disables the notifications system; sounds, desktop notifications, mobile notifications, and emails will stop!"));
0027     connectCheckBox(mDisableNotifications, QStringLiteral("Troubleshoot_Disable_Notifications"));
0028 
0029     mDisablePresenceBroadcast->setObjectName(QStringLiteral("mDisablePresenceBroadcast"));
0030     mMainLayout->addWidget(mDisablePresenceBroadcast);
0031     mDisablePresenceBroadcast->setToolTip(
0032         i18n("This setting prevents all instances from sending the status changes of the users to their clients keeping all the users with their presence "
0033              "status from the first load!"));
0034     connectCheckBox(mDisablePresenceBroadcast, QStringLiteral("Troubleshoot_Disable_Presence_Broadcast"));
0035 
0036     mDisableInstanceBroadcast->setObjectName(QStringLiteral("mDisableInstanceBroadcast"));
0037     mMainLayout->addWidget(mDisableInstanceBroadcast);
0038     mDisableInstanceBroadcast->setToolTip(
0039         i18n("This setting prevents the Rocket.Chat instances from sending events to the other instances, it may cause syncing problems and misbehavior!"));
0040     connectCheckBox(mDisableInstanceBroadcast, QStringLiteral("Troubleshoot_Disable_Instance_Broadcast"));
0041 
0042     mDisableSessionsMonitor->setObjectName(QStringLiteral("mDisableSessionsMonitor"));
0043     mMainLayout->addWidget(mDisableSessionsMonitor);
0044     mDisableSessionsMonitor->setToolTip(
0045         i18n("This setting prevents the Rocket.Chat instances from sending events to the other instances, it may cause syncing problems and misbehavior!"));
0046     connectCheckBox(mDisableSessionsMonitor, QStringLiteral("Troubleshoot_Disable_Sessions_Monitor"));
0047 
0048     mDisableLivechatActivityMonitor->setObjectName(QStringLiteral("mDisableLivechatActivityMonitor"));
0049     mMainLayout->addWidget(mDisableLivechatActivityMonitor);
0050     mDisableLivechatActivityMonitor->setToolTip(
0051         i18n("This setting stops the processing of livechat visitor sessions causing the statistics to stop working correctly!"));
0052     connectCheckBox(mDisableLivechatActivityMonitor, QStringLiteral("Troubleshoot_Disable_Livechat_Activity_Monitor"));
0053 
0054     mDisableStatisticsGenerator->setObjectName(QStringLiteral("mDisableStatisticsGenerator"));
0055     mMainLayout->addWidget(mDisableStatisticsGenerator);
0056     mDisableStatisticsGenerator->setToolTip(
0057         i18n("This setting stops the processing all statistics making the info page outdated until someone clicks on the refresh button and may cause other "
0058              "missing information around the system!"));
0059     connectCheckBox(mDisableStatisticsGenerator, QStringLiteral("Troubleshoot_Disable_Statistics_Generator"));
0060 
0061     mDisableDataExporterProcessor->setObjectName(QStringLiteral("mDisableDataExporterProcessor"));
0062     mMainLayout->addWidget(mDisableDataExporterProcessor);
0063     mDisableDataExporterProcessor->setToolTip(
0064         i18n("This setting stops the processing of all export requests from users, so they will not receive the link to download their data!"));
0065     connectCheckBox(mDisableDataExporterProcessor, QStringLiteral("Troubleshoot_Disable_Data_Exporter_Processor"));
0066 
0067     mDisableWorkspaceSync->setObjectName(QStringLiteral("mDisableWorkspaceSync"));
0068     mMainLayout->addWidget(mDisableWorkspaceSync);
0069     mDisableWorkspaceSync->setToolTip(
0070         i18n("This setting stops the sync of this server with Rocket.Chat's cloud and may cause issues with marketplace and enterprise licenses!"));
0071     connectCheckBox(mDisableWorkspaceSync, QStringLiteral("Troubleshoot_Disable_Workspace_Sync"));
0072 }
0073 
0074 TroubleshootSettingsWidget::~TroubleshootSettingsWidget() = default;
0075 
0076 void TroubleshootSettingsWidget::initialize(const QMap<QString, QVariant> &mapSettings)
0077 {
0078     initializeWidget(mDisableNotifications, mapSettings, false);
0079     initializeWidget(mDisablePresenceBroadcast, mapSettings, false);
0080     initializeWidget(mDisableInstanceBroadcast, mapSettings, false);
0081     initializeWidget(mDisableSessionsMonitor, mapSettings, false);
0082     initializeWidget(mDisableLivechatActivityMonitor, mapSettings, false);
0083     initializeWidget(mDisableStatisticsGenerator, mapSettings, false);
0084     initializeWidget(mDisableDataExporterProcessor, mapSettings, false);
0085     initializeWidget(mDisableWorkspaceSync, mapSettings, false);
0086 }