mirror of
https://invent.kde.org/marcoa/shift-shell.git
synced 2026-04-26 14:23:09 +00:00
respect max favorite count when dropping
This commit is contained in:
parent
e01cf0b6a2
commit
ed91354960
1 changed files with 12 additions and 1 deletions
|
|
@ -218,11 +218,16 @@ Item {
|
|||
|
||||
onDragEnter: {
|
||||
event.accept(event.proposedAction);
|
||||
launcherDragManager.active = true;
|
||||
}
|
||||
onDragMove: {
|
||||
let posInFavorites = favoriteStrip.mapFromItem(this, event.x, event.y);
|
||||
if (posInFavorites.y > 0) {
|
||||
launcherDragManager.showSpacerAtPos(event.x, event.y, favoriteStrip);
|
||||
if (plasmoid.nativeInterface.applicationListModel.favoriteCount >= plasmoid.nativeInterface.applicationListModel.maxFavoriteCount ) {
|
||||
launcherDragManager.hideSpacer();
|
||||
} else {
|
||||
launcherDragManager.showSpacerAtPos(event.x, event.y, favoriteStrip);
|
||||
}
|
||||
appletsLayout.hidePlaceHolder();
|
||||
} else {
|
||||
appletsLayout.showPlaceHolderAt(
|
||||
|
|
@ -237,16 +242,22 @@ Item {
|
|||
|
||||
onDragLeave: {
|
||||
appletsLayout.hidePlaceHolder();
|
||||
launcherDragManager.active = false;
|
||||
}
|
||||
|
||||
preventStealing: true
|
||||
|
||||
onDrop: {
|
||||
launcherDragManager.active = false;
|
||||
if (event.mimeData.formats[0] === "text/x-plasma-phone-homescreen-launcher") {
|
||||
let storageId = event.mimeData.getDataAsByteArray("text/x-plasma-phone-homescreen-launcher");
|
||||
|
||||
let posInFavorites = favoriteStrip.flow.mapFromItem(this, event.x, event.y);
|
||||
if (posInFavorites.y > 0) {
|
||||
if (plasmoid.nativeInterface.applicationListModel.favoriteCount >= plasmoid.nativeInterface.applicationListModel.maxFavoriteCount ) {
|
||||
return;
|
||||
}
|
||||
|
||||
plasmoid.nativeInterface.applicationListModel.addFavorite(storageId, 0, ApplicationListModel.Favorites)
|
||||
let item = launcherRepeater.itemAt(0);
|
||||
|
||||
|
|
|
|||
Loading…
Reference in a new issue