Ubuntu Download Manager  1.2.0
A session-wide downloading service
downloads_list_impl.cpp
Go to the documentation of this file.
1 /*
2  * Copyright 2014 Canonical Ltd.
3  *
4  * This library is free software; you can redistribute it and/or
5  * modify it under the terms of version 3 of the GNU Lesser General Public
6  * License as published by the Free Software Foundation.
7  *
8  * This program is distributed in the hope that it will be useful,
9  * but WITHOUT ANY WARRANTY; without even the implied warranty of
10  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
11  * General Public License for more details.
12  *
13  * You should have received a copy of the GNU Lesser General Public
14  * License along with this library; if not, write to the
15  * Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
16  * Boston, MA 02110-1301, USA.
17  */
18 
19 #include "download.h"
20 #include "error.h"
21 #include "downloads_list_impl.h"
22 
23 namespace Ubuntu {
24 
25 namespace DownloadManager {
26 
27 DownloadsListImpl::DownloadsListImpl(QObject* parent)
28  : DownloadsList(parent) {
29 }
30 
31 DownloadsListImpl::DownloadsListImpl(
32  const QList<QSharedPointer<Download> > downs,
33  QObject* parent)
34  : DownloadsList(parent),
35  _downs(downs){
36 }
37 
38 DownloadsListImpl::DownloadsListImpl(Error* err, QObject* parent)
39  : DownloadsList(parent),
40  _lastError(err) {
41 }
42 
43 DownloadsListImpl::~DownloadsListImpl() {
44  delete _lastError;
45 }
46 
47 QList<QSharedPointer<Download> >
48 DownloadsListImpl::downloads() const {
49  return _downs;
50 }
51 
52 bool
53 DownloadsListImpl::isError() const {
54  return _lastError != nullptr;
55 }
56 
57 Error*
58 DownloadsListImpl::error() const {
59  return _lastError;
60 }
61 
62 } // Ubuntu
63 
64 } // DownloadManager