Warning, /plasma/latte-dock/containment/package/contents/ui/applet/communicator/Engine.qml is written in an unsupported language. File is not indexed.

0001 /*
0002     SPDX-FileCopyrightText: 2018 Michail Vourlakos <mvourlakos@gmail.com>
0003     SPDX-License-Identifier: GPL-2.0-or-later
0004 */
0005 
0006 import QtQuick 2.7
0007 
0008 import org.kde.latte.abilities.definition 0.1 as AbilityDefinition
0009 
0010 import "../../../code/AppletIdentifier.js" as AppletIdentifier
0011 
0012 Item{
0013     id: mainCommunicator
0014 
0015     //             -------------------------------------
0016     //              BEGIN OF INTERNAL APPLET PROPERTIES
0017     //             LATTE<->APPLET COMMUNICATION PROTOCOL
0018     //             -------------------------------------
0019     //
0020     // NAME: latteBridge
0021     //   USAGE: property QtObject latteBridge: null
0022     //   EXPLANATION: The main shared object that Latte is using to communicate with the applet
0023     property bool appletContainsLatteBridge: appletRootItem && appletRootItem.hasOwnProperty("latteBridge") ? true : false
0024     //!              END OF INTERNAL APPLET PROPERTIES
0025     //             -------------------------------------
0026 
0027     //! BEGIN OF PROPERTIES
0028     //this is used for applets to identify their main icon shown in order to identify its main colors
0029     readonly property bool appletMainIconIsFound: (appletIconItem !== null) || (appletImageItem !== null)
0030 
0031     property bool inStartup: true
0032 
0033     property Item appletRootItem: appletDiscoveredRootItem ? appletDiscoveredRootItem : appletDefaultRootItem
0034     property Item appletDiscoveredRootItem: null
0035     property Item appletDefaultRootItem: applet && applet.children && applet.children.length>0 ? applet.children[0] : null
0036 
0037     property Item appletIconItem: null //first applet's IconItem to be used by Latte
0038     property Item appletImageItem: null //first applet's ImageItem to be used by Latte
0039     //! END OF PROPERTIES
0040 
0041     //! BEGIN OF PUBLIC PROPERTIES SET THROUGH LATTEBRIDGE.ACTIONS   
0042     readonly property Item requires: AbilityDefinition.AppletRequirements{}
0043     //! END OF PUBLIC PROPERTIES SET THROUGH LATTEBRIDGE.ACTIONS
0044 
0045     //! BEGIN OF ABILITIES SUPPORT
0046     readonly property bool animationsAreSupported: bridge && bridge.animations.client
0047     readonly property bool indexerIsSupported: bridge && bridge.indexer.client
0048     readonly property bool launchersAreSupported: bridge && bridge.launchers.client
0049     readonly property bool myViewIsSupported: bridge && bridge.myView.client
0050     readonly property bool parabolicEffectIsSupported: bridge && bridge.parabolic.client
0051     readonly property bool positionShortcutsAreSupported: bridge && bridge.shortcuts.client
0052     readonly property bool thinTooltipIsSupported: bridge && bridge.thinTooltip.client
0053 
0054     readonly property Item bridge: bridgeLoader.active ? bridgeLoader.item : null
0055     //! END OF ABILITIES SUPPORT
0056 
0057     //! BEGIN OF FUNCTIONS
0058 
0059     function reconsiderAppletIconItem() {
0060         AppletIdentifier.reconsiderAppletIconItem();
0061     }
0062 
0063     //! END OF FUNCTIONS
0064 
0065     //! BEGIN OF CONNECTIONS
0066     Connections{
0067         target: appletItem
0068         onAppletChanged: {
0069             if (applet) {
0070                 AppletIdentifier.checkAndUpdateAppletRootItem();
0071                 AppletIdentifier.reconsiderAppletIconItem();
0072                 overlayInitTimer.start();
0073             }
0074         }
0075     }
0076 
0077     //! END OF CONNECTIONS
0078 
0079     //! BEGIN OF LOADERS
0080     Loader{
0081         id: bridgeLoader
0082         active: appletContainsLatteBridge
0083         sourceComponent: LatteBridge{}
0084     }
0085     //! END OF LOADERS
0086 
0087     //! BEGIN OF TIMERS
0088     //a timer that is used in  order to init some Communicator values
0089     Timer {
0090         id: overlayInitTimer
0091         interval: 1000
0092         onTriggered: {
0093             AppletIdentifier.checkAndUpdateAppletRootItem();
0094             AppletIdentifier.reconsiderAppletIconItem();
0095             mainCommunicator.inStartup = false;
0096 
0097             if (appletItem.debug.timersEnabled) {
0098                 console.log("containment timer: appletItem fakeInitTimer called...");
0099             }
0100         }
0101     }
0102 
0103     //! END OF TIMERS
0104 }