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 "userdatadownloadwidget.h"
0008 #include <KLocalizedString>
0009 #include <QCheckBox>
0010 #include <QFormLayout>
0011 #include <QLineEdit>
0012 #include <QSpinBox>
0013 
0014 UserDataDownloadWidget::UserDataDownloadWidget(RocketChatAccount *account, QWidget *parent)
0015     : SettingsWidgetBase(account, parent)
0016     , mUserDataDownloadEnabled(new QCheckBox(i18n("Enable User Data Download"), this))
0017     , mSystemPathExportedFiles(new QLineEdit(this))
0018     , mSystemPathCompressedFile(new QLineEdit(this))
0019     , mProcessingFrequency(new QSpinBox(this))
0020     , mMessageLimitRequest(new QSpinBox(this))
0021 {
0022     mUserDataDownloadEnabled->setObjectName(QStringLiteral("mUserDataDownloadEnabled"));
0023     mMainLayout->addWidget(mUserDataDownloadEnabled);
0024     connectCheckBox(mUserDataDownloadEnabled, QStringLiteral("UserData_EnableDownload"));
0025 
0026     mSystemPathExportedFiles->setObjectName(QStringLiteral("mSystemPathExportedFiles"));
0027     addLineEdit(i18n("System Path (Exported Files)"), mSystemPathExportedFiles, QStringLiteral("UserData_FileSystemPath"));
0028 
0029     mSystemPathCompressedFile->setObjectName(QStringLiteral("mSystemPathCompressedFile"));
0030     addLineEdit(i18n("System Path (Compressed File)"), mSystemPathCompressedFile, QStringLiteral("UserData_FileSystemZipPath"));
0031 
0032     mProcessingFrequency->setObjectName(QStringLiteral("mProcessingFrequency"));
0033     mProcessingFrequency->setMaximum(1000);
0034     addSpinbox(i18n("Processing Frequency (Minutes)"), mProcessingFrequency, QStringLiteral("UserData_ProcessingFrequency"));
0035 
0036     mMessageLimitRequest->setObjectName(QStringLiteral("mMessageLimitRequest"));
0037     mMessageLimitRequest->setMaximum(99999);
0038     addSpinbox(i18n("Message Limit per Request"), mMessageLimitRequest, QStringLiteral("UserData_MessageLimitPerRequest"));
0039 }
0040 
0041 UserDataDownloadWidget::~UserDataDownloadWidget() = default;
0042 
0043 void UserDataDownloadWidget::initialize(const QMap<QString, QVariant> &mapSettings)
0044 {
0045     initializeWidget(mUserDataDownloadEnabled, mapSettings, true);
0046     initializeWidget(mSystemPathExportedFiles, mapSettings, QString());
0047     initializeWidget(mSystemPathCompressedFile, mapSettings, QString());
0048     initializeWidget(mProcessingFrequency, mapSettings, 2);
0049     initializeWidget(mMessageLimitRequest, mapSettings, 1000);
0050 }
0051 
0052 #include "moc_userdatadownloadwidget.cpp"