ipsservices/ipssossettings/src/ipssetutilsoperationwait.cpp
changeset 0 8466d47a6819
child 26 968773a0b6ef
equal deleted inserted replaced
-1:000000000000 0:8466d47a6819
       
     1 /*
       
     2 * Copyright (c) 2007 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: This file implements class CIpsSetUtilsOperationWait.
       
    15 *
       
    16 */
       
    17 
       
    18 // INCLUDE FILES
       
    19 #include "emailtrace.h"
       
    20 #include <aknenv.h>
       
    21 #include <AknWaitDialog.h> // CAknWaitDialog 
       
    22 #include <ipssossettings.rsg>
       
    23 
       
    24 #include "ipssetutilsoperationwait.h"
       
    25 
       
    26 
       
    27 // ============================ MEMBER FUNCTIONS ===============================
       
    28 
       
    29 // ----------------------------------------------------------------------------
       
    30 // CIpsSetUtilsOperationWait::NewLC()
       
    31 // ----------------------------------------------------------------------------
       
    32 //
       
    33 CIpsSetUtilsOperationWait* CIpsSetUtilsOperationWait::NewLC( 
       
    34     TInt aPriority )
       
    35     {
       
    36     FUNC_LOG;
       
    37     CIpsSetUtilsOperationWait* self = 
       
    38         new ( ELeave ) CIpsSetUtilsOperationWait( aPriority );
       
    39     CleanupStack::PushL( self );
       
    40     return self;
       
    41     }
       
    42 
       
    43 // ----------------------------------------------------------------------------
       
    44 // CIpsSetUtilsOperationWait::CIpsSetUtilsOperationWait()
       
    45 // ----------------------------------------------------------------------------
       
    46 //
       
    47 CIpsSetUtilsOperationWait::CIpsSetUtilsOperationWait( TInt aPriority )
       
    48     : 
       
    49     CActive( aPriority )
       
    50     {
       
    51     FUNC_LOG;
       
    52     CActiveScheduler::Add( this );
       
    53     }
       
    54 
       
    55 // ----------------------------------------------------------------------------
       
    56 // CIpsSetUtilsOperationWait::~CIpsSetUtilsOperationWait()
       
    57 // ----------------------------------------------------------------------------
       
    58 //
       
    59 CIpsSetUtilsOperationWait::~CIpsSetUtilsOperationWait()
       
    60     {
       
    61     FUNC_LOG;
       
    62     
       
    63     delete iWaitDialog;
       
    64     iWaitDialog = NULL;
       
    65     Cancel();
       
    66     }
       
    67 
       
    68 // ----------------------------------------------------------------------------
       
    69 // CIpsSetUtilsOperationWait::Start()
       
    70 // ----------------------------------------------------------------------------
       
    71 //
       
    72 void CIpsSetUtilsOperationWait::Start()
       
    73     {
       
    74     FUNC_LOG;
       
    75     SetActive();
       
    76     iWait.Start();
       
    77     }
       
    78 
       
    79 // <cmail>
       
    80 // ----------------------------------------------------------------------------
       
    81 // CIpsSetUtilsOperationWait::SimpleSetActive()
       
    82 // ----------------------------------------------------------------------------
       
    83 //
       
    84 void CIpsSetUtilsOperationWait::StartAndShowWaitDialogL()
       
    85     {
       
    86     FUNC_LOG;	
       
    87     SetActive();
       
    88     StartWaitDialogL(); 
       
    89     iWait.Start();
       
    90     }
       
    91 // </cmail>
       
    92 
       
    93 // ----------------------------------------------------------------------------
       
    94 // CIpsSetUtilsOperationWait::RunL()
       
    95 // ----------------------------------------------------------------------------
       
    96 //
       
    97 void CIpsSetUtilsOperationWait::RunL()
       
    98     {
       
    99     FUNC_LOG;
       
   100     if ( iWaitDialog )
       
   101     	{
       
   102     	StopWaitDialogL();
       
   103     	}
       
   104 
       
   105     if ( iWait.IsStarted() )
       
   106     	{
       
   107     	CAknEnv::StopSchedulerWaitWithBusyMessage( iWait );
       
   108     	}
       
   109     }
       
   110 
       
   111 // ----------------------------------------------------------------------------
       
   112 // CIpsSetUtilsOperationWait::DoCancel()
       
   113 // ----------------------------------------------------------------------------
       
   114 //
       
   115 void CIpsSetUtilsOperationWait::DoCancel()
       
   116     {
       
   117     FUNC_LOG;
       
   118     if( iStatus == KRequestPending )
       
   119         {
       
   120         TRequestStatus* s=&iStatus;
       
   121         User::RequestComplete( s, KErrCancel );
       
   122         }
       
   123     if ( iWaitDialog )
       
   124     	{
       
   125     	TRAP_IGNORE( StopWaitDialogL() );
       
   126     	}
       
   127 
       
   128     CAknEnv::StopSchedulerWaitWithBusyMessage( iWait );
       
   129     }
       
   130 
       
   131 // <cmail>
       
   132 // ----------------------------------------------------------------------------
       
   133 // CIpsSetUtilsOperationWait::DialogDismissedL()
       
   134 // ----------------------------------------------------------------------------
       
   135 //
       
   136 void CIpsSetUtilsOperationWait::DialogDismissedL(TInt /*aButtonId*/ )
       
   137 	{
       
   138 	FUNC_LOG;
       
   139 	iWaitDialog = NULL;
       
   140 	Cancel();
       
   141 	}
       
   142 
       
   143 // ----------------------------------------------------------------------------
       
   144 // CIpsSetUtilsOperationWait::StartWaitDialog()
       
   145 // ----------------------------------------------------------------------------
       
   146 //
       
   147 void CIpsSetUtilsOperationWait::StartWaitDialogL()
       
   148 	{
       
   149 	FUNC_LOG;
       
   150 	if( iWaitDialog )
       
   151 		{
       
   152 		delete iWaitDialog;
       
   153 		iWaitDialog = NULL;
       
   154 		}
       
   155 
       
   156 	iWaitDialog = new(ELeave)CAknWaitDialog(
       
   157 	                        (REINTERPRET_CAST(CEikDialog**,&iWaitDialog)));
       
   158 	iWaitDialog->SetCallback(this);
       
   159 	iWaitDialog->ExecuteLD( R_IPS_SETUI_WAIT_REFRESH_FOLDER_LIST_DIALOG );
       
   160 
       
   161 	}
       
   162 
       
   163 // ----------------------------------------------------------------------------
       
   164 // CIpsSetUtilsOperationWait::StopWaitDialog()
       
   165 // ----------------------------------------------------------------------------
       
   166 //
       
   167 void CIpsSetUtilsOperationWait::StopWaitDialogL()
       
   168 	{
       
   169 	FUNC_LOG;
       
   170 	if ( iWaitDialog )
       
   171 		{
       
   172 		iWaitDialog->ProcessFinishedL();
       
   173 		iWaitDialog = NULL;
       
   174 		}
       
   175 	}
       
   176 // </cmail>
       
   177 // End of file
       
   178