source: SMSSender/src/ui/models/contacttablemodel.h @ 217:1ed3ec64fc1f

Last change on this file since 217:1ed3ec64fc1f was 217:1ed3ec64fc1f, checked in by Sämy Zehnder <saemy.zehnder@…>, 7 years ago
  • Removed all Priv stuff. Using Qts parent mechanism for memory management now.
File size: 1.9 KB
Line 
1/*
2 smssender - A frontend for fast and easy SMS sending over different gateways.
3 Copyright (C) 2007-2012, gorrión. See http://smssender.gorrion.ch
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#ifndef CONTACTTABLEMODEL_H
19#define CONTACTTABLEMODEL_H
20
21#include <QAbstractTableModel>
22
23#include <scontact.h>
24
25class ContactTableModel: public QAbstractTableModel {
26    Q_OBJECT
27
28public:
29    enum Columns {
30        ColImage   = 0,
31        ColName    = 1,
32        ColNumber  = 2,
33        ColAliases = 3,
34
35        MaxCol     = ColAliases
36    };
37
38public:
39    ContactTableModel(QObject* parent);
40
41    QVariant headerData(int section, Qt::Orientation orientation, int role = Qt::DisplayRole) const;
42    QVariant data(const QModelIndex& index, int role = Qt::DisplayRole) const;
43    int      columnCount(const QModelIndex& parent = QModelIndex()) const;
44    int      rowCount(const QModelIndex& parent = QModelIndex()) const;
45    bool     removeRows(int row, int count, const QModelIndex& parent = QModelIndex());
46
47    SContact dataObject(const QModelIndex& index) const;
48
49private:
50    QString  getAliasesStr(const SContact& contact) const;
51
52private slots:
53    void contactAddRemove(const SContact& contact);
54    void contactUpdated(const SContact& contact);
55
56private:
57    QList<SContact> contacts_;
58};
59
60
61#endif // CONTACTTABLEMODEL_H
62
Note: See TracBrowser for help on using the repository browser.