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 pageStack.push(Qt.resolvedUrl("SearchPage.qml"), { dir: page.dir });
42 fileModel.showAll = true
43 menuShowAll.visible = false
44 menuShowFiltered.visible = true
47 fileModel.showAll = false
48 menuShowFiltered.visible = false
49 menuShowAll.visible = true
57 onClicked: _selectedMenu = 1
61 onClicked: _selectedMenu = 2
65 visible: !fileModel.showAll
66 text: qsTr("Show all files")
67 onClicked: _selectedMenu = 3
71 visible: fileModel.showAll
72 text: qsTr("Show only ") + engine.extensionFilter + qsTr(" files")
73 onClicked: _selectedMenu = 4
78 title: Functions.formatPathForTitle(page.dir) + " " +
79 Functions.unicodeBlackDownPointingTriangle()
82 onClicked: dirPopup.show();
89 width: ListView.view.width
90 contentHeight: listLabel.height+listSize.height + 13
94 anchors.left: parent.left
95 anchors.leftMargin: Theme.paddingLarge
96 anchors.top: parent.top
98 source: "../images/small-"+fileIcon+".png"
102 anchors.left: listIcon.right
103 anchors.leftMargin: 10
104 anchors.right: parent.right
105 anchors.rightMargin: Theme.paddingLarge
106 anchors.top: parent.top
109 elide: Text.ElideRight
113 anchors.left: listIcon.right
114 anchors.leftMargin: 10
115 anchors.top: listLabel.bottom
116 text: !(isLink && isDir) ? size : Functions.unicodeArrow()+" "+symLinkTarget
117 color: Theme.secondaryColor
118 font.pixelSize: Theme.fontSizeExtraSmall
121 visible: !(isLink && isDir)
122 anchors.top: listLabel.bottom
123 anchors.horizontalCenter: parent.horizontalCenter
124 text: filekind+permissions
125 color: Theme.secondaryColor
126 font.pixelSize: Theme.fontSizeExtraSmall
129 visible: !(isLink && isDir)
130 anchors.top: listLabel.bottom
131 anchors.right: listLabel.right
133 color: Theme.secondaryColor
134 font.pixelSize: Theme.fontSizeExtraSmall
139 pageStack.push(Qt.resolvedUrl("DirectoryPage.qml"),
140 { dir: fileModel.appendPath(listLabel.text) });
144 Functions.fileSelect(fileModel.appendPath(listLabel.text))
145 //pageStack.push(Qt.resolvedUrl("FilePage.qml"),
146 // { file: fileModel.appendPath(listLabel.text) });
150 // delete file after remorse time
151 ListView.onRemove: animateRemoval(fileItem)
152 function deleteFile(deleteFilename) {
153 remorseAction(qsTr("Deleting"), function() {
154 progressPanel.showText(qsTr("Deleting"));
155 engine.deleteFiles([ deleteFilename ]);
159 // context menu is activated with long press
165 text: qsTr("Properties")
167 pageStack.push(Qt.resolvedUrl("FilePage.qml"),
168 { file: fileModel.fileNameAt(index) });
175 // text if no files or error message
178 anchors.leftMargin: Theme.paddingLarge
179 anchors.rightMargin: Theme.paddingLarge
180 horizontalAlignment: Qt.AlignHCenter
181 y: -fileList.contentY + 100
182 visible: fileModel.fileCount === 0 || fileModel.errorMessage !== ""
183 text: fileModel.errorMessage !== "" ? fileModel.errorMessage : (fileModel.showAll ? qsTr("No files") : qsTr("No key files"))
184 color: Theme.highlightColor
190 if (status === PageStatus.Activating) {
191 // go to Home on startup
193 page.initial = false;
194 Functions.goToInitial(dir);
205 // connect signals from engine to panels
208 onProgressChanged: progressPanel.text = engine.progressFilename
209 onWorkerDone: progressPanel.hide()
210 onWorkerErrorOccurred: {
211 // the error signal goes to all pages in pagestack, show it only in the active one
212 if (progressPanel.open) {
213 progressPanel.hide();
214 if (message === "Unknown error")
215 filename = qsTr("Trying to move between phone and SD Card? It doesn't work, try copying.");
216 else if (message === "Failure to write block")
217 filename = qsTr("Perhaps the storage is full?");
219 notificationPanel.showText(message, filename);
225 id: notificationPanel
232 onCancelled: engine.cancel()