Add a Don't ask again choices mechanism.

Use it for encryption info popup.
This commit is contained in:
Julien Wadel 2023-07-24 11:30:22 +02:00
parent 0cad46cdc7
commit 03e94e6fdb
21 changed files with 254 additions and 18 deletions

View file

@ -1761,6 +1761,11 @@
<translation>Za tímto účelem zavolejte kontaktní osobě a postupujte podle postupu ověřování.</translation>
<extra-Context>Explanation process</extra-Context>
</message>
<message>
<source>dontAskAgain</source>
<extracomment>&quot;Don&apos;t ask again&quot; : Checkbox text to avoid showing the popup information on encryptions.</extracomment>
<translation type="unfinished"></translation>
</message>
</context>
<context>
<name>InviteFriends</name>
@ -3712,6 +3717,11 @@ Klikněte zde: &lt;a href=&quot;%1&quot;&gt;%1&lt;/a&gt;
<extracomment>&apos;Max results on search&apos; : Label for setting the max results returned by the Magic Search bar.</extracomment>
<translation type="unfinished"></translation>
</message>
<message>
<source>restoreAskingPopups</source>
<extracomment>&apos;Restore asking popups&apos; : Text button for restoring asking popups.</extracomment>
<translation type="unfinished"></translation>
</message>
</context>
<context>
<name>SettingsVideo</name>

View file

@ -1752,6 +1752,11 @@ Server url ikke konfigureret.</translation>
<translation type="unfinished"></translation>
<extra-Context>Explanation process</extra-Context>
</message>
<message>
<source>dontAskAgain</source>
<extracomment>&quot;Don&apos;t ask again&quot; : Checkbox text to avoid showing the popup information on encryptions.</extracomment>
<translation type="unfinished"></translation>
</message>
</context>
<context>
<name>InviteFriends</name>
@ -3676,6 +3681,11 @@ Klik her: &lt;a href=&quot;%1&quot;&gt;%1&lt;/a&gt;
<extracomment>&apos;Max results on search&apos; : Label for setting the max results returned by the Magic Search bar.</extracomment>
<translation type="unfinished"></translation>
</message>
<message>
<source>restoreAskingPopups</source>
<extracomment>&apos;Restore asking popups&apos; : Text button for restoring asking popups.</extracomment>
<translation type="unfinished"></translation>
</message>
</context>
<context>
<name>SettingsVideo</name>

View file

@ -1752,6 +1752,11 @@ Server URL ist nicht konfiguriert.</translation>
<translation>Um das durchzuführen, rufen Sie den Kontakt an und folgen Sie dem Authentifizierungsprozess.</translation>
<extra-Context>Explanation process</extra-Context>
</message>
<message>
<source>dontAskAgain</source>
<extracomment>&quot;Don&apos;t ask again&quot; : Checkbox text to avoid showing the popup information on encryptions.</extracomment>
<translation type="unfinished"></translation>
</message>
</context>
<context>
<name>InviteFriends</name>
@ -3676,6 +3681,11 @@ Klicken Sie hier: &lt;a href=&quot;%1&quot;&gt;%1&lt;/a&gt;
<extracomment>&apos;Max results on search&apos; : Label for setting the max results returned by the Magic Search bar.</extracomment>
<translation type="unfinished"></translation>
</message>
<message>
<source>restoreAskingPopups</source>
<extracomment>&apos;Restore asking popups&apos; : Text button for restoring asking popups.</extracomment>
<translation type="unfinished"></translation>
</message>
</context>
<context>
<name>SettingsVideo</name>

View file

@ -1752,6 +1752,11 @@ Server URL not configured.</translation>
<translation>To do so, call the contact and follow the authentification process.</translation>
<extra-Context>Explanation process</extra-Context>
</message>
<message>
<source>dontAskAgain</source>
<extracomment>&quot;Don&apos;t ask again&quot; : Checkbox text to avoid showing the popup information on encryptions.</extracomment>
<translation>Don&apos;t ask again</translation>
</message>
</context>
<context>
<name>InviteFriends</name>
@ -3701,6 +3706,11 @@ Click here: &lt;a href=&quot;%1&quot;&gt;%1&lt;/a&gt;
<extracomment>&apos;Max results on search&apos; : Label for setting the max results returned by the Magic Search bar.</extracomment>
<translation>Max results on search</translation>
</message>
<message>
<source>restoreAskingPopups</source>
<extracomment>&apos;Restore asking popups&apos; : Text button for restoring asking popups.</extracomment>
<translation>Restore asking popups</translation>
</message>
</context>
<context>
<name>SettingsVideo</name>

