Classified ads
profilecommentlistingmodel.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 PROFILECOMMENTLISTINGMODEL_H
22 #define PROFILECOMMENTLISTINGMODEL_H
23 
24 #include <QAbstractListModel>
25 #include "../util/hash.h"
26 #include "../mcontroller.h"
27 #include <QIcon>
28 
29 class Model ;
30 class ProfileComment ;
36 class ProfileCommentListingModel: public QAbstractTableModel {
37  Q_OBJECT
38 public: // types:
48  QString iCommentSubject ;
49  QString iSenderName ;
50  bool iIsRead ;
51  QString iCommentText ;
52  bool iIsUpdated ;
53  unsigned iNrOfAttachedFiles ;
54  } ;
55 public:
56  ProfileCommentListingModel(Model& aModel,MController& aController) ;
58 
67  void setSearchHash(const Hash& aSearch) ;
72  virtual int rowCount(const QModelIndex & parent = QModelIndex()) const ;
77  virtual int columnCount(const QModelIndex & parent = QModelIndex()) const ;
86  virtual QVariant data(const QModelIndex & index, int role = Qt::DisplayRole) const ;
87  virtual QVariant headerData ( int section, Qt::Orientation orientation, int role = Qt::DisplayRole ) const ;
88 
89  void setAsRead(const Hash& aComment, bool aIsRead) ;
94  void newCommentReceived(const Hash& aComment,
95  const Hash& aCommentedProfile) ;
101  void newCommentReceived(const ProfileComment& aComment) ;
102 signals:
104  const QString& aExplanation) ;
105 public slots:
111  void doUpdateDataOnIdle() ;
115  void profileSelected(const Hash&) ;
116 private:// methods
117  void performSearch() ;
124 
125 private: // data
128  QList<ProfileCommentListItem> iProfileComments ;
130 } ;
131 #endif
Hash iCommentedProfileHash
Definition: profilecommentlistingmodel.h:45
QList< ProfileCommentListItem > iProfileComments
Definition: profilecommentlistingmodel.h:128
QString iCommentSubject
Definition: profilecommentlistingmodel.h:48
Carrier-class for comments of a profile.
Definition: profilecomment.h:38
void setSearchHash(const Hash &aSearch)
bool updateSenderAndSubjectOfMsg(ProfileCommentListItem &aItem)
bool iIsRead
Definition: profilecommentlistingmodel.h:50
void error(MController::CAErrorSituation aError, const QString &aExplanation)
virtual int columnCount(const QModelIndex &parent=QModelIndex()) const
Definition: profilecommentlistingmodel.h:43
Hash iCommentHash
Definition: profilecommentlistingmodel.h:44
Hash is class that carries 160-bit digest.
Definition: hash.h:38
CAErrorSituation
Definition: mcontroller.h:57
MController & iController
Definition: profilecommentlistingmodel.h:127
unsigned iNrOfAttachedFiles
Definition: profilecommentlistingmodel.h:53
Model & iModel
Definition: profilecommentlistingmodel.h:126
void setAsRead(const Hash &aComment, bool aIsRead)
ProfileCommentListingModel(Model &aModel, MController &aController)
Pure-virtual interface class for controller. This is spammed across parties needing access to applica...
Definition: mcontroller.h:48
virtual int rowCount(const QModelIndex &parent=QModelIndex()) const
bool iIsUpdated
Definition: profilecommentlistingmodel.h:52
M of the MVC pattern. Handles permanent storage.
Definition: model.h:50
QString iSenderName
Definition: profilecommentlistingmodel.h:49
virtual QVariant data(const QModelIndex &index, int role=Qt::DisplayRole) const
Hash iSearchHash
Definition: profilecommentlistingmodel.h:129
quint32 iCommentTimeStamp
Definition: profilecommentlistingmodel.h:47
void profileSelected(const Hash &)
QString iCommentText
Definition: profilecommentlistingmodel.h:51
void newCommentReceived(const Hash &aComment, const Hash &aCommentedProfile)
Hash iSenderHash
Definition: profilecommentlistingmodel.h:46
virtual QVariant headerData(int section, Qt::Orientation orientation, int role=Qt::DisplayRole) const
Model-class for performing search on comments about a profile. This is supposed to act as an underlyi...
Definition: profilecommentlistingmodel.h:36