fix multiTasks global shortcuts on position

--multi Tasks now work properly with global
shortcuts on position even when only one of them
is stealing them for its own use.
pull/17/head
Michail Vourlakos 5 years ago
parent 5be106565c
commit 05bc900a6d

@ -616,6 +616,10 @@ Item {
target: appletItem.shortcuts
onSglActivateEntryAtIndex: {
if (!appletItem.shortcuts.unifiedGlobalShortcuts) {
return;
}
var visibleIndex = appletItem.indexer.visibleIndex(appletItem.index);
if (visibleIndex === entryIndex && !communicator.positionShortcutsAreSupported) {
@ -624,6 +628,10 @@ Item {
}
onSglNewInstanceForEntryAtIndex: {
if (!appletItem.shortcuts.unifiedGlobalShortcuts) {
return;
}
var visibleIndex = appletItem.indexer.visibleIndex(appletItem.index);
if (visibleIndex === entryIndex && !communicator.positionShortcutsAreSupported) {

@ -29,6 +29,15 @@ AbilityDefinition.PositionShortcuts {
property bool isStealingGlobalPositionShortcuts: false
readonly property bool showPositionShortcutBadges: ref.shortcuts.showPositionShortcutBadges
readonly property bool isEnabled: {
if (bridge) {
return bridge.shortcuts.host.unifiedGlobalShortcuts
|| (!bridge.shortcuts.host.unifiedGlobalShortcuts && bridge.shortcuts.appletIndex === bridge.shortcuts.host.appletIdStealingPositionShortcuts);
}
return true;
}
signal disabledIsStealingGlobalPositionShortcuts();
Item {

@ -26,4 +26,14 @@ import org.kde.latte.abilities.applets 0.1 as AppletAbility
AppletAbility.PositionShortcuts {
id: shortcuts
function shortcutIndex(entryIndex) {
if (!bridge) {
return indexer.visibleIndex(entryIndex);
}
var base = bridge.indexer.host.visibleIndex(bridge.shortcuts.appletIndex);
return (indexer.visibleIndex(entryIndex) - base);
}
}

@ -25,7 +25,7 @@ import org.kde.latte.components 1.0 as LatteComponents
Loader{
id: shorcutBadge
anchors.fill: iconImageBuffer
active: taskItem.shortcuts.showPositionShortcutBadges && !taskItem.isSeparator && !taskItem.isHidden
active: taskItem.shortcuts.showPositionShortcutBadges && !taskItem.isSeparator && !taskItem.isHidden && taskItem.shortcuts.isEnabled
asynchronous: true
visible: badgeString !== ""
@ -35,14 +35,16 @@ Loader{
onActiveChanged: {
if (active && taskItem.shortcuts.showPositionShortcutBadges) {
fixedIndex = taskItem.indexer.visibleIndex(taskItem.itemIndex);
fixedIndex = taskItem.shortcuts.shortcutIndex(taskItem.itemIndex);
} else {
fixedIndex = -1;
}
}
Component.onCompleted: {
fixedIndex = taskItem.indexer.visibleIndex(taskItem.itemIndex);
if (taskItem.shortcuts.isEnabled) {
fixedIndex = taskItem.shortcuts.shortcutIndex(taskItem.itemIndex);
}
}
sourceComponent: Item{

@ -1456,9 +1456,13 @@ MouseArea{
Connections {
target: shortcuts
onSglActivateEntryAtIndex: {
var visibleIndex = taskItem.indexer.visibleIndex(taskItem.itemIndex);
if (!taskItem.shortcuts.isEnabled) {
return;
}
var shortcutIndex = taskItem.shortcuts.shortcutIndex(taskItem.itemIndex);
if (visibleIndex === entryIndex) {
if (shortcutIndex === entryIndex) {
if (taskItem.isGroupParent) {
taskItem.activateNextTask();
} else {
@ -1468,9 +1472,13 @@ MouseArea{
}
onSglNewInstanceForEntryAtIndex: {
var visibleIndex = taskItem.indexer.visibleIndex(taskItem.itemIndex);
if (!taskItem.shortcuts.isEnabled) {
return;
}
var shortcutIndex = taskItem.shortcuts.shortcutIndex(taskItem.itemIndex);
if (visibleIndex === entryIndex) {
if (shortcutIndex === entryIndex) {
tasksModel.requestNewInstance(taskItem.modelIndex());
}
}

Loading…
Cancel
Save