Members of the KDE Community are recommended to subscribe to the kde-community mailing list at https://mail.kde.org/mailman/listinfo/kde-community to allow them to participate in important discussions and receive other important announcements

Commit e73ae4f1 authored by Kai Uwe Broulik's avatar Kai Uwe Broulik 🍇

[Image Wallpaper] Allow dropping images and folders into config dialog

This allows adding images (for image wallpaper) and folders (for slideshow) by dragging them into the list of images/folder.

Differential Revision: https://phabricator.kde.org/D6568
parent 28d86ab4
......@@ -27,6 +27,7 @@ import org.kde.plasma.core 2.0 as Plasmacore
import org.kde.plasma.wallpapers.image 2.0 as Wallpaper
import org.kde.kquickcontrolsaddons 2.0
import org.kde.kconfig 1.0 // for KAuthorized
import org.kde.draganddrop 2.0 as DragDrop
ColumnLayout {
id: root
......@@ -326,10 +327,32 @@ ColumnLayout {
}
}
Loader {
DragDrop.DropArea {
Layout.fillWidth: true
Layout.fillHeight: true
sourceComponent: (configDialog.currentWallpaper == "org.kde.image") ? thumbnailsComponent : foldersComponent
onDragEnter: {
if (!event.mimeData.hasUrls) {
event.ignore();
}
}
onDrop: {
event.mimeData.urls.forEach(function (url) {
if (url.indexOf("file://") === 0) {
var path = url.substr(7); // 7 is length of "file://"
if (configDialog.currentWallpaper === "org.kde.image") {
imageWallpaper.addUsersWallpaper(path);
} else {
imageWallpaper.addSlidePath(path);
}
}
});
}
Loader {
anchors.fill: parent
sourceComponent: (configDialog.currentWallpaper == "org.kde.image") ? thumbnailsComponent : foldersComponent
}
}
RowLayout {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment