Andreas Traczyk | b8b13ba | 2018-08-21 16:30:16 -0400 | [diff] [blame] | 1 | /*************************************************************************** |
| 2 | * Copyright (C) 2018 by Savoir-faire Linux * |
| 3 | * Author: Andreas Traczyk <andreas.traczyk@savoirfairelinux.com> * |
| 4 | * * |
| 5 | * This program is free software; you can redistribute it and/or modify * |
| 6 | * it under the terms of the GNU General Public License as published by * |
| 7 | * the Free Software Foundation; either version 3 of the License, or * |
| 8 | * (at your option) any later version. * |
| 9 | * * |
| 10 | * This program is distributed in the hope that it will be useful, * |
| 11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of * |
| 12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * |
| 13 | * GNU General Public License for more details. * |
| 14 | * * |
| 15 | * You should have received a copy of the GNU General Public License * |
| 16 | * along with this program. If not, see <http://www.gnu.org/licenses/>. * |
| 17 | ***************************************************************************/ |
| 18 | #pragma once |
| 19 | |
| 20 | // Qt include |
| 21 | #include <QAbstractItemModel> |
| 22 | |
| 23 | // LRC |
| 24 | #include "api/account.h" |
| 25 | #include "api/conversation.h" |
| 26 | #include "api/contact.h" |
| 27 | |
| 28 | class AccountListModel : public QAbstractItemModel |
| 29 | { |
| 30 | Q_OBJECT |
| 31 | |
| 32 | public: |
| 33 | enum Role { |
| 34 | Alias = Qt::UserRole + 1, |
| 35 | Username, |
| 36 | Picture, |
| 37 | Type, |
| 38 | Status, |
| 39 | ID |
| 40 | }; |
| 41 | |
| 42 | explicit AccountListModel(QObject *parent = 0); |
| 43 | |
| 44 | // QAbstractItemModel |
| 45 | int rowCount(const QModelIndex &parent = QModelIndex()) const override; |
| 46 | int columnCount(const QModelIndex &parent) const override; |
| 47 | QVariant data(const QModelIndex &index, int role = Qt::DisplayRole) const override; |
| 48 | QModelIndex index(int row, int column = 0, const QModelIndex &parent = QModelIndex()) const; |
| 49 | QModelIndex parent(const QModelIndex &child) const; |
| 50 | Qt::ItemFlags flags(const QModelIndex &index) const; |
| 51 | }; |