Changeset View
Changeset View
Standalone View
Standalone View
wallpapers/image/imagepackage/contents/ui/WallpaperDelegate.qml
Show All 13 Lines | |||||
14 | * | 14 | * | ||
15 | * You should have received a copy of the GNU General Public License | 15 | * You should have received a copy of the GNU General Public License | ||
16 | * along with this program; if not, write to the Free Software | 16 | * along with this program; if not, write to the Free Software | ||
17 | * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 2.010-1301, USA. | 17 | * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 2.010-1301, USA. | ||
18 | */ | 18 | */ | ||
19 | 19 | | |||
20 | import QtQuick 2.0 | 20 | import QtQuick 2.0 | ||
21 | import QtQuick.Controls.Private 1.0 | 21 | import QtQuick.Controls.Private 1.0 | ||
22 | import QtQuick.Controls 2.3 as QtControls2 | ||||
22 | import QtGraphicalEffects 1.0 | 23 | import QtGraphicalEffects 1.0 | ||
23 | import org.kde.kquickcontrolsaddons 2.0 | 24 | import org.kde.kquickcontrolsaddons 2.0 | ||
24 | import org.kde.plasma.components 2.0 as PlasmaComponents | 25 | import org.kde.plasma.components 2.0 as PlasmaComponents | ||
25 | import org.kde.kirigami 2.4 as Kirigami | 26 | import org.kde.kirigami 2.4 as Kirigami | ||
26 | import org.kde.kcm 1.1 as KCM | 27 | import org.kde.kcm 1.1 as KCM | ||
27 | 28 | | |||
28 | KCM.GridDelegate { | 29 | KCM.GridDelegate { | ||
29 | id: wallpaperDelegate | 30 | id: wallpaperDelegate | ||
30 | 31 | | |||
31 | | ||||
32 | property alias color: backgroundRect.color | 32 | property alias color: backgroundRect.color | ||
33 | property bool selected: (wallpapersGrid.currentIndex == index) | 33 | property bool selected: (wallpapersGrid.currentIndex == index) | ||
34 | opacity: model.pendingDeletion ? 0.5 : 1 | 34 | opacity: model.pendingDeletion ? 0.5 : 1 | ||
35 | 35 | | |||
36 | text: model.display | 36 | text: model.display | ||
37 | 37 | | |||
38 | toolTip: model.author.length > 0 ? i18ndc("plasma_wallpaper_org.kde.image", "<image> by <author>", "By %1", model.author) : "" | 38 | toolTip: model.author.length > 0 ? i18ndc("plasma_wallpaper_org.kde.image", "<image> by <author>", "By %1", model.author) : "" | ||
39 | 39 | | |||
40 | hoverEnabled: true | 40 | hoverEnabled: true | ||
ngraham: I just realized: setting this to false when in slideshow mode is a quick way to make them non… | |||||
That doesn't work - they're still selectable but now we don't get the "open containing folder" action on hover davidre: That doesn't work - they're still selectable but now we don't get the "open containing folder"… | |||||
41 | 41 | | |||
42 | actions: [ | 42 | actions: [ | ||
43 | Kirigami.Action { | 43 | Kirigami.Action { | ||
44 | icon.name: "document-open-folder" | 44 | icon.name: "document-open-folder" | ||
45 | tooltip: i18nd("plasma_wallpaper_org.kde.image", "Open Containing Folder") | 45 | tooltip: i18nd("plasma_wallpaper_org.kde.image", "Open Containing Folder") | ||
46 | onTriggered: imageWallpaper.wallpaperModel.openContainingFolder(index) | 46 | onTriggered: imageModel.openContainingFolder(index) | ||
47 | }, | 47 | }, | ||
48 | Kirigami.Action { | 48 | Kirigami.Action { | ||
49 | icon.name: "edit-undo" | 49 | icon.name: "edit-undo" | ||
50 | visible: model.pendingDeletion | 50 | visible: model.pendingDeletion | ||
51 | tooltip: i18nd("plasma_wallpaper_org.kde.image", "Restore wallpaper") | 51 | tooltip: i18nd("plasma_wallpaper_org.kde.image", "Restore wallpaper") | ||
52 | onTriggered: imageWallpaper.wallpaperModel.setPendingDeletion(index, !model.pendingDeletion) | 52 | onTriggered: imageModel.setPendingDeletion(index, !model.pendingDeletion) | ||
53 | }, | 53 | }, | ||
54 | Kirigami.Action { | 54 | Kirigami.Action { | ||
55 | icon.name: "edit-delete" | 55 | icon.name: "edit-delete" | ||
56 | tooltip: i18nd("plasma_wallpaper_org.kde.image", "Remove Wallpaper") | 56 | tooltip: i18nd("plasma_wallpaper_org.kde.image", "Remove Wallpaper") | ||
57 | visible: model.removable && !model.pendingDeletion | 57 | visible: model.removable && !model.pendingDeletion && configDialog.currentWallpaper == "org.kde.image" | ||
58 | onTriggered: { | 58 | onTriggered: { | ||
59 | imageWallpaper.wallpaperModel.setPendingDeletion(index, true); | 59 | imageModel.setPendingDeletion(index, true); | ||
60 | if (wallpapersGrid.currentIndex === index) { | 60 | if (wallpapersGrid.currentIndex === index) { | ||
61 | wallpapersGrid.currentIndex = (index + 1) % wallpapersGrid.count; | 61 | wallpapersGrid.currentIndex = (index + 1) % wallpapersGrid.count; | ||
62 | } | 62 | } | ||
63 | } | 63 | } | ||
64 | } | 64 | } | ||
65 | ] | 65 | ] | ||
66 | 66 | | |||
67 | thumbnail: Rectangle { | 67 | thumbnail: Rectangle { | ||
▲ Show 20 Lines • Show All 58 Lines • Show Last 20 Lines |
I just realized: setting this to false when in slideshow mode is a quick way to make them non-selectable.