|
1 /* |
|
2 * Copyright (c) 2004 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: Wait note container. |
|
15 * |
|
16 */ |
|
17 |
|
18 // INCLUDE FILES |
|
19 #include <e32std.h> |
|
20 #include <aknwaitdialog.h> |
|
21 #include "MCnUiWaitNoteObserver.h" |
|
22 #include "CCnUiWaitNoteContainer.h" |
|
23 |
|
24 |
|
25 // CONSTANTS |
|
26 // ================= MEMBER FUNCTIONS ======================= |
|
27 // Two-phased constructor. |
|
28 CCnUiWaitNoteContainer* CCnUiWaitNoteContainer::NewL( TInt aNoteStructureResourceId, |
|
29 const TDesC& aLabelText, |
|
30 MCnUiWaitNoteObserver* aObserver ) |
|
31 { |
|
32 CCnUiWaitNoteContainer* self = new ( ELeave ) CCnUiWaitNoteContainer( aObserver ); |
|
33 CleanupStack::PushL( self ); |
|
34 self->ConstructL( aLabelText, aNoteStructureResourceId ); |
|
35 CleanupStack::Pop( self ); //self |
|
36 return self; |
|
37 } |
|
38 |
|
39 |
|
40 // Destructor |
|
41 CCnUiWaitNoteContainer::~CCnUiWaitNoteContainer() |
|
42 { |
|
43 //NULL observer before dismissing the wait note |
|
44 //==>protects the observer from getting the wait note |
|
45 //cancel events caused by the note deletion |
|
46 iObserver = NULL; |
|
47 |
|
48 if ( iWaitNote ) |
|
49 { |
|
50 //wait note showing, try to dismiss it |
|
51 TInt ignore; |
|
52 TRAP( ignore, iWaitNote->ProcessFinishedL() ); |
|
53 |
|
54 //if the ProcessFinishedL() leaves, |
|
55 //force the dialog away with delete |
|
56 delete iWaitNote; |
|
57 } |
|
58 } |
|
59 |
|
60 // C++ default constructor can NOT contain any code, that |
|
61 // might leave. |
|
62 // |
|
63 CCnUiWaitNoteContainer::CCnUiWaitNoteContainer( MCnUiWaitNoteObserver* aObserver ) |
|
64 : iObserver( aObserver ) |
|
65 { |
|
66 } |
|
67 |
|
68 // Symbian OS default constructor can leave. |
|
69 void CCnUiWaitNoteContainer::ConstructL( const TDesC& aLabelText, TInt aNoteStructureResourceId ) |
|
70 { |
|
71 iWaitNote = new ( ELeave ) CAknWaitDialog( reinterpret_cast< CEikDialog** > |
|
72 ( &iWaitNote ) ); |
|
73 |
|
74 // prepare LC:s push to CleanUpStack isn't a problem in case of leave, cos |
|
75 // CAknWaitDialog sets self pointer to NULL in its destructor |
|
76 iWaitNote->PrepareLC( aNoteStructureResourceId ); |
|
77 |
|
78 iWaitNote->SetTextL( aLabelText ); |
|
79 iWaitNote->SetCallback( this ); |
|
80 |
|
81 //pops the dialog |
|
82 iWaitNote->RunLD(); // CSI: 50 # This sets iWaitNote as NULL |
|
83 } |
|
84 |
|
85 |
|
86 // ----------------------------------------------------------------------------- |
|
87 // CCnUiWaitNoteContainer::PushLC() |
|
88 // ----------------------------------------------------------------------------- |
|
89 // |
|
90 void CCnUiWaitNoteContainer::PushLC() |
|
91 { |
|
92 CleanupStack::PushL( this ); |
|
93 } |
|
94 |
|
95 |
|
96 // ----------------------------------------------------------------------------- |
|
97 // CCnUiWaitNoteContainer::DialogDismissedL() |
|
98 // from MProgressDialogCallback |
|
99 // ----------------------------------------------------------------------------- |
|
100 // |
|
101 void CCnUiWaitNoteContainer::DialogDismissedL( TInt /*aButtonId*/ ) |
|
102 { |
|
103 if ( iObserver ) |
|
104 { |
|
105 iObserver->HandleWaitNoteCancel(); |
|
106 } |
|
107 } |
|
108 |
|
109 // End of File |