Changeset View
Changeset View
Standalone View
Standalone View
applets/systemtray/package/contents/ui/items/PlasmoidItem.qml
Show All 18 Lines | |||||
19 | 19 | | |||
20 | import QtQuick 2.1 | 20 | import QtQuick 2.1 | ||
21 | import org.kde.plasma.core 2.0 as PlasmaCore | 21 | import org.kde.plasma.core 2.0 as PlasmaCore | ||
22 | 22 | | |||
23 | AbstractItem { | 23 | AbstractItem { | ||
24 | id: plasmoidContainer | 24 | id: plasmoidContainer | ||
25 | 25 | | |||
26 | property Item applet: model.applet || null | 26 | property Item applet: model.applet || null | ||
27 | iconItem: applet | | |||
28 | text: applet ? applet.title : "" | 27 | text: applet ? applet.title : "" | ||
29 | 28 | | |||
30 | itemId: applet ? applet.pluginName : "" | 29 | itemId: applet ? applet.pluginName : "" | ||
31 | mainText: applet ? applet.toolTipMainText : "" | 30 | mainText: applet ? applet.toolTipMainText : "" | ||
32 | subText: applet ? applet.toolTipSubText : "" | 31 | subText: applet ? applet.toolTipSubText : "" | ||
33 | icon: applet ? applet.icon : "" | 32 | icon: applet ? applet.icon : "" | ||
34 | mainItem: applet && applet.toolTipItem ? applet.toolTipItem : null | 33 | mainItem: applet && applet.toolTipItem ? applet.toolTipItem : null | ||
35 | textFormat: applet ? applet.toolTipTextFormat : "" | 34 | textFormat: applet ? applet.toolTipTextFormat : "" | ||
Show All 10 Lines | 42 | onPressed: { | |||
46 | } | 45 | } | ||
47 | } | 46 | } | ||
48 | onContextMenu: { | 47 | onContextMenu: { | ||
49 | if (applet) { | 48 | if (applet) { | ||
50 | plasmoid.nativeInterface.showPlasmoidMenu(applet, 0, plasmoidContainer.inHiddenLayout ? applet.height : 0); | 49 | plasmoid.nativeInterface.showPlasmoidMenu(applet, 0, plasmoidContainer.inHiddenLayout ? applet.height : 0); | ||
51 | } | 50 | } | ||
52 | } | 51 | } | ||
53 | 52 | | |||
54 | onHeightChanged: { | | |||
55 | if (applet) { | | |||
56 | applet.width = Math.min(plasmoidContainer.width, plasmoidContainer.height) | | |||
57 | applet.height = applet.width | | |||
58 | } | | |||
59 | } | | |||
60 | onWidthChanged: { | | |||
61 | if (applet) { | | |||
62 | applet.width = Math.min(plasmoidContainer.width, plasmoidContainer.height) | | |||
63 | applet.height = applet.width | | |||
64 | } | | |||
65 | } | | |||
66 | | ||||
67 | //This is to make preloading effective, minimizes the scene changes | 53 | //This is to make preloading effective, minimizes the scene changes | ||
68 | function preloadFullRepresentationItem(fullRepresentationItem) { | 54 | function preloadFullRepresentationItem(fullRepresentationItem) { | ||
69 | if (fullRepresentationItem && fullRepresentationItem.parent === null) { | 55 | if (fullRepresentationItem && fullRepresentationItem.parent === null) { | ||
70 | fullRepresentationItem.width = expandedRepresentation.width | 56 | fullRepresentationItem.width = expandedRepresentation.width | ||
71 | fullRepresentationItem.width = expandedRepresentation.height | 57 | fullRepresentationItem.width = expandedRepresentation.height | ||
72 | fullRepresentationItem.parent = preloadedStorage; | 58 | fullRepresentationItem.parent = preloadedStorage; | ||
73 | } | 59 | } | ||
74 | } | 60 | } | ||
75 | 61 | | |||
76 | onAppletChanged: { | 62 | onAppletChanged: { | ||
77 | if (applet) { | 63 | if (applet) { | ||
78 | applet.parent = plasmoidContainer | 64 | applet.parent = plasmoidContainer.iconContainer | ||
79 | applet.anchors.left = plasmoidContainer.left | 65 | applet.anchors.fill = applet.parent | ||
80 | applet.anchors.verticalCenter = plasmoidContainer.verticalCenter | | |||
81 | applet.width = Math.min(plasmoidContainer.width, plasmoidContainer.height) | | |||
82 | applet.height = applet.width | | |||
83 | applet.visible = true | 66 | applet.visible = true | ||
84 | 67 | | |||
85 | preloadFullRepresentationItem(applet.fullRepresentationItem) | 68 | preloadFullRepresentationItem(applet.fullRepresentationItem) | ||
86 | } | 69 | } | ||
87 | } | 70 | } | ||
88 | 71 | | |||
89 | Connections { | 72 | Connections { | ||
90 | target: applet | 73 | target: applet | ||
Show All 26 Lines |