Warning, file /office/calligra/gemini/CloudAccountsModel.h was not indexed or was modified since last indexation (in which case cross-reference links may be missing, inaccurate or erroneous).

0001 /* This file is part of the KDE project
0002  * SPDX-FileCopyrightText: 2014 Dan Leinir Turthra Jensen <admin@leinir.dk>
0003  *
0004  * SPDX-License-Identifier: GPL-2.0-only OR GPL-3.0-only OR LicenseRef-KDE-Accepted-GPL
0005  *
0006  */
0007 
0008 #ifndef CLOUDACCOUNTSMODEL_H
0009 #define CLOUDACCOUNTSMODEL_H
0010 
0011 #include <QAbstractListModel>
0012 
0013 class CloudAccountsModel : public QAbstractListModel
0014 {
0015     Q_OBJECT
0016 public:
0017     enum CloudAccountRoles {
0018         TextRole = Qt::UserRole + 1,
0019         SelectedRole,
0020         AccountTypeRole,
0021         StackComponentRole,
0022         AccountDetailsRole
0023     };
0024     explicit CloudAccountsModel(QObject* parent = 0);
0025     ~CloudAccountsModel() override;
0026     
0027     QHash<int, QByteArray> roleNames() const override;
0028     QVariant data(const QModelIndex& index, int role) const override;
0029     int rowCount(const QModelIndex& parent) const override;
0030     Q_INVOKABLE void selectIndex(int newSelection);
0031 
0032     /**
0033      * Add an account to the list. If removeExisting is true, the call will first remove any existing
0034      * accounts with the same text.
0035      *
0036      * @param text           The user visible name of the account shown in the UI
0037      * @param accountType    The type of account, either DropBox, Git or WebDav
0038      * @param stackComponent The name of the component instantiated to show the files available through
0039      *                       the account
0040      * @param accountDetails A pure QObject with a set of dynamic properties containing information used
0041      *                       by the service. For example, the local repository location for Git
0042      * @param removeExisting Whether or not to remove any existing accounts with the given text before
0043      *                       adding this one. Currently used by DropBox to ensure there is only one
0044      *                       account at a given moment
0045      */
0046     Q_INVOKABLE void addAccount(QString text, QString accountType, QString stackComponent, QObject* accountDetails, bool removeExisting = false);
0047     Q_INVOKABLE void renameAccount(int index, QString newText);
0048     Q_INVOKABLE void removeAccountByName(QString text);
0049     Q_INVOKABLE void removeAccount(int index);
0050 
0051     Q_INVOKABLE QObject* accountDetails(int index);
0052     Q_INVOKABLE void setAccountDetails(int index, QObject* newDetails);
0053 private:
0054     class Private;
0055     Private* d;
0056 };
0057 
0058 #endif // CLOUDACCOUNTSMODEL_H