securitydialogs/SecUi/Src/SecUiWait.cpp
changeset 0 164170e6151a
child 26 aad866c37519
equal deleted inserted replaced
-1:000000000000 0:164170e6151a
       
     1 /*
       
     2 * Copyright (c) 2002 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: 
       
    15 *    
       
    16 *
       
    17 */
       
    18 
       
    19 
       
    20 
       
    21 #include    <e32base.h>
       
    22 #include    <eikenv.h>
       
    23 #include    <eikappui.h>
       
    24 #include    "SecUiWait.h"
       
    25 
       
    26 
       
    27 
       
    28 // ================= MEMBER FUNCTIONS =======================
       
    29 //
       
    30 // ----------------------------------------------------------
       
    31 // CWait::NewL()    
       
    32 // 
       
    33 // ----------------------------------------------------------
       
    34 // 
       
    35 CWait* CWait::NewL()
       
    36     {
       
    37     CWait* self = new(ELeave) CWait();
       
    38     CleanupStack::PushL(self);
       
    39     self->ConstructL();
       
    40     CleanupStack::Pop();
       
    41     return self;
       
    42     }
       
    43 //
       
    44 // ----------------------------------------------------------
       
    45 // CWait::ConstructL()    
       
    46 // 
       
    47 // ----------------------------------------------------------
       
    48 // 
       
    49 void CWait::ConstructL()    
       
    50     {    
       
    51     CActiveScheduler::Add(this);            
       
    52     }    
       
    53 //
       
    54 // ----------------------------------------------------------
       
    55 // CWait::CWait()
       
    56 // 
       
    57 // ----------------------------------------------------------
       
    58 //
       
    59 CWait::CWait() : CActive(0)
       
    60     { 
       
    61     }
       
    62 //
       
    63 // ----------------------------------------------------------
       
    64 // CWait::~CWait()
       
    65 // Destructor
       
    66 // ----------------------------------------------------------
       
    67 //
       
    68 CWait::~CWait()
       
    69     {
       
    70 		Cancel();
       
    71     }
       
    72 //
       
    73 // ----------------------------------------------------------
       
    74 // CWait::WaitForRequestL()
       
    75 // 
       
    76 // ----------------------------------------------------------
       
    77 //
       
    78 TInt CWait::WaitForRequestL()
       
    79     {    
       
    80     CWaitAbsorbingControl* absorbing = CWaitAbsorbingControl::NewLC();
       
    81     SetActive();
       
    82     iWait.Start();
       
    83     CleanupStack::PopAndDestroy(absorbing);
       
    84     return iStatus.Int();
       
    85     }
       
    86 //
       
    87 // ----------------------------------------------------------
       
    88 // CWait::RunL()
       
    89 // 
       
    90 // ----------------------------------------------------------
       
    91 // 
       
    92 void CWait::RunL()
       
    93     {        
       
    94     if(iWait.IsStarted())        
       
    95         iWait.AsyncStop();
       
    96     }
       
    97 //
       
    98 // ----------------------------------------------------------
       
    99 // CWait::DoCancel()
       
   100 // Cancels code request
       
   101 // ----------------------------------------------------------
       
   102 //
       
   103 void CWait::DoCancel()
       
   104     {
       
   105     if(iWait.IsStarted())
       
   106         iWait.AsyncStop();
       
   107     }
       
   108 
       
   109 //
       
   110 // ----------------------------------------------------------
       
   111 // CWait::SetRequestType
       
   112 // Sets active request type
       
   113 // ----------------------------------------------------------
       
   114 //
       
   115 void CWait::SetRequestType(TInt aRequestType)
       
   116 {
       
   117     iRequestType = aRequestType;
       
   118 }
       
   119 
       
   120 //
       
   121 // ----------------------------------------------------------
       
   122 // CWait::GetRequestType
       
   123 // Gets active request type
       
   124 // ----------------------------------------------------------
       
   125 //
       
   126 TInt CWait::GetRequestType()
       
   127 {
       
   128     return iRequestType;
       
   129 }
       
   130 //
       
   131 // class CWaitAbsorbingControl
       
   132 //
       
   133 CWaitAbsorbingControl::CWaitAbsorbingControl()
       
   134     {
       
   135     }
       
   136 
       
   137 CWaitAbsorbingControl::~CWaitAbsorbingControl()
       
   138     {
       
   139     if (iCoeEnv && iAppUi)
       
   140         iAppUi->RemoveFromStack(this);
       
   141     }
       
   142 
       
   143 CWaitAbsorbingControl* CWaitAbsorbingControl::NewLC()
       
   144     {
       
   145     CWaitAbsorbingControl* self= new(ELeave) CWaitAbsorbingControl();
       
   146     CleanupStack::PushL(self);
       
   147     self->ConstructL();
       
   148     return self;
       
   149     }
       
   150 
       
   151 void CWaitAbsorbingControl::ConstructL()
       
   152     {
       
   153     CreateWindowL();
       
   154     SetExtent(TPoint(0,0), TSize(0,0));
       
   155     ActivateL();
       
   156     SetPointerCapture(ETrue);
       
   157     ClaimPointerGrab(ETrue);
       
   158     iAppUi=iEikonEnv->EikAppUi();
       
   159     iAppUi->AddToStackL(this, ECoeStackPriorityEnvironmentFilter);
       
   160     }
       
   161 
       
   162 TKeyResponse CWaitAbsorbingControl::OfferKeyEventL(const TKeyEvent& /*aKeyEvent*/,TEventCode /*aType*/)
       
   163     {
       
   164     return EKeyWasConsumed;
       
   165     }
       
   166 
       
   167 // End of file