271 DEBUG(("_MM_:CHnRepositoryShowFolderObserver::HandleNotifyStringL IN")); |
271 DEBUG(("_MM_:CHnRepositoryShowFolderObserver::HandleNotifyStringL IN")); |
272 DEBUG(("\tID: %d : %S", aId, &aNewValue)); |
272 DEBUG(("\tID: %d : %S", aId, &aNewValue)); |
273 |
273 |
274 //++Show Folder |
274 //++Show Folder |
275 if( aId == iId && aNewValue.Length()) |
275 if( aId == iId && aNewValue.Length()) |
276 { |
276 { |
277 iNotifyType = 0; |
277 iNotifyType = 0; |
278 ExtractCRKeyShowFolderName( aNewValue ); |
278 ExtractCRKeyShowFolderName( aNewValue ); |
279 |
279 |
280 // iCRKeyFolderItemUid can contain mcs id or uid |
280 // iCRKeyFolderItemUid can contain mcs id or uid |
281 // in case of uid it will be replaced whith id in HandleNotifyL callback |
281 // in case of uid it will be replaced whith id in HandleNotifyL callback |
282 if( iCRKeyFolderItemUid.Length()>0 ) |
282 if( iCRKeyFolderItemUid.Length()>0 ) |
283 { |
283 { |
284 if( iCRKeyFolderItemUid.FindF( KHexPrefix8 )==0 ) |
284 if( iCRKeyFolderItemUid.FindF( KHexPrefix8 )==0 ) |
285 { |
285 { |
286 iNotifyType |= EAPP_UID; |
286 iNotifyType |= EAPP_UID; |
287 } |
287 } |
288 else |
288 else |
289 { |
289 { |
290 iNotifyType |= EAPP_ID; |
290 iNotifyType |= EAPP_ID; |
291 } |
291 } |
292 } |
292 } |
293 |
293 |
294 CHnMdBaseKey* inDataKey = HnMdKeyFactory::CreateL( |
294 CHnMdBaseKey* inDataKey = HnMdKeyFactory::CreateL( |
295 KInData8, KKeyTypeMap, KDefaultParentId8 ); |
295 KInData8, KKeyTypeMap, KDefaultParentId8 ); |
296 CleanupStack::PushL( inDataKey ); |
296 CleanupStack::PushL( inDataKey ); |
297 |
297 |
390 if( id ) |
390 if( id ) |
391 { |
391 { |
392 CleanupStack::PopAndDestroy( id ); |
392 CleanupStack::PopAndDestroy( id ); |
393 } |
393 } |
394 CleanupStack::PopAndDestroy( inDataKey ); |
394 CleanupStack::PopAndDestroy( inDataKey ); |
395 } |
395 } |
396 |
396 |
397 DEBUG(("_MM_:CHnRepositoryShowFolderObserver::HandleNotifyStringL OUT")); |
397 DEBUG(("_MM_:CHnRepositoryShowFolderObserver::HandleNotifyStringL OUT")); |
398 |
398 |
399 } |
399 } |
400 |
400 |
401 // --------------------------------------------------------------------------- |
401 // --------------------------------------------------------------------------- |
402 // |
402 // |
403 // --------------------------------------------------------------------------- |
403 // --------------------------------------------------------------------------- |
404 // |
404 // |
405 void CHnRepositoryShowFolderObserver::ExtractCRKeyShowFolderName( const TDesC& aNewValue ) |
405 void CHnRepositoryShowFolderObserver::ExtractCRKeyShowFolderName( const TDesC& aNewValue ) |
406 { |
406 { |
407 DEBUG(( "_MM_:CHnRepositoryShowFolderObserver::ExtractCRKeyShowFolderName IN" )); |
407 DEBUG(( "_MM_:CHnRepositoryShowFolderObserver::ExtractCRKeyShowFolderName IN" )); |
408 iCRKeyFolderName.Copy( KBlank ); |
408 iCRKeyFolderName.Copy( KBlank ); |
409 iCRKeyFolderItemUid.Copy( KBlank ); |
409 iCRKeyFolderItemUid.Copy( KBlank ); |
410 |
410 |
411 int keyValueLength = aNewValue.Length(); |
411 int keyValueLength = aNewValue.Length(); |
412 if( keyValueLength ) |
412 if( keyValueLength ) |
413 { |
413 { |
414 TApaAppGroupName folder; |
414 TApaAppGroupName folder; |
415 TBuf<KTimeStampBufferLength + KUidStringLength + 1> tempBuf; |
415 TBuf<KTimeStampBufferLength + KUidStringLength + 1> tempBuf; |
416 TBuf<KTimeStampBufferLength> timeStamp; |
416 TBuf<KTimeStampBufferLength> timeStamp; |
417 |
417 |
418 TInt ret = aNewValue.Find( KComma ); |
418 TInt ret = aNewValue.Find( KComma ); |
419 if( (ret == KErrNotFound )|| ( ret == ( keyValueLength-1 ) ) ) |
419 if( (ret == KErrNotFound )|| ( ret == ( keyValueLength-1 ) ) ) |
420 { |
420 { |
421 DEBUG(( "_MM_:CHnRepositoryShowFolderObserver::ExtractCRKeyShowFolderName (bad CR key value input) OUT" )); |
421 DEBUG(( "_MM_:CHnRepositoryShowFolderObserver::ExtractCRKeyShowFolderName (bad CR key value input) OUT" )); |
422 return; //bad CR key value input |
422 return; //bad CR key value input |
423 } |
423 } |
424 if( ret>KApaMaxAppGroupName ) |
424 if( ret>KApaMaxAppGroupName ) |
425 { |
425 { |
426 return; |
426 return; |
427 } |
427 } |
428 folder.Copy(aNewValue.Left(ret)); |
428 folder.Copy(aNewValue.Left(ret)); |
429 if( aNewValue.Length()-ret > tempBuf.MaxLength() ) |
429 if( aNewValue.Length()-ret > tempBuf.MaxLength() ) |
430 { |
430 { |
431 return; |
431 return; |
432 } |
432 } |
433 tempBuf.Copy(aNewValue.Mid( ret + 1 ) ); |
433 tempBuf.Copy(aNewValue.Mid( ret + 1 ) ); |
434 |
434 |
435 TInt posUid = tempBuf.Find( KComma ); |
435 TInt posUid = tempBuf.Find( KComma ); |
436 if ( KErrNotFound != posUid ) |
436 if ( KErrNotFound != posUid ) |
437 { |
437 { |
438 if( posUid>KTimeStampBufferLength ) |
438 if( posUid>KTimeStampBufferLength ) |
439 { |
439 { |
440 return; |
440 return; |
441 } |
441 } |
442 timeStamp.Copy( tempBuf.Left(posUid) ); |
442 timeStamp.Copy( tempBuf.Left(posUid) ); |
443 if( tempBuf.Length()-(posUid+1) > KUidStringLength ) |
443 if( tempBuf.Length()-(posUid+1) > KUidStringLength ) |
444 { |
444 { |
445 return; |
445 return; |
446 } |
446 } |
447 iCRKeyFolderItemUid.Copy( tempBuf.Mid( posUid + 1 ) ); |
447 iCRKeyFolderItemUid.Copy( tempBuf.Mid( posUid + 1 ) ); |
448 } |
448 } |
449 else |
449 else |
450 { |
450 { |
451 if( tempBuf.Length()>KTimeStampBufferLength ) |
451 if( tempBuf.Length()>KTimeStampBufferLength ) |
452 { |
452 { |
453 return; |
453 return; |
454 } |
454 } |
455 timeStamp.Copy( tempBuf ); |
455 timeStamp.Copy( tempBuf ); |
456 } |
456 } |
457 |
457 |
458 TTime currentTime; |
458 TTime currentTime; |
459 currentTime.HomeTime(); |
459 currentTime.HomeTime(); |
460 TTimeIntervalSeconds interval; |
460 TTimeIntervalSeconds interval; |
461 |
461 |
462 TTime timeStampTime; |
462 TTime timeStampTime; |
463 ret = timeStampTime.Set(timeStamp); |
463 ret = timeStampTime.Set(timeStamp); |
464 |
464 |
465 if(ret == KErrGeneral ) |
465 if(ret == KErrGeneral ) |
466 { |
466 { |
467 DEBUG(( "_MM_:CHnRepositoryShowFolderObserver::ExtractCRKeyShowFolderName (bad timestamp) OUT" )); |
467 DEBUG(( "_MM_:CHnRepositoryShowFolderObserver::ExtractCRKeyShowFolderName (bad timestamp) OUT" )); |
468 return; // bad time stamp value |
468 return; // bad time stamp value |
469 } |
469 } |
470 |
470 |
471 ret = currentTime.SecondsFrom( timeStampTime, interval ); |
471 ret = currentTime.SecondsFrom( timeStampTime, interval ); |
472 |
472 |
473 if( interval.Int() < 0 ) |
473 if( interval.Int() < 0 ) |
474 {//negative timestamp is set ahead of current time...! |
474 {//negative timestamp is set ahead of current time...! |
475 DEBUG(( "_MM_:CHnRepositoryShowFolderObserver::ExtractCRKeyShowFolderName (negative interval) OUT" )); |
475 DEBUG(( "_MM_:CHnRepositoryShowFolderObserver::ExtractCRKeyShowFolderName (negative interval) OUT" )); |
476 return; |
476 return; |
477 } |
477 } |
478 |
478 |
479 if(( interval.Int()) > KTimeStampCutOff ) |
479 if(( interval.Int()) > KTimeStampCutOff ) |
480 {//positive timestamp but more than 5 seconds |
480 {//positive timestamp but more than 5 seconds |
481 DEBUG(( "_MM_:CHnRepositoryShowFolderObserver::ExtractCRKeyShowFolderName (more than 5 seconds) OUT" )); |
481 DEBUG(( "_MM_:CHnRepositoryShowFolderObserver::ExtractCRKeyShowFolderName (more than 5 seconds) OUT" )); |
482 return; |
482 return; |
483 } |
483 } |
484 else |
484 else |
485 { |
485 { |
486 iCRKeyFolderName.Copy(folder); |
486 iCRKeyFolderName.Copy(folder); |
487 } |
487 } |
488 } |
488 } |
489 DEBUG(( "_MM_:CHnRepositoryShowFolderObserver::ExtractCRKeyShowFolderName OUT" )); |
489 DEBUG(( "_MM_:CHnRepositoryShowFolderObserver::ExtractCRKeyShowFolderName OUT" )); |
490 } |
490 } |
491 |
491 |
492 // --------------------------------------------------------------------------- |
492 // --------------------------------------------------------------------------- |
493 // |
493 // |
494 // --------------------------------------------------------------------------- |
494 // --------------------------------------------------------------------------- |
495 // |
495 // |
767 CleanupStack::PopAndDestroy( &varSuiteName ); |
766 CleanupStack::PopAndDestroy( &varSuiteName ); |
768 CleanupStack::PopAndDestroy( &varAppGroupName ); |
767 CleanupStack::PopAndDestroy( &varAppGroupName ); |
769 CleanupStack::PopAndDestroy( &varId ); |
768 CleanupStack::PopAndDestroy( &varId ); |
770 } |
769 } |
771 |
770 |
772 DEBUG(("_MM_:CHnRepositoryShowFolderObserver::HandleNotifyL OUT")); |
771 DEBUG(("_MM_:CHnRepositoryShowFolderObserver::HandleNotifyL OUT")); |
773 return KErrNone; |
772 return KErrNone; |
774 } |
773 } |
775 |
|
776 // --------------------------------------------------------------------------- |
|
777 // |
|
778 // --------------------------------------------------------------------------- |
|
779 // |
|
780 void CHnRepositoryShowFolderObserver::HandleSuiteEventL ( THnCustomSuiteEvent aCustomSuiteEvent, |
|
781 CHnSuiteModel *aModel ) |
|
782 { |
|
783 |
|
784 if ( aCustomSuiteEvent == ESuiteModelInitialized && iCRKeyFolderItemUid.Length() > 0 ) |
|
785 { |
|
786 if (iCRKeyFolderItemUid.Length() > 0 ) |
|
787 { |
|
788 TLex8 lex( iCRKeyFolderItemUid ); |
|
789 TInt64 id (0); |
|
790 TInt err = lex.Val( id ); |
|
791 TInt focus( KErrNotFound ); |
|
792 // If suite is not null, then find matching item model. |
|
793 CHnItemModel* itemModel = aModel->GetMatchingItemModelL( id, focus ); |
|
794 aModel->SetSuiteHighlightL( focus ); |
|
795 } |
|
796 iCRKeyFolderItemUid.Copy( KBlank ); |
|
797 aModel->UnregisterSuiteObserver( this ); |
|
798 CLiwGenericParamList* pl = CLiwGenericParamList::NewL(); |
|
799 CleanupStack::PushL( pl ); |
|
800 iCmnPtrs->iModelEventObserver->HandleModelEventL( KAppGainForeground, *pl ); |
|
801 CleanupStack::PopAndDestroy( pl ); |
|
802 } |
|
803 } |
|
804 |
774 |
805 // End of File |
775 // End of File |