Changeset View
Changeset View
Standalone View
Standalone View
src/incidenceattachmentmodel.cpp
Show First 20 Lines • Show All 193 Lines • ▼ Show 20 Line(s) | 188 | { | |||
---|---|---|---|---|---|
194 | KCalCore::Attachment::Ptr attachment = d->m_incidence->attachments().at(index.row()); | 194 | KCalCore::Attachment::Ptr attachment = d->m_incidence->attachments().at(index.row()); | ||
195 | switch (role) { | 195 | switch (role) { | ||
196 | case Qt::DisplayRole: | 196 | case Qt::DisplayRole: | ||
197 | return attachment->label(); | 197 | return attachment->label(); | ||
198 | case AttachmentDataRole: | 198 | case AttachmentDataRole: | ||
199 | return attachment->decodedData(); | 199 | return attachment->decodedData(); | ||
200 | case MimeTypeRole: | 200 | case MimeTypeRole: | ||
201 | return attachment->mimeType(); | 201 | return attachment->mimeType(); | ||
202 | case AttachmentUrl: | | |||
203 | return d->m_incidence->writeAttachmentToTempFile(attachment); | | |||
204 | } | 202 | } | ||
205 | return QVariant(); | 203 | return QVariant(); | ||
206 | } | 204 | } | ||
207 | 205 | | |||
208 | QVariant IncidenceAttachmentModel::headerData(int section, Qt::Orientation orientation, | 206 | QVariant IncidenceAttachmentModel::headerData(int section, Qt::Orientation orientation, | ||
209 | int role) const | 207 | int role) const | ||
210 | { | 208 | { | ||
211 | return QAbstractItemModel::headerData(section, orientation, role); | 209 | return QAbstractItemModel::headerData(section, orientation, role); | ||
212 | } | 210 | } | ||
213 | 211 | | |||
214 | QHash<int, QByteArray> CalendarSupport::IncidenceAttachmentModel::roleNames() const | 212 | QHash<int, QByteArray> CalendarSupport::IncidenceAttachmentModel::roleNames() const | ||
215 | { | 213 | { | ||
216 | QHash<int, QByteArray> roleNames = QAbstractListModel::roleNames(); | 214 | QHash<int, QByteArray> roleNames = QAbstractListModel::roleNames(); | ||
217 | roleNames.insert(IncidenceAttachmentModel::MimeTypeRole, "mimeType"); | 215 | roleNames.insert(IncidenceAttachmentModel::MimeTypeRole, "mimeType"); | ||
218 | roleNames.insert(IncidenceAttachmentModel::AttachmentUrl, "attachmentUrl"); | | |||
219 | return roleNames; | 216 | return roleNames; | ||
220 | } | 217 | } | ||
221 | 218 | | |||
222 | #include "moc_incidenceattachmentmodel.cpp" | 219 | #include "moc_incidenceattachmentmodel.cpp" |