utilities/downloadmanager/inc/backgrounddownloadmanager.h
changeset 16 3c88a81ff781
equal deleted inserted replaced
14:6aeb7a756187 16:3c88a81ff781
       
     1 /**
       
     2    This file is part of CWRT package **
       
     3 
       
     4    Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies). **
       
     5 
       
     6    This program is free software: you can redistribute it and/or modify
       
     7    it under the terms of the GNU (Lesser) General Public License as 
       
     8    published by the Free Software Foundation, version 2.1 of the License. 
       
     9    This program is distributed in the hope that it will be useful, but
       
    10    WITHOUT ANY WARRANTY; without even the implied warranty of 
       
    11    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 
       
    12    (Lesser) General Public License for more details. You should have 
       
    13    received a copy of the GNU (Lesser) General Public License along 
       
    14    with this program. If not, see <http://www.gnu.org/licenses/>.
       
    15 */
       
    16 
       
    17 #ifndef BACKGROUNDDOWNLOADMANAGER_H
       
    18 #define BACKGROUNDDOWNLOADMANAGER_H
       
    19 
       
    20 #include "dmcommon.h"
       
    21 #include "dmpimpl.h"
       
    22 #include <QObject>
       
    23 
       
    24 // forward declarations
       
    25 class DownloadManager;
       
    26 class Download;
       
    27 class DownloadManagerClient;
       
    28 class BackgroundDownloadManagerPrivate;
       
    29 
       
    30 // class declaration
       
    31 class BackgroundDownloadManager : public QObject
       
    32 {
       
    33     Q_OBJECT
       
    34     DM_DECLARE_PRIVATE(BackgroundDownloadManager); // private implementation
       
    35 public:
       
    36     BackgroundDownloadManager(DownloadManager* downloadMgr);
       
    37     virtual ~BackgroundDownloadManager();
       
    38 
       
    39     // to initialise all the downloads which belongs to last
       
    40     // download manager session
       
    41     void init();
       
    42     // creates new download by passing url
       
    43     Download* createDownload(const QString& url, DownloadType type = Parallel);
       
    44     // creates new download by reading from persistant download information
       
    45     Download* createDownload(int dlId);
       
    46     // sets the proxy
       
    47     void setProxy(const QString& proxyServer, int port);
       
    48     // sets download manager attributes
       
    49     int setAttribute(DownloadManagerAttribute attr, const QVariant& value);
       
    50     // fetches download manager attributes
       
    51     QVariant getAttribute(DownloadManagerAttribute attr);
       
    52     // returns all the current downloads
       
    53     QList<Download*>& currentDownloads();
       
    54     // finds a download provided id if exists
       
    55     Download* findDownload(int dlId);
       
    56     // cancels all the downloads and removes from the list
       
    57     void removeAll();
       
    58     // cancels and removes the download from list
       
    59     void removeOne(Download *dl);
       
    60     // pauses all the downloads which are in progress
       
    61     void pauseAll();
       
    62     // resumes all the downloads which are paused
       
    63     void resumeAll();
       
    64     // returns download manager client object
       
    65     DownloadManagerClient* downloadManagerClient();
       
    66 };
       
    67 
       
    68 #endif