View file

@ -1752,6 +1752,11 @@ URL del servidor no configurada.</translation>
<translation type="unfinished"></translation>
<extra-Context>Explanation process</extra-Context>
</message>
<message>
<source>dontAskAgain</source>
<extracomment>&quot;Don&apos;t ask again&quot; : Checkbox text to avoid showing the popup information on encryptions.</extracomment>
<translation type="unfinished"></translation>
</message>
</context>
<context>
<name>InviteFriends</name>
@ -3676,6 +3681,11 @@ Haga clic aquí: &lt;a href=&quot;%1&quot;&gt;%1 &lt;/a&gt;
<extracomment>&apos;Max results on search&apos; : Label for setting the max results returned by the Magic Search bar.</extracomment>
<translation type="unfinished"></translation>
</message>
<message>
<source>restoreAskingPopups</source>
<extracomment>&apos;Restore asking popups&apos; : Text button for restoring asking popups.</extracomment>
<translation type="unfinished"></translation>
</message>
</context>
<context>
<name>SettingsVideo</name>

View file

@ -1752,6 +1752,11 @@ URL du serveur non configurée.</translation>
<translation>Pour se faire, il faut appeler chaque appareil enregistré et suivre le processus d&apos;authentification.</translation>
<extra-Context>Explanation process</extra-Context>
</message>
<message>
<source>dontAskAgain</source>
<extracomment>&quot;Don&apos;t ask again&quot; : Checkbox text to avoid showing the popup information on encryptions.</extracomment>
<translation type="unfinished"></translation>
</message>
</context>
<context>
<name>InviteFriends</name>
@ -3676,6 +3681,11 @@ Cliquez ici : &lt;a href=&quot;%1&quot;&gt;%1&lt;/a&gt;
<extracomment>&apos;Max results on search&apos; : Label for setting the max results returned by the Magic Search bar.</extracomment>
<translation type="unfinished"></translation>
</message>
<message>
<source>restoreAskingPopups</source>
<extracomment>&apos;Restore asking popups&apos; : Text button for restoring asking popups.</extracomment>
<translation type="unfinished"></translation>
</message>
</context>
<context>
<name>SettingsVideo</name>

View file

@ -1742,6 +1742,11 @@ A kiszolgáló URL-je nincs konfigurálva.</translation>
<translation>Ehhez hívja fel a kapcsolatot és kövesse a hitelesítési folyamatot.</translation>
<extra-Context>Explanation process</extra-Context>
</message>
<message>
<source>dontAskAgain</source>
<extracomment>&quot;Don&apos;t ask again&quot; : Checkbox text to avoid showing the popup information on encryptions.</extracomment>
<translation type="unfinished"></translation>
</message>
</context>
<context>
<name>InviteFriends</name>
@ -3663,6 +3668,11 @@ Kattintson ide: &lt;a href=&quot;%1&quot;&gt;%1&lt;/a&gt;
<extracomment>&apos;Max results on search&apos; : Label for setting the max results returned by the Magic Search bar.</extracomment>
<translation type="unfinished"></translation>
</message>
<message>
<source>restoreAskingPopups</source>
<extracomment>&apos;Restore asking popups&apos; : Text button for restoring asking popups.</extracomment>
<translation type="unfinished"></translation>
</message>
</context>
<context>
<name>SettingsVideo</name>

View file

