Classified ads
contactlistingmodel.h
Go to the documentation of this file.
1 /* -*-C++-*- -*-coding: utf-8-unix;-*-
2  Classified Ads is Copyright (c) Antti Järvinen 2013.
3 
4  This file is part of Classified Ads.
5 
6  Classified Ads is free software; you can redistribute it and/or
7  modify it under the terms of the GNU Lesser General Public
8  License as published by the Free Software Foundation; either
9  version 2.1 of the License, or (at your option) any later version.
10 
11  Classified Ads is distributed in the hope that it will be useful,
12  but WITHOUT ANY WARRANTY; without even the implied warranty of
13  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14  Lesser General Public License for more details.
15 
16  You should have received a copy of the GNU Lesser General Public
17  License along with Classified Ads; if not, write to the Free Software
18  Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
19 */
20 
21 #ifndef CONTACTSEARCHMODEL_H
22 #define CONTACTSEARCHMODEL_H
23 
24 #include <QAbstractListModel>
25 #include "../util/hash.h"
26 #include "../mcontroller.h"
27 #include "contact.h"
28 
29 class Model ;
30 
36 class ContactListingModel: public QAbstractTableModel {
37  Q_OBJECT
38 public:
39  ContactListingModel(Model& aModel,MController& aController) ;
41 
42  virtual int rowCount(const QModelIndex & parent = QModelIndex()) const ;
47  virtual int columnCount(const QModelIndex & parent = QModelIndex()) const ;
52  virtual QVariant data(const QModelIndex & index, int role = Qt::DisplayRole) const ;
53  virtual QVariant headerData ( int section, Qt::Orientation orientation, int role = Qt::DisplayRole ) const ;
54 
55  void newContactAdded(const Contact& aContact) ;
56  void removeContact(const Hash& aContact) ;
62  bool contactByFingerPrint(const Hash& aFingerPrint, Contact* aResultingContact) const ;
66  QVariant contactsAsQVariant() const ;
67  void setContactsFromQVariant(const QVariantList& aContacts) ;
68  bool isContactContained(const Hash& aFingerPrint) const ;
69  void clearContents() ;
74  QList<Hash> trustList() const ;
75 signals:
77  const QString& aExplanation) ;
78 
79 private: // data
82  QList<Contact> iContacts ;
83 } ;
84 #endif
QList< Contact > iContacts
Definition: contactlistingmodel.h:82
QVariant contactsAsQVariant() const
ContactListingModel(Model &aModel, MController &aController)
bool isContactContained(const Hash &aFingerPrint) const
Hash is class that carries 160-bit digest.
Definition: hash.h:38
CAErrorSituation
Definition: mcontroller.h:52
Carrier-class for a profile that is in contacts-list.
Definition: contact.h:35
void newContactAdded(const Contact &aContact)
Model & iModel
Definition: contactlistingmodel.h:80
void error(MController::CAErrorSituation aError, const QString &aExplanation)
MController & iController
Definition: contactlistingmodel.h:81
Pure-virtual interface class for controller. This is spammed across parties needing access to applica...
Definition: mcontroller.h:43
QList< Hash > trustList() const
M of the MVC pattern. Handles permanent storage.
Definition: model.h:48
bool contactByFingerPrint(const Hash &aFingerPrint, Contact *aResultingContact) const
virtual QVariant data(const QModelIndex &index, int role=Qt::DisplayRole) const
Model-class for performing search on contact-list contacts This is supposed to act as an underlying d...
Definition: contactlistingmodel.h:36
virtual int rowCount(const QModelIndex &parent=QModelIndex()) const
virtual int columnCount(const QModelIndex &parent=QModelIndex()) const
void removeContact(const Hash &aContact)
void setContactsFromQVariant(const QVariantList &aContacts)
virtual QVariant headerData(int section, Qt::Orientation orientation, int role=Qt::DisplayRole) const