homescreens/halcyon: Fix entry removal for folders

This commit is contained in:
Devin Lin 2022-07-10 21:08:03 -04:00
parent 2c50d50440
commit 32bd414b9e
3 changed files with 7 additions and 5 deletions

View file

@ -40,6 +40,7 @@ Item {
readonly property string applicationIcon: application ? application.icon : "" readonly property string applicationIcon: application ? application.icon : ""
signal folderOpenRequested() signal folderOpenRequested()
signal removeRequested()
property alias drag: mouseArea.drag property alias drag: mouseArea.drag
Drag.active: delegate.drag.active Drag.active: delegate.drag.active
@ -101,9 +102,7 @@ Item {
PlasmaComponents.MenuItem { PlasmaComponents.MenuItem {
icon.name: "emblem-favorite" icon.name: "emblem-favorite"
text: i18n("Remove from favourites") text: i18n("Remove from favourites")
onClicked: { onClicked: delegate.removeRequested()
Halcyon.PinnedModel.removeEntry(model.index);
}
} }
onClosed: dialogLoader.active = false onClosed: dialogLoader.active = false
} }

View file

@ -177,7 +177,7 @@ MobileShell.GridView {
anchors.left: leftDropArea.right anchors.left: leftDropArea.right
anchors.right: rightDropArea.left anchors.right: rightDropArea.left
onEntered: (drag) => { onEntered: (drag) => {
if (transitionAnim.running || appDelegate.drag.active) return; // don't do anything when reordering if (transitionAnim.running || appDelegate.drag.active || drag.source.isFolder) return; // don't do anything when reordering
folderAnim.to = 1; folderAnim.to = 1;
folderAnim.restart(); folderAnim.restart();
} }
@ -186,7 +186,7 @@ MobileShell.GridView {
folderAnim.restart(); folderAnim.restart();
} }
onDropped: (drop) => { onDropped: (drop) => {
if (transitionAnim.running || appDelegate.drag.active) return; // don't do anything when reordering if (transitionAnim.running || appDelegate.drag.active || drag.source.isFolder) return; // don't do anything when reordering
if (appDelegate.isFolder) { if (appDelegate.isFolder) {
Halcyon.PinnedModel.addAppToFolder(drop.source.visualIndex, appDelegate.visualIndex); Halcyon.PinnedModel.addAppToFolder(drop.source.visualIndex, appDelegate.visualIndex);
} else { } else {
@ -214,6 +214,7 @@ MobileShell.GridView {
application: model.application application: model.application
onFolderOpenRequested: root.requestOpenFolder(model.folder) onFolderOpenRequested: root.requestOpenFolder(model.folder)
onRemoveRequested: Halcyon.PinnedModel.removeEntry(model.index);
readonly property bool isLeftColumn: !root.twoColumn || ((visualIndex % 2) === 0) readonly property bool isLeftColumn: !root.twoColumn || ((visualIndex % 2) === 0)
readonly property bool isRightColumn: !root.twoColumn || ((visualIndex % 2) !== 0) readonly property bool isRightColumn: !root.twoColumn || ((visualIndex % 2) !== 0)

View file

@ -123,6 +123,8 @@ MobileShell.GridView {
isFolder: false isFolder: false
application: modelData application: modelData
onRemoveRequested: root.folder.removeApp(model.index);
readonly property bool isLeftColumn: !root.twoColumn || ((visualIndex % 2) === 0) readonly property bool isLeftColumn: !root.twoColumn || ((visualIndex % 2) === 0)
readonly property bool isRightColumn: !root.twoColumn || ((visualIndex % 2) !== 0) readonly property bool isRightColumn: !root.twoColumn || ((visualIndex % 2) !== 0)
leftPadding: isLeftColumn ? root.leftMargin : 0 leftPadding: isLeftColumn ? root.leftMargin : 0