Commit f49af7f5 authored by eekkelund's avatar eekkelund

[AppLauncher] Add removing from folder. Add folder destruction if less than 2 items in folder

parent 36070da9
...@@ -94,7 +94,7 @@ Item { ...@@ -94,7 +94,7 @@ Item {
id: folderLoader id: folderLoader
property Item reorderItem property Item reorderItem
property bool isRootFolder:false property bool isRootFolder:false
cacheBuffer: gridview.contentHeight cacheBuffer: folderLoader.contentHeight
parent: gridview.contentItem parent: gridview.contentItem
y: wrapper.y + wrapper.width y: wrapper.y + wrapper.width
x: 0 x: 0
...@@ -109,7 +109,7 @@ Item { ...@@ -109,7 +109,7 @@ Item {
width: parent.width width: parent.width
height: parent.height height: parent.height
opacity: 0.85 opacity: 0.85
color: "white" color: triangle.color
radius: Theme.itemSpacingMedium radius: Theme.itemSpacingMedium
z: -1 z: -1
} }
......
...@@ -51,7 +51,7 @@ MouseArea { ...@@ -51,7 +51,7 @@ MouseArea {
onYChanged: moved() onYChanged: moved()
drag.minimumX: parentItem.contentItem.x - width/2 drag.minimumX: parentItem.contentItem.x - width/2
drag.maximumX: parentItem.contentItem.width + width/2 drag.maximumX: parentItem.contentItem.width + width/2
drag.minimumY: parentItem.contentItem.y -height/2 drag.minimumY: parentItem.contentItem.y -height/2 -height/4
drag.maximumY: parentItem.contentItem.height +height/2 drag.maximumY: parentItem.contentItem.height +height/2
onClicked: { onClicked: {
...@@ -83,8 +83,8 @@ MouseArea { ...@@ -83,8 +83,8 @@ MouseArea {
onReleased: { onReleased: {
if (reordering) { if (reordering) {
reorderEnded()
reordering = false reordering = false
reorderEnded()
reorderTimer.stop() reorderTimer.stop()
drag.target = null drag.target = null
reorderItem = null reorderItem = null
...@@ -165,6 +165,12 @@ MouseArea { ...@@ -165,6 +165,12 @@ MouseArea {
folderIndex = -1 folderIndex = -1
newFolderActive = false newFolderActive = false
} }
//To drop appicon out of the folder
var realY = parseInt(parentItem.mapFromItem(launcherItem, 0, 0).y) + parseInt(((launcherItem.height*launcherItem.scale-launcherItem.height)/2).toFixed(2))
if (!parent.isRootFolder && (realY < -Math.abs(launcherItem.height/2) || realY > parentItem.height)) {
var parentFolderIndex = folderModel.parentFolder.indexOf(folderModel)
folderModel.parentFolder.moveToFolder(modelData.object, folderModel.parentFolder, parentFolderIndex+1)
}
} }
Timer { Timer {
...@@ -195,7 +201,19 @@ MouseArea { ...@@ -195,7 +201,19 @@ MouseArea {
NumberAnimation { target: launcherItem; property: "y"; to: wrapper.y; duration: 130; easing.type: Easing.OutQuint } NumberAnimation { target: launcherItem; property: "y"; to: wrapper.y; duration: 130; easing.type: Easing.OutQuint }
} }
Connections {
target: modelData.object
ignoreUnknownSignals: true
onItemRemoved: {
var modelDataObject = modelData.object
//If there is only one item in folder, remove the folder
if (modelDataObject.itemCount === 1) {
var parentFolderIndex = modelDataObject.parentFolder.indexOf(modelDataObject)
modelDataObject.parentFolder.moveToFolder(modelDataObject.get(0), modelDataObject.parentFolder, parentFolderIndex)
modelDataObject.destroyFolder()
}
}
}
Item { Item {
id: iconWrapper id: iconWrapper
......
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