Changeset View
Changeset View
Standalone View
Standalone View
src/iconthemesmodel.cpp
Show All 26 Lines | |||||
27 | #include <QSet> | 27 | #include <QSet> | ||
28 | #include <KIconTheme> | 28 | #include <KIconTheme> | ||
29 | #include <QStandardPaths> | 29 | #include <QStandardPaths> | ||
30 | 30 | | |||
31 | IconThemesModel::IconThemesModel(bool onlyHome, QObject* parent) | 31 | IconThemesModel::IconThemesModel(bool onlyHome, QObject* parent) | ||
32 | : QStandardItemModel(parent) | 32 | : QStandardItemModel(parent) | ||
33 | , m_onlyHome(onlyHome) | 33 | , m_onlyHome(onlyHome) | ||
34 | { | 34 | { | ||
35 | setSortRole(Qt::DisplayRole); | | |||
36 | reload(); | 35 | reload(); | ||
37 | } | 36 | } | ||
38 | 37 | | |||
39 | QList<QDir> IconThemesModel::installedThemesPaths() | 38 | QList<QDir> IconThemesModel::installedThemesPaths() | ||
40 | { | 39 | { | ||
41 | QList<QDir> availableIcons; | 40 | QList<QDir> availableIcons; | ||
42 | 41 | | |||
43 | QSet<QString> dirs; | 42 | QSet<QString> dirs; | ||
▲ Show 20 Lines • Show All 80 Lines • ▼ Show 20 Line(s) | 106 | // qWarning() << "invalid theme" << dir.dirName(); | |||
124 | if (iconName.isEmpty()) | 123 | if (iconName.isEmpty()) | ||
125 | iconName = QStringLiteral("folder"); | 124 | iconName = QStringLiteral("folder"); | ||
126 | 125 | | |||
127 | QString path = theme.iconPathByName(iconName, 16, KIconLoader::MatchBest); | 126 | QString path = theme.iconPathByName(iconName, 16, KIconLoader::MatchBest); | ||
128 | item->setIcon(QIcon(path)); | 127 | item->setIcon(QIcon(path)); | ||
129 | 128 | | |||
130 | appendRow(item); | 129 | appendRow(item); | ||
131 | } | 130 | } | ||
132 | sort(0); | | |||
133 | } | 131 | } |