mirror of
https://github.com/KDE/latte-dock.git
synced 2025-03-09 00:58:15 +03:00
plasmoid:move launchers actions to relevant ability
This commit is contained in:
parent
8556cc4808
commit
37588abf84
@ -678,7 +678,7 @@ PlasmaComponents.ContextMenu {
|
||||
}
|
||||
|
||||
PlasmaComponents.MenuItem {
|
||||
visible: (plasmoid.configuration.groupingStrategy != 0) && menu.visualParent.m.IsWindow === true
|
||||
visible: (plasmoid.configuration.groupingStrategy !== 0) && menu.visualParent.m.IsWindow === true
|
||||
|
||||
checkable: true
|
||||
checked: menu.visualParent && menu.visualParent.m.IsGroupable === true
|
||||
@ -717,29 +717,10 @@ PlasmaComponents.ContextMenu {
|
||||
icon: "window-pin"
|
||||
|
||||
onClicked: {
|
||||
if (tasksModel.launcherPosition(get(atm.LauncherUrlWithoutIcon)) != -1) {
|
||||
var launcher = get(atm.LauncherUrl);
|
||||
|
||||
if (latteView && !launchers.inUniqueGroup()) {
|
||||
latteView.layoutsManager.launchersSignals.removeLauncher(root.viewLayoutName,
|
||||
launchers.group,
|
||||
launcher);
|
||||
} else {
|
||||
root.launcherForRemoval = launcher;
|
||||
tasksModel.requestRemoveLauncher(launcher);
|
||||
root.launchersUpdatedFor(launcher);
|
||||
}
|
||||
|
||||
if (tasksModel.launcherPosition(get(atm.LauncherUrlWithoutIcon)) !== -1) {
|
||||
launchers.removeLauncher(get(atm.LauncherUrl));
|
||||
} else {
|
||||
var launcher = get(atm.LauncherUrl);
|
||||
if (latteView && !launchers.inUniqueGroup()) {
|
||||
latteView.layoutsManager.launchersSignals.addLauncher(root.viewLayoutName,
|
||||
launchers.group,
|
||||
launcher);
|
||||
} else {
|
||||
tasksModel.requestAddLauncher(launcher);
|
||||
root.launchersUpdatedFor(launcher);
|
||||
}
|
||||
launchers.addLauncher(get(atm.LauncherUrl))
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -782,32 +763,9 @@ PlasmaComponents.ContextMenu {
|
||||
result.clicked.connect(
|
||||
function() {
|
||||
if (result.checked) {
|
||||
if (latteView && !launchers.inUniqueGroup()) {
|
||||
latteView.layoutsManager.launchersSignals.addLauncherToActivity(root.viewLayoutName,
|
||||
launchers.group,
|
||||
url,
|
||||
id);
|
||||
} else {
|
||||
if (id !== tasksModel.activity && (activities[0] === "00000000-0000-0000-0000-000000000000")) {
|
||||
root.launcherForRemoval = url;
|
||||
}
|
||||
|
||||
tasksModel.requestAddLauncherToActivity(url, id);
|
||||
root.launchersUpdatedFor(url);
|
||||
}
|
||||
launchers.addLauncherToActivity(url,id);
|
||||
} else {
|
||||
if (latteView && !launchers.inUniqueGroup()) {
|
||||
latteView.layoutsManager.launchersSignals.removeLauncherFromActivity(root.viewLayoutName,
|
||||
launchers.group,
|
||||
url,
|
||||
id);
|
||||
} else {
|
||||
if (id === tasksModel.activity) {
|
||||
root.launcherForRemoval = url;
|
||||
}
|
||||
tasksModel.requestRemoveLauncherFromActivity(url, id);
|
||||
root.launchersUpdatedFor(url);
|
||||
}
|
||||
launchers.removeLauncherFromActivity(url, id);
|
||||
}
|
||||
}
|
||||
);
|
||||
@ -855,17 +813,7 @@ PlasmaComponents.ContextMenu {
|
||||
icon: "window-unpin"
|
||||
|
||||
onClicked: {
|
||||
var launcher = get(atm.LauncherUrlWithoutIcon);
|
||||
|
||||
if (latteView && !launchers.inUniqueGroup()) {
|
||||
latteView.layoutsManager.launchersSignals.removeLauncher(root.viewLayoutName,
|
||||
launchers.group,
|
||||
launcher);
|
||||
} else {
|
||||
root.launcherForRemoval = launcher
|
||||
tasksModel.requestRemoveLauncher(launcher);
|
||||
root.launchersUpdatedFor(launcher);
|
||||
}
|
||||
launchers.removeLauncher(get(atm.LauncherUrlWithoutIcon));
|
||||
}
|
||||
}
|
||||
|
||||
@ -899,17 +847,7 @@ PlasmaComponents.ContextMenu {
|
||||
enabled: (root.indexer.separators.length > 0) && visualParent && visualParent.isSeparator
|
||||
|
||||
onClicked: {
|
||||
var launcher = get(atm.LauncherUrlWithoutIcon);
|
||||
|
||||
if (latteView && !launchers.inUniqueGroup()) {
|
||||
latteView.layoutsManager.launchersSignals.removeLauncher(root.viewLayoutName,
|
||||
launchers.group,
|
||||
launcher);
|
||||
} else {
|
||||
root.launcherForRemoval = launcher;
|
||||
tasksModel.requestRemoveLauncher(launcher);
|
||||
root.launchersUpdatedFor(launcher);
|
||||
}
|
||||
launchers.removeLauncher(get(atm.LauncherUrlWithoutIcon));
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -27,8 +27,12 @@ import "launchers" as LaunchersPart
|
||||
|
||||
Item {
|
||||
id: _launchers
|
||||
signal launcherChanged(string launcherUrl);
|
||||
|
||||
property int group: LatteCore.Types.UniqueLaunchers
|
||||
property Item bridge: null
|
||||
property Item layout: null
|
||||
|
||||
property QtObject tasksModel: null
|
||||
|
||||
readonly property LaunchersPart.Actions actions: LaunchersPart.Actions{}
|
||||
@ -81,8 +85,62 @@ Item {
|
||||
return _launchers.tasksModel.launcherPosition(url) != -1;
|
||||
}
|
||||
|
||||
function inCurrentActivity(url) {
|
||||
var activities = _launchers.tasksModel.launcherActivities(url);
|
||||
function addLauncher(launcherUrl) {
|
||||
if (latteView && !inUniqueGroup()) {
|
||||
latteView.layoutsManager.launchersSignals.addLauncher(root.viewLayoutName,
|
||||
launchers.group,
|
||||
launcherUrl);
|
||||
} else {
|
||||
_launchers.tasksModel.requestAddLauncher(launcherUrl);
|
||||
_launchers.launcherChanged(launcherUrl);
|
||||
}
|
||||
}
|
||||
|
||||
function removeLauncher(launcherUrl) {
|
||||
if (latteView && !inUniqueGroup()) {
|
||||
latteView.layoutsManager.launchersSignals.removeLauncher(root.viewLayoutName,
|
||||
launchers.group,
|
||||
launcherUrl);
|
||||
} else {
|
||||
root.launcherForRemoval = launcherUrl;
|
||||
_launchers.tasksModel.requestRemoveLauncher(launcherUrl);
|
||||
_launchers.launcherChanged(launcherUrl);
|
||||
}
|
||||
}
|
||||
|
||||
function addLauncherToActivity(launcherUrl, activityId) {
|
||||
if (latteView && !inUniqueGroup()) {
|
||||
latteView.layoutsManager.launchersSignals.addLauncherToActivity(root.viewLayoutName,
|
||||
launchers.group,
|
||||
launcherUrl,
|
||||
activityId);
|
||||
} else {
|
||||
if (activityId !== activityInfo.currentActivity && isOnAllActivities(launcherUrl)) {
|
||||
root.launcherForRemoval = url;
|
||||
}
|
||||
|
||||
_launchers.tasksModel.requestAddLauncherToActivity(launcherUrl, activityId);
|
||||
_launchers.launcherChanged(launcherUrl);
|
||||
}
|
||||
}
|
||||
|
||||
function removeLauncherFromActivity(launcherUrl, activityId) {
|
||||
if (latteView && !inUniqueGroup()) {
|
||||
latteView.layoutsManager.launchersSignals.removeLauncherFromActivity(root.viewLayoutName,
|
||||
launchers.group,
|
||||
launcherUrl,
|
||||
activityId);
|
||||
} else {
|
||||
if (activityId === activityInfo.currentActivity) {
|
||||
root.launcherForRemoval = launcherUrl;
|
||||
}
|
||||
_launchers.tasksModel.requestRemoveLauncherFromActivity(launcherUrl, activityId);
|
||||
_launchers.launcherChanged(launcherUrl);
|
||||
}
|
||||
}
|
||||
|
||||
function inCurrentActivity(launcherUrl) {
|
||||
var activities = _launchers.tasksModel.launcherActivities(launcherUrl);
|
||||
|
||||
var NULL_UUID = "00000000-0000-0000-0000-000000000000";
|
||||
|
||||
@ -93,6 +151,12 @@ Item {
|
||||
return false;
|
||||
}
|
||||
|
||||
function isOnAllActivities(launcherUrl) {
|
||||
var activities = _launchers.tasksModel.launcherActivities(url);
|
||||
var NULL_UUID = "00000000-0000-0000-0000-000000000000";
|
||||
return (activities.indexOf(NULL_UUID) >= 0)
|
||||
}
|
||||
|
||||
function childAtLayoutIndex(position) {
|
||||
var tasks = layout.children;
|
||||
|
||||
|
@ -26,4 +26,5 @@ import org.kde.latte.core 0.2 as LatteCore
|
||||
Item {
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
@ -247,7 +247,6 @@ Item {
|
||||
|
||||
signal draggingFinished();
|
||||
signal hiddenTasksUpdated();
|
||||
signal launchersUpdatedFor(string launcher);
|
||||
signal presentWindows(variant winIds);
|
||||
signal requestLayout;
|
||||
signal signalPreviewsShown();
|
||||
@ -834,6 +833,7 @@ Item {
|
||||
|
||||
Ability.Launchers {
|
||||
id: _launchers
|
||||
bridge: latteBridge
|
||||
group: plasmoid.configuration.launchersGroup
|
||||
layout: icList.contentItem
|
||||
tasksModel: tasksModel
|
||||
@ -1436,7 +1436,7 @@ Item {
|
||||
function extSignalAddLauncher(group, launcher) {
|
||||
if (group === launchers.group) {
|
||||
tasksModel.requestAddLauncher(launcher);
|
||||
launchersUpdatedFor(launcher);
|
||||
launchers.launcherChanged(launcher);
|
||||
tasksModel.syncLaunchers();
|
||||
}
|
||||
}
|
||||
@ -1445,7 +1445,7 @@ Item {
|
||||
if (group === launchers.group) {
|
||||
root.launcherForRemoval = launcher;
|
||||
tasksModel.requestRemoveLauncher(launcher);
|
||||
launchersUpdatedFor(launcher);
|
||||
launchers.launcherChanged(launcher);
|
||||
tasksModel.syncLaunchers();
|
||||
}
|
||||
}
|
||||
@ -1459,7 +1459,7 @@ Item {
|
||||
}
|
||||
|
||||
tasksModel.requestAddLauncherToActivity(launcher, activity);
|
||||
launchersUpdatedFor(launcher);
|
||||
launchers.launcherChanged(launcher);
|
||||
tasksModel.syncLaunchers();
|
||||
}
|
||||
}
|
||||
@ -1471,7 +1471,7 @@ Item {
|
||||
}
|
||||
|
||||
tasksModel.requestRemoveLauncherFromActivity(launcher, activity);
|
||||
launchersUpdatedFor(launcher);
|
||||
launchers.launcherChanged(launcher);
|
||||
tasksModel.syncLaunchers();
|
||||
}
|
||||
}
|
||||
@ -1560,7 +1560,7 @@ Item {
|
||||
tasksExtendedManager.addToBeAddedLauncher(filename);
|
||||
|
||||
tasksModel.requestAddLauncher(url);
|
||||
launchersUpdatedFor(url);
|
||||
launchers.launcherChanged(launcher);
|
||||
tasksModel.syncLaunchers();
|
||||
}
|
||||
|
||||
|
@ -1374,7 +1374,7 @@ MouseArea{
|
||||
}
|
||||
}
|
||||
|
||||
function slotLaunchersChangedFor(launcher) {
|
||||
function onLauncherChanged(launcher) {
|
||||
if ((root.showWindowsOnlyFromLaunchers || root.disableAllWindowsFunctionality) && launcher === launcherUrl) {
|
||||
updateVisibilityBasedOnLaunchers()
|
||||
}
|
||||
@ -1508,8 +1508,8 @@ MouseArea{
|
||||
root.publishTasksGeometries.connect(slotPublishGeometries);
|
||||
root.showPreviewForTasks.connect(slotShowPreviewForTasks);
|
||||
root.mimicEnterForParabolic.connect(slotMimicEnterForParabolic);
|
||||
root.launchersUpdatedFor.connect(slotLaunchersChangedFor);
|
||||
|
||||
launchers.launcherChanged.connect(onLauncherChanged);
|
||||
parabolic.sglClearZoom.connect(sltClearZoom);
|
||||
|
||||
var hasShownLauncher = ((tasksModel.launcherPosition(taskItem.launcherUrl) !== -1)
|
||||
@ -1539,8 +1539,8 @@ MouseArea{
|
||||
root.publishTasksGeometries.disconnect(slotPublishGeometries);
|
||||
root.showPreviewForTasks.disconnect(slotShowPreviewForTasks);
|
||||
root.mimicEnterForParabolic.disconnect(slotMimicEnterForParabolic);
|
||||
root.launchersUpdatedFor.disconnect(slotLaunchersChangedFor);
|
||||
|
||||
launchers.launcherChanged.disconnect(onLauncherChanged);
|
||||
parabolic.sglClearZoom.disconnect(sltClearZoom);
|
||||
|
||||
tasksExtendedManager.waitingLauncherRemoved.disconnect(slotWaitingLauncherRemoved);
|
||||
|
Loading…
x
Reference in New Issue
Block a user