diff --git a/src/neochatconfig.kcfg b/src/neochatconfig.kcfg index b0f45eb45..e706d0f7e 100644 --- a/src/neochatconfig.kcfg +++ b/src/neochatconfig.kcfg @@ -223,6 +223,10 @@ false + + + true + diff --git a/src/neochatconnection.cpp b/src/neochatconnection.cpp index 0d5977c56..21a9a6650 100644 --- a/src/neochatconnection.cpp +++ b/src/neochatconnection.cpp @@ -145,6 +145,10 @@ void NeoChatConnection::connectSignals() }); }, Qt::SingleShotConnection); + setDirectChatEncryptionDefault(NeoChatConfig::preferUsingEncryption()); + connect(NeoChatConfig::self(), &NeoChatConfig::PreferUsingEncryptionChanged, this, [] { + setDirectChatEncryptionDefault(NeoChatConfig::preferUsingEncryption()); + }); } int NeoChatConnection::badgeNotificationCount() const diff --git a/src/settings/NeoChatSecurityPage.qml b/src/settings/NeoChatSecurityPage.qml index ae21a4fd8..1861193ac 100644 --- a/src/settings/NeoChatSecurityPage.qml +++ b/src/settings/NeoChatSecurityPage.qml @@ -65,6 +65,21 @@ FormCard.FormCardPage { NeoChatConfig.save(); } } + FormCard.FormDelegateSeparator { + above: rejectInvitationsDelegate + below: preferEncryptionDelegate + } + FormCard.FormCheckDelegate { + id: preferEncryptionDelegate + text: i18nc("@option:check", "Turn on encryption in new chats") + description: i18nc("@info", "If enabled, NeoChat will use encryption when starting new direct messages.") + checked: NeoChatConfig.preferUsingEncryption + enabled: !NeoChatConfig.preferUsingEncryptionImmutable + onToggled: { + NeoChatConfig.preferUsingEncryption = checked; + NeoChatConfig.save(); + } + } } FormCard.FormHeader { title: i18nc("@title:group", "Encryption")