|
1 /* |
|
2 * Copyright (c) 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: |
|
15 * |
|
16 */ |
|
17 |
|
18 #include <mcsmenuoperation.h> |
|
19 #include "mcsmenuopwatcher.h" |
|
20 |
|
21 // --------------------------------------------------------------------------- |
|
22 // two-phased constructor |
|
23 // --------------------------------------------------------------------------- |
|
24 CMCSMenuOpWatcher* CMCSMenuOpWatcher::NewL( TBool aStopScheduler ) |
|
25 { |
|
26 CMCSMenuOpWatcher* self = new (ELeave) CMCSMenuOpWatcher(aStopScheduler); |
|
27 CleanupStack::PushL( self ); |
|
28 self->ConstructL(); |
|
29 CleanupStack::Pop( self ); |
|
30 return self; |
|
31 } |
|
32 |
|
33 // --------------------------------------------------------------------------- |
|
34 // default constructor |
|
35 // --------------------------------------------------------------------------- |
|
36 CMCSMenuOpWatcher::CMCSMenuOpWatcher( TBool aStopScheduler ) |
|
37 : CActive( CActive::EPriorityStandard ), |
|
38 iStopScheduler(aStopScheduler) |
|
39 { |
|
40 CActiveScheduler::Add( this ); |
|
41 } |
|
42 |
|
43 // --------------------------------------------------------------------------- |
|
44 // destructor |
|
45 // --------------------------------------------------------------------------- |
|
46 CMCSMenuOpWatcher::~CMCSMenuOpWatcher() |
|
47 { |
|
48 Cancel(); |
|
49 } |
|
50 |
|
51 // --------------------------------------------------------------------------- |
|
52 // second phase constructor |
|
53 // --------------------------------------------------------------------------- |
|
54 void CMCSMenuOpWatcher::ConstructL() |
|
55 { |
|
56 |
|
57 } |
|
58 |
|
59 // --------------------------------------------------------------------------- |
|
60 // Watch Async |
|
61 // --------------------------------------------------------------------------- |
|
62 void CMCSMenuOpWatcher::Watch( CMenuOperation& aOperation) |
|
63 { |
|
64 __ASSERT_DEBUG( KRequestPending == iStatus.Int(), User::Invariant() ); |
|
65 __ASSERT_DEBUG( !iOperation, User::Invariant() ); |
|
66 iOperation = &aOperation; |
|
67 SetActive(); |
|
68 } |
|
69 |
|
70 // --------------------------------------------------------------------------- |
|
71 // Inherited from CActive class |
|
72 // --------------------------------------------------------------------------- |
|
73 void CMCSMenuOpWatcher::RunL() |
|
74 { |
|
75 delete iOperation; |
|
76 iOperation = NULL; |
|
77 //TRAP_IGNORE( iObserver.MenuOpCompletedL(iStatus.Int() ) ); |
|
78 if (iStopScheduler) |
|
79 { |
|
80 CActiveScheduler::Stop(); |
|
81 } |
|
82 } |
|
83 |
|
84 // --------------------------------------------------------------------------- |
|
85 // Inherited from CActive class |
|
86 // --------------------------------------------------------------------------- |
|
87 void CMCSMenuOpWatcher::DoCancel() |
|
88 { |
|
89 //iOperation->Cancel(); |
|
90 delete iOperation; |
|
91 iOperation = NULL; |
|
92 } |
|
93 |
|
94 TInt CMCSMenuOpWatcher::GetStatus() |
|
95 { |
|
96 return iStatus.Int(); |
|
97 } |