Changeset View
Changeset View
Standalone View
Standalone View
src/folder/accounttabbar_p.h
- This file was added.
1 | /* | ||||
---|---|---|---|---|---|
2 | Copyright (c) 2017 Daniel Vrátil <dvratil@kde.org> | ||||
3 | | ||||
4 | This program is free software; you can redistribute it and/or modify it | ||||
5 | under the terms of the GNU General Public License, version 2, as | ||||
6 | published by the Free Software Foundation. | ||||
7 | | ||||
8 | This program is distributed in the hope that it will be useful, but | ||||
9 | WITHOUT ANY WARRANTY; without even the implied warranty of | ||||
10 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | ||||
11 | General Public License for more details. | ||||
12 | | ||||
13 | You should have received a copy of the GNU General Public License along | ||||
14 | with this program; if not, write to the Free Software Foundation, Inc., | ||||
15 | 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA | ||||
16 | */ | ||||
17 | | ||||
18 | #ifndef MAILCOMMON_ACCOUNTTABBAR_H | ||||
19 | #define MAILCOMMON_ACCOUNTTABAR_H | ||||
20 | | ||||
21 | #include <QTabBar> | ||||
22 | | ||||
23 | class QAbstractItemModel; | ||||
24 | class QModelIndex; | ||||
25 | | ||||
26 | namespace MailCommon { | ||||
27 | | ||||
28 | class AccountTabBar : public QTabBar | ||||
29 | { | ||||
30 | public: | ||||
31 | explicit AccountTabBar(QWidget *parent = nullptr); | ||||
32 | ~AccountTabBar(); | ||||
33 | | ||||
34 | void setModel(QAbstractItemModel *model); | ||||
35 | QAbstractItemModel *model() const; | ||||
36 | | ||||
37 | int tabForIndex(const QModelIndex &index) const; | ||||
38 | | ||||
39 | private Q_SLOTS: | ||||
40 | void onRowsInserted(const QModelIndex &parent, int first, int last); | ||||
41 | void onRowsRemoved(const QModelIndex &parent, int first, int last); | ||||
42 | void onRowsMoved(const QModelIndex &parent, int start, int end, | ||||
43 | const QModelIndex &dest, int row); | ||||
44 | void onModelReset(); | ||||
45 | void onDataChanged(const QModelIndex &topLeft, const QModelIndex &bottomRight, | ||||
46 | const QVector<int> &roles); | ||||
47 | | ||||
48 | private: | ||||
49 | void updateUnreadCount(int tabIdx); | ||||
50 | | ||||
51 | QAbstractItemModel *mModel; | ||||
52 | }; | ||||
53 | | ||||
54 | } // namespace MailCommon | ||||
55 | | ||||
56 | #endif |