menufw/hierarchynavigator/hnmetadatamodel/src/hnrepositoryobserver.cpp
branchRCL_3
changeset 93 b01126ce0bec
parent 88 3321d3e205b6
child 102 ba63c83f4716
--- a/menufw/hierarchynavigator/hnmetadatamodel/src/hnrepositoryobserver.cpp	Tue Sep 14 20:58:58 2010 +0300
+++ b/menufw/hierarchynavigator/hnmetadatamodel/src/hnrepositoryobserver.cpp	Wed Sep 15 12:00:00 2010 +0300
@@ -227,9 +227,8 @@
     {
     CHnRepositoryObserver::ConstructL( aRepositoryUid );
     TInt ret = iRepository->Create( iId, KBlank );
-    iNotifyHandler = CCenRepNotifyHandler::NewL(
-        *this, *iRepository,
-      CCenRepNotifyHandler::EStringKey, iId );
+    iNotifyHandler = CCenRepNotifyHandler::NewL( *this, *iRepository,
+            CCenRepNotifyHandler::EStringKey, iId );
     iNotifyHandler->StartListeningL();
     }
 
@@ -273,129 +272,128 @@
 
     //++Show Folder
     if( aId == iId && aNewValue.Length())
-    {
+        {
         iNotifyType = 0;
-    ExtractCRKeyShowFolderName( aNewValue );
+        ExtractCRKeyShowFolderName( aNewValue );
+
+        // iCRKeyFolderItemUid can contain mcs id or uid
+        // in case of uid it will be replaced whith id in HandleNotifyL callback
+        if( iCRKeyFolderItemUid.Length()>0 )
+            {
+            if( iCRKeyFolderItemUid.FindF( KHexPrefix8 )==0 )
+                {
+                iNotifyType |= EAPP_UID;
+                }
+            else
+                {
+                iNotifyType |= EAPP_ID;
+                }
+            }
+
+            CHnMdBaseKey* inDataKey = HnMdKeyFactory::CreateL(
+                KInData8, KKeyTypeMap, KDefaultParentId8 );
+            CleanupStack::PushL( inDataKey );
+
+            CHnMdBaseKey* filter( NULL );
+            HBufC8* id( NULL );
+            if ( iCRKeyFolderName.Length()>0 && !( iNotifyType & EAPP_UID ) )
+                {
+                // app group name is known
+                // id is optional
+                id = HnConvUtils::NumToStr8LC( KRootId );
+                inDataKey->AddSubKeyL( HnMdKeyFactory::CreateL( KType8, KKeyTypeString, KMenuFolder8 ) );
+                inDataKey->AddSubKeyL( HnMdKeyFactory::CreateL( KIdParam, KKeyTypeInteger, *id ) );
+                inDataKey->AddSubKeyL( HnMdKeyFactory::CreateL( KRecursiveSearch8, KKeyTypeBoolean, KStringTrue8 ) );
+                inDataKey->AddSubKeyL( HnMdKeyFactory::CreateL( KFlatResult8, KKeyTypeBoolean, KStringTrue8 ) );
+
+                filter = HnMdKeyFactory::CreateL(
+                        KFilter8, KKeyTypeMap, KStringTrue8 );
+                CleanupStack::PushL( filter );
+                filter->AddSubKeyL( HnMdKeyFactory::CreateL( KMcsAppGroupName8, KKeyTypeString, iCRKeyFolderName ) );
+                filter->AddSubKeyL( HnMdKeyFactory::CreateL( KType8, KKeyTypeString, KMenuFolder8 ) );
+                filter->AddSubKeyL( HnMdKeyFactory::CreateL( KHidden8, KKeyTypeBoolean, KStringFalse8 ) );
+                }
+            else if( iNotifyType & EAPP_ID )
+                {
+                // no app group name, id is known
+                inDataKey->AddSubKeyL( HnMdKeyFactory::CreateL( KType8, KKeyTypeString, KMenuApplication8 ) );
+                inDataKey->AddSubKeyL( HnMdKeyFactory::CreateL( KIdParam, KKeyTypeInteger, iCRKeyFolderItemUid ) );
+                inDataKey->AddSubKeyL( HnMdKeyFactory::CreateL( KParentOnly8, KKeyTypeBoolean, KStringTrue8 ) );
+                }
+            else if( iNotifyType & EAPP_UID )
+                {
+                // uid is known
+                // app group name is optional
+                id = HnConvUtils::NumToStr8LC( KRootId );
+                inDataKey->AddSubKeyL( HnMdKeyFactory::CreateL( KType8, KKeyTypeString, KMenuFolder8 ) );
+                inDataKey->AddSubKeyL( HnMdKeyFactory::CreateL( KIdParam, KKeyTypeInteger, *id ) );
+                inDataKey->AddSubKeyL( HnMdKeyFactory::CreateL( KRecursiveSearch8, KKeyTypeBoolean, KStringTrue8 ) );
+                inDataKey->AddSubKeyL( HnMdKeyFactory::CreateL( KFlatResult8, KKeyTypeBoolean, KStringTrue8 ) );
 
-    // iCRKeyFolderItemUid can contain mcs id or uid
-    // in case of uid it will be replaced whith id in HandleNotifyL callback
-    if( iCRKeyFolderItemUid.Length()>0 )
-        {
-        if( iCRKeyFolderItemUid.FindF( KHexPrefix8 )==0 )
-            {
-            iNotifyType |= EAPP_UID;
-            }
-        else
-            {
-            iNotifyType |= EAPP_ID;
-            }
+                filter = HnMdKeyFactory::CreateL(
+                    KFilter8, KKeyTypeMap, KStringTrue8 );
+                CleanupStack::PushL( filter );
+                filter->AddSubKeyL( HnMdKeyFactory::CreateL( KUid8, KKeyTypeInteger, iCRKeyFolderItemUid ) );
+                filter->AddSubKeyL( HnMdKeyFactory::CreateL( KType8, KKeyTypeString, KMenuApplication8 ) );
+                filter->AddSubKeyL( HnMdKeyFactory::CreateL( KHidden8, KKeyTypeBoolean, KStringFalse8 ) );
+                }
+            else
+                {
+                // No app group name, no uid. Search for root.
+                id = HnConvUtils::NumToStr8LC( KRootId );
+                inDataKey->AddSubKeyL( HnMdKeyFactory::CreateL( KType8, KKeyTypeString, KMenuFolder8 ) );
+                inDataKey->AddSubKeyL( HnMdKeyFactory::CreateL( KIdParam, KKeyTypeInteger, *id ) );
+                inDataKey->AddSubKeyL( HnMdKeyFactory::CreateL( KParentOnly8, KKeyTypeBoolean, KStringTrue8 ) );
+                }
+
+            RPointerArray< CHnMdBaseKey > data;
+            CleanupClosePushL( data );
+            data.AppendL( inDataKey );
+            if ( filter )
+                {
+                data.AppendL( filter );
+                }
+
+            CHnMdBaseKey* serviceData = HnMdKeyFactory::CreateL(
+                KServiceContentName, KKeyTypeString, KMatrixMenuData );
+            CleanupStack::PushL( serviceData );
+
+            RPointerArray< CHnMdBaseKey> constructor;
+            CleanupClosePushL( constructor );
+            constructor.AppendL( serviceData );
+            CLiwGenericParamList* constructorLiw = CLiwGenericParamList::NewLC();
+            CLiwGenericParamList* commandLiw = CLiwGenericParamList::NewLC();
+            HnLiwUtils::SetGenericParamListL( constructor, *constructorLiw );
+            HnLiwUtils::SetGenericParamListL( data, *commandLiw );
+
+            TBuf8< KMaxLength > interface( KMCSDataSourceInterface8 );
+
+            delete iServiceHandler;
+            iServiceHandler = NULL;
+            iServiceHandler = CHnServiceHandler::NewL(
+                    KMCSService8, interface, KCmdGetList8,
+                    EServiceModeAsynchronous, constructorLiw, commandLiw );
+
+            CleanupStack::Pop( commandLiw );
+            CleanupStack::Pop( constructorLiw );
+
+            iServiceHandler->ExecuteL( this );
+
+            CleanupStack::PopAndDestroy( &constructor );
+            CleanupStack::PopAndDestroy( serviceData );
+            CleanupStack::PopAndDestroy( &data );
+            if( filter )
+                {
+                CleanupStack::PopAndDestroy( filter );
+                }
+            if( id )
+                {
+                CleanupStack::PopAndDestroy( id );
+                }
+            CleanupStack::PopAndDestroy( inDataKey );
         }
 
-        CHnMdBaseKey* inDataKey = HnMdKeyFactory::CreateL(
-            KInData8, KKeyTypeMap, KDefaultParentId8 );
-        CleanupStack::PushL( inDataKey );
-
-        CHnMdBaseKey* filter( NULL );
-        HBufC8* id( NULL );
-        if ( iCRKeyFolderName.Length()>0 && !( iNotifyType & EAPP_UID ) )
-            {
-            // app group name is known
-            // id is optional
-            id = HnConvUtils::NumToStr8LC( KRootId );
-            inDataKey->AddSubKeyL( HnMdKeyFactory::CreateL( KType8, KKeyTypeString, KMenuFolder8 ) );
-            inDataKey->AddSubKeyL( HnMdKeyFactory::CreateL( KIdParam, KKeyTypeInteger, *id ) );
-            inDataKey->AddSubKeyL( HnMdKeyFactory::CreateL( KRecursiveSearch8, KKeyTypeBoolean, KStringTrue8 ) );
-            inDataKey->AddSubKeyL( HnMdKeyFactory::CreateL( KFlatResult8, KKeyTypeBoolean, KStringTrue8 ) );
-
-            filter = HnMdKeyFactory::CreateL(
-                    KFilter8, KKeyTypeMap, KStringTrue8 );
-            CleanupStack::PushL( filter );
-            filter->AddSubKeyL( HnMdKeyFactory::CreateL( KMcsAppGroupName8, KKeyTypeString, iCRKeyFolderName ) );
-            filter->AddSubKeyL( HnMdKeyFactory::CreateL( KType8, KKeyTypeString, KMenuFolder8 ) );
-            filter->AddSubKeyL( HnMdKeyFactory::CreateL( KHidden8, KKeyTypeBoolean, KStringFalse8 ) );
-            }
-        else if( iNotifyType & EAPP_ID )
-            {
-            // no app group name, id is known
-            inDataKey->AddSubKeyL( HnMdKeyFactory::CreateL( KType8, KKeyTypeString, KMenuApplication8 ) );
-            inDataKey->AddSubKeyL( HnMdKeyFactory::CreateL( KIdParam, KKeyTypeInteger, iCRKeyFolderItemUid ) );
-            inDataKey->AddSubKeyL( HnMdKeyFactory::CreateL( KParentOnly8, KKeyTypeBoolean, KStringTrue8 ) );
-            }
-        else if( iNotifyType & EAPP_UID )
-            {
-            // uid is known
-            // app group name is optional
-            id = HnConvUtils::NumToStr8LC( KRootId );
-            inDataKey->AddSubKeyL( HnMdKeyFactory::CreateL( KType8, KKeyTypeString, KMenuFolder8 ) );
-            inDataKey->AddSubKeyL( HnMdKeyFactory::CreateL( KIdParam, KKeyTypeInteger, *id ) );
-            inDataKey->AddSubKeyL( HnMdKeyFactory::CreateL( KRecursiveSearch8, KKeyTypeBoolean, KStringTrue8 ) );
-            inDataKey->AddSubKeyL( HnMdKeyFactory::CreateL( KFlatResult8, KKeyTypeBoolean, KStringTrue8 ) );
-
-            filter = HnMdKeyFactory::CreateL(
-                KFilter8, KKeyTypeMap, KStringTrue8 );
-            CleanupStack::PushL( filter );
-            filter->AddSubKeyL( HnMdKeyFactory::CreateL( KUid8, KKeyTypeInteger, iCRKeyFolderItemUid ) );
-            filter->AddSubKeyL( HnMdKeyFactory::CreateL( KType8, KKeyTypeString, KMenuApplication8 ) );
-            filter->AddSubKeyL( HnMdKeyFactory::CreateL( KHidden8, KKeyTypeBoolean, KStringFalse8 ) );
-            }
-        else
-            {
-            // No app group name, no uid. Search for root.
-            id = HnConvUtils::NumToStr8LC( KRootId );
-            inDataKey->AddSubKeyL( HnMdKeyFactory::CreateL( KType8, KKeyTypeString, KMenuFolder8 ) );
-            inDataKey->AddSubKeyL( HnMdKeyFactory::CreateL( KIdParam, KKeyTypeInteger, *id ) );
-            inDataKey->AddSubKeyL( HnMdKeyFactory::CreateL( KParentOnly8, KKeyTypeBoolean, KStringTrue8 ) );
-            }
-
-        RPointerArray< CHnMdBaseKey > data;
-        CleanupClosePushL( data );
-        data.AppendL( inDataKey );
-        if ( filter )
-            {
-            data.AppendL( filter );
-            }
-
-        CHnMdBaseKey* serviceData = HnMdKeyFactory::CreateL(
-            KServiceContentName, KKeyTypeString, KMatrixMenuData );
-        CleanupStack::PushL( serviceData );
-
-        RPointerArray< CHnMdBaseKey> constructor;
-        CleanupClosePushL( constructor );
-        constructor.AppendL( serviceData );
-        CLiwGenericParamList* constructorLiw = CLiwGenericParamList::NewLC();
-        CLiwGenericParamList* commandLiw = CLiwGenericParamList::NewLC();
-        HnLiwUtils::SetGenericParamListL( constructor, *constructorLiw );
-        HnLiwUtils::SetGenericParamListL( data, *commandLiw );
-
-        TBuf8< KMaxLength > interface( KMCSDataSourceInterface8 );
-
-        delete iServiceHandler;
-        iServiceHandler = NULL;
-        iServiceHandler = CHnServiceHandler::NewL(
-                KMCSService8, interface, KCmdGetList8,
-                EServiceModeAsynchronous, constructorLiw, commandLiw );
-
-        CleanupStack::Pop( commandLiw );
-        CleanupStack::Pop( constructorLiw );
-
-        iServiceHandler->ExecuteL( this );
-
-        CleanupStack::PopAndDestroy( &constructor );
-        CleanupStack::PopAndDestroy( serviceData );
-        CleanupStack::PopAndDestroy( &data );
-        if( filter )
-            {
-            CleanupStack::PopAndDestroy( filter );
-            }
-        if( id )
-            {
-            CleanupStack::PopAndDestroy( id );
-            }
-        CleanupStack::PopAndDestroy( inDataKey );
-    }
-
     DEBUG(("_MM_:CHnRepositoryShowFolderObserver::HandleNotifyStringL OUT"));
-
     }
 
 // ---------------------------------------------------------------------------
