mirror of
https://invent.kde.org/marcoa/shift-shell.git
synced 2026-07-26 14:24:45 +00:00
fix halcyon pinned model
This commit is contained in:
parent
3b0cf51810
commit
1d46f88e6e
2 changed files with 10 additions and 11 deletions
|
|
@ -56,11 +56,6 @@ MobileShell.GridView {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
Halcyon.PinnedModel {
|
|
||||||
id: pinnedModel
|
|
||||||
applet: plasmoid.nativeInterface
|
|
||||||
}
|
|
||||||
|
|
||||||
// open wallpaper menu when held on click
|
// open wallpaper menu when held on click
|
||||||
TapHandler {
|
TapHandler {
|
||||||
onLongPressed: root.openConfigureRequested()
|
onLongPressed: root.openConfigureRequested()
|
||||||
|
|
@ -82,7 +77,7 @@ MobileShell.GridView {
|
||||||
|
|
||||||
model: DelegateModel {
|
model: DelegateModel {
|
||||||
id: visualModel
|
id: visualModel
|
||||||
model: pinnedModel
|
model: Halcyon.PinnedModel
|
||||||
|
|
||||||
delegate: Item {
|
delegate: Item {
|
||||||
id: delegateRoot
|
id: delegateRoot
|
||||||
|
|
@ -94,7 +89,7 @@ MobileShell.GridView {
|
||||||
function moveDragToCurrentPos(from, to) {
|
function moveDragToCurrentPos(from, to) {
|
||||||
if (from !== to) {
|
if (from !== to) {
|
||||||
visualModel.items.move(from, to);
|
visualModel.items.move(from, to);
|
||||||
pinnedModel.moveEntry(from, to);
|
Halcyon.PinnedModel.moveEntry(from, to);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -196,9 +191,9 @@ MobileShell.GridView {
|
||||||
onDropped: (drop) => {
|
onDropped: (drop) => {
|
||||||
if (transitionAnim.running || appDelegate.drag.active || drag.source.isFolder) 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) {
|
||||||
pinnedModel.addAppToFolder(drop.source.visualIndex, appDelegate.visualIndex);
|
Halcyon.PinnedModel.addAppToFolder(drop.source.visualIndex, appDelegate.visualIndex);
|
||||||
} else {
|
} else {
|
||||||
pinnedModel.createFolderFromApps(drop.source.visualIndex, appDelegate.visualIndex);
|
Halcyon.PinnedModel.createFolderFromApps(drop.source.visualIndex, appDelegate.visualIndex);
|
||||||
}
|
}
|
||||||
folderAnim.to = 0;
|
folderAnim.to = 0;
|
||||||
folderAnim.restart();
|
folderAnim.restart();
|
||||||
|
|
@ -227,7 +222,7 @@ MobileShell.GridView {
|
||||||
Kirigami.Action {
|
Kirigami.Action {
|
||||||
iconName: "emblem-favorite"
|
iconName: "emblem-favorite"
|
||||||
text: i18n("Remove from favourites")
|
text: i18n("Remove from favourites")
|
||||||
onTriggered: pinnedModel.removeEntry(model.index)
|
onTriggered: Halcyon.PinnedModel.removeEntry(model.index)
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -19,7 +19,11 @@ void HalcyonPlugin::registerTypes(const char *uri)
|
||||||
return applicationListModel;
|
return applicationListModel;
|
||||||
});
|
});
|
||||||
|
|
||||||
qmlRegisterType<PinnedModel>(uri, 1, 0, "PinnedModel");
|
PinnedModel *pinnedModel = new PinnedModel{this};
|
||||||
|
qmlRegisterSingletonType<PinnedModel>(uri, 1, 0, "PinnedModel", [pinnedModel](QQmlEngine *, QJSEngine *) -> QObject * {
|
||||||
|
return pinnedModel;
|
||||||
|
});
|
||||||
|
|
||||||
qmlRegisterType<Application>(uri, 1, 0, "Application");
|
qmlRegisterType<Application>(uri, 1, 0, "Application");
|
||||||
qmlRegisterType<ApplicationFolder>(uri, 1, 0, "ApplicationFolder");
|
qmlRegisterType<ApplicationFolder>(uri, 1, 0, "ApplicationFolder");
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue