1 /* |
|
2 * Copyright (c) 2002-2007 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: Wrapper to AVKON global note functionality. |
|
15 * |
|
16 */ |
|
17 |
|
18 |
|
19 // INCLUDE FILES |
|
20 #include "GlobalNoteImpl.h" |
|
21 #include <avkon.rsg> |
|
22 |
|
23 // ============================ MEMBER FUNCTIONS ============================= |
|
24 |
|
25 // --------------------------------------------------------------------------- |
|
26 // CGlobalNoteImpl::CGlobalNoteImpl |
|
27 // C++ default constructor can NOT contain any code, that |
|
28 // might leave. |
|
29 // --------------------------------------------------------------------------- |
|
30 // |
|
31 CGlobalNoteImpl::CGlobalNoteImpl() |
|
32 { |
|
33 } |
|
34 |
|
35 |
|
36 // --------------------------------------------------------------------------- |
|
37 // CGlobalNoteImpl::ConstructL |
|
38 // Symbian 2nd phase constructor can leave. |
|
39 // --------------------------------------------------------------------------- |
|
40 // |
|
41 void CGlobalNoteImpl::ConstructL() |
|
42 { |
|
43 iAknGlobalNote = CAknGlobalNote::NewL(); |
|
44 } |
|
45 |
|
46 |
|
47 // --------------------------------------------------------------------------- |
|
48 // CGlobalNoteImpl::NewL |
|
49 // Two-phased constructor. |
|
50 // --------------------------------------------------------------------------- |
|
51 // |
|
52 CGlobalNoteImpl* CGlobalNoteImpl::NewL() |
|
53 { |
|
54 CGlobalNoteImpl* self = new( ELeave ) CGlobalNoteImpl; |
|
55 |
|
56 CleanupStack::PushL( self ); |
|
57 self->ConstructL(); |
|
58 CleanupStack::Pop( self ); |
|
59 |
|
60 return self; |
|
61 } |
|
62 |
|
63 |
|
64 // --------------------------------------------------------------------------- |
|
65 // CGlobalNoteImpl::~CGlobalNoteImpl |
|
66 // Destructor |
|
67 // --------------------------------------------------------------------------- |
|
68 // |
|
69 CGlobalNoteImpl::~CGlobalNoteImpl() |
|
70 { |
|
71 delete iAknGlobalNote; |
|
72 } |
|
73 |
|
74 |
|
75 // --------------------------------------------------------------------------- |
|
76 // CGlobalNoteImpl::SetSoftkeys() |
|
77 // (other items were commented in a header). |
|
78 // --------------------------------------------------------------------------- |
|
79 // |
|
80 void CGlobalNoteImpl::SetSoftkeys( TInt aId ) |
|
81 { |
|
82 TInt id; |
|
83 SoftKeysInAvkon( aId, id ); |
|
84 iAknGlobalNote->SetSoftkeys( id ); |
|
85 } |
|
86 |
|
87 |
|
88 // --------------------------------------------------------------------------- |
|
89 // CGlobalNoteImpl::ShowNoteL() |
|
90 // (other items were commented in a header). |
|
91 // --------------------------------------------------------------------------- |
|
92 // |
|
93 TInt CGlobalNoteImpl::ShowNoteL( TGlobalNoteType aType, |
|
94 const TDesC& aNoteText ) |
|
95 { |
|
96 TAknGlobalNoteType type; |
|
97 User::LeaveIfError( NoteTypeInAvkon( aType, type ) ); |
|
98 |
|
99 return iAknGlobalNote->ShowNoteL( type, aNoteText ); |
|
100 } |
|
101 |
|
102 |
|
103 // --------------------------------------------------------------------------- |
|
104 // CGlobalNoteImpl::ShowNoteL() |
|
105 // (other items were commented in a header). |
|
106 // --------------------------------------------------------------------------- |
|
107 // |
|
108 TInt CGlobalNoteImpl::ShowNoteL( TRequestStatus& aStatus, |
|
109 TGlobalNoteType aType, |
|
110 const TDesC& aNoteText ) |
|
111 { |
|
112 TAknGlobalNoteType type; |
|
113 User::LeaveIfError( NoteTypeInAvkon( aType, type ) ); |
|
114 |
|
115 // This way we can indicate to avkon global note that adapter is in use. |
|
116 iAknGlobalNote->SetPriority( 0xFFFF + 1 ); |
|
117 |
|
118 return iAknGlobalNote->ShowNoteL( aStatus, type, aNoteText ); |
|
119 } |
|
120 |
|
121 |
|
122 // --------------------------------------------------------------------------- |
|
123 // CGlobalNoteImpl::NoteTypeInAvkon() |
|
124 // (other items were commented in a header). |
|
125 // --------------------------------------------------------------------------- |
|
126 // |
|
127 TInt CGlobalNoteImpl::NoteTypeInAvkon( const TGlobalNoteType& aType, |
|
128 TAknGlobalNoteType& aAknType ) const |
|
129 { |
|
130 switch ( aType ) |
|
131 { |
|
132 case EGlobalInformationNote: |
|
133 aAknType = EAknGlobalInformationNote; |
|
134 break; |
|
135 case EGlobalWarningNote: |
|
136 aAknType = EAknGlobalWarningNote; |
|
137 break; |
|
138 case EGlobalConfirmationNote: |
|
139 aAknType = EAknGlobalConfirmationNote; |
|
140 break; |
|
141 case EGlobalErrorNote: |
|
142 aAknType = EAknGlobalErrorNote; |
|
143 break; |
|
144 case EGlobalWaitNote: |
|
145 aAknType = EAknGlobalWaitNote; |
|
146 break; |
|
147 default: |
|
148 return KErrNotFound; |
|
149 } |
|
150 |
|
151 return KErrNone; |
|
152 } |
|
153 |
|
154 |
|
155 // --------------------------------------------------------------------------- |
|
156 // CGlobalNoteImpl::SoftKeysInAvkon() |
|
157 // (other items were commented in a header). |
|
158 // --------------------------------------------------------------------------- |
|
159 // |
|
160 void CGlobalNoteImpl::SoftKeysInAvkon( const TInt& aId, TInt& aAknId ) const |
|
161 { |
|
162 switch ( aId ) |
|
163 { |
|
164 case EGlobalNoteSoftkeyOk: |
|
165 aAknId = R_AVKON_SOFTKEYS_OK_EMPTY; |
|
166 break; |
|
167 case EGlobalNoteSoftkeyExit: |
|
168 aAknId = R_AVKON_SOFTKEYS_EXIT; |
|
169 break; |
|
170 case EGlobalNoteSoftkeyCancel: |
|
171 aAknId = R_AVKON_SOFTKEYS_CANCEL; |
|
172 break; |
|
173 case EGlobalNoteSoftkeyBack: |
|
174 aAknId = R_AVKON_SOFTKEYS_BACK; |
|
175 break; |
|
176 case EGlobalNoteSoftKeyClose: |
|
177 aAknId = R_AVKON_SOFTKEYS_CLOSE; |
|
178 break; |
|
179 case EGlobalNoteSoftKeyQuit: |
|
180 aAknId = R_AVKON_SOFTKEYS_QUIT; |
|
181 break; |
|
182 case EGlobalNoteSoftkeyOkCancel: |
|
183 aAknId = R_AVKON_SOFTKEYS_OK_CANCEL; |
|
184 break; |
|
185 case EGlobalNoteSoftkeyYesNo: |
|
186 aAknId = R_AVKON_SOFTKEYS_YES_NO; |
|
187 break; |
|
188 case EGlobalNoteSoftkeyAnswerExit: |
|
189 aAknId = R_AVKON_SOFTKEYS_ANSWER_EXIT; |
|
190 break; |
|
191 default: |
|
192 aAknId = R_AVKON_SOFTKEYS_EMPTY; |
|
193 break; |
|
194 } |
|
195 } |
|
196 |
|
197 |
|
198 // --------------------------------------------------------------------------- |
|
199 // CGlobalNoteImpl::CancelGlobalNoteL() |
|
200 // (other items were commented in a header). |
|
201 // --------------------------------------------------------------------------- |
|
202 // |
|
203 void CGlobalNoteImpl::CancelGlobalNoteL( TInt aNoteId ) |
|
204 { |
|
205 iAknGlobalNote->CancelNoteL( aNoteId ); |
|
206 } |
|
207 |
|
208 // End of File |
|