mirror of
https://github.com/KDE/latte-dock.git
synced 2025-03-09 00:58:15 +03:00
fix #118,support dragging a file at windows group
This commit is contained in:
parent
8af7e78cd8
commit
45fb9466a5
@ -178,6 +178,7 @@ Item {
|
||||
}
|
||||
|
||||
if (parent.hoveredItem.m.IsGroupParent === true) {
|
||||
root.showPreviewForTasks(parent.hoveredItem);
|
||||
// groupDialog.visualParent = parent.hoveredItem;
|
||||
// groupDialog.visible = true;
|
||||
} else if (parent.hoveredItem.m.IsLauncher !== true) {
|
||||
|
@ -857,8 +857,6 @@ MouseArea{
|
||||
}
|
||||
///window previews////
|
||||
|
||||
|
||||
|
||||
function modelIndex(){
|
||||
return tasksModel.makeModelIndex(index);
|
||||
}
|
||||
@ -867,6 +865,13 @@ MouseArea{
|
||||
inBlockingAnimation = value;
|
||||
}
|
||||
|
||||
function slotShowPreviewForTasks(group) {
|
||||
if (group === mainItemContainer) {
|
||||
preparePreviewWindow();
|
||||
windowsPreviewDlg.show();
|
||||
}
|
||||
}
|
||||
|
||||
function slotPublishGeometries() {
|
||||
if ((isWindow || isStartup || isGroupParent) && tasksModel) {
|
||||
tasksModel.requestPublishDelegateGeometry(mainItemContainer.modelIndex(),
|
||||
@ -890,6 +895,7 @@ MouseArea{
|
||||
root.draggingFinished.connect(handlerDraggingFinished);
|
||||
root.clearZoomSignal.connect(clearZoom);
|
||||
root.publishTasksGeometries.connect(slotPublishGeometries);
|
||||
root.showPreviewForTasks.connect(slotShowPreviewForTasks);
|
||||
|
||||
//fix wrong positioning of launchers....
|
||||
for(var i=0; i<tasksModel.launcherList.length; ++i){
|
||||
|
@ -25,6 +25,8 @@ import QtQuick.Layouts 1.1
|
||||
import QtGraphicalEffects 1.0
|
||||
import QtQml.Models 2.2
|
||||
|
||||
import org.kde.draganddrop 2.0
|
||||
|
||||
import org.kde.plasma.core 2.0 as PlasmaCore
|
||||
import org.kde.plasma.components 2.0 as PlasmaComponents
|
||||
import org.kde.plasma.extras 2.0 as PlasmaExtras
|
||||
@ -107,6 +109,31 @@ PlasmaExtras.ScrollArea {
|
||||
return singleTask.containsMouse() || groupTask.containsMouse();
|
||||
}
|
||||
|
||||
DropArea {
|
||||
id: dropMainArea
|
||||
anchors.fill: contentItem
|
||||
enabled: isGroup
|
||||
|
||||
preventStealing: true
|
||||
|
||||
property bool dragInside: false
|
||||
|
||||
property QtObject currentWindow
|
||||
|
||||
onDragLeave: {
|
||||
windowsPreviewDlg.hide();
|
||||
}
|
||||
|
||||
onDragMove: {
|
||||
var current = groupTask.childAtPos(event.x, event.y);
|
||||
|
||||
if (current && currentWindow !== current && current.submodelIndex) {
|
||||
currentWindow = current;
|
||||
tasksModel.requestActivate(current.submodelIndex);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
ToolTipInstance {
|
||||
id: singleTask
|
||||
visible: !isGroup
|
||||
@ -138,6 +165,28 @@ PlasmaExtras.ScrollArea {
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
function childAtPos(x, y){
|
||||
var tasks = groupTask.children;
|
||||
|
||||
for(var i=0; i<tasks.length; ++i){
|
||||
var task = tasks[i];
|
||||
|
||||
var choords = contentItem.mapFromItem(task,0, 0);
|
||||
|
||||
if(choords.y < 0)
|
||||
choords.y = 0;
|
||||
if(choords.x < 0)
|
||||
choords.x = 0;
|
||||
|
||||
if( (x>=choords.x) && (x<=choords.x+task.width)
|
||||
&& (y>=choords.y) && (y<=choords.y+task.height)){
|
||||
return task;
|
||||
}
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -30,6 +30,8 @@ import org.kde.plasma.components 2.0 as PlasmaComponents
|
||||
import org.kde.plasma.extras 2.0 as PlasmaExtras
|
||||
import org.kde.kquickcontrolsaddons 2.0 as KQuickControlsAddons
|
||||
|
||||
import org.kde.draganddrop 2.0
|
||||
|
||||
import org.kde.taskmanager 0.1 as TaskManager
|
||||
|
||||
Column {
|
||||
|
@ -134,6 +134,7 @@ Item {
|
||||
signal signalAnimationsNeedLength(int value);
|
||||
signal signalAnimationsNeedThickness(int value);
|
||||
signal signalDraggingState(bool value);
|
||||
signal showPreviewForTasks(QtObject group);
|
||||
//trigger updating scaling of neighbour delegates of zoomed delegate
|
||||
signal updateScale(int delegateIndex, real newScale, real step)
|
||||
signal publishTasksGeometries();
|
||||
|
Loading…
x
Reference in New Issue
Block a user