Model for the mail view. More...
#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 () |
void | loadSetup () |
Private Attributes | |
AccountList * | accounts |
QList< Mail > | viewMailList |
KIcon | picNewMail |
KIcon | picSenderOnWhitelist |
Qt::SortOrder | lastSortOrder |
int | lastSortColumn |
SenderListFilter | senderlist |
Black and White lists. |
Model for the mail view.
Definition at line 44 of file mailviewmodel.h.
MailViewModel::MailViewModel | ( | AccountList * | accounts, | |
QObject * | parent | |||
) |
Constructor
accounts | pointer to the account list
|
Definition at line 20 of file mailviewmodel.cpp.
MailViewModel::~MailViewModel | ( | ) | [virtual] |
Destructor
Definition at line 30 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 54 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
|
Definition at line 59 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 169 of file mailviewmodel.cpp.
Mail MailViewModel::getMail | ( | const QModelIndex | index | ) | const |
Returns the mail at the given index
index | index |
Definition at line 270 of file mailviewmodel.cpp.
QModelIndexList MailViewModel::getMarkedMails | ( | ) | const |
Returns the indexes of mails which are marked by filter.
Definition at line 351 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 327 of file mailviewmodel.cpp.
QStringList MailViewModel::getSelectedSenders | ( | QItemSelectionModel * | selectModel | ) | const |
Returns the senders of the selected mails.
selectModel | mail select model
|
Definition at line 301 of file mailviewmodel.cpp.
QStringList MailViewModel::getSelectedSubjects | ( | QItemSelectionModel * | selectModel | ) | const |
Returns the subjects of the selected mails.
selectModel | mail select model
|
Definition at line 275 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 139 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
|
Definition at line 148 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
|
Definition at line 32 of file mailviewmodel.cpp.
void MailViewModel::loadSetup | ( | ) |
Loads the setup
Definition at line 391 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 41 of file mailviewmodel.cpp.
void MailViewModel::refresh | ( | ) |
Emits the dataChanged signal to the views to inform they about changed data
Definition at line 174 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 46 of file mailviewmodel.cpp.
void MailViewModel::saveSetup | ( | ) |
Saves the setup
Definition at line 373 of file mailviewmodel.cpp.
void MailViewModel::sort | ( | ) |
Sorts the model by the last sort properties.
Definition at line 265 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
|
Definition at line 182 of file mailviewmodel.cpp.
AccountList* MailViewModel::accounts [private] |
Pointer to the account list
Definition at line 190 of file mailviewmodel.h.
int MailViewModel::lastSortColumn [private] |
last sort column
Definition at line 215 of file mailviewmodel.h.
Qt::SortOrder MailViewModel::lastSortOrder [private] |
Last sort order
Definition at line 210 of file mailviewmodel.h.
KIcon MailViewModel::picNewMail [private] |
Icon for a new mail
Definition at line 200 of file mailviewmodel.h.
KIcon MailViewModel::picSenderOnWhitelist [private] |
Icon for a sender which is listed on the whitelist
Definition at line 205 of file mailviewmodel.h.
SenderListFilter MailViewModel::senderlist [private] |
Black and White lists.
This is to whether a sender is listed on the whitelist
Definition at line 222 of file mailviewmodel.h.
QList<Mail> MailViewModel::viewMailList [private] |
In this we store the pointer to the mails
Definition at line 195 of file mailviewmodel.h.