utilities/downloadmanager/inc/wmdrmdownloadbackend.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 WMDRMDOWNLOADBACKEND_H
       
    18 #define WMDRMDOWNLOADBACKEND_H
       
    19 
       
    20 #include <bldvariant.hrh>
       
    21 #if defined(RD_WMDRM_DLA_ENABLERS)
       
    22 
       
    23 #include "dmcommon.h"
       
    24 #include "dmcommoninternal.h"
       
    25 #include "downloadbackend.h"
       
    26 #include <e32base.h>
       
    27 
       
    28 // forward declarations
       
    29 class DownloadCore;
       
    30 class ClientDownload;
       
    31 class CCameseUtility;
       
    32 
       
    33 // class declaration
       
    34 
       
    35 // concrete download implementation for WM DRM downloads
       
    36 class WMDRMDownloadBackend : public DownloadBackend, public CActive
       
    37 {
       
    38     Q_OBJECT
       
    39 public:
       
    40     WMDRMDownloadBackend(DownloadCore *dlCore, ClientDownload *dl);
       
    41     ~WMDRMDownloadBackend();
       
    42 
       
    43     // fetches the wmdrm download attributes
       
    44     QVariant getAttribute(DownloadAttribute attr);
       
    45     // sets the wmdrm 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     // from base class CActive
       
    62     void RunL();
       
    63     void DoCancel();
       
    64 
       
    65 
       
    66 private slots:
       
    67     void bytesRecieved(qint64 bytesRecieved, qint64 bytesTotal);
       
    68     void handleFinished();    
       
    69 private:
       
    70     // event handler
       
    71     bool event(QEvent *event);
       
    72     // mark download failed
       
    73     void markDownloadFailed(const QString& error);
       
    74 
       
    75 private:
       
    76     DownloadCore *m_downloadCore;
       
    77     ClientDownload *m_download;
       
    78     ClientDownload *m_contentDownload; // not owned
       
    79     CCameseUtility* m_utility;
       
    80     HBufC8* m_contentUrl;
       
    81     
       
    82     // Error status for the synchronous request
       
    83     TInt m_requestResult;
       
    84 
       
    85     //Waiter for the synchronous request  
       
    86     CActiveSchedulerWait m_wait;   
       
    87 };
       
    88 #endif
       
    89 #endif