Commit 523c5e22 authored by Lamarque Souza's avatar Lamarque Souza
Browse files

Closes all delete activity dialogs if a new one has just been opened or

the ActivitySwitcher panel has just hidden itself.
Also move the delete activity dialog to above the delete button for all
cases. I had to set the z value of the current activity to 0 to prevent
its thumbnail from covering the delete dialog.

CCBUG: 288426
parent 5abf7c17
......@@ -29,6 +29,20 @@ Item {
z: PathView.z
property string current: model["Current"]
property int deleteDialogOpenedAtIndex: mainView.deleteDialogOpenedAtIndex
property int delegateIndex: index
onDeleteDialogOpenedAtIndexChanged: {
// if necessary close this ActivityDelegate's deleteDialog if a deleteDialog from another ActivityDelegate has been opened.
if (deleteDialogOpenedAtIndex != index && deleteButtonParent.confirmationDialog != null) {
deleteButtonParent.confirmationDialog.scale = 0
deleteButtonParent.confirmationDialog.destroy()
deleteButtonParent.confirmationDialog = null
// restore this ActivityDelegate's opacity to the value before this ActivityDelegate's deleteDialog had been opened.
deleteButton.checked = false
}
}
onCurrentChanged: {
//avoid to restart the timer if the current index is already correct
......@@ -52,7 +66,6 @@ Item {
y: delegate.PathView.itemYTranslate
}
PlasmaCore.FrameSvgItem {
id: activityBorder
imagePath: "widgets/media-delegate"
......@@ -169,17 +182,19 @@ Item {
}
if (toggle) {
// make dialog fully opaque if it is not already.
checked = true
// closes all other deleteDialogs from other ActivityDelegates.
delegate.parent.deleteDialogOpenedAtIndex = delegate.delegateIndex
deleteButtonParent.confirmationDialog = confirmationDialogComponent.createObject(deleteButtonParent)
deleteButtonParent.confirmationDialog.scale = 1 / delegate.scale
// scale does not change dialog's width so we need to anchor the confirmationDialog's center manually.
deleteButtonParent.confirmationDialog.x = deleteButton.x + deleteButton.width / 2 - deleteButtonParent.confirmationDialog.width * (1 / delegate.scale) / 2
if (delegate.PathView.itemScale == 1) { // activity at PathView's center, not necessary the current activity.
deleteButtonParent.confirmationDialog.anchors.bottom = deleteButton.top
} else {
deleteButtonParent.confirmationDialog.y = deleteButton.y - deleteButton.height / (3/2) * (1 / delegate.scale)
}
deleteButtonParent.confirmationDialog.anchors.bottom = deleteButton.top
}
}
......
......@@ -84,6 +84,9 @@ Item {
onTriggered: {
if (activitySwitcher.state == "Passive") {
mainView.currentIndex = pendingIndex
// close all opened deleteDialogs since ActivitySwitcher panel is now hidden.
mainView.deleteDialogOpenedAtIndex = -1
}
}
}
......@@ -121,7 +124,7 @@ Item {
flickDeceleration: 600
property int deleteDialogOpenedAtIndex: -1
delegate: ActivityDelegate{}
path: Path {
......@@ -154,7 +157,7 @@ Item {
PathAttribute { name: "itemXTranslate"; value: 0 }
PathAttribute { name: "itemYTranslate"; value: 0 }
PathAttribute { name: "itemScale"; value: 1 }
PathAttribute { name: "z"; value: 100 }
PathAttribute { name: "z"; value: 0 }
PathLine {
......
Supports Markdown
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