2022-08-28 21:48:51 +00:00
|
|
|
/*
|
|
|
|
SPDX-FileCopyrightText: 2014-2015 Eike Hein <hein@kde.org>
|
|
|
|
|
|
|
|
SPDX-License-Identifier: GPL-2.0-or-later
|
|
|
|
*/
|
|
|
|
|
2024-08-09 01:20:25 +00:00
|
|
|
import QtQuick 2.15
|
2022-08-28 21:48:51 +00:00
|
|
|
|
2024-08-09 01:20:25 +00:00
|
|
|
import org.kde.plasma.plasmoid 2.0
|
|
|
|
import org.kde.plasma.core as PlasmaCore
|
|
|
|
import org.kde.kirigami 2.20 as Kirigami
|
2022-08-28 21:48:51 +00:00
|
|
|
|
|
|
|
import org.kde.private.desktopcontainment.folder 0.1 as Folder
|
|
|
|
|
|
|
|
Folder.SubDialog {
|
|
|
|
id: dialog
|
|
|
|
|
|
|
|
visible: false
|
|
|
|
|
|
|
|
property bool containsDrag: {
|
|
|
|
if (folderViewDropArea.containsDrag) {
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
|
|
|
|
if (folderView.hoveredItem && folderView.hoveredItem.popupDialog) {
|
|
|
|
return folderView.hoveredItem.popupDialog.containsDrag;
|
|
|
|
}
|
|
|
|
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
|
|
|
|
property QtObject closeTimer: closeTimer
|
2024-08-09 01:20:25 +00:00
|
|
|
property QtObject childDialog: (folderView.hoveredItem !== null) ? folderView.hoveredItem.popupDialog : null
|
|
|
|
property bool containsMouse: folderView.containsMouse || (childDialog !== null && childDialog.containsMouse)
|
2022-08-28 21:48:51 +00:00
|
|
|
|
|
|
|
property alias url: folderView.url
|
|
|
|
|
|
|
|
location: PlasmaCore.Types.Floating
|
2024-08-09 01:20:25 +00:00
|
|
|
hideOnWindowDeactivate: (childDialog === null)
|
2022-08-28 21:48:51 +00:00
|
|
|
|
|
|
|
onContainsMouseChanged: {
|
|
|
|
if (containsMouse) {
|
|
|
|
closeTimer.stop();
|
|
|
|
} else {
|
|
|
|
closeTimer.start();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
mainItem: FolderViewDropArea {
|
|
|
|
id: folderViewDropArea
|
|
|
|
|
2024-08-09 01:20:25 +00:00
|
|
|
width: folderView.cellWidth * 3 + Kirigami.Units.iconSizes.small // FIXME HACK: Use actual scrollbar width.
|
2022-08-28 21:48:51 +00:00
|
|
|
height: folderView.cellHeight * 2
|
|
|
|
|
|
|
|
folderView: folderView
|
|
|
|
|
|
|
|
FolderView {
|
|
|
|
id: folderView
|
|
|
|
|
|
|
|
anchors.fill: parent
|
|
|
|
|
|
|
|
isRootView: false
|
|
|
|
dialog: dialog
|
|
|
|
|
|
|
|
locked: true
|
|
|
|
|
2024-08-09 01:20:25 +00:00
|
|
|
sortMode: ((Plasmoid.configuration.sortMode === 0) ? 1 : Plasmoid.configuration.sortMode)
|
2022-08-28 21:48:51 +00:00
|
|
|
filterMode: 0
|
|
|
|
|
|
|
|
// TODO: Bidi.
|
2024-08-09 01:20:25 +00:00
|
|
|
flow: GridView.FlowLeftToRight
|
2022-08-28 21:48:51 +00:00
|
|
|
layoutDirection: Qt.LeftToRight
|
|
|
|
|
|
|
|
onDragInProgressAnywhereChanged: {
|
|
|
|
if (!dragInProgressAnywhere && !dialog.visible) {
|
|
|
|
dialog.destroy();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
data: [
|
|
|
|
Timer {
|
|
|
|
id: closeTimer
|
|
|
|
|
2024-08-09 01:20:25 +00:00
|
|
|
interval: Kirigami.Units.longDuration * 2
|
2022-08-28 21:48:51 +00:00
|
|
|
|
|
|
|
onTriggered: {
|
2024-08-09 01:20:25 +00:00
|
|
|
if (childDialog !== null) {
|
2022-08-28 21:48:51 +00:00
|
|
|
childDialog.closeTimer.stop();
|
|
|
|
childDialog.visible = false;
|
|
|
|
}
|
|
|
|
|
|
|
|
dialog.visible = false;
|
|
|
|
delayedDestroy();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
]
|
|
|
|
|
|
|
|
function requestDestroy() {
|
|
|
|
if (folderView.dragInProgressAnywhere) {
|
|
|
|
visible = false;
|
|
|
|
} else {
|
|
|
|
destroy();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
function delayedDestroy() {
|
2024-08-09 01:20:25 +00:00
|
|
|
Qt.callLater(() => itemDialog.destroy());
|
2022-08-28 21:48:51 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
Component.onDestruction: {
|
|
|
|
closeTimer.stop();
|
|
|
|
}
|
|
|
|
}
|