support applets configuration dialog

needs a way to disable the button for those that
don't have a config dialog
This commit is contained in:
Marco Martin 2015-09-25 15:10:05 +02:00
parent 2ed4578a55
commit 92d3b613ee
3 changed files with 56 additions and 5 deletions

View file

@ -67,6 +67,7 @@ MouseEventListener {
editOverlay.visible = true; editOverlay.visible = true;
var pos = mapToItem(appletsLayout, mouse.x, mouse.y); var pos = mapToItem(appletsLayout, mouse.x, mouse.y);
draggingApplet = appletsSpace.layout.childAt(pos.x, pos.y); draggingApplet = appletsSpace.layout.childAt(pos.x, pos.y);
editOverlay.applet = draggingApplet;
startMouseX = mouse.screenX; startMouseX = mouse.screenX;
startMouseY = mouse.screenY; startMouseY = mouse.screenY;

View file

@ -32,6 +32,7 @@ Rectangle {
id: editOverlay id: editOverlay
anchors.fill: parent anchors.fill: parent
property Item applet
color: Qt.rgba(0, 0, 0, 0.8) color: Qt.rgba(0, 0, 0, 0.8)
visible: false visible: false
onVisibleChanged: { onVisibleChanged: {
@ -61,6 +62,31 @@ Rectangle {
anchors.fill: parent anchors.fill: parent
preventStealing: true preventStealing: true
onClicked: editOverlay.opacity = 0; onClicked: editOverlay.opacity = 0;
Row {
visible: editOverlay.applet
anchors.horizontalCenter: parent.horizontalCenter
y: parent.mapFromItem(editOverlay.applet, 0, 0).y + units.gridUnit * 3
PlasmaComponents.ToolButton {
iconSource: "configure"
flat: false
onClicked: {
editOverlay.applet.applet.action("configure").trigger();
editOverlay.opacity = 0;
}
}
Item {
width: units.gridUnit * 10
height: 1
}
PlasmaComponents.ToolButton {
iconSource: "window-close"
flat: false
onClicked: {
editOverlay.applet.applet.action("remove").trigger();
editOverlay.opacity = 0;
}
}
}
} }
PlasmaCore.FrameSvgItem { PlasmaCore.FrameSvgItem {
id: background id: background

View file

@ -17,6 +17,7 @@
*/ */
import QtQuick 2.0 import QtQuick 2.0
import QtGraphicalEffects 1.0
import QtQuick.Dialogs 1.1 import QtQuick.Dialogs 1.1
import QtQuick.Controls 1.0 as QtControls import QtQuick.Controls 1.0 as QtControls
import QtQuick.Layouts 1.0 import QtQuick.Layouts 1.0
@ -42,11 +43,6 @@ Rectangle {
ConfigModel { ConfigModel {
id: globalAppletConfigModel id: globalAppletConfigModel
ConfigCategory {
name: i18nd("plasma_shell_org.kde.plasma.desktop", "Keyboard shortcuts")
icon: "preferences-desktop-keyboard"
source: "ConfigurationShortcuts.qml"
}
} }
//END model //END model
@ -363,6 +359,34 @@ Rectangle {
shortcut: "Escape" shortcut: "Escape"
} }
} }
LinearGradient {
width: units.gridUnit/2
anchors {
right: parent.left
top: parent.top
bottom: parent.bottom
rightMargin: -1
}
start: Qt.point(0, 0)
end: Qt.point(units.gridUnit/2, 0)
gradient: Gradient {
GradientStop {
position: 0.0
color: "transparent"
}
GradientStop {
position: 0.7
color: Qt.rgba(0, 0, 0, 0.15)
}
GradientStop {
position: 1.0
color: Qt.rgba(0, 0, 0, 0.3)
}
}
MouseArea {
anchors.fill: parent
}
}
} }
} }
//END UI components //END UI components