If the default account is selected, Me is all local accounts. This is useful to display all chat rooms and get rid of unread messages.

Display chat rooms on removed account
This commit is contained in:
Julien Wadel 2023-10-31 15:24:39 +01:00
parent 19d54cb0aa
commit 7371b877b3
5 changed files with 14 additions and 4 deletions

View file

@ -87,7 +87,7 @@ shared_ptr<linphone::Address> AccountSettingsModel::getUsedSipAddress () const {
return account ? account->getParams()->getIdentityAddress()->clone() : core->createPrimaryContactParsed();
}
std::shared_ptr<linphone::Account> AccountSettingsModel::findAccount(shared_ptr<const linphone::Address> address) const {
std::shared_ptr<linphone::Account> AccountSettingsModel::findAccount(shared_ptr<const linphone::Address> address) const {
if(!address)
return nullptr;
shared_ptr<linphone::Core> core = CoreManager::getInstance()->getCore();

View file

@ -68,6 +68,7 @@ SettingsModel::SettingsModel (QObject *parent) : QObject(parent) {
connect(coreManager->getAccountSettingsModel(), &AccountSettingsModel::defaultAccountChanged, this, &SettingsModel::groupChatEnabledChanged);
connect(coreManager->getAccountSettingsModel(), &AccountSettingsModel::defaultAccountChanged, this, &SettingsModel::videoConferenceEnabledChanged);
connect(coreManager->getAccountSettingsModel(), &AccountSettingsModel::defaultAccountChanged, this, &SettingsModel::secureChatEnabledChanged);
connect(coreManager->getAccountSettingsModel(), &AccountSettingsModel::defaultAccountChanged, this, &SettingsModel::onDefaultAccountChanged);
connect(coreManager->getAccountSettingsModel(), &AccountSettingsModel::accountSettingsUpdated, this, &SettingsModel::groupChatEnabledChanged);
connect(coreManager->getAccountSettingsModel(), &AccountSettingsModel::accountSettingsUpdated, this, &SettingsModel::videoConferenceEnabledChanged);
@ -2015,3 +2016,7 @@ bool SettingsModel::isReadOnly(const std::string& section, const std::string& na
std::string SettingsModel::getEntryFullName(const std::string& section, const std::string& name) const {
return isReadOnly(section, name)?name+"/readonly" : name;
}
void SettingsModel::onDefaultAccountChanged(){
mConfig->setInt("misc", "hide_chat_rooms_from_removed_proxies", CoreManager::getInstance()->getCore()->getDefaultAccount() != nullptr);
}

View file

@ -703,6 +703,8 @@ public:
bool isReadOnly(const std::string& section, const std::string& name) const;
std::string getEntryFullName(const std::string& section, const std::string& name) const; // Return the full name of the entry : 'name/readonly' or 'name'
void onDefaultAccountChanged();
static const std::string UiSection;
static const std::string ContactsSection;

View file

@ -142,7 +142,7 @@ bool TimelineProxyModel::filterAcceptsRow (int sourceRow, const QModelIndex &sou
//|| timeline->getChatRoomModel()->getFullPeerAddress().contains(search); not enough significant?
}
if(show)
show = timeline->getChatRoomModel()->isCurrentAccount();
show = !CoreManager::getInstance()->getCore()->getDefaultAccount() || timeline->getChatRoomModel()->isCurrentAccount();
return show;
}

View file

@ -671,11 +671,14 @@ QString Utils::computeUserAgent(const std::shared_ptr<linphone::Config>& config)
}
bool Utils::isMe(const QString& address){
return !address.isEmpty() ? CoreManager::getInstance()->getAccountSettingsModel()->getUsedSipAddress()->weakEqual(Utils::interpretUrl(address)) : false;
return !address.isEmpty() ? isMe(Utils::interpretUrl(address)) : false;
}
bool Utils::isMe(const std::shared_ptr<const linphone::Address>& address){
return address ? CoreManager::getInstance()->getAccountSettingsModel()->getUsedSipAddress()->weakEqual(address) : false;
if( !CoreManager::getInstance()->getCore()->getDefaultAccount()){// Default account is selected : Me is all local accounts.
return CoreManager::getInstance()->getAccountSettingsModel()->findAccount(address) != nullptr;
}else
return address ? CoreManager::getInstance()->getAccountSettingsModel()->getUsedSipAddress()->weakEqual(address) : false;
}
bool Utils::isAnimatedImage(const QString& path){