File: WebdavFileBrowser.qml

package info (click to toggle)
lomiri-cloudsync-app 0.8.1%2Bdfsg-3
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 3,560 kB
  • sloc: cpp: 1,053; python: 67; javascript: 25; makefile: 21; sh: 9
file content (69 lines) | stat: -rw-r--r-- 1,846 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
import QtQuick 2.4
import Lomiri.Components 1.3

import "../components"

// C++ Plugin
import OwncloudSync 1.0

FileBrowser{
    id:fileBrowser
    caller: caller
    folderModel: folderListModel
    rootPath: "/"

    property string paramUsername: ""
    property string paramPassword: ""
    property string paramServerUrl: ""

    WebdavFolderListModel{
        id: folderListModel

        showDirs:  true
        showFiles: false
        showHidden: true

        username: fileBrowser.paramUsername
        password: fileBrowser.paramPassword
        serverUrl: fileBrowser.paramServerUrl

        folder: caller.text ? caller.text : fileBrowser.rootPath

        onFolderChanged: {
            connectionStatus.spinner = true
            connectionStatus.status = i18n.tr("Loading")
            connectionStatus.indicationIcon = "updating"
            connectionStatus.autoHide = true
        }

        onCountChanged: {
            connectionStatus.hide()
            fileBrowser.showNoChildFolders = true
        }

        onErrorOccured: {
            connectionStatus.spinner = false
            connectionStatus.status = i18n.tr("Check your connection or try again!") + "<br>(" + folderListModel.errorMsg + ")"
            connectionStatus.indicationIcon = "error"
            connectionStatus.autoHide = false
            fileBrowser.header.trailingActionBar.actions = []
            fileBrowser.header.leadingActionBar.actions = []
            // Indicate error
            fileBrowser.errorOccured = true
        }

        function newFolder(folderPath){
            console.log(folderPath)

            folderListModel.newWebDavFolder(folderPath)

        }
    }

    PopupStatusBox{
        id: connectionStatus
        autoHide: false
        anchors{left: parent.left; right:parent.right; bottom: parent.bottom;}

    }
}