Add an option to disable encryption in new chats

Right now NeoChat (or more technically, libQuotient) decides to use
encryption by default in new chats. Some users may not prefer or need
this, so a new option is added under Security to change this behavior.

BUG: 498375
This commit is contained in:
Joshua Goins
2025-01-08 16:38:39 -05:00
parent 6fde07a20d
commit c315e817b2
3 changed files with 23 additions and 0 deletions

View File

@@ -223,6 +223,10 @@
<label>Reject unknown invites</label>
<default>false</default>
</entry>
<entry name="PreferUsingEncryption" type="bool">
<label>Prefer encrypting chats</label>
<default>true</default>
</entry>
</group>
</kcfg>

View File

@@ -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

View File

@@ -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")