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 "mobilesettingswidget.h" 0008 #include <KLocalizedString> 0009 #include <QCheckBox> 0010 #include <QFormLayout> 0011 #include <QLabel> 0012 #include <QSpinBox> 0013 0014 MobileSettingsWidget::MobileSettingsWidget(RocketChatAccount *account, QWidget *parent) 0015 : SettingsWidgetBase(account, parent) 0016 , mAllowSaveMediaGallery(new QCheckBox(i18n("Allow Save Media to Gallery"), this)) 0017 , mForceScreenLock(new QCheckBox(i18n("Force screen lock"), this)) 0018 , mForceScreenLockAfter(new QSpinBox(this)) 0019 { 0020 mAllowSaveMediaGallery->setObjectName(QStringLiteral("mAllowSaveMediaGallery")); 0021 mMainLayout->addWidget(mAllowSaveMediaGallery); 0022 connectCheckBox(mAllowSaveMediaGallery, QStringLiteral("Allow_Save_Media_to_Gallery")); 0023 0024 auto screenLockLabel = createBoldLabel(i18n("Screen Lock")); 0025 screenLockLabel->setObjectName(QStringLiteral("screenLockLabel")); 0026 mMainLayout->addWidget(screenLockLabel); 0027 0028 mForceScreenLock->setObjectName(QStringLiteral("mForceScreenLock")); 0029 mForceScreenLock->setToolTip(i18n("When enabled, you'll force your users to use a PIN/BIOMETRY/FACEID to unlock the app.")); 0030 mMainLayout->addWidget(mForceScreenLock); 0031 connectCheckBox(mForceScreenLock, QStringLiteral("Force_Screen_Lock")); 0032 0033 mForceScreenLockAfter->setObjectName(QStringLiteral("mForceScreenLockAfter")); 0034 mForceScreenLockAfter->setMaximum(99999); 0035 mForceScreenLockAfter->setToolTip(i18n("The time to request password again after the finish of the latest session, in seconds.")); 0036 addSpinbox(i18n("Force Screen Lock After"), mForceScreenLockAfter, QStringLiteral("Force_Screen_Lock_After")); 0037 } 0038 0039 MobileSettingsWidget::~MobileSettingsWidget() = default; 0040 0041 void MobileSettingsWidget::initialize(const QMap<QString, QVariant> &mapSettings) 0042 { 0043 initializeWidget(mAllowSaveMediaGallery, mapSettings, true); 0044 initializeWidget(mForceScreenLock, mapSettings, true); 0045 initializeWidget(mForceScreenLockAfter, mapSettings, 1800); 0046 } 0047 0048 #include "moc_mobilesettingswidget.cpp"