[graphics/koko] src/qml: Add FileDropArea for sidebar and navigator

Oliver Beard <[email protected]>
Newsgroups gmane.comp.kde.cvs
Message-ID <[email protected]>
Git commit c6b43e649790ba94ab60e91ada28c785c205d059 by Oliver Beard.
Committed on 30/07/2026 at 15:13.
Pushed by olib into branch 'master'.

Add FileDropArea for sidebar and navigator

`highlighted` is set for all on `containsDrag`. Unfortunately, the navigator `ToolButton`s do not change appearance.

M  +10   -1    src/qml/Sidebar.qml
M  +20   -0    src/qml/gallery/NavigatorComponent.qml

https://invent.kde.org/graphics/koko/-/commit/c6b43e649790ba94ab60e91ada28c785c205d059

diff --git a/src/qml/Sidebar.qml b/src/qml/Sidebar.qml
index 5e86a1f1..01ad0c45 100644
--- a/src/qml/Sidebar.qml
+++ b/src/qml/Sidebar.qml
@@ -171,7 +171,7 @@ Kirigami.OverlayDrawer {
                     AC.ActionCollection.action: item.actionName
                     enabled: root.mainWindow.pageStack.layers.depth === 1
                 }
-                highlighted: checked || down
+                highlighted: checked || down || fileDropArea.containsDrag
                 // automatically unchecks when another is checked,
                 // but don't assume that its impossible to uncheck all
                 autoExclusive: true
@@ -186,6 +186,15 @@ Kirigami.OverlayDrawer {
                 //         item.checked = checked ? checked : Qt.binding(() => item.shouldBeChecked)
                 //     }
                 // }
+
+                Koko.FileDropArea {
+                    id: fileDropArea
+                    anchors.fill: parent
+
+                    window: Window.window
+                    rootUrl: enabled ? action.fromQAction.data.path : ""
+                    enabled: action.fromQAction.data.modelType === Koko.NavigationActions.FolderModel
+                }
             }
 
             ColumnLayout {
diff --git a/src/qml/gallery/NavigatorComponent.qml b/src/qml/gallery/NavigatorComponent.qml
index 648701c3..5f7f8a42 100644
--- a/src/qml/gallery/NavigatorComponent.qml
+++ b/src/qml/gallery/NavigatorComponent.qml
@@ -246,6 +246,16 @@ RowLayout {
                 Controls.ToolTip.text: text
                 Controls.ToolTip.visible: hovered && (width < implicitWidth) && text.length > 0
                 Controls.ToolTip.delay: Kirigami.Units.toolTipDelay
+
+                Koko.FileDropArea {
+                    id: rootFileDropArea
+                    anchors.fill: parent
+
+                    window: Window.window
+                    rootUrl: enabled ? navigatorRootButton.rootLocations[navigatorRootButton.rootLocation].path : ""
+                    enabled: navigatorRoot.isUrlNavigator
+                }
+                highlighted: rootFileDropArea.containsDrag
             }
 
             Repeater {
@@ -289,6 +299,16 @@ RowLayout {
                         Controls.ToolTip.text: text
                         Controls.ToolTip.visible: hovered && (width < implicitWidth) && text.length > 0
                         Controls.ToolTip.delay: Kirigami.Units.toolTipDelay
+
+                        Koko.FileDropArea {
+                            id: delegateFileDropArea
+                            anchors.fill: parent
+
+                            window: Window.window
+                            rootUrl: enabled ? Koko.DirModelUtils.partialUrlForIndex(root.path, navigatorDelegate.index + 1) : ""
+                            enabled: navigatorRoot.isUrlNavigator
+                        }
+                        highlighted: delegateFileDropArea.containsDrag
                     }
                 }
             }
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.