Changeset View
Changeset View
Standalone View
Standalone View
applets/systemtray/package/contents/ui/ExpandedRepresentation.qml
Show All 11 Lines | |||||
12 | * GNU Library General Public License for more details | 12 | * GNU Library General Public License for more details | ||
13 | * | 13 | * | ||
14 | * You should have received a copy of the GNU Library General Public | 14 | * You should have received a copy of the GNU Library General Public | ||
15 | * License along with this program; if not, write to the | 15 | * License along with this program; if not, write to the | ||
16 | * Free Software Foundation, Inc., | 16 | * Free Software Foundation, Inc., | ||
17 | * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. | 17 | * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. | ||
18 | */ | 18 | */ | ||
19 | 19 | | |||
20 | import QtQuick 2.12 | 20 | import QtQuick 2.1 | ||
21 | import QtQuick.Layouts 1.12 | 21 | import QtQuick.Layouts 1.1 | ||
22 | | ||||
23 | import org.kde.plasma.core 2.0 as PlasmaCore | 22 | import org.kde.plasma.core 2.0 as PlasmaCore | ||
24 | import org.kde.plasma.components 3.0 as PlasmaComponents | 23 | import org.kde.plasma.components 2.0 as PlasmaComponents | ||
25 | import org.kde.plasma.extras 2.0 as PlasmaExtras | 24 | import org.kde.plasma.extras 2.0 as PlasmaExtras | ||
26 | 25 | | |||
27 | ColumnLayout { | 26 | Item { | ||
28 | id: expandedRepresentation | 27 | id: expandedRepresentation | ||
28 | | ||||
29 | //set width/height to avoid an useless Dialog resize | 29 | //set width/height to avoid an useless Dialog resize | ||
30 | width: Layout.minimumWidth | 30 | width: Layout.minimumWidth | ||
31 | height: Layout.minimumHeight | 31 | height: Layout.minimumHeight | ||
32 | Layout.minimumWidth: units.gridUnit * 24 | 32 | Layout.minimumWidth: units.gridUnit * 24 | ||
33 | Layout.minimumHeight: units.gridUnit * 21 | 33 | Layout.minimumHeight: units.gridUnit * 21 | ||
34 | Layout.preferredWidth: Layout.minimumWidth | 34 | Layout.preferredWidth: Layout.minimumWidth | ||
35 | Layout.preferredHeight: Layout.minimumHeight * 1.5 | 35 | Layout.preferredHeight: Layout.minimumHeight * 1.5 | ||
36 | spacing: 0 // avoid gap between title and content | | |||
37 | 36 | | |||
38 | property alias activeApplet: container.activeApplet | 37 | property alias activeApplet: container.activeApplet | ||
39 | property alias hiddenLayout: hiddenItemsView.layout | 38 | property alias hiddenLayout: hiddenItemsView.layout | ||
40 | 39 | | |||
41 | RowLayout { | 40 | PlasmaComponents.ToolButton { | ||
42 | Layout.maximumWidth: parent.width //otherwise the pin button disappears in noApplet mode | 41 | id: pinButton | ||
42 | anchors.right: parent.right | ||||
43 | width: Math.round(units.gridUnit * 1.25) | ||||
44 | height: width | ||||
45 | checkable: true | ||||
46 | checked: plasmoid.configuration.pin | ||||
47 | onCheckedChanged: plasmoid.configuration.pin = checked | ||||
48 | iconSource: "window-pin" | ||||
49 | z: 2 | ||||
50 | tooltip: i18n("Keep Open") | ||||
51 | } | ||||
43 | 52 | | |||
44 | PlasmaExtras.Heading { | 53 | PlasmaExtras.Heading { | ||
45 | id: heading | 54 | id: heading | ||
46 | level: 1 | 55 | level: 1 | ||
47 | Layout.leftMargin: { | | |||
48 | //Menu mode | | |||
49 | if (!activeApplet && hiddenItemsView.visible && !LayoutMirroring.enabled) { | | |||
50 | return units.smallSpacing; | | |||
51 | 56 | | |||
52 | //applet open, sidebar | 57 | anchors { | ||
53 | } else if (activeApplet && hiddenItemsView.visible && !LayoutMirroring.enabled) { | 58 | left: parent.left | ||
54 | return hiddenItemsView.width + units.largeSpacing; | 59 | top: parent.top | ||
55 | 60 | right: parent.right | |||
56 | //applet open, no sidebar | 61 | topMargin: hiddenItemsView.visible ? units.smallSpacing : 0 | ||
57 | } else { | 62 | leftMargin: { | ||
58 | return 0; | | |||
59 | } | | |||
60 | } | | |||
61 | Layout.rightMargin: { | | |||
62 | //Menu mode | 63 | //Menu mode | ||
63 | if (!activeApplet && hiddenItemsView.visible && LayoutMirroring.enabled) { | 64 | if (!activeApplet && hiddenItemsView.visible) { | ||
64 | return units.smallSpacing; | 65 | return units.smallSpacing; | ||
65 | 66 | | |||
66 | //applet open, sidebar | 67 | //applet open, sidebar | ||
67 | } else if (activeApplet && hiddenItemsView.visible && LayoutMirroring.enabled) { | 68 | } else if (activeApplet && hiddenItemsView.visible) { | ||
68 | return hiddenItemsView.width + units.largeSpacing; | 69 | return hiddenItemsView.iconColumnWidth + units.largeSpacing; | ||
69 | 70 | | |||
70 | //applet open, no sidebar | 71 | //applet open, no sidebar | ||
71 | } else { | 72 | } else { | ||
72 | return 0; | 73 | return units.smallSpacing; | ||
74 | } | ||||
73 | } | 75 | } | ||
74 | } | 76 | } | ||
75 | 77 | | |||
76 | visible: activeApplet | 78 | visible: activeApplet | ||
77 | text: activeApplet ? activeApplet.title : "" | 79 | text: activeApplet ? activeApplet.title : "" | ||
78 | MouseArea { | 80 | MouseArea { | ||
79 | anchors.fill: parent | 81 | anchors.fill: parent | ||
80 | onClicked: { | 82 | onClicked: { | ||
81 | if (activeApplet) { | 83 | if (activeApplet) { | ||
82 | activeApplet.expanded = false; | 84 | activeApplet.expanded = false; | ||
83 | dialog.visible = true; | 85 | dialog.visible = true; | ||
84 | } | 86 | } | ||
85 | } | 87 | } | ||
86 | } | 88 | } | ||
87 | } | 89 | } | ||
88 | | ||||
89 | PlasmaExtras.Heading { | 90 | PlasmaExtras.Heading { | ||
90 | id: noAppletHeading | 91 | id: noAppletHeading | ||
91 | level: 1 | 92 | level: 1 | ||
93 | anchors { | ||||
94 | left: parent.left | ||||
95 | top: parent.top | ||||
96 | right: parent.right | ||||
97 | topMargin: hiddenItemsView.visible ? units.smallSpacing : 0 | ||||
98 | leftMargin: units.smallSpacing | ||||
99 | } | ||||
92 | text: i18n("Status and Notifications") | 100 | text: i18n("Status and Notifications") | ||
93 | visible: !heading.visible | 101 | visible: !heading.visible | ||
94 | } | 102 | } | ||
95 | 103 | | |||
96 | //spacer | 104 | PlasmaCore.SvgItem { | ||
97 | Item { | 105 | anchors { | ||
98 | Layout.fillWidth: true | 106 | left: parent.left | ||
99 | } | 107 | leftMargin: hiddenLayout.width | ||
100 | 108 | top: parent.top | |||
101 | PlasmaComponents.ToolButton { | 109 | bottom: parent.bottom | ||
102 | id: pinButton | 110 | margins: -units.gridUnit | ||
103 | checkable: true | | |||
104 | checked: plasmoid.configuration.pin | | |||
105 | onCheckedChanged: plasmoid.configuration.pin = checked | | |||
106 | icon.name: "window-pin" | | |||
107 | PlasmaComponents.ToolTip { | | |||
108 | text: i18n("Keep Open") | | |||
109 | } | | |||
110 | } | | |||
111 | } | | |||
112 | | ||||
113 | RowLayout { | | |||
114 | spacing: 0 // must be 0 so that the separator is as close to the indicator as possible | | |||
115 | | ||||
116 | HiddenItemsView { | | |||
117 | id: hiddenItemsView | | |||
118 | Layout.preferredWidth: visible && activeApplet ? iconColumnWidth : expandedRepresentation.width | | |||
119 | Layout.fillHeight: true | | |||
120 | } | 111 | } | ||
121 | 112 | | |||
122 | PlasmaCore.SvgItem { | | |||
123 | visible: hiddenItemsView.visible && activeApplet | 113 | visible: hiddenItemsView.visible && activeApplet | ||
124 | Layout.fillHeight: true | 114 | width: lineSvg.elementSize("vertical-line").width | ||
125 | Layout.preferredWidth: lineSvg.elementSize("vertical-line").width | 115 | | ||
126 | elementId: "vertical-line" | 116 | elementId: "vertical-line" | ||
117 | | ||||
127 | svg: PlasmaCore.Svg { | 118 | svg: PlasmaCore.Svg { | ||
128 | id: lineSvg; | 119 | id: lineSvg; | ||
129 | imagePath: "widgets/line" | 120 | imagePath: "widgets/line" | ||
130 | } | 121 | } | ||
131 | } | 122 | } | ||
132 | 123 | | |||
124 | HiddenItemsView { | ||||
125 | id: hiddenItemsView | ||||
126 | anchors { | ||||
127 | left: parent.left | ||||
128 | top: noAppletHeading.bottom | ||||
129 | topMargin: units.smallSpacing | ||||
130 | bottom: parent.bottom | ||||
131 | } | ||||
132 | } | ||||
133 | | ||||
133 | PlasmoidPopupsContainer { | 134 | PlasmoidPopupsContainer { | ||
134 | id: container | 135 | id: container | ||
135 | Layout.fillWidth: true | 136 | anchors { | ||
136 | Layout.fillHeight: true | 137 | left: parent.left | ||
137 | Layout.leftMargin: hiddenItemsView.visible && activeApplet && !LayoutMirroring.enabled ? units.largeSpacing : 0 | 138 | right: parent.right | ||
138 | Layout.rightMargin: hiddenItemsView.visible && activeApplet && LayoutMirroring.enabled ? units.largeSpacing : 0 | 139 | top: heading.bottom | ||
140 | bottom: parent.bottom | ||||
141 | leftMargin: hiddenItemsView.visible ? hiddenItemsView.iconColumnWidth + units.largeSpacing : 0 | ||||
139 | } | 142 | } | ||
140 | } | 143 | } | ||
141 | } | 144 | } |