~abreu-alexandre/webbrowser-app/theme-color-meta-detection

« back to all changes in this revision

Viewing changes to src/app/webbrowser/DownloadHandler.qml

  • Committer: CI Train Bot
  • Author(s): Michael Sheldon
  • Date: 2015-12-21 20:39:33 UTC
  • mfrom: (1106.3.119 implement-download-folder)
  • Revision ID: ci-train-bot@canonical.com-20151221203933-o2ijlcmhhyoi62wk
Add support for handling downloads internally within the browser. Fixes: #1354391
Approved by: Olivier Tilloy

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
/*
 
2
 * Copyright 2015 Canonical Ltd.
 
3
 *
 
4
 * This file is part of webbrowser-app.
 
5
 *
 
6
 * webbrowser-app is free software; you can redistribute it and/or modify
 
7
 * it under the terms of the GNU General Public License as published by
 
8
 * the Free Software Foundation; version 3.
 
9
 *
 
10
 * webbrowser-app is distributed in the hope that it will be useful,
 
11
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 
12
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 
13
 * GNU General Public License for more details.
 
14
 *
 
15
 * You should have received a copy of the GNU General Public License
 
16
 * along with this program.  If not, see <http://www.gnu.org/licenses/>.
 
17
 */
 
18
 
 
19
import QtQuick 2.4
 
20
import Ubuntu.DownloadManager 1.2
 
21
 
 
22
DownloadManager {
 
23
    id: downloadManager
 
24
 
 
25
    onDownloadFinished: {
 
26
        downloadsModel.moveToDownloads(download.downloadId, path)
 
27
        downloadsModel.setComplete(download.downloadId, true)
 
28
    }
 
29
 
 
30
    onDownloadPaused: {
 
31
        downloadsModel.pauseDownload(download.downloadId)
 
32
    }
 
33
 
 
34
    onDownloadResumed: {
 
35
        downloadsModel.resumeDownload(download.downloadId)
 
36
    }
 
37
 
 
38
    onDownloadCanceled: {
 
39
        downloadsModel.cancelDownload(download.downloadId)
 
40
    }
 
41
 
 
42
    onErrorFound: {
 
43
        downloadsModel.setError(download.downloadId, download.errorMessage)
 
44
    }
 
45
}