KPeople
19 #include "emaillistmodel.h"
25 EmailListModel::EmailListModel(QObject *parent) : QAbstractListModel(parent)
29 int EmailListModel::rowCount(
const QModelIndex &parent)
const
32 return emailList.count();
35 QVariant EmailListModel::data(const QModelIndex &index,
int role)
const
38 if (!index.isValid()) {
42 EmailItem mail = emailList.at(index.row());
46 if (mail.subject ==
"") {
47 mail.subject = i18n(
"No Subject");
49 mail.subject.replace(
'\n',
' ');
53 mail.body.replace(
'\n',
' ');
57 return KGlobal::locale()->formatDateTime(mail.date.dateTime(), KLocale::FancyShortDate);
62 void EmailListModel::addEmail(
const EmailItem &mail)
64 beginInsertRows(QModelIndex(), emailList.count(), emailList.count());
69 QUrl EmailListModel::getItemUrl(
int row)
71 return emailList.at(row).url;
This file is part of the KDE documentation.
Documentation copyright © 1996-2015 The KDE developers.
Generated on Fri Feb 13 2015 15:16:39 by
doxygen 1.8.9.1 written
by
Dimitri van Heesch, © 1997-2006
KDE's Doxygen guidelines are available online.