2014-09-29 14:40:58 +00:00
|
|
|
/*
|
|
|
|
|
* Copyright 2014 Aaron Seigo <aseigo@kde.org>
|
|
|
|
|
* Copyright 2012 Marco Martin <notmart@gmail.com>
|
|
|
|
|
*
|
|
|
|
|
* 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.
|
|
|
|
|
*/
|
|
|
|
|
|
2018-02-22 18:26:53 +00:00
|
|
|
import QtQuick 2.7
|
2014-09-29 19:38:56 +00:00
|
|
|
import QtGraphicalEffects 1.0
|
2018-02-08 18:54:32 +00:00
|
|
|
import QtQuick.Controls 2.3
|
2014-09-03 14:50:41 +00:00
|
|
|
import org.kde.plasma.core 2.0 as PlasmaCore
|
2014-09-29 11:32:55 +00:00
|
|
|
import org.kde.plasma.shell 2.0 as Shell
|
2014-10-30 13:09:10 +00:00
|
|
|
import org.kde.plasma.components 2.0 as PlasmaComponents
|
2014-11-09 12:50:03 +00:00
|
|
|
import org.kde.plasma.workspace.components 2.0 as PlasmaWorkspace
|
2014-11-19 18:58:09 +00:00
|
|
|
import org.kde.kquickcontrolsaddons 2.0
|
2017-01-16 15:08:47 +00:00
|
|
|
import org.kde.activities 0.1 as Activities
|
2019-09-04 15:33:01 +00:00
|
|
|
//import "../components"
|
2014-09-03 14:50:41 +00:00
|
|
|
|
2018-02-09 12:04:48 +00:00
|
|
|
|
2020-07-16 09:37:43 +00:00
|
|
|
Rectangle {
|
|
|
|
|
id: root
|
2018-02-13 13:16:48 +00:00
|
|
|
|
2020-07-16 09:37:43 +00:00
|
|
|
visible: false //adjust borders is run during setup. We want to avoid painting till completed
|
|
|
|
|
property Item containment
|
2018-02-13 13:16:48 +00:00
|
|
|
|
2020-07-16 09:37:43 +00:00
|
|
|
color: containment.backgroundHints == PlasmaCore.Types.NoBackground ? "transparent" : theme.textColor
|
2017-08-30 16:28:22 +00:00
|
|
|
|
2015-06-20 00:52:09 +00:00
|
|
|
function toggleWidgetExplorer(containment) {
|
|
|
|
|
console.log("Widget Explorer toggled");
|
|
|
|
|
if (widgetExplorerStack.source != "") {
|
|
|
|
|
widgetExplorerStack.source = "";
|
|
|
|
|
} else {
|
2020-07-16 11:48:53 +00:00
|
|
|
widgetExplorerStack.setSource(desktop.fileFromPackage("explorer", "WidgetExplorer.qml"), {"containment": containment, "containmentInterface": root.containment})
|
2015-06-20 00:52:09 +00:00
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
Loader {
|
|
|
|
|
id: widgetExplorerStack
|
|
|
|
|
z: 99
|
|
|
|
|
asynchronous: true
|
2020-07-16 11:48:53 +00:00
|
|
|
y: containment ? containment.availableScreenRect.y : 0
|
|
|
|
|
height: containment ? containment.availableScreenRect.height : parent.height
|
|
|
|
|
width: parent.width
|
2015-06-20 00:52:09 +00:00
|
|
|
|
|
|
|
|
onLoaded: {
|
|
|
|
|
if (widgetExplorerStack.item) {
|
|
|
|
|
item.closed.connect(function() {
|
|
|
|
|
widgetExplorerStack.source = ""
|
|
|
|
|
});
|
2016-10-05 14:59:07 +00:00
|
|
|
|
2020-07-16 09:37:43 +00:00
|
|
|
item.topPanelHeight = containment.availableScreenRect.y
|
|
|
|
|
item.bottomPanelHeight = root.height - (containment.availableScreenRect.height + containment.availableScreenRect.y)
|
2018-02-13 13:16:48 +00:00
|
|
|
|
2020-07-16 09:37:43 +00:00
|
|
|
item.leftPanelWidth = containment.availableScreenRect.x
|
|
|
|
|
item.rightPanelWidth = root.width - (containment.availableScreenRect.width + containment.availableScreenRect.x)
|
|
|
|
|
}
|
2014-09-29 17:15:21 +00:00
|
|
|
}
|
2014-09-29 14:40:58 +00:00
|
|
|
}
|
|
|
|
|
|
2014-10-30 15:44:32 +00:00
|
|
|
Loader {
|
|
|
|
|
id: pinOverlay
|
2014-09-29 19:38:56 +00:00
|
|
|
anchors {
|
2015-06-22 18:43:44 +00:00
|
|
|
fill: parent
|
2020-02-07 12:38:02 +00:00
|
|
|
topMargin: containment ? containment.availableScreenRect.y : 0
|
|
|
|
|
bottomMargin: parent.height - containment ? (containment.availableScreenRect.height + containment.availableScreenRect.y) : 0
|
2014-09-29 19:38:56 +00:00
|
|
|
}
|
2015-06-22 18:43:44 +00:00
|
|
|
z: 222
|
2015-06-03 17:00:18 +00:00
|
|
|
source: Qt.resolvedUrl("Pin.qml")
|
2014-09-29 19:38:56 +00:00
|
|
|
}
|
|
|
|
|
|
2020-07-16 09:37:43 +00:00
|
|
|
onContainmentChanged: {
|
|
|
|
|
containment.parent = root;
|
|
|
|
|
containment.visible = true;
|
|
|
|
|
containment.anchors.fill = root;
|
|
|
|
|
panel.backgroundHints = containment.backgroundHints;
|
2018-02-13 13:16:48 +00:00
|
|
|
}
|
2020-07-16 09:37:43 +00:00
|
|
|
|
2014-09-29 11:32:55 +00:00
|
|
|
Component.onCompleted: {
|
2020-07-16 09:37:43 +00:00
|
|
|
visible = true
|
2014-09-29 11:32:55 +00:00
|
|
|
}
|
2014-10-23 21:34:33 +00:00
|
|
|
}
|