functionality for widget explorer is there
This commit is contained in:
parent
60e5a57c23
commit
52b95779ad
@ -33,37 +33,68 @@ Rectangle {
|
|||||||
function toggleWidgetExplorer(explorerObject) {
|
function toggleWidgetExplorer(explorerObject) {
|
||||||
console.log("Widget Explorer toggled");
|
console.log("Widget Explorer toggled");
|
||||||
|
|
||||||
if (0&&sidePanel.visible) {
|
sidePanelStack.pop(blankPage);
|
||||||
explorerObject.close()
|
|
||||||
sidePanel.visible = false;
|
if (sidePanelStack.state == "widgetExplorer") {
|
||||||
|
explorerObject.close();
|
||||||
|
sidePanelStack.state = "closed";
|
||||||
} else {
|
} else {
|
||||||
explorerObject.parent = sidePanelStack
|
sidePanelStack.push(explorerObject);
|
||||||
explorerObject.anchors.fill = parent;
|
explorerObject.closed.connect(function(){sidePanelStack.state = "closed";});
|
||||||
sidePanel.visible = true;
|
sidePanelStack.state = "widgetExplorer";
|
||||||
sidePanel.height = containment.availableScreenRegion(containment.screen)[0].height;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
function toggleActivityManager() {
|
function toggleActivityManager() {
|
||||||
console.log("Activity manger toggled");
|
console.log("Activity manger toggled");
|
||||||
|
|
||||||
if (sidePanel.visible) {
|
sidePanelStack.pop(blankPage);
|
||||||
sidePanelStack.source = '';
|
|
||||||
sidePanel.visible = false;
|
if (sidePanelStack.state == "activitySwitcher") {
|
||||||
|
sidePanelStack.state = "closed";
|
||||||
} else {
|
} else {
|
||||||
sidePanelStack.source = Qt.resolvedUrl("../activityswitcher/ActivitySwitcher.qml");
|
sidePanelStack.push(Qt.resolvedUrl("../activityswitcher/ActivitySwitcher.qml"));
|
||||||
sidePanel.visible = true;
|
sidePanelStack.state = "activitySwitcher";
|
||||||
sidePanel.height = containment.availableScreenRegion(containment.screen)[0].height;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
PlasmaCore.Dialog {
|
PlasmaCore.Dialog {
|
||||||
id: sidePanel
|
id: sidePanel
|
||||||
location: PlasmaCore.Types.LeftEdge
|
location: PlasmaCore.Types.LeftEdge
|
||||||
mainItem: Loader {
|
mainItem: PlasmaComponents.PageStack {
|
||||||
id: sidePanelStack
|
id: sidePanelStack
|
||||||
|
state: "closed"
|
||||||
width: 250
|
width: 250
|
||||||
height: 500
|
height: 500
|
||||||
|
initialPage: Item {
|
||||||
|
id: blankPage
|
||||||
|
}
|
||||||
|
|
||||||
|
states: [
|
||||||
|
State {
|
||||||
|
name: "closed"
|
||||||
|
PropertyChanges {
|
||||||
|
target: sidePanel
|
||||||
|
visible: false
|
||||||
|
}
|
||||||
|
},
|
||||||
|
State {
|
||||||
|
name: "widgetExplorer"
|
||||||
|
PropertyChanges {
|
||||||
|
target: sidePanel
|
||||||
|
visible: true
|
||||||
|
height: containment.availableScreenRegion(containment.screen)[0].height;
|
||||||
|
}
|
||||||
|
},
|
||||||
|
State {
|
||||||
|
name: "activitySwitcher"
|
||||||
|
PropertyChanges {
|
||||||
|
target: sidePanel
|
||||||
|
visible: true
|
||||||
|
height: containment.availableScreenRegion(containment.screen)[0].height;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
]
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -23,6 +23,8 @@
|
|||||||
|
|
||||||
#include <QQmlEngine>
|
#include <QQmlEngine>
|
||||||
#include <QQmlContext>
|
#include <QQmlContext>
|
||||||
|
#include <QQmlExpression>
|
||||||
|
#include <QQmlProperty>
|
||||||
|
|
||||||
#include <klocalizedstring.h>
|
#include <klocalizedstring.h>
|
||||||
#include <kservicetypetrader.h>
|
#include <kservicetypetrader.h>
|
||||||
@ -359,6 +361,10 @@ void WidgetExplorer::setSource(const QUrl &source)
|
|||||||
d->qmlObject->completeInitialization();
|
d->qmlObject->completeInitialization();
|
||||||
QQuickItem *i = qobject_cast<QQuickItem *>(d->qmlObject->rootObject());
|
QQuickItem *i = qobject_cast<QQuickItem *>(d->qmlObject->rootObject());
|
||||||
i->setParentItem(this);
|
i->setParentItem(this);
|
||||||
|
//set anchors
|
||||||
|
QQmlExpression expr(d->qmlObject->engine()->rootContext(), d->qmlObject->rootObject(), "parent");
|
||||||
|
QQmlProperty prop(d->qmlObject->rootObject(), "anchors.fill");
|
||||||
|
prop.write(expr.evaluate());
|
||||||
}
|
}
|
||||||
|
|
||||||
QUrl WidgetExplorer::source() const
|
QUrl WidgetExplorer::source() const
|
||||||
@ -520,7 +526,7 @@ void WidgetExplorer::uninstall(const QString &pluginName)
|
|||||||
|
|
||||||
void WidgetExplorer::close()
|
void WidgetExplorer::close()
|
||||||
{
|
{
|
||||||
//d->qmlObject->engine()->rootContext()->setContextProperty("widgetExplorer", 0);
|
emit closed();
|
||||||
deleteLater();
|
deleteLater();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -154,6 +154,7 @@ Q_SIGNALS:
|
|||||||
void orientationChanged();
|
void orientationChanged();
|
||||||
void widgetsMenuActionsChanged();
|
void widgetsMenuActionsChanged();
|
||||||
void extraActionsChanged();
|
void extraActionsChanged();
|
||||||
|
void closed();
|
||||||
|
|
||||||
public Q_SLOTS:
|
public Q_SLOTS:
|
||||||
/**
|
/**
|
||||||
|
Loading…
x
Reference in New Issue
Block a user