• DownloadManager
  • DownloadManager

    Manage downloads for several files. More...

    Import Statement: import Ubuntu.DownloadManager 0.1

    Properties

    Methods

    Detailed Description

    DownloadManager provides facilities for downloading a several files, connect the downloads property to any Item that works with models, and dynamically update the content of those lists/repeaters/etc to show the current downloads and connect any UI to the SingleDownload properties in the delegates.

    Example usage:

    import QtQuick 2.0
    import Ubuntu.Components 0.1
    import Ubuntu.DownloadManager 0.1
    
    Rectangle {
        width: units.gu(100)
        height: units.gu(80)
    
        DownloadManager {
            id: manager
        }
    
        TextField {
            id: text
            placeholderText: "File URL to download..."
            height: 50
            anchors {
                left: parent.left
                right: button.left
                rightMargin: units.gu(2)
            }
        }
    
        Button {
            id: button
            text: "Download"
            height: 50
            anchors.right: parent.right
    
            onClicked: {
                manager.download(text.text);
            }
        }
    
        ListView {
            id: list
            anchors {
                left: parent.left
                right: parent.right
                top: text.bottom
                bottom: parent.bottom
            }
            model: manager.downloads
    
            delegate: ProgressBar {
                minimumValue: 0
                maximumValue: 100
                value: modelData.progress
            }
        }
    }

    See also SingleDownload.

    Property Documentation

    autoStart : bool

    This property sets if the downloads should start automatically, or let the user decide when to start them calling the "start()" method on each download.


    cleanDownloads : bool

    This property sets if the model with the list of downloads should be cleaned when a download finish. Removing those completed transfers, and only showing current downloads.


    downloads : list

    This property provides a model that can be used for Lists, Repeaters, etc. To handle those downloads in a UI component that changes automatically when a new download is started, and let a custom delegate how to represent the UI for each download.


    errorMessage : string

    The error message associated with the current download, if there is any.


    Method Documentation

    void download(string url)

    Starts the download for the given url and update the model with the list of the different downloads.