File indexing completed on 2024-12-22 04:45:42
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 "encryptionsettingswidget.h" 0008 0009 #include <QCheckBox> 0010 #include <QFormLayout> 0011 0012 #include <KLocalizedString> 0013 0014 EncryptionSettingsWidget::EncryptionSettingsWidget(RocketChatAccount *account, QWidget *parent) 0015 : SettingsWidgetBase{account, parent} 0016 , mEnableE2E(new QCheckBox(i18n("Enabled E2E encryption"), this)) 0017 , mEnableEncryptionDirectRoomsByDefault(new QCheckBox(i18n("Enable encryption for Direct Rooms by default"), this)) 0018 , mEnableEncryptionPrivateRoomsByDefault(new QCheckBox(i18n("Enable encryption for Private Rooms by default"), this)) 0019 , mEnableOtr(new QCheckBox(i18n("Enable OTR"), this)) 0020 { 0021 mEnableE2E->setObjectName(QStringLiteral("mEnableE2E")); 0022 mEnableE2E->setToolTip(i18n("Enable option to create encrypted groups and be able to change groups and direct messages to be encrypted.")); 0023 mMainLayout->addWidget(mEnableE2E); 0024 connectCheckBox(mEnableE2E, QStringLiteral("E2E_Enable")); 0025 0026 mEnableEncryptionDirectRoomsByDefault->setObjectName(QStringLiteral("mEnableEncryptionDirectRoomsByDefault")); 0027 mMainLayout->addWidget(mEnableEncryptionDirectRoomsByDefault); 0028 connectCheckBox(mEnableEncryptionDirectRoomsByDefault, QStringLiteral("E2E_Enabled_Default_DirectRooms")); 0029 0030 mEnableEncryptionPrivateRoomsByDefault->setObjectName(QStringLiteral("mEnableEncryptionPrivateRoomsByDefault")); 0031 mMainLayout->addWidget(mEnableEncryptionPrivateRoomsByDefault); 0032 connectCheckBox(mEnableEncryptionPrivateRoomsByDefault, QStringLiteral("E2E_Enabled_Default_PrivateRooms")); 0033 0034 mEnableOtr->setObjectName(QStringLiteral("mEnableOtr")); 0035 mEnableOtr->setToolTip( 0036 i18n("Enable option to use off-the-record (OTR) messages in direct messages between 2 users. OTR messages are not recorded on the server and exchanged " 0037 "directly and encrypted between the 2 users.")); 0038 mMainLayout->addWidget(mEnableOtr); 0039 connectCheckBox(mEnableOtr, QStringLiteral("OTR_Enabled")); 0040 } 0041 0042 EncryptionSettingsWidget::~EncryptionSettingsWidget() = default; 0043 0044 void EncryptionSettingsWidget::initialize(const QMap<QString, QVariant> &mapSettings) 0045 { 0046 initializeWidget(mEnableE2E, mapSettings, false); 0047 initializeWidget(mEnableEncryptionDirectRoomsByDefault, mapSettings, false); 0048 initializeWidget(mEnableEncryptionPrivateRoomsByDefault, mapSettings, false); 0049 initializeWidget(mEnableOtr, mapSettings); 0050 } 0051 0052 #include "moc_encryptionsettingswidget.cpp"