From 03e94e6fdb31421e39e411ddcebd609095d51018 Mon Sep 17 00:00:00 2001 From: Julien Wadel Date: Mon, 24 Jul 2023 11:30:22 +0200 Subject: [PATCH] Add a Don't ask again choices mechanism. Use it for encryption info popup. --- linphone-app/assets/languages/cs.ts | 10 ++++++ linphone-app/assets/languages/da.ts | 10 ++++++ linphone-app/assets/languages/de.ts | 10 ++++++ linphone-app/assets/languages/en.ts | 10 ++++++ linphone-app/assets/languages/es.ts | 10 ++++++ linphone-app/assets/languages/fr_FR.ts | 10 ++++++ linphone-app/assets/languages/hu.ts | 10 ++++++ linphone-app/assets/languages/it.ts | 10 ++++++ linphone-app/assets/languages/ja.ts | 10 ++++++ linphone-app/assets/languages/lt.ts | 10 ++++++ linphone-app/assets/languages/pt_BR.ts | 10 ++++++ linphone-app/assets/languages/ru.ts | 10 ++++++ linphone-app/assets/languages/sv.ts | 10 ++++++ linphone-app/assets/languages/tr.ts | 10 ++++++ linphone-app/assets/languages/uk.ts | 10 ++++++ linphone-app/assets/languages/zh_CN.ts | 10 ++++++ .../src/components/settings/SettingsModel.cpp | 21 +++++++++++ .../src/components/settings/SettingsModel.hpp | 14 ++++++++ .../ui/views/App/Main/Conversation.qml | 18 ++++++---- .../views/App/Main/Dialogs/InfoEncryption.qml | 23 +++++++++--- .../ui/views/App/Settings/SettingsUi.qml | 36 ++++++++++++++----- 21 files changed, 254 insertions(+), 18 deletions(-) diff --git a/linphone-app/assets/languages/cs.ts b/linphone-app/assets/languages/cs.ts index 6f9e36370..cb0e3f845 100644 --- a/linphone-app/assets/languages/cs.ts +++ b/linphone-app/assets/languages/cs.ts @@ -1761,6 +1761,11 @@ Za tímto účelem zavolejte kontaktní osobě a postupujte podle postupu ověřování. Explanation process + + dontAskAgain + "Don't ask again" : Checkbox text to avoid showing the popup information on encryptions. + + InviteFriends @@ -3712,6 +3717,11 @@ Klikněte zde: <a href="%1">%1</a> 'Max results on search' : Label for setting the max results returned by the Magic Search bar. + + restoreAskingPopups + 'Restore asking popups' : Text button for restoring asking popups. + + SettingsVideo diff --git a/linphone-app/assets/languages/da.ts b/linphone-app/assets/languages/da.ts index b7f89a8de..e2a07bd4b 100644 --- a/linphone-app/assets/languages/da.ts +++ b/linphone-app/assets/languages/da.ts @@ -1752,6 +1752,11 @@ Server url ikke konfigureret. Explanation process + + dontAskAgain + "Don't ask again" : Checkbox text to avoid showing the popup information on encryptions. + + InviteFriends @@ -3676,6 +3681,11 @@ Klik her: <a href="%1">%1</a> 'Max results on search' : Label for setting the max results returned by the Magic Search bar. + + restoreAskingPopups + 'Restore asking popups' : Text button for restoring asking popups. + + SettingsVideo diff --git a/linphone-app/assets/languages/de.ts b/linphone-app/assets/languages/de.ts index 26407277d..29b61f3de 100644 --- a/linphone-app/assets/languages/de.ts +++ b/linphone-app/assets/languages/de.ts @@ -1752,6 +1752,11 @@ Server URL ist nicht konfiguriert. Um das durchzuführen, rufen Sie den Kontakt an und folgen Sie dem Authentifizierungsprozess. Explanation process + + dontAskAgain + "Don't ask again" : Checkbox text to avoid showing the popup information on encryptions. + + InviteFriends @@ -3676,6 +3681,11 @@ Klicken Sie hier: <a href="%1">%1</a> 'Max results on search' : Label for setting the max results returned by the Magic Search bar. + + restoreAskingPopups + 'Restore asking popups' : Text button for restoring asking popups. + + SettingsVideo diff --git a/linphone-app/assets/languages/en.ts b/linphone-app/assets/languages/en.ts index 4dfedb852..cd125ec62 100644 --- a/linphone-app/assets/languages/en.ts +++ b/linphone-app/assets/languages/en.ts @@ -1752,6 +1752,11 @@ Server URL not configured. To do so, call the contact and follow the authentification process. Explanation process + + dontAskAgain + "Don't ask again" : Checkbox text to avoid showing the popup information on encryptions. + Don't ask again + InviteFriends @@ -3701,6 +3706,11 @@ Click here: <a href="%1">%1</a> 'Max results on search' : Label for setting the max results returned by the Magic Search bar. Max results on search + + restoreAskingPopups + 'Restore asking popups' : Text button for restoring asking popups. + Restore asking popups + SettingsVideo diff --git a/linphone-app/assets/languages/es.ts b/linphone-app/assets/languages/es.ts index 8326e24ea..36182ccea 100644 --- a/linphone-app/assets/languages/es.ts +++ b/linphone-app/assets/languages/es.ts @@ -1752,6 +1752,11 @@ URL del servidor no configurada. Explanation process + + dontAskAgain + "Don't ask again" : Checkbox text to avoid showing the popup information on encryptions. + + InviteFriends @@ -3676,6 +3681,11 @@ Haga clic aquí: <a href="%1">%1 </a> 'Max results on search' : Label for setting the max results returned by the Magic Search bar. + + restoreAskingPopups + 'Restore asking popups' : Text button for restoring asking popups. + + SettingsVideo diff --git a/linphone-app/assets/languages/fr_FR.ts b/linphone-app/assets/languages/fr_FR.ts index 5989f751a..b803a0fea 100644 --- a/linphone-app/assets/languages/fr_FR.ts +++ b/linphone-app/assets/languages/fr_FR.ts @@ -1752,6 +1752,11 @@ URL du serveur non configurée. Pour se faire, il faut appeler chaque appareil enregistré et suivre le processus d'authentification. Explanation process + + dontAskAgain + "Don't ask again" : Checkbox text to avoid showing the popup information on encryptions. + + InviteFriends @@ -3676,6 +3681,11 @@ Cliquez ici : <a href="%1">%1</a> 'Max results on search' : Label for setting the max results returned by the Magic Search bar. + + restoreAskingPopups + 'Restore asking popups' : Text button for restoring asking popups. + + SettingsVideo diff --git a/linphone-app/assets/languages/hu.ts b/linphone-app/assets/languages/hu.ts index 18df92669..cc3b1fd78 100644 --- a/linphone-app/assets/languages/hu.ts +++ b/linphone-app/assets/languages/hu.ts @@ -1742,6 +1742,11 @@ A kiszolgáló URL-je nincs konfigurálva. Ehhez hívja fel a kapcsolatot és kövesse a hitelesítési folyamatot. Explanation process + + dontAskAgain + "Don't ask again" : Checkbox text to avoid showing the popup information on encryptions. + + InviteFriends @@ -3663,6 +3668,11 @@ Kattintson ide: <a href="%1">%1</a> 'Max results on search' : Label for setting the max results returned by the Magic Search bar. + + restoreAskingPopups + 'Restore asking popups' : Text button for restoring asking popups. + + SettingsVideo diff --git a/linphone-app/assets/languages/it.ts b/linphone-app/assets/languages/it.ts index bfbe03ed9..31c056d12 100644 --- a/linphone-app/assets/languages/it.ts +++ b/linphone-app/assets/languages/it.ts @@ -1752,6 +1752,11 @@ URL del server non configurato. Per farlo, chiama il contatto e segui il processo di autenticazione. Explanation process + + dontAskAgain + "Don't ask again" : Checkbox text to avoid showing the popup information on encryptions. + + InviteFriends @@ -3676,6 +3681,11 @@ Clicca: <a href="%1">%1</a> 'Max results on search' : Label for setting the max results returned by the Magic Search bar. + + restoreAskingPopups + 'Restore asking popups' : Text button for restoring asking popups. + + SettingsVideo diff --git a/linphone-app/assets/languages/ja.ts b/linphone-app/assets/languages/ja.ts index ec7f0ba37..9e6ba426d 100644 --- a/linphone-app/assets/languages/ja.ts +++ b/linphone-app/assets/languages/ja.ts @@ -1742,6 +1742,11 @@ 利用するためには、連絡先に電話をして、認証の手続きを行ってください。 Explanation process + + dontAskAgain + "Don't ask again" : Checkbox text to avoid showing the popup information on encryptions. + + InviteFriends @@ -3663,6 +3668,11 @@ 'Max results on search' : Label for setting the max results returned by the Magic Search bar. + + restoreAskingPopups + 'Restore asking popups' : Text button for restoring asking popups. + + SettingsVideo diff --git a/linphone-app/assets/languages/lt.ts b/linphone-app/assets/languages/lt.ts index 3976153f5..5d5184fb5 100644 --- a/linphone-app/assets/languages/lt.ts +++ b/linphone-app/assets/languages/lt.ts @@ -1762,6 +1762,11 @@ Nesukonfigūruotas serverio url. Explanation process + + dontAskAgain + "Don't ask again" : Checkbox text to avoid showing the popup information on encryptions. + + InviteFriends @@ -3689,6 +3694,11 @@ Spustelėkite čia: <a href="%1">%1</a> 'Max results on search' : Label for setting the max results returned by the Magic Search bar. + + restoreAskingPopups + 'Restore asking popups' : Text button for restoring asking popups. + + SettingsVideo diff --git a/linphone-app/assets/languages/pt_BR.ts b/linphone-app/assets/languages/pt_BR.ts index e496f2ff1..c789280b8 100644 --- a/linphone-app/assets/languages/pt_BR.ts +++ b/linphone-app/assets/languages/pt_BR.ts @@ -1752,6 +1752,11 @@ URL do servidor não configurado. Para isso, ligue para o contato e siga o processo de autenticação. Explanation process + + dontAskAgain + "Don't ask again" : Checkbox text to avoid showing the popup information on encryptions. + + InviteFriends @@ -3676,6 +3681,11 @@ Clique aqui: <a href="%1">%1 </a> 'Max results on search' : Label for setting the max results returned by the Magic Search bar. + + restoreAskingPopups + 'Restore asking popups' : Text button for restoring asking popups. + + SettingsVideo diff --git a/linphone-app/assets/languages/ru.ts b/linphone-app/assets/languages/ru.ts index c96638da2..4de374f52 100644 --- a/linphone-app/assets/languages/ru.ts +++ b/linphone-app/assets/languages/ru.ts @@ -1762,6 +1762,11 @@ Для этого позвоните контакту и следуйте процессу аутентификации. Explanation process + + dontAskAgain + "Don't ask again" : Checkbox text to avoid showing the popup information on encryptions. + + InviteFriends @@ -3689,6 +3694,11 @@ 'Max results on search' : Label for setting the max results returned by the Magic Search bar. + + restoreAskingPopups + 'Restore asking popups' : Text button for restoring asking popups. + + SettingsVideo diff --git a/linphone-app/assets/languages/sv.ts b/linphone-app/assets/languages/sv.ts index 6df4d9e4e..7afff6c73 100644 --- a/linphone-app/assets/languages/sv.ts +++ b/linphone-app/assets/languages/sv.ts @@ -1752,6 +1752,11 @@ Serverwebbadressen är inte konfigurerad. Explanation process + + dontAskAgain + "Don't ask again" : Checkbox text to avoid showing the popup information on encryptions. + + InviteFriends @@ -3676,6 +3681,11 @@ Klicka här: <a href="%1">%1</a> 'Max results on search' : Label for setting the max results returned by the Magic Search bar. + + restoreAskingPopups + 'Restore asking popups' : Text button for restoring asking popups. + + SettingsVideo diff --git a/linphone-app/assets/languages/tr.ts b/linphone-app/assets/languages/tr.ts index 8d384c22c..432d87649 100644 --- a/linphone-app/assets/languages/tr.ts +++ b/linphone-app/assets/languages/tr.ts @@ -1742,6 +1742,11 @@ Sunucu url'si yapılandırılmadı. Bunu yapmak için kişinizi arayın ve kimlik doğrulama sürecini izleyin. Explanation process + + dontAskAgain + "Don't ask again" : Checkbox text to avoid showing the popup information on encryptions. + + InviteFriends @@ -3663,6 +3668,11 @@ Buraya tıklayın: <a href="%1">%1</a> 'Max results on search' : Label for setting the max results returned by the Magic Search bar. + + restoreAskingPopups + 'Restore asking popups' : Text button for restoring asking popups. + + SettingsVideo diff --git a/linphone-app/assets/languages/uk.ts b/linphone-app/assets/languages/uk.ts index 478d21865..be6b43132 100644 --- a/linphone-app/assets/languages/uk.ts +++ b/linphone-app/assets/languages/uk.ts @@ -1762,6 +1762,11 @@ Explanation process + + dontAskAgain + "Don't ask again" : Checkbox text to avoid showing the popup information on encryptions. + + InviteFriends @@ -3689,6 +3694,11 @@ 'Max results on search' : Label for setting the max results returned by the Magic Search bar. + + restoreAskingPopups + 'Restore asking popups' : Text button for restoring asking popups. + + SettingsVideo diff --git a/linphone-app/assets/languages/zh_CN.ts b/linphone-app/assets/languages/zh_CN.ts index 7972b0e5e..1de29a6ac 100644 --- a/linphone-app/assets/languages/zh_CN.ts +++ b/linphone-app/assets/languages/zh_CN.ts @@ -1742,6 +1742,11 @@ 为此,请致电联系人并按照身份验证流程进行操作。 Explanation process + + dontAskAgain + "Don't ask again" : Checkbox text to avoid showing the popup information on encryptions. + + InviteFriends @@ -3663,6 +3668,11 @@ 'Max results on search' : Label for setting the max results returned by the Magic Search bar. + + restoreAskingPopups + 'Restore asking popups' : Text button for restoring asking popups. + + SettingsVideo diff --git a/linphone-app/src/components/settings/SettingsModel.cpp b/linphone-app/src/components/settings/SettingsModel.cpp index 462d779e6..8968aa9e5 100644 --- a/linphone-app/src/components/settings/SettingsModel.cpp +++ b/linphone-app/src/components/settings/SettingsModel.cpp @@ -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. // ============================================================================= diff --git a/linphone-app/src/components/settings/SettingsModel.hpp b/linphone-app/src/components/settings/SettingsModel.hpp index b1b581172..b5b6374eb 100644 --- a/linphone-app/src/components/settings/SettingsModel.hpp +++ b/linphone-app/src/components/settings/SettingsModel.hpp @@ -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); diff --git a/linphone-app/ui/views/App/Main/Conversation.qml b/linphone-app/ui/views/App/Main/Conversation.qml index 1618a8736..6cb3a8e05 100644 --- a/linphone-app/ui/views/App/Main/Conversation.qml +++ b/linphone-app/ui/views/App/Main/Conversation.qml @@ -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() } } } diff --git a/linphone-app/ui/views/App/Main/Dialogs/InfoEncryption.qml b/linphone-app/ui/views/App/Main/Dialogs/InfoEncryption.qml index 68581b57a..66fb34ff6 100644 --- a/linphone-app/ui/views/App/Main/Dialogs/InfoEncryption.qml +++ b/linphone-app/ui/views/App/Main/Dialogs/InfoEncryption.qml @@ -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') + } } } \ No newline at end of file diff --git a/linphone-app/ui/views/App/Settings/SettingsUi.qml b/linphone-app/ui/views/App/Settings/SettingsUi.qml index 1f78d09a9..2334fd1c0 100644 --- a/linphone-app/ui/views/App/Settings/SettingsUi.qml +++ b/linphone-app/ui/views/App/Settings/SettingsUi.qml @@ -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() + } + } } } }