@@ -403,91 +401,91 @@
 // ---------------------------------------------------------------------------
 //
 void CHnRepositoryShowFolderObserver::ExtractCRKeyShowFolderName( const TDesC& aNewValue )
-  {
-  DEBUG(( "_MM_:CHnRepositoryShowFolderObserver::ExtractCRKeyShowFolderName IN" ));
-  iCRKeyFolderName.Copy( KBlank );
-  iCRKeyFolderItemUid.Copy( KBlank );
+    {
+    DEBUG(( "_MM_:CHnRepositoryShowFolderObserver::ExtractCRKeyShowFolderName IN" ));
+    iCRKeyFolderName.Copy( KBlank );
+    iCRKeyFolderItemUid.Copy( KBlank );
 
-  int keyValueLength = aNewValue.Length();
-  if( keyValueLength )
-    {
-      TApaAppGroupName folder;
-          TBuf<KTimeStampBufferLength + KUidStringLength + 1> tempBuf;
-          TBuf<KTimeStampBufferLength> timeStamp;
+    int keyValueLength = aNewValue.Length();
+    if( keyValueLength )
+        {
+        TApaAppGroupName folder;
+        TBuf<KTimeStampBufferLength + KUidStringLength + 1> tempBuf;
+        TBuf<KTimeStampBufferLength> timeStamp;
 
-          TInt ret = aNewValue.Find( KComma );
-          if( (ret == KErrNotFound )|| ( ret == ( keyValueLength-1 ) ) )
-              {
-              DEBUG(( "_MM_:CHnRepositoryShowFolderObserver::ExtractCRKeyShowFolderName (bad CR key value input) OUT" ));
-            return;	//bad CR key value input
-              }
-          if( ret>KApaMaxAppGroupName )
-              {
-              return;
-              }
-          folder.Copy(aNewValue.Left(ret));
-          if( aNewValue.Length()-ret > tempBuf.MaxLength() )
-              {
-              return;
-              }
-          tempBuf.Copy(aNewValue.Mid( ret + 1 ) );
+        TInt ret = aNewValue.Find( KComma );
+        if( ( ret == KErrNotFound ) || ( ret == ( keyValueLength - 1 ) ) )
+            {
+            DEBUG(( "_MM_:CHnRepositoryShowFolderObserver::ExtractCRKeyShowFolderName (bad CR key value input) OUT" ));
+            return; //bad CR key value input
+            }
+        if( ret > KApaMaxAppGroupName )
+            {
+            return;
+            }
+        folder.Copy( aNewValue.Left( ret ) );
+        if( aNewValue.Length() - ret > tempBuf.MaxLength() )
+            {
+            return;
+            }
+        tempBuf.Copy( aNewValue.Mid( ret + 1 ) );
 
-          TInt posUid = tempBuf.Find( KComma );
-          if ( KErrNotFound != posUid )
+        TInt posUid = tempBuf.Find( KComma );
+        if( KErrNotFound != posUid )
             {
-            if( posUid>KTimeStampBufferLength )
+            if( posUid > KTimeStampBufferLength )
                 {
                 return;
                 }
-            timeStamp.Copy( tempBuf.Left(posUid) );
-            if( tempBuf.Length()-(posUid+1) > KUidStringLength )
+            timeStamp.Copy( tempBuf.Left( posUid ) );
+            if( tempBuf.Length() - ( posUid + 1 ) > KUidStringLength )
                 {
                 return;
                 }
             iCRKeyFolderItemUid.Copy( tempBuf.Mid( posUid + 1 ) );
             }
-          else
+        else
             {
-                if( tempBuf.Length()>KTimeStampBufferLength )
-                    {
-                    return;
-                    }
+            if( tempBuf.Length() > KTimeStampBufferLength )
+                {
+                return;
+                }
             timeStamp.Copy( tempBuf );
             }
 
-          TTime currentTime;
-          currentTime.HomeTime();
-          TTimeIntervalSeconds interval;
+        TTime currentTime;
+        currentTime.HomeTime();
+        TTimeIntervalSeconds interval;
 
-          TTime timeStampTime;
-          ret = timeStampTime.Set(timeStamp);
+        TTime timeStampTime;
+        ret = timeStampTime.Set( timeStamp );
 
-          if(ret == KErrGeneral )
-              {
-              DEBUG(( "_MM_:CHnRepositoryShowFolderObserver::ExtractCRKeyShowFolderName (bad timestamp) OUT" ));
+        if( ret == KErrGeneral )
+            {
+            DEBUG(( "_MM_:CHnRepositoryShowFolderObserver::ExtractCRKeyShowFolderName (bad timestamp) OUT" ));
             return; // bad time stamp value
-              }
+            }
 
-          ret = currentTime.SecondsFrom( timeStampTime, interval );
+        ret = currentTime.SecondsFrom( timeStampTime, interval );
 
-          if( interval.Int() < 0 )
-              {//negative timestamp is set ahead of current time...!
-              DEBUG(( "_MM_:CHnRepositoryShowFolderObserver::ExtractCRKeyShowFolderName (negative interval) OUT" ));
+        if( interval.Int() < 0 )
+            {//negative timestamp is set ahead of current time...!
+            DEBUG(( "_MM_:CHnRepositoryShowFolderObserver::ExtractCRKeyShowFolderName (negative interval) OUT" ));
             return;
-              }
+            }
 
-          if(( interval.Int()) > KTimeStampCutOff )
-              {//positive timestamp but more than 5 seconds
-              DEBUG(( "_MM_:CHnRepositoryShowFolderObserver::ExtractCRKeyShowFolderName (more than 5 seconds) OUT" ));
+        if( ( interval.Int() ) > KTimeStampCutOff )
+            {//positive timestamp but more than 5 seconds
+            DEBUG(( "_MM_:CHnRepositoryShowFolderObserver::ExtractCRKeyShowFolderName (more than 5 seconds) OUT" ));
             return;
-              }
-          else
-              {
-            iCRKeyFolderName.Copy(folder);
-              }
+            }
+        else
+            {
+            iCRKeyFolderName.Copy( folder );
+            }
+        }
+    DEBUG(( "_MM_:CHnRepositoryShowFolderObserver::ExtractCRKeyShowFolderName OUT" ));
     }
-  DEBUG(( "_MM_:CHnRepositoryShowFolderObserver::ExtractCRKeyShowFolderName OUT" ));
-  }
 
 // ---------------------------------------------------------------------------
 //
@@ -547,7 +545,6 @@
 //
 void CHnRepositoryShowFolderObserver::GetShowFolderGroupNameL()
     {
-
     CHnMdBaseKey* inDataKey = HnMdKeyFactory::CreateL(
         KInData8, KKeyTypeMap, KDefaultParentId8 );
     CleanupStack::PushL( inDataKey );
@@ -611,13 +608,13 @@
 // ---------------------------------------------------------------------------
 //
 TInt CHnRepositoryShowFolderObserver::HandleNotifyL(
-    TInt /*aCmdId*/,
-    TInt aEventId,
-    CLiwGenericParamList& aEventParamList,
-    const CLiwGenericParamList& /*aInParamList*/)
-  {
-  DEBUG(("_MM_:CHnRepositoryShowFolderObserver::HandleNotifyL IN"));
-  if( aEventId == KLiwEventCanceled )
+        TInt /*aCmdId*/,
+        TInt aEventId,
+        CLiwGenericParamList& aEventParamList,
+        const CLiwGenericParamList& /*aInParamList*/)
+    {
+    DEBUG(("_MM_:CHnRepositoryShowFolderObserver::HandleNotifyL IN"));
+    if( aEventId == KLiwEventCanceled )
         {
         return KErrNotFound;
         }
@@ -772,4 +769,248 @@
   return KErrNone;
   }
 
+// class CHnRepositoryOpenItemObserver
+// ---------------------------------------------------------------------------
+//
+// ---------------------------------------------------------------------------
+//
+CHnRepositoryOpenItemObserver * CHnRepositoryOpenItemObserver::NewL(
+        THnMdCommonPointers* aCmnPtrs, const TUid aRepositoryUid, const TUint32 aId )
+    {
+    CHnRepositoryOpenItemObserver * self = CHnRepositoryOpenItemObserver::NewLC(
+            aCmnPtrs, aRepositoryUid, aId );
+    CleanupStack::Pop(self);
+    return self;
+    }
+
+// ---------------------------------------------------------------------------
+//
+// ---------------------------------------------------------------------------
+//
+CHnRepositoryOpenItemObserver * CHnRepositoryOpenItemObserver::NewLC(
+        THnMdCommonPointers* aCmnPtrs, const TUid aRepositoryUid, const TUint32 aId )
+    {
+    CHnRepositoryOpenItemObserver * self = new (ELeave) CHnRepositoryOpenItemObserver(
+            aCmnPtrs, aId );
+    CleanupStack::PushL(self);
+    self->ConstructL( aRepositoryUid );
+    return self;
+    }
+
+// ---------------------------------------------------------------------------
+//
+// ---------------------------------------------------------------------------
+//
+void CHnRepositoryOpenItemObserver::ConstructL( const TUid aRepositoryUid )
+    {
+    CHnRepositoryObserver::ConstructL( aRepositoryUid );
+    TInt ret = iRepository->Create( iId, KBlank );
+    iNotifyHandler = CCenRepNotifyHandler::NewL( *this, *iRepository,
+            CCenRepNotifyHandler::EStringKey, iId );
+    iNotifyHandler->StartListeningL();
+    }
+
+
+// ---------------------------------------------------------------------------
+//
+// ---------------------------------------------------------------------------
+//
+CHnRepositoryOpenItemObserver::CHnRepositoryOpenItemObserver( 
+        THnMdCommonPointers* aCmnPtrs, TUint32 aId  ) :
+            CHnRepositoryObserver( aCmnPtrs, aId )
+    {
+    }
+
+// ---------------------------------------------------------------------------
+//
+// ---------------------------------------------------------------------------
+//
+CHnRepositoryOpenItemObserver::~CHnRepositoryOpenItemObserver()
+    {
+    iRepository->Delete( iId );
+    delete iServiceHandler;
+    }
+
+// ---------------------------------------------------------------------------
+//
+// ---------------------------------------------------------------------------
+//
+void CHnRepositoryOpenItemObserver::HandleNotifyString(
+        TUint32 aId, const TDesC16& aNewValue )
+    {
+    TRAP_IGNORE( HandleNotifyStringL( aId, aNewValue ) );
+    }
+
+// ---------------------------------------------------------------------------
+//
+// ---------------------------------------------------------------------------
+//
+void CHnRepositoryOpenItemObserver::HandleNotifyStringL(
+        TUint32 aId, const TDesC16& aNewValue )
+    {
+    DEBUG(("_MM_:CHnRepositoryOpenItemObserver::HandleNotifyStringL IN"));
+    DEBUG(("\tID: %d : %S", aId, &aNewValue));
+
+    // Open item
+    if( aId == iId && aNewValue.Length())
+        {
+        ShowFolderL( aNewValue );
+        }
+    }
+
+// ---------------------------------------------------------------------------
+//
+// ---------------------------------------------------------------------------
+//
+TInt CHnRepositoryOpenItemObserver::HandleNotifyL(
+        TInt /*aCmdId*/,
+        TInt aEventId,
+        CLiwGenericParamList& aEventParamList,
+        const CLiwGenericParamList& /*aInParamList*/)
+    {
+    DEBUG(("_MM_:CHnRepositoryOpenItemObserver::HandleNotifyL IN"));
+    if( aEventId == KLiwEventCanceled )
+        {
+        return KErrNotFound;
+        }
+    else
+        {
+        TInt pos( 0 );
+        const TLiwGenericParam* first = aEventParamList.FindFirst(
+                pos, KReturnValue8() );
+        if( pos == KErrNotFound )
+            {
+            return KErrNotFound;
+            }
+
+        TInt count = first->Value().AsList()->Count();
+        if( count == 0 )
+            {
+            return KErrNotFound;
+            }
+
+        TLiwVariant varId;
+        varId.PushL();
+        TLiwVariant varAppGroupName;
+        varAppGroupName.PushL();
+        TLiwVariant varSuiteName;
+        varSuiteName.PushL();
+        TLiwVariant varChildrenCount;
+        varChildrenCount.PushL();
+
+        HnLiwUtils::GetVariantL( aEventParamList, KIdPath8, 0, varId );
+        HnLiwUtils::GetVariantL( aEventParamList, KAppGroupNamePath8, 0, varAppGroupName );
+        HnLiwUtils::GetVariantL( aEventParamList, KTitleNamePath8, 0, varSuiteName );
+        HnLiwUtils::GetVariantL( aEventParamList, KChildrenCountPath8, 0, varChildrenCount );
+
+        CLiwGenericParamList* paramList = CLiwGenericParamList::NewL();
+        CleanupStack::PushL( paramList );
+
+        CLiwDefaultMap* map = CLiwDefaultMap::NewLC();
+
+        paramList->AppendL( TLiwGenericParam( KSuiteName8, TLiwVariant(
+                KFolderSuite ) ) );
+
+        map->InsertL( KSuiteName8, varSuiteName );
+        map->InsertL( KFolderId8, varId );
+        map->InsertL( KRemoveLocked8, TLiwVariant( KStringFalse8 ) );
+        map->InsertL( KParentFolderId8, varId );
+        map->InsertL( KTmpParentFolderId8, varId );
+        map->InsertL( KMcsAppGroupName8, varAppGroupName );
+
+        paramList->AppendL( TLiwGenericParam( KParams8, TLiwVariant( map ) ) );
+
+        CleanupStack::PopAndDestroy( map );
+
+        while( iCmnPtrs->iModel->LoadedSuitesCount() > 1 )
+            {
+            CHnMdSuite* suite = iCmnPtrs->iModel->GetLastSuite();
+            iCmnPtrs->iContainer->PopSuiteModelL( suite->SuiteName() );
+            iCmnPtrs->iModel->DeleteLastSuite();
+            }
+
+        if( iCmnPtrs->iContainer->GetLastSuiteModel()->CustomId()
+                != varId.AsTInt64() )
+            {
+            iCmnPtrs->iModelEventObserver->HandleModelEventL(
+                    KNewSuiteLoadedMdEvent, *paramList );
+            iCmnPtrs->iModel->QueueForeground(
+                    CHnMdModel::EWhenCurrentTopSuiteIsEvaluated );
+            }
+        else
+            {
+            iCmnPtrs->iContainer->GetLastSuiteModel()->NotifyObserversL(
+                    ESuiteModelInitialized );
+            CLiwGenericParamList* paramList = CLiwGenericParamList::NewL();
+            CleanupStack::PushL( paramList );
+            iCmnPtrs->iModelEventObserver->HandleModelEventL(
+                    KAppGainForeground, *paramList );
+            CleanupStack::PopAndDestroy( paramList );
+            }
+
+        iRepository->Set( iId, KBlank ); // reset key repository to empty string
+
+        CleanupStack::PopAndDestroy( paramList );
+        CleanupStack::PopAndDestroy( &varChildrenCount );
+        CleanupStack::PopAndDestroy( &varSuiteName );
+        CleanupStack::PopAndDestroy( &varAppGroupName );
+        CleanupStack::PopAndDestroy( &varId );
+        }
+
+    DEBUG(("_MM_:CHnRepositoryOpenItemObserver::HandleNotifyL OUT"));
+    return KErrNone;
+    }
+
+// ---------------------------------------------------------------------------
+//
+// ---------------------------------------------------------------------------
+//
+void CHnRepositoryOpenItemObserver::ShowFolderL( const TDesC16& aFolderId )
+    {
+    CHnMdBaseKey* inDataKey = HnMdKeyFactory::CreateL(
+            KInData8, KKeyTypeMap, KDefaultParentId8 );
+    CleanupStack::PushL( inDataKey );
+    inDataKey->AddSubKeyL(
+            HnMdKeyFactory::CreateL( KType8, KKeyTypeString, KMenuFolder8 ) );
+    inDataKey->AddSubKeyL(
+            HnMdKeyFactory::CreateL( KIdParam, KKeyTypeInteger, aFolderId ) );
+    inDataKey->AddSubKeyL(
+            HnMdKeyFactory::CreateL( KParentOnly8, KKeyTypeBoolean, KStringTrue8 ) );
+
+    RPointerArray< CHnMdBaseKey > data;
+    CleanupClosePushL( data );
+    data.Append( inDataKey );
+
+    CHnMdBaseKey* serviceData = HnMdKeyFactory::CreateL(
+        KServiceContentName, KKeyTypeString, KMatrixMenuData );
+    CleanupStack::PushL( serviceData );
+
+    RPointerArray< CHnMdBaseKey> constructor;
+    CleanupClosePushL( constructor );
+    constructor.Append( serviceData );
+    CLiwGenericParamList* constructorLiw = CLiwGenericParamList::NewLC();
+    CLiwGenericParamList* commandLiw = CLiwGenericParamList::NewLC();
+    HnLiwUtils::SetGenericParamListL( constructor, *constructorLiw );
+    HnLiwUtils::SetGenericParamListL( data, *commandLiw );
+
+    TBuf8< KMaxLength > interface( KMCSDataSourceInterface8 );
+
+    delete iServiceHandler;
+    iServiceHandler = NULL;
+    iServiceHandler = CHnServiceHandler::NewL(
+            KMCSService8, interface, KCmdGetList8,
+            EServiceModeAsynchronous, constructorLiw, commandLiw );
+
+    CleanupStack::Pop( commandLiw );
+    CleanupStack::Pop( constructorLiw );
+
+    iServiceHandler->ExecuteL( this );
+
+    CleanupStack::PopAndDestroy( &constructor );
+    CleanupStack::PopAndDestroy( serviceData );
+    CleanupStack::PopAndDestroy( &data );
+    CleanupStack::PopAndDestroy( inDataKey );
+
+    }
+
 // End of File