• Skip to content
  • Skip to link menu
  • KDE API Reference
  • KDE Home
  • Contact Us
 

Nepomuk-Core

  • KTp
  • Models
accounts-list-model.h
Go to the documentation of this file.
1 /*
2  * This file is part of ktp-common-internals
3  *
4  * Copyright (C) 2009 Collabora Ltd. <info@collabora.com>
5  * Copyright (C) 2012 David Edmundson <kde@davidedmundson.co.uk>
6  *
7  * This library is free software; you can redistribute it and/or
8  * modify it under the terms of the GNU Lesser General Public
9  * License as published by the Free Software Foundation; either
10  * version 2.1 of the License, or (at your option) any later version.
11  *
12  * This library is distributed in the hope that it will be useful,
13  * but WITHOUT ANY WARRANTY; without even the implied warranty of
14  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
15  * Lesser General Public License for more details.
16  *
17  * You should have received a copy of the GNU Lesser General Public
18  * License along with this library; if not, write to the Free Software
19  * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
20  */
21 
22 #ifndef KTP_ACCOUNTS_LIST_MODEL_H
23 #define KTP_ACCOUNTS_LIST_MODEL_H
24 
25 #include <QtCore/QAbstractListModel>
26 
27 #include <TelepathyQt/Account>
28 
29 #include <KTp/ktp-export.h>
30 
31 class KIcon;
32 
33 namespace KTp
34 {
35 
36 class KTP_EXPORT AccountsListModel : public QAbstractListModel
37 {
38  Q_OBJECT
39  Q_DISABLE_COPY(AccountsListModel);
40 
41 public:
42  enum Roles {
43  ConnectionStateRole = Qt::UserRole,
44  ConnectionStateDisplayRole = Qt::UserRole+1,
45  ConnectionStateIconRole,
46  ConnectionErrorMessageDisplayRole,
47  ConnectionProtocolNameRole,
48  EnabledRole,
49  AccountRole
50  };
51 
52  explicit AccountsListModel(QObject *parent = 0);
53  virtual ~AccountsListModel();
54 
55  void setAccountSet(const Tp::AccountSetPtr &accountSet);
56 
57  virtual int rowCount(const QModelIndex & parent = QModelIndex()) const;
58  virtual int columnCount(const QModelIndex &parent = QModelIndex()) const;
59  virtual QVariant data(const QModelIndex &index, int role = Qt::DisplayRole) const;
60  virtual bool setData(const QModelIndex &index, const QVariant &value, int role);
61  virtual QModelIndex index(int row, int column, const QModelIndex &parent = QModelIndex()) const;
62 
63 private Q_SLOTS:
64  void onAccountAdded(const Tp::AccountPtr &account);
65  void onAccountRemoved(const Tp::AccountPtr &account);
66  void onAccountUpdated();
67 
68 private:
69  class Private;
70  Private * const d;
71 
72  const QString connectionStateString(const Tp::AccountPtr &account) const;
73  const KIcon connectionStateIcon(const Tp::AccountPtr &account) const;
74  const QString connectionStatusReason(const Tp::AccountPtr &account) const;
75 };
76 
77 }
78 
79 Q_DECLARE_METATYPE(Tp::AccountPtr)
80 
81 #endif // header guard
82 
This file is part of the KDE documentation.
Documentation copyright © 1996-2013 The KDE developers.
Generated on Fri Mar 22 2013 10:58:52 by doxygen 1.8.1.2 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.

ktp-common-internals API Reference

Skip menu "ktp-common-internals API Reference"
Report problems with this website to our bug tracking system.
Contact the specific authors with questions and comments about the page contents.

KDE® and the K Desktop Environment® logo are registered trademarks of KDE e.V. | Legal