Warning, /plasma/latte-dock/containment/package/contents/ui/abilities/privates/MyViewPrivate.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.7
0007 import org.kde.plasma.plasmoid 2.0
0008 
0009 import org.kde.latte.core 0.2 as LatteCore
0010 
0011 import org.kde.latte.abilities.host 0.1 as AbilityHost
0012 
0013 import org.kde.latte.private.containment 0.1 as LatteContainment
0014 
0015 AbilityHost.MyView {
0016     id: _myView
0017     property Item layouts: null
0018 
0019     readonly property int itemShadowOpacity: (plasmoid.configuration.shadowOpacity/100) * 255
0020     readonly property int itemShadowMaxSize: itemShadow.isEnabled ? (0.5*metrics.maxIconSize) * (plasmoid.configuration.shadowSize/100) : 0
0021 
0022     readonly property real backgroundStoredOpacity: background.themeExtendedBackground && plasmoid.configuration.panelTransparency === -1 ?
0023                                                       background.themeExtendedBackground.maxOpacity : plasmoid.configuration.panelTransparency / 100
0024 
0025     readonly property string itemShadowCurrentColor: {
0026         if (plasmoid.configuration.shadowColorType === LatteContainment.Types.ThemeColorShadow) {
0027             var strC = String(theme.textColor);
0028             return strC.indexOf("#") === 0 ? strC.substr(1) : strC;
0029         } else if (plasmoid.configuration.shadowColorType === LatteContainment.Types.UserColorShadow) {
0030             return plasmoid.configuration.shadowColor;
0031         }
0032 
0033         return "080808"; // default
0034     }
0035 
0036     property bool isHidingBlockedFromApplet: false
0037 
0038     //! do not update during dragging/moving applets inConfigureAppletsMode
0039     readonly property bool isBindingUpdateEnabled: !(root.dragOverlay && root.dragOverlay.pressed)
0040 
0041     readonly property string hidingBlockedStr: "_myViewHost"
0042 
0043     onIsHidingBlockedChanged: {
0044         if (isHidingBlocked) {
0045             view.visibility.addBlockHidingEvent(_myView + hidingBlockedStr);
0046         } else {
0047             view.visibility.removeBlockHidingEvent(_myView + hidingBlockedStr);
0048         }
0049     }
0050 
0051     Binding{
0052         target: _myView
0053         property: "isHidingBlockedFromApplet"
0054         when: isBindingUpdateEnabled
0055         value: {
0056             var grid;
0057 
0058             for (var l=0; l<=2; ++l) {
0059                 if (l===0) {
0060                     grid = layouts.startLayout;
0061                 } else if (l===1) {
0062                     grid = layouts.mainLayout;
0063                 } else if (l===2) {
0064                     grid = layouts.endLayout;
0065                 }
0066 
0067                 for (var i=0; i<grid.children.length; ++i){
0068                     var appletItem = grid.children[i];
0069                     if (appletItem
0070                             && appletItem.communicator
0071                             && appletItem.communicator.myViewIsSupported
0072                             && appletItem.communicator.bridge.myView.client.local.isHidingBlocked) {
0073                         return true;
0074                     }
0075                 }
0076             }
0077 
0078             return false;
0079         }
0080     }
0081 
0082     function decimalToHex(d, padding) {
0083         var hex = Number(d).toString(16);
0084         padding = typeof (padding) === "undefined" || padding === null ? padding = 2 : padding;
0085 
0086         while (hex.length < padding) {
0087             hex = "0" + hex;
0088         }
0089 
0090         return hex;
0091     }
0092 }
0093