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: folder
52 property bool load: true
53 property string folder: folderModel.folder
56 color: Const.DEFAULT_DIALOG_BACKGROUND_COLOR
58 function setFolder(folder)
60 folderAnimation.folderToChange = folder;
61 folderAnimation.start();
64 function loadFile(filePath) {
66 storageThread.loadByUrl(filePath);
67 fileSelector.currentFilePath = filePath;
68 gestureListView.currentSetFilename =
69 helper.extractFilenameFromPath(filePath);
71 if (!viewSwitcher.running) {
72 viewSwitcher.switchView(gestureListView, true);
76 function saveFile(filePath) {
77 helper.saveGestures(filePath, engine);
78 gestureListView.currentSetFilename =
79 helper.extractFilenameFromPath(filePath);
81 if (!viewSwitcher.running) {
82 viewSwitcher.switchView(gestureListView, true);
90 anchors.top: parent.top
92 color: Const.LIGHT_AUBERGINE_COLOR
95 anchors.horizontalCenter: parent.horizontalCenter
96 width: parent.width - 2 * Const.DEFAULT_MARGIN
97 height: parent.height - Const.DEFAULT_MARGIN
103 spacing: Const.DEFAULT_MARGIN
106 id: currentFolderButton
108 label: fixPath(folderModel.folder)
109 width: pathController.width-folderUpButton.width-cancelButton.width-4*Const.DEFAULT_MARGIN
110 onButtonClicked: root.folderSelected(folderModel.folder)
111 disabled: !root.folderOnly
116 iconSource: "images/up.png"
117 onButtonClicked: fileSelector.setFolder(folderModel.parentFolder);
122 iconSource: "images/close.png"
134 y: pathController.height
139 id: folderModelContainer
141 anchors.top: pathController.bottom;
142 anchors.bottom: parent.bottom
143 color: Const.TRANSPARENT
149 //nameFilters: [ "*.*" ]
153 id: folderModelDelegate
157 height: folderModel.isFolder(index)? file.height + Const.DEFAULT_MARGIN : root.folderOnly? 0 : file.height + Const.DEFAULT_MARGIN
158 color: Const.TRANSPARENT
159 visible: root.folderOnly? folderModel.isFolder(index) : true
163 anchors.verticalCenter: parent.verticalCenter
166 isDirectory: folderModel.isFolder(index)
167 textMax: root.width/17
170 fileSelector.setFolder(filePath);
172 root.fileSelected(folderModel.folder,filename)
183 margins: Const.TEXT_MARGIN
187 delegate: folderModelDelegate
189 SequentialAnimation {
192 property string folderToChange
194 PropertyAnimation { target: folderModelView; property: "opacity"; to: 0; duration: 100 }
195 PropertyAction { target: folderModel; property: "folder"; value: folderAnimation.folderToChange }
196 PropertyAnimation { target: folderModelView; property: "opacity"; to: 1.0; duration: 100 }
200 } // folderModelContainer
206 PropertyChanges { target: root; opacity: 1 }
207 PropertyChanges { target: root; y: Const.SYSTEM_BAR_HEIGHT }
211 PropertyChanges { target: root; opacity: 0 }
212 PropertyChanges { target: root; y: root.parent.height }
216 transitions: Transition {
217 NumberAnimation { properties: "opacity"; easing.type: Easing.InOutQuad }
218 NumberAnimation { properties: "y"; easing.type: Easing.InOutQuad }