tsrc/CenrepEditor/Src/cenrepeditorlistbox2.cpp
changeset 15 ccd8e69b5392
parent 2 b31261fd4e04
child 20 e8be2c2e049d
child 22 496ad160a278
equal deleted inserted replaced
2:b31261fd4e04 15:ccd8e69b5392
     1 /*
       
     2 * Copyright (c) 2009 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:
       
    15 *
       
    16 */
       
    17 #include <aknnotewrappers.h>
       
    18 #include <akntextsettingpage.h> 
       
    19 #include "cenrepeditorListbox2.h"
       
    20 
       
    21 #include "cenrepeditorListbox2.h"
       
    22 #include <e32debug.h>
       
    23 
       
    24 CAknSettingItem* COtherResourcesListbox::CreateSettingItemL( TInt aIdentifier )
       
    25     {
       
    26     CAknSettingItem* settingItem = NULL;
       
    27 
       
    28     // create a setting item for each setting list resource
       
    29     switch (aIdentifier)
       
    30     {
       
    31     case EOtherResourceActivation:        
       
    32         settingItem=ConstructByValueL( aIdentifier,iOtherResources->iActivation);
       
    33         break;
       
    34     case EOtherResourceOperatorVariant:        
       
    35         settingItem=ConstructByValueL( aIdentifier,iOtherResources->iOperatorVariant);
       
    36         break;    
       
    37     case EOtherResourceAuditoryNotification:        
       
    38         settingItem=ConstructByValueL( aIdentifier,iOtherResources->iAuditoryNotification);
       
    39         break;  
       
    40    case EOtherResourcePopupNotification:        
       
    41         settingItem=ConstructByValueL( aIdentifier,iOtherResources->iPopupNotification);
       
    42         break;
       
    43     case EOtherResourcePopupNotificationType:        
       
    44         settingItem=ConstructByValueL( aIdentifier,iOtherResources->iPopupNotificationType);
       
    45         break;
       
    46     case EOtherResourceEdgeDtmSupport:        
       
    47         settingItem=ConstructByValueL( aIdentifier,iOtherResources->iEdgeDtmSupport);
       
    48         break;
       
    49     case EOtherResourceSessionSetupMethod:        
       
    50         settingItem=ConstructByValueL( aIdentifier,iOtherResources->iSessionSetupMethod);
       
    51         break;
       
    52     case EOtherRResourcePrivacyVariationMode:
       
    53         settingItem=ConstructByValueL( aIdentifier, iOtherResources->iPrivacyVariation ); 
       
    54         break;  
       
    55     case EOtherResourceAutoRecord:        
       
    56         settingItem=ConstructByValueL( aIdentifier,iOtherResources->iAutoRecord);
       
    57         break;
       
    58     case EOtherResourceVideoLocation:        
       
    59         settingItem=new (ELeave) 
       
    60             CAknIntegerEdwinSettingItem(aIdentifier,iOtherResources->iVideoLocation);
       
    61         break;
       
    62     case EOtherResourceSipProfileId:
       
    63         settingItem = new (ELeave) 
       
    64             CAknIntegerEdwinSettingItem(aIdentifier, iOtherResources->iSipProfileId);        
       
    65         break;
       
    66     case EOtherResourceUiOrientation:        
       
    67         settingItem=ConstructByValueL( aIdentifier,iOtherResources->iUiOrientation);
       
    68         break;
       
    69     case EOtherResourceCapabilityQuery:    	
       
    70         settingItem=ConstructByValueL( aIdentifier,iOtherResources->iCapabilityQuery);
       
    71     	break; 
       
    72     case EOtherResourceProductModeVariationKey:    	
       
    73         settingItem = new (ELeave) 
       
    74             CAknIntegerEdwinSettingItem( aIdentifier, iOtherResources->iProductModeVariation);
       
    75     	break;
       
    76     case EOtherResourceEncoderConfigurationInfo:
       
    77         settingItem = new (ELeave)
       
    78             CAknTextSettingItem( aIdentifier, iOtherResources->iEncoderInfo );
       
    79         settingItem->SetSettingPageFlags(CAknTextSettingPage::EZeroLengthAllowed);
       
    80 
       
    81         break;   
       
    82     case EOtherResourceEncodingDevice:
       
    83         settingItem = new (ELeave) 
       
    84            CAknTextSettingItem( aIdentifier, iOtherResources->iEncodingDeviceStr ); 
       
    85     	break;             
       
    86     default:
       
    87         break;
       
    88         }
       
    89     return settingItem;
       
    90     }
       
    91 
       
    92 
       
    93 void COtherResourcesListbox::SetData(COtherResources* aOtherResources)
       
    94     {
       
    95     iOtherResources = aOtherResources;
       
    96     }
       
    97 
       
    98 void COtherResourcesListbox::SizeChanged()
       
    99     {
       
   100     if (ListBox()) 
       
   101         {
       
   102         ListBox()->SetRect(Rect());
       
   103         }    
       
   104     }
       
   105 
       
   106 
       
   107 // ------------------------------------------------------------------
       
   108 // CPhoneResourcesListbox::ConstructByValueL( aIdentifier, )
       
   109 // ------------------------------------------------------------------
       
   110 //
       
   111 
       
   112 CAknSettingItem* COtherResourcesListbox::ConstructByValueL( TInt aIdentifier,  
       
   113                                             TInt& aVal )
       
   114     {    
       
   115     CAknSettingItem* settingItem = NULL ;
       
   116     if(aVal<0 )
       
   117         {        
       
   118         settingItem = new (ELeave) CAknSettingItem(aIdentifier);
       
   119         settingItem->SetProtectionState(CAknSettingItem::ESettingItemProtected);
       
   120         }
       
   121     else
       
   122         {
       
   123         settingItem = new (ELeave) 
       
   124             CAknEnumeratedTextPopupSettingItem(aIdentifier,aVal);
       
   125         }
       
   126     return settingItem ;
       
   127     }
       
   128 
       
   129 
       
   130 void COtherResourcesListbox::EditItemL(TInt aIndex, TBool aCalledFromMenu)
       
   131     {
       
   132     CAknSettingItemList::EditItemL(aIndex, aCalledFromMenu);
       
   133     
       
   134     CAknSettingItem* currentItem = SettingItemArray()->At(aIndex);
       
   135     if ( currentItem->Identifier() == EOtherResourceEncodingDevice )
       
   136         {
       
   137         TLex lex( currentItem->SettingTextL() );
       
   138         TUint uid;
       
   139         TInt err = lex.Val(uid, EHex);
       
   140         
       
   141         if ( (err != KErrNone) || !lex.Eos() )
       
   142             {
       
   143             currentItem->LoadL();
       
   144             currentItem->UpdateListBoxTextL();
       
   145 
       
   146             CAknWarningNote* warningNote = new (ELeave) CAknWarningNote;
       
   147             warningNote->ExecuteLD(_L("Invalid value"));
       
   148             }
       
   149          }
       
   150     }