diff --git a/Linphone/core/App.cpp b/Linphone/core/App.cpp index 52fa46b41..a9d37dbe3 100644 --- a/Linphone/core/App.cpp +++ b/Linphone/core/App.cpp @@ -713,6 +713,8 @@ void App::initCore() { mAccountList->setInitialized(false); mAccountList->lUpdate(true); } + connect(mAccountList.get(), &AccountList::defaultAccountChanged, this, + &App::currentAccountChanged); // Update global unread Notifications when an account updates his unread Notifications connect(mAccountList.get(), &AccountList::unreadNotificationsChanged, this, [this]() { lDebug() << "unreadNotificationsChanged of AccountList"; @@ -1726,6 +1728,10 @@ void App::setCurrentChat(ChatGui *chat) { } } +AccountGui *App::getCurrentAccount() const { + return mAccountList ? mAccountList->getDefaultAccount() : nullptr; +} + float App::getScreenRatio() const { return mScreenRatio; } diff --git a/Linphone/core/App.hpp b/Linphone/core/App.hpp index 83b1dea88..1047a1405 100644 --- a/Linphone/core/App.hpp +++ b/Linphone/core/App.hpp @@ -47,6 +47,7 @@ class App : public SingleApplication, public AbstractObject { Q_OBJECT Q_PROPERTY(bool coreStarted READ getCoreStarted WRITE setCoreStarted NOTIFY coreStartedChanged) Q_PROPERTY(AccountList *accounts READ getAccounts NOTIFY accountsChanged) + Q_PROPERTY(AccountGui *currentAccount READ getCurrentAccount NOTIFY currentAccountChanged) Q_PROPERTY(CallList *calls READ getCalls NOTIFY callsChanged) Q_PROPERTY(ChatList *chats READ getChats NOTIFY chatsChanged) Q_PROPERTY(QString shortApplicationVersion READ getShortApplicationVersion CONSTANT) @@ -175,6 +176,10 @@ public: QSharedPointer getChatList() const; ChatList *getChats() const; void setChatList(QSharedPointer data); + ChatGui *getCurrentChat() const; + void setCurrentChat(ChatGui *chat); + + AccountGui *getCurrentAccount() const; QSharedPointer getCallList() const; void setCallList(QSharedPointer data); @@ -192,8 +197,6 @@ public: QString getQtVersion() const; Q_INVOKABLE void checkForUpdate(bool requestedByUser = false); - ChatGui *getCurrentChat() const; - void setCurrentChat(ChatGui *chat); float getScreenRatio() const; Q_INVOKABLE void setScreenRatio(float ratio); @@ -227,6 +230,7 @@ signals: void localeChanged(); void lForceOidcTimeout(); void remainingTimeBeforeOidcTimeoutChanged(); + void currentAccountChanged(); // void executeCommand(QString command); private: diff --git a/Linphone/view/Control/Display/Chat/ChatListView.qml b/Linphone/view/Control/Display/Chat/ChatListView.qml index 60b7bd217..72372008e 100644 --- a/Linphone/view/Control/Display/Chat/ChatListView.qml +++ b/Linphone/view/Control/Display/Chat/ChatListView.qml @@ -297,7 +297,7 @@ ListView { imageSource: AppIcons.clockCountDown } EffectImage { - visible: modelData != undefined && modelData?.core.isBasic + visible: modelData != undefined && !modelData.core.isEncrypted && AppCpp.currentAccount && AppCpp.currentAccount.core.limeServerUrl !== "" && AppCpp.currentAccount.core.conferenceFactoryAddress !== "" Layout.preferredWidth: visible ? Utils.getSizeWithScreenRatio(14) : 0 Layout.preferredHeight: Utils.getSizeWithScreenRatio(14) colorizationColor: DefaultStyle.warning_700 diff --git a/Linphone/view/Control/Display/Chat/ChatMessagesListView.qml b/Linphone/view/Control/Display/Chat/ChatMessagesListView.qml index 1adceb0ef..a3bcc05df 100644 --- a/Linphone/view/Control/Display/Chat/ChatMessagesListView.qml +++ b/Linphone/view/Control/Display/Chat/ChatMessagesListView.qml @@ -18,6 +18,7 @@ ListView { property real busyIndicatorSize: Utils.getSizeWithScreenRatio(60) property bool loading: false property bool isEncrypted: chat && chat.core.isEncrypted + property bool showEncryptedInfo: AppCpp.currentAccount !== null && AppCpp.currentAccount.core.limeServerUrl !== "" && AppCpp.currentAccount.core.conferenceFactoryAddress !== "" highlightFollowsCurrentItem: true verticalLayoutDirection: ListView.BottomToTop @@ -135,6 +136,7 @@ ListView { anchors.horizontalCenter: parent.horizontalCenter Control.Control { id: headerMessage + visible: mainItem.showEncryptedInfo property int topMargin: Utils.getSizeWithScreenRatio(mainItem.contentHeight > mainItem.height ? 30 : 50) property int bottomMargin: Utils.getSizeWithScreenRatio(30) anchors.topMargin: topMargin diff --git a/Linphone/view/Page/Form/Chat/SelectedChatView.qml b/Linphone/view/Page/Form/Chat/SelectedChatView.qml index 34c3a265f..8976bf5da 100644 --- a/Linphone/view/Page/Form/Chat/SelectedChatView.qml +++ b/Linphone/view/Page/Form/Chat/SelectedChatView.qml @@ -23,6 +23,8 @@ FocusScope { property bool replyingToMessage: false property bool editingMessage: false property string lastChar + property AccountGui currentAccount: AppCpp.currentAccount + property bool showEncryptedInfo: currentAccount && currentAccount.core.limeServerUrl !== "" && currentAccount.core.conferenceFactoryAddress !== "" enum PanelType { MessageReactions, SharedFiles, Medias, ImdnStatus, ForwardToList, ManageParticipants, EphemeralSettings, None} signal oneOneCall(bool video) @@ -128,7 +130,7 @@ FocusScope { } } RowLayout { - visible: mainItem.chat != undefined && mainItem.chat.core.isBasic + visible: mainItem.showEncryptedInfo && mainItem.chat != undefined && !mainItem.chat.core.isEncrypted spacing: Utils.getSizeWithScreenRatio(8) EffectImage { Layout.preferredWidth: visible ? Utils.getSizeWithScreenRatio(14) : 0 @@ -136,17 +138,18 @@ FocusScope { colorizationColor: DefaultStyle.warning_700 imageSource: AppIcons.lockSimpleOpen } - Text { - // hiding text if in call cause te view - // has smaller width - visible: !mainItem.call - Layout.fillWidth: true - color: DefaultStyle.warning_700 - //: This conversation is not encrypted ! - text: qsTr("unencrypted_conversation_warning") - font: Typography.p2 - } + // Text { + // // hiding text if in call cause te view + // // has smaller width + // visible: !mainItem.call + // Layout.fillWidth: true + // color: DefaultStyle.warning_700 + // //: This conversation is not encrypted ! + // text: qsTr("unencrypted_conversation_warning") + // font: Typography.p2 + // } } + EffectImage { visible: mainItem.chat?.core.muted || false Layout.preferredWidth: Utils.getSizeWithScreenRatio(20)