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