applicationmanagement/server/inc/appmgmtdownloadmgr.h
changeset 42 aa33c2cb9a50
child 52 6e38e48ee756
equal deleted inserted replaced
41:c742e1129640 42:aa33c2cb9a50
       
     1 /*
       
     2  * Copyright (c) 2000 Nokia Corporation and/or its subsidiary(-ies). 
       
     3  * All rights reserved.
       
     4  * This component and the accompanying materials are made available
       
     5  * under the terms of "Eclipse Public License v1.0"
       
     6  * which accompanies this distribution, and is available
       
     7  * at the URL "http://www.eclipse.org/legal/epl-v10.html".
       
     8  *
       
     9  * Initial Contributors:
       
    10  * Nokia Corporation - initial contribution.
       
    11  *
       
    12  * Contributors:
       
    13  *
       
    14  * Description: Implementation of applicationmanagement components
       
    15  *
       
    16  */
       
    17 
       
    18 #include <QObject>
       
    19 #include <qtimeline.h>
       
    20 #include <QTimer>
       
    21 #include <QWidget>
       
    22 #include <hbcombobox.h>
       
    23 #include <downloadevent.h>
       
    24 #include <downloadmanager.h>
       
    25 #include <hbdocumentloader.h>
       
    26 #include "appmgmtprogdialog.h"
       
    27 #include "AMDeploymentComponent.h"
       
    28 #include "appmgmtnotifier.h"
       
    29 #define  KOmaDMAppUid   0x101F6DE5
       
    30 const TReal KSizeDivisor = 1024.0;
       
    31 
       
    32 const TUint32 KDownloadActive = 0x0000008;
       
    33 enum TDriveSize
       
    34     {
       
    35     EKb = -1,
       
    36     EMb = 0,
       
    37     EGb = 1
       
    38     };
       
    39 
       
    40 using namespace WRT;
       
    41 
       
    42 namespace NApplicationManagement
       
    43     {
       
    44 
       
    45     class MDownloadMgrQTCallback
       
    46         {
       
    47     public:
       
    48         virtual void DownloadCompleted()=0;
       
    49         virtual void DownloadFailed(TInt aDownloaderr)=0;
       
    50         virtual void SetStatus(TInt aStatus)=0;
       
    51         };
       
    52     
       
    53     class CDialogWait : public CActive
       
    54         {
       
    55     public:
       
    56         static CDialogWait* NewL();
       
    57         CDialogWait();
       
    58         void ConstructL();
       
    59         ~CDialogWait();
       
    60         void StartWait();
       
    61         void Stop();
       
    62     protected:
       
    63         void DoCancel();
       
    64         void RunL();
       
    65         TInt RunError(TInt aError);
       
    66     private:
       
    67         CActiveSchedulerWait* iWait;
       
    68         };
       
    69     
       
    70     class appmgmtdownloadmgr : public QWidget
       
    71         {
       
    72 
       
    73     Q_OBJECT
       
    74 
       
    75     public:
       
    76         appmgmtdownloadmgr(QWidget* parent, MDownloadMgrQTCallback& wrapper, TRequestStatus& aStatus);
       
    77         ~appmgmtdownloadmgr();
       
    78         
       
    79         void startDownload(CDeploymentComponent *aComponent);
       
    80         void showDialog(CDeploymentComponent *aComponent);
       
    81         void showUninstallDialog(const CDeploymentComponent &aCompo, TRequestStatus &s);
       
    82         void updateProgress(TInt32 aDownloadedSize, TInt32 aContentSize);
       
    83         void closeProgress();
       
    84         void setUri();
       
    85         void getUri();
       
    86         void setState();
       
    87         void getState();
       
    88         void MimeType(QString& aMimeType);
       
    89         void FileName(QString& afilename);
       
    90 	  void SetMimeType();
       
    91         void sendSrvToBg();
       
    92         QString convertSize();
       
    93         int currDwnldStatForGenericAlert(int dwnldstatus);
       
    94         
       
    95     public slots:
       
    96         bool downloadMgrEventRecieved(DownloadManagerEvent *event);
       
    97         bool downloadEventRecieved(DownloadEvent *event);
       
    98         void dialogSlot(HbAction*);
       
    99         void defaultDriveChanged(int);
       
   100     private:
       
   101         void getAvailableDrives();
       
   102         void showInstalltoDialog();
       
   103         void showDownloadDialog();
       
   104     private:
       
   105         QStringList m_drivList;
       
   106         QString m_appName;
       
   107         HbAction* mOkButton;
       
   108         HbAction* mCancel;
       
   109         QString mSize;
       
   110         QString mSizeFormat;
       
   111         QString mNotifierdata, mDialogData;
       
   112         QString m_sizeStr;
       
   113         QString m_mimetype;
       
   114         HbComboBox* mDriveBox;
       
   115         HbDialog* mDialog;
       
   116     public:
       
   117         // Functions from base classes
       
   118         TBuf<256> drilist;
       
   119         DownloadManager* iDownloadManager;
       
   120         Download* iDl;
       
   121         int m_inProgress;
       
   122         int m_currentDownloadedSize;
       
   123         int m_totalSize;
       
   124         CDialogWait* iWait;
       
   125         TUint32 iProgStarted;
       
   126         TUint32 iSetFinalValue;
       
   127 		int m_downloadStatus;
       
   128         AppMgmtProgDialog *iProgressNote;
       
   129         TDownloadTarget iOperationType;
       
   130     private:
       
   131         // Data
       
   132         MDownloadMgrQTCallback& m_callback;
       
   133         CDeploymentComponent* iComp;
       
   134         HBufC *iFileName;
       
   135         HBufC8 *iContentType;
       
   136         HBufC8 *iURI;
       
   137         TBool iProgressCancelled;
       
   138         TBool iDialogAccepted;
       
   139         TRequestStatus& iStatus;
       
   140         AppMgmtNotifier* mNote;
       
   141         int mEndReported;
       
   142         int mNetworkLoss;
       
   143         };
       
   144 
       
   145     }