| 1 | #include "AccountServiceWorker.h" |
| 2 | |
| 3 | #include <qmailaccount.h> |
| 4 | #include <qmailstore.h> |
| 5 | #include "serviceutils.h" |
| 6 | |
| 7 | AccountServiceWorker::AccountServiceWorker(QObject *parent) : QObject(parent) |
| 8 | { |
| 9 | connect(QMailStore::instance(), &QMailStore::accountsRemoved, [=](const QMailAccountIdList &ids) { |
| 10 | foreach(const QMailAccountId &id, ids) { |
| 11 | emit accountRemoved(id.toULongLong()); |
| 12 | } |
| 13 | }); |
| 14 | } |
| 15 | |
| 16 | void AccountServiceWorker::removeAccount(const quint64 &id) |
| 17 | { |
| 18 | QMailAccountId aId(id); |
| 19 | QMailStore::instance()->removeAccount(aId); |
| 20 | } |
| 21 | |
| 22 | QList<quint64> AccountServiceWorker::queryAccounts(const QByteArray &accountKey, const QByteArray &sortKey, const int &limit) |
| 23 | { |
| 24 | QMailAccountIdList accounts = QMailStore::instance()->queryAccounts( |
| 25 | to_account_key(accountKey), |
| 26 | to_account_sort_key(sortKey), |
| 27 | limit); |
| 28 | return to_dbus_accountlist(accounts); |
| 29 | } |