1 import QtQuick 1.0 // to target S60 5th Edition or Maemo 5
3 import "UIConstants.js" as Const
5 import Qt.labs.folderlistmodel 1.0
11 property string currentFilePath: fileSelector.currentFilePath
12 property bool load: fileSelector.load
13 property alias folder: folderModel.folder
14 property bool folderOnly: true
18 signal folderSelected(string folder)
19 signal fileSelected(string folder, string file)
24 function fixPath(path) {
25 path = path.toString();
27 var ind = path.lastIndexOf("/");
29 path = path.substr(ind+1);
31 if(path=="") path = "/";
51 property string currentFilePath: folderModel.folder
52 property bool load: true
53 property string folder: folderModel.folder
56 color: Const.DEFAULT_DIALOG_BACKGROUND_COLOR
58 function setFolder(folder)
60 console.log(root.folder);
63 folderAnimation.folderToChange = folder;
64 folderAnimation.start();
67 function loadFile(filePath) {
69 storageThread.loadByUrl(filePath);
70 fileSelector.currentFilePath = filePath;
71 gestureListView.currentSetFilename =
72 helper.extractFilenameFromPath(filePath);
74 if (!viewSwitcher.running) {
75 viewSwitcher.switchView(gestureListView, true);
79 function saveFile(filePath) {
80 helper.saveGestures(filePath, engine);
81 gestureListView.currentSetFilename =
82 helper.extractFilenameFromPath(filePath);
84 if (!viewSwitcher.running) {
85 viewSwitcher.switchView(gestureListView, true);
93 anchors.top: parent.top
95 color: Const.LIGHT_AUBERGINE_COLOR
98 anchors.horizontalCenter: parent.horizontalCenter
99 width: parent.width - 2 * Const.DEFAULT_MARGIN
100 height: parent.height - Const.DEFAULT_MARGIN
106 spacing: Const.DEFAULT_MARGIN
109 id: currentFolderButton
111 label: fixPath(folderModel.folder)
112 width: pathController.width-folderUpButton.width-cancelButton.width-4*Const.DEFAULT_MARGIN
113 onButtonClicked: root.folderSelected(folderModel.folder)
114 disabled: !root.folderOnly
119 iconSource: "images/up.png"
120 onButtonClicked: fileSelector.setFolder(folderModel.parentFolder);
125 iconSource: "images/close.png"
137 y: pathController.height
142 id: folderModelContainer
144 anchors.top: pathController.bottom;
145 anchors.bottom: parent.bottom
146 color: Const.TRANSPARENT
152 //nameFilters: [ "*.*" ]
156 id: folderModelDelegate
160 height: folderModel.isFolder(index)? file.height + Const.DEFAULT_MARGIN : root.folderOnly? 0 : file.height + Const.DEFAULT_MARGIN
161 color: Const.TRANSPARENT
162 visible: root.folderOnly? folderModel.isFolder(index) : true
166 anchors.verticalCenter: parent.verticalCenter
169 isDirectory: folderModel.isFolder(index)
170 textMax: root.width/17
173 fileSelector.setFolder(filePath);
175 root.fileSelected(folderModel.folder,filename)
186 margins: Const.TEXT_MARGIN
190 delegate: folderModelDelegate
192 SequentialAnimation {
195 property string folderToChange
197 PropertyAnimation { target: folderModelView; property: "opacity"; to: 0; duration: 100 }
198 PropertyAction { target: folderModel; property: "folder"; value: folderAnimation.folderToChange }
199 PropertyAnimation { target: folderModelView; property: "opacity"; to: 1.0; duration: 100 }
203 } // folderModelContainer
209 PropertyChanges { target: root; opacity: 1 }
210 PropertyChanges { target: root; y: Const.SYSTEM_BAR_HEIGHT }
214 PropertyChanges { target: root; opacity: 0 }
215 PropertyChanges { target: root; y: root.parent.height }
219 transitions: Transition {
220 NumberAnimation { properties: "opacity"; easing.type: Easing.InOutQuad }
221 NumberAnimation { properties: "y"; easing.type: Easing.InOutQuad }