Changeset View
Changeset View
Standalone View
Standalone View
applets/kickoff/package/contents/ui/ConfigButtons.qml
Show All 20 Lines | |||||
21 | 21 | | |||
22 | import org.kde.plasma.core 2.0 as PlasmaCore | 22 | import org.kde.plasma.core 2.0 as PlasmaCore | ||
23 | import org.kde.kirigami 2.5 as Kirigami | 23 | import org.kde.kirigami 2.5 as Kirigami | ||
24 | 24 | | |||
25 | 25 | | |||
26 | GridView { | 26 | GridView { | ||
27 | id: configButtons | 27 | id: configButtons | ||
28 | 28 | | |||
29 | cellHeight: units.gridUnit * 6 + units.smallSpacing | 29 | cellHeight: units.gridUnit * 5 + units.smallSpacing | ||
30 | cellWidth: units.gridUnit * 6 | 30 | cellWidth: units.gridUnit * 5 | ||
31 | 31 | | |||
32 | width: cellWidth * 5 | 32 | implicitWidth: cellWidth * 5 | ||
33 | height: cellHeight * 2 | 33 | implicitHeight: cellHeight * 2 | ||
34 | 34 | | |||
35 | property var items: { | 35 | property var items: { | ||
36 | "bookmark": { icon: "bookmarks", text: i18n("Favorites")}, | 36 | "bookmark": { icon: "bookmarks", text: i18n("Favorites")}, | ||
37 | "application": { icon: "applications-other", text: i18n("Applications")}, | 37 | "application": { icon: "applications-other", text: i18n("Applications")}, | ||
38 | "computer": { icon: "pm", text: i18n("Computer")}, | 38 | "computer": { icon: "pm", text: i18n("Computer")}, | ||
39 | "used": { icon: "view-history", text: i18n("History")}, | 39 | "used": { icon: "view-history", text: i18n("History")}, | ||
40 | "oftenUsed": { icon: "office-chart-pie", text: i18n("Often Used")}, | 40 | "oftenUsed": { icon: "office-chart-pie", text: i18n("Often Used")}, | ||
41 | "leave": { icon: "system-log-out", text: i18n("Leave")} | 41 | "leave": { icon: "system-log-out", text: i18n("Leave")} | ||
▲ Show 20 Lines • Show All 59 Lines • ▼ Show 20 Line(s) | |||||
101 | function resetModel() { | 101 | function resetModel() { | ||
102 | listModel.clear(); | 102 | listModel.clear(); | ||
103 | var items = updateModel(); | 103 | var items = updateModel(); | ||
104 | for(var i = 0; i< items.length; i++) { | 104 | for(var i = 0; i< items.length; i++) { | ||
105 | listModel.append(items[i]); | 105 | listModel.append(items[i]); | ||
106 | } | 106 | } | ||
107 | } | 107 | } | ||
108 | 108 | | |||
109 | | ||||
110 | displaced: Transition { | 109 | displaced: Transition { | ||
111 | NumberAnimation { properties: "x,y"; easing.type: Easing.OutQuad } | 110 | NumberAnimation { properties: "x,y"; easing.type: Easing.OutQuad } | ||
112 | } | 111 | } | ||
113 | 112 | | |||
114 | PlasmaCore.DataSource { | 113 | PlasmaCore.DataSource { | ||
115 | id: pmSource | 114 | id: pmSource | ||
116 | engine: "powermanagement" | 115 | engine: "powermanagement" | ||
117 | connectedSources: ["PowerDevil"] | 116 | connectedSources: ["PowerDevil"] | ||
118 | } | 117 | } | ||
119 | 118 | | |||
120 | model: DelegateModel { | 119 | model: DelegateModel { | ||
121 | id: visualModel | 120 | id: visualModel | ||
122 | model: ListModel { | 121 | model: ListModel { | ||
123 | id: listModel | 122 | id: listModel | ||
124 | } | 123 | } | ||
125 | 124 | | |||
126 | delegate: MouseArea { | 125 | delegate: MouseArea { | ||
127 | id: delegateRoot | 126 | id: delegateRoot | ||
128 | 127 | | |||
129 | width: units.gridUnit * 6 | 128 | width: units.gridUnit * 5 | ||
130 | height: units.gridUnit * 5 | 129 | height: units.gridUnit * 4 | ||
131 | 130 | | |||
132 | property int visualIndex: DelegateModel.itemsIndex | 131 | property int visualIndex: DelegateModel.itemsIndex | ||
133 | 132 | | |||
134 | drag.target: button | 133 | drag.target: button | ||
135 | 134 | | |||
136 | onReleased: { | 135 | onReleased: { | ||
137 | button.Drag.drop() | 136 | button.Drag.drop() | ||
138 | } | 137 | } | ||
▲ Show 20 Lines • Show All 66 Lines • ▼ Show 20 Line(s) | 202 | onDropped: { | |||
205 | updateConfiguration(); | 204 | updateConfiguration(); | ||
206 | sourceIndex = -1; | 205 | sourceIndex = -1; | ||
207 | previousCell = [-1, -1]; | 206 | previousCell = [-1, -1]; | ||
208 | } | 207 | } | ||
209 | } | 208 | } | ||
210 | } | 209 | } | ||
211 | } | 210 | } | ||
212 | 211 | | |||
213 | Kirigami.Heading { | 212 | header: Kirigami.Heading { | ||
214 | level: 2 | 213 | level: 2 | ||
215 | text: i18n("Active Tabs") | 214 | text: i18n("Active Tabs") | ||
216 | anchors.bottom: configButtons.top | 215 | width: parent.width | ||
216 | horizontalAlignment: Text.AlignHCenter | ||||
217 | } | 217 | } | ||
218 | 218 | | |||
219 | // the middle label is placed right the middle of the grid view, which is a single grid with a gap in the middle | ||||
219 | Kirigami.Heading { | 220 | Kirigami.Heading { | ||
220 | level: 2 | 221 | level: 2 | ||
221 | text: i18n("Inactive Tabs") | 222 | text: i18n("Inactive Tabs") | ||
222 | anchors.bottom: configButtons.verticalCenter | 223 | anchors.top: configButtons.verticalCenter | ||
224 | width: parent.width | ||||
225 | horizontalAlignment: Text.AlignHCenter | ||||
223 | } | 226 | } | ||
224 | } | 227 | } |