Merge lp:~ajalkane/ubuntu-filemanager-app/filedetails into lp:ubuntu-filemanager-app

Proposed by Arto Jalkanen
Status: Merged
Approved by: Arto Jalkanen
Approved revision: 12
Merged at revision: 11
Proposed branch: lp:~ajalkane/ubuntu-filemanager-app/filedetails
Merge into: lp:ubuntu-filemanager-app
Diff against target: 122 lines (+78/-7)
2 files modified
FileDetailsPopover.qml (+73/-3)
FolderListView.qml (+5/-4)
To merge this branch: bzr merge lp:~ajalkane/ubuntu-filemanager-app/filedetails
Reviewer Review Type Date Requested Status
Arto Jalkanen Approve
Ubuntu Phone Apps Jenkins Bot continuous-integration Approve
Review via email: mp+153246@code.launchpad.net

Commit message

Initial file details popover

Description of the change

Initial file details popover

To post a comment you must log in.
Revision history for this message
Ubuntu Phone Apps Jenkins Bot (ubuntu-phone-apps-jenkins-bot) wrote :
review: Approve (continuous-integration)
Revision history for this message
Arto Jalkanen (ajalkane) wrote :

It's raw, but better to get in than be left out.

review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'FileDetailsPopover.qml'
2--- FileDetailsPopover.qml 2013-03-05 20:48:28 +0000
3+++ FileDetailsPopover.qml 2013-03-13 21:23:19 +0000
4@@ -4,11 +4,81 @@
5
6 Popover {
7 id: root
8- property string filePath
9+ property var model
10+
11+ function dateTimeFormat(dateTime) {
12+ return Qt.formatDateTime(dateTime, Qt.DefaultLocaleShortDate)
13+ }
14+
15+ function permissionsToString(model) {
16+ var permissions = []
17+ if (model.isReadable) {
18+ permissions.push(i18n.tr("Readable"))
19+ }
20+ if (model.isWritable) {
21+ permissions.push(i18n.tr("Writable"))
22+ }
23+ if (model.isExecutable) {
24+ permissions.push(i18n.tr("Executable"))
25+ }
26+
27+ // Now why does this not work?
28+ // return permissions.join(", ")
29+ var permStr = ""
30+ for (var i = 0; i < permissions.length; ++i) {
31+ if (permStr.length > 0) {
32+ permStr += ", "
33+ }
34+ permStr += permissions[i]
35+ }
36+ return permStr
37+ }
38
39 Column {
40- Label {
41- text: "\n\nTODO file details for " + filePath + "\n\n"
42+ anchors.margins: units.gu(2)
43+ Row {
44+ Image {
45+ // TODO: how to get proper icon?
46+ source: model.isDir
47+ ? "/usr/share/icons/gnome/48x48/apps/file-manager.png"
48+ : "/usr/share/icons/gnome/48x48/mimetypes/text-x-preview.png"
49+ }
50+ Label {
51+ text: model.fileName
52+ anchors.verticalCenter: parent.verticalCenter
53+ }
54+ }
55+ Grid {
56+ columns: 2
57+ spacing: units.gu(1)
58+ Label {
59+ text: i18n.tr("Size:")
60+ }
61+ Label {
62+ text: model.fileSize
63+ }
64+
65+ Label {
66+ text: i18n.tr("Created:")
67+ }
68+ Label {
69+ text: dateTimeFormat(model.creationDate)
70+ }
71+
72+ Label {
73+ text: i18n.tr("Modified:")
74+ }
75+ Label {
76+ text: dateTimeFormat(model.modifiedDate)
77+ }
78+
79+ Label {
80+ text: i18n.tr("Permissions:")
81+ }
82+ Label {
83+ text: permissionsToString(model)
84+ }
85+
86 }
87 }
88 }
89
90=== modified file 'FolderListView.qml'
91--- FolderListView.qml 2013-03-12 20:10:44 +0000
92+++ FolderListView.qml 2013-03-13 21:23:19 +0000
93@@ -12,8 +12,7 @@
94
95 ActionSelectionPopover {
96 id: actionSelectionPopover
97- property string filePath
98-
99+ property var model
100 actions: ActionList {
101 Action {
102 text: i18n.tr("Add as bookmark")
103@@ -26,7 +25,9 @@
104 print(text)
105 PopupUtils.open(Qt.resolvedUrl("FileDetailsPopover.qml"),
106 actionSelectionPopover.caller,
107- { "filePath": actionSelectionPopover.filePath } )
108+ { "model": actionSelectionPopover.model
109+ }
110+ )
111 }
112 }
113 }
114@@ -79,7 +80,7 @@
115 onPressAndHold: {
116 console.log("FolderListDelegate onPressAndHold")
117 actionSelectionPopover.caller = delegate
118- actionSelectionPopover.filePath = filePath
119+ actionSelectionPopover.model = model
120 actionSelectionPopover.show();
121 }
122 }

Subscribers

People subscribed via source and target branches