coreapplicationuis/SysAp/Src/SysApWaitNote.cpp
changeset 0 2e3d3ce01487
child 33 332e7bf3b42f
equal deleted inserted replaced
-1:000000000000 0:2e3d3ce01487
       
     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:  CSysApWaitNote implementation.
       
    15 *
       
    16 */
       
    17 
       
    18 
       
    19 // INCLUDES
       
    20 
       
    21 #include <avkon.hrh>
       
    22 #include <avkon.rsg>
       
    23 #include "SysAp.hrh"
       
    24 #include "SysApWaitNote.h"
       
    25 #include <SecondaryDisplay/SecondaryDisplaySysApAPI.h>
       
    26 #include <aknSDData.h>
       
    27 
       
    28 
       
    29 // ============================ MEMBER FUNCTIONS ==============================
       
    30 
       
    31 // ----------------------------------------------------------------------------
       
    32 // CSysApWaitNote::NewL() 
       
    33 // ----------------------------------------------------------------------------
       
    34 CSysApWaitNote* CSysApWaitNote::NewL(TBool aCoverDisplaySupported)
       
    35     {
       
    36     CSysApWaitNote* self = new(ELeave) CSysApWaitNote(aCoverDisplaySupported);
       
    37     CleanupStack::PushL(self);
       
    38     self->ConstructL();
       
    39     CleanupStack::Pop();
       
    40     return self;
       
    41     }
       
    42 
       
    43 // ----------------------------------------------------------------------------
       
    44 // CSysApWaitNote::ConstructL() 
       
    45 // ----------------------------------------------------------------------------
       
    46 void CSysApWaitNote::ConstructL()
       
    47     {
       
    48     iWaitNote = CAknGlobalNote::NewL();           
       
    49     iWaitNote->SetSoftkeys( R_AVKON_SOFTKEYS_EMPTY );
       
    50     }
       
    51 
       
    52 // ----------------------------------------------------------------------------
       
    53 // CSysApWaitNote::CSysApWaitNote()
       
    54 // ----------------------------------------------------------------------------
       
    55 
       
    56 CSysApWaitNote::CSysApWaitNote(TBool aCoverDisplaySupported) : iActive( EFalse ),
       
    57     iCoverDisplaySupported(aCoverDisplaySupported)
       
    58     {
       
    59     }
       
    60 
       
    61 // ----------------------------------------------------------------------------
       
    62 // CSysApWaitNote::~CSysApWaitNote() 
       
    63 // ----------------------------------------------------------------------------
       
    64 
       
    65 CSysApWaitNote::~CSysApWaitNote() 
       
    66     {
       
    67     Cancel();
       
    68     delete iWaitNote;
       
    69     iWaitNote = NULL;
       
    70     }
       
    71 
       
    72 
       
    73 // ----------------------------------------------------------------------------
       
    74 // CSysApWaitNote::Cancel() 
       
    75 // ----------------------------------------------------------------------------
       
    76 
       
    77 void CSysApWaitNote::Cancel() 
       
    78     {
       
    79     TRACES( RDebug::Print( _L("CSysApWaitNote::Cancel()" ) ) );
       
    80     TRAPD ( err, iWaitNote->CancelNoteL( iNoteId ) );
       
    81     iActive = EFalse;
       
    82     if ( err )
       
    83         {
       
    84         TRACES( RDebug::Print( _L("CSysApWaitNote::Cancel(), error: %d" ), err ) );
       
    85         }
       
    86     }
       
    87 
       
    88 // ----------------------------------------------------------------------------
       
    89 // CSysApWaitNote::ShowNoteL()
       
    90 // ----------------------------------------------------------------------------
       
    91 
       
    92 void CSysApWaitNote::ShowNoteL( const TSysApWaitNoteIds aNote, HBufC* aNoteStringBuf )
       
    93     {
       
    94     TRACES( RDebug::Print( _L("CSysApWaitNote::ShowNoteL") ) );
       
    95 
       
    96     if ( iActive )
       
    97         {
       
    98         Cancel();
       
    99         }
       
   100     iActive = ETrue;
       
   101     TInt tone ( EAvkonSIDNoSound );
       
   102     iWaitNote->SetTone( tone );
       
   103     TRACES( RDebug::Print( _L("CSysApWaitNote::StartL: ShowNoteL()" ) ) );
       
   104     
       
   105     if ( aNote == EClosingApplicationsNote )
       
   106         {
       
   107         // Set secondary display data if necessary
       
   108         if ( iCoverDisplaySupported )
       
   109             {
       
   110             CAknSDData* sd = CAknSDData::NewL(SecondaryDisplay::KCatSysAp, SecondaryDisplay::ECmdShowClosingApplicationsNote, KNullDesC8);
       
   111             iWaitNote->SetSecondaryDisplayData(sd); // ownership to notifier client
       
   112             }
       
   113         
       
   114         }
       
   115     
       
   116     iNoteId = iWaitNote->ShowNoteL( EAknGlobalWaitNote, aNoteStringBuf->Des() );
       
   117     }
       
   118 
       
   119 // End of File
       
   120 
       
   121 
       
   122