Merge lp:~dpm/ubuntu-filemanager-app/xdguserdir into lp:ubuntu-filemanager-app
- xdguserdir
- Merge into trunk
Status: | Superseded |
---|---|
Proposed branch: | lp:~dpm/ubuntu-filemanager-app/xdguserdir |
Merge into: | lp:ubuntu-filemanager-app |
Diff against target: |
638 lines (+319/-101) 14 files modified
debian/control (+10/-0) debian/qtdeclarative5-xdguserdirs0.1.install (+1/-0) src/app/qml/components/PathBar.qml (+6/-1) src/app/qml/components/PlacesSidebar.qml (+2/-35) src/app/qml/filemanager.qml (+7/-2) src/app/qml/ui/FolderListPage.qml (+15/-28) src/app/qml/ui/PlacesPopover.qml (+2/-35) src/plugin/CMakeLists.txt (+1/-0) src/plugin/xdguserdir/CMakeLists.txt (+35/-0) src/plugin/xdguserdir/qmldir (+2/-0) src/plugin/xdguserdir/xdguserdir.cpp (+108/-0) src/plugin/xdguserdir/xdguserdir.h (+57/-0) src/plugin/xdguserdir/xdguserdir_plugin.cpp (+34/-0) src/plugin/xdguserdir/xdguserdir_plugin.h (+39/-0) |
To merge this branch: | bzr merge lp:~dpm/ubuntu-filemanager-app/xdguserdir |
Related bugs: |
Reviewer | Review Type | Date Requested | Status |
---|---|---|---|
Ubuntu Phone Apps Jenkins Bot | continuous-integration | Needs Fixing | |
David Planella | Needs Information | ||
Michael Spencer | Needs Fixing | ||
Nicholas Skaggs | Pending | ||
Review via email: mp+223411@code.launchpad.net |
This proposal has been superseded by a proposal from 2014-06-18.
Commit message
Add a plugin to return the user's directories via the XDG spec
Description of the change
Add a plugin to return the user's directories via the XDG spec
Ubuntu Phone Apps Jenkins Bot (ubuntu-phone-apps-jenkins-bot) wrote : | # |
Michael Spencer (ibelieve) wrote : | # |
What is the reason for replacing "~" with userdirs.
Also, you should mark your branch as fixing LP #1328332 and assign your self to the bug.
Michael Spencer (ibelieve) wrote : | # |
I see the bug related to the "~" question I was wondering about, but I don't think using userdirs.
David Planella (dpm) wrote : | # |
To answer the first question, the model does not seem to do the "~" expansion. This is the first bug this branch addresses.
The next one is about it not loading the localized user dirs.
Why do you think that userdirs.
Nicholas Skaggs (nskaggs) wrote : | # |
Add the depends?
file://
import com.canonical.
Michael Spencer (ibelieve) wrote : | # |
Actually, it is doing the expansion correctly, at least it is when I just checked. The bug is here:
FolderListModel {
id: repeaterModel
path: folderListPage.
}
}
userdirs.
// This stores the location using ~ to represent home
property string folder: homeFolder
property string homeFolder: "~"
// This replaces ~ with the actual home folder, since the
// plugin doesn't recognize the ~
property string path: folder.replace("~", folderModel.
So the actual fix to that bug should be changing:
id: repeaterModel
path: folderListPage.
To:
id: repeaterModel
path: folderListPage.path
Does that make sense, or is there something else I am missing?
- 210. By David Planella
-
Fixed ~ replacements, renamed plugin
- 211. By David Planella
-
Created debian package for the XDG user dirs plugin
David Planella (dpm) wrote : | # |
Ah, I know what you mean now. Yes, what you are saying makes sense, and if that'd be the only bug targetted, this would be the fix that I'd favour too.
However, while fixing the hardcoded Documents, Music, etc. folders, I think it makes sense to return the home dir as part of the XDG user dirs listing, and it gives us the ability to use that as a model for the places sidebar and the places popup. Also, after your last comment, I've made some changes to remove the need to do on-the-fly replacement of "~"
Ubuntu Phone Apps Jenkins Bot (ubuntu-phone-apps-jenkins-bot) wrote : | # |
FAILED: Continuous integration, rev:211
http://
Executed test runs:
UNSTABLE: http://
deb: http://
SUCCESS: http://
Click here to trigger a rebuild:
http://
Unmerged revisions
Preview Diff
1 | === modified file 'debian/control' |
2 | --- debian/control 2014-05-06 17:57:59 +0000 |
3 | +++ debian/control 2014-06-18 07:41:55 +0000 |
4 | @@ -41,6 +41,16 @@ |
5 | This package contains the Folder List model plugin of the Nemo QML |
6 | plugins collection. |
7 | |
8 | +Package: qtdeclarative5-xdguserdirs0.1 |
9 | +Architecture: any |
10 | +Multi-Arch: same |
11 | +Depends: ${misc:Depends}, |
12 | + ${shlibs:Depends}, |
13 | + ${misc:Pre-Depends}, |
14 | +Description: XDG user dirs QML plugin |
15 | + This package contains a plugin that enables QML apps to list the |
16 | + XDG user locations in the file system. |
17 | + |
18 | Package: ubuntu-filemanager-app-autopilot |
19 | Architecture: all |
20 | Depends: ${misc:Depends}, |
21 | |
22 | === added file 'debian/qtdeclarative5-xdguserdirs0.1.install' |
23 | --- debian/qtdeclarative5-xdguserdirs0.1.install 1970-01-01 00:00:00 +0000 |
24 | +++ debian/qtdeclarative5-xdguserdirs0.1.install 2014-06-18 07:41:55 +0000 |
25 | @@ -0,0 +1,1 @@ |
26 | +usr/lib/*/qt5/qml/com/ubuntu/XdgUserDirs/ |
27 | |
28 | === modified file 'src/app/qml/components/PathBar.qml' |
29 | --- src/app/qml/components/PathBar.qml 2014-06-03 23:27:22 +0000 |
30 | +++ src/app/qml/components/PathBar.qml 2014-06-18 07:41:55 +0000 |
31 | @@ -1,6 +1,7 @@ |
32 | import QtQuick 2.0 |
33 | import Ubuntu.Components 0.1 |
34 | import Ubuntu.Components.Popups 0.1 |
35 | +import com.ubuntu.XdgUserDirs 0.1 |
36 | |
37 | Rectangle { |
38 | id: root |
39 | @@ -17,6 +18,10 @@ |
40 | UbuntuNumberAnimation {} |
41 | } |
42 | |
43 | + XdgUserDirs { |
44 | + id: userdirs |
45 | + } |
46 | + |
47 | Rectangle { |
48 | id: goToButton |
49 | objectName: "goToButton" |
50 | @@ -117,7 +122,7 @@ |
51 | Label { |
52 | id: label |
53 | anchors.centerIn: parent |
54 | - text: modelData === "" ? "/" : modelData === "~" ? i18n.tr("Home") : modelData |
55 | + text: modelData === "" ? "/" : modelData |
56 | color: UbuntuColors.coolGrey |
57 | } |
58 | |
59 | |
60 | === modified file 'src/app/qml/components/PlacesSidebar.qml' |
61 | --- src/app/qml/components/PlacesSidebar.qml 2014-06-10 02:34:07 +0000 |
62 | +++ src/app/qml/components/PlacesSidebar.qml 2014-06-18 07:41:55 +0000 |
63 | @@ -20,6 +20,7 @@ |
64 | import Ubuntu.Components 0.1 |
65 | import Ubuntu.Components.ListItems 0.1 |
66 | import Ubuntu.Components.Popups 0.1 |
67 | +import com.ubuntu.XdgUserDirs 0.1 |
68 | |
69 | Sidebar { |
70 | id: root |
71 | @@ -42,40 +43,6 @@ |
72 | UbuntuNumberAnimation {} |
73 | } |
74 | |
75 | - ListModel { |
76 | - id: places |
77 | - |
78 | - ListElement { |
79 | - objectName: "placeHome" |
80 | - path: "~" |
81 | - } |
82 | - |
83 | - ListElement { |
84 | - path: "~/Documents" |
85 | - } |
86 | - |
87 | - ListElement { |
88 | - path: "~/Downloads" |
89 | - } |
90 | - |
91 | - ListElement { |
92 | - path: "~/Music" |
93 | - } |
94 | - |
95 | - ListElement { |
96 | - path: "~/Pictures" |
97 | - } |
98 | - |
99 | - ListElement { |
100 | - path: "~/Videos" |
101 | - } |
102 | - |
103 | - ListElement { |
104 | - objectName: "placeRoot" |
105 | - path: "/" |
106 | - } |
107 | - } |
108 | - |
109 | Column { |
110 | anchors { |
111 | left: parent.left |
112 | @@ -91,7 +58,7 @@ |
113 | id: placesList |
114 | objectName: "placesList" |
115 | |
116 | - model: places |
117 | + model: XdgUserDirs {} |
118 | |
119 | delegate: Standard { |
120 | objectName: model.objectName |
121 | |
122 | === modified file 'src/app/qml/filemanager.qml' |
123 | --- src/app/qml/filemanager.qml 2014-04-29 18:05:45 +0000 |
124 | +++ src/app/qml/filemanager.qml 2014-06-18 07:41:55 +0000 |
125 | @@ -21,6 +21,7 @@ |
126 | import Ubuntu.Components.Popups 0.1 |
127 | import Ubuntu.Unity.Action 1.0 as UnityActions |
128 | import U1db 1.0 as U1db |
129 | +import com.ubuntu.XdgUserDirs 0.1 |
130 | |
131 | import "ui" |
132 | |
133 | @@ -60,6 +61,10 @@ |
134 | backgroundColor: "#797979" |
135 | footerColor: "#808080" |
136 | |
137 | + XdgUserDirs { |
138 | + id: userdirs |
139 | + } |
140 | + |
141 | // HUD Actions |
142 | Action { |
143 | id: settingsAction |
144 | @@ -72,7 +77,7 @@ |
145 | |
146 | property var pageStack: pageStack |
147 | |
148 | - property var folderTabs: ["~"] |
149 | + property var folderTabs: [userdirs.locationHome] |
150 | |
151 | function openTab(folder) { |
152 | var list = folderTabs |
153 | @@ -100,7 +105,7 @@ |
154 | page: FolderListPage { |
155 | objectName: "folderPage" |
156 | |
157 | - folder: "~"//modelData |
158 | + folder: userdirs.locationHome //modelData |
159 | } |
160 | } |
161 | |
162 | |
163 | === modified file 'src/app/qml/ui/FolderListPage.qml' |
164 | --- src/app/qml/ui/FolderListPage.qml 2014-04-30 08:54:08 +0000 |
165 | +++ src/app/qml/ui/FolderListPage.qml 2014-06-18 07:41:55 +0000 |
166 | @@ -20,6 +20,7 @@ |
167 | import Ubuntu.Components.Popups 0.1 |
168 | import Ubuntu.Components.ListItems 0.1 |
169 | import org.nemomobile.folderlistmodel 1.0 |
170 | +import com.ubuntu.XdgUserDirs 0.1 |
171 | import "../components" |
172 | |
173 | Page { |
174 | @@ -63,27 +64,15 @@ |
175 | } |
176 | } |
177 | |
178 | - // This stores the location using ~ to represent home |
179 | + XdgUserDirs { id: userdirs } |
180 | + |
181 | property string folder |
182 | - property string homeFolder: "~" |
183 | - |
184 | - // This replaces ~ with the actual home folder, since the |
185 | - // plugin doesn't recognize the ~ |
186 | - property string path: folder.replace("~", pageModel.homePath()) |
187 | - |
188 | - function goHome() { |
189 | - goTo(folderListPage.homeFolder) |
190 | - } |
191 | + property string path: folder |
192 | |
193 | function goTo(location) { |
194 | - // Since the FolderListModel returns paths using the actual |
195 | - // home folder, this replaces with ~ before actually going |
196 | - // to the specified folder |
197 | - while (location !== '/' && location.substring(location.lastIndexOf('/')+1) === "") { |
198 | - location = location.substring(0, location.length - 1) |
199 | - } |
200 | - |
201 | - folderListPage.folder = location.replace(pageModel.homePath(), "~") |
202 | + // This allows us to enter "~" as a shortcut to the home folder |
203 | + // when entering a location on the Go To dialog |
204 | + folderListPage.folder = location.replace("~", userdirs.locationHome) |
205 | refresh() |
206 | } |
207 | |
208 | @@ -113,21 +102,20 @@ |
209 | // files will need an icon. |
210 | // TODO: Remove isDir parameter and use new model functions |
211 | function fileIcon(file, isDir) { |
212 | - file = file.replace(pageModel.homePath(), "~") |
213 | var iconPath = isDir ? "/usr/share/icons/Humanity/places/48/folder.svg" |
214 | : "/usr/share/icons/Humanity/mimes/48/empty.svg" |
215 | |
216 | - if (file === "~") { |
217 | + if (file === userdirs.locationHome) { |
218 | iconPath = "../icons/folder-home.svg" |
219 | } else if (file === i18n.tr("~/Desktop")) { |
220 | iconPath = "/usr/share/icons/Humanity/places/48/user-desktop.svg" |
221 | - } else if (file === i18n.tr("~/Documents")) { |
222 | + } else if (file === userdirs.locationDocuments) { |
223 | iconPath = "/usr/share/icons/Humanity/places/48/folder-documents.svg" |
224 | - } else if (file === i18n.tr("~/Downloads")) { |
225 | + } else if (file === userdirs.locationDownloads) { |
226 | iconPath = "/usr/share/icons/Humanity/places/48/folder-downloads.svg" |
227 | - } else if (file === i18n.tr("~/Music")) { |
228 | + } else if (file === userdirs.locationMusic) { |
229 | iconPath = "/usr/share/icons/Humanity/places/48/folder-music.svg" |
230 | - } else if (file === i18n.tr("~/Pictures")) { |
231 | + } else if (file === userdirs.locationPictures) { |
232 | iconPath = "/usr/share/icons/Humanity/places/48/folder-pictures.svg" |
233 | } else if (file === i18n.tr("~/Public")) { |
234 | iconPath = "/usr/share/icons/Humanity/places/48/folder-publicshare.svg" |
235 | @@ -135,7 +123,7 @@ |
236 | iconPath = "/usr/share/icons/Humanity/places/48/folder-system.svg" |
237 | } else if (file === i18n.tr("~/Templates")) { |
238 | iconPath = "/usr/share/icons/Humanity/places/48/folder-templates.svg" |
239 | - } else if (file === i18n.tr("~/Videos")) { |
240 | + } else if (file === userdirs.locationVideos) { |
241 | iconPath = "/usr/share/icons/Humanity/places/48/folder-videos.svg" |
242 | } else if (file === "/") { |
243 | iconPath = "/usr/share/icons/Humanity/devices/48/drive-harddisk.svg" |
244 | @@ -145,9 +133,8 @@ |
245 | } |
246 | |
247 | function folderName(folder) { |
248 | - folder = folder.replace(pageModel.homePath(), "~") |
249 | |
250 | - if (folder === folderListPage.homeFolder) { |
251 | + if (folder === userdirs.locationHome) { |
252 | return i18n.tr("Home") |
253 | } else if (folder === "/") { |
254 | return i18n.tr("File System") |
255 | @@ -208,7 +195,7 @@ |
256 | path: folderListPage.folder |
257 | |
258 | onPathChanged: { |
259 | - console.log("Path: " + repeaterModel.path) |
260 | + console.log("Path changed to: " + repeaterModel.path) |
261 | } |
262 | } |
263 | |
264 | |
265 | === modified file 'src/app/qml/ui/PlacesPopover.qml' |
266 | --- src/app/qml/ui/PlacesPopover.qml 2014-06-10 02:34:07 +0000 |
267 | +++ src/app/qml/ui/PlacesPopover.qml 2014-06-18 07:41:55 +0000 |
268 | @@ -19,45 +19,12 @@ |
269 | import Ubuntu.Components 0.1 |
270 | import Ubuntu.Components.Popups 0.1 |
271 | import Ubuntu.Components.ListItems 0.1 |
272 | +import com.ubuntu.XdgUserDirs 0.1 |
273 | |
274 | Popover { |
275 | id: root |
276 | objectName: "placesPopover" |
277 | |
278 | - ListModel { |
279 | - id: places |
280 | - |
281 | - ListElement { |
282 | - objectName: 'placeHome' |
283 | - path: "~" |
284 | - } |
285 | - |
286 | - ListElement { |
287 | - path: "~/Documents" |
288 | - } |
289 | - |
290 | - ListElement { |
291 | - path: "~/Downloads" |
292 | - } |
293 | - |
294 | - ListElement { |
295 | - path: "~/Music" |
296 | - } |
297 | - |
298 | - ListElement { |
299 | - path: "~/Pictures" |
300 | - } |
301 | - |
302 | - ListElement { |
303 | - path: "~/Videos" |
304 | - } |
305 | - |
306 | - ListElement { |
307 | - objectName: "placeRoot" |
308 | - path: "/" |
309 | - } |
310 | - } |
311 | - |
312 | Column { |
313 | anchors { |
314 | left: parent.left |
315 | @@ -113,7 +80,7 @@ |
316 | id: placesList |
317 | objectName: "placesList" |
318 | |
319 | - model: places |
320 | + model: XdgUserDirs {} |
321 | |
322 | delegate: Standard { |
323 | objectName: model.objectName |
324 | |
325 | === modified file 'src/plugin/CMakeLists.txt' |
326 | --- src/plugin/CMakeLists.txt 2014-03-29 17:04:56 +0000 |
327 | +++ src/plugin/CMakeLists.txt 2014-06-18 07:41:55 +0000 |
328 | @@ -5,3 +5,4 @@ |
329 | find_package(Qt5Widgets) |
330 | |
331 | add_subdirectory(folderlistmodel) |
332 | +add_subdirectory(xdguserdir) |
333 | |
334 | === added directory 'src/plugin/xdguserdir' |
335 | === added file 'src/plugin/xdguserdir/CMakeLists.txt' |
336 | --- src/plugin/xdguserdir/CMakeLists.txt 1970-01-01 00:00:00 +0000 |
337 | +++ src/plugin/xdguserdir/CMakeLists.txt 2014-06-18 07:41:55 +0000 |
338 | @@ -0,0 +1,35 @@ |
339 | +include_directories( |
340 | + ${CMAKE_CURRENT_SOURCE_DIR} |
341 | +) |
342 | + |
343 | +set(PLUGIN_DIR com/ubuntu/XdgUserDirs) |
344 | + |
345 | +set(xdguserdir_SRCS |
346 | + xdguserdir.cpp |
347 | + xdguserdir.h |
348 | + xdguserdir_plugin.cpp |
349 | + xdguserdir_plugin.h |
350 | +) |
351 | + |
352 | +add_library(XdgUserDirs MODULE |
353 | + ${xdguserdir_SRCS} |
354 | +) |
355 | + |
356 | +qt5_use_modules(XdgUserDirs Gui Qml Quick Widgets) |
357 | + |
358 | +# Copy the plugin, the qmldir file and other assets to the build dir for running in QtCreator |
359 | +if(NOT "${CMAKE_CURRENT_SOURCE_DIR}" STREQUAL "${CMAKE_CURRENT_BINARY_DIR}") |
360 | + add_custom_command(TARGET XdgUserDirs POST_BUILD |
361 | + COMMAND ${CMAKE_COMMAND} -E make_directory ${CMAKE_CURRENT_BINARY_DIR}/../${PLUGIN_DIR} |
362 | + COMMENT "Creating plugin directory layout in the build directory" |
363 | + COMMAND ${CMAKE_COMMAND} -E copy ${CMAKE_CURRENT_SOURCE_DIR}/qmldir ${CMAKE_CURRENT_BINARY_DIR}/../${PLUGIN_DIR} |
364 | + COMMENT "Copying the qmldir file to the build directory" |
365 | + COMMAND ${CMAKE_COMMAND} -E copy $<TARGET_FILE:XdgUserDirs> ${CMAKE_CURRENT_BINARY_DIR}/../${PLUGIN_DIR} |
366 | + COMMENT "Copying the plugin binary to the build directory" |
367 | + ) |
368 | +endif(NOT "${CMAKE_CURRENT_SOURCE_DIR}" STREQUAL "${CMAKE_CURRENT_BINARY_DIR}") |
369 | + |
370 | +# Install plugin file |
371 | +install(TARGETS XdgUserDirs DESTINATION ${QT_IMPORTS_DIR}/${PLUGIN_DIR}) |
372 | +install(FILES qmldir DESTINATION ${QT_IMPORTS_DIR}/${PLUGIN_DIR}) |
373 | + |
374 | |
375 | === added file 'src/plugin/xdguserdir/qmldir' |
376 | --- src/plugin/xdguserdir/qmldir 1970-01-01 00:00:00 +0000 |
377 | +++ src/plugin/xdguserdir/qmldir 2014-06-18 07:41:55 +0000 |
378 | @@ -0,0 +1,2 @@ |
379 | +module com.ubuntu.XdgUserDirs |
380 | +plugin XdgUserDirs |
381 | |
382 | === added file 'src/plugin/xdguserdir/xdguserdir.cpp' |
383 | --- src/plugin/xdguserdir/xdguserdir.cpp 1970-01-01 00:00:00 +0000 |
384 | +++ src/plugin/xdguserdir/xdguserdir.cpp 2014-06-18 07:41:55 +0000 |
385 | @@ -0,0 +1,108 @@ |
386 | +/* |
387 | + * Copyright (C) 2013 Canonical Ltd |
388 | + * |
389 | + * This program is free software: you can redistribute it and/or modify |
390 | + * it under the terms of the GNU General Public License version 3 as |
391 | + * published by the Free Software Foundation. |
392 | + * |
393 | + * This program is distributed in the hope that it will be useful, |
394 | + * but WITHOUT ANY WARRANTY; without even the implied warranty of |
395 | + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
396 | + * GNU General Public License for more details. |
397 | + * |
398 | + * You should have received a copy of the GNU General Public License |
399 | + * along with this program. If not, see <http://www.gnu.org/licenses/>. |
400 | + * |
401 | + * Author : David Planella <david.planella@ubuntu.com> |
402 | + */ |
403 | + |
404 | +#include "xdguserdir.h" |
405 | +#include <QDebug> |
406 | +#include <QDir> |
407 | + |
408 | +XdgUserDir::XdgUserDir(QAbstractListModel *parent) : |
409 | + QAbstractListModel(parent) |
410 | +{ |
411 | + |
412 | +} |
413 | + |
414 | +XdgUserDir::~XdgUserDir() { |
415 | + |
416 | +} |
417 | + |
418 | +QString XdgUserDir::standardLocation(QStandardPaths::StandardLocation location) const |
419 | +{ |
420 | + QStringList locations = QStandardPaths::standardLocations(location); |
421 | + QString standardLocation = ""; |
422 | + |
423 | + foreach (const QString &location, locations) { |
424 | + // We always return the first location or an empty string |
425 | + // The frontend should check out that it exists |
426 | + if (QDir(location).exists()) { |
427 | + standardLocation = location; |
428 | + break; |
429 | + } |
430 | + } |
431 | + |
432 | + return standardLocation; |
433 | +} |
434 | + |
435 | +QString XdgUserDir::locationHome() const |
436 | +{ |
437 | + return standardLocation(QStandardPaths::HomeLocation); |
438 | +} |
439 | + |
440 | +QString XdgUserDir::locationDocuments() const |
441 | +{ |
442 | + return standardLocation(QStandardPaths::DocumentsLocation); |
443 | +} |
444 | + |
445 | +QString XdgUserDir::locationDownloads() const |
446 | +{ |
447 | + return standardLocation(QStandardPaths::DownloadLocation); |
448 | +} |
449 | + |
450 | +QString XdgUserDir::locationMusic() const |
451 | +{ |
452 | + return standardLocation(QStandardPaths::MusicLocation); |
453 | +} |
454 | + |
455 | +QString XdgUserDir::locationPictures() const |
456 | +{ |
457 | + return standardLocation(QStandardPaths::PicturesLocation); |
458 | +} |
459 | + |
460 | +QString XdgUserDir::locationVideos() const |
461 | +{ |
462 | + return standardLocation(QStandardPaths::MoviesLocation); |
463 | +} |
464 | + |
465 | +int XdgUserDir::rowCount(const QModelIndex &parent) const |
466 | +{ |
467 | + Q_UNUSED(parent) |
468 | + return 6; |
469 | +} |
470 | + |
471 | +QVariant XdgUserDir::data(const QModelIndex &index, int role) const |
472 | +{ |
473 | + Q_UNUSED(role) |
474 | + |
475 | + switch(index.row()) { |
476 | + case 0: return locationHome(); |
477 | + case 1: return locationDocuments(); |
478 | + case 2: return locationDownloads(); |
479 | + case 3: return locationMusic(); |
480 | + case 4: return locationPictures(); |
481 | + case 5: return locationVideos(); |
482 | + } |
483 | + |
484 | + return QVariant(); |
485 | +} |
486 | + |
487 | +QHash<int, QByteArray> XdgUserDir::roleNames() const |
488 | +{ |
489 | + QHash<int, QByteArray> roles; |
490 | + roles.insert(Qt::UserRole, "path"); |
491 | + |
492 | + return roles; |
493 | + } |
494 | |
495 | === added file 'src/plugin/xdguserdir/xdguserdir.h' |
496 | --- src/plugin/xdguserdir/xdguserdir.h 1970-01-01 00:00:00 +0000 |
497 | +++ src/plugin/xdguserdir/xdguserdir.h 2014-06-18 07:41:55 +0000 |
498 | @@ -0,0 +1,57 @@ |
499 | +/* |
500 | + * Copyright (C) 2013 Canonical Ltd |
501 | + * |
502 | + * This program is free software: you can redistribute it and/or modify |
503 | + * it under the terms of the GNU General Public License version 3 as |
504 | + * published by the Free Software Foundation. |
505 | + * |
506 | + * This program is distributed in the hope that it will be useful, |
507 | + * but WITHOUT ANY WARRANTY; without even the implied warranty of |
508 | + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
509 | + * GNU General Public License for more details. |
510 | + * |
511 | + * You should have received a copy of the GNU General Public License |
512 | + * along with this program. If not, see <http://www.gnu.org/licenses/>. |
513 | + * |
514 | + * Author : David Planella <david.planella@ubuntu.com> |
515 | + */ |
516 | + |
517 | +#ifndef XDGUSERDIR_H |
518 | +#define XDGUSERDIR_H |
519 | + |
520 | +#include <QObject> |
521 | +#include <QAbstractListModel> |
522 | +#include <QStandardPaths> |
523 | + |
524 | +class XdgUserDir : public QAbstractListModel |
525 | +{ |
526 | + Q_OBJECT |
527 | + |
528 | + Q_PROPERTY(QString locationHome READ locationHome CONSTANT) |
529 | + Q_PROPERTY(QString locationDocuments READ locationDocuments CONSTANT) |
530 | + Q_PROPERTY(QString locationDownloads READ locationDownloads CONSTANT) |
531 | + Q_PROPERTY(QString locationMusic READ locationMusic CONSTANT) |
532 | + Q_PROPERTY(QString locationPictures READ locationPictures CONSTANT) |
533 | + Q_PROPERTY(QString locationVideos READ locationVideos CONSTANT) |
534 | + |
535 | +public: |
536 | + explicit XdgUserDir(QAbstractListModel *parent = 0); |
537 | + ~XdgUserDir(); |
538 | + QString locationHome() const; |
539 | + QString locationDocuments() const; |
540 | + QString locationDownloads() const; |
541 | + QString locationMusic() const; |
542 | + QString locationPictures() const; |
543 | + QString locationVideos() const; |
544 | + int rowCount(const QModelIndex &parent) const override; |
545 | + QVariant data(const QModelIndex &index, int role) const override; |
546 | + QHash<int, QByteArray> roleNames() const override; |
547 | + |
548 | +private: |
549 | + QString standardLocation(QStandardPaths::StandardLocation location) const; |
550 | +}; |
551 | + |
552 | +#endif // XDGUSERDIR_H |
553 | + |
554 | + |
555 | + |
556 | |
557 | === added file 'src/plugin/xdguserdir/xdguserdir_plugin.cpp' |
558 | --- src/plugin/xdguserdir/xdguserdir_plugin.cpp 1970-01-01 00:00:00 +0000 |
559 | +++ src/plugin/xdguserdir/xdguserdir_plugin.cpp 2014-06-18 07:41:55 +0000 |
560 | @@ -0,0 +1,34 @@ |
561 | +/* |
562 | + * Copyright (C) 2013 Canonical Ltd |
563 | + * |
564 | + * This program is free software: you can redistribute it and/or modify |
565 | + * it under the terms of the GNU General Public License version 3 as |
566 | + * published by the Free Software Foundation. |
567 | + * |
568 | + * This program is distributed in the hope that it will be useful, |
569 | + * but WITHOUT ANY WARRANTY; without even the implied warranty of |
570 | + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
571 | + * GNU General Public License for more details. |
572 | + * |
573 | + * You should have received a copy of the GNU General Public License |
574 | + * along with this program. If not, see <http://www.gnu.org/licenses/>. |
575 | + * |
576 | + * Author : David Planella <david.planella@ubuntu.com> |
577 | + */ |
578 | + |
579 | +#include <QtQml> |
580 | +#include <QtQml/QQmlContext> |
581 | +#include "xdguserdir_plugin.h" |
582 | +#include "xdguserdir.h" |
583 | + |
584 | +void BackendPlugin::registerTypes(const char *uri) |
585 | +{ |
586 | + Q_ASSERT(uri == QLatin1String(QUOTES(PLUGIN_URI))); |
587 | + |
588 | + qmlRegisterType<XdgUserDir>(uri, 0, 1, "XdgUserDirs"); |
589 | +} |
590 | + |
591 | +void BackendPlugin::initializeEngine(QQmlEngine *engine, const char *uri) |
592 | +{ |
593 | + QQmlExtensionPlugin::initializeEngine(engine, uri); |
594 | +} |
595 | |
596 | === added file 'src/plugin/xdguserdir/xdguserdir_plugin.h' |
597 | --- src/plugin/xdguserdir/xdguserdir_plugin.h 1970-01-01 00:00:00 +0000 |
598 | +++ src/plugin/xdguserdir/xdguserdir_plugin.h 2014-06-18 07:41:55 +0000 |
599 | @@ -0,0 +1,39 @@ |
600 | +/* |
601 | + * Copyright (C) 2013 Canonical Ltd |
602 | + * |
603 | + * This program is free software: you can redistribute it and/or modify |
604 | + * it under the terms of the GNU General Public License version 3 as |
605 | + * published by the Free Software Foundation. |
606 | + * |
607 | + * This program is distributed in the hope that it will be useful, |
608 | + * but WITHOUT ANY WARRANTY; without even the implied warranty of |
609 | + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
610 | + * GNU General Public License for more details. |
611 | + * |
612 | + * You should have received a copy of the GNU General Public License |
613 | + * along with this program. If not, see <http://www.gnu.org/licenses/>. |
614 | + * |
615 | + * Author : David Planella <david.planella@ubuntu.com> |
616 | + */ |
617 | + |
618 | +#ifndef XDGUSERDIR_PLUGIN_H |
619 | +#define XDGUSERDIR_PLUGIN_H |
620 | + |
621 | +#include <QtQml/QQmlEngine> |
622 | +#include <QtQml/QQmlExtensionPlugin> |
623 | + |
624 | +class BackendPlugin : public QQmlExtensionPlugin |
625 | +{ |
626 | + Q_OBJECT |
627 | + Q_PLUGIN_METADATA(IID "org.qt-project.Qt.QQmlExtensionInterface") |
628 | + |
629 | +public: |
630 | + void registerTypes(const char *uri); |
631 | + void initializeEngine(QQmlEngine *engine, const char *uri); |
632 | +}; |
633 | +#endif // XDGUSERDIR_PLUGIN_H |
634 | + |
635 | + |
636 | + |
637 | + |
638 | + |
FAILED: Continuous integration, rev:209 91.189. 93.70:8080/ job/ubuntu- filemanager- app-ci/ 255/ 91.189. 93.70:8080/ job/generic- mediumtests- utopic/ 536 91.189. 93.70:8080/ job/generic- mediumtests- utopic/ 536/artifact/ work/output/ *zip*/output. zip 91.189. 93.70:8080/ job/ubuntu- filemanager- app-utopic- amd64-ci/ 53
http://
Executed test runs:
UNSTABLE: http://
deb: http://
SUCCESS: http://
Click here to trigger a rebuild: 91.189. 93.70:8080/ job/ubuntu- filemanager- app-ci/ 255/rebuild
http://