|
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: Implementation of CCmDestinationIconDialog |
|
15 * |
|
16 */ |
|
17 |
|
18 // INCLUDE FILES |
|
19 #include <uikon.hrh> |
|
20 #include <e32std.h> |
|
21 #include <eikcapc.h> |
|
22 |
|
23 #include <aknlayoutscalable_avkon.cdl.h> |
|
24 #include <layoutmetadata.cdl.h> |
|
25 |
|
26 #include <aknborders.h> |
|
27 #include <aknconsts.h> |
|
28 #include <AknUtils.h> |
|
29 #include <aknPopupHeadingPane.h> |
|
30 #include <AknSettingCache.h> |
|
31 |
|
32 #include <AknLayout.lag> |
|
33 #include <e32property.h> |
|
34 |
|
35 #include <cmmanager.rsg> |
|
36 |
|
37 #include "cmmanager.hrh" |
|
38 #include "cmdesticondialog.h" |
|
39 #include "cmdesticonmap.h" |
|
40 |
|
41 // ============================ MEMBER FUNCTIONS =============================== |
|
42 |
|
43 // ---------------------------------------------------------------------------- |
|
44 // CCmDestinationIconDialog class |
|
45 // CCmDestinationIconDialog() - constructor |
|
46 // ---------------------------------------------------------------------------- |
|
47 // |
|
48 CCmDestinationIconDialog::CCmDestinationIconDialog( TInt& aIconIndex ) |
|
49 : iIconIndex(&aIconIndex) |
|
50 { |
|
51 CEikDialog::SetBorder( AknBorderId::EAknBorderNotePopup ); |
|
52 } |
|
53 |
|
54 // ----------------------------------------------------------------------------- |
|
55 // CCmDestinationIconDialog::~CCmDestinationIconDialog() |
|
56 // ----------------------------------------------------------------------------- |
|
57 // |
|
58 CCmDestinationIconDialog::~CCmDestinationIconDialog() |
|
59 { |
|
60 } |
|
61 |
|
62 // ----------------------------------------------------------------------------- |
|
63 // CCmDestinationIconDialog::HandleResourceChange() |
|
64 // ----------------------------------------------------------------------------- |
|
65 // |
|
66 void CCmDestinationIconDialog::HandleResourceChange(TInt aType) |
|
67 { |
|
68 CAknDialog::HandleResourceChange(aType); |
|
69 |
|
70 if (aType==KEikDynamicLayoutVariantSwitch) |
|
71 { |
|
72 } |
|
73 } |
|
74 |
|
75 // ----------------------------------------------------------------------------- |
|
76 // CCmDestinationIconDialog::OkToExitL() |
|
77 // ----------------------------------------------------------------------------- |
|
78 // |
|
79 TBool CCmDestinationIconDialog::OkToExitL(TInt aButtonId) |
|
80 { |
|
81 CCmDestinationIconMap* iconmapControl = |
|
82 STATIC_CAST(CCmDestinationIconMap*, Control(ECmDestIconMapContentId)); |
|
83 // Selection key / select softkey adds a iconacter only if 5-key was not |
|
84 // used to select multiple icons before. |
|
85 if ( aButtonId == EAknSoftkeyOk || aButtonId == EAknSoftkeySelect ) |
|
86 { |
|
87 TKeyEvent key; |
|
88 key.iCode=EKeyOK; |
|
89 key.iModifiers=0; |
|
90 iconmapControl->OfferKeyEventL(key, EEventKey); |
|
91 } |
|
92 return(ETrue); |
|
93 } |
|
94 |
|
95 // ----------------------------------------------------------------------------- |
|
96 // CCmDestinationIconDialog::PreLayoutDynInitL() |
|
97 // ----------------------------------------------------------------------------- |
|
98 // |
|
99 void CCmDestinationIconDialog::PreLayoutDynInitL() |
|
100 { |
|
101 CCmDestinationIconMap* iconmapControl = |
|
102 STATIC_CAST( CCmDestinationIconMap*, Control( ECmDestIconMapContentId )); |
|
103 CAknPopupHeadingPane* headingPane = |
|
104 STATIC_CAST( CAknPopupHeadingPane*, Control( EAknSCTQueryHeadingId )); |
|
105 |
|
106 iconmapControl->SetIndex(*iIconIndex); |
|
107 |
|
108 SetLineNonFocusing(EAknSCTQueryHeadingId); |
|
109 |
|
110 // add title |
|
111 CEikonEnv* env = CEikonEnv::Static(); |
|
112 HBufC* title = env->AllocReadResourceL( R_CMMANAGERUI_PRMPT_SELECT_ICON ); |
|
113 CleanupStack::PushL( title ); |
|
114 headingPane->SetTextL( *title ); |
|
115 CleanupStack::PopAndDestroy( title ); |
|
116 title = NULL; |
|
117 |
|
118 #ifdef RD_SCALABLE_UI_V2 |
|
119 |
|
120 iconmapControl->SetObserver(this); |
|
121 |
|
122 #endif // RD_SCALABLE_UI_V2 |
|
123 } |
|
124 |
|
125 // ----------------------------------------------------------------------------- |
|
126 // CCmDestinationIconDialog::SetSizeAndPosition() |
|
127 // ----------------------------------------------------------------------------- |
|
128 // |
|
129 void CCmDestinationIconDialog::SetSizeAndPosition( const TSize& aSize ) |
|
130 { |
|
131 SetBorder( TGulBorder::ENone ); // No Dialog borders in SCT. |
|
132 CAknDialog::SetSizeAndPosition( aSize ); |
|
133 } |
|
134 |
|
135 // ----------------------------------------------------------------------------- |
|
136 // CCmDestinationIconDialog::OfferKeyEventL() |
|
137 // ----------------------------------------------------------------------------- |
|
138 // |
|
139 TKeyResponse CCmDestinationIconDialog::OfferKeyEventL( |
|
140 const TKeyEvent& aKeyEvent, TEventCode aModifiers ) |
|
141 { |
|
142 if ( aModifiers == EEventKey ) |
|
143 { |
|
144 TUint code=aKeyEvent.iCode; |
|
145 CCmDestinationIconMap* iconmapControl = |
|
146 STATIC_CAST( CCmDestinationIconMap*, |
|
147 Control( ECmDestIconMapContentId )); |
|
148 |
|
149 switch ( code ) |
|
150 { |
|
151 case EKeyLeftArrow: |
|
152 case EKeyRightArrow: |
|
153 case EKeyUpArrow: |
|
154 case EKeyDownArrow: |
|
155 { |
|
156 TKeyResponse res( |
|
157 iconmapControl->OfferKeyEventL( aKeyEvent, aModifiers )); |
|
158 return res; |
|
159 } |
|
160 |
|
161 case EKeyEnter: |
|
162 // change fro EKeyEnter to EKeyOK |
|
163 { |
|
164 TKeyEvent keyEvent; |
|
165 keyEvent.iCode = EKeyOK; |
|
166 keyEvent.iScanCode = aKeyEvent.iScanCode; |
|
167 keyEvent.iModifiers = aKeyEvent.iModifiers; |
|
168 keyEvent.iRepeats = aKeyEvent.iRepeats; |
|
169 return CEikDialog::OfferKeyEventL( keyEvent, aModifiers ); |
|
170 } |
|
171 |
|
172 default: |
|
173 break; |
|
174 } |
|
175 } |
|
176 |
|
177 return CEikDialog::OfferKeyEventL( aKeyEvent, aModifiers ); |
|
178 } |
|
179 |
|
180 // ----------------------------------------------------------------------------- |
|
181 // CCmDestinationIconDialog::ExecuteLD() |
|
182 // ----------------------------------------------------------------------------- |
|
183 // |
|
184 TInt CCmDestinationIconDialog::ExecuteLD() |
|
185 { |
|
186 // Prepare real icon map |
|
187 CEikDialog::PrepareLC( R_ICONSEL_DIALOG ); |
|
188 return(RunLD()); |
|
189 } |
|
190 |
|
191 // ----------------------------------------------------------------------------- |
|
192 // CCmDestinationIconDialog::CEikDialog_Reserved_1() |
|
193 // ----------------------------------------------------------------------------- |
|
194 // |
|
195 void CCmDestinationIconDialog::CEikDialog_Reserved_1() |
|
196 { |
|
197 } |
|
198 |
|
199 // ----------------------------------------------------------------------------- |
|
200 // CCmDestinationIconDialog::CEikDialog_Reserved_2() |
|
201 // ----------------------------------------------------------------------------- |
|
202 // |
|
203 void CCmDestinationIconDialog::CEikDialog_Reserved_2() |
|
204 { |
|
205 } |
|
206 |
|
207 // ----------------------------------------------------------------------------- |
|
208 // CCmDestinationIconDialog::CCmDestinationIconDialog_Reserved() |
|
209 // ----------------------------------------------------------------------------- |
|
210 // |
|
211 void CCmDestinationIconDialog::CAknIconMapDialog_Reserved() |
|
212 { |
|
213 } |
|
214 |
|
215 // ----------------------------------------------------------------------------- |
|
216 // CCmDestinationIconDialog::CreateCustomControlL() |
|
217 // Virtual function override from the base class to implement the custom control |
|
218 // ----------------------------------------------------------------------------- |
|
219 // |
|
220 SEikControlInfo CCmDestinationIconDialog::CreateCustomControlL( |
|
221 TInt aControlType) |
|
222 { |
|
223 CCmDestinationIconMap *control= NULL; |
|
224 if ( aControlType == KCmDestIconMapType ) |
|
225 { |
|
226 control = CCmDestinationIconMap::NewL(); |
|
227 } |
|
228 SEikControlInfo info; |
|
229 info.iControl = control; |
|
230 info.iFlags = 0; |
|
231 info.iTrailerTextId = 0; |
|
232 return info; |
|
233 } |
|
234 |
|
235 #ifdef RD_SCALABLE_UI_V2 |
|
236 |
|
237 // ----------------------------------------------------------------------------- |
|
238 // CCmDestinationIconDialog::HandleControlEventL |
|
239 // Handles the event. |
|
240 // ----------------------------------------------------------------------------- |
|
241 // |
|
242 void CCmDestinationIconDialog::HandleControlEventL( |
|
243 CCoeControl* /*aControl*/, |
|
244 TCoeEvent aEventType ) |
|
245 { |
|
246 if( aEventType == EEventStateChanged) |
|
247 { |
|
248 iConSelected = ETrue; |
|
249 } |
|
250 } |
|
251 |
|
252 // ----------------------------------------------------------------------------- |
|
253 // CCmDestinationIconDialog::HandleDialogPageEventL |
|
254 // Handles the event. |
|
255 // ----------------------------------------------------------------------------- |
|
256 // |
|
257 void CCmDestinationIconDialog::HandleDialogPageEventL(TInt aEventID) |
|
258 { |
|
259 if ( AknLayoutUtils::PenEnabled() && ( aEventID == |
|
260 MEikDialogPageObserver::EDialogPageTapped && iConSelected ) ) |
|
261 { |
|
262 TryExitL( EAknSoftkeyOk ); |
|
263 } |
|
264 } |
|
265 |
|
266 #endif //RD_SCALABLE_UI_V2 |
|
267 |
|
268 // End of File |