Changeset View
Changeset View
Standalone View
Standalone View
containments/desktop/package/contents/ui/AppletAppearance.qml
Show All 30 Lines | |||||
31 | Item { | 31 | Item { | ||
32 | id: appletItem | 32 | id: appletItem | ||
33 | 33 | | |||
34 | property int handleWidth: iconSize | 34 | property int handleWidth: iconSize | ||
35 | property int minimumHandleHeight: 7 * (root.iconSize + 7) + margins.top + margins.bottom | 35 | property int minimumHandleHeight: 7 * (root.iconSize + 7) + margins.top + margins.bottom | ||
36 | property int handleHeight: (height < minimumHandleHeight) ? minimumHandleHeight : height | 36 | property int handleHeight: (height < minimumHandleHeight) ? minimumHandleHeight : height | ||
37 | property string category | 37 | property string category | ||
38 | 38 | | |||
39 | property bool showAppletHandle: false | 39 | property bool showAppletHandle: temporaryShowAppletHandle || toolBox.open | ||
40 | property bool temporaryShowAppletHandle: false | ||||
40 | property real controlsOpacity: (plasmoid.immutable || !showAppletHandle) ? 0 : 1 | 41 | property real controlsOpacity: (plasmoid.immutable || !showAppletHandle) ? 0 : 1 | ||
41 | property string backgroundHints: "NoBackground" | 42 | property string backgroundHints: "NoBackground" | ||
42 | property bool hasBackground: false | 43 | property bool hasBackground: false | ||
43 | property bool handleMerged: (height > minimumHandleHeight && !appletHandle.forceFloating) | 44 | property bool handleMerged: (height > minimumHandleHeight && !appletHandle.forceFloating) | ||
44 | property bool animationsEnabled: false | 45 | property bool animationsEnabled: false | ||
45 | property bool floating: true // turns off layoutManagment space handling for appletItem | 46 | property bool floating: true // turns off layoutManagment space handling for appletItem | ||
46 | 47 | | |||
47 | property alias innerEndHeight: mouseListener.endHeight | 48 | property alias innerEndHeight: mouseListener.endHeight | ||
▲ Show 20 Lines • Show All 163 Lines • ▼ Show 20 Line(s) | 192 | KQuickControlsAddons.MouseEventListener { | |||
211 | onPressed: { | 212 | onPressed: { | ||
212 | pressX = mouse.x; | 213 | pressX = mouse.x; | ||
213 | pressY = mouse.y; | 214 | pressY = mouse.y; | ||
214 | } | 215 | } | ||
215 | 216 | | |||
216 | onPressAndHold: { | 217 | onPressAndHold: { | ||
217 | if (!plasmoid.immutable && plasmoid.configuration.pressToMove) { | 218 | if (!plasmoid.immutable && plasmoid.configuration.pressToMove) { | ||
218 | if (!dragMouseArea.dragging && !root.isDrag(pressX, pressY, mouse.x, mouse.y)) { | 219 | if (!dragMouseArea.dragging && !root.isDrag(pressX, pressY, mouse.x, mouse.y)) { | ||
219 | showAppletHandle = true; | 220 | temporaryShowAppletHandle = true; | ||
220 | 221 | | |||
221 | dragMouseArea.dragging = true; | 222 | dragMouseArea.dragging = true; | ||
222 | 223 | | |||
223 | eventGenerator.sendGrabEventRecursive(appletItem, KQuickControlsAddons.EventGenerator.UngrabMouse); | 224 | eventGenerator.sendGrabEventRecursive(appletItem, KQuickControlsAddons.EventGenerator.UngrabMouse); | ||
224 | eventGenerator.sendGrabEvent(dragMouseArea, KQuickControlsAddons.EventGenerator.GrabMouse); | 225 | eventGenerator.sendGrabEvent(dragMouseArea, KQuickControlsAddons.EventGenerator.GrabMouse); | ||
225 | eventGenerator.sendMouseEvent(dragMouseArea, KQuickControlsAddons.EventGenerator.MouseButtonPress, mouse.x, mouse.y, Qt.LeftButton, Qt.LeftButton, 0); | 226 | eventGenerator.sendMouseEvent(dragMouseArea, KQuickControlsAddons.EventGenerator.MouseButtonPress, mouse.x, mouse.y, Qt.LeftButton, Qt.LeftButton, 0); | ||
226 | } | 227 | } | ||
227 | } | 228 | } | ||
Show All 12 Lines | |||||
240 | 241 | | |||
241 | Timer { | 242 | Timer { | ||
242 | id: hoverTracker | 243 | id: hoverTracker | ||
243 | repeat: false | 244 | repeat: false | ||
244 | interval: root.handleDelay | 245 | interval: root.handleDelay | ||
245 | onTriggered: { | 246 | onTriggered: { | ||
246 | if (mouseListener.containsMouse || (appletHandle.item && (appletHandle.item.containsMouse || appletHandle.item.pressed))) { | 247 | if (mouseListener.containsMouse || (appletHandle.item && (appletHandle.item.containsMouse || appletHandle.item.pressed))) { | ||
247 | if (!plasmoid.configuration.pressToMove) { | 248 | if (!plasmoid.configuration.pressToMove) { | ||
248 | showAppletHandle = true; | 249 | temporaryShowAppletHandle = true; | ||
249 | } | 250 | } | ||
250 | } else if (!dragMouseArea.dragging) { | 251 | } else if (!dragMouseArea.dragging) { | ||
251 | showAppletHandle = false; | 252 | temporaryShowAppletHandle = false; | ||
252 | } | 253 | } | ||
253 | } | 254 | } | ||
254 | } | 255 | } | ||
255 | 256 | | |||
256 | Item { | 257 | Item { | ||
257 | anchors { left: parent.left; top: parent.top; bottom: parent.bottom; } | 258 | anchors { left: parent.left; top: parent.top; bottom: parent.bottom; } | ||
258 | width: parent.width+handleWidth; | 259 | width: parent.width+handleWidth; | ||
259 | z: mouseListener.z + 4 | 260 | z: mouseListener.z + 4 | ||
Show All 17 Lines | 262 | PlasmaCore.FrameSvgItem { | |||
277 | } | 278 | } | ||
278 | } | 279 | } | ||
279 | 280 | | |||
280 | Connections { | 281 | Connections { | ||
281 | target: plasmoid | 282 | target: plasmoid | ||
282 | onImmutableChanged: { | 283 | onImmutableChanged: { | ||
283 | // print(" TB dragMouseArea.visible: " + plasmoid.immutable) | 284 | // print(" TB dragMouseArea.visible: " + plasmoid.immutable) | ||
284 | dragMouseArea.visible = !plasmoid.immutable; | 285 | dragMouseArea.visible = !plasmoid.immutable; | ||
285 | showAppletHandle = false; | 286 | temporaryShowAppletHandle = false; | ||
286 | } | 287 | } | ||
287 | onAppletRemoved: { | 288 | onAppletRemoved: { | ||
288 | // print("Applet removed Applet-" + applet.id) | 289 | // print("Applet removed Applet-" + applet.id) | ||
289 | if (applet.id == appletItem.applet.id) { | 290 | if (applet.id == appletItem.applet.id) { | ||
290 | // print("Destroying Applet-" + applet.id) | 291 | // print("Destroying Applet-" + applet.id) | ||
291 | root.layoutManager.saveRotation(appletItem); | 292 | root.layoutManager.saveRotation(appletItem); | ||
292 | appletItem.releasePosition(); | 293 | appletItem.releasePosition(); | ||
293 | //applet.action("remove").trigger(); | 294 | //applet.action("remove").trigger(); | ||
▲ Show 20 Lines • Show All 320 Lines • Show Last 20 Lines |