1
0
mirror of https://github.com/KDE/latte-dock.git synced 2025-03-09 00:58:15 +03:00

decouple dropping launchers in applet/containment

--all dropping launchers infrastructure has now decoupled
and can be used from any other applet in other to gain
such privileges
This commit is contained in:
Michail Vourlakos 2021-01-22 21:17:41 +02:00
parent 3680862138
commit 04b6909e66
16 changed files with 314 additions and 179 deletions

View File

@ -128,9 +128,6 @@
<entry name="smallAutomaticIconJumps" type="Bool">
<default>true</default>
</entry>
<entry name="addLaunchersInTaskManager" type="Bool">
<default>true</default>
</entry>
<entry name="backgroundOnlyOnMaximized" type="Bool">
<default>false</default>
</entry>
@ -452,5 +449,8 @@
</choices>
<default>0</default>
</entry>
<entry name="addLaunchersInTaskManager" type="Bool">
<default>true</default>
</entry>
</group>
</kcfg>

View File

@ -139,23 +139,11 @@ DragDrop.DropArea {
//! may not be triggered #408926
animations.needLength.addEvent(dragArea);
if (latteApplet && (dragInfo.onlyLaunchers || dragInfo.isSeparator || !dragInfo.isPlasmoid)) {
if (dragInfo.onlyLaunchers) {
var hoversLatteTasks = root.latteAppletContainer.containsPos(event);
root.addLaunchersMessage = root.addLaunchersInTaskManager || (!root.addLaunchersInTaskManager && hoversLatteTasks);
if (root.addLaunchersInTaskManager || hoversLatteTasks) {
dndSpacer.opacity = 0;
dndSpacer.parent = root;
return;
}
} else {
if ((dragInfo.isSeparator || !dragInfo.isPlasmoid) && root.latteAppletContainer.containsPos(event)) {
dndSpacer.opacity = 0;
dndSpacer.parent = root;
return;
}
}
if (root.launchers.hasStealingApplet && dragInfo.onlyLaunchers) {
root.launchers.showAddLaunchersMessageInStealingApplet();
dndSpacer.opacity = 0;
dndSpacer.parent = root;
return;
}
root.layoutManager().insertAtCoordinates2(dndSpacer, event.x, event.y)
@ -169,23 +157,11 @@ DragDrop.DropArea {
return;
}
if (latteApplet && (dragInfo.onlyLaunchers || dragInfo.isSeparator || !dragInfo.isPlasmoid)) {
if (dragInfo.onlyLaunchers) {
var hoversLatteTasks = root.latteAppletContainer.containsPos(event);
root.addLaunchersMessage = root.addLaunchersInTaskManager || (!root.addLaunchersInTaskManager && hoversLatteTasks);
if (root.addLaunchersInTaskManager || hoversLatteTasks) {
dndSpacer.opacity = 0;
dndSpacer.parent = root;
return;
}
} else {
if ((dragInfo.isSeparator || !dragInfo.isPlasmoid) && root.latteAppletContainer.containsPos(event)) {
dndSpacer.opacity = 0;
dndSpacer.parent = root;
return;
}
}
if (root.launchers.hasStealingApplet && dragInfo.onlyLaunchers) {
root.launchers.showAddLaunchersMessageInStealingApplet();
dndSpacer.opacity = 0;
dndSpacer.parent = root;
return;
}
root.layoutManager().insertAtCoordinates2(dndSpacer, event.x, event.y)
@ -195,7 +171,11 @@ DragDrop.DropArea {
onDragLeave: {
containsDrag = false;
animations.needLength.removeEvent(dragArea);
root.addLaunchersMessage = false;
if (root.launchers.hasStealingApplet) {
root.launchers.hideAddLaunchersMessageInStealingApplet();
}
dndSpacer.opacity = 0;
dndSpacer.parent = root;
}
@ -204,18 +184,21 @@ DragDrop.DropArea {
containsDrag = false;
animations.needLength.removeEvent(dragArea);
if (root.launchers.hasStealingApplet) {
root.launchers.hideAddLaunchersMessageInStealingApplet();
}
if (dragInfo.isTask || !root.myView.isShownFully) {
return;
}
if (latteApplet && dragInfo.onlyLaunchers && (root.addLaunchersInTaskManager || root.latteAppletContainer.containsPos(event))) {
latteApplet.launchersDropped(event.mimeData.urls);
if (root.launchers.hasStealingApplet && dragInfo.onlyLaunchers) {
root.launchers.addDroppedLaunchersInStealingApplet(event.mimeData.urls);
} else {
plasmoid.processMimeData(event.mimeData, event.x, event.y);
event.accept(event.proposedAction);
}
root.addLaunchersMessage = false;
dndSpacer.opacity = 0;
if (dragInfo.isPlasmoid && root.myView.alignment === LatteCore.Types.Justify) {

View File

@ -90,6 +90,7 @@ Item{
tasks.configuration.modifierClickAction = plasmoid.configuration.modifierClickAction;
tasks.configuration.modifier = plasmoid.configuration.modifier;
tasks.configuration.modifierClick = plasmoid.configuration.modifierClick;
tasks.configuration.isDroppedLauncherAddedOnlyInCurrentTasks = plasmoid.configuration.addLaunchersInTaskManager;
console.log("Migrating Tasks Applet for v0.10 succeeded ...");
plasmoid.configuration.tasksUpgraded = true;

View File

@ -20,7 +20,13 @@
import QtQuick 2.7
import org.kde.plasma.plasmoid 2.0
Item {
import "./privates" as Ability
Ability.LaunchersPrivate {
//! do not update during dragging/moving applets inConfigureAppletsMode
updateIsBlocked: (root.dragOverlay && root.dragOverlay.pressed)
|| layouter.appletsInParentChange
readonly property bool isReady: latteView && latteView.layout && universalSettings && root.layoutsManager !== null
readonly property bool isCapableOfLayoutLaunchers: latteView && latteView.layout
readonly property bool isCapableOfUniversalLaunchers: latteView && universalSettings
@ -77,6 +83,24 @@ Item {
orderedlaunchers);
}
function addDroppedLaunchersInStealingApplet(launchers) {
if (hasStealingApplet) {
appletStealingDroppedLaunchers.addDroppedLaunchers(launchers);
}
}
function showAddLaunchersMessageInStealingApplet() {
if (hasStealingApplet) {
appletStealingDroppedLaunchers.isShowingAddLaunchersMessage = true;
}
}
function hideAddLaunchersMessageInStealingApplet() {
if (hasStealingApplet) {
appletStealingDroppedLaunchers.isShowingAddLaunchersMessage = false;
}
}
function setLayoutLaunchers(launchers) {
if (isCapableOfLayoutLaunchers) {
latteView.layout.launchers = launchers;

View File

@ -0,0 +1,125 @@
/*
* Copyright 2021 Michail Vourlakos <mvourlakos@gmail.com>
*
* This file is part of Latte-Dock
*
* Latte-Dock is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License as
* published by the Free Software Foundation; either version 2 of
* the License, or (at your option) any later version.
*
* Latte-Dock is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
import QtQuick 2.7
Item {
id: _launchersprivate
property Item layouts: null
property bool updateIsBlocked: false
readonly property bool hasStealingApplet: appletStealingDroppedLaunchers !== null
property int appletIdStealingDroppedLaunchers: -1
property Item appletStealingDroppedLaunchers: null
signal currentAppletStealingDroppedLaunchers(int id);
Binding {
target: _launchersprivate
property: "appletIdStealingDroppedLaunchers"
when: !updateIsBlocked
value: {
var sLayout = layouts.startLayout;
for (var i=0; i<sLayout.children.length; ++i){
var appletItem = sLayout.children[i];
if (appletItem
&& appletItem.index>=0
&& appletItem.communicator
&& appletItem.communicator.launchersAreSupported
&& appletItem.communicator.bridge.launchers.client.isStealingDroppedLaunchers) {
return appletItem.index;
}
}
var mLayout = layouts.mainLayout;
for (var i=0; i<mLayout.children.length; ++i){
var appletItem = mLayout.children[i];
if (appletItem
&& appletItem.index>=0
&& appletItem.communicator
&& appletItem.communicator.launchersAreSupported
&& appletItem.communicator.bridge.launchers.client.isStealingDroppedLaunchers) {
return appletItem.index;
}
}
var eLayout = layouts.endLayout;
for (var i=0; i<eLayout.children.length; ++i){
var appletItem = eLayout.children[i];
if (appletItem
&& appletItem.index>=0
&& appletItem.communicator
&& appletItem.communicator.launchersAreSupported
&& appletItem.communicator.bridge.launchers.client.isStealingDroppedLaunchers) {
return appletItem.index;
}
}
return -1;
}
}
Binding {
target: _launchersprivate
property: "appletStealingDroppedLaunchers"
when: !updateIsBlocked
value: {
var sLayout = layouts.startLayout;
for (var i=0; i<sLayout.children.length; ++i){
var appletItem = sLayout.children[i];
if (appletItem
&& appletItem.index>=0
&& appletItem.communicator
&& appletItem.communicator.launchersAreSupported
&& appletItem.communicator.bridge.launchers.client.isStealingDroppedLaunchers) {
return appletItem.communicator.bridge.launchers.client;
}
}
var mLayout = layouts.mainLayout;
for (var i=0; i<mLayout.children.length; ++i){
var appletItem = mLayout.children[i];
if (appletItem
&& appletItem.index>=0
&& appletItem.communicator
&& appletItem.communicator.launchersAreSupported
&& appletItem.communicator.bridge.launchers.client.isStealingDroppedLaunchers) {
return appletItem.communicator.bridge.launchers.client;
}
}
var eLayout = layouts.endLayout;
for (var i=0; i<eLayout.children.length; ++i){
var appletItem = eLayout.children[i];
if (appletItem
&& appletItem.index>=0
&& appletItem.communicator
&& appletItem.communicator.launchersAreSupported
&& appletItem.communicator.bridge.launchers.client.isStealingDroppedLaunchers) {
return appletItem.communicator.bridge.launchers.client;
}
}
return null;
}
}
}

View File

@ -964,92 +964,6 @@ Item {
]
}
Loader {
id: addingAreaLoader
width: root.isHorizontal ? parent.width : parent.width - appletItem.metrics.margin.screenEdge
height: root.isHorizontal ? parent.height - appletItem.metrics.margin.screenEdge : parent.height
active: isLattePlasmoid
sourceComponent: LatteComponents.AddingArea{
id: addingAreaItem
anchors.fill: parent
// width: root.isHorizontal ? parent.width : parent.width - appletItem.metrics.margin.screenEdge
// height: root.isHorizontal ? parent.height - appletItem.metrics.margin.screenEdge : parent.height
radius: appletItem.metrics.iconSize/10
opacity: root.addLaunchersMessage ? 1 : 0
backgroundOpacity: 0.75
duration: appletItem.animations.speedFactor.current
title: i18n("Tasks Area")
}
//! AddingAreaItem States
states:[
State{
name: "bottom"
when: plasmoid.location === PlasmaCore.Types.BottomEdge
AnchorChanges{
target: addingAreaLoader
anchors.horizontalCenter: parent.horizontalCenter; anchors.verticalCenter: undefined;
anchors.right: undefined; anchors.left: undefined; anchors.top: undefined; anchors.bottom: parent.bottom;
}
PropertyChanges{
target: addingAreaLoader
anchors.leftMargin: 0; anchors.rightMargin: 0; anchors.topMargin:0; anchors.bottomMargin: appletItem.metrics.margin.screenEdge;
anchors.horizontalCenterOffset: 0; anchors.verticalCenterOffset: 0;
}
},
State{
name: "top"
when: plasmoid.location === PlasmaCore.Types.TopEdge
AnchorChanges{
target: addingAreaLoader
anchors.horizontalCenter: parent.horizontalCenter; anchors.verticalCenter: undefined;
anchors.right: undefined; anchors.left: undefined; anchors.top: parent.top; anchors.bottom: undefined;
}
PropertyChanges{
target: addingAreaLoader
anchors.leftMargin: 0; anchors.rightMargin: 0; anchors.topMargin: appletItem.metrics.margin.screenEdge; anchors.bottomMargin: 0;
anchors.horizontalCenterOffset: 0; anchors.verticalCenterOffset: 0;
}
},
State{
name: "left"
when: plasmoid.location === PlasmaCore.Types.LeftEdge
AnchorChanges{
target: addingAreaLoader
anchors.horizontalCenter: undefined; anchors.verticalCenter: parent.verticalCenter;
anchors.right: undefined; anchors.left: parent.left; anchors.top: undefined; anchors.bottom: undefined;
}
PropertyChanges{
target: addingAreaLoader
anchors.leftMargin: appletItem.metrics.margin.screenEdge; anchors.rightMargin: 0; anchors.topMargin:0; anchors.bottomMargin: 0;
anchors.horizontalCenterOffset: 0; anchors.verticalCenterOffset: 0;
}
},
State{
name: "right"
when: plasmoid.location === PlasmaCore.Types.RightEdge
AnchorChanges{
target: addingAreaLoader
anchors.horizontalCenter: undefined; anchors.verticalCenter: parent.verticalCenter;
anchors.right: parent.right; anchors.left: undefined; anchors.top: undefined; anchors.bottom: undefined;
}
PropertyChanges{
target: addingAreaLoader
anchors.leftMargin: 0; anchors.rightMargin: appletItem.metrics.margin.screenEdge; anchors.topMargin:0; anchors.bottomMargin: 0;
anchors.horizontalCenterOffset: 0; anchors.verticalCenterOffset: 0;
}
}
]
}
//! Debug Elements
Loader{
anchors.bottom: parent.bottom

View File

@ -59,6 +59,7 @@ Item{
//! BEGIN OF ABILITIES SUPPORT
readonly property bool animationsAreSupported: bridge && bridge.animations.client
readonly property bool indexerIsSupported: bridge && bridge.indexer.client
readonly property bool launchersAreSupported: bridge && bridge.launchers.client
readonly property bool parabolicEffectIsSupported: bridge && bridge.parabolic.client
readonly property bool positionShortcutsAreSupported: bridge && bridge.shortcuts.client

View File

@ -142,7 +142,6 @@ Item{
readonly property Item actions: Actions{}
readonly property Item applet: mainCommunicator.requires
readonly property Item debug: appletItem.debug.publicApi
readonly property Item launchers: appletItem.launchers
readonly property Item metrics: appletItem.metrics.publicApi
readonly property Item myView: appletItem.myView
readonly property Item userRequests: appletItem.userRequests
@ -159,6 +158,11 @@ Item{
tailAppletIsSeparator: appletItem.tailAppletIsSeparator
}
readonly property AbilityBridge.Launchers launchers: AbilityBridge.Launchers {
host: appletItem.launchers
appletIndex: index
}
readonly property AbilityBridge.ParabolicEffect parabolic: AbilityBridge.ParabolicEffect {
host: appletItem.parabolic
appletIndex: index

View File

@ -64,12 +64,6 @@ Item {
readonly property int version: LatteCore.Environment.makeVersion(0,9,75)
readonly property bool kirigamiLibraryIsFound: LatteCore.Environment.frameworksVersion >= LatteCore.Environment.makeVersion(5,69,0)
property bool addLaunchersMessage: false
property bool addLaunchersInTaskManager: plasmoid.configuration.addLaunchersInTaskManager
&& latteView
&& (latteView.extendedInterface.latteTasksModel.count === 1)
&& (latteView.extendedInterface.plasmaTasksModel.count === 0)
property bool backgroundOnlyOnMaximized: plasmoid.configuration.backgroundOnlyOnMaximized
readonly property bool behaveAsPlasmaPanel: viewType === LatteCore.Types.PanelView
readonly property bool behaveAsDockWithMask: !behaveAsPlasmaPanel
@ -363,6 +357,7 @@ Item {
readonly property alias indexer: _indexer
readonly property alias indicatorsManager: indicators
readonly property alias layouter: _layouter
readonly property alias launchers: _launchers
readonly property alias metrics: _metrics
readonly property alias myView: _myView
readonly property alias parabolic: _parabolic
@ -1357,6 +1352,7 @@ Item {
Ability.Launchers {
id: _launchers
layouts: layoutsContainer
layoutName: latteView && latteView.layout ? latteView.layout.name : ""
}

View File

@ -0,0 +1,51 @@
/*
* Copyright 2021 Michail Vourlakos <mvourlakos@gmail.com>
*
* This file is part of Latte-Dock
*
* Latte-Dock is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License as
* published by the Free Software Foundation; either version 2 of
* the License, or (at your option) any later version.
*
* Latte-Dock is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
import QtQuick 2.0
BridgeItem {
id: launchersBridge
readonly property bool isConnected: host && client
onClientChanged: {
if (client) {
if (host.appletIdStealingDroppedLaunchers !== launchersBridge.appletIndex) {
client.disabledIsStealingDroppedLaunchers();
}
}
}
Connections {
target: client
onIsStealingDroppedLaunchersChanged: {
if (isConnected && client.isStealingDroppedLaunchers) {
host.currentAppletStealingDroppedLaunchers(appletIndex);
}
}
}
Connections {
target: host
onCurrentAppletStealingDroppedLaunchers: {
if (appletIndex !== id && client) {
client.disabledIsStealingDroppedLaunchers();
}
}
}
}

View File

@ -2,5 +2,6 @@ module org.kde.latte.abilities.bridge
Animations 0.1 Animations.qml
Indexer 0.1 Indexer.qml
Launchers 0.1 Launchers.qml
ParabolicEffect 0.1 ParabolicEffect.qml
PositionShortcuts 0.1 PositionShortcuts.qml

View File

@ -37,6 +37,9 @@
<entry name="isPreferredForPositionShortcuts" type="Bool">
<default>false</default>
</entry>
<entry name="isPreferredForDroppedLaunchers" type="Bool">
<default>true</default>
</entry>
<entry name="zoomLevel" type="Int">
<default>14</default>
</entry>

View File

@ -27,6 +27,8 @@ import "launchers" as LaunchersPart
Item {
id: _launchers
readonly property bool isActive: bridge !== null
signal launcherChanged(string launcherUrl);
signal launcherRemoved(string launcherUrl);
@ -35,6 +37,11 @@ Item {
signal launcherInRemoving(string launcherUrl);
signal launcherInMoving(string launcherUrl, int pos);
signal disabledIsStealingDroppedLaunchers();
property bool isStealingDroppedLaunchers: false
property bool isShowingAddLaunchersMessage: false
property bool __isLoadedDuringViewStartup: false
property int group: LatteCore.Types.UniqueLaunchers
@ -95,8 +102,8 @@ Item {
function addLauncher(launcherUrl) {
if (bridge && !inUniqueGroup()) {
bridge.launchers.addSyncedLauncher(launchers.group,
launcherUrl);
bridge.launchers.host.addSyncedLauncher(launchers.group,
launcherUrl);
} else {
_launchers.tasksModel.requestAddLauncher(launcherUrl);
_launchers.launcherChanged(launcherUrl);
@ -123,8 +130,8 @@ Item {
function addDroppedLaunchers(urls) {
//! inform synced docks for new dropped launchers
if (bridge && !launchers.inUniqueGroup()) {
bridge.launchers.addDroppedLaunchers(launchers.group,
urls);
bridge.launchers.host.addDroppedLaunchers(launchers.group,
urls);
} else {
urls.forEach(function (item) {
addDroppedLauncher(item);
@ -151,8 +158,8 @@ Item {
function removeLauncher(launcherUrl) {
if (bridge && !inUniqueGroup()) {
bridge.launchers.removeSyncedLauncher(launchers.group,
launcherUrl);
bridge.launchers.host.removeSyncedLauncher(launchers.group,
launcherUrl);
} else {
_launchers.launcherInRemoving(launcherUrl);
_launchers.tasksModel.requestRemoveLauncher(launcherUrl);
@ -162,9 +169,9 @@ Item {
function addLauncherToActivity(launcherUrl, activityId) {
if (bridge && !inUniqueGroup()) {
bridge.launchers.addSyncedLauncherToActivity(launchers.group,
launcherUrl,
activityId);
bridge.launchers.host.addSyncedLauncherToActivity(launchers.group,
launcherUrl,
activityId);
} else {
if (activityId !== activityInfo.currentActivity && isOnAllActivities(launcherUrl)) {
_launchers.launcherInRemoving(launcherUrl);
@ -177,9 +184,9 @@ Item {
function removeLauncherFromActivity(launcherUrl, activityId) {
if (bridge && !inUniqueGroup()) {
bridge.launchers.removeSyncedLauncherFromActivity(launchers.group,
launcherUrl,
activityId);
bridge.launchers.host.removeSyncedLauncherFromActivity(launchers.group,
launcherUrl,
activityId);
} else {
if (activityId === activityInfo.currentActivity) {
_launchers.launcherInRemoving(launcherUrl);
@ -191,9 +198,9 @@ Item {
function validateSyncedLaunchersOrder() {
if (bridge && !_launchers.inUniqueGroup()) {
bridge.launchers.validateSyncedLaunchersOrder(syncer.clientId,
group,
currentShownLauncherList());
bridge.launchers.host.validateSyncedLaunchersOrder(syncer.clientId,
group,
currentShownLauncherList());
} else {
/*validator.stop();
validator.launchers = orderedLaunchers;
@ -269,12 +276,12 @@ Item {
var launch = [];
var launchersList = [];
if (bridge && bridge.launchers.isReady) {
if (bridge && bridge.launchers.host.isReady) {
if (!_launchers.inUniqueGroup()) {
if (_launchers.inLayoutGroup()) {
launchersList = bridge.launchers.layoutLaunchers;
launchersList = bridge.launchers.host.layoutLaunchers;
} else if (_launchers.inGlobalGroup()) {
launchersList = bridge.launchers.universalLaunchers;
launchersList = bridge.launchers.host.universalLaunchers;
}
}
} else {
@ -302,13 +309,13 @@ Item {
}
function importLauncherListInModel() {
if (bridge && bridge.launchers.isReady && !inUniqueGroup()) {
if (bridge && bridge.launchers.host.isReady && !inUniqueGroup()) {
if (inLayoutGroup()) {
console.log("Tasks: Applying LAYOUT Launchers List...");
tasksModel.launcherList = bridge.launchers.layoutLaunchers;
tasksModel.launcherList = bridge.launchers.host.layoutLaunchers;
} else if (inGlobalGroup()) {
console.log("Tasks: Applying GLOBAL Launchers List...");
tasksModel.launcherList = bridge.launchers.universalLaunchers;
tasksModel.launcherList = bridge.launchers.host.universalLaunchers;
}
} else {
console.log("Tasks: Applying UNIQUE Launchers List...");
@ -318,6 +325,23 @@ Item {
//! Connections
Component.onCompleted: {
if (isActive) {
bridge.launchers.client = _launchers;
}
}
Component.onDestruction: {
if (isActive) {
bridge.launchers.client = null;
}
}
onIsActiveChanged: {
if (isActive) {
bridge.launchers.client = _launchers;
}
}
onGroupChanged:{
if(appletAbilities.myView.isReady) {
@ -337,9 +361,9 @@ Item {
}
Connections {
target: bridge ? bridge.launchers : null
target: bridge ? bridge.launchers.host : null
onIsReadyChanged: {
if (bridge && bridge.launchers.isReady && !_launchers.__isLoadedDuringViewStartup) {
if (bridge && bridge.launchers.host.isReady && !_launchers.__isLoadedDuringViewStartup) {
_launchers.__isLoadedDuringViewStartup = true;
_launchers.importLauncherListInModel();
}
@ -349,12 +373,12 @@ Item {
Connections {
target: _launchers.tasksModel
onLauncherListChanged: {
if (bridge && bridge.launchers.isReady) {
if (bridge && bridge.launchers.host.isReady) {
if (!_launchers.inUniqueGroup()) {
if (_launchers.inLayoutGroup()) {
bridge.launchers.setLayoutLaunchers(_launchers.tasksModel.launcherList);
bridge.launchers.host.setLayoutLaunchers(_launchers.tasksModel.launcherList);
} else if (_launchers.inGlobalGroup()) {
bridge.launchers.setUniversalLaunchers(_launchers.tasksModel.launcherList);
bridge.launchers.host.setUniversalLaunchers(_launchers.tasksModel.launcherList);
}
if (inDraggingPhase) {

View File

@ -26,35 +26,35 @@ import org.kde.latte.core 0.2 as LatteCore
Item {
id:_syncer
property bool isBlocked: false
readonly property bool isActive: bridge !== null && group !== LatteCore.Types.UniqueLaunchers
readonly property bool isActive: bridge !== null && bridge.launchers.host !==null && group !== LatteCore.Types.UniqueLaunchers
readonly property int clientId: plasmoid.id
//! Connections
Component.onCompleted: {
if (isActive) {
bridge.launchers.addAbilityClient(_syncer);
bridge.launchers.host.addAbilityClient(_syncer);
}
}
Component.onDestruction: {
if (bridge) {
bridge.launchers.removeAbilityClient(_syncer);
bridge.launchers.host.removeAbilityClient(_syncer);
}
}
onIsActiveChanged: {
if (isActive) {
bridge.launchers.addAbilityClient(_syncer);
bridge.launchers.host.addAbilityClient(_syncer);
} else if (bridge) {
bridge.launchers.removeAbilityClient(_syncer);
bridge.launchers.host.removeAbilityClient(_syncer);
}
}
Connections {
target: isActive ? bridge.launchers : null
target: isActive ? bridge.launchers.host : null
onIsReadyChanged: {
if (bridge.launchers.isReady && _syncer.isActive) {
bridge.launchers.addAbilityClient(_syncer);
if (bridge.launchers.host.isReady && _syncer.isActive) {
bridge.launchers.host.addAbilityClient(_syncer);
}
}
}

View File

@ -754,6 +754,7 @@ Item {
indexer.updateIsBlocked: root.inDraggingPhase || root.inActivityChange
launchers.group: plasmoid.configuration.launchersGroup
launchers.isStealingDroppedLaunchers: plasmoid.configuration.isPreferredForDroppedLaunchers
launchers.syncer.isBlocked: inDraggingPhase
parabolic.itemsCount: tasksModel.count
@ -767,14 +768,20 @@ Item {
requires.latteSideColoringEnabled: false
requires.screenEdgeMarginSupported: true
//! Connections
Connections {
target: _appletAbilities.shortcuts
onDisabledIsStealingGlobalPositionShortcuts: {
plasmoid.configuration.isPreferredForPositionShortcuts = false;
}
}
Connections {
target: _appletAbilities.launchers
onDisabledIsStealingDroppedLaunchers: {
plasmoid.configuration.isPreferredForDroppedLaunchers = false;
}
}
}
Component{
@ -1113,7 +1120,7 @@ Item {
visible: backgroundOpacity > 0
radius: appletAbilities.metrics.iconSize/10
backgroundOpacity: mouseHandler.isDroppingOnlyLaunchers ? 0.75 : 0
backgroundOpacity: mouseHandler.isDroppingOnlyLaunchers || appletAbilities.launchers.isShowingAddLaunchersMessage ? 0.75 : 0
duration: appletAbilities.animations.speedFactor.current
title: i18n("Tasks Area")

View File

@ -135,14 +135,15 @@ PlasmaComponents.Page {
LatteComponents.CheckBox {
Layout.maximumWidth: dialog.optionsWidth
text: i18n("Add launchers only in the Tasks Area")
checked: plasmoid.configuration.addLaunchersInTaskManager
tooltip: i18n("Launchers are added only in the taskmanager and not as plasma applets")
enabled: latteView.extendedInterface.latteTasksModel.count === 1
&& latteView.extendedInterface.plasmaTasksModel.count === 0
text: i18n("Launchers are added only in current tasks applet")
tooltip: i18n("Launchers are added only in current tasks applet and not as regular applets or in any other applet")
readonly property bool isPreferredForLaunchers: tasks.configuration.isPreferredForDroppedLaunchers
onIsPreferredForLaunchersChanged: checked = isPreferredForLaunchers;
onClicked: {
plasmoid.configuration.addLaunchersInTaskManager = checked;
tasks.configuration.isPreferredForDroppedLaunchers = !tasks.configuration.isPreferredForDroppedLaunchers;
}
}
@ -175,9 +176,9 @@ PlasmaComponents.Page {
LatteComponents.CheckBox {
id: unifyGlobalShortcutsChk
Layout.maximumWidth: dialog.optionsWidth
text: i18n("➊ Based on position shortcuts apply only on tasks")
text: i18n("➊ Based on position shortcuts apply only on current tasks")
// checked: tasks.configuration.isPreferredForPositionShortcuts //! Disabled because it was not updated between multiple Tasks
tooltip: i18n("Based on position global shortcuts are enabled only for tasks and not for applets")
tooltip: i18n("Based on position global shortcuts are enabled only for current tasks and not for other applets")
visible: dialog.advancedLevel
enabled: latteView.isPreferredForShortcuts || (!latteView.layout.preferredForShortcutsTouched && latteView.isHighestPriorityView())