phonebookui/Phonebook2/xSPExtensionManager/src/CGlobalNoteObserver.cpp
changeset 0 e686773b3f54
equal deleted inserted replaced
-1:000000000000 0:e686773b3f54
       
     1 /*
       
     2 * Copyright (c) 2002 - 2008 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:  Generic global note events observer.
       
    15 *
       
    16 */
       
    17 
       
    18 
       
    19 // INCLUDE FILES
       
    20 #include "CGlobalNoteObserver.h"
       
    21 #include "MGlobalNoteObserver.h"
       
    22 
       
    23 #include <basched.h>
       
    24 
       
    25 // ============================ MEMBER FUNCTIONS ===============================
       
    26 
       
    27 // -----------------------------------------------------------------------------
       
    28 // CGlobalNoteObserver::CGlobalNoteObserver
       
    29 // C++ constructor
       
    30 // -----------------------------------------------------------------------------
       
    31 //
       
    32 CGlobalNoteObserver::CGlobalNoteObserver( MGlobalNoteObserver* aObserver )
       
    33     : CActive( CActive::EPriorityStandard ),
       
    34     iObserver( aObserver )
       
    35     {
       
    36     }
       
    37 
       
    38 // -----------------------------------------------------------------------------
       
    39 // CGlobalNoteObserver::NewL
       
    40 // Two-phased constructor.
       
    41 // -----------------------------------------------------------------------------
       
    42 //
       
    43 CGlobalNoteObserver* CGlobalNoteObserver::NewL( MGlobalNoteObserver* aObserver )
       
    44     {
       
    45     CGlobalNoteObserver* self = new(ELeave) CGlobalNoteObserver( aObserver );
       
    46     CleanupStack::PushL( self );
       
    47     self->ConstructL();
       
    48     CleanupStack::Pop( self );
       
    49     return self;
       
    50     }
       
    51 
       
    52 // -----------------------------------------------------------------------------
       
    53 // CGlobalNoteObserver::ConstructL
       
    54 // Symbian 2nd phase constructor can leave.
       
    55 // -----------------------------------------------------------------------------
       
    56 //
       
    57 void CGlobalNoteObserver::ConstructL()
       
    58     {
       
    59     if( !iObserver )
       
    60         {
       
    61         User::Leave( KErrArgument );
       
    62         }
       
    63     CActiveScheduler::Add( this );
       
    64     SetActive();
       
    65     }
       
    66 
       
    67 // -----------------------------------------------------------------------------
       
    68 // CGlobalNoteObserver::~CGlobalNoteObserver
       
    69 // Destructor
       
    70 // -----------------------------------------------------------------------------
       
    71 //
       
    72 CGlobalNoteObserver::~CGlobalNoteObserver()
       
    73     {
       
    74     Cancel();
       
    75     }
       
    76 
       
    77 // -----------------------------------------------------------------------------
       
    78 // CGlobalNoteObserver::DoCancel
       
    79 // -----------------------------------------------------------------------------
       
    80 //
       
    81 void CGlobalNoteObserver::DoCancel()
       
    82     {
       
    83     // Currently there is no need to be able to cancel the note; we can just
       
    84     // wait that the user dismisses it.
       
    85     }
       
    86 
       
    87 // -----------------------------------------------------------------------------
       
    88 // CGlobalNoteObserver::RunL
       
    89 // -----------------------------------------------------------------------------
       
    90 //
       
    91 void CGlobalNoteObserver::RunL()
       
    92     {
       
    93     iObserver->GlobalNoteClosed( iStatus.Int() );
       
    94     }
       
    95 
       
    96 // -----------------------------------------------------------------------------
       
    97 // CGlobalNoteObserver::RunError
       
    98 // -----------------------------------------------------------------------------
       
    99 //
       
   100 TInt CGlobalNoteObserver::RunError( TInt aError )
       
   101     {
       
   102     // Pass on leave code from application exit
       
   103     if( aError != KLeaveExit )
       
   104         {
       
   105         return KLeaveExit;
       
   106         }
       
   107 
       
   108     iObserver->GlobalNoteError( aError );
       
   109 
       
   110     // Error handled, return KErrNone
       
   111     return KErrNone;
       
   112     }
       
   113 
       
   114 //  End of File