Changeset 24160 in webkit
- Timestamp:
- Jul 10, 2007 1:08:03 PM (17 years ago)
- Location:
- S60/branches/3.1m/WebKit
- Files:
-
- 7 edited
Legend:
- Unmodified
- Added
- Removed
-
S60/branches/3.1m/WebKit/BrowserControl/inc/BrCtlDefs.h
r21537 r24160 727 727 EWidgetBasePath 728 728 }; 729 730 /** 731 * Orientation for rotating display 732 */ 733 enum TBrCtlOrientation 734 { 735 EOrientationUndefined = 0, 736 EOrientationLandscape, 737 EOrientationPortrait 738 }; 739 729 740 }; 730 741 -
S60/branches/3.1m/WebKit/BrowserControl/inc/BrCtlInterface.h
r21537 r24160 900 900 virtual TBool DialogMimeFileSelectLC(HBufC*& aSelectedFileName, 901 901 const TDesC& aMimeType) = 0; 902 903 /** 904 * Called to show or hide softkeys 905 * @since 3.1 906 * @param aVisible ETrue to show softkeys, EFalse when full screen is needed 907 */ 908 virtual void SetSoftkeysVisible(TBool aVisible) = 0; 909 910 /** 911 * Called to change the display orientation to landscape 912 * @since 3.1 913 */ 914 virtual void SetDisplayMode(TBrCtlDefs::TBrCtlOrientation aOrientation) = 0; 915 916 virtual void Reserved_1() = 0; 917 virtual void Reserved_2() = 0; 918 virtual void Reserved_3() = 0; 919 virtual void Reserved_4() = 0; 920 virtual void Reserved_5() = 0; 921 virtual void Reserved_6() = 0; 922 virtual void Reserved_7() = 0; 923 virtual void Reserved_8() = 0; 924 virtual void Reserved_9() = 0; 925 virtual void Reserved_10() = 0; 926 927 902 928 903 929 }; -
S60/branches/3.1m/WebKit/BrowserView/inc/WidgetExtension.h
r21537 r24160 190 190 * @param ID of the command to issue when the menu item is selected 191 191 * @param command ID of the parent menu item 192 * @return none193 */ 194 voidAddOptionsMenuItem( const TDesC& aText, TInt aCmdId, TInt aParentCmdId, void* obj );192 * @return Error code 193 */ 194 TInt AddOptionsMenuItem( const TDesC& aText, TInt aCmdId, TInt aParentCmdId, void* obj ); 195 195 196 196 /** … … 225 225 * @param command ID of the new menu item 226 226 * @param dimmed status 227 * @return none228 */ 229 voidReplaceMenuItem( TInt oldCmdId, const TDesC& newText,227 * @return Error code 228 */ 229 TInt ReplaceMenuItem( TInt oldCmdId, const TDesC& newText, 230 230 TInt newCmdId, TInt newDimmed ); 231 231 … … 369 369 */ 370 370 void* GetFromMenuItemCollection( TInt cmdId ); 371 372 /** 373 * Method HideSoftkeys 374 * @since 3.2 375 * @return void 376 */ 377 void HideSoftkeys( ); 378 379 /** 380 * Method ShowSoftkeys 381 * @since 3.2 382 * @return void 383 */ 384 void ShowSoftkeys( ); 385 386 /** 387 * Method SetDisplayLandscape 388 * @since 3.2 389 * @return void 390 */ 391 void SetDisplayLandscape( ); 392 393 /** 394 * Method SetDisplayPortrait 395 * @since 3.2 396 * @return void 397 */ 398 void SetDisplayPortrait( ); 371 399 372 400 … … 543 571 * @param parent menu item 544 572 * @param menu item to be inserted 545 * @return TBool546 */ 547 T BoolAppend( CMenuItem* root, CMenuItem* item );573 * @return error code 574 */ 575 TInt Append( CMenuItem* root, CMenuItem* item ); 548 576 549 577 /* -
S60/branches/3.1m/WebKit/BrowserView/inc/WidgetPreferences.h
r21537 r24160 58 58 59 59 // CLASS DECLARATION 60 61 /** 62 * CPrefElement 63 * 64 * @lib widgetengine.dll 65 * @since 3.2 66 */ 67 class CPrefElement : public CBase 68 { 69 public : 70 /** 71 * Constructor. 72 */ 73 CPrefElement(); 74 75 /** 76 * Destructor. 77 */ 78 ~CPrefElement(); 79 80 /** 81 * SetValueL 82 * Set value for a preference 83 * @param const TDesC& aValue - The value to be set 84 * @return none 85 */ 86 void SetValueL( const TDesC& aValue ); 87 88 /** 89 * SetValueSize 90 * Set length of value 91 * @param const TInt aSize - The length to be set 92 * @return none 93 */ 94 void SetValueSize( const TInt aSize ) 95 { 96 iValueSize = aSize; 97 } 98 99 /** 100 * GetValue 101 * Get value for a preference 102 * @param none 103 * @return const TDesC& - value for the preference 104 */ 105 const TDesC& Value() const 106 { 107 if ( iValue ) 108 return *iValue; 109 else 110 return KNullDesC(); 111 } 112 113 /** 114 * GetValueSize 115 * Get length of value 116 * @param none 117 * @return TInt - length of value for the preference 118 */ 119 TInt ValueSize() const 120 { 121 return iValueSize; 122 } 123 124 private : 125 HBufC* iValue; // value of the preference 126 TInt iValueSize; // length of the value 127 }; 128 129 60 130 /** 61 131 * CWidgetPreferences … … 68 138 69 139 public: 70 static CWidgetPreferences* NewL(CWidgetExtension& aWidgetExtension); 71 static CWidgetPreferences* NewLC(CWidgetExtension& aWidgetExtension); 140 /** 141 * Two-phased constructor. 142 */ 143 static CWidgetPreferences* NewL( CWidgetExtension& aWidgetExtension ); 144 static CWidgetPreferences* NewLC( CWidgetExtension& aWidgetExtension ); 145 146 /** 147 * Destructor. 148 */ 72 149 ~CWidgetPreferences(); 73 150 74 151 public: 152 /** 153 * Load preferences from persistent storage 154 */ 75 155 void LoadL(); 156 157 /** 158 * Save preferences to persistent storage 159 */ 76 160 void SaveL(); 77 TInt PreferenceL(const TDesC& aName, TPtrC& aValue); 78 void SetPreferenceL(const TDesC& aName, const TDesC& aValue); 161 162 /** 163 * Get preference for a particular key 164 */ 165 TInt PreferenceL( const TDesC& aName, TPtrC& aValue ); 166 167 /** 168 * Set preference for a particular key 169 */ 170 void SetPreferenceL( const TDesC& aName, const TDesC& aValue ); 79 171 80 172 protected: 81 void Empty(); 82 void CreateFilePathL(); 83 HBufC* MakeKeyLC(const TDesC& aName); 84 85 protected: 86 CWidgetPreferences(CWidgetExtension& aWidgetExtension); 173 /** 174 * C++ Constructor 175 */ 176 CWidgetPreferences( CWidgetExtension& aWidgetExtension ); 177 178 /** 179 * Symbian 2nd phase constructor 180 */ 87 181 void ConstructL(); 88 182 89 183 private: 90 RPtrHashMap<TDesC,TDesC> iMap; 91 RPtrHashMap<TDesC,TInt> iSizeMap; 184 RPtrHashMap<TDesC,CPrefElement> iPreferences; 92 185 HBufC* iFilePath; 93 186 CWidgetExtension* iWidgetExtension; //not owned 94 187 HBufC* iBasePath; 95 96 188 }; 97 189 190 98 191 #endif -
S60/branches/3.1m/WebKit/BrowserView/src/WidgetExtension.cpp
r21537 r24160 47 47 #include <browserlauncher.h> 48 48 #include <widgetmenu.rsg> 49 #include <eikbtgpc.h>50 49 #include <avkon.hrh> 51 50 … … 413 412 } 414 413 if ( parentNode ) 414 { 415 415 node = parentNode->FirstChild(); 416 } 416 417 } 417 418 else … … 429 430 } 430 431 if ( iMenuRoot ) 431 node = iMenuRoot->FirstChild(); 432 { 433 node = iMenuRoot->FirstChild(); 434 } 432 435 } 433 436 … … 463 466 { 464 467 if ( iResourceId > R_CASCADE_MENU_1 + KMaxOptionsMenu ) 468 { 465 469 menuData.iCascadeId = 0; 470 } 466 471 else 472 { 467 473 menuData.iCascadeId = iResourceId; 474 } 468 475 } 469 476 else 477 { 470 478 menuData.iCascadeId = 0; 479 } 471 480 472 481 menuData.iFlags = 0; … … 478 487 iCascadeArr.Append( entry ); 479 488 480 aMenuPane.InsertMenuItemL( menuData, 0);489 aMenuPane.InsertMenuItemL( menuData, aMenuPane.NumberOfItemsInPane()-1 ); 481 490 aMenuPane.SetItemDimmed( aNode->CmdId()+KMenuItemCommandIdBase, aNode->Dimmed() ); 482 491 } … … 657 666 // ----------------------------------------------------------------------------- 658 667 // 659 void CWidgetExtension::AddOptionsMenuItem( 668 TInt CWidgetExtension::AddOptionsMenuItem( 660 669 const TDesC& aText, TInt aCmdId, TInt aParentId, void* aObj ) 661 { 662 if ( !iMenuRoot ) 663 { 670 { 671 if ( !iMenuRoot ) 672 { 664 673 iMenuRoot = CMenuItem::NewL( _L(""), -1 ); 665 } 674 } 675 666 676 if ( aText.Length() > 0 ) 667 677 { 668 678 CMenuItem* parent = FindNodeById( iMenuRoot, aParentId ); 669 679 if ( !parent ) 670 return; 671 CMenuItem* item = CMenuItem::NewL( aText, aCmdId, parent, aObj ); 672 Append( parent, item ); 673 } 680 { 681 return KErrGeneral; 682 } 683 684 CMenuItem* item = NULL; 685 item = FindNodeById( iMenuRoot, aCmdId ); 686 if ( item ) 687 { 688 return KErrAlreadyExists; 689 } 690 691 item = FindNodeByText( iMenuRoot, aText ); 692 if ( item ) 693 { 694 return KErrAlreadyExists; 695 } 696 697 item = CMenuItem::NewL( aText, aCmdId, parent, aObj ); 698 return Append( parent, item ); 699 } 700 701 return KErrGeneral; 674 702 } 675 703 … … 683 711 void CWidgetExtension::SetRightSoftKeyLabel( const TDesC& aText ) 684 712 { 685 CEikButtonGroupContainer * pCbaGroup = CEikButtonGroupContainer::Current(); 686 pCbaGroup->SetCommandL( EAknSoftkeyExit, aText ); 687 pCbaGroup->DrawNow(); 713 if (iWebKitView->WebKitControl().BrCtl().BrCtlSoftkeysObserver()) 714 { 715 iWebKitView->WebKitControl().BrCtl().BrCtlSoftkeysObserver()->UpdateSoftkeyL( 716 EKeyRight, aText, 0, EChangeReasonLoad); 717 } 688 718 } 689 719 … … 695 725 // ----------------------------------------------------------------------------- 696 726 // 697 T Bool CWidgetExtension::Append(727 TInt CWidgetExtension::Append( 698 728 CMenuItem* aParent, CMenuItem* aItem ) 699 { 729 { 700 730 if ( !aParent ) 701 return EFalse; 731 { 732 return KErrGeneral; 733 } 702 734 703 735 if ( aParent->FirstChild() == NULL ) //first child … … 709 741 AppendSibling( aParent->FirstChild(), aItem ); 710 742 } 711 return ETrue;712 } 743 return KErrNone; 744 } 713 745 714 746 // ----------------------------------------------------------------------------- … … 767 799 CMenuItem* item = NULL; 768 800 if ( prev ) 801 { 769 802 item = prev->NextSibling(); 803 } 804 770 805 while( item ) 771 806 { … … 803 838 // ---------------------------------------------------------------------------- 804 839 // 805 void CWidgetExtension::ReplaceMenuItem( 806 TInt oldItemCmdId, 807 const TDesC& newItemText, 808 TInt newItemCmdId, 840 TInt CWidgetExtension::ReplaceMenuItem( 841 TInt oldItemCmdId, 842 const TDesC& newItemText, 843 TInt newItemCmdId, 809 844 TInt newItemDimmed ) 810 845 { 811 CMenuItem* node = NULL; 812 813 node = FindNodeById( iMenuRoot, oldItemCmdId ); 814 if ( node ) 815 { 816 node->SetText( newItemText ); 817 node->SetCmdId( newItemCmdId ); 818 node->SetDimmed( newItemDimmed ); 819 } 846 CMenuItem* newItem = NULL; 847 CMenuItem* oldItem = NULL; 848 849 // check if there is another node in the tree with the same Id as that of 850 // newItem but allow a replace of oldItem with the same Id as the newItem 851 newItem = FindNodeById( iMenuRoot, newItemCmdId ); 852 if ( newItem && newItem->CmdId() != oldItemCmdId ) 853 { 854 return KErrAlreadyExists; 855 } 856 857 // check if there is another node in the tree with the same text as that of 858 // newItem but allow a replace of oldItem with the same text as the newItem 859 newItem = FindNodeByText( iMenuRoot, newItemText ); 860 oldItem = FindNodeById( iMenuRoot, oldItemCmdId ); 861 if ( newItem && oldItem && newItem->Text().Compare(oldItem->Text()) != 0 ) 862 { 863 return KErrAlreadyExists; 864 } 865 866 if ( oldItem ) 867 { 868 oldItem->SetText( newItemText ); 869 oldItem->SetCmdId( newItemCmdId ); 870 oldItem->SetDimmed( newItemDimmed ); 871 return KErrNone; 872 } 873 874 return KErrGeneral; 820 875 } 821 876 … … 861 916 node = FindNodeByText( iMenuRoot, textVal ); 862 917 if ( node ) 918 { 863 919 return node->Obj(); 920 } 864 921 else 922 { 865 923 return NULL; 924 } 866 925 } 867 926 … … 878 937 879 938 node = FindNodeById( iMenuRoot, cmdId ); 939 880 940 if ( node ) 941 { 881 942 return node->Obj(); 943 } 882 944 else 945 { 883 946 return NULL; 947 } 884 948 } 885 949 … … 895 959 CMenuItem* node = NULL; 896 960 node = FindNodeById( iMenuRoot, aCmdId ); 961 897 962 if ( node ) 963 { 898 964 node->SetDimmed( aValue ); 965 } 899 966 } 900 967 … … 911 978 CMenuItem* node = NULL; 912 979 node = FindNodeById( iMenuRoot, aCmdId ); 980 913 981 if ( node ) 982 { 914 983 node->SetCallback( aOnSelectCallback ); 984 } 915 985 } 916 986 … … 926 996 CMenuItem* node = NULL; 927 997 node = FindNodeById( iMenuRoot, aCmdId ); 998 928 999 if ( node ) 1000 { 929 1001 return node->Callback(); 1002 } 930 1003 else 1004 { 931 1005 return NULL; 1006 } 932 1007 } 933 1008 … … 1009 1084 1010 1085 if ( !node ) 1086 { 1011 1087 return item; 1088 } 1012 1089 1013 1090 if ( node->CmdId() == aCmdId ) … … 1043 1120 1044 1121 if ( !node ) 1122 { 1045 1123 return item; 1124 } 1046 1125 1047 1126 if ( node->Text().Compare( aText ) == 0 ) … … 1066 1145 } 1067 1146 1147 // ----------------------------------------------------------------------------- 1148 // CWidgetExtension::HideSoftkeys 1149 // 1150 // 1151 // 1152 // ----------------------------------------------------------------------------- 1153 // 1154 void CWidgetExtension::HideSoftkeys( ) 1155 { 1156 iWidgetCallback->SetSoftkeysVisible(EFalse); 1157 } 1158 1159 // ----------------------------------------------------------------------------- 1160 // CWidgetExtension::ShowSoftkeys 1161 // 1162 // 1163 // 1164 // ----------------------------------------------------------------------------- 1165 // 1166 void CWidgetExtension::ShowSoftkeys( ) 1167 { 1168 iWidgetCallback->SetSoftkeysVisible(ETrue); 1169 } 1170 1171 // ----------------------------------------------------------------------------- 1172 // CWidgetExtension::SetDisplayLandscape 1173 // 1174 // 1175 // 1176 // ----------------------------------------------------------------------------- 1177 // 1178 void CWidgetExtension::SetDisplayLandscape( ) 1179 { 1180 iWidgetCallback->SetDisplayMode(TBrCtlDefs::EOrientationLandscape); 1181 } 1182 1183 // ----------------------------------------------------------------------------- 1184 // CWidgetExtension::SetDisplayPortrait 1185 // 1186 // 1187 // 1188 // ----------------------------------------------------------------------------- 1189 // 1190 void CWidgetExtension::SetDisplayPortrait( ) 1191 { 1192 iWidgetCallback->SetDisplayMode(TBrCtlDefs::EOrientationPortrait); 1193 } 1068 1194 1069 1195 // ---------------------------------------------------------------------------- -
S60/branches/3.1m/WebKit/BrowserView/src/WidgetPreferences.cpp
r21537 r24160 61 61 // ---------------------------------------------------------------------------- 62 62 // CWidgetPreferences::NewL 63 // 63 // Two-phased constructor 64 64 // 65 65 // … … 76 76 // ---------------------------------------------------------------------------- 77 77 // CWidgetPreferences::NewLC 78 // 78 // Two-phased constructor 79 79 // 80 80 // … … 92 92 // ---------------------------------------------------------------------------- 93 93 // CWidgetPreferences::CWidgetPreferences 94 // 94 // C++ Constructor 95 95 // 96 96 // … … 98 98 CWidgetPreferences::CWidgetPreferences( CWidgetExtension& aWidgetExtension ) 99 99 : iWidgetExtension( &aWidgetExtension ) 100 { 100 { 101 101 } 102 102 103 103 // ---------------------------------------------------------------------------- 104 104 // CWidgetPreferences::~CWidgetPreferences 105 // 105 // Destructor 106 106 // 107 107 // … … 109 109 CWidgetPreferences::~CWidgetPreferences() 110 110 { 111 iMap.ResetAndDestroy(); 112 iMap.Close(); 113 iSizeMap.ResetAndDestroy(); 114 iSizeMap.Close(); 111 iPreferences.ResetAndDestroy(); 112 iPreferences.Close(); 115 113 delete iBasePath; 116 114 } … … 118 116 // ---------------------------------------------------------------------------- 119 117 // CWidgetPreferences::ConstructL 120 // 118 // Symbian 2nd phase constructor 121 119 // 122 120 // … … 128 126 // ---------------------------------------------------------------------------- 129 127 // CWidgetPreferences::PreferenceL 130 // 128 // Get preference for a key 131 129 // 132 130 // … … 134 132 TInt CWidgetPreferences::PreferenceL( const TDesC& aKey, TPtrC& aValue ) 135 133 { 134 TInt rSuccess = KErrNotFound; 135 TInt i = 0; 136 TInt size = 0; 137 136 138 if ( !iBasePath && ( iWidgetExtension->WidgetBasePath().Length() > 0 ) ) 137 139 iBasePath = iWidgetExtension->WidgetBasePath().AllocL(); 138 140 139 TInt rSuccess = KErrNotFound; 140 141 141 142 if ( aKey.Length() <= KMaxKeyValueSize ) 142 143 { 143 144 HBufC* key = HBufC::NewLC( aKey.Length() + KMaxIntLength + 1 ); 144 145 key->Des().Format( KKeyFormat, iWidgetExtension->GetWidgetId(), &aKey ); 145 TInt* size = iSizeMap.Find( *key );146 TDesC* res = iMap.Find( *key );147 148 if ( ! res || !size)146 147 CPrefElement* pref = iPreferences.Find( *key ); 148 149 if ( !pref ) 149 150 { 150 151 CleanupStack::PopAndDestroy( key ); 151 152 return rSuccess; 152 153 } 153 154 if ( *size > KMaxKeyValueSize ) 154 155 size = pref->ValueSize(); 156 157 158 if ( size > KMaxKeyValueSize ) 155 159 { 156 160 // return contents from temp file whose name is stored 157 // in the value field of iMap161 // in the iValue member of iPreferences 158 162 RFs fs; 159 163 … … 161 165 { 162 166 CleanupClosePushL( fs ); 163 HBufC* filePath = HBufC::NewLC( res->Length() ); 164 167 HBufC* filePath = HBufC::NewLC( pref->Value().Length() ); 165 168 TPtr fName( filePath->Des() ); 166 fName.Append( *res);169 fName.Append( pref->Value() ); 167 170 168 171 RFileReadStream readStream; … … 185 188 } 186 189 187 CleanupStack::PopAndDestroy( 2); //filePath,fs190 CleanupStack::PopAndDestroy( 2 ); //filePath,fs 188 191 } 189 192 } 190 else if ( *size >= 0 )191 { 192 aValue.Set( *res);193 else if ( size >= 0 ) 194 { 195 aValue.Set( pref->Value() ); 193 196 rSuccess = KErrNone; 194 197 } 195 198 196 CleanupStack::PopAndDestroy( key);199 CleanupStack::PopAndDestroy( key ); 197 200 } 198 201 … … 202 205 // ---------------------------------------------------------------------------- 203 206 // CWidgetPreferences::SetPreferenceL 204 // 207 // Set Preference for a key 205 208 // 206 209 // … … 219 222 if ( aValue.Length() <= KMaxKeyValueSize ) 220 223 { 221 HBufC* value = aValue.AllocLC(); 222 iMap.InsertL( key, value ); 223 TInt* size = new TInt(aValue.Length()); 224 // make a copy of key and insert that 225 HBufC* newKey = key->AllocLC(); 226 iSizeMap.InsertL( newKey, size ); 227 CleanupStack::Pop( 3 );//newKey,value,key 224 CPrefElement* pref = new (ELeave) CPrefElement; 225 CleanupStack::PushL( pref ); 226 pref->SetValueL( aValue ); 227 pref->SetValueSize( aValue.Length() ); 228 iPreferences.InsertL( key, pref ); 229 CleanupStack::Pop( 2 ); //pref, key 228 230 return; 229 231 } … … 231 233 { 232 234 // create a temp file and save the value in temp file. 233 // i Map value fieldcontains the temp file name.235 // iValue member of CPrefElement contains the temp file name. 234 236 RFs fs; 235 237 RFile file; … … 247 249 TPtr fName( filePath->Des() ); 248 250 fName.Append( tempFileName ); 249 iMap.InsertL( key, filePath ); 250 TInt* size = new TInt( aValue.Length() ); 251 // make a copy of key and insert that 252 HBufC* newKey = key->AllocLC(); 253 iSizeMap.InsertL( newKey, size ); 254 251 CPrefElement* pref = new ( ELeave ) CPrefElement; 252 CleanupStack::PushL( pref ); 253 pref->SetValueL( *filePath ); 254 pref->SetValueSize( aValue.Length() ); 255 iPreferences.InsertL( key, pref ); 255 256 RFileWriteStream writeStream( file ); 256 257 CleanupClosePushL( writeStream ); … … 258 259 writeStream.WriteL( aValue ); 259 260 writeStream.CommitL(); 260 CleanupStack::PopAndDestroy( ); //writeStream261 CleanupStack::Pop( 2 );//newKey,filePath262 CleanupStack::PopAndDestroy( 2 ); //file,fs261 CleanupStack::PopAndDestroy( ); //writeStream 262 CleanupStack::Pop( pref ); 263 CleanupStack::PopAndDestroy( 3 ); //filePath,file,fs 263 264 CleanupStack::Pop( key ); 264 265 return; … … 272 273 // ---------------------------------------------------------------------------- 273 274 // CWidgetPreferences::SaveL 274 // 275 // SAve preferences to persistent storage 275 276 // 276 277 // … … 306 307 { 307 308 CleanupClosePushL( writeStream ); 308 writeStream.WriteInt32L( i Map.Count() );309 310 TPtrHashMapIter<TDesC, TDesC> it( iMap);309 writeStream.WriteInt32L( iPreferences.Count() ); 310 311 TPtrHashMapIter<TDesC,CPrefElement> it( iPreferences ); 311 312 const TDesC* key; 312 const TDesC* value;313 const CPrefElement* pref; 313 314 314 315 while ( ( key = it.NextKey() ) != 0 ) 315 316 { 316 value= it.CurrentValue();317 pref = it.CurrentValue(); 317 318 writeStream.WriteInt32L( key->Length() ); 318 319 writeStream.WriteL( *key ); 319 writeStream.WriteInt32L( value->Length() ); 320 writeStream.WriteL( *value ); 321 TInt* size = iSizeMap.Find( *key ); 322 if ( size ) 323 writeStream.WriteInt32L( *size ); 324 else 325 writeStream.WriteInt32L( 0 ); 320 writeStream.WriteInt32L( pref->Value().Length() ); 321 writeStream.WriteL( pref->Value() ); 322 writeStream.WriteInt32L( pref->ValueSize() ); 326 323 } 327 324 … … 336 333 // ---------------------------------------------------------------------------- 337 334 // CWidgetPreferences::LoadL 338 // 335 // Load preferences from persistent storage 339 336 // 340 337 // … … 379 376 TPtr ptrvalue = value->Des(); 380 377 readStream.ReadL( ptrvalue, len ); 381 iMap.InsertL( key, value ); 382 TInt *size = new TInt ( readStream.ReadInt32L() ); 383 // make a copy of key and insert that 384 HBufC* newKey = key->AllocLC(); 385 iSizeMap.InsertL( newKey, size ); 386 CleanupStack::Pop( 3 ); //newKey,value,key 378 CPrefElement* pref = new ( ELeave ) CPrefElement; 379 CleanupStack::PushL( pref ); 380 pref->SetValueL( ptrvalue ); 381 TInt size = readStream.ReadInt32L(); 382 pref->SetValueSize( size ); 383 iPreferences.InsertL( key, pref ); 384 CleanupStack::Pop(); //pref 385 CleanupStack::PopAndDestroy(); //value 386 CleanupStack::Pop(); //key 387 387 } 388 388 else … … 403 403 } 404 404 } 405 405 406 // ---------------------------------------------------------------------------- 407 // CPrefElement::CPrefElement 408 // C++ constructor 409 // 410 // 411 // ---------------------------------------------------------------------------- 412 CPrefElement::CPrefElement() 413 { 414 } 415 416 417 // ---------------------------------------------------------------------------- 418 // CPrefElement::~CPrefElement 419 // Destructor 420 // 421 // 422 // ---------------------------------------------------------------------------- 423 CPrefElement::~CPrefElement() 424 { 425 delete iValue; 426 } 427 428 429 // ---------------------------------------------------------------------------- 430 // CPrefElement::SetValueL 431 // Set value for a preference 432 // 433 // 434 // ---------------------------------------------------------------------------- 435 void CPrefElement::SetValueL( const TDesC& aValue ) 436 { 437 if ( !iValue ) 438 { 439 iValue = aValue.AllocL(); 440 return; 441 } 442 443 if ( aValue.Length() > iValue->Length() ) 444 { 445 delete iValue; 446 iValue = NULL; 447 iValue = aValue.AllocL(); 448 } 449 else 450 { 451 *iValue = aValue; 452 if ( aValue.Length() < iValue->Length() ) 453 iValue = iValue->ReAllocL( aValue.Length() ); // reclaim space 454 } 455 } -
S60/branches/3.1m/WebKit/ChangeLog
r23928 r24160 1 2007-07-03 rathnasa <sornalatha.rathnasamy@nokia.com> 2 3 Reviewed by zbujtas@gmail.com. 4 DESC: merge fixes SYAI-73AS6K and SYAI-73ARXK from 3.2 5 http://bugs.webkit.org/show_bug.cgi?id=14389 6 7 * BrowserControl/inc/BrCtlDefs.h: 8 (TBrCtlDefs::): 9 * BrowserControl/inc/BrCtlInterface.h: 10 * BrowserView/inc/WidgetExtension.h: 11 * BrowserView/inc/WidgetPreferences.h: 12 (CPrefElement::SetValueSize): 13 (CPrefElement::Value): 14 (CPrefElement::ValueSize): 15 * BrowserView/src/WidgetExtension.cpp: 16 (CWidgetExtension::AddOptionMenuItemsL): 17 (CWidgetExtension::AddMenuItem): 18 (CWidgetExtension::AddOptionsMenuItem): 19 (CWidgetExtension::SetRightSoftKeyLabel): 20 (CWidgetExtension::Append): 21 (CWidgetExtension::DeleteMenuItem): 22 (CWidgetExtension::ReplaceMenuItem): 23 (CWidgetExtension::GetFromMenuItemCollection): 24 (CWidgetExtension::SetDimmed): 25 (CWidgetExtension::SetMenuItemObserver): 26 (CWidgetExtension::MenuItemObserver): 27 (CWidgetExtension::FindNodeById): 28 (CWidgetExtension::FindNodeByText): 29 (CWidgetExtension::HideSoftkeys): 30 (CWidgetExtension::ShowSoftkeys): 31 (CWidgetExtension::SetDisplayLandscape): 32 (CWidgetExtension::SetDisplayPortrait): 33 * BrowserView/src/WidgetPreferences.cpp: 34 (CWidgetPreferences::CWidgetPreferences): 35 (CWidgetPreferences::~CWidgetPreferences): 36 (CWidgetPreferences::PreferenceL): 37 (CWidgetPreferences::SetPreferenceL): 38 (CWidgetPreferences::SaveL): 39 (CWidgetPreferences::LoadL): 40 (CPrefElement::CPrefElement): 41 (CPrefElement::~CPrefElement): 42 (CPrefElement::SetValueL): 43 1 44 brad, rs'd by sachin. 2 45
Note: See TracChangeset
for help on using the changeset viewer.