2 import Sailfish.Silica 1.0
3 import harbour.file.browser.FileModel 1.0
4 import "functions.js" as Functions
9 //allowedOrientations: Orientation.All
10 property string dir: "/"
11 property string initialDir: ""
12 property bool initial: false // this is set to true if the page is initial page
13 property int _selectedMenu: 0
18 // page.status does not exactly work - root folder seems to be active always??
19 active: page.status === PageStatus.Active
28 VerticalScrollDecorator { flickable: fileList }
34 switch (_selectedMenu) {
39 Functions.fileSelect("")
42 pageStack.push(Qt.resolvedUrl("SearchPage.qml"), { dir: page.dir });
45 fileModel.showAll = true
46 menuShowAll.visible = false
47 menuShowFiltered.visible = true
50 fileModel.showAll = false
51 menuShowFiltered.visible = false
52 menuShowAll.visible = true
60 onClicked: _selectedMenu = 1
64 onClicked: _selectedMenu = 2
68 onClicked: _selectedMenu = 3
72 visible: !fileModel.showAll
73 text: qsTr("Show all files")
74 onClicked: _selectedMenu = 4
78 visible: fileModel.showAll
79 text: qsTr("Show only ") + engine.extensionFilter + qsTr(" files")
80 onClicked: _selectedMenu = 5
85 title: Functions.formatPathForTitle(page.dir) + " " +
86 Functions.unicodeBlackDownPointingTriangle()
89 onClicked: dirPopup.show();
96 width: ListView.view.width
97 contentHeight: listLabel.height+listSize.height + 13
101 anchors.left: parent.left
102 anchors.leftMargin: Theme.paddingLarge
103 anchors.top: parent.top
104 anchors.topMargin: 11
105 source: "../images/small-"+fileIcon+".png"
109 anchors.left: listIcon.right
110 anchors.leftMargin: 10
111 anchors.right: parent.right
112 anchors.rightMargin: Theme.paddingLarge
113 anchors.top: parent.top
116 elide: Text.ElideRight
120 anchors.left: listIcon.right
121 anchors.leftMargin: 10
122 anchors.top: listLabel.bottom
123 text: !(isLink && isDir) ? size : Functions.unicodeArrow()+" "+symLinkTarget
124 color: Theme.secondaryColor
125 font.pixelSize: Theme.fontSizeExtraSmall
128 visible: !(isLink && isDir)
129 anchors.top: listLabel.bottom
130 anchors.horizontalCenter: parent.horizontalCenter
131 text: filekind+permissions
132 color: Theme.secondaryColor
133 font.pixelSize: Theme.fontSizeExtraSmall
136 visible: !(isLink && isDir)
137 anchors.top: listLabel.bottom
138 anchors.right: listLabel.right
140 color: Theme.secondaryColor
141 font.pixelSize: Theme.fontSizeExtraSmall
146 pageStack.push(Qt.resolvedUrl("DirectoryPage.qml"),
147 { dir: fileModel.appendPath(listLabel.text) });
150 Functions.fileSelect(fileModel.appendPath(listLabel.text))
152 //pageStack.push(Qt.resolvedUrl("FilePage.qml"),
153 // { file: fileModel.appendPath(listLabel.text) });
157 // delete file after remorse time
158 ListView.onRemove: animateRemoval(fileItem)
159 function deleteFile(deleteFilename) {
160 remorseAction(qsTr("Deleting"), function() {
161 progressPanel.showText(qsTr("Deleting"));
162 engine.deleteFiles([ deleteFilename ]);
166 // context menu is activated with long press
172 text: qsTr("Properties")
174 pageStack.push(Qt.resolvedUrl("FilePage.qml"), { file: fileModel.fileNameAt(index) });
181 // text if no files or error message
184 anchors.leftMargin: Theme.paddingLarge
185 anchors.rightMargin: Theme.paddingLarge
186 horizontalAlignment: Qt.AlignHCenter
187 y: -fileList.contentY + 100
188 visible: fileModel.fileCount === 0 || fileModel.errorMessage !== ""
189 text: fileModel.errorMessage !== "" ? fileModel.errorMessage : (fileModel.showAll ? qsTr("No files") : qsTr("No key files"))
190 color: Theme.highlightColor
196 if (status === PageStatus.Activating) {
197 // go to Home on startup
199 page.initial = false;
200 Functions.goToInitial(dir);
211 // connect signals from engine to panels
214 onProgressChanged: progressPanel.text = engine.progressFilename
215 onWorkerDone: progressPanel.hide()
216 onWorkerErrorOccurred: {
217 // the error signal goes to all pages in pagestack, show it only in the active one
218 if (progressPanel.open) {
219 progressPanel.hide();
220 if (message === "Unknown error")
221 filename = qsTr("Trying to move between phone and SD Card? It doesn't work, try copying.");
222 else if (message === "Failure to write block")
223 filename = qsTr("Perhaps the storage is full?");
225 notificationPanel.showText(message, filename);
231 id: notificationPanel
238 onCancelled: engine.cancel()