1
0
mirror of https://github.com/KDE/latte-dock.git synced 2025-01-12 01:17:55 +03:00

plasmoid:launchers ability new signals

--do not use TasksExtendedManager to launchers
plasmoid ability
This commit is contained in:
Michail Vourlakos 2021-01-10 09:33:19 +02:00
parent 315568909b
commit 4689412a13
4 changed files with 23 additions and 12 deletions

View File

@ -341,6 +341,15 @@ Item {
console.log("TO BE MOVED LAUNCHERS ::: " + tbmLaunchers);
}
//! Connections
Connections {
target: launchers
onLauncherInRemoving: {
addToBeRemovedLauncher(launcherUrl);
}
}
//!Trying to avoid a binding loop in TaskItem for modelLauncherUrl
Timer {
id: launchersToBeMovedTimer

View File

@ -28,6 +28,8 @@ import "launchers" as LaunchersPart
Item {
id: _launchers
signal launcherChanged(string launcherUrl);
signal launcherRemoved(string launcherUrl);
signal launcherInRemoving(string launcherUrl);
property int group: LatteCore.Types.UniqueLaunchers
property Item bridge: null
@ -104,9 +106,9 @@ Item {
launchers.group,
launcherUrl);
} else {
tasksExtendedManager.addToBeRemovedLauncher(launcherUrl);
_launchers.launcherInRemoving(launcherUrl);
_launchers.tasksModel.requestRemoveLauncher(launcherUrl);
_launchers.launcherChanged(launcherUrl);
_launchers.launcherRemoved(launcherUrl);
}
}
@ -118,7 +120,7 @@ Item {
activityId);
} else {
if (activityId !== activityInfo.currentActivity && isOnAllActivities(launcherUrl)) {
tasksExtendedManager.addToBeRemovedLauncher(launcherUrl);
_launchers.launcherInRemoving(launcherUrl);
}
_launchers.tasksModel.requestAddLauncherToActivity(launcherUrl, activityId);
@ -134,7 +136,7 @@ Item {
activityId);
} else {
if (activityId === activityInfo.currentActivity) {
tasksExtendedManager.addToBeRemovedLauncher(launcherUrl);
_launchers.launcherInRemoving(launcherUrl);
}
_launchers.tasksModel.requestRemoveLauncherFromActivity(launcherUrl, activityId);
_launchers.launcherChanged(launcherUrl);
@ -152,7 +154,7 @@ Item {
}
function isOnAllActivities(launcherUrl) {
var activities = _launchers.tasksModel.launcherActivities(url);
var activities = _launchers.tasksModel.launcherActivities(launcherUrl);
return (activities.indexOf(_NULLACTIVITYID_) >= 0)
}

View File

@ -1440,7 +1440,7 @@ Item {
function extSignalRemoveLauncher(group, launcher) {
if (group === launchers.group) {
tasksExtendedManager.addToBeRemovedLauncher(launcher);
launchers.launcherInRemoving(launcher)
tasksModel.requestRemoveLauncher(launcher);
launchers.launcherChanged(launcher);
tasksModel.syncLaunchers();
@ -1449,10 +1449,8 @@ Item {
function extSignalAddLauncherToActivity(group, launcher, activity) {
if (group === launchers.group) {
var launcherActivities = tasksModel.launcherActivities(launcher);
if (activity !== tasksModel.activity && (launcherActivities[0] === "00000000-0000-0000-0000-000000000000")) {
tasksExtendedManager.addToBeRemovedLauncher(launcher);
if (activity !== activityInfo.currentActivity && _launchers.isOnAllActivities(launcher)) {
launchers.launcherInRemoving(launcher);
}
tasksModel.requestAddLauncherToActivity(launcher, activity);
@ -1463,8 +1461,8 @@ Item {
function extSignalRemoveLauncherFromActivity(group, launcher, activity) {
if (group === launchers.group) {
if (activity === tasksModel.activity) {
tasksExtendedManager.addToBeRemovedLauncher(launcher);
if ( activity === activityInfo.currentActivity) {
launchers.launcherInRemoving(launcher)
}
tasksModel.requestRemoveLauncherFromActivity(launcher, activity);

View File

@ -1510,6 +1510,7 @@ MouseArea{
root.mimicEnterForParabolic.connect(slotMimicEnterForParabolic);
launchers.launcherChanged.connect(onLauncherChanged);
launchers.launcherRemoved.connect(onLauncherChanged);
parabolic.sglClearZoom.connect(sltClearZoom);
var hasShownLauncher = ((tasksModel.launcherPosition(taskItem.launcherUrl) !== -1)
@ -1541,6 +1542,7 @@ MouseArea{
root.mimicEnterForParabolic.disconnect(slotMimicEnterForParabolic);
launchers.launcherChanged.disconnect(onLauncherChanged);
launchers.launcherRemoved.disconnect(onLauncherChanged);
parabolic.sglClearZoom.disconnect(sltClearZoom);
tasksExtendedManager.waitingLauncherRemoved.disconnect(slotWaitingLauncherRemoved);