@ -1752,6 +1752,11 @@ URL del server non configurato.</translation>
<translation>Per farlo, chiama il contatto e segui il processo di autenticazione.</translation>
<extra-Context>Explanation process</extra-Context>
</message>
<message>
<source>dontAskAgain</source>
<extracomment>&quot;Don&apos;t ask again&quot; : Checkbox text to avoid showing the popup information on encryptions.</extracomment>
<translation type="unfinished"></translation>
</message>
</context>
<context>
<name>InviteFriends</name>
@ -3676,6 +3681,11 @@ Clicca: &lt;a href=&quot;%1&quot;&gt;%1&lt;/a&gt;
<extracomment>&apos;Max results on search&apos; : Label for setting the max results returned by the Magic Search bar.</extracomment>
<translation type="unfinished"></translation>
</message>
<message>
<source>restoreAskingPopups</source>
<extracomment>&apos;Restore asking popups&apos; : Text button for restoring asking popups.</extracomment>
<translation type="unfinished"></translation>
</message>
</context>
<context>
<name>SettingsVideo</name>

View file

@ -1742,6 +1742,11 @@
<translation></translation>
<extra-Context>Explanation process</extra-Context>
</message>
<message>
<source>dontAskAgain</source>
<extracomment>&quot;Don&apos;t ask again&quot; : Checkbox text to avoid showing the popup information on encryptions.</extracomment>
<translation type="unfinished"></translation>
</message>
</context>
<context>
<name>InviteFriends</name>
@ -3663,6 +3668,11 @@
<extracomment>&apos;Max results on search&apos; : Label for setting the max results returned by the Magic Search bar.</extracomment>
<translation type="unfinished"></translation>
</message>
<message>
<source>restoreAskingPopups</source>
<extracomment>&apos;Restore asking popups&apos; : Text button for restoring asking popups.</extracomment>
<translation type="unfinished"></translation>
</message>
</context>
<context>
<name>SettingsVideo</name>

View file

@ -1762,6 +1762,11 @@ Nesukonfigūruotas serverio url.</translation>
<translation type="unfinished"></translation>
<extra-Context>Explanation process</extra-Context>
</message>
<message>
<source>dontAskAgain</source>
<extracomment>&quot;Don&apos;t ask again&quot; : Checkbox text to avoid showing the popup information on encryptions.</extracomment>
<translation type="unfinished"></translation>
</message>
</context>
<context>
<name>InviteFriends</name>
@ -3689,6 +3694,11 @@ Spustelėkite čia: &lt;a href=&quot;%1&quot;&gt;%1&lt;/a&gt;
<extracomment>&apos;Max results on search&apos; : Label for setting the max results returned by the Magic Search bar.</extracomment>
<translation type="unfinished"></translation>
</message>
<message>
<source>restoreAskingPopups</source>
<extracomment>&apos;Restore asking popups&apos; : Text button for restoring asking popups.</extracomment>
<translation type="unfinished"></translation>
</message>
</context>
<context>
<name>SettingsVideo</name>

View file

@ -1752,6 +1752,11 @@ URL do servidor não configurado.</translation>
<translation>Para isso, ligue para o contato e siga o processo de autenticação.</translation>
<extra-Context>Explanation process</extra-Context>
</message>
<message>
<source>dontAskAgain</source>
<extracomment>&quot;Don&apos;t ask again&quot; : Checkbox text to avoid showing the popup information on encryptions.</extracomment>
<translation type="unfinished"></translation>
</message>
</context>
<context>
<name>InviteFriends</name>
@ -3676,6 +3681,11 @@ Clique aqui: &lt;a href=&quot;%1&quot;&gt;%1 &lt;/a&gt;
<extracomment>&apos;Max results on search&apos; : Label for setting the max results returned by the Magic Search bar.</extracomment>
<translation type="unfinished"></translation>
</message>
<message>
<source>restoreAskingPopups</source>
<extracomment>&apos;Restore asking popups&apos; : Text button for restoring asking popups.</extracomment>
<translation type="unfinished"></translation>
</message>
</context>
<context>
<name>SettingsVideo</name>

View file

@ -1762,6 +1762,11 @@
<translation>Для этого позвоните контакту и следуйте процессу аутентификации.</translation>
<extra-Context>Explanation process</extra-Context>
</message>
<message>
<source>dontAskAgain</source>
<extracomment>&quot;Don&apos;t ask again&quot; : Checkbox text to avoid showing the popup information on encryptions.</extracomment>
<translation type="unfinished"></translation>
</message>
</context>
<context>
<name>InviteFriends</name>
@ -3689,6 +3694,11 @@
<extracomment>&apos;Max results on search&apos; : Label for setting the max results returned by the Magic Search bar.</extracomment>
<translation type="unfinished"></translation>
</message>
<message>
<source>restoreAskingPopups</source>
<extracomment>&apos;Restore asking popups&apos; : Text button for restoring asking popups.</extracomment>
<translation type="unfinished"></translation>
</message>
</context>
<context>
<name>SettingsVideo</name>

View file

@ -1752,6 +1752,11 @@ Serverwebbadressen är inte konfigurerad.</translation>
<translation type="unfinished"></translation>
<extra-Context>Explanation process</extra-Context>
</message>
<message>
<source>dontAskAgain</source>
<extracomment>&quot;Don&apos;t ask again&quot; : Checkbox text to avoid showing the popup information on encryptions.</extracomment>
<translation type="unfinished"></translation>
</message>
</context>
<context>
<name>InviteFriends</name>
@ -3676,6 +3681,11 @@ Klicka här: &lt;a href=&quot;%1&quot;&gt;%1&lt;/a&gt;
<extracomment>&apos;Max results on search&apos; : Label for setting the max results returned by the Magic Search bar.</extracomment>
<translation type="unfinished"></translation>
</message>
<message>
<source>restoreAskingPopups</source>
<extracomment>&apos;Restore asking popups&apos; : Text button for restoring asking popups.</extracomment>
<translation type="unfinished"></translation>
</message>
</context>
<context>
<name>SettingsVideo</name>

View file

@ -1742,6 +1742,11 @@ Sunucu url&apos;si yapılandırılmadı.</translation>
<translation>Bunu yapmak için kişinizi arayın ve kimlik doğrulama sürecini izleyin.</translation>
<extra-Context>Explanation process</extra-Context>
</message>
<message>
<source>dontAskAgain</source>
<extracomment>&quot;Don&apos;t ask again&quot; : Checkbox text to avoid showing the popup information on encryptions.</extracomment>
<translation type="unfinished"></translation>
</message>
</context>
<context>
<name>InviteFriends</name>
@ -3663,6 +3668,11 @@ Buraya tıklayın: &lt;a href=&quot;%1&quot;&gt;%1&lt;/a&gt;
<extracomment>&apos;Max results on search&apos; : Label for setting the max results returned by the Magic Search bar.</extracomment>
<translation type="unfinished"></translation>
</message>
<message>
<source>restoreAskingPopups</source>
<extracomment>&apos;Restore asking popups&apos; : Text button for restoring asking popups.</extracomment>
<translation type="unfinished"></translation>
</message>
</context>
<context>
<name>SettingsVideo</name>

View file

@ -1762,6 +1762,11 @@
<translation type="unfinished"></translation>
<extra-Context>Explanation process</extra-Context>
</message>
<message>
<source>dontAskAgain</source>
<extracomment>&quot;Don&apos;t ask again&quot; : Checkbox text to avoid showing the popup information on encryptions.</extracomment>
<translation type="unfinished"></translation>
</message>
</context>
<context>
<name>InviteFriends</name>
@ -3689,6 +3694,11 @@
<extracomment>&apos;Max results on search&apos; : Label for setting the max results returned by the Magic Search bar.</extracomment>
<translation type="unfinished"></translation>
</message>
<message>
<source>restoreAskingPopups</source>
<extracomment>&apos;Restore asking popups&apos; : Text button for restoring asking popups.</extracomment>
<translation type="unfinished"></translation>
</message>
</context>
<context>
<name>SettingsVideo</name>

View file

@ -1742,6 +1742,11 @@
<translation></translation>
<extra-Context>Explanation process</extra-Context>
</message>
<message>
<source>dontAskAgain</source>
<extracomment>&quot;Don&apos;t ask again&quot; : Checkbox text to avoid showing the popup information on encryptions.</extracomment>
<translation type="unfinished"></translation>
</message>
</context>
<context>
<name>InviteFriends</name>
@ -3663,6 +3668,11 @@
<extracomment>&apos;Max results on search&apos; : Label for setting the max results returned by the Magic Search bar.</extracomment>
<translation type="unfinished"></translation>
</message>
<message>
<source>restoreAskingPopups</source>
<extracomment>&apos;Restore asking popups&apos; : Text button for restoring asking popups.</extracomment>
<translation type="unfinished"></translation>
</message>
</context>
<context>
<name>SettingsVideo</name>

View file

@ -53,6 +53,8 @@ const string SettingsModel::ContactsSection("contacts_import");
SettingsModel::SettingsModel (QObject *parent) : QObject(parent) {
CoreManager *coreManager = CoreManager::getInstance();
mConfig = coreManager->getCore()->getConfig();
connect(this, &SettingsModel::dontAskAgainInfoEncryptionChanged, this, &SettingsModel::haveDontAskAgainChoicesChanged);
QObject::connect(coreManager->getHandlers().get(), &CoreHandlers::callCreated,
this, &SettingsModel::handleCallCreated);
@ -1079,6 +1081,21 @@ bool SettingsModel::getPostQuantumAvailable() const{
return CoreManager::getInstance()->getCore() && CoreManager::getInstance()->getCore()->getPostQuantumAvailable();
}
bool SettingsModel::getDontAskAgainInfoEncryption() const{
return mConfig->getBool(UiSection, "dont_ask_again_info_encryption", false);
}
void SettingsModel::setDontAskAgainInfoEncryption(bool show){
if(show != getDontAskAgainInfoEncryption()) {
mConfig->setBool(UiSection, "dont_ask_again_info_encryption", show);
emit dontAskAgainInfoEncryptionChanged();
}
}
bool SettingsModel::getHaveDontAskAgainChoices() const {
return getDontAskAgainInfoEncryption();
}
// -----------------------------------------------------------------------------
bool SettingsModel::getLimeState () const {
@ -1714,6 +1731,10 @@ void SettingsModel::setMagicSearchMaxResults(int maxResults) {
}
}
void SettingsModel::resetDontAskAgainChoices(){
setDontAskAgainInfoEncryption(false);
}
// =============================================================================
// Advanced.
// =============================================================================

View file

@ -225,6 +225,10 @@ class SettingsModel : public QObject {
Q_PROPERTY(Utils::SipDisplayMode sipDisplayMode READ getSipDisplayMode WRITE setSipDisplayMode NOTIFY sipDisplayModeChanged)
Q_PROPERTY(int magicSearchMaxResults READ getMagicSearchMaxResults WRITE setMagicSearchMaxResults NOTIFY magicSearchMaxResultsChanged)
Q_PROPERTY(bool dontAskAgainInfoEncryption READ getDontAskAgainInfoEncryption WRITE setDontAskAgainInfoEncryption NOTIFY dontAskAgainInfoEncryptionChanged)
Q_PROPERTY(bool haveDontAskAgainChoices READ getHaveDontAskAgainChoices NOTIFY haveDontAskAgainChoicesChanged)
// Advanced. -----------------------------------------------------------------
Q_PROPERTY(QString logsFolder READ getLogsFolder WRITE setLogsFolder NOTIFY logsFolderChanged)
@ -483,6 +487,9 @@ public:
bool getPostQuantumAvailable() const;
bool getDontAskAgainInfoEncryption() const;
void setDontAskAgainInfoEncryption(bool show);
bool getLimeState () const;
void setLimeState (const bool& state);
@ -622,6 +629,10 @@ public:
int getMagicSearchMaxResults() const;
void setMagicSearchMaxResults(int maxResults);
// Show all "don't ask again" checkboxes and popups.
bool getHaveDontAskAgainChoices() const;
Q_INVOKABLE void resetDontAskAgainChoices();
// Advanced. ---------------------------------------------------------------------------
@ -849,6 +860,9 @@ signals:
void magicSearchMaxResultsChanged();
void dontAskAgainInfoEncryptionChanged();
void haveDontAskAgainChoicesChanged();
// Advanced. -----------------------------------------------------------------
void logsFolderChanged (const QString &folder);

View file

@ -205,18 +205,24 @@ ColumnLayout {
MouseArea{
anchors.fill:parent
visible: conversation.chatRoomModel && !conversation.chatRoomModel.isReadOnly && (SettingsModel.standardChatEnabled || SettingsModel.secureChatEnabled)
onClicked : {
function showParticipantsDevice(){
window.detachVirtualWindow()
window.attachVirtualWindow(Qt.resolvedUrl('Dialogs/InfoEncryption.qml')
window.attachVirtualWindow(Qt.resolvedUrl('Dialogs/ParticipantsDevices.qml')
,{chatRoomModel:chatRoomModel
, window:window})
}
onClicked : {
if(!SettingsModel.dontAskAgainInfoEncryption){
window.detachVirtualWindow()
window.attachVirtualWindow(Qt.resolvedUrl('Dialogs/InfoEncryption.qml')
,{securityLevel:securityLevel}
, function (status) {
if(status){
window.detachVirtualWindow()
window.attachVirtualWindow(Qt.resolvedUrl('Dialogs/ParticipantsDevices.qml')
,{chatRoomModel:chatRoomModel
, window:window})
showParticipantsDevice()
}
})
} else
showParticipantsDevice()
}
}
}

View file

@ -31,10 +31,7 @@ DialogPlus {
)
textButtonStyle: InfoEncryptionStyle.okButton
onClicked: {
if(addressToCall != ''){
CallsListModel.launchSecureAudioCall(addressToCall, LinphoneEnums.MediaEncryptionZrtp)
}
exit(1)
dialog.ok()
}
}
]
@ -50,6 +47,13 @@ DialogPlus {
height: InfoEncryptionStyle.height
width: InfoEncryptionStyle.width
function ok(){
if(addressToCall != ''){
CallsListModel.launchSecureAudioCall(addressToCall, LinphoneEnums.MediaEncryptionZrtp)
}
exit(1)
}
// ---------------------------------------------------------------------------
ColumnLayout {
anchors.fill: parent
@ -99,5 +103,16 @@ DialogPlus {
//~ Context Explanation process
text: qsTr('encryptionProcessExplanation')
}
CheckBoxText{
id: dontAskAgainCheckBox
Layout.bottomMargin: 10
Layout.alignment: Qt.AlignVCenter | Qt.AlignRight
visible: dialog.addressToCall == ''
checked: SettingsModel.dontAskAgainInfoEncryption
onCheckedChanged: SettingsModel.dontAskAgainInfoEncryption = checked
//: "Don't ask again" : Checkbox text to avoid showing the popup information on encryptions.
text: qsTr('dontAskAgain')
}
}
}

View file

@ -217,15 +217,20 @@ TabContainer {
visible: SettingsModel.contactsEnabled || SettingsModel.developerSettingsEnabled
width: parent.width
}
TextButtonB {
anchors.right: parent.right
text: qsTr('cleanAvatars')
visible: SettingsModel.contactsEnabled || SettingsModel.developerSettingsEnabled
onClicked: Logic.cleanAvatars()
RowLayout{
width: parent.width
Item{
Layout.fillHeight: true
Layout.fillWidth: true
}
TextButtonB {
id: cleanAvatarsButton
text: qsTr('cleanAvatars')
visible: SettingsModel.contactsEnabled || SettingsModel.developerSettingsEnabled
onClicked: Logic.cleanAvatars()
}
}
// -------------------------------------------------------------------------
// Other.
// -------------------------------------------------------------------------
@ -355,6 +360,21 @@ TabContainer {
}
}
}
RowLayout{
width: parent.width
Item{
Layout.fillHeight: true
Layout.fillWidth: true
}
TextButtonB {
visible: SettingsModel.haveDontAskAgainChoices
//: 'Restore asking popups' : Text button for restoring asking popups.
text: qsTr('restoreAskingPopups')
onClicked: SettingsModel.resetDontAskAgainChoices()
}
}
}
}
}