Merge lp:~ibelieve/ubuntu-filemanager-app/advanced-options into lp:ubuntu-filemanager-app

Proposed by Michael Spencer
Status: Merged
Approved by: Nicholas Skaggs
Approved revision: 49
Merged at revision: 56
Proposed branch: lp:~ibelieve/ubuntu-filemanager-app/advanced-options
Merge into: lp:ubuntu-filemanager-app
Diff against target: 294 lines (+198/-10)
5 files modified
FolderListPage.qml (+12/-2)
OptionsPopover.qml (+31/-7)
SettingsSheet.qml (+40/-0)
Storage.qml (+58/-0)
ubuntu-filemanager-app.qml (+57/-1)
To merge this branch: bzr merge lp:~ibelieve/ubuntu-filemanager-app/advanced-options
Reviewer Review Type Date Requested Status
Ubuntu Phone Apps Jenkins Bot continuous-integration Approve
Nicholas Skaggs (community) Approve
Arto Jalkanen Pending
Review via email: mp+175440@code.launchpad.net

Commit message

Added settings sheet and advanced option to filter files

Description of the change

Adds a settings sheet and the ability to hide/show advanced features. This allows the app to have features that advanced/power users want, while still being simple for regular users.

This also adds an advanced option to filter the files by a regex, so for example, a user can only see JPGs by using the "*.jpg" regex.

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

FAILED: Continuous integration, rev:48
No commit message was specified in the merge proposal. Click on the following link and set the commit message (if you want a jenkins rebuild you need to trigger it yourself):
https://code.launchpad.net/~mdspencer/ubuntu-filemanager-app/advanced-options/+merge/175440/+edit-commit-message

http://91.189.93.70:8080/job/ubuntu-filemanager-app-ci/8/
Executed test runs:
    SUCCESS: http://91.189.93.70:8080/job/ubuntu-filemanager-app-precise-amd64-ci/6
    SUCCESS: http://91.189.93.70:8080/job/ubuntu-filemanager-app-quantal-amd64-ci/9
    SUCCESS: http://91.189.93.70:8080/job/ubuntu-filemanager-app-raring-amd64-ci/9
    SUCCESS: http://91.189.93.70:8080/job/ubuntu-filemanager-app-saucy-amd64-ci/6

Click here to trigger a rebuild:
http://91.189.93.70:8080/job/ubuntu-filemanager-app-ci/8/rebuild

review: Needs Fixing (continuous-integration)
49. By Michael Spencer

