|
1 /* |
|
2 * Copyright (c) 2005 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 the License "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: Encapsulates a edit feed dialog. |
|
15 * |
|
16 */ |
|
17 |
|
18 |
|
19 #include <AknPopupFieldText.h> |
|
20 #include <aknslider.h> |
|
21 #include <avkon.hrh> |
|
22 #include <avkon.rsg> |
|
23 #include <eikedwin.h> |
|
24 #include <eikmenup.h> |
|
25 #include <charconv.h> |
|
26 #include <aknviewappui.h> |
|
27 #include <StringLoader.h> |
|
28 |
|
29 #ifdef __SERIES60_HELP |
|
30 // Context-Sensitve Help File |
|
31 #include <hlplch.h> |
|
32 #include <csxhelp/browser.hlp.hrh> |
|
33 #include "BrowserApplication.h" |
|
34 #endif // __SERIES60_HELP |
|
35 |
|
36 #include "BrowserAppUi.h" |
|
37 #include "BrowserAppViewBase.h" |
|
38 #include "Browser.hrh" |
|
39 #include <BrowserNG.rsg> |
|
40 #include <AknRadioButtonSettingPage.h> |
|
41 |
|
42 #include "FeedsEditFeedDialog.h" |
|
43 |
|
44 //Constants |
|
45 const TInt KAutoUpdatingOff = 0; |
|
46 const TInt KFifteen = 15; |
|
47 const TInt KOneHour = 60; |
|
48 const TInt KFourHour = 240; |
|
49 const TInt KDay = 1440; |
|
50 const TInt KWeek = 10080; |
|
51 |
|
52 // ----------------------------------------------------------------------------- |
|
53 // CFeedsEditFeedDialog::NewL |
|
54 // |
|
55 // Two-phased constructor. |
|
56 // ----------------------------------------------------------------------------- |
|
57 // |
|
58 CFeedsEditFeedDialog* CFeedsEditFeedDialog::NewL(MFeedsEditFeedDialogObserver& aObserver, |
|
59 CAknViewAppUi* aAppUi, |
|
60 const TDesC& aName, const TDesC& aUrl, TInt aFreq) |
|
61 { |
|
62 CFeedsEditFeedDialog* self = new (ELeave) CFeedsEditFeedDialog(aObserver, aAppUi, aName, aUrl, aFreq); |
|
63 CleanupStack::PushL(self); |
|
64 self->ConstructL(); |
|
65 self->iSelectedDlgLine = 0; |
|
66 CleanupStack::Pop(self); |
|
67 |
|
68 return self; |
|
69 } |
|
70 |
|
71 |
|
72 // ----------------------------------------------------------------------------- |
|
73 // CFeedsEditFeedDialog::NewL |
|
74 // |
|
75 // Two-phased constructor. |
|
76 // ----------------------------------------------------------------------------- |
|
77 // |
|
78 CFeedsEditFeedDialog* CFeedsEditFeedDialog::NewL(MFeedsEditFeedDialogObserver& aObserver, CAknViewAppUi* aAppUi) |
|
79 { |
|
80 CFeedsEditFeedDialog* self = new (ELeave) CFeedsEditFeedDialog(aObserver, aAppUi, KNullDesC, KNullDesC,0); |
|
81 |
|
82 CleanupStack::PushL(self); |
|
83 self->iIsNewFeed = ETrue; |
|
84 self->ConstructL(); |
|
85 CleanupStack::Pop(self); |
|
86 |
|
87 return self; |
|
88 } |
|
89 |
|
90 |
|
91 // ----------------------------------------------------------------------------- |
|
92 // CFeedsEditFeedDialog::CFeedsEditFeedDialog |
|
93 // |
|
94 // C++ default constructor. |
|
95 // ----------------------------------------------------------------------------- |
|
96 // |
|
97 CFeedsEditFeedDialog::CFeedsEditFeedDialog (MFeedsEditFeedDialogObserver& aObserver, |
|
98 CAknViewAppUi* aAppUi, |
|
99 const TDesC& aName, const TDesC& aUrl, TInt aFreq) |
|
100 :iObserver(aObserver), iAppUi(aAppUi), iName(aName), iUrl(aUrl),iFreq(aFreq), iActionCancelled(EFalse) |
|
101 { |
|
102 iPreviousFreq = iFreq; |
|
103 } |
|
104 |
|
105 |
|
106 |
|
107 // ---------------------------------------------------- |
|
108 // CFeedsEditFeedDialog::OfferKeyEventL |
|
109 // Keyevent process. |
|
110 // ---------------------------------------------------- |
|
111 // |
|
112 TKeyResponse CFeedsEditFeedDialog::OfferKeyEventL(const TKeyEvent& aKeyEvent, |
|
113 TEventCode aType) |
|
114 { |
|
115 if ((aKeyEvent.iScanCode == EStdKeyDevice3) || (aKeyEvent.iScanCode == EStdKeyEnter)) |
|
116 { |
|
117 if ((aType == EEventKey) && (iSelectedDlgLine == EFeedsEditAutomaticUpdatingId)) |
|
118 { |
|
119 HandleFreqCmdL(); |
|
120 return EKeyWasConsumed; |
|
121 } |
|
122 } |
|
123 return CAknForm::OfferKeyEventL(aKeyEvent, aType); |
|
124 } |
|
125 |
|
126 // --------------------------------------------------------- |
|
127 // CFeedsEditFeedDialog::HandlePointerEventL |
|
128 // --------------------------------------------------------- |
|
129 // |
|
130 void CFeedsEditFeedDialog::HandlePointerEventL(const TPointerEvent& aPointerEvent) |
|
131 { |
|
132 if ((iSelectedDlgLine == EFeedsEditAutomaticUpdatingId) && (aPointerEvent.iType == TPointerEvent::EButton1Up)) |
|
133 HandleFreqCmdL(); |
|
134 else |
|
135 CAknForm::HandlePointerEventL(aPointerEvent); |
|
136 } |
|
137 |
|
138 // --------------------------------------------------------- |
|
139 // CFeedsEditFeedDialog::OkToExitL |
|
140 // --------------------------------------------------------- |
|
141 // |
|
142 |
|
143 TBool CFeedsEditFeedDialog::OkToExitL( TInt aButtonId ) |
|
144 { |
|
145 if (aButtonId == EAknSoftkeyOptions) |
|
146 { |
|
147 DisplayMenuL(); |
|
148 return EFalse; |
|
149 } |
|
150 else |
|
151 if ((aButtonId == EAknSoftkeyChange) && (iSelectedDlgLine == EFeedsEditAutomaticUpdatingId)) |
|
152 { |
|
153 HandleFreqCmdL(); |
|
154 return EFalse; |
|
155 } |
|
156 else |
|
157 { |
|
158 return CAknForm::OkToExitL(aButtonId); |
|
159 } |
|
160 } |
|
161 |
|
162 // --------------------------------------------------------- |
|
163 // CFeedsEditFeedDialog::HandleFreqCmdL |
|
164 // Handles the auto update freuency modification commands |
|
165 // --------------------------------------------------------- |
|
166 // |
|
167 void CFeedsEditFeedDialog::HandleFreqCmdL() |
|
168 { |
|
169 TBuf<32> title(_L("Auto update")); |
|
170 TInt currentlySelected = KAutoUpdatingOff; |
|
171 |
|
172 // options array |
|
173 CDesCArrayFlat* values = new( ELeave )CDesCArrayFlat(1); |
|
174 |
|
175 CleanupStack::PushL( values ); |
|
176 HBufC* text = iCoeEnv->AllocReadResourceLC(R_FEEDS_AUTOUPDATING_FEEDS_OFF); |
|
177 values->AppendL(text->Des()); |
|
178 CleanupStack::Pop(); |
|
179 |
|
180 text = iCoeEnv->AllocReadResourceLC(R_FEEDS_UPDATING_INTERVAL_15MIN); |
|
181 values->AppendL(text->Des()); |
|
182 CleanupStack::Pop(); |
|
183 |
|
184 text = iCoeEnv->AllocReadResourceLC(R_FEEDS_UPDATING_INTERVAL_HOURLY); |
|
185 values->AppendL(text->Des()); |
|
186 CleanupStack::Pop(); |
|
187 |
|
188 text = iCoeEnv->AllocReadResourceLC(R_FEEDS_UPDATING_INTERVAL_4HOURS); |
|
189 values->AppendL(text->Des()); |
|
190 CleanupStack::Pop(); |
|
191 |
|
192 text = iCoeEnv->AllocReadResourceLC(R_FEEDS_UPDATING_INTERVAL_DAILY); |
|
193 values->AppendL(text->Des()); |
|
194 CleanupStack::Pop(); |
|
195 |
|
196 text = iCoeEnv->AllocReadResourceLC(R_FEEDS_UPDATING_INTERVAL_WEEKLY); |
|
197 values->AppendL(text->Des()); |
|
198 CleanupStack::Pop(); |
|
199 |
|
200 switch(iFreq) |
|
201 { |
|
202 case KAutoUpdatingOff: |
|
203 currentlySelected = EFeedsEditAutomaticUpdatingOff; |
|
204 break; |
|
205 case KFifteen: |
|
206 currentlySelected = EFeedsEditAutomaticUpdating15min; |
|
207 break; |
|
208 case KOneHour: |
|
209 currentlySelected = EFeedsEditAutomaticUpdatingHourly; |
|
210 break; |
|
211 case KFourHour: |
|
212 currentlySelected = EFeedsEditAutomaticUpdating4hours; |
|
213 break; |
|
214 case KDay: |
|
215 currentlySelected = EFeedsEditAutomaticUpdatingDaily; |
|
216 break; |
|
217 case KWeek: |
|
218 currentlySelected = EFeedsEditAutomaticUpdatingWeekly; |
|
219 break; |
|
220 } |
|
221 |
|
222 currentlySelected = ShowRadioButtonSettingPageL(title,values,currentlySelected); |
|
223 |
|
224 if(!iActionCancelled) |
|
225 { |
|
226 switch(currentlySelected) |
|
227 { |
|
228 case EFeedsEditAutomaticUpdatingOff: |
|
229 iFreq = KAutoUpdatingOff; |
|
230 break; |
|
231 case EFeedsEditAutomaticUpdating15min: |
|
232 iFreq = KFifteen; |
|
233 break; |
|
234 case EFeedsEditAutomaticUpdatingHourly: |
|
235 iFreq = KOneHour; |
|
236 break; |
|
237 case EFeedsEditAutomaticUpdating4hours: |
|
238 iFreq = KFourHour; |
|
239 break; |
|
240 case EFeedsEditAutomaticUpdatingDaily: |
|
241 iFreq = KDay; |
|
242 break; |
|
243 case EFeedsEditAutomaticUpdatingWeekly: |
|
244 iFreq = KWeek; |
|
245 break; |
|
246 } |
|
247 CAknPopupField *freqControl = |
|
248 static_cast< CAknPopupField* >( Control( EFeedsEditAutomaticUpdatingId ) ); |
|
249 switch(iFreq) |
|
250 { |
|
251 case KAutoUpdatingOff: |
|
252 text = iCoeEnv->AllocReadResourceLC(R_FEEDS_AUTOUPDATING_FEEDS_OFF); |
|
253 break; |
|
254 case KFifteen: |
|
255 text = iCoeEnv->AllocReadResourceLC(R_FEEDS_UPDATING_INTERVAL_15MIN); |
|
256 break; |
|
257 case KOneHour: |
|
258 text = iCoeEnv->AllocReadResourceLC(R_FEEDS_UPDATING_INTERVAL_HOURLY); |
|
259 break; |
|
260 case KFourHour: |
|
261 text = iCoeEnv->AllocReadResourceLC(R_FEEDS_UPDATING_INTERVAL_4HOURS); |
|
262 break; |
|
263 case KDay: |
|
264 text = iCoeEnv->AllocReadResourceLC(R_FEEDS_UPDATING_INTERVAL_DAILY); |
|
265 break; |
|
266 case KWeek: |
|
267 text = iCoeEnv->AllocReadResourceLC(R_FEEDS_UPDATING_INTERVAL_WEEKLY); |
|
268 break; |
|
269 } |
|
270 freqControl->SetEmptyTextL(text->Des()); |
|
271 CleanupStack::Pop(); |
|
272 SetChangesPending(ETrue); |
|
273 } |
|
274 CleanupStack::PopAndDestroy(values); |
|
275 } |
|
276 |
|
277 // --------------------------------------------------------- |
|
278 // CFeedsEditFeedDialog::PostLayoutDynInitL |
|
279 // --------------------------------------------------------- |
|
280 // |
|
281 |
|
282 void CFeedsEditFeedDialog::PostLayoutDynInitL() |
|
283 { |
|
284 //Call the Base class LineChangedL() before the form is actually drawn |
|
285 // Call the LineChangedL to avoid the line clicking error for the first line |
|
286 LineChangedL(EFeedsEditDialogUrlId); |
|
287 // Call the base class PostLayoutDynInitL() |
|
288 CAknForm::PostLayoutDynInitL(); |
|
289 } |
|
290 |
|
291 // --------------------------------------------------------- |
|
292 // CFeedsEditFeedDialog::LineChangedL |
|
293 // Takes any action required when the current line is changed |
|
294 // to aControlId. |
|
295 // --------------------------------------------------------- |
|
296 // |
|
297 void CFeedsEditFeedDialog::LineChangedL( TInt aControlId ) |
|
298 { |
|
299 iSelectedDlgLine = aControlId; |
|
300 //get the reference to the buttomgroup container |
|
301 CEikButtonGroupContainer& cba = ButtonGroupContainer(); |
|
302 //add the 'Change' command |
|
303 //cba.SetCommandSetL(R_EDIT_FEEDS_CBA_OPTIONS_AUTO_UPDATE_CONTEXT_MENU); |
|
304 |
|
305 //now we check where is the control, as 'Change' command is not to be |
|
306 //shown for the first two form lines |
|
307 if((aControlId == EFeedsEditDialogUrlId) || |
|
308 (aControlId == EFeedsEditDialogNameId)) |
|
309 { |
|
310 // make the 'Change' button invisible |
|
311 cba.MakeCommandVisible(EAknSoftkeyChange, EFalse); |
|
312 } |
|
313 else if(aControlId == EFeedsEditAutomaticUpdatingId) |
|
314 { |
|
315 // make the 'Change' Button visible |
|
316 cba.MakeCommandVisible(EAknSoftkeyChange, ETrue); |
|
317 } |
|
318 else |
|
319 { |
|
320 //blank implementation |
|
321 } |
|
322 // draw the CBA |
|
323 cba.DrawNow(); |
|
324 } |
|
325 |
|
326 |
|
327 // ----------------------------------------------------------------------------- |
|
328 // CFeedsEditFeedDialog::~CFeedsEditFeedDialog |
|
329 // |
|
330 // Deconstructor. |
|
331 // ----------------------------------------------------------------------------- |
|
332 // |
|
333 CFeedsEditFeedDialog::~CFeedsEditFeedDialog() |
|
334 { |
|
335 } |
|
336 |
|
337 |
|
338 // ----------------------------------------------------------------------------- |
|
339 // CFeedsEditFeedDialog::PreLayoutDynInitL |
|
340 // |
|
341 // Called to setup the options menu with the dialog is active. |
|
342 // ----------------------------------------------------------------------------- |
|
343 // |
|
344 void CFeedsEditFeedDialog::DynInitMenuPaneL(TInt aResourceId, CEikMenuPane* aMenuPane) |
|
345 { |
|
346 CAknForm::DynInitMenuPaneL(aResourceId, aMenuPane); |
|
347 |
|
348 if (aResourceId == R_AVKON_FORM_MENUPANE) |
|
349 { |
|
350 aMenuPane->SetItemDimmed(EAknFormCmdLabel, ETrue); |
|
351 aMenuPane->SetItemDimmed(EAknFormCmdAdd, ETrue); |
|
352 aMenuPane->SetItemDimmed(EAknFormCmdDelete, ETrue); |
|
353 |
|
354 aMenuPane->AddMenuItemsL(R_FEEDS_HELP_EXIT_FEED_MENU); |
|
355 } |
|
356 } |
|
357 |
|
358 |
|
359 // ----------------------------------------------------------------------------- |
|
360 // CFeedsEditFeedDialog::SaveFormDataL |
|
361 // |
|
362 // Called by the framework whenver the 'Save' menu item is selected. |
|
363 // ----------------------------------------------------------------------------- |
|
364 // |
|
365 TBool CFeedsEditFeedDialog::SaveFormDataL() |
|
366 { |
|
367 CEikEdwin* textEditorName; |
|
368 CEikEdwin* textEditorUrl; |
|
369 |
|
370 HBufC* name = NULL; |
|
371 HBufC* url = NULL; |
|
372 TBool valid = EFalse; |
|
373 |
|
374 // Extract the new name. |
|
375 textEditorName = static_cast<CEikEdwin*>(ControlOrNull(EFeedsEditDialogNameId)); |
|
376 name = textEditorName->GetTextInHBufL(); |
|
377 CleanupStack::PushL(name); |
|
378 |
|
379 // Extract the url name. |
|
380 textEditorUrl = static_cast<CEikEdwin*>(ControlOrNull(EFeedsEditDialogUrlId)); |
|
381 url = textEditorUrl->GetTextInHBufL(); |
|
382 CleanupStack::PushL(url); |
|
383 |
|
384 // Notify the observer. |
|
385 valid = iObserver.IsFeedNameValidL(name, !iIsNewFeed); |
|
386 |
|
387 // If invalid force the user to reentry it. |
|
388 if (!valid) |
|
389 { |
|
390 // Change Focus and select the name field. |
|
391 TryChangeFocusToL( EFeedsEditDialogNameId ); |
|
392 textEditorName->SelectAllL(); |
|
393 |
|
394 iExitDialog = EFalse; |
|
395 } |
|
396 |
|
397 // Otherwise, check the url too. |
|
398 else |
|
399 { |
|
400 valid = iObserver.IsFeedUrlValidL(url); |
|
401 |
|
402 // If invalid force the user to reentry it. |
|
403 if (!valid) |
|
404 { |
|
405 // Set focus to url field |
|
406 TryChangeFocusToL( EFeedsEditDialogUrlId ); |
|
407 // Position focus to end of char, but not highlight the whole url field |
|
408 textEditorUrl->SetSelectionL( textEditorUrl->TextLength(), textEditorUrl->TextLength() ); |
|
409 textEditorUrl->DrawDeferred(); |
|
410 iExitDialog = EFalse; |
|
411 } |
|
412 |
|
413 // Otherwise pass the new values to the observer. |
|
414 else |
|
415 { |
|
416 if (iIsNewFeed) |
|
417 { |
|
418 iObserver.NewFeedL(*name, *url, iFreq); |
|
419 } |
|
420 else |
|
421 { |
|
422 // If the setting is changed from Off to other values, a confirmation |
|
423 // query with text: 'Enabling automatic updating may increase your monthly |
|
424 // phone bill' is shown. |
|
425 if ((iPreviousFreq == EFeedsEditAutomaticUpdatingOff) && |
|
426 (iFreq != EFeedsEditAutomaticUpdatingOff) && (iPreviousFreq != iFreq)) |
|
427 { |
|
428 HBufC* note = StringLoader::LoadLC( R_FEEDS_DATAQUERY_AUTOUPDATEWARN ); |
|
429 if(iPreviousFreq == 0) |
|
430 { |
|
431 // ShowInfoDialogwithOkSoftKeyL( note->Des() ); |
|
432 ShowInfoDialogwithOkSoftKeyL( _L("Enabling automatic updating may increase your monthly phone bill") ); |
|
433 } |
|
434 CleanupStack::PopAndDestroy(); // note |
|
435 iPreviousFreq = iFreq; |
|
436 } |
|
437 iObserver.UpdateFeedL(*name, *url, iFreq); |
|
438 } |
|
439 |
|
440 iExitDialog = ETrue; |
|
441 } |
|
442 } |
|
443 |
|
444 // Clean up. |
|
445 CleanupStack::PopAndDestroy(url); |
|
446 CleanupStack::PopAndDestroy(name); |
|
447 |
|
448 return valid; |
|
449 } |
|
450 |
|
451 |
|
452 // ----------------------------------------------------------------------------- |
|
453 // CFeedsEditFeedDialog::PreLayoutDynInitL |
|
454 // |
|
455 // Called by the framework before the form is initialised. |
|
456 // ----------------------------------------------------------------------------- |
|
457 // |
|
458 void CFeedsEditFeedDialog::PreLayoutDynInitL() |
|
459 { |
|
460 CEikEdwin* textEditor = NULL; |
|
461 |
|
462 CAknForm::PreLayoutDynInitL(); |
|
463 |
|
464 // Get the name field |
|
465 textEditor = static_cast<CEikEdwin*>(ControlOrNull(EFeedsEditDialogNameId)); |
|
466 |
|
467 // If the name was set then set it. |
|
468 if (iName.Length() > 0) |
|
469 { |
|
470 textEditor->SetTextL(&iName); |
|
471 } |
|
472 |
|
473 // Otherwise use the default name. |
|
474 else |
|
475 { |
|
476 HBufC* text = NULL; |
|
477 |
|
478 // Load the label |
|
479 text = CCoeEnv::Static()->AllocReadResourceAsDes16L(R_FEEDS_NEW_FEED_ITEM); |
|
480 CleanupStack::PushL(text); |
|
481 |
|
482 textEditor->SetTextL(text); |
|
483 SetFormFlag(EUnsavedEdit, ETrue); |
|
484 |
|
485 CleanupStack::PopAndDestroy(text); |
|
486 } |
|
487 |
|
488 // Get the url field |
|
489 textEditor = static_cast<CEikEdwin*>(ControlOrNull(EFeedsEditDialogUrlId)); |
|
490 |
|
491 textEditor->SetAknEditorAllowedInputModes( EAknEditorTextInputMode | EAknEditorNumericInputMode ); |
|
492 |
|
493 textEditor->SetAknEditorFlags |
|
494 ( |
|
495 EAknEditorFlagLatinInputModesOnly | |
|
496 EAknEditorFlagUseSCTNumericCharmap |
|
497 ); |
|
498 textEditor->SetAknEditorPermittedCaseModes( EAknEditorUpperCase | EAknEditorLowerCase ); |
|
499 |
|
500 // If the url was set then set it. |
|
501 if (iUrl.Length() > 0) |
|
502 { |
|
503 textEditor->SetTextL(&iUrl); |
|
504 } |
|
505 |
|
506 // Otherwise use the url. |
|
507 else |
|
508 { |
|
509 HBufC* text = NULL; |
|
510 |
|
511 // Load the label |
|
512 text = CCoeEnv::Static()->AllocReadResourceAsDes16L(R_FEEDS_NEW_FEED_URL_ITEM); |
|
513 CleanupStack::PushL(text); |
|
514 |
|
515 textEditor->SetTextL(text); |
|
516 SetFormFlag(EUnsavedEdit, ETrue); |
|
517 |
|
518 CleanupStack::PopAndDestroy(text); |
|
519 } |
|
520 CAknPopupField *freqControl = |
|
521 static_cast< CAknPopupField* >( Control( EFeedsEditAutomaticUpdatingId ) ); |
|
522 HBufC* text = NULL; |
|
523 switch(iFreq) |
|
524 { |
|
525 case KAutoUpdatingOff: |
|
526 text = iCoeEnv->AllocReadResourceLC(R_FEEDS_AUTOUPDATING_FEEDS_OFF); |
|
527 break; |
|
528 case KFifteen: |
|
529 text = iCoeEnv->AllocReadResourceLC(R_FEEDS_UPDATING_INTERVAL_15MIN); |
|
530 break; |
|
531 case KOneHour: |
|
532 text = iCoeEnv->AllocReadResourceLC(R_FEEDS_UPDATING_INTERVAL_HOURLY); |
|
533 break; |
|
534 case KFourHour: |
|
535 text = iCoeEnv->AllocReadResourceLC(R_FEEDS_UPDATING_INTERVAL_4HOURS); |
|
536 break; |
|
537 case KDay: |
|
538 text = iCoeEnv->AllocReadResourceLC(R_FEEDS_UPDATING_INTERVAL_DAILY); |
|
539 break; |
|
540 case KWeek: |
|
541 text = iCoeEnv->AllocReadResourceLC(R_FEEDS_UPDATING_INTERVAL_WEEKLY); |
|
542 break; |
|
543 } |
|
544 freqControl->SetEmptyTextL(text->Des()); |
|
545 CleanupStack::Pop(); |
|
546 } |
|
547 |
|
548 // ----------------------------------------------------------------------------- |
|
549 // CFeedsEditFeedDialog::ProcessCommandL |
|
550 // |
|
551 // Called by the framework to process the options menu. |
|
552 // ----------------------------------------------------------------------------- |
|
553 // |
|
554 void CFeedsEditFeedDialog::ProcessCommandL(TInt aCommandId) |
|
555 { |
|
556 switch (aCommandId) |
|
557 { |
|
558 case EAknCmdExit: |
|
559 { |
|
560 // Custom added commands. Forward to view. |
|
561 // Note that we respond to EAknCmdExit, not CEikCmdExit; it's |
|
562 // because we don't get it through the AppUi framework (instead, |
|
563 // we forward it there now). |
|
564 CBrowserAppUi::Static()->ActiveView()->ProcessCommandL( aCommandId ); |
|
565 break; |
|
566 } |
|
567 |
|
568 case EEikCmdExit: |
|
569 break; |
|
570 |
|
571 #ifdef __SERIES60_HELP |
|
572 case EAknFepCmdPredHelp: |
|
573 case EAknCmdHelp: |
|
574 HlpLauncher::LaunchHelpApplicationL(iEikonEnv->WsSession(), |
|
575 iAppUi->AppHelpContextL()); |
|
576 |
|
577 break; |
|
578 #endif //__SERIES60_HELP |
|
579 |
|
580 default: |
|
581 // Standard form commands. |
|
582 CAknForm::ProcessCommandL(aCommandId); |
|
583 |
|
584 if (iExitDialog) |
|
585 { |
|
586 TryExitL(EAknSoftkeyBack); |
|
587 } |
|
588 break; |
|
589 } |
|
590 } |
|
591 |
|
592 |
|
593 // ----------------------------------------------------------------------------- |
|
594 // CFeedsEditFeedDialog::GetHelpContext |
|
595 // |
|
596 // Get help context for the control. |
|
597 // ----------------------------------------------------------------------------- |
|
598 // |
|
599 #ifdef __SERIES60_HELP |
|
600 void CFeedsEditFeedDialog::GetHelpContext(TCoeHelpContext& aContext) const |
|
601 { |
|
602 // This must be the Browser's uid becasue the help texts are under Browser topics. |
|
603 aContext.iMajor = KUidBrowserApplication; |
|
604 |
|
605 if (iIsNewFeed) |
|
606 { |
|
607 aContext.iContext = KOSS_HLP_RSS_ADD; |
|
608 } |
|
609 else |
|
610 { |
|
611 aContext.iContext = KOSS_HLP_RSS_EDIT; |
|
612 } |
|
613 } |
|
614 #endif // __SERIES60_HELP |
|
615 |
|
616 // ----------------------------------------------------------------------------- |
|
617 // CFeedsEditFeedDialog::ShowRadioButtonSettingPageL |
|
618 // ----------------------------------------------------------------------------- |
|
619 // |
|
620 TInt CFeedsEditFeedDialog::ShowRadioButtonSettingPageL( |
|
621 TDesC& aTitle, |
|
622 CDesCArrayFlat* aValues, |
|
623 TInt aCurrentItem ) |
|
624 { |
|
625 |
|
626 // index must be turned upside down, because options list is upside down |
|
627 //TInt newItem = aCurrentItem = aValues->Count() - 1 - aCurrentItem; |
|
628 TInt newItem = aCurrentItem; |
|
629 |
|
630 // We have everything to create dialog |
|
631 CAknRadioButtonSettingPage* dlg = new ( ELeave )CAknRadioButtonSettingPage( |
|
632 R_RADIO_BUTTON_SETTING_PAGE, newItem, aValues ); |
|
633 |
|
634 CleanupStack::PushL( dlg ); |
|
635 dlg->SetSettingTextL( aTitle ); |
|
636 CleanupStack::Pop(); // dlg |
|
637 iActionCancelled = EFalse; |
|
638 if ( !dlg->ExecuteLD( CAknSettingPage::EUpdateWhenChanged ) ) |
|
639 { |
|
640 // Changes confirmed |
|
641 newItem = aCurrentItem; |
|
642 iActionCancelled = ETrue; |
|
643 } |
|
644 //iActionCancelled = EFalse; |
|
645 |
|
646 // index must be re-turned upside down, because options list is upside down |
|
647 return newItem; |
|
648 } |
|
649 |
|
650 // --------------------------------------------------------- |
|
651 // CFeedsEditFeedDialog::ShowInfoDialogwithOkSoftKeyL |
|
652 // --------------------------------------------------------- |
|
653 // |
|
654 void CFeedsEditFeedDialog::ShowInfoDialogwithOkSoftKeyL( const TDesC& aNoteText ) |
|
655 { |
|
656 CAknNoteDialog* dlg = new (ELeave) CAknNoteDialog(CAknNoteDialog::EConfirmationTone,CAknNoteDialog::ENoTimeout); |
|
657 dlg->SetTextL( aNoteText ); |
|
658 dlg->PrepareLC( R_FEEDS_EDIT_AUTOUPDATE_INFORMATION_NOTE_DIALOG ); |
|
659 dlg->RunLD(); |
|
660 } |