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 modify
7  it under the terms of the GNU General Public License as published by
8  the Free Software Foundation, either version 3 of the License, or
9  (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
14  GNU General Public License for more details.
15 
16  You should have received a copy of the GNU General Public License
17  along with Classified Ads. If not, see <http://www.gnu.org/licenses/>.
18 */
19 
20 #ifndef PROFILECOMMENTLISTINGMODEL_H
21 #define PROFILECOMMENTLISTINGMODEL_H
22 
23 #include <QAbstractListModel>
24 #include "../util/hash.h"
25 #include "../mcontroller.h"
26 #include <QIcon>
27 
28 class Model ;
29 class ProfileComment ;
35 class ProfileCommentListingModel: public QAbstractTableModel {
36  Q_OBJECT
37 public: // types:
43  {
47  quint32 iCommentTimeStamp ;
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() ;
119 
120 private: // data
123  QList<ProfileCommentListItem> iProfileComments ;
125 } ;
126 #endif
Hash iCommentedProfileHash
Definition: profilecommentlistingmodel.h:45
QList< ProfileCommentListItem > iProfileComments
Definition: profilecommentlistingmodel.h:123
QString iCommentSubject
Definition: profilecommentlistingmodel.h:48
virtual int columnCount(const QModelIndex &parent=QModelIndex()) const
Carrier-class for comments of a profile.
Definition: profilecomment.h:37
virtual QVariant data(const QModelIndex &index, int role=Qt::DisplayRole) const
void setSearchHash(const Hash &aSearch)
bool iIsRead
Definition: profilecommentlistingmodel.h:50
void error(MController::CAErrorSituation aError, const QString &aExplanation)
Definition: profilecommentlistingmodel.h:42
Hash iCommentHash
Definition: profilecommentlistingmodel.h:44
Hash is class that carries 160-bit digest.
Definition: hash.h:37
CAErrorSituation
Definition: mcontroller.h:48
MController & iController
Definition: profilecommentlistingmodel.h:122
unsigned iNrOfAttachedFiles
Definition: profilecommentlistingmodel.h:53
Model & iModel
Definition: profilecommentlistingmodel.h:121
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:39
bool iIsUpdated
Definition: profilecommentlistingmodel.h:52
M of the MVC pattern. Handles permanent storage.
Definition: model.h:47
QString iSenderName
Definition: profilecommentlistingmodel.h:49
Hash iSearchHash
Definition: profilecommentlistingmodel.h:124
virtual int rowCount(const QModelIndex &parent=QModelIndex()) const
quint32 iCommentTimeStamp
Definition: profilecommentlistingmodel.h:47
void profileSelected(const Hash &)
QString iCommentText
Definition: profilecommentlistingmodel.h:51
void newCommentReceived(const Hash &aComment, const Hash &aCommentedProfile)
void updateSenderAndSubjectOfMsg(ProfileCommentListItem &aItem)
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:35