Changeset View
Changeset View
Standalone View
Standalone View
applets/systemtray/package/contents/ui/items/PlasmoidItem.qml
Show All 34 Lines | 24 | AbstractItem { | |||
---|---|---|---|---|---|
35 | icon: applet ? applet.icon : "" | 35 | icon: applet ? applet.icon : "" | ||
36 | mainItem: applet && applet.toolTipItem ? applet.toolTipItem : null | 36 | mainItem: applet && applet.toolTipItem ? applet.toolTipItem : null | ||
37 | textFormat: applet ? applet.toolTipTextFormat : "" | 37 | textFormat: applet ? applet.toolTipTextFormat : "" | ||
38 | status: applet ? applet.status : PlasmaCore.Types.UnknownStatus | 38 | status: applet ? applet.status : PlasmaCore.Types.UnknownStatus | ||
39 | active: root.activeApplet !== applet | 39 | active: root.activeApplet !== applet | ||
40 | 40 | | |||
41 | onClicked: { | 41 | onClicked: { | ||
42 | if (applet && mouse.button === Qt.LeftButton) { | 42 | if (applet && mouse.button === Qt.LeftButton) { | ||
43 | applet.expanded = true; | 43 | applet.expanded = true; | ||
davidedmundson: Do we want it here? | |||||
44 | } | 44 | } | ||
45 | } | 45 | } | ||
46 | onContextMenu: { | 46 | onContextMenu: { | ||
47 | if (applet) { | 47 | if (applet) { | ||
48 | plasmoid.nativeInterface.showPlasmoidMenu(applet, 0, plasmoidContainer.hidden ? applet.height : 0); | 48 | plasmoid.nativeInterface.showPlasmoidMenu(applet, 0, plasmoidContainer.hidden ? applet.height : 0); | ||
49 | } | 49 | } | ||
50 | } | 50 | } | ||
51 | 51 | | |||
52 | onHeightChanged: { | 52 | onHeightChanged: { | ||
53 | if (applet) { | 53 | if (applet) { | ||
54 | applet.width = height | 54 | applet.width = height | ||
55 | } | 55 | } | ||
56 | } | 56 | } | ||
57 | onAppletChanged: { | 57 | onAppletChanged: { | ||
58 | if (!applet) { | 58 | if (!applet) { | ||
59 | plasmoidContainer.destroy(); | 59 | plasmoidContainer.destroy(); | ||
60 | print("applet destroyed") | 60 | print("applet destroyed") | ||
61 | } | 61 | } | ||
62 | } | 62 | } | ||
63 | Connections { | 63 | Connections { | ||
64 | target: applet | 64 | target: applet | ||
65 | onActivated: plasmoidContainer.activated() | ||||
66 | | ||||
65 | onExpandedChanged: { | 67 | onExpandedChanged: { | ||
66 | if (expanded) { | 68 | if (expanded) { | ||
67 | var oldApplet = root.activeApplet; | 69 | var oldApplet = root.activeApplet; | ||
68 | root.activeApplet = applet; | 70 | root.activeApplet = applet; | ||
69 | if (oldApplet) { | 71 | if (oldApplet) { | ||
70 | oldApplet.expanded = false; | 72 | oldApplet.expanded = false; | ||
71 | } | 73 | } | ||
72 | dialog.visible = true; | 74 | dialog.visible = true; | ||
75 | plasmoidContainer.activated() | ||||
73 | 76 | | |||
74 | } else if (root.activeApplet === applet) { | 77 | } else if (root.activeApplet === applet) { | ||
75 | if (!applet.parent.hidden) { | 78 | if (!applet.parent.hidden) { | ||
76 | dialog.visible = false; | 79 | dialog.visible = false; | ||
77 | } | 80 | } | ||
78 | //if not expanded we don't have an active applet anymore | 81 | //if not expanded we don't have an active applet anymore | ||
79 | root.activeApplet = null; | 82 | root.activeApplet = null; | ||
80 | } | 83 | } | ||
81 | } | 84 | } | ||
82 | } | 85 | } | ||
83 | } | 86 | } |
Do we want it here?