fotaapplication/fotaserver/FotaServer/src/DevEncProgressDlg.cpp
changeset 50 a36219ae6585
parent 49 689a71addb96
child 51 2e64dc50f295
equal deleted inserted replaced
49:689a71addb96 50:a36219ae6585
     1 /*
       
     2 * Copyright (c) 2005 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:   Progress dlg for download
       
    15 *
       
    16 */
       
    17 
       
    18 
       
    19 
       
    20 // INCLUDE FILES
       
    21 #include "DevEncProgressDlg.h"
       
    22 #include <AknGlobalProgressDialog.h>
       
    23 #include <StringLoader.h>
       
    24 #include <stringresourcereader.h>
       
    25 #include <avkon.rsg>
       
    26 #include "FotaSrvDebug.h"
       
    27 
       
    28 // ========================= MEMBER FUNCTIONS ================================
       
    29 EXPORT_C CDevEncProgressDlg* CDevEncProgressDlg::NewL(MDEProgressDlgObserver* aObserver, TInt aResource)
       
    30     {
       
    31     FLOG(_L("CDevEncProgressDlg::NewL >>"));
       
    32     
       
    33     CDevEncProgressDlg* self = CDevEncProgressDlg::NewLC(aObserver, aResource);
       
    34     CleanupStack::Pop();
       
    35     
       
    36     FLOG(_L("CDevEncProgressDlg::NewL <<"));
       
    37     return self;
       
    38     }
       
    39 
       
    40 EXPORT_C CDevEncProgressDlg* CDevEncProgressDlg::NewLC(MDEProgressDlgObserver* aObserver, TInt aResource)
       
    41     {
       
    42     FLOG(_L("CDevEncProgressDlg::NewLC >>"));
       
    43     
       
    44     CDevEncProgressDlg* self = new (ELeave) CDevEncProgressDlg(aObserver);
       
    45     CleanupStack::PushL(self);
       
    46     
       
    47     self->ConstructL(aResource);
       
    48     
       
    49     FLOG(_L("CDevEncProgressDlg::NewL <<"));
       
    50     return self;    
       
    51     }
       
    52 
       
    53 void CDevEncProgressDlg::ConstructL(TInt aResource)
       
    54     {
       
    55     FLOG(_L("CDevEncProgressDlg::ConstructL >>"));
       
    56     
       
    57     iProgressDialog = CAknGlobalProgressDialog::NewL();
       
    58     iStringResource = StringLoader::LoadL(aResource);
       
    59     
       
    60     FLOG(_L("CDevEncProgressDlg::ConstructL <<"));
       
    61     }
       
    62 
       
    63 // ---------------------------------------------------------------------------
       
    64 // CDevEncProgressDlg::CDevEncProgressDlg
       
    65 // ---------------------------------------------------------------------------
       
    66 CDevEncProgressDlg::CDevEncProgressDlg(MDEProgressDlgObserver* aObserver) : CActive(EPriorityMore),
       
    67                                                                             iProgressDialog (NULL),
       
    68                                                                             iStringResource (NULL),
       
    69                                                                             iObserver (aObserver)
       
    70     {
       
    71     CActiveScheduler::Add(this);
       
    72     }
       
    73 
       
    74 // ---------------------------------------------------------------------------
       
    75 // Destructor
       
    76 // ---------------------------------------------------------------------------
       
    77 CDevEncProgressDlg::~CDevEncProgressDlg()
       
    78     {
       
    79     FLOG(_L("CDevEncProgressDlg::~CDevEncProgressDlg >>"));
       
    80     
       
    81     Cancel();
       
    82     
       
    83     delete iProgressDialog; iProgressDialog = NULL;
       
    84     
       
    85     delete iStringResource; iStringResource = NULL;
       
    86     
       
    87     iObserver = NULL;
       
    88     
       
    89     FLOG(_L("CDevEncProgressDlg::~CDevEncProgressDlg <<"));
       
    90     }
       
    91 
       
    92 // ---------------------------------------------------------------------------
       
    93 // CDevEncProgressDlg::OkToExitL
       
    94 // Called by framework when the Softkey is pressed.
       
    95 // ---------------------------------------------------------------------------
       
    96 //
       
    97 void CDevEncProgressDlg::DoCancel()
       
    98     {
       
    99     FLOG(_L("CDevEncProgressDlg::DoCancel >>"));
       
   100     
       
   101     if (iProgressDialog)
       
   102         {
       
   103         iProgressDialog->CancelProgressDialog();
       
   104         }
       
   105     
       
   106     FLOG(_L("CDevEncProgressDlg::DoCancel <<"));
       
   107     }
       
   108 
       
   109 void CDevEncProgressDlg::RunL()
       
   110     {
       
   111     FLOG(_L("CDevEncProgressDlg::RunL >>"));
       
   112     
       
   113     if (iObserver)
       
   114         {
       
   115         iObserver->HandleDEProgressDialogExitL(iStatus.Int());
       
   116         }
       
   117     FLOG(_L("CDevEncProgressDlg::RunL <<"));
       
   118     }
       
   119 
       
   120 void CDevEncProgressDlg::ShowProgressDialogL()
       
   121     {
       
   122     FLOG(_L("CDevEncProgressDlg::ShowProgressDialogL >>"));
       
   123     
       
   124     iProgressDialog->ShowProgressDialogL(iStatus,iStringResource->Des(),R_AVKON_SOFTKEYS_EMPTY);
       
   125     FLOG(_L("Step...1"));
       
   126     
       
   127     SetActive();
       
   128     FLOG(_L("Step...2"));
       
   129     FLOG(_L("CDevEncProgressDlg::ShowProgressDialogL <<"));
       
   130     }
       
   131 
       
   132 
       
   133 void CDevEncProgressDlg::UpdateProgressDialogL(TInt aValue, TInt aFinalValue)
       
   134     {
       
   135     FLOG(_L("CDevEncProgressDlg::UpdateProgressDialogL, value = %d >>"), aValue);
       
   136     
       
   137     iProgressDialog->UpdateProgressDialog(aValue, aFinalValue);
       
   138     
       
   139     FLOG(_L("CDevEncProgressDlg::UpdateProgressDialogL <<"));
       
   140     }
       
   141 
       
   142 void CDevEncProgressDlg::ProgressFinished()
       
   143     {
       
   144     FLOG(_L("CDevEncProgressDlg::ProgressFinished >>"));
       
   145    
       
   146     iProgressDialog->ProcessFinished();
       
   147     
       
   148     FLOG(_L("CDevEncProgressDlg::ProgressFinished <<"));
       
   149     }
       
   150 // End of File