utilities/downloadmanager/inc/omadownloadbackend.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 OMADOWNLOADBACKEND_H
       
    18 #define OMADOWNLOADBACKEND_H
       
    19 
       
    20 #include "dmcommon.h"
       
    21 #include "dmcommoninternal.h"
       
    22 #include "dmpimpl.h"
       
    23 #include "downloadbackend.h"
       
    24 
       
    25 // forward declarations
       
    26 class OMADownloadBackendPrivate;
       
    27 class DownloadCore;
       
    28 class ClientDownload;
       
    29 
       
    30 typedef QList<ClientDownload*> MediaDownloadList;
       
    31 
       
    32 // class declaration
       
    33 
       
    34 // concrete download implementation for OMA downloads
       
    35 class OMADownloadBackend : public DownloadBackend
       
    36 {
       
    37     Q_OBJECT
       
    38     DM_DECLARE_PRIVATE(OMADownloadBackend); // private implementation
       
    39 public:
       
    40     OMADownloadBackend(DownloadCore *dlCore, ClientDownload *dl);
       
    41     ~OMADownloadBackend();
       
    42 
       
    43     // fetches the oma download attributes
       
    44     QVariant getAttribute(DownloadAttribute attr);
       
    45     // sets the oma download specific attributes
       
    46     int setAttribute(DownloadAttribute attr, const QVariant& value);
       
    47     // overloaded function for pausing the download
       
    48     int pause();
       
    49     // overloaded function for resuming paused download
       
    50     int resume();
       
    51     // overloaded function for cancelling the download
       
    52     int cancel();
       
    53 
       
    54     // stores the data in storage
       
    55     void store(QByteArray data, bool lastChunk=false);
       
    56     // deletes the storage
       
    57     void deleteStore();
       
    58     // returns the size of stored data
       
    59     qint64 storedDataSize();
       
    60 
       
    61 private slots:
       
    62     void bytesRecieved(qint64 bytesRecieved, qint64 bytesTotal);
       
    63     void handleFinished();    
       
    64     void bytesUploaded(qint64, qint64); 
       
    65 private:
       
    66     // parses download descriptor
       
    67     bool parseDownloadDescriptor();
       
    68     // does the capability check on receiving DD
       
    69     bool checkDownloadDescriptor();
       
    70     // event handler
       
    71     bool event(QEvent *event);
       
    72 };
       
    73 
       
    74 #endif