Changeset View
Changeset View
Standalone View
Standalone View
containments/desktop/package/contents/ui/ConfigLocation.qml
Show All 16 Lines | |||||
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.0 | 20 | import QtQuick 2.0 | ||
21 | import QtQuick.Controls 1.0 | 21 | import QtQuick.Controls 1.0 | ||
22 | import QtQuick.Layouts 1.0 | 22 | import QtQuick.Layouts 1.0 | ||
23 | 23 | | |||
24 | import org.kde.plasma.plasmoid 2.0 | 24 | import org.kde.plasma.plasmoid 2.0 | ||
25 | import org.kde.kirigami 2.4 as Kirigami | ||||
25 | 26 | | |||
26 | import org.kde.private.desktopcontainment.folder 0.1 as Folder | 27 | import org.kde.private.desktopcontainment.folder 0.1 as Folder | ||
27 | 28 | | |||
28 | Item { | 29 | Item { | ||
29 | id: configLocation | 30 | id: configLocation | ||
30 | 31 | | |||
31 | width: childrenRect.width | 32 | width: childrenRect.width | ||
32 | height: childrenRect.height | 33 | height: childrenRect.height | ||
▲ Show 20 Lines • Show All 46 Lines • ▼ Show 20 Line(s) | 79 | onCurrentChanged: { | |||
79 | if (current == locationDesktop) { | 80 | if (current == locationDesktop) { | ||
80 | cfg_url = "desktop:/"; | 81 | cfg_url = "desktop:/"; | ||
81 | } else if (current == locationCurrentActivity) { | 82 | } else if (current == locationCurrentActivity) { | ||
82 | cfg_url = "activities:/current/"; | 83 | cfg_url = "activities:/current/"; | ||
83 | } | 84 | } | ||
84 | } | 85 | } | ||
85 | } | 86 | } | ||
86 | 87 | | |||
87 | GridLayout { | 88 | Kirigami.FormLayout { | ||
88 | 89 | anchors.horizontalCenter: parent.horizontalCenter | |||
89 | // Row 0: "Show the Desktop folder" | | |||
90 | Label { | | |||
91 | id: locationLabel | | |||
92 | Layout.column: 0 | | |||
93 | Layout.row: 0 | | |||
94 | text: i18n("Location:") | | |||
95 | } | | |||
96 | 90 | | |||
97 | RadioButton { | 91 | RadioButton { | ||
98 | id: locationDesktop | 92 | id: locationDesktop | ||
99 | Layout.row: 0 | 93 | | ||
100 | Layout.column: 1 | 94 | Kirigami.FormData.label: i18n("Show:") | ||
101 | Layout.columnSpan: 3 | 95 | | ||
102 | text: i18n("Show the Desktop folder") | 96 | text: i18n("Desktop folder") | ||
103 | exclusiveGroup: locationGroup | 97 | exclusiveGroup: locationGroup | ||
104 | } | 98 | } | ||
105 | 99 | | |||
106 | // Row 1: "Show files linked to the current activity" | | |||
107 | RadioButton { | 100 | RadioButton { | ||
108 | id: locationCurrentActivity | 101 | id: locationCurrentActivity | ||
109 | Layout.row: 1 | | |||
110 | Layout.column: 1 | | |||
111 | Layout.columnSpan: 3 | | |||
112 | | ||||
113 | visible: placesModel.activityLinkingEnabled | 102 | visible: placesModel.activityLinkingEnabled | ||
114 | text: i18n("Show files linked to the current activity") | 103 | | ||
104 | text: i18n("Files linked to the current activity") | ||||
115 | exclusiveGroup: locationGroup | 105 | exclusiveGroup: locationGroup | ||
116 | } | 106 | } | ||
117 | 107 | | |||
118 | // Rows 2+3: "Show a place" | | |||
119 | RadioButton { | 108 | RadioButton { | ||
120 | id: locationPlace | 109 | id: locationPlace | ||
121 | Layout.row: 2 | 110 | | ||
122 | Layout.column: 1 | 111 | text: i18n("Places panel item:") | ||
123 | Layout.columnSpan: 3 | | |||
124 | text: i18n("Show a place:") | | |||
125 | 112 | | |||
126 | exclusiveGroup: locationGroup | 113 | exclusiveGroup: locationGroup | ||
127 | 114 | | |||
128 | onCheckedChanged: { | 115 | onCheckedChanged: { | ||
129 | locationPlaceValue.enabled = checked; | 116 | locationPlaceValue.enabled = checked; | ||
130 | } | 117 | } | ||
131 | } | 118 | } | ||
119 | RowLayout { | ||||
120 | Layout.fillWidth: true | ||||
132 | 121 | | |||
133 | Item { | 122 | Kirigami.Spacer { | ||
134 | id: indentSpacer | | |||
135 | Layout.row: 3 | | |||
136 | Layout.column: 1 | | |||
137 | Layout.minimumWidth: units.largeSpacing | | |||
138 | } | 123 | } | ||
139 | | ||||
140 | ComboBox { | 124 | ComboBox { | ||
141 | id: locationPlaceValue | 125 | id: locationPlaceValue | ||
142 | Layout.row: 3 | 126 | | ||
143 | Layout.column: 2 | | |||
144 | Layout.columnSpan: 2 | | |||
145 | Layout.fillWidth: true | 127 | Layout.fillWidth: true | ||
146 | 128 | | |||
147 | model: placesModel | 129 | model: placesModel | ||
148 | textRole: "display" | 130 | textRole: "display" | ||
149 | 131 | | |||
150 | enabled: true | 132 | enabled: true | ||
151 | 133 | | |||
152 | onEnabledChanged: { | 134 | onEnabledChanged: { | ||
153 | if (enabled && currentIndex != -1) { | 135 | if (enabled && currentIndex != -1) { | ||
154 | cfg_url = placesModel.urlForIndex(currentIndex); | 136 | cfg_url = placesModel.urlForIndex(currentIndex); | ||
155 | } | 137 | } | ||
156 | } | 138 | } | ||
157 | 139 | | |||
158 | onActivated: { | 140 | onActivated: { | ||
159 | cfg_url = placesModel.urlForIndex(index); | 141 | cfg_url = placesModel.urlForIndex(index); | ||
160 | } | 142 | } | ||
161 | } | 143 | } | ||
162 | 144 | } | |||
163 | // Rows 4+5: "Specify a folder" | | |||
164 | 145 | | |||
165 | RadioButton { | 146 | RadioButton { | ||
166 | id: locationCustom | 147 | id: locationCustom | ||
167 | Layout.row: 4 | | |||
168 | Layout.column: 1 | | |||
169 | Layout.columnSpan: 3 | | |||
170 | 148 | | |||
171 | exclusiveGroup: locationGroup | 149 | exclusiveGroup: locationGroup | ||
172 | text: i18n("Specify a folder:") | 150 | text: i18n("Custom location:") | ||
173 | } | 151 | } | ||
174 | 152 | | |||
153 | RowLayout { | ||||
154 | Layout.fillWidth: true | ||||
155 | Kirigami.Spacer { | ||||
156 | } | ||||
175 | TextField { | 157 | TextField { | ||
176 | id: locationCustomValue | 158 | id: locationCustomValue | ||
177 | Layout.row: 5 | | |||
178 | Layout.column: 2 | | |||
179 | Layout.fillWidth: true | | |||
180 | | ||||
181 | enabled: locationCustom.checked | 159 | enabled: locationCustom.checked | ||
160 | Layout.fillWidth: true | ||||
182 | 161 | | |||
183 | placeholderText: i18n("Type a path or a URL here") | 162 | placeholderText: i18n("Type a path or a URL here") | ||
184 | 163 | | |||
185 | onEnabledChanged: { | 164 | onEnabledChanged: { | ||
186 | if (enabled && text != "") { | 165 | if (enabled && text != "") { | ||
187 | cfg_url = text; | 166 | cfg_url = text; | ||
188 | } | 167 | } | ||
189 | } | 168 | } | ||
190 | 169 | | |||
191 | onTextChanged: { | 170 | onTextChanged: { | ||
192 | if (enabled) { | 171 | if (enabled) { | ||
193 | cfg_url = text; | 172 | cfg_url = text; | ||
194 | } | 173 | } | ||
195 | } | 174 | } | ||
196 | } | 175 | } | ||
197 | | ||||
198 | Button { | 176 | Button { | ||
199 | Layout.row: 5 | | |||
200 | Layout.column: 3 | | |||
201 | Layout.alignment: Qt.AlignLeft | | |||
202 | iconName: "document-open" | 177 | iconName: "document-open" | ||
203 | 178 | | |||
204 | enabled: locationCustom.checked | 179 | enabled: locationCustom.checked | ||
205 | 180 | | |||
206 | onClicked: { | 181 | onClicked: { | ||
207 | directoryPicker.open(); | 182 | directoryPicker.open(); | ||
208 | } | 183 | } | ||
209 | } | 184 | } | ||
210 | | ||||
211 | Folder.DirectoryPicker { | 185 | Folder.DirectoryPicker { | ||
212 | id: directoryPicker | 186 | id: directoryPicker | ||
213 | 187 | | |||
214 | onUrlChanged: { | 188 | onUrlChanged: { | ||
215 | locationCustomValue.text = url; | 189 | locationCustomValue.text = url; | ||
216 | } | 190 | } | ||
217 | } | 191 | } | ||
218 | | ||||
219 | // Row 6: Spacing | | |||
220 | Item { | | |||
221 | id: titleSpacer | | |||
222 | Layout.column: 0 | | |||
223 | Layout.row: 6 | | |||
224 | Layout.minimumHeight: units.largeSpacing | | |||
225 | visible: titleVisible | | |||
226 | } | 192 | } | ||
227 | 193 | | |||
228 | // Rows 7+8: "Title" | 194 | Kirigami.Spacer { | ||
229 | Label { | | |||
230 | id: titleLabel | | |||
231 | Layout.column: 0 | | |||
232 | Layout.row: 7 | | |||
233 | text: i18n("Title:") | | |||
234 | visible: titleVisible | 195 | visible: titleVisible | ||
235 | } | 196 | } | ||
236 | 197 | | |||
198 | | ||||
237 | ComboBox { | 199 | ComboBox { | ||
238 | id: labelMode | 200 | id: labelMode | ||
239 | Layout.row: 7 | | |||
240 | Layout.column: 1 | | |||
241 | Layout.columnSpan: 3 | | |||
242 | Layout.fillWidth: true | | |||
243 | visible: titleVisible | 201 | visible: titleVisible | ||
202 | Layout.fillWidth: true | ||||
203 | | ||||
204 | Kirigami.FormData.label: i18n("Title:") | ||||
244 | 205 | | |||
245 | model: [i18n("None"), i18n("Default"), i18n("Full path"), i18n("Custom title")] | 206 | model: [i18n("None"), i18n("Default"), i18n("Full path"), i18n("Custom title")] | ||
246 | } | 207 | } | ||
247 | 208 | | |||
248 | TextField { | 209 | RowLayout { | ||
249 | id: labelText | | |||
250 | Layout.row: 8 | | |||
251 | Layout.column: 2 | | |||
252 | Layout.columnSpan: 2 | | |||
253 | Layout.fillWidth: true | 210 | Layout.fillWidth: true | ||
254 | visible: titleVisible | 211 | visible: titleVisible | ||
255 | 212 | | |||
213 | Kirigami.Spacer { | ||||
214 | } | ||||
215 | TextField { | ||||
216 | id: labelText | ||||
217 | Layout.fillWidth: true | ||||
256 | enabled: (labelMode.currentIndex == 3) | 218 | enabled: (labelMode.currentIndex == 3) | ||
257 | 219 | | |||
258 | placeholderText: i18n("Enter custom title here") | 220 | placeholderText: i18n("Enter custom title here") | ||
259 | } | 221 | } | ||
260 | } | 222 | } | ||
261 | } | 223 | } | ||
224 | } |