fix #LINQT-1553 auth dialog on start even if account is registered

This commit is contained in:
Gaelle Braud 2025-01-22 16:09:46 +01:00 committed by Julien Wadel
parent 1c1bd91080
commit 96772fabac
3 changed files with 18 additions and 30 deletions

View file

@ -909,6 +909,16 @@ void App::onExitOnCloseChanged() {
void App::onAuthenticationRequested(const std::shared_ptr<linphone::Core> &core,
const std::shared_ptr<linphone::AuthInfo> &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) {

View file

@ -223,7 +223,7 @@ bool ToolModel::createCall(const QString &sipAddress,
std::shared_ptr<linphone::Account> ToolModel::findAccount(const std::shared_ptr<const linphone::Address> &address) {
std::shared_ptr<linphone::Account> 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;
}

View file

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