From 6d1463af067640c9a580a41f470efdd267049681 Mon Sep 17 00:00:00 2001 From: Julien Wadel Date: Thu, 28 Aug 2025 12:14:25 +0200 Subject: [PATCH] Remove from GUI a bad account created from Assistant. --- CHANGELOG.md | 1 + linphone-app/src/components/assistant/AssistantModel.cpp | 2 +- linphone-app/src/components/core/CoreHandlers.cpp | 8 ++++++++ linphone-app/src/components/core/CoreHandlers.hpp | 4 ++++ linphone-app/src/components/core/CoreListener.cpp | 6 ++++++ linphone-app/src/components/core/CoreListener.hpp | 4 ++++ .../src/components/settings/AccountSettingsModel.cpp | 3 +++ 7 files changed, 27 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 8de3a1af5..c7db3827d 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -15,6 +15,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 - Volumes settings based on hardware volumes. Remove software gains. - Display call duration instead of conference duration. - Publish presence indicator synchronized on default account. +- Remove from GUI a bad account created from Assistant. ### Added - Screen Sharing in conference calls diff --git a/linphone-app/src/components/assistant/AssistantModel.cpp b/linphone-app/src/components/assistant/AssistantModel.cpp index 85249d40e..ac6560e94 100644 --- a/linphone-app/src/components/assistant/AssistantModel.cpp +++ b/linphone-app/src/components/assistant/AssistantModel.cpp @@ -382,7 +382,7 @@ public: case linphone::RegistrationState::Failed: emit mAssistant->loginStatusChanged(QObject::tr("loginWithUsernameFailed")); mAssistant->setIsProcessing(false); - CoreManager::getInstance()->getCore()->removeAccount(account); + CoreManager::getInstance()->getAccountSettingsModel()->removeAccount(account); account->removeListener(mSelf); mSelf = nullptr; break; diff --git a/linphone-app/src/components/core/CoreHandlers.cpp b/linphone-app/src/components/core/CoreHandlers.cpp index 37213c25e..d6fc95880 100644 --- a/linphone-app/src/components/core/CoreHandlers.cpp +++ b/linphone-app/src/components/core/CoreHandlers.cpp @@ -100,6 +100,14 @@ void CoreHandlers::onAccountRegistrationStateChanged ( emit registrationStateChanged(account, state); } +void CoreHandlers::onAccountAdded(const std::shared_ptr &, const std::shared_ptr & account){ + emit accountAdded(account); +} + +void CoreHandlers::onAccountRemoved(const std::shared_ptr &, const std::shared_ptr & account) { + emit accountRemoved(account); +} + void CoreHandlers::onAuthenticationRequested ( const shared_ptr & core, const shared_ptr &authInfo, diff --git a/linphone-app/src/components/core/CoreHandlers.hpp b/linphone-app/src/components/core/CoreHandlers.hpp index 64fe884b2..e16d1e945 100644 --- a/linphone-app/src/components/core/CoreHandlers.hpp +++ b/linphone-app/src/components/core/CoreHandlers.hpp @@ -39,6 +39,8 @@ public: signals: void authenticationRequested (const std::shared_ptr &authInfo); + void accountAdded (const std::shared_ptr &account); + void accountRemoved (const std::shared_ptr &account); void callEncryptionChanged (const std::shared_ptr &call); void callLogUpdated(const std::shared_ptr &call); void callStateChanged (const std::shared_ptr &call, linphone::Call::State state); @@ -69,6 +71,8 @@ signals: public slots: void onAccountRegistrationStateChanged(const std::shared_ptr & core,const std::shared_ptr & account,linphone::RegistrationState state,const std::string & message); + void onAccountAdded(const std::shared_ptr & core, const std::shared_ptr & account); + void onAccountRemoved(const std::shared_ptr & core, const std::shared_ptr & account); void onAuthenticationRequested (const std::shared_ptr &core,const std::shared_ptr &authInfo,linphone::AuthMethod method); void onCallEncryptionChanged (const std::shared_ptr &core,const std::shared_ptr &call,bool on,const std::string &authenticationToken); void onCallLogUpdated(const std::shared_ptr & core, const std::shared_ptr & callLog); diff --git a/linphone-app/src/components/core/CoreListener.cpp b/linphone-app/src/components/core/CoreListener.cpp index 1c7df2701..f56d9f591 100644 --- a/linphone-app/src/components/core/CoreListener.cpp +++ b/linphone-app/src/components/core/CoreListener.cpp @@ -33,6 +33,12 @@ CoreListener::~CoreListener(){ void CoreListener::onAccountRegistrationStateChanged(const std::shared_ptr & core,const std::shared_ptr & account,linphone::RegistrationState state,const std::string & message){ emit accountRegistrationStateChanged(core,account,state,message); } +void CoreListener::onAccountAdded(const std::shared_ptr & core, const std::shared_ptr & account) { + emit accountAdded(core, account); +} +void CoreListener::onAccountRemoved(const std::shared_ptr & core, const std::shared_ptr & account) { + emit accountRemoved(core, account); +} void CoreListener::onAuthenticationRequested (const std::shared_ptr &core,const std::shared_ptr &authInfo,linphone::AuthMethod method){ emit authenticationRequested (core,authInfo,method); } diff --git a/linphone-app/src/components/core/CoreListener.hpp b/linphone-app/src/components/core/CoreListener.hpp index 6edef18ed..1e527096c 100644 --- a/linphone-app/src/components/core/CoreListener.hpp +++ b/linphone-app/src/components/core/CoreListener.hpp @@ -36,6 +36,8 @@ public: virtual ~CoreListener (); virtual void onAccountRegistrationStateChanged(const std::shared_ptr & core,const std::shared_ptr & account,linphone::RegistrationState state,const std::string & message) override; + virtual void onAccountAdded(const std::shared_ptr & core, const std::shared_ptr & account) override; + virtual void onAccountRemoved(const std::shared_ptr & core, const std::shared_ptr & account) override; virtual void onAuthenticationRequested (const std::shared_ptr &core,const std::shared_ptr &authInfo,linphone::AuthMethod method) override; virtual void onCallEncryptionChanged (const std::shared_ptr &core,const std::shared_ptr &call,bool on,const std::string &authenticationToken) override; virtual void onCallLogUpdated(const std::shared_ptr & core, const std::shared_ptr & callLog) override; @@ -64,6 +66,8 @@ public: signals: void accountRegistrationStateChanged(const std::shared_ptr & core,const std::shared_ptr & account,linphone::RegistrationState state,const std::string & message); + void accountAdded(const std::shared_ptr & core, const std::shared_ptr & account); + void accountRemoved(const std::shared_ptr & core, const std::shared_ptr & account); void authenticationRequested (const std::shared_ptr &core,const std::shared_ptr &authInfo,linphone::AuthMethod method); void callEncryptionChanged (const std::shared_ptr &core,const std::shared_ptr &call,bool on,const std::string &authenticationToken); void callLogUpdated(const std::shared_ptr & core, const std::shared_ptr & callLog); diff --git a/linphone-app/src/components/settings/AccountSettingsModel.cpp b/linphone-app/src/components/settings/AccountSettingsModel.cpp index 8075ce125..b77bf2e53 100644 --- a/linphone-app/src/components/settings/AccountSettingsModel.cpp +++ b/linphone-app/src/components/settings/AccountSettingsModel.cpp @@ -59,6 +59,9 @@ static inline AccountSettingsModel::RegistrationState mapLinphoneRegistrationSta AccountSettingsModel::AccountSettingsModel (QObject *parent) : QObject(parent) { CoreManager *coreManager = CoreManager::getInstance(); QObject::connect(coreManager->getHandlers().get(), &CoreHandlers::registrationStateChanged, this, &AccountSettingsModel::handleRegistrationStateChanged); + QObject::connect(coreManager->getHandlers().get(), &CoreHandlers::accountAdded, this, &AccountSettingsModel::accountSettingsUpdated); + QObject::connect(coreManager->getHandlers().get(), &CoreHandlers::accountRemoved, this, &AccountSettingsModel::accountSettingsUpdated); + QObject::connect(coreManager, &CoreManager::callLogsCountChanged, this, &AccountSettingsModel::missedCallsCountChanged); //QObject::connect(coreManager, &CoreManager::eventCountChanged, this, [this]() { emit accountSettingsUpdated(); });