diff options
author | link2xt <link2xt@testrun.org> | 2020-11-05 22:03:37 +0300 |
---|---|---|
committer | link2xt <link2xt@testrun.org> | 2020-11-05 23:08:08 +0300 |
commit | fe89c7a4ff760564f3cdbcd8e27c04eadd9f79d8 (patch) | |
tree | 39d56b00509277afca8743adcf6051bd42121e99 /accounts.h | |
parent | daa31b783ad1dead6cbed79b428792702612aa31 (diff) | |
download | kdeltachat-fe89c7a4ff760564f3cdbcd8e27c04eadd9f79d8.tar.gz kdeltachat-fe89c7a4ff760564f3cdbcd8e27c04eadd9f79d8.zip |
Move accounts model from C++ to QML
C++ models are not well documented and it is easier to manage the model
in QML.
Now all QObjects are thin wrappers around Delta Chat core structures.
Diffstat (limited to 'accounts.h')
-rw-r--r-- | accounts.h | 31 |
1 files changed, 31 insertions, 0 deletions
diff --git a/accounts.h b/accounts.h new file mode 100644 index 0000000..20ede38 --- /dev/null +++ b/accounts.h @@ -0,0 +1,31 @@ +#pragma once + +#include <QAbstractListModel> +#include <deltachat.h> + +#include "eventemitter.h" +#include "context.h" + +class DcAccounts : public QObject { + Q_OBJECT + +public: + explicit DcAccounts(QObject *parent = nullptr); + ~DcAccounts(); + + Q_INVOKABLE uint32_t addAccount(); + Q_INVOKABLE uint32_t importAccount(QString tarfile); + Q_INVOKABLE uint32_t migrateAccount(QString dbfile); + Q_INVOKABLE bool removeAccount(uint32_t accountId); + Q_INVOKABLE QVariantList getAll(); + Q_INVOKABLE Context *getAccount(uint32_t accountId); + Q_INVOKABLE Context *getSelectedAccount(); + Q_INVOKABLE bool selectAccount(uint32_t accountId); + Q_INVOKABLE void startIo(); + Q_INVOKABLE void stopIo(); + Q_INVOKABLE void maybeNetwork(); + Q_INVOKABLE DcAccountsEventEmitter *getEventEmitter(); + +private: + dc_accounts_t *m_accounts{nullptr}; +}; |