Warning, /plasma/latte-dock/shell/package/contents/views/Panel.qml is written in an unsupported language. File is not indexed.

0001 /*
0002     SPDX-FileCopyrightText: 2016 Smith AR <audoban@openmailbox.org>
0003     SPDX-FileCopyrightText: 2016 Michail Vourlakos <mvourlakos@gmail.com>
0004     SPDX-License-Identifier: GPL-2.0-or-later
0005 */
0006 
0007 import QtQuick 2.0
0008 import QtQuick.Layouts 1.1
0009 
0010 import org.kde.plasma.core 2.0 as PlasmaCore
0011 
0012 PlasmaCore.FrameSvgItem {
0013     id: root
0014 
0015     imagePath: containment && containment.backgroundHints === PlasmaCore.Types.NoBackground ? "" : "widgets/panel-background"
0016     //imagePath: "widgets/panel-background"
0017     //imagePath: ""
0018     prefix:""
0019     // onRepaintNeeded: adjustPrefix();
0020 
0021     property Item containment
0022     property Item viewLayout
0023 
0024     readonly property bool verticalPanel: containment && containment.formFactor === PlasmaCore.Types.Vertical
0025 
0026     /*  Rectangle{
0027         anchors.fill: parent
0028         color: "transparent"
0029         border.color: "blue"
0030         border.width: 1
0031     }*/
0032 
0033     function adjustPrefix() {
0034         if (!containment) {
0035             return "";
0036         }
0037         var pre;
0038         switch (containment.location) {
0039         case PlasmaCore.Types.LeftEdge:
0040             pre = "west";
0041             break;
0042         case PlasmaCore.Types.TopEdge:
0043             pre = "north";
0044             break;
0045         case PlasmaCore.Types.RightEdge:
0046             pre = "east";
0047             break;
0048         case PlasmaCore.Types.BottomEdge:
0049             pre = "south";
0050             break;
0051         default:
0052             prefix = "";
0053         }
0054         if (hasElementPrefix(pre)) {
0055             prefix = pre;
0056         } else {
0057             prefix = "";
0058         }
0059     }
0060 
0061     Component.onDestruction: {
0062         console.log("latte view qml source deleting...");
0063 
0064         if (containment) {
0065             containment.locationChanged.disconnect(adjustPrefix);
0066         }
0067     }
0068 
0069     onContainmentChanged: {
0070         console.log("latte view qml source - containment changed 1...");
0071         if (!containment) {
0072             return;
0073         }
0074         console.log("latte view qml source - containment changed 2...");
0075 
0076         containment.parent = containmentParent;
0077         containment.visible = true;
0078         containment.anchors.fill = containmentParent;
0079         containment.locationChanged.connect(adjustPrefix);
0080         adjustPrefix();
0081 
0082         for(var i=0; i<containment.children.length; ++i){
0083             if (containment.children[i].objectName === "containmentViewLayout") {
0084                 viewLayout = containment.children[i];
0085             }
0086         }
0087     }
0088 
0089     Item {
0090         id: containmentParent
0091         anchors.fill: parent
0092     }
0093 
0094     //! it is used in order to check the right click position
0095     //! the only way to take into account the visual appearance
0096     //! of the applet (including its spacers)
0097     function appletContainsPos(appletId, pos) {
0098         if (viewLayout) {
0099             return viewLayout.appletContainsPos(appletId, pos);
0100         }
0101 
0102         return false;
0103     }
0104 }