Changeset View
Changeset View
Standalone View
Standalone View
wallpapers/image/slidemodel.cpp
Show All 36 Lines | |||||
37 | } | 37 | } | ||
38 | 38 | | |||
39 | void SlideModel::removeBackgrounds(const QStringList &paths, const QString &token) | 39 | void SlideModel::removeBackgrounds(const QStringList &paths, const QString &token) | ||
40 | { | 40 | { | ||
41 | Q_FOREACH (const QString &file, paths) { | 41 | Q_FOREACH (const QString &file, paths) { | ||
42 | removeBackground(file); | 42 | removeBackground(file); | ||
43 | } | 43 | } | ||
44 | } | 44 | } | ||
45 | | ||||
46 | QVariant SlideModel::data(const QModelIndex& index, int role) const | ||||
47 | { | ||||
48 | if (role == ToggleRole) { | ||||
49 | return !m_wallpaper.data()->uncheckedSlides().contains(data(index, PathRole).toString()); | ||||
50 | } | ||||
51 | return BackgroundListModel::data(index, role); | ||||
52 | } | ||||
53 | | ||||
54 | QHash<int, QByteArray> SlideModel::roleNames() const | ||||
55 | { | ||||
56 | QHash<int, QByteArray> roleNames = BackgroundListModel::roleNames(); | ||||
57 | roleNames.insert(ToggleRole, "checked"); | ||||
58 | return roleNames; | ||||
59 | } |