From a1e2c253bff2c4a4ceb4dc241ef93c7733bb6b64 Mon Sep 17 00:00:00 2001 From: Gaelle Braud Date: Thu, 7 Aug 2025 09:25:02 +0200 Subject: [PATCH] fix #LINQT-1839 force switching to main page when account added and remote provisioning configured --- Linphone/core/App.cpp | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/Linphone/core/App.cpp b/Linphone/core/App.cpp index 6f14261fc..56f7a1822 100644 --- a/Linphone/core/App.cpp +++ b/Linphone/core/App.cpp @@ -381,6 +381,21 @@ void App::setSelf(QSharedPointer(me)) { }); } }); + mCoreModelConnection->makeConnectToModel( + &CoreModel::accountAdded, + [this](const std::shared_ptr &core, const std::shared_ptr &account) { + mustBeInLinphoneThread(log().arg(Q_FUNC_INFO)); + if (CoreModel::getInstance()->mConfigStatus == linphone::ConfiguringState::Successful) { + bool accountConnected = account && account->getState() == linphone::RegistrationState::Ok; + mCoreModelConnection->invokeToCore([this, accountConnected]() { + mustBeInMainThread(log().arg(Q_FUNC_INFO)); + // There is an account added by a remote provisioning, force switching to main page + // because the account may not be connected already + QMetaObject::invokeMethod(mMainWindow, "openMainPage", Qt::DirectConnection, + Q_ARG(QVariant, accountConnected)); + }); + } + }); // Synchronize state for because linphoneCore was ran before any connections. mCoreModelConnection->invokeToModel([this]() {