|
1 /* |
|
2 * Copyright (c) 2006 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: Shows global confirmation query and |
|
15 * follows user answering |
|
16 * |
|
17 */ |
|
18 |
|
19 |
|
20 |
|
21 // INCLUDE FILES |
|
22 #include "CCAGlobalNoteHandler.h" |
|
23 #include "impsbuilddefinitions.h" |
|
24 |
|
25 // The Settings have been moved to Cenrep (also retained in the Resource file), |
|
26 // so the enums for keys and central repository header is added here |
|
27 #include "VariantKeys.h" |
|
28 #include <AknGlobalConfirmationQuery.h> |
|
29 #include <chatNG.rsg> |
|
30 #include <StringLoader.h> |
|
31 |
|
32 |
|
33 // ============================ MEMBER FUNCTIONS =============================== |
|
34 |
|
35 // ----------------------------------------------------------------------------- |
|
36 // CCAGlobalNoteHandler::CCAGlobalNoteHandler |
|
37 // C++ default constructor can NOT contain any code, that |
|
38 // might leave. |
|
39 // ----------------------------------------------------------------------------- |
|
40 // |
|
41 CCAGlobalNoteHandler::CCAGlobalNoteHandler() : CActive( EPriorityStandard ) |
|
42 { |
|
43 CActiveScheduler::Add( this ); |
|
44 } |
|
45 |
|
46 // ----------------------------------------------------------------------------- |
|
47 // CCAGlobalNoteHandler::ConstructL |
|
48 // Symbian 2nd phase constructor can leave. |
|
49 // ----------------------------------------------------------------------------- |
|
50 // |
|
51 void CCAGlobalNoteHandler::ConstructL() |
|
52 { |
|
53 iGlobalConfirmationQuery = CAknGlobalConfirmationQuery::NewL(); |
|
54 } |
|
55 |
|
56 // ----------------------------------------------------------------------------- |
|
57 // CCAGlobalNoteHandler::NewL |
|
58 // Two-phased constructor. |
|
59 // ----------------------------------------------------------------------------- |
|
60 // |
|
61 CCAGlobalNoteHandler* CCAGlobalNoteHandler::NewL() |
|
62 { |
|
63 CCAGlobalNoteHandler* self = new( ELeave ) CCAGlobalNoteHandler; |
|
64 |
|
65 CleanupStack::PushL( self ); |
|
66 self->ConstructL(); |
|
67 CleanupStack::Pop(); |
|
68 |
|
69 return self; |
|
70 } |
|
71 |
|
72 // Destructor |
|
73 CCAGlobalNoteHandler::~CCAGlobalNoteHandler() |
|
74 { |
|
75 Cancel(); |
|
76 delete iGlobalConfirmationQuery; |
|
77 } |
|
78 |
|
79 // --------------------------------------------------------- |
|
80 // CCAGlobalNoteHandler::DoCancel |
|
81 // |
|
82 // --------------------------------------------------------- |
|
83 // |
|
84 void CCAGlobalNoteHandler::DoCancel() |
|
85 { |
|
86 iGlobalConfirmationQuery->CancelConfirmationQuery(); |
|
87 } |
|
88 |
|
89 // --------------------------------------------------------- |
|
90 // CCAGlobalNoteHandler::RunL |
|
91 // |
|
92 // --------------------------------------------------------- |
|
93 // |
|
94 void CCAGlobalNoteHandler::RunL() |
|
95 { |
|
96 iAnswer = iStatus.Int(); |
|
97 Cancel(); |
|
98 if ( iWait.IsStarted() ) |
|
99 { |
|
100 iWait.AsyncStop(); |
|
101 } |
|
102 } |
|
103 |
|
104 // --------------------------------------------------------- |
|
105 // CCAGlobalNoteHandler::ShowNoteL |
|
106 // |
|
107 // --------------------------------------------------------- |
|
108 // |
|
109 TInt CCAGlobalNoteHandler::ShowNoteL( TInt aResourceId ) |
|
110 { |
|
111 iAnswer = 0; |
|
112 if ( !IsActive() ) |
|
113 { |
|
114 HBufC* prompt = CEikonEnv::Static()->AllocReadResourceLC( aResourceId ); |
|
115 iGlobalConfirmationQuery->ShowConfirmationQueryL( |
|
116 iStatus, *prompt, R_AVKON_SOFTKEYS_YES_NO__YES ); |
|
117 CleanupStack::PopAndDestroy( prompt ); // prompt |
|
118 SetActive(); |
|
119 if ( ! iWait.IsStarted() ) |
|
120 { |
|
121 iWait.Start(); // CSI: 10 # iWait is not an active object |
|
122 } |
|
123 } |
|
124 |
|
125 return iAnswer; |
|
126 } |
|
127 |
|
128 // --------------------------------------------------------- |
|
129 // CCAGlobalNoteHandler::CancelNoteShowing |
|
130 // |
|
131 // --------------------------------------------------------- |
|
132 // |
|
133 void CCAGlobalNoteHandler::CancelNoteShowing() |
|
134 { |
|
135 if ( IsActive() ) |
|
136 { |
|
137 Cancel(); |
|
138 } |
|
139 iAnswer = KErrCancel; |
|
140 if ( iWait.IsStarted() ) |
|
141 { |
|
142 iWait.AsyncStop(); |
|
143 } |
|
144 } |
|
145 |
|
146 // --------------------------------------------------------- |
|
147 // CCAGlobalNoteHandler::RunError |
|
148 // |
|
149 // --------------------------------------------------------- |
|
150 // |
|
151 TInt CCAGlobalNoteHandler::RunError( TInt aError ) |
|
152 { |
|
153 if ( IsActive() ) |
|
154 { |
|
155 Cancel(); |
|
156 } |
|
157 |
|
158 iAnswer = aError; |
|
159 if ( iWait.IsStarted() ) |
|
160 { |
|
161 iWait.AsyncStop(); |
|
162 } |
|
163 return KErrNone; |
|
164 } |
|
165 |
|
166 // End of File |
|
167 |