MailViewModel Class Reference

Model for the mail view. More...

#include <mailviewmodel.h>

List of all members.

Public Member Functions

 MailViewModel (AccountList *accounts, QObject *parent)
virtual ~MailViewModel ()
virtual QModelIndex index (int row, int column, const QModelIndex &parent=QModelIndex()) const
virtual QModelIndex parent (const QModelIndex &) const
virtual int rowCount (const QModelIndex &parent=QModelIndex()) const
virtual int columnCount (const QModelIndex &) const
QVariant data (const QModelIndex &index, int role=Qt::DisplayRole) const
bool hasChildren (const QModelIndex &parent=QModelIndex()) const
 Overloaded from QAbstractItemModel.
QVariant headerData (int section, Qt::Orientation orientation, int role) const
virtual Qt::ItemFlags flags (const QModelIndex &) const
void refresh ()
void sort (int column, Qt::SortOrder order=Qt::AscendingOrder)
void sort ()
Mail getMail (const QModelIndex index) const
QStringList getSelectedSubjects (QItemSelectionModel *selectModel) const
QStringList getSelectedSenders (QItemSelectionModel *selectModel) const
QList< MailgetSelectedMails (QItemSelectionModel *mailSelectModel) const
QModelIndexList getMarkedMails () const
void saveSetup ()


Detailed Description

Model for the mail view.

Definition at line 44 of file mailviewmodel.h.


Constructor & Destructor Documentation

MailViewModel::MailViewModel ( AccountList accounts,
QObject *  parent 
)

Constructor

Parameters:
accounts pointer to the account list
parent parent object

Definition at line 20 of file mailviewmodel.cpp.

MailViewModel::~MailViewModel (  )  [virtual]

Destructor

Definition at line 29 of file mailviewmodel.cpp.


Member Function Documentation

QModelIndex MailViewModel::index ( int  row,
int  column,
const QModelIndex &  parent = QModelIndex() 
) const [virtual]

Returns the index of the mail data in this model specified by the given row, column. The parent index is not used. Overloaded from QAbstractItemModel

Parameters:
row Row
column Column
parent parent index; not used

Definition at line 31 of file mailviewmodel.cpp.

QModelIndex MailViewModel::parent ( const QModelIndex &   )  const [virtual]

Overloaded from QAbstractItemModel Because this model doesn't provide tree structured data this function just returns an invalid index.

Definition at line 40 of file mailviewmodel.cpp.

int MailViewModel::rowCount ( const QModelIndex &  parent = QModelIndex()  )  const [virtual]

Overloaded from QAbstractItemModel Doesn't give a parent item, because the model doesn't provide tree structured data The row count is equal to the number of mails.

Parameters:
parent parent index

Definition at line 45 of file mailviewmodel.cpp.

int MailViewModel::columnCount ( const QModelIndex &   )  const [virtual]

Overloaded from QAbstractItemModel Doesn't give a parent item, because the model doesn't provide tree structured data. The column count is equal to the number of showed mail data

Definition at line 53 of file mailviewmodel.cpp.

QVariant MailViewModel::data ( const QModelIndex &  index,
int  role = Qt::DisplayRole 
) const

Overloaded from QAbstractItemModel Returns the data of the given index.

Parameters:
index the index
role the role

Definition at line 58 of file mailviewmodel.cpp.

bool MailViewModel::hasChildren ( const QModelIndex &  parent = QModelIndex()  )  const

Overloaded from QAbstractItemModel.

Because this model doesn't provides tree structured data, this methode always returns false

Parameters:
parent parent index

Definition at line 114 of file mailviewmodel.cpp.

QVariant MailViewModel::headerData ( int  section,
Qt::Orientation  orientation,
int  role 
) const

Returns the header text of the given section

Parameters:
section header section
orientation orientation of the header; just returns the horizontal orientation
role display role

Definition at line 123 of file mailviewmodel.cpp.

Qt::ItemFlags MailViewModel::flags ( const QModelIndex &   )  const [virtual]

Returns the flags of the given index. All items are enabled and selectable.

Definition at line 144 of file mailviewmodel.cpp.

void MailViewModel::refresh (  ) 

Emits the dataChanged signal to the views to inform they about changed data

Definition at line 149 of file mailviewmodel.cpp.

void MailViewModel::sort ( int  column,
Qt::SortOrder  order = Qt::AscendingOrder 
)

Sorts the model by column in the given order.

Parameters:
column column to sort
order sort order

Definition at line 157 of file mailviewmodel.cpp.

void MailViewModel::sort (  ) 

Sorts the model by the last sort properties.

Definition at line 240 of file mailviewmodel.cpp.

Mail MailViewModel::getMail ( const QModelIndex  index  )  const

Returns the mail at the given index

Parameters:
index index

Definition at line 245 of file mailviewmodel.cpp.

QStringList MailViewModel::getSelectedSubjects ( QItemSelectionModel *  selectModel  )  const

Returns the subjects of the selected mails.

Parameters:
selectModel mail select model
Returns:
mail subjects

Definition at line 250 of file mailviewmodel.cpp.

QStringList MailViewModel::getSelectedSenders ( QItemSelectionModel *  selectModel  )  const

Returns the senders of the selected mails.

Parameters:
selectModel mail select model
Returns:
mail senders

Definition at line 276 of file mailviewmodel.cpp.

QList< Mail > MailViewModel::getSelectedMails ( QItemSelectionModel *  mailSelectModel  )  const

Returns the selected mails.

Parameters:
mailSelectModel selection model of the mail view
Returns:
selected mails

Definition at line 302 of file mailviewmodel.cpp.

QModelIndexList MailViewModel::getMarkedMails (  )  const

Returns the indexes of mails which are marked by filter.

Returns:
indexes of mails marked by filter

Definition at line 326 of file mailviewmodel.cpp.

void MailViewModel::saveSetup (  ) 

Saves the setup

Definition at line 348 of file mailviewmodel.cpp.


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

Generated on Tue May 18 19:43:53 2010 for KShowmail by  doxygen 1.5.6