Changeset View
Changeset View
Standalone View
Standalone View
kmymoney/models/onlinebankingaccountsfilterproxymodel.cpp
Show First 20 Lines • Show All 43 Lines • ▼ Show 20 Line(s) | 42 | { | |||
---|---|---|---|---|---|
44 | if (onlineJobAdministration::instance()->isAnyJobSupported(accountId)) | 44 | if (onlineJobAdministration::instance()->isAnyJobSupported(accountId)) | ||
45 | return QSortFilterProxyModel::flags(index); | 45 | return QSortFilterProxyModel::flags(index); | ||
46 | return QSortFilterProxyModel::flags(index) & ~Qt::ItemIsSelectable; | 46 | return QSortFilterProxyModel::flags(index) & ~Qt::ItemIsSelectable; | ||
47 | } | 47 | } | ||
48 | 48 | | |||
49 | 49 | | |||
50 | bool OnlineBankingAccountsFilterProxyModel::filterAcceptsParent(const QModelIndex& index) const | 50 | bool OnlineBankingAccountsFilterProxyModel::filterAcceptsParent(const QModelIndex& index) const | ||
51 | { | 51 | { | ||
52 | const int rowCount = sourceModel()->rowCount(index); | 52 | auto const model = sourceModel(); | ||
53 | for (int i = 0; i < rowCount; i++) { | 53 | const auto rowCount = model->rowCount(index); | ||
54 | const QModelIndex childIndex = sourceModel()->index(i, 0, index); | 54 | for (auto i = 0; i < rowCount; ++i) { | ||
55 | if (onlineJobAdministration::instance()->isAnyJobSupported(sourceModel()->data(childIndex, AccountsModel::AccountIdRole).toString())) | 55 | const auto childIndex = model->index(i, AccountsModel::Account, index); // CAUTION! Assumption is being made that Account column number is always 0 | ||
56 | if (onlineJobAdministration::instance()->isAnyJobSupported(model->data(childIndex, AccountsModel::AccountIdRole).toString())) | ||||
56 | return true; | 57 | return true; | ||
57 | if (filterAcceptsParent(childIndex)) | 58 | if (filterAcceptsParent(childIndex)) | ||
58 | return true; | 59 | return true; | ||
59 | } | 60 | } | ||
60 | return false; | 61 | return false; | ||
61 | } | 62 | } |