Changeset View
Changeset View
Standalone View
Standalone View
containments/desktop/plugins/folder/mimetypesmodel.cpp
Show All 36 Lines | |||||
37 | 37 | | |||
38 | MimeTypesModel::~MimeTypesModel() | 38 | MimeTypesModel::~MimeTypesModel() | ||
39 | { | 39 | { | ||
40 | } | 40 | } | ||
41 | 41 | | |||
42 | QHash<int, QByteArray> MimeTypesModel::roleNames() const | 42 | QHash<int, QByteArray> MimeTypesModel::roleNames() const | ||
43 | { | 43 | { | ||
44 | return { | 44 | return { | ||
45 | { Qt::DisplayRole, "display" }, | 45 | { Qt::DisplayRole, "comment" }, | ||
46 | { Qt::UserRole, "name" }, | ||||
46 | { Qt::DecorationRole, "decoration" }, | 47 | { Qt::DecorationRole, "decoration" }, | ||
47 | { Qt::CheckStateRole, "checked" } | 48 | { Qt::CheckStateRole, "checked" } | ||
48 | }; | 49 | }; | ||
49 | } | 50 | } | ||
50 | 51 | | |||
51 | QVariant MimeTypesModel::data(const QModelIndex &index, int role) const | 52 | QVariant MimeTypesModel::data(const QModelIndex &index, int role) const | ||
52 | { | 53 | { | ||
53 | if (index.row() < 0 || index.row() >= m_mimeTypesList.size()) { | 54 | if (index.row() < 0 || index.row() >= m_mimeTypesList.size()) { | ||
54 | return QVariant(); | 55 | return QVariant(); | ||
55 | } | 56 | } | ||
56 | 57 | | |||
57 | switch (role) { | 58 | switch (role) { | ||
58 | case Qt::DisplayRole: | 59 | case Qt::DisplayRole: | ||
60 | return m_mimeTypesList.at(index.row()).comment(); | ||||
61 | case Qt::UserRole: | ||||
59 | return m_mimeTypesList.at(index.row()).name(); | 62 | return m_mimeTypesList.at(index.row()).name(); | ||
60 | 63 | | |||
61 | case Qt::DecorationRole: | 64 | case Qt::DecorationRole: | ||
62 | { | 65 | { | ||
63 | QString icon = m_mimeTypesList.at(index.row()).iconName(); | 66 | QString icon = m_mimeTypesList.at(index.row()).iconName(); | ||
64 | 67 | | |||
65 | if (icon.isEmpty()) { | 68 | if (icon.isEmpty()) { | ||
66 | icon = m_mimeTypesList.at(index.row()).genericIconName(); | 69 | icon = m_mimeTypesList.at(index.row()).genericIconName(); | ||
▲ Show 20 Lines • Show All 83 Lines • Show Last 20 Lines |