Skip to content
Snippets Groups Projects
Commit c6ff5011 authored by Stepan Salenikovich's avatar Stepan Salenikovich
Browse files

use user selected account when CM is not specified

When currentDefaultAccount() was being called with no CM as input
(eg: from ther UserActionModel), then the scheme type was being
set to NONE, and thus Ring accounts were not passing the check in
validAccountForScheme(). This is because we can always detect the
scheme for a Ring URI, so Ring accounts don't support the scheme
of type NONE.

However, in this situation we want the user selected account to
be chosen, since there is no other information available.

Change-Id: Ia2d9b02fb3bb0476f044541d276dba768468feb8
parent 14518888
No related branches found
No related tags found
No related merge requests found
...@@ -97,6 +97,12 @@ bool AvailableAccountModel::filterAcceptsRow(int source_row, const QModelIndex& ...@@ -97,6 +97,12 @@ bool AvailableAccountModel::filterAcceptsRow(int source_row, const QModelIndex&
///Return the current account ///Return the current account
Account* AvailableAccountModel::currentDefaultAccount(ContactMethod* method) Account* AvailableAccountModel::currentDefaultAccount(ContactMethod* method)
{ {
// if no CM is give, we use the user chosen account, since no other parameters are available
const auto idx = AvailableAccountModel::instance().selectionModel()->currentIndex();
if (!method && idx.isValid()) {
return idx.data(static_cast<int>(Account::Role::Object)).value<Account*>();
}
// Start by validating the scheme used by the ContactMethod // Start by validating the scheme used by the ContactMethod
URI::SchemeType type = (!method) ? URI::SchemeType::NONE : method->uri().schemeType(); URI::SchemeType type = (!method) ? URI::SchemeType::NONE : method->uri().schemeType();
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment