fix : AvailableAccountModel uses
- after last meeting it was decided to not show disabled accounts
in combobox_account_selector. We are now using AvailableAccountModel.
- this patch fix several bugs :
* display the right information on ringwelcomeview.
* get_active_ring_account() returns the right selected account.
* bind the selection from combobox_account_selector to
AvailableAccountModel.
* use currentChanged signal from selectionModel() to refresh
treeview_conversations.
* select the good account in AvailableAccountModel during an
incoming call.
Change-Id: I652da29da57ab5d6d4f1abe26dd3c2cbf807396c
diff --git a/src/utils/accounts.cpp b/src/utils/accounts.cpp
index bbc182b..b9aa20e 100644
--- a/src/utils/accounts.cpp
+++ b/src/utils/accounts.cpp
@@ -20,6 +20,7 @@
#include "accounts.h"
#include <accountmodel.h>
+#include <availableaccountmodel.h>
// LRC
#include <QItemSelectionModel>
@@ -58,6 +59,8 @@
Account*
get_active_ring_account()
{
- auto account = AccountModel::instance().userChosenAccount();
+ const auto idx = AvailableAccountModel::instance().selectionModel()->currentIndex();
+ auto account = idx.data(static_cast<int>(Account::Role::Object)).value<Account*>();
+
return (account && account->protocol() == Account::Protocol::RING) ? account : nullptr;
}