smartinstaller/common/globalwaitnote.cpp
branchADM
changeset 14 343c622c9f65
equal deleted inserted replaced
13:8ed1157e9487 14:343c622c9f65
       
     1 /*
       
     2 * Copyright (c) 2010 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 #include <aknglobalnote.h>
       
    19 #include <stringloader.h>
       
    20 #include <avkon.hrh>
       
    21 #include <avkon.rsg>
       
    22 
       
    23 #include "globalwaitnote.h"
       
    24 
       
    25 CGlobalWaitNote* CGlobalWaitNote::NewLC(MGlobalWaitNoteClient& aOwner, TBool aCancellable)
       
    26 	{
       
    27 	CGlobalWaitNote* self = new(ELeave) CGlobalWaitNote(aOwner, aCancellable);
       
    28 	CleanupStack::PushL(self);
       
    29 	self->ConstructL();
       
    30 	return self;
       
    31 	}
       
    32 
       
    33 CGlobalWaitNote* CGlobalWaitNote::NewL(MGlobalWaitNoteClient& aOwner, TBool aCancellable)
       
    34 	{
       
    35 	CGlobalWaitNote* self = NewLC(aOwner, aCancellable);
       
    36 	CleanupStack::Pop(self);
       
    37 	return self;
       
    38 	}
       
    39 
       
    40 CGlobalWaitNote::CGlobalWaitNote(MGlobalWaitNoteClient& aOwner, TBool aCancellable) :
       
    41 	CActive(EPriorityStandard),
       
    42 	iOwner(aOwner),
       
    43 	iCancellable(aCancellable)
       
    44 	{
       
    45 	}
       
    46 
       
    47 void CGlobalWaitNote::ConstructL()
       
    48 	{
       
    49 	iWaitNote = CAknGlobalNote::NewL();
       
    50 	CActiveScheduler::Add(this);
       
    51 	}
       
    52 
       
    53 CGlobalWaitNote::~CGlobalWaitNote()
       
    54 	{
       
    55 	Cancel();
       
    56 	delete iWaitNote;
       
    57 	iWaitNote = NULL;
       
    58 	}
       
    59 
       
    60 void CGlobalWaitNote::StartL(const TDesC& aText)
       
    61 	{
       
    62 	if ( !IsActive() )
       
    63 		{
       
    64 		if ( !iCancellable )
       
    65 			{
       
    66 			iWaitNote->SetSoftkeys( R_AVKON_SOFTKEYS_EMPTY );
       
    67 			}
       
    68 		iWaitNoteId = iWaitNote->ShowNoteL(
       
    69 			iStatus,
       
    70 			EAknGlobalWaitNote,
       
    71 			aText );
       
    72 		SetActive();
       
    73 		}
       
    74 	}
       
    75 
       
    76 void CGlobalWaitNote::StopL()
       
    77 	{
       
    78 	if ( iWaitNote && iWaitNoteId >= 0 )
       
    79 		{
       
    80 		iWaitNote->CancelNoteL( iWaitNoteId );
       
    81 		iWaitNoteId = -1;
       
    82 		}
       
    83 	}
       
    84 
       
    85 void CGlobalWaitNote::RunL()
       
    86 	{
       
    87 	if ( iCancellable && iStatus.Int() == EAknSoftkeyCancel )
       
    88 		{
       
    89 		iOwner.WaitNoteCancelled();
       
    90 		}
       
    91 	}
       
    92 
       
    93 void CGlobalWaitNote::DoCancel()
       
    94 	{
       
    95 	}