mirror of
https://invent.kde.org/marcoa/shift-shell.git
synced 2026-08-03 18:24:46 +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: {
|
onDragEnter: {
|
||||||
event.accept(event.proposedAction);
|
event.accept(event.proposedAction);
|
||||||
|
launcherDragManager.active = true;
|
||||||
}
|
}
|
||||||
onDragMove: {
|
onDragMove: {
|
||||||
let posInFavorites = favoriteStrip.mapFromItem(this, event.x, event.y);
|
let posInFavorites = favoriteStrip.mapFromItem(this, event.x, event.y);
|
||||||
if (posInFavorites.y > 0) {
|
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();
|
appletsLayout.hidePlaceHolder();
|
||||||
} else {
|
} else {
|
||||||
appletsLayout.showPlaceHolderAt(
|
appletsLayout.showPlaceHolderAt(
|
||||||
|
|
@ -237,16 +242,22 @@ Item {
|
||||||
|
|
||||||
onDragLeave: {
|
onDragLeave: {
|
||||||
appletsLayout.hidePlaceHolder();
|
appletsLayout.hidePlaceHolder();
|
||||||
|
launcherDragManager.active = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
preventStealing: true
|
preventStealing: true
|
||||||
|
|
||||||
onDrop: {
|
onDrop: {
|
||||||
|
launcherDragManager.active = false;
|
||||||
if (event.mimeData.formats[0] === "text/x-plasma-phone-homescreen-launcher") {
|
if (event.mimeData.formats[0] === "text/x-plasma-phone-homescreen-launcher") {
|
||||||
let storageId = event.mimeData.getDataAsByteArray("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);
|
let posInFavorites = favoriteStrip.flow.mapFromItem(this, event.x, event.y);
|
||||||
if (posInFavorites.y > 0) {
|
if (posInFavorites.y > 0) {
|
||||||
|
if (plasmoid.nativeInterface.applicationListModel.favoriteCount >= plasmoid.nativeInterface.applicationListModel.maxFavoriteCount ) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
plasmoid.nativeInterface.applicationListModel.addFavorite(storageId, 0, ApplicationListModel.Favorites)
|
plasmoid.nativeInterface.applicationListModel.addFavorite(storageId, 0, ApplicationListModel.Favorites)
|
||||||
let item = launcherRepeater.itemAt(0);
|
let item = launcherRepeater.itemAt(0);
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue