Warning, /plasma/latte-dock/declarativeimports/abilities/client/PositionShortcuts.qml is written in an unsupported language. File is not indexed.
0001 /* 0002 SPDX-FileCopyrightText: 2021 Michail Vourlakos <mvourlakos@gmail.com> 0003 SPDX-License-Identifier: GPL-2.0-or-later 0004 */ 0005 0006 import QtQuick 2.0 0007 0008 import org.kde.latte.abilities.definition 0.1 as AbilityDefinition 0009 0010 AbilityDefinition.PositionShortcuts { 0011 id: shortcuts 0012 property Item bridge: null 0013 property Item indexer: null 0014 0015 badges: ref.shortcuts.badges 0016 showPositionShortcutBadges: ref.shortcuts.showPositionShortcutBadges 0017 0018 property bool isStealingGlobalPositionShortcuts: false 0019 0020 readonly property bool isActive: bridge !== null 0021 0022 readonly property bool isEnabled: { 0023 if (bridge) { 0024 return bridge.shortcuts.host.unifiedGlobalShortcuts 0025 || (!bridge.shortcuts.host.unifiedGlobalShortcuts && bridge.shortcuts.appletIndex === bridge.shortcuts.host.appletIdStealingPositionShortcuts); 0026 } 0027 0028 return true; 0029 } 0030 0031 signal disabledIsStealingGlobalPositionShortcuts(); 0032 0033 readonly property AbilityDefinition.PositionShortcuts local: AbilityDefinition.PositionShortcuts {} 0034 0035 Item { 0036 id: ref 0037 readonly property Item shortcuts: bridge ? bridge.shortcuts.host : local 0038 } 0039 0040 onIsActiveChanged: { 0041 if (isActive) { 0042 bridge.shortcuts.client = shortcuts; 0043 } 0044 } 0045 0046 Component.onCompleted: { 0047 if (isActive) { 0048 bridge.shortcuts.client = shortcuts; 0049 } 0050 } 0051 0052 Component.onDestruction: { 0053 if (isActive) { 0054 bridge.shortcuts.client = null; 0055 } 0056 } 0057 0058 function shortcutIndex(entryIndex) { 0059 if (!bridge || bridge.shortcuts.host.unifiedGlobalShortcuts) { 0060 return indexer.visibleIndex(entryIndex); 0061 } 0062 0063 var base = bridge.indexer.host.visibleIndex(bridge.shortcuts.appletIndex); 0064 0065 //!visible indexes start counting from 1 0066 return (indexer.visibleIndex(entryIndex) - base + 1); 0067 } 0068 } 0069