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