~verzegnassi-stefano/ubuntu-docviewer-app/fix-1544149

« back to all changes in this revision

Viewing changes to src/app/qml/common/ContentHubProxy.qml

  • Committer: Stefano Verzegnassi
  • Date: 2016-02-10 17:46:14 UTC
  • Revision ID: stefano92.100@gmail.com-20160210174614-m4v6l1rupe0m9lcq
Fixed ContentTransferHint being visible during an export

Show diffs side-by-side

added added

removed removed

Lines of Context:
23
23
Item {
24
24
    id: contentHubProxy
25
25
 
26
 
    property var activeTransfer
 
26
    property var activeImportTransfer
 
27
    property var activeExportTransfer
27
28
 
28
29
    // This property is used in ../documentPage/Document(Grid|List)View.qml
29
30
    // so that we avoid to import Ubuntu.Content module outside this proxy.
30
 
    property bool multipleSelectionType: !activeTransfer || activeTransfer.selectionType == ContentTransfer.Multiple
 
31
    property bool multipleSelectionType: !activeExportTransfer || activeExportTransfer.selectionType == ContentTransfer.Multiple
31
32
 
32
33
    property alias rejectedDocuments: rejectedDocsModel
33
34
    property alias importedDocuments: importedDocsModel
36
37
    ListModel { id: importedDocsModel }
37
38
 
38
39
    ContentTransferHint {
39
 
        activeTransfer: contentHubProxy.activeTransfer
 
40
        activeTransfer: contentHubProxy.activeImportTransfer
40
41
    }
41
42
 
42
43
    Connections {
43
44
        target: ContentHub
44
45
 
45
46
        onImportRequested: {
46
 
             activeTransfer = transfer
 
47
             activeImportTransfer = transfer
47
48
 
48
 
            if (activeTransfer.state === ContentTransfer.Charged) {
 
49
            if (activeImportTransfer.state === ContentTransfer.Charged) {
49
50
                mainView.switchToBrowseMode()
50
51
 
51
52
                internal.clearModels()
52
53
 
53
 
                for (var i=0; i<activeTransfer.items.length; i++) {
54
 
                    var sourcePath = internal.getPathFromUrl(activeTransfer.items[i].url)
 
54
                for (var i=0; i<activeImportTransfer.items.length; i++) {
 
55
                    var sourcePath = internal.getPathFromUrl(activeImportTransfer.items[i].url)
55
56
 
56
57
                    if (DocumentViewer.isFileSupported(sourcePath)) {
57
58
                        var documentsLocation = DocumentViewer.getXdgDocumentsLocation()
84
85
        }
85
86
 
86
87
        onExportRequested: {
87
 
            activeTransfer = transfer
 
88
            activeExportTransfer = transfer
88
89
            mainView.switchToPickMode()
89
90
        }
90
91
    }
125
126
        }
126
127
 
127
128
        function finalizeImport() {
128
 
            activeTransfer.finalize()
 
129
            activeImportTransfer.finalize()
129
130
        }
130
131
 
131
132
        function handleNotifications() {