iaupdate/IAD/ui/src/iaupdatewaitdialog.cpp
branchRCL_3
changeset 66 8b7f4e561641
parent 65 7333d7932ef7
equal deleted inserted replaced
65:7333d7932ef7 66:8b7f4e561641
     1 /*
     1 /*
     2 * Copyright (c) 2007-2010 Nokia Corporation and/or its subsidiary(-ies).
     2 * Copyright (c) 2007-2008 Nokia Corporation and/or its subsidiary(-ies).
     3 * All rights reserved.
     3 * All rights reserved.
     4 * This component and the accompanying materials are made available
     4 * This component and the accompanying materials are made available
     5 * under the terms of "Eclipse Public License v1.0"
     5 * under the terms of "Eclipse Public License v1.0"
     6 * which accompanies this distribution, and is available
     6 * which accompanies this distribution, and is available
     7 * at the URL "http://www.eclipse.org/legal/epl-v10.html".
     7 * at the URL "http://www.eclipse.org/legal/epl-v10.html".
     9 * Initial Contributors:
     9 * Initial Contributors:
    10 * Nokia Corporation - initial contribution.
    10 * Nokia Corporation - initial contribution.
    11 *
    11 *
    12 * Contributors:
    12 * Contributors:
    13 *
    13 *
    14 * Description:   This file contains the implementation of IAUpdateWaitDialog
    14 * Description:   This file contains the implementation of CIAUpdateWaitDialog
    15 *                class member functions.
    15 *                class member functions.
    16 *
    16 *
    17 */
    17 */
    18 
    18 
    19 
    19 
    20 
    20 
    21 // INCLUDE FILES
    21 // INCLUDE FILES
    22 #include <hbprogressdialog.h>
       
    23 
       
    24 #include "iaupdatewaitdialog.h"
    22 #include "iaupdatewaitdialog.h"
    25 #include "iaupdatewaitdialogobserver.h"
    23 #include "iaupdatewaitdialogobserver.h"
    26 
    24 
    27 
    25 
    28 
    26 
    29 // ========================= MEMBER FUNCTIONS ================================
    27 // ========================= MEMBER FUNCTIONS ================================
    30 
    28 
    31 // -----------------------------------------------------------------------------
    29 // -----------------------------------------------------------------------------
    32 // IAUpdateWaitDialog::IAUpdateWaitDialog
    30 // CIAUpdateDialogs::CIAUpdateDialogs
       
    31 // C++ default constructor can NOT contain any code, that
       
    32 // might leave.
    33 // -----------------------------------------------------------------------------
    33 // -----------------------------------------------------------------------------
    34 //
    34 //
    35 IAUpdateWaitDialog::IAUpdateWaitDialog() 
    35 CIAUpdateWaitDialog::CIAUpdateWaitDialog( CEikDialog** aSelfPtr, 
    36 {
    36                                 TBool aVisibilityDelayOff )
    37     mCallback = NULL;
    37     :CAknWaitDialog( aSelfPtr, aVisibilityDelayOff )
    38     mWaitDialog = NULL;
    38     {
    39 }
    39     }
    40 
    40 
    41 // -----------------------------------------------------------------------------
    41 // -----------------------------------------------------------------------------
    42 // IAUpdateWaitDialog::~IAUpdateWaitDialog
    42 // CIAUpdateDialogs::~CIAUpdateDialogs
    43 // Destructor
    43 // Destructor
    44 // -----------------------------------------------------------------------------
    44 // -----------------------------------------------------------------------------
    45 //
    45 //
    46 IAUpdateWaitDialog::~IAUpdateWaitDialog()
    46 CIAUpdateWaitDialog::~CIAUpdateWaitDialog()
    47 {
       
    48     if (mWaitDialog)
       
    49     {
    47     {
    50         //mWaitDialog->close();  //TODO: is there need to close/delete progressdialog, it's selfdeleted in close()
       
    51     }
    48     }
    52 }
       
    53 
    49 
    54 // ---------------------------------------------------------------------------
    50 // ---------------------------------------------------------------------------
    55 // IAUpdateWaitDialog::showDialog()
    51 // CIAUpdateWaitDialog::OkToExitL()
       
    52 // called by framework when the Softkey is pressed. 
       
    53 // On cancel either stop installation or exit 
    56 // ---------------------------------------------------------------------------
    54 // ---------------------------------------------------------------------------
    57 //
    55 //
    58 int IAUpdateWaitDialog::showDialog(const QString& text)
    56 TBool CIAUpdateWaitDialog::OkToExitL( TInt aButtonId )
    59 {
       
    60     if (!mWaitDialog)
       
    61     {
    57     {
    62         mWaitDialog = new HbProgressDialog(HbProgressDialog::WaitDialog);
    58     TBool result( ETrue );
    63         connect(mWaitDialog, SIGNAL(cancelled()), this, SLOT(dialogCancelled()));
    59     
       
    60     if ( iCallback )
       
    61         {
       
    62         result = iCallback->HandleDialogExitL( aButtonId );
       
    63         }
       
    64 
       
    65     return result;
    64     }
    66     }
    65     mWaitDialog->setText(text);
    67 
    66     mWaitDialog->setTimeout(HbPopup::NoTimeout);
       
    67     mWaitDialog->show();
       
    68     return 0;
       
    69 }
       
    70 // ---------------------------------------------------------------------------
    68 // ---------------------------------------------------------------------------
    71 // IAUpdateWaitDialog::SetCallback
    69 // CIAUpdateWaitDialog::SetCallback
    72 // ---------------------------------------------------------------------------
    70 // ---------------------------------------------------------------------------
    73 //
    71 //
    74 void IAUpdateWaitDialog::SetCallback(MIAUpdateWaitDialogObserver* callback)
    72 void CIAUpdateWaitDialog::SetCallback( MIAUpdateWaitDialogObserver* aCallback )
    75 {
    73     {
    76     mCallback = callback;
    74     iCallback = aCallback;
    77 }
    75     }
    78 
    76 
    79 void IAUpdateWaitDialog::close()
       
    80 {
       
    81     if (mWaitDialog)  
       
    82     {
       
    83        mWaitDialog->close();     
       
    84     }
       
    85 }
       
    86 
       
    87 void IAUpdateWaitDialog::dialogCancelled()
       
    88 {
       
    89     if (mCallback)
       
    90     {
       
    91         mCallback->HandleWaitDialogCancel();        
       
    92     }
       
    93 }
       
    94 // End of File
    77 // End of File