Merged in changes from master branch

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
Nicholas Skaggs (nskaggs) :
review: Approve
Revision history for this message
Ubuntu Phone Apps Jenkins Bot (ubuntu-phone-apps-jenkins-bot) wrote :
review: Approve (continuous-integration)

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
=== modified file 'FolderListPage.qml'
--- FolderListPage.qml 2013-07-26 20:37:32 +0000
+++ FolderListPage.qml 2013-08-06 15:23:35 +0000
@@ -330,13 +330,13 @@
330 }330 }
331331
332 ToolbarButton {332 ToolbarButton {
333 text: i18n.tr("Settings")333 text: i18n.tr("Options")
334 iconSource: "icons/settings.png"334 iconSource: "icons/settings.png"
335335
336 onTriggered: {336 onTriggered: {
337 print(text)337 print(text)
338338
339 PopupUtils.open(Qt.resolvedUrl("SettingsPopover.qml"), caller)339 PopupUtils.open(Qt.resolvedUrl("OptionsPopover.qml"), caller)
340 }340 }
341 }341 }
342342
@@ -350,6 +350,16 @@
350 PopupUtils.open(Qt.resolvedUrl("PlacesPopover.qml"), caller)350 PopupUtils.open(Qt.resolvedUrl("PlacesPopover.qml"), caller)
351 }351 }
352 }352 }
353
354 ToolbarButton {
355 text: i18n.tr("Settings")
356 iconSource: "icons/settings.png"
357 onTriggered: {
358 print(text)
359
360 showSettings()
361 }
362 }
353 }363 }
354364
355 Column {365 Column {
356366
=== renamed file 'SettingsPopover.qml' => 'OptionsPopover.qml'
--- SettingsPopover.qml 2013-06-27 02:10:00 +0000
+++ OptionsPopover.qml 2013-08-06 15:23:35 +0000
@@ -47,11 +47,11 @@
47 }47 }
4848
49 ValueSelector {49 ValueSelector {
50 text: "Sort By"50 text: i18n.tr("Sort By")
51 selectedIndex: values.indexOf(fileView.sortingMethod)51 selectedIndex: values.indexOf(fileView.sortingMethod)
52 values: [52 values: [
53 "Name",53 i18n.tr("Name"),
54 "Date"54 i18n.tr("Date")
55 ]55 ]
5656
57 onSelectedIndexChanged: {57 onSelectedIndexChanged: {
@@ -60,15 +60,39 @@
60 }60 }
6161
62 ValueSelector {62 ValueSelector {
63 text: "Sort Order"63 text: i18n.tr("Sort Order")
64 selectedIndex: sortAccending ? 0 : 164 selectedIndex: sortAccending ? 0 : 1
65 values: [65 values: [
66 "Ascending",66 i18n.tr("Ascending"),
67 "Descending"67 i18n.tr("Descending")
68 ]68 ]
6969
70 onSelectedIndexChanged: {70 onSelectedIndexChanged: {
71 fileView.sortAccending = (values[selectedIndex] === "Ascending")71 fileView.sortAccending = (values[selectedIndex] === i18n.tr("Ascending"))
72 }
73 }
74
75 Standard {
76 visible: showAdvancedFeatures
77 text: i18n.tr("Filter")
78
79 TextField {
80 id: filterField
81 anchors {
82 verticalCenter: parent.verticalCenter
83 right: parent.right
84 margins: units.gu(1)
85 }
86
87 inputMethodHints: Qt.ImhNoAutoUppercase
88
89 text: pageModel.nameFilters
90
91 onAccepted: goButton.clicked()
92 onTextChanged: {
93 if (text !== pageModel.nameFilters)
94 pageModel.nameFilters = [text]
95 }
72 }96 }
73 }97 }
74 }98 }
7599
=== added file 'SettingsSheet.qml'
--- SettingsSheet.qml 1970-01-01 00:00:00 +0000
+++ SettingsSheet.qml 2013-08-06 15:23:35 +0000
@@ -0,0 +1,40 @@
1import QtQuick 2.0
2import Ubuntu.Components 0.1
3import Ubuntu.Components.ListItems 0.1
4import Ubuntu.Components.Popups 0.1
5
6/*
7 * The Settings sheet holds global settings/preferences.
8 *
9 * TODO: Make sure this fits with the UI guidelines if
10 * they are updated to include About/Settings info.
11 */
12ComposerSheet {
13 id: root
14
15 title: i18n.tr("Settings")
16
17 contentsHeight: parent.height
18
19 Column {
20 anchors.fill: parent
21
22 Standard {
23 text: i18n.tr("Show Advanced Features")
24 control: CheckBox {
25 id: showAdvancedFeaturesCheckBox
26 checked: showAdvancedFeatures
27 }
28 }
29 }
30
31 onConfirmClicked: {
32 saveSetting("showAdvancedFeatures", showAdvancedFeaturesCheckBox.checked ? "true" : "false");
33
34 // ... Handling of other settings here ...
35
36 refreshSettings()
37
38 PopupUtils.close(root)
39 }
40}
041
=== added file 'Storage.qml'
--- Storage.qml 1970-01-01 00:00:00 +0000
+++ Storage.qml 2013-08-06 15:23:35 +0000
@@ -0,0 +1,58 @@
1import QtQuick.LocalStorage 2.0
2import QtQuick 2.0
3
4Item {
5 property var db: null
6
7 function openDB() {
8 if(db !== null) return;
9
10 db = LocalStorage.openDatabaseSync("ubuntu-filemanager-app", "", "Default Ubuntu file manager app", 100000);
11
12 if (db.version === "") {
13 db.changeVersion("", "0.1",
14 function(tx) {
15 tx.executeSql('CREATE TABLE IF NOT EXISTS settings(key TEXT UNIQUE, value TEXT)');
16 console.log('Database created');
17 });
18 // reopen database with new version number
19 db = LocalStorage.openDatabaseSync("ubuntu-filemanager-app", "", "Default Ubuntu file manager app", 100000);
20 }
21 }
22
23 function saveSetting(key, value) {
24 openDB();
25 db.transaction( function(tx){
26 tx.executeSql('INSERT OR REPLACE INTO settings VALUES(?, ?)', [key, value]);
27 });
28 }
29
30 function getSettings(callback) {
31 openDB();
32 var settings = {};
33 db.readTransaction(
34 function(tx){
35 var rs = tx.executeSql('SELECT key, value FROM Settings');
36 for(var i = 0; i < rs.rows.length; i++) {
37 var row = rs.rows.item(i);
38 settings[row.key] = row.value;
39 }
40 callback(settings);
41 }
42 );
43 }
44
45 function clearSetting(name) {
46 openDB();
47 db.transaction(function(tx){
48 tx.executeSql('DELETE FROM Settings WHERE key = ?', [name]);
49 });
50 }
51
52 function clearDB() { // for dev purposes
53 openDB();
54 db.transaction(function(tx){
55 tx.executeSql('DELETE FROM Settings WHERE 1');
56 });
57 }
58}
059
=== modified file 'ubuntu-filemanager-app.qml'
--- ubuntu-filemanager-app.qml 2013-06-27 16:46:45 +0000
+++ ubuntu-filemanager-app.qml 2013-08-06 15:23:35 +0000
@@ -18,6 +18,7 @@
18import QtQuick 2.018import QtQuick 2.0
19import Ubuntu.Components 0.119import Ubuntu.Components 0.1
20import org.nemomobile.folderlistmodel 1.020import org.nemomobile.folderlistmodel 1.0
21import Ubuntu.Components.Popups 0.1
2122
22/*!23/*!
23 \brief MainView with Tabs element.24 \brief MainView with Tabs element.
@@ -30,7 +31,7 @@
30 // objectName for functional testing purposes (autopilot-qt5)31 // objectName for functional testing purposes (autopilot-qt5)
31 objectName: "filemanager"32 objectName: "filemanager"
32 applicationName: "ubuntu-filemanager-app"33 applicationName: "ubuntu-filemanager-app"
33 34
34 width: units.gu(50)35 width: units.gu(50)
35 height: units.gu(75)36 height: units.gu(75)
3637
@@ -38,10 +39,65 @@
3839
39 property bool wideAspect: width >= units.gu(80)40 property bool wideAspect: width >= units.gu(80)
4041
42 // Default settings
43 property var settings: {"showAdvancedFeatures": false}
44
45 property bool needsRefreshSettings: true
46
47 // Individual settings, used for bindings
48 property bool showAdvancedFeatures: false
49
41 FolderListPage {50 FolderListPage {
42 id: folderPage51 id: folderPage
43 objectName: "folderPage"52 objectName: "folderPage"
4453
45 folder: homeFolder54 folder: homeFolder
46 }55 }
56
57 Component {
58 id: settingsSheet
59
60 SettingsSheet {
61 objectName: "settingsSheet"
62 }
63 }
64
65 Storage {
66 id: storage
67 }
68
69 function showSettings() {
70 PopupUtils.open(settingsSheet)
71 }
72
73 function reloadSettings() {
74 showAdvancedFeatures = settings["showAdvancedFeatures"] === "true" ? true : false
75 print("showAdvancedFeatures <=", showAdvancedFeatures)
76 }
77
78 function refreshSettings() {
79 if (needsRefreshSettings) {
80 storage.getSettings(function(storedSettings) {
81 for(var settingName in storedSettings) {
82 print(settingName, "=", storedSettings[settingName])
83 settings[settingName] = storedSettings[settingName]
84 }
85
86 reloadSettings()
87 })
88
89 needsRefreshSettings = false
90 }
91 }
92
93 function saveSetting(name, value) {
94 // Check if the setting was changed
95 if(settings[name] !== value) {
96 print(name, "=>", value)
97 storage.saveSetting(name, value)
98 needsRefreshSettings = true
99 }
100 }
101
102 Component.onCompleted: refreshSettings();
47}103}

Subscribers

People subscribed via source and target branches