47 _LIT8( KProperValueSuite, "suite" ); |
47 _LIT8( KProperValueSuite, "suite" ); |
48 _LIT8( KProperValueBookmark, "bookmark" ); |
48 _LIT8( KProperValueBookmark, "bookmark" ); |
49 _LIT8( KProperValueAppl, "application" ); |
49 _LIT8( KProperValueAppl, "application" ); |
50 _LIT8( KProperValueMailbox, "mailbox" ); |
50 _LIT8( KProperValueMailbox, "mailbox" ); |
51 _LIT( KMenuTypeMailbox, "menu:mailbox" ); |
51 _LIT( KMenuTypeMailbox, "menu:mailbox" ); |
|
52 _LIT8( KMenuAttrInvokeSettingsUid, "0x99999990" ); |
52 |
53 |
53 using namespace HSPluginSettingsIf; |
54 using namespace HSPluginSettingsIf; |
54 |
55 |
55 // ======== LOCAL FUNCTIONS ======== |
56 // ======== LOCAL FUNCTIONS ======== |
56 |
57 |
228 // --------------------------------------------------------------------------- |
229 // --------------------------------------------------------------------------- |
229 // |
230 // |
230 TSettingItem CMCSPluginSettingsModel::ItemL( |
231 TSettingItem CMCSPluginSettingsModel::ItemL( |
231 RPointerArray<HSPluginSettingsIf::CPropertyMap>& aProperties ) |
232 RPointerArray<HSPluginSettingsIf::CPropertyMap>& aProperties ) |
232 { |
233 { |
233 TSettingItem setting = { KErrNotFound, EApplication , EFalse }; |
234 TSettingItem setting = { KErrNotFound, EApplication , EFalse, EFalse }; |
234 |
235 |
235 TSettingType type = SettingTypeL( aProperties ); |
236 TSettingType type = SettingTypeL( aProperties ); |
236 if ( type == EApplication || type == EMailbox ) |
237 if ( type == EApplication || type == EMailbox ) |
237 { |
238 { |
238 setting = iAppList->FindItemL( aProperties ); |
239 setting = iAppList->FindItemL( aProperties ); |
241 { |
242 { |
242 setting = iBkmList->FindItemL( aProperties ); |
243 setting = iBkmList->FindItemL( aProperties ); |
243 } |
244 } |
244 |
245 |
245 setting.locked = SettingLockedL( aProperties ); |
246 setting.locked = SettingLockedL( aProperties ); |
246 |
247 setting.empty = SettingEmptyL( aProperties ); |
|
248 |
247 return setting; |
249 return setting; |
248 } |
250 } |
249 |
251 |
250 // --------------------------------------------------------------------------- |
252 // --------------------------------------------------------------------------- |
251 // Gets Type (application or bookmark) of given HSPS entry |
253 // Gets Type (application or bookmark) of given HSPS entry |
289 TPtrC8 name = aProperties[i]->Name(); |
291 TPtrC8 name = aProperties[i]->Name(); |
290 if( name == KProperNameLocked ) |
292 if( name == KProperNameLocked ) |
291 { |
293 { |
292 TPtrC8 value = aProperties[i]->Value(); |
294 TPtrC8 value = aProperties[i]->Value(); |
293 if( value == KTrue ) |
295 if( value == KTrue ) |
|
296 { |
|
297 return ETrue; |
|
298 } |
|
299 } |
|
300 } |
|
301 |
|
302 return EFalse; |
|
303 } |
|
304 |
|
305 // --------------------------------------------------------------------------- |
|
306 // Gets empty status of given HSPS entry |
|
307 // --------------------------------------------------------------------------- |
|
308 // |
|
309 TBool CMCSPluginSettingsModel::SettingEmptyL( |
|
310 RPointerArray<HSPluginSettingsIf::CPropertyMap>& aProperties ) |
|
311 { |
|
312 |
|
313 for( TInt i = 0; i <aProperties.Count(); i++ ) |
|
314 { |
|
315 TPtrC8 name = aProperties[i]->Name(); |
|
316 if( name == KProperNameUid ) |
|
317 { |
|
318 TPtrC8 value = aProperties[i]->Value(); |
|
319 if( value.Compare(KMenuAttrInvokeSettingsUid) == 0 ) |
294 { |
320 { |
295 return ETrue; |
321 return ETrue; |
296 } |
322 } |
297 } |
323 } |
298 } |
324 } |
400 properties[ i ]->SetValueL( KNullDesC8 ); |
426 properties[ i ]->SetValueL( KNullDesC8 ); |
401 } |
427 } |
402 } |
428 } |
403 else if ( properties[ i ]->Name() == KProperNameView ) |
429 else if ( properties[ i ]->Name() == KProperNameView ) |
404 { |
430 { |
405 TPtrC view = aMenuItem.GetAttributeL( KMenuAttrView, exists ); |
431 TPtrC type = aMenuItem.Type(); |
|
432 TPtrC attr; |
|
433 if ( type == KMenuTypeUrl ) |
|
434 { |
|
435 // In case of bookmark type item, bookmark URL is stored to view property |
|
436 attr.Set( KMenuAttrUrl ); |
|
437 } |
|
438 else |
|
439 { |
|
440 attr.Set( KMenuAttrView ); |
|
441 } |
|
442 TPtrC view = aMenuItem.GetAttributeL( attr, exists ); |
406 if( exists && view.Length() > 0 ) |
443 if( exists && view.Length() > 0 ) |
407 { |
444 { |
408 HBufC8* view8( NULL ); |
445 HBufC8* view8( NULL ); |
409 view8 = AiUtility::CopyToBufferL( view8, view ); |
446 view8 = AiUtility::CopyToBufferL( view8, view ); |
410 CleanupStack::PushL( view8 ); |
447 CleanupStack::PushL( view8 ); |
468 } |
505 } |
469 } |
506 } |
470 } |
507 } |
471 } |
508 } |
472 |
509 |
473 // ETrue tells that modified settings are stored also to plugin reference |
510 // EFalse tells that modified settings are not stored to plugin reference |
474 User::LeaveIfError( iPluginSettings->SetSettingsL( *iPluginId, settingItems, ETrue ) ); |
511 User::LeaveIfError( iPluginSettings->SetSettingsL( *iPluginId, settingItems, EFalse ) ); |
475 CleanupStack::PopAndDestroy(); // settingItems |
512 CleanupStack::PopAndDestroy(); // settingItems |
476 } |
513 } |
477 |
514 |
478 // --------------------------------------------------------------------------- |
515 // --------------------------------------------------------------------------- |
479 // Updates settings container. |
516 // Updates settings container. |
513 if ( iSettings[aIndex].type == EApplication ) |
550 if ( iSettings[aIndex].type == EApplication ) |
514 { |
551 { |
515 // first, we need to check if the item is missing |
552 // first, we need to check if the item is missing |
516 // (application uninstalled or mmc card removed) |
553 // (application uninstalled or mmc card removed) |
517 // If it is, we return "Undefined" application name instead |
554 // If it is, we return "Undefined" application name instead |
|
555 // In case of empty item, it's own name is returned |
518 if ( iSettings[ aIndex ].id == KErrNotFound ) |
556 if ( iSettings[ aIndex ].id == KErrNotFound ) |
519 { |
557 { |
520 const TDesC& caption = iAppList->UndefinedText(); |
558 if ( iSettings[ aIndex ].empty ) |
521 TRAP_IGNORE( line.Set( ListBoxLineL( caption, aIndex ) ) ) |
559 { |
|
560 const TDesC& caption = iAppList->EmptyText(); |
|
561 TRAP_IGNORE( line.Set( ListBoxLineL( caption, aIndex ) ) ) |
|
562 } |
|
563 else |
|
564 { |
|
565 const TDesC& caption = iAppList->UndefinedText(); |
|
566 TRAP_IGNORE( line.Set( ListBoxLineL( caption, aIndex ) ) ) |
|
567 } |
522 } |
568 } |
523 else |
569 else |
524 { |
570 { |
525 const TDesC& caption = iAppList->MdcaPoint( iSettings[ aIndex ].id ); |
571 const TDesC& caption = iAppList->MdcaPoint( iSettings[ aIndex ].id ); |
526 TRAP_IGNORE( line.Set( ListBoxLineL( caption, aIndex ) ) ) |
572 TRAP_IGNORE( line.Set( ListBoxLineL( caption, aIndex ) ) ) |
553 // Returns a pointer to setting item for the given index |
599 // Returns a pointer to setting item for the given index |
554 // --------------------------------------------------------------------------- |
600 // --------------------------------------------------------------------------- |
555 // |
601 // |
556 const TSettingItem CMCSPluginSettingsModel::Item( TInt aIndex ) const |
602 const TSettingItem CMCSPluginSettingsModel::Item( TInt aIndex ) const |
557 { |
603 { |
558 TSettingItem setting = { KErrNotFound, EApplication, EFalse }; |
604 TSettingItem setting = { KErrNotFound, EApplication, EFalse, EFalse }; |
559 |
605 |
560 if ( aIndex >= 0 && aIndex < iSettings.Count() ) |
606 if ( aIndex >= 0 && aIndex < iSettings.Count() ) |
561 { |
607 { |
562 setting = iSettings[ aIndex ]; |
608 setting = iSettings[ aIndex ]; |
563 } |
609 } |