#include <mailviewmodel.h>
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 () |
getMail (const QModelIndex index) const | |
QStringList | getSelectedSubjects (QItemSelectionModel *selectModel) const |
QStringList | getSelectedSenders (QItemSelectionModel *selectModel) const |
QList< Mail > | getSelectedMails (QItemSelectionModel *mailSelectModel) const |
QModelIndexList | getMarkedMails () const |
void | saveSetup () |
Definition at line 44 of file mailviewmodel.h.
MailViewModel::MailViewModel | ( | AccountList * | accounts, | |
QObject * | parent | |||
) |
Constructor
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.
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
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.
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.
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
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
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.
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
index | index |
Definition at line 245 of file mailviewmodel.cpp.
QStringList MailViewModel::getSelectedSubjects | ( | QItemSelectionModel * | selectModel | ) | const |
Returns the subjects of the selected mails.
selectModel | mail select model |
Definition at line 250 of file mailviewmodel.cpp.
QStringList MailViewModel::getSelectedSenders | ( | QItemSelectionModel * | selectModel | ) | const |
Returns the senders of the selected mails.
selectModel | mail select model |
Definition at line 276 of file mailviewmodel.cpp.
QList< Mail > MailViewModel::getSelectedMails | ( | QItemSelectionModel * | mailSelectModel | ) | const |
Returns the selected mails.
mailSelectModel | selection model of the mail view |
Definition at line 302 of file mailviewmodel.cpp.
QModelIndexList MailViewModel::getMarkedMails | ( | ) | const |
Returns the indexes of mails which are 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.