messagingappbase/msgerrorwatcher/src/MsgErrorGlobalQuery.cpp
changeset 0 72b543305e3a
equal deleted inserted replaced
-1:000000000000 0:72b543305e3a
       
     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 *    CMsgErrorGlobalQuery implementation file
       
    16 *
       
    17 */
       
    18 
       
    19 
       
    20 
       
    21 #include <e32base.h>
       
    22 #include <avkon.hrh>
       
    23 #include <AknGlobalConfirmationQuery.h>
       
    24 
       
    25 #include "MsgErrorWatcher.h"
       
    26 #include "MsgErrorGlobalQuery.h"
       
    27 
       
    28 // LOCAL CONSTANTS AND MACROS
       
    29 
       
    30 // ---------------------------------------------------------
       
    31 // CMsgErrorGlobalQuery::NewL
       
    32 //
       
    33 // Two-phased constructor.
       
    34 // ---------------------------------------------------------
       
    35 //
       
    36 CMsgErrorGlobalQuery* CMsgErrorGlobalQuery::NewL( CMsgErrorWatcher* aWatcher )
       
    37     {
       
    38     CMsgErrorGlobalQuery* self = new ( ELeave ) CMsgErrorGlobalQuery( aWatcher );
       
    39     CleanupStack::PushL( self );
       
    40     self->ConstructL();
       
    41     CleanupStack::Pop( self );
       
    42     return self;
       
    43     }
       
    44 
       
    45 // ---------------------------------------------------------
       
    46 // CMsgErrorGlobalQuery::ConstructL
       
    47 //
       
    48 // Symbian OS default constructor can leave.
       
    49 // ---------------------------------------------------------
       
    50 //
       
    51 void CMsgErrorGlobalQuery::ConstructL()
       
    52     {
       
    53     iGlobalQuery = CAknGlobalConfirmationQuery::NewL();
       
    54     CActiveScheduler::Add( this );
       
    55     }
       
    56 
       
    57 // ---------------------------------------------------------
       
    58 // CMsgErrorGlobalQuery::CMsgErrorGlobalQuery
       
    59 //
       
    60 // C++ constructor can NOT contain any code, that
       
    61 // might leave.
       
    62 // ---------------------------------------------------------
       
    63 //
       
    64 CMsgErrorGlobalQuery::CMsgErrorGlobalQuery( CMsgErrorWatcher* aWatcher ) 
       
    65     : CActive( CActive::EPriorityStandard ),
       
    66     iWatcher( aWatcher )
       
    67     {
       
    68     }
       
    69 
       
    70 // ---------------------------------------------------------
       
    71 // CMsgErrorGlobalQuery::~CMsgErrorGlobalQuery
       
    72 //
       
    73 // Destructor
       
    74 // ---------------------------------------------------------
       
    75 //
       
    76 CMsgErrorGlobalQuery::~CMsgErrorGlobalQuery()
       
    77     {
       
    78     Cancel();
       
    79     delete iPrompt;
       
    80     }
       
    81 
       
    82 // ---------------------------------------------------------
       
    83 // CMsgErrorGlobalQuery::RunL
       
    84 //
       
    85 // From active object framework
       
    86 // ---------------------------------------------------------
       
    87 //
       
    88 void CMsgErrorGlobalQuery::RunL() 
       
    89     {
       
    90     TRAP_IGNORE( iWatcher->HandleGlobalQueryEventL( iQueryId, iStatus.Int() ) );
       
    91     }
       
    92 
       
    93 // ---------------------------------------------------------
       
    94 // CMsgErrorGlobalQuery::DoCancel
       
    95 //
       
    96 // From active object framework
       
    97 // ---------------------------------------------------------
       
    98 //
       
    99 void CMsgErrorGlobalQuery::DoCancel()
       
   100     {
       
   101     if ( iGlobalQuery )
       
   102         {
       
   103         iGlobalQuery->CancelConfirmationQuery();
       
   104         }
       
   105     }
       
   106 
       
   107 // ---------------------------------------------------------
       
   108 // CMsgErrorGlobalQuery::Start
       
   109 //
       
   110 // Starts the active object
       
   111 // ---------------------------------------------------------
       
   112 //
       
   113 void CMsgErrorGlobalQuery::ShowQueryL( const TDesC& aPrompt,
       
   114                                       TInt aSoftkeys,
       
   115                                       TInt aQueryId )
       
   116     {
       
   117     if ( IsActive() )
       
   118         {
       
   119         Cancel();
       
   120         }
       
   121     delete iPrompt;
       
   122     iPrompt = NULL;
       
   123     iPrompt = aPrompt.AllocL();
       
   124     iQueryId = aQueryId;
       
   125 
       
   126     SetActive();
       
   127     iGlobalQuery->ShowConfirmationQueryL(
       
   128         iStatus,
       
   129         *iPrompt,
       
   130         aSoftkeys,
       
   131         R_QGN_NOTE_ERROR_ANIM );
       
   132     }
       
   133 
       
   134 
       
   135 // End of File