Merge lp:~ibelieve/ubuntu-filemanager-app/fix-popover-caller into lp:ubuntu-filemanager-app

Proposed by Michael Spencer
Status: Rejected
Rejected by: Nicholas Skaggs
Proposed branch: lp:~ibelieve/ubuntu-filemanager-app/fix-popover-caller
Merge into: lp:ubuntu-filemanager-app
Diff against target: 821 lines (+305/-243)
12 files modified
FolderListPage.qml (+21/-28)
GoToDialog.qml (+1/-13)
OptionsPopover.qml (+1/-1)
PlacesPopover.qml (+1/-13)
PlacesSidebar.qml (+3/-4)
SettingsPage.qml (+22/-18)
Sidebar.qml (+120/-49)
Storage.qml (+0/-58)
VerticalDivider.qml (+49/-0)
debian/control (+2/-1)
tests/autopilot/ubuntu_filemanager_app/tests/test_filemanager.py (+3/-0)
ubuntu-filemanager-app.qml (+82/-58)
To merge this branch: bzr merge lp:~ibelieve/ubuntu-filemanager-app/fix-popover-caller
Reviewer Review Type Date Requested Status
Ubuntu Phone Apps Jenkins Bot continuous-integration Needs Fixing
Ubuntu File Manager Developers Pending
Review via email: mp+183225@code.launchpad.net

Commit message

Fixed popovers, improved sidebar, and converted to using U1db for settings

Description of the change

 * Fixed the toolbar buttons so they open popovers again.
 * Added improved Sidebar
 * Converted to using U1db for settings storage (temporary until https://code.launchpad.net/~kalikiana/ubuntu-ui-toolkit/appsettings/+merge/181304 lands)

To post a comment you must log in.
61. By Michael Spencer

Fixed email address

Revision history for this message
Ubuntu Phone Apps Jenkins Bot (ubuntu-phone-apps-jenkins-bot) wrote :
review: Needs Fixing (continuous-integration)
Revision history for this message
Ubuntu Phone Apps Jenkins Bot (ubuntu-phone-apps-jenkins-bot) wrote :
review: Needs Fixing (continuous-integration)
62. By Michael Spencer

Added U1db to Debian

Revision history for this message
Ubuntu Phone Apps Jenkins Bot (ubuntu-phone-apps-jenkins-bot) wrote :
review: Needs Fixing (continuous-integration)
Revision history for this message
Ubuntu Phone Apps Jenkins Bot (ubuntu-phone-apps-jenkins-bot) wrote :
review: Needs Fixing (continuous-integration)
Revision history for this message
Ubuntu Phone Apps Jenkins Bot (ubuntu-phone-apps-jenkins-bot) wrote :
review: Needs Fixing (continuous-integration)
Revision history for this message
Ubuntu Phone Apps Jenkins Bot (ubuntu-phone-apps-jenkins-bot) wrote :
review: Needs Fixing (continuous-integration)
Revision history for this message
Ubuntu Phone Apps Jenkins Bot (ubuntu-phone-apps-jenkins-bot) wrote :
review: Needs Fixing (continuous-integration)
Revision history for this message
Ubuntu Phone Apps Jenkins Bot (ubuntu-phone-apps-jenkins-bot) wrote :
review: Needs Fixing (continuous-integration)
63. By Michael Spencer

Added in .Xauthority fix by Francis Ginther

Revision history for this message
Ubuntu Phone Apps Jenkins Bot (ubuntu-phone-apps-jenkins-bot) wrote :
review: Needs Fixing (continuous-integration)
64. By Michael Spencer

Fixed pep8 errors

Revision history for this message
Ubuntu Phone Apps Jenkins Bot (ubuntu-phone-apps-jenkins-bot) wrote :
review: Needs Fixing (continuous-integration)
Revision history for this message
Ubuntu Phone Apps Jenkins Bot (ubuntu-phone-apps-jenkins-bot) wrote :
review: Needs Fixing (continuous-integration)
Revision history for this message
Nicholas Skaggs (nskaggs) wrote :

Landed, with test fixes here: https://code.launchpad.net/~nskaggs/ubuntu-filemanager-app/land-fix-popover-caller/+merge/184003

In the end, I disabled the copy_file test to get this pushed in for the moment

Unmerged revisions

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'FolderListPage.qml'
2--- FolderListPage.qml 2013-08-06 23:34:50 +0000
3+++ FolderListPage.qml 2013-09-04 21:48:28 +0000
4@@ -23,7 +23,6 @@
5
6 Page {
7 id: root
8- anchors.fill: parent
9
10 title: folderName(folder)
11
12@@ -351,28 +350,31 @@
13 }
14
15 ToolbarButton {
16+ id: actionsButton
17 objectName: "actions"
18 text: i18n.tr("Actions")
19 iconSource: "icons/edit.png"
20
21 onTriggered: {
22 print(text)
23- PopupUtils.open(folderActionsPopoverComponent, caller)
24+ PopupUtils.open(folderActionsPopoverComponent, actionsButton)
25 }
26 }
27
28 ToolbarButton {
29 text: i18n.tr("Options")
30 iconSource: "icons/settings.png"
31+ id: optionsButton
32
33 onTriggered: {
34 print(text)
35
36- PopupUtils.open(Qt.resolvedUrl("OptionsPopover.qml"), caller)
37+ PopupUtils.open(Qt.resolvedUrl("OptionsPopover.qml"), optionsButton)
38 }
39 }
40
41 ToolbarButton {
42+ id: goToButton
43 visible: wideAspect
44 objectName: "goTo"
45 text: i18n.tr("Go To")
46@@ -380,11 +382,12 @@
47 onTriggered: {
48 print(text)
49
50- PopupUtils.open(Qt.resolvedUrl("GoToDialog.qml"), caller)
51+ PopupUtils.open(Qt.resolvedUrl("GoToDialog.qml"), goToButton)
52 }
53 }
54
55 ToolbarButton {
56+ id: placesButton
57 visible: !wideAspect
58 objectName: "places"
59 text: i18n.tr("Places")
60@@ -392,17 +395,7 @@
61 onTriggered: {
62 print(text)
63
64- PopupUtils.open(Qt.resolvedUrl("PlacesPopover.qml"), caller)
65- }
66- }
67-
68- ToolbarButton {
69- text: i18n.tr("Settings")
70- iconSource: "icons/settings.png"
71- onTriggered: {
72- print(text)
73-
74- showSettings()
75+ PopupUtils.open(Qt.resolvedUrl("PlacesPopover.qml"), placesButton)
76 }
77 }
78 }
79@@ -415,7 +408,6 @@
80
81 anchors {
82 top: parent.top
83- topMargin: units.gu(9.5)
84 bottom: parent.bottom
85 bottomMargin: units.gu(-2)
86 }
87@@ -425,6 +417,7 @@
88
89 Item {
90 id: contents
91+
92 anchors {
93 top: parent.top
94 bottom: parent.bottom
95@@ -486,7 +479,7 @@
96 target: folderListView
97
98 anchors.top: contents.top
99- anchors.topMargin: units.gu(9.5)
100+ //anchors.topMargin: units.gu(9.5)
101 topMargin: 0
102 }
103
104@@ -495,19 +488,19 @@
105 anchors.top: root.top
106 anchors.topMargin: 0
107 }
108- },
109-
110- //FIXME: This should automatically be calculated - is there a way to remove it?
111- State {
112- name: ""
113-
114- PropertyChanges {
115- target: folderListView
116-
117- topMargin: units.gu(9.5)
118- }
119 }
120
121+// //FIXME: This should automatically be calculated - is there a way to remove it?
122+// State {
123+// name: ""
124+
125+// PropertyChanges {
126+// target: folderListView
127+
128+// topMargin: units.gu(9.5)
129+// }
130+// }
131+
132 ]
133
134 // Errors from model
135
136=== modified file 'GoToDialog.qml'
137--- GoToDialog.qml 2013-08-06 14:49:03 +0000
138+++ GoToDialog.qml 2013-09-04 21:48:28 +0000
139@@ -13,7 +13,7 @@
140 * You should have received a copy of the GNU General Public License
141 * along with this program. If not, see <http://www.gnu.org/licenses/>.
142 *
143- * Authored by: Michael Spencer <spencers1993@gmail.com>
144+ * Authored by: Michael Spencer <sonrisesoftware@gmail.com>
145 */
146 import QtQuick 2.0
147 import Ubuntu.Components 0.1
148@@ -44,18 +44,6 @@
149 id: goButton
150 objectName: "goButton"
151
152- gradient: Gradient {
153- GradientStop {
154- position: 0
155- color: "green"//Qt.rgba(0,0.7,0,1)
156- }
157-
158- GradientStop {
159- position: 1
160- color: Qt.rgba(0.3,0.7,0.3,1)
161- }
162- }
163-
164 text: i18n.tr("Go")
165 enabled: locationField.acceptableInput && locationField.valid
166
167
168=== modified file 'OptionsPopover.qml'
169--- OptionsPopover.qml 2013-08-06 17:40:06 +0000
170+++ OptionsPopover.qml 2013-09-04 21:48:28 +0000
171@@ -13,7 +13,7 @@
172 * You should have received a copy of the GNU General Public License
173 * along with this program. If not, see <http://www.gnu.org/licenses/>.
174 *
175- * Authored by: Michael Spencer <spencers1993@gmail.com>
176+ * Authored by: Michael Spencer <sonrisesoftware@gmail.com>
177 */
178 import QtQuick 2.0
179 import Ubuntu.Components 0.1
180
181=== modified file 'PlacesPopover.qml'
182--- PlacesPopover.qml 2013-08-15 20:50:12 +0000
183+++ PlacesPopover.qml 2013-09-04 21:48:28 +0000
184@@ -13,7 +13,7 @@
185 * You should have received a copy of the GNU General Public License
186 * along with this program. If not, see <http://www.gnu.org/licenses/>.
187 *
188- * Authored by: Michael Spencer <spencers1993@gmail.com>
189+ * Authored by: Michael Spencer <sonrisesoftware@gmail.com>
190 */
191 import QtQuick 2.0
192 import Ubuntu.Components 0.1
193@@ -94,18 +94,6 @@
194 rightMargin: units.gu(1)
195 }
196
197- gradient: Gradient {
198- GradientStop {
199- position: 0
200- color: "green"//Qt.rgba(0,0.7,0,1)
201- }
202-
203- GradientStop {
204- position: 1
205- color: Qt.rgba(0.3,0.7,0.3,1)
206- }
207- }
208-
209 text: i18n.tr("Go")
210 enabled: locationField.acceptableInput && locationField.valid
211
212
213=== modified file 'PlacesSidebar.qml'
214--- PlacesSidebar.qml 2013-08-06 17:40:06 +0000
215+++ PlacesSidebar.qml 2013-09-04 21:48:28 +0000
216@@ -13,7 +13,7 @@
217 * You should have received a copy of the GNU General Public License
218 * along with this program. If not, see <http://www.gnu.org/licenses/>.
219 *
220- * Authored by: Michael Spencer <spencers1993@gmail.com>
221+ * Authored by: Michael Spencer <sonrisesoftware@gmail.com>
222 */
223 import QtQuick 2.0
224 import Ubuntu.Components 0.1
225@@ -23,9 +23,8 @@
226 Sidebar {
227 id: root
228
229- color: "gray"
230-
231- width: units.gu(25)
232+ color: Qt.rgba(0.5,0.5,0.5,0.3)
233+ width: units.gu(30)
234
235 ListModel {
236 id: places
237
238=== renamed file 'SettingsSheet.qml' => 'SettingsPage.qml'
239--- SettingsSheet.qml 2013-08-06 16:53:16 +0000
240+++ SettingsPage.qml 2013-09-04 21:48:28 +0000
241@@ -1,25 +1,36 @@
242+/*
243+ * Copyright (C) 2013 Canonical Ltd
244+ *
245+ * This program is free software: you can redistribute it and/or modify
246+ * it under the terms of the GNU General Public License version 3 as
247+ * published by the Free Software Foundation.
248+ *
249+ * This program is distributed in the hope that it will be useful,
250+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
251+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
252+ * GNU General Public License for more details.
253+ *
254+ * You should have received a copy of the GNU General Public License
255+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
256+ *
257+ * Authored by: Michael Spencer <sonrisesoftware@gmail.com>
258+ */
259 import QtQuick 2.0
260 import Ubuntu.Components 0.1
261 import Ubuntu.Components.ListItems 0.1
262 import Ubuntu.Components.Popups 0.1
263
264 /*
265- * The Settings sheet holds global settings/preferences.
266+ * The Settings page holds global settings/preferences.
267 *
268 * TODO: Make sure this fits with the UI guidelines if
269 * they are updated to include About/Settings info.
270 */
271-ComposerSheet {
272+Page {
273 id: root
274
275 title: i18n.tr("Settings")
276
277- Binding {
278- target: root.__foreground
279- property: "minHeight"
280- value: Math.max(units.gu(75), root.contentsHeight)
281- }
282-
283 Column {
284 anchors.fill: parent
285
286@@ -28,17 +39,10 @@
287 control: CheckBox {
288 id: showAdvancedFeaturesCheckBox
289 checked: showAdvancedFeatures
290+ onCheckedChanged: {
291+ saveSetting("showAdvancedFeatures", showAdvancedFeaturesCheckBox.checked ? "true" : "false");
292+ }
293 }
294 }
295 }
296-
297- onConfirmClicked: {
298- saveSetting("showAdvancedFeatures", showAdvancedFeaturesCheckBox.checked ? "true" : "false");
299-
300- // ... Handling of other settings here ...
301-
302- refreshSettings()
303-
304- PopupUtils.close(root)
305- }
306 }
307
308=== modified file 'Sidebar.qml'
309--- Sidebar.qml 2013-08-06 17:40:06 +0000
310+++ Sidebar.qml 2013-09-04 21:48:28 +0000
311@@ -1,75 +1,146 @@
312-/*
313- * Copyright (C) 2013 Canonical Ltd
314- *
315- * This program is free software: you can redistribute it and/or modify
316- * it under the terms of the GNU General Public License version 3 as
317- * published by the Free Software Foundation.
318- *
319- * This program is distributed in the hope that it will be useful,
320- * but WITHOUT ANY WARRANTY; without even the implied warranty of
321- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
322- * GNU General Public License for more details.
323- *
324- * You should have received a copy of the GNU General Public License
325- * along with this program. If not, see <http://www.gnu.org/licenses/>.
326- *
327- * Authored by: Michael Spencer <spencers1993@gmail.com>
328- */
329-
330+/***************************************************************************
331+ * Whatsoever ye do in word or deed, do all in the name of the *
332+ * Lord Jesus, giving thanks to God and the Father by him. *
333+ * - Colossians 3:17 *
334+ * *
335+ * Ubuntu UI Extras - A collection of QML widgets not available *
336+ * in the default Ubuntu UI Toolkit *
337+ * Copyright (C) 2013 Michael Spencer <sonrisesoftware@gmail.com> *
338+ * *
339+ * This program is free software: you can redistribute it and/or modify *
340+ * it under the terms of the GNU General Public License as published by *
341+ * the Free Software Foundation, either version 3 of the License, or *
342+ * (at your option) any later version. *
343+ * *
344+ * This program is distributed in the hope that it will be useful, *
345+ * but WITHOUT ANY WARRANTY; without even the implied warranty of *
346+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
347+ * GNU General Public License for more details. *
348+ * *
349+ * You should have received a copy of the GNU General Public License *
350+ * along with this program. If not, see <http://www.gnu.org/licenses/>. *
351+ ***************************************************************************/
352 import QtQuick 2.0
353 import Ubuntu.Components 0.1
354 import Ubuntu.Components.ListItems 0.1
355
356+/*!
357+ \qmltype Sidebar
358+ \brief A sidebar component for use in adaptive layouts
359+
360+ To use, simply add an instance to your code, and anchor other components to it.
361+
362+ To show or hide, set the expanded property.
363+
364+ By default, the sidebar has a flickable built in, and whatever contents are added
365+ will be placed in the flickable. When you want this disabled, or want to fill the
366+ entire sidebar, set the autoFill property to false.
367+
368+ Examples:
369+ \qml
370+ property bool wideAspect: width > units.gu(80)
371+
372+ Sidebar {
373+ expanded: wideAspect
374+
375+ // Anchoring is automatic
376+ }
377+ \endqml
378+*/
379 Rectangle {
380- //color: "lightgray"
381+ id: root
382+
383+ color: Qt.rgba(0.2,0.2,0.2,0.4)
384
385 property bool expanded: true
386
387- Item {
388- ThinDivider {
389- rotation: 90
390-
391- //Rectangle {
392- //color: "lightgray"
393-
394- //width: 1
395- width: parent.height
396- height: 2
397- anchors {
398- left: undefined
399- right: undefined
400- centerIn: parent
401- }
402- }
403- width: 2
404+ property string mode: "left" // or "right"
405+ property alias header: headerItem.text
406+
407+ anchors {
408+ left: mode === "left" ? parent.left : undefined
409+ right: mode === "right" ? parent.right : undefined
410+ top: parent.top
411+ bottom: parent.bottom
412+ }
413+
414+ VerticalDivider {
415+ mode: root.mode
416
417 anchors {
418 top: parent.top
419 bottom: parent.bottom
420- right: parent.right
421- rightMargin: 0
422+ right: mode === "left" ? parent.right : undefined
423+ left: mode === "right" ? parent.left : undefined
424+ rightMargin: -1
425 }
426 }
427
428 width: units.gu(35)
429
430
431- x: expanded ? 0 : -width
432-
433- Behavior on x {
434- PropertyAnimation {
435- duration: 250
436- }
437+ anchors.leftMargin: expanded ? 0 : -width
438+ anchors.rightMargin: expanded ? 0 : -width
439+
440+ Behavior on anchors.leftMargin {
441+ UbuntuNumberAnimation {}
442+ }
443+
444+ Behavior on anchors.rightMargin {
445+ UbuntuNumberAnimation {}
446 }
447
448 default property alias contents: contents.data
449
450- Item {
451- id: contents
452+ Header {
453+ id: headerItem
454+
455+ visible: text !== ""
456+ }
457+
458+ property bool autoFlick: true
459+
460+ Flickable {
461+ id: flickable
462+
463+ clip: true
464
465 anchors {
466- fill: parent
467- rightMargin: 1
468- }
469+ top: headerItem.visible ? headerItem.bottom : parent.top
470+ left: parent.left
471+ right: parent.right
472+ bottom: parent.bottom
473+ rightMargin: mode === "left" ? 1 : 0
474+ leftMargin: mode === "right" ? 1 : 0
475+ }
476+
477+ contentWidth: width
478+ contentHeight: autoFlick ? contents.height : height
479+ interactive: contentHeight > height
480+
481+ Item {
482+ id: contents
483+
484+ width: flickable.width
485+ height: autoFlick ? childrenRect.height : flickable.height
486+ }
487+
488+ function getFlickableChild(item) {
489+ if (item && item.hasOwnProperty("children")) {
490+ for (var i=0; i < item.children.length; i++) {
491+ var child = item.children[i];
492+ if (internal.isVerticalFlickable(child)) {
493+ if (child.anchors.top === page.top || child.anchors.fill === page) {
494+ return item.children[i];
495+ }
496+ }
497+ }
498+ }
499+ return null;
500+ }
501+ }
502+
503+ Scrollbar {
504+ flickableItem: flickable
505 }
506 }
507
508=== removed file 'Storage.qml'
509--- Storage.qml 2013-07-18 01:16:56 +0000
510+++ Storage.qml 1970-01-01 00:00:00 +0000
511@@ -1,58 +0,0 @@
512-import QtQuick.LocalStorage 2.0
513-import QtQuick 2.0
514-
515-Item {
516- property var db: null
517-
518- function openDB() {
519- if(db !== null) return;
520-
521- db = LocalStorage.openDatabaseSync("ubuntu-filemanager-app", "", "Default Ubuntu file manager app", 100000);
522-
523- if (db.version === "") {
524- db.changeVersion("", "0.1",
525- function(tx) {
526- tx.executeSql('CREATE TABLE IF NOT EXISTS settings(key TEXT UNIQUE, value TEXT)');
527- console.log('Database created');
528- });
529- // reopen database with new version number
530- db = LocalStorage.openDatabaseSync("ubuntu-filemanager-app", "", "Default Ubuntu file manager app", 100000);
531- }
532- }
533-
534- function saveSetting(key, value) {
535- openDB();
536- db.transaction( function(tx){
537- tx.executeSql('INSERT OR REPLACE INTO settings VALUES(?, ?)', [key, value]);
538- });
539- }
540-
541- function getSettings(callback) {
542- openDB();
543- var settings = {};
544- db.readTransaction(
545- function(tx){
546- var rs = tx.executeSql('SELECT key, value FROM Settings');
547- for(var i = 0; i < rs.rows.length; i++) {
548- var row = rs.rows.item(i);
549- settings[row.key] = row.value;
550- }
551- callback(settings);
552- }
553- );
554- }
555-
556- function clearSetting(name) {
557- openDB();
558- db.transaction(function(tx){
559- tx.executeSql('DELETE FROM Settings WHERE key = ?', [name]);
560- });
561- }
562-
563- function clearDB() { // for dev purposes
564- openDB();
565- db.transaction(function(tx){
566- tx.executeSql('DELETE FROM Settings WHERE 1');
567- });
568- }
569-}
570
571=== added file 'VerticalDivider.qml'
572--- VerticalDivider.qml 1970-01-01 00:00:00 +0000
573+++ VerticalDivider.qml 2013-09-04 21:48:28 +0000
574@@ -0,0 +1,49 @@
575+/***************************************************************************
576+ * Whatsoever ye do in word or deed, do all in the name of the *
577+ * Lord Jesus, giving thanks to God and the Father by him. *
578+ * - Colossians 3:17 *
579+ * *
580+ * Ubuntu UI Extras - A collection of QML widgets not available *
581+ * in the default Ubuntu UI Toolkit *
582+ * Copyright (C) 2013 Michael Spencer <sonrisesoftware@gmail.com> *
583+ * *
584+ * This program is free software: you can redistribute it and/or modify *
585+ * it under the terms of the GNU General Public License as published by *
586+ * the Free Software Foundation, either version 3 of the License, or *
587+ * (at your option) any later version. *
588+ * *
589+ * This program is distributed in the hope that it will be useful, *
590+ * but WITHOUT ANY WARRANTY; without even the implied warranty of *
591+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
592+ * GNU General Public License for more details. *
593+ * *
594+ * You should have received a copy of the GNU General Public License *
595+ * along with this program. If not, see <http://www.gnu.org/licenses/>. *
596+ ***************************************************************************/
597+import QtQuick 2.0
598+import Ubuntu.Components 0.1
599+import Ubuntu.Components.ListItems 0.1
600+import QtQuick 2.0
601+
602+Item {
603+ property string mode: "left" // or right
604+
605+ ThinDivider {
606+ id: divider
607+ rotation: mode === "left" ? 90 : -90
608+
609+ width: parent.height
610+
611+ anchors {
612+ left: undefined
613+ right: undefined
614+ centerIn: parent
615+ }
616+ }
617+ width: divider.height
618+
619+ anchors {
620+ top: parent ? parent.top : undefined
621+ bottom: parent ? parent.bottom : undefined
622+ }
623+}
624
625=== modified file 'debian/control'
626--- debian/control 2013-08-06 17:08:11 +0000
627+++ debian/control 2013-09-04 21:48:28 +0000
628@@ -14,7 +14,8 @@
629 qmlscene,
630 qtdeclarative5-ubuntu-ui-toolkit-plugin | qt-components-ubuntu,
631 qtdeclarative5-qtquick2-plugin,
632- qtdeclarative5-nemo-qml-plugin-folderlistmodel
633+ qtdeclarative5-nemo-qml-plugin-folderlistmodel,
634+ qtdeclarative5-u1db1.0
635 Description: File Manager application
636 Core File Manager application
637
638
639=== modified file 'tests/autopilot/ubuntu_filemanager_app/tests/test_filemanager.py'
640--- tests/autopilot/ubuntu_filemanager_app/tests/test_filemanager.py 2013-08-15 22:08:28 +0000
641+++ tests/autopilot/ubuntu_filemanager_app/tests/test_filemanager.py 2013-09-04 21:48:28 +0000
642@@ -42,6 +42,9 @@
643
644 def _patch_home(self):
645 temp_dir = tempfile.mkdtemp()
646+ shutil.copyfile(
647+ os.path.expanduser(os.path.join('~', '.Xauthority')),
648+ os.path.join(temp_dir, '.Xauthority'))
649 self.addCleanup(shutil.rmtree, temp_dir)
650 patcher = mock.patch.dict('os.environ', {'HOME': temp_dir})
651 patcher.start()
652
653=== modified file 'ubuntu-filemanager-app.qml'
654--- ubuntu-filemanager-app.qml 2013-08-15 20:50:12 +0000
655+++ ubuntu-filemanager-app.qml 2013-09-04 21:48:28 +0000
656@@ -19,6 +19,7 @@
657 import Ubuntu.Components 0.1
658 import org.nemomobile.folderlistmodel 1.0
659 import Ubuntu.Components.Popups 0.1
660+import U1db 1.0 as U1db
661
662 /*!
663 \brief MainView with Tabs element.
664@@ -32,76 +33,99 @@
665 objectName: "filemanager"
666 applicationName: "ubuntu-filemanager-app"
667
668- width: units.gu(50)
669+ width: units.gu(100)
670 height: units.gu(75)
671
672 property alias filemanager: root
673
674 property bool wideAspect: width >= units.gu(80)
675
676- // Default settings
677- property var settings: {"showAdvancedFeatures": false}
678-
679- property bool needsRefreshSettings: true
680-
681- // Individual settings, used for bindings
682- property bool showAdvancedFeatures: false
683-
684 headerColor: "#303030"
685 backgroundColor: "#505050"
686 footerColor: "#707070"
687
688- FolderListPage {
689- id: folderPage
690- objectName: "folderPage"
691-
692- folder: homeFolder
693- }
694-
695- Component {
696- id: settingsSheet
697-
698- SettingsSheet {
699- objectName: "settingsSheet"
700- }
701- }
702-
703- Storage {
704+ property var pageStack: pageStack
705+
706+ PageStack {
707+ id: pageStack
708+
709+ Tabs {
710+ id: tabs
711+
712+ Tab {
713+ title: page.title
714+ page: FolderListPage {
715+ id: folderPage
716+ objectName: "folderPage"
717+
718+ folder: homeFolder
719+ }
720+ }
721+
722+ Tab {
723+ title: page.title
724+ page: SettingsPage {
725+ id: settingsPage
726+ }
727+ }
728+ }
729+
730+ Component.onCompleted: {
731+ pageStack.push(tabs)
732+ pageStack.push(Qt.resolvedUrl("FolderListPage.qml"))
733+ pageStack.pop()
734+ }
735+ }
736+
737+ /* Settings Storage */
738+
739+ U1db.Database {
740 id: storage
741- }
742-
743- function showSettings() {
744- PopupUtils.open(settingsSheet)
745+ path: "ubuntu-filemanager-app.db"
746+ }
747+
748+ U1db.Document {
749+ id: settings
750+
751+ database: storage
752+ docId: 'settings'
753+ create: true
754+
755+ defaults: {
756+ showAdvancedFeatures: false
757+ }
758+ }
759+
760+ // Individual settings, used for bindings
761+ property bool showAdvancedFeatures: false
762+
763+ function getSetting(name, def) {
764+ var tempContents = {};
765+ tempContents = settings.contents
766+ var value = tempContents.hasOwnProperty(name)
767+ ? tempContents[name]
768+ : settings.defaults.hasOwnProperty(name)
769+ ? settings.defaults[name]
770+ : def
771+ //print(name, JSON.stringify(def), JSON.stringify(value))
772+ return value
773+ }
774+
775+ function saveSetting(name, value) {
776+ if (getSetting(name) !== value) {
777+ //print(name, "=>", value)
778+ var tempContents = {}
779+ tempContents = settings.contents
780+ tempContents[name] = value
781+ settings.contents = tempContents
782+
783+ reloadSettings()
784+ }
785 }
786
787 function reloadSettings() {
788- showAdvancedFeatures = settings["showAdvancedFeatures"] === "true" ? true : false
789- print("showAdvancedFeatures <=", showAdvancedFeatures)
790- }
791-
792- function refreshSettings() {
793- if (needsRefreshSettings) {
794- storage.getSettings(function(storedSettings) {
795- for(var settingName in storedSettings) {
796- print(settingName, "=", storedSettings[settingName])
797- settings[settingName] = storedSettings[settingName]
798- }
799-
800- reloadSettings()
801- })
802-
803- needsRefreshSettings = false
804- }
805- }
806-
807- function saveSetting(name, value) {
808- // Check if the setting was changed
809- if(settings[name] !== value) {
810- print(name, "=>", value)
811- storage.saveSetting(name, value)
812- needsRefreshSettings = true
813- }
814- }
815-
816- Component.onCompleted: refreshSettings();
817+ showAdvancedFeatures = getSetting("showAdvancedFeatures", false)
818+ }
819+
820+ Component.onCompleted: reloadSettings()
821 }

Subscribers

People subscribed via source and target branches