/* * Copyright 2014 Aaron Seigo * Copyright 2012 Marco Martin * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU Library General Public License as * published by the Free Software Foundation; either version 2, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU Library General Public License for more details * * You should have received a copy of the GNU Library General Public * License along with this program; if not, write to the * Free Software Foundation, Inc., * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ import QtQuick 2.7 import QtGraphicalEffects 1.0 import QtQuick.Controls 2.3 import org.kde.plasma.core 2.0 as PlasmaCore import org.kde.plasma.shell 2.0 as Shell import org.kde.plasma.components 2.0 as PlasmaComponents import org.kde.plasma.workspace.components 2.0 as PlasmaWorkspace import org.kde.kquickcontrolsaddons 2.0 import org.kde.activities 0.1 as Activities //import "../components" Rectangle { id: root visible: false //adjust borders is run during setup. We want to avoid painting till completed property Item containment color: containment.backgroundHints == PlasmaCore.Types.NoBackground ? "transparent" : theme.textColor function toggleWidgetExplorer(containment) { console.log("Widget Explorer toggled"); if (widgetExplorerStack.source != "") { widgetExplorerStack.source = ""; } else { widgetExplorerStack.setSource(desktop.fileFromPackage("explorer", "WidgetExplorer.qml"), {"containment": containment, "containmentInterface": root.containment}) } } Loader { id: widgetExplorerStack z: 99 asynchronous: true y: containment ? containment.availableScreenRect.y : 0 height: containment ? containment.availableScreenRect.height : parent.height width: parent.width onLoaded: { if (widgetExplorerStack.item) { item.closed.connect(function() { widgetExplorerStack.source = "" }); item.topPanelHeight = containment.availableScreenRect.y item.bottomPanelHeight = root.height - (containment.availableScreenRect.height + containment.availableScreenRect.y) item.leftPanelWidth = containment.availableScreenRect.x item.rightPanelWidth = root.width - (containment.availableScreenRect.width + containment.availableScreenRect.x) } } } Loader { id: pinOverlay anchors { fill: parent topMargin: containment ? containment.availableScreenRect.y : 0 bottomMargin: parent.height - containment ? (containment.availableScreenRect.height + containment.availableScreenRect.y) : 0 } z: 222 source: Qt.resolvedUrl("Pin.qml") } onContainmentChanged: { containment.parent = root; containment.visible = true; containment.anchors.fill = root; panel.backgroundHints = containment.backgroundHints; } Component.onCompleted: { visible = true } }