Classified ads
Classes | Public Slots | Signals | Public Member Functions | Private Member Functions | Private Attributes | List of all members
ProfileCommentListingModel Class Reference

Model-class for performing search on comments about a profile. This is supposed to act as an underlying data-container for an user-interface view (QListView etc.) More...

#include <profilecommentlistingmodel.h>

Inheritance diagram for ProfileCommentListingModel:
Inheritance graph
[legend]
Collaboration diagram for ProfileCommentListingModel:
Collaboration graph
[legend]

Classes

struct  ProfileCommentListItem
 

Public Slots

void doUpdateDataOnIdle ()
 
void profileSelected (const Hash &)
 

Signals

void error (MController::CAErrorSituation aError, const QString &aExplanation)
 

Public Member Functions

 ProfileCommentListingModel (Model &aModel, MController &aController)
 
 ~ProfileCommentListingModel ()
 
void setSearchHash (const Hash &aSearch)
 
virtual int rowCount (const QModelIndex &parent=QModelIndex()) const
 
virtual int columnCount (const QModelIndex &parent=QModelIndex()) const
 
virtual QVariant data (const QModelIndex &index, int role=Qt::DisplayRole) const
 
virtual QVariant headerData (int section, Qt::Orientation orientation, int role=Qt::DisplayRole) const
 
void setAsRead (const Hash &aComment, bool aIsRead)
 
void newCommentReceived (const Hash &aComment, const Hash &aCommentedProfile)
 
void newCommentReceived (const ProfileComment &aComment)
 

Private Member Functions

void performSearch ()
 
bool updateSenderAndSubjectOfMsg (ProfileCommentListItem &aItem)
 

Private Attributes

ModeliModel
 
MControlleriController
 
QList< ProfileCommentListItemiProfileComments
 
Hash iSearchHash
 

Detailed Description

Model-class for performing search on comments about a profile. This is supposed to act as an underlying data-container for an user-interface view (QListView etc.)

Constructor & Destructor Documentation

ProfileCommentListingModel::ProfileCommentListingModel ( Model aModel,
MController aController 
)
ProfileCommentListingModel::~ProfileCommentListingModel ( )

Member Function Documentation

virtual int ProfileCommentListingModel::columnCount ( const QModelIndex &  parent = QModelIndex()) const
virtual

re-implemented from QAbstractTableModel

Returns
number of columns in view
virtual QVariant ProfileCommentListingModel::data ( const QModelIndex &  index,
int  role = Qt::DisplayRole 
) const
virtual

re-implemented from QAbstractListModel

Returns
data to display in list. If Qt::UserRole+1 is used to obtain data, html of the comment is returned, Qt::UserRole returns comment hash as QVariant. UserRole+2 returns header data as single string, intended for list displays. UserRole+3 returns number of attached files as unsigned.
void ProfileCommentListingModel::doUpdateDataOnIdle ( )
slot

method called via QTimer::singleShot() that is used for filling missing parts (message subjects etc.) from data that model is listing

void ProfileCommentListingModel::error ( MController::CAErrorSituation  aError,
const QString &  aExplanation 
)
signal
virtual QVariant ProfileCommentListingModel::headerData ( int  section,
Qt::Orientation  orientation,
int  role = Qt::DisplayRole 
) const
virtual
void ProfileCommentListingModel::newCommentReceived ( const Hash aComment,
const Hash aCommentedProfile 
)

notification method called when new comment is inserted into database

void ProfileCommentListingModel::newCommentReceived ( const ProfileComment aComment)

notification method called when new comment is inserted into database , this variant is called from UI

void ProfileCommentListingModel::performSearch ( )
private
void ProfileCommentListingModel::profileSelected ( const Hash )
slot

called from controller when user profile is selected

virtual int ProfileCommentListingModel::rowCount ( const QModelIndex &  parent = QModelIndex()) const
virtual

re-implemented from QAbstractTableModel

Returns
number of rows in list
void ProfileCommentListingModel::setAsRead ( const Hash aComment,
bool  aIsRead 
)
void ProfileCommentListingModel::setSearchHash ( const Hash aSearch)

Calling this method will populate the model with messages that are either sent by profile given in parameter, or comment a given profile.

Parameters
aSearchprofile fingerprint whose messages are the item of interest
Returns
no thing, always succeeds
bool ProfileCommentListingModel::updateSenderAndSubjectOfMsg ( ProfileCommentListItem aItem)
private

updates profile comment subject etc. from dabase.

Returns
false if update was not success indicating that comment should be removed from list

Member Data Documentation

MController& ProfileCommentListingModel::iController
private
Model& ProfileCommentListingModel::iModel
private
QList<ProfileCommentListItem> ProfileCommentListingModel::iProfileComments
private
Hash ProfileCommentListingModel::iSearchHash
private

The documentation for this class was generated from the following file: