From 96772fabacda32621ee60064aa8a4f4a22265ac5 Mon Sep 17 00:00:00 2001 From: Gaelle Braud Date: Wed, 22 Jan 2025 16:09:46 +0100 Subject: [PATCH] fix #LINQT-1553 auth dialog on start even if account is registered --- Linphone/core/App.cpp | 10 ++++++ Linphone/model/tool/ToolModel.cpp | 2 +- .../Page/Main/Account/AccountListView.qml | 36 ++++--------------- 3 files changed, 18 insertions(+), 30 deletions(-) diff --git a/Linphone/core/App.cpp b/Linphone/core/App.cpp index 831fd503e..622c2c258 100644 --- a/Linphone/core/App.cpp +++ b/Linphone/core/App.cpp @@ -909,6 +909,16 @@ void App::onExitOnCloseChanged() { void App::onAuthenticationRequested(const std::shared_ptr &core, const std::shared_ptr &authInfo, linphone::AuthMethod method) { + bool authInfoIsInAccounts = false; + for (auto &account : core->getAccountList()) { + auto accountAuthInfo = account->findAuthInfo(); + if (authInfo && accountAuthInfo && authInfo->isEqualButAlgorithms(accountAuthInfo)) { + authInfoIsInAccounts = true; + if (account->getState() == linphone::RegistrationState::Ok) return; + break; + } + } + if (!authInfoIsInAccounts) return; mCoreModelConnection->invokeToCore([this, core, authInfo, method]() { auto window = App::getInstance()->getMainWindow(); if (!window) { diff --git a/Linphone/model/tool/ToolModel.cpp b/Linphone/model/tool/ToolModel.cpp index 4cadce78c..f5ae651ac 100644 --- a/Linphone/model/tool/ToolModel.cpp +++ b/Linphone/model/tool/ToolModel.cpp @@ -223,7 +223,7 @@ bool ToolModel::createCall(const QString &sipAddress, std::shared_ptr ToolModel::findAccount(const std::shared_ptr &address) { std::shared_ptr account; for (auto item : CoreModel::getInstance()->getCore()->getAccountList()) { - if (item->getContactAddress() && item->getContactAddress()->weakEqual(address)) { + if (item->getParams() && item->getParams()->getIdentityAddress()->weakEqual(address)) { account = item; break; } diff --git a/Linphone/view/Page/Main/Account/AccountListView.qml b/Linphone/view/Page/Main/Account/AccountListView.qml index ff8a2463f..a553571bb 100644 --- a/Linphone/view/Page/Main/Account/AccountListView.qml +++ b/Linphone/view/Page/Main/Account/AccountListView.qml @@ -12,7 +12,7 @@ Item { id: mainItem width: 517 * DefaultStyle.dp readonly property int topPadding: 23 * DefaultStyle.dp - readonly property int bottomPadding: 18 * DefaultStyle.dp + readonly property int bottomPadding: 13 * DefaultStyle.dp readonly property int leftPadding: 24 * DefaultStyle.dp readonly property int rightPadding: 24 * DefaultStyle.dp readonly property int spacing: 16 * DefaultStyle.dp @@ -21,7 +21,7 @@ Item { signal addAccountRequest() signal editAccount(AccountGui account) - implicitHeight: list.contentHeight + topPadding + bottomPadding + 32 * DefaultStyle.dp + 1 + newAccountArea.height + implicitHeight: list.contentHeight + topPadding + bottomPadding + 32 * DefaultStyle.dp + 1 + addAccountButton.height ColumnLayout{ id: childLayout anchors.top: parent.top @@ -78,37 +78,15 @@ Item { height: 1 * DefaultStyle.dp color: DefaultStyle.main2_300 } - MouseArea{ + IconLabelButton{ id: addAccountButton Layout.fillWidth: true - Layout.preferredHeight: 32 * DefaultStyle.dp visible: SettingsCpp.maxAccount == 0 || SettingsCpp.maxAccount > accountProxy.count onClicked: mainItem.addAccountRequest() - RowLayout{ - id: newAccountArea - anchors.fill: parent - spacing: 5 * DefaultStyle.dp - EffectImage { - id: newAccount - imageSource: AppIcons.plusCircle - width: 32 * DefaultStyle.dp - height: 32 * DefaultStyle.dp - Layout.preferredWidth: 32 * DefaultStyle.dp - Layout.preferredHeight: 32 * DefaultStyle.dp - Layout.alignment: Qt.AlignHCenter - fillMode: Image.PreserveAspectFit - colorizationColor: DefaultStyle.main2_500main - } - Text{ - Layout.fillHeight: true - Layout.fillWidth: true - verticalAlignment: Text.AlignVCenter - font.weight: 400 * DefaultStyle.dp - font.pixelSize: 14 * DefaultStyle.dp - color: DefaultStyle.main2_500main - text: 'Ajouter un compte' - } - } + icon.source: AppIcons.plusCircle + icon.width: 32 * DefaultStyle.dp + icon.height: 32 * DefaultStyle.dp + text: 'Ajouter un compte' } } }