diff --git a/src/availableaccountmodel.cpp b/src/availableaccountmodel.cpp index c8d43749eb2c956051299c1aeab634d8bfc5bfa9..bcf7814f0bb8ba18c519b6bdde6c19e6cbab8560 100644 --- a/src/availableaccountmodel.cpp +++ b/src/availableaccountmodel.cpp @@ -97,6 +97,12 @@ bool AvailableAccountModel::filterAcceptsRow(int source_row, const QModelIndex& ///Return the current account 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 URI::SchemeType type = (!method) ? URI::SchemeType::NONE : method->uri().schemeType();