Changeset View
Changeset View
Standalone View
Standalone View
applets/systemtray/package/contents/ui/items/PlasmoidItem.qml
Show All 31 Lines | 23 | AbstractItem { | |||
---|---|---|---|---|---|
32 | mainText: applet ? applet.toolTipMainText : "" | 32 | mainText: applet ? applet.toolTipMainText : "" | ||
33 | subText: applet ? applet.toolTipSubText : "" | 33 | subText: applet ? applet.toolTipSubText : "" | ||
34 | icon: applet ? applet.icon : "" | 34 | icon: applet ? applet.icon : "" | ||
35 | mainItem: applet && applet.toolTipItem ? applet.toolTipItem : null | 35 | mainItem: applet && applet.toolTipItem ? applet.toolTipItem : null | ||
36 | textFormat: applet ? applet.toolTipTextFormat : "" | 36 | textFormat: applet ? applet.toolTipTextFormat : "" | ||
37 | status: applet ? applet.status : PlasmaCore.Types.UnknownStatus | 37 | status: applet ? applet.status : PlasmaCore.Types.UnknownStatus | ||
38 | active: root.activeApplet !== applet | 38 | active: root.activeApplet !== applet | ||
39 | 39 | | |||
40 | Component.onDestruction: { | | |||
41 | applet = null | | |||
42 | } | | |||
43 | | ||||
44 | onClicked: { | 40 | onClicked: { | ||
45 | if (applet && mouse.button === Qt.LeftButton) { | 41 | if (applet && mouse.button === Qt.LeftButton) { | ||
46 | applet.expanded = true; | 42 | applet.expanded = true; | ||
47 | } | 43 | } | ||
48 | } | 44 | } | ||
49 | onPressed: { | 45 | onPressed: { | ||
50 | if (mouse.button === Qt.RightButton) { | 46 | if (mouse.button === Qt.RightButton) { | ||
51 | plasmoidContainer.contextMenu(mouse); | 47 | plasmoidContainer.contextMenu(mouse); | ||
52 | } | 48 | } | ||
53 | } | 49 | } | ||
54 | onContextMenu: { | 50 | onContextMenu: { | ||
55 | if (applet) { | 51 | if (applet) { | ||
56 | plasmoid.nativeInterface.showPlasmoidMenu(applet, 0, plasmoidContainer.inHiddenLayout ? applet.height : 0); | 52 | plasmoid.nativeInterface.showPlasmoidMenu(applet, 0, plasmoidContainer.inHiddenLayout ? applet.height : 0); | ||
57 | } | 53 | } | ||
58 | } | 54 | } | ||
59 | 55 | | |||
60 | onHeightChanged: { | 56 | onHeightChanged: { | ||
61 | if (applet) { | 57 | if (applet) { | ||
62 | applet.width = height | 58 | applet.width = height | ||
63 | } | 59 | } | ||
64 | } | 60 | } | ||
65 | 61 | | |||
66 | //This is to make preloading effective, minimizes the scene changes | 62 | //This is to make preloading effective, minimizes the scene changes | ||
67 | function preloadFullRepresentationItem(fullRepresentationItem) { | 63 | function preloadFullRepresentationItem(fullRepresentationItem) { | ||
68 | if (fullRepresentationItem && applet.fullRepresentationItem.parent === null) { | 64 | if (fullRepresentationItem && fullRepresentationItem.parent === null) { | ||
69 | fullRepresentationItem.width = expandedRepresentation.width | 65 | fullRepresentationItem.width = expandedRepresentation.width | ||
70 | fullRepresentationItem.width = expandedRepresentation.height | 66 | fullRepresentationItem.width = expandedRepresentation.height | ||
71 | fullRepresentationItem.parent = preloadedStorage; | 67 | fullRepresentationItem.parent = preloadedStorage; | ||
72 | } | 68 | } | ||
73 | } | 69 | } | ||
74 | 70 | | |||
75 | onAppletChanged: { | 71 | onAppletChanged: { | ||
76 | if (applet) { | 72 | if (applet) { | ||
▲ Show 20 Lines • Show All 43 Lines • Show Last 20 Lines |