Warning, /plasma/latte-dock/declarativeimports/abilities/bridge/PositionShortcuts.qml is written in an unsupported language. File is not indexed.

0001 /*
0002     SPDX-FileCopyrightText: 2020 Michail Vourlakos <mvourlakos@gmail.com>
0003     SPDX-License-Identifier: GPL-2.0-or-later
0004 */
0005 
0006 import QtQuick 2.0
0007 
0008 BridgeItem {
0009     id: shortcutsBridge
0010     readonly property bool isConnected: host && client
0011 
0012     onIsConnectedChanged: {
0013         if (isConnected) {
0014             host.sglActivateEntryAtIndex.connect(client.sglActivateEntryAtIndex);
0015             host.sglNewInstanceForEntryAtIndex.connect(client.sglNewInstanceForEntryAtIndex);
0016         } else {
0017             host.sglActivateEntryAtIndex.disconnect(client.sglActivateEntryAtIndex);
0018             host.sglNewInstanceForEntryAtIndex.disconnect(client.sglNewInstanceForEntryAtIndex);
0019         }
0020     }
0021 
0022     onClientChanged: {
0023         if (client) {
0024             if (host.appletIdStealingPositionShortcuts !== shortcutsBridge.appletIndex) {
0025                 client.disabledIsStealingGlobalPositionShortcuts();
0026             }
0027         }
0028     }
0029     Connections {
0030         target: client
0031         onIsStealingGlobalPositionShortcutsChanged: {
0032             if (isConnected && client.isStealingGlobalPositionShortcuts) {
0033                 host.currentAppletStealingPositionShortcuts(appletIndex);
0034             }
0035         }
0036     }
0037 
0038     Connections {
0039         target: host
0040         onCurrentAppletStealingPositionShortcuts: {
0041             if (appletIndex !== id && client) {
0042                 client.disabledIsStealingGlobalPositionShortcuts();
0043             }
0044         }
0045     }
0046 
0047     Component.onDestruction: {
0048         if (isConnected) {
0049             host.sglActivateEntryAtIndex.disconnect(client.sglActivateEntryAtIndex);
0050             host.sglNewInstanceForEntryAtIndex.disconnect(client.sglNewInstanceForEntryAtIndex);
0051         }
0052     }
0053 }