menufw/menufwui/mmextensions/mmfolderuiextension/src/mmmovetofoldercommand.cpp
branchv5backport
changeset 14 1abc632eb502
parent 13 6205fd287e8a
child 20 636d517f67e6
equal deleted inserted replaced
13:6205fd287e8a 14:1abc632eb502
     1 /*
       
     2 * Copyright (c) 2007-2008 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:   Add folder command
       
    15  *
       
    16 */
       
    17 
       
    18  
       
    19 #include <liwcommon.h>
       
    20 
       
    21 #include "mmmovetofoldercommand.h"
       
    22 #include "hnglobals.h"
       
    23 #include "menudebug.h"
       
    24 #include "hnconvutils.h"
       
    25 #include "hnliwutils.h"
       
    26 #include "hnutils.h"
       
    27 
       
    28 #include "hnmdbasekey.h"
       
    29 #include "hnmdkeyfactory.h"
       
    30 #include "menudebug.h"
       
    31 #include "mmactionrequest.h"
       
    32 #include "hnservicehandler.h"
       
    33 #include "mmpluginsharedresources.h"
       
    34 
       
    35 #include <StringLoader.h>
       
    36 #include <liwcommon.h>
       
    37 #include <avkon.rsg>
       
    38 #include <avkon.mbg>
       
    39 #include <AknIconArray.h>
       
    40 #include <AknIconUtils.h>
       
    41 #include <aknnotedialog.h>
       
    42 #include <mmf/common/mmfcontrollerpluginresolver.h>
       
    43 #include <mmfolderuiextplugin.rsg>
       
    44 #include <matrixmenu.rsg>
       
    45 
       
    46 _LIT( KFolderClosed, "0\t" );
       
    47 _LIT( KFolderOpened, "1\t" );
       
    48 const TInt KSoftkeyBack( 0 );
       
    49 
       
    50 // ============================ MEMBER FUNCTIONS =============================
       
    51 
       
    52 // ---------------------------------------------------------------------------
       
    53 // Symbian factory function.
       
    54 // ---------------------------------------------------------------------------
       
    55 //
       
    56 CMmMoveToFolderCommand* CMmMoveToFolderCommand::NewL()
       
    57     {
       
    58     CMmMoveToFolderCommand* self = new( ELeave ) CMmMoveToFolderCommand();
       
    59     CleanupStack::PushL( self );
       
    60     self->ConstructL();
       
    61     CleanupStack::Pop( self );
       
    62     return self;
       
    63     }
       
    64 
       
    65 
       
    66 // ---------------------------------------------------------------------------
       
    67 // Symbian second phase constructor.
       
    68 // ---------------------------------------------------------------------------
       
    69 //
       
    70 void CMmMoveToFolderCommand::ConstructL()
       
    71     {
       
    72     BaseConstructL();
       
    73     iLockDialog = EFalse;
       
    74     iFlagLeave = EFalse;
       
    75     }
       
    76 
       
    77 // ---------------------------------------------------------------------------
       
    78 // Destructor.
       
    79 // ---------------------------------------------------------------------------
       
    80 //
       
    81 CMmMoveToFolderCommand::~CMmMoveToFolderCommand()
       
    82     {
       
    83     iItemName.Close();
       
    84     iFolderName.Close();
       
    85     iWidgetType.Close();
       
    86     iOpenedHierarchy.ResetAndDestroy();
       
    87     iOpenedHierarchy.Close();
       
    88     delete iServiceHandler;
       
    89     }
       
    90 
       
    91 // ---------------------------------------------------------------------------
       
    92 // 
       
    93 // ---------------------------------------------------------------------------
       
    94 //
       
    95 CMmMoveToFolderCommand::CMmMoveToFolderCommand()
       
    96     {
       
    97     }
       
    98 
       
    99 // ---------------------------------------------------------------------------
       
   100 // 
       
   101 // ---------------------------------------------------------------------------
       
   102 //
       
   103 TInt CMmMoveToFolderCommand::HandleNotifyL(
       
   104         TInt /*aCmdId*/, 
       
   105         TInt aEventId,
       
   106         CLiwGenericParamList& /*aEventParamList*/,
       
   107         const CLiwGenericParamList& /*aInParamList*/ )
       
   108     {
       
   109     if (aEventId != KLiwEventCanceled)
       
   110         {
       
   111         NotificationMovingCompleteL();
       
   112         iItemName.Close();
       
   113         iFolderName.Close();
       
   114         }
       
   115     return KErrNone;
       
   116     }
       
   117 
       
   118 
       
   119 // ---------------------------------------------------------------------------
       
   120 // 
       
   121 // ---------------------------------------------------------------------------
       
   122 //
       
   123 void CMmMoveToFolderCommand::ExecuteActionL(
       
   124         CLiwGenericParamList* aEventParamList )
       
   125     {
       
   126     
       
   127     //
       
   128     // Prepare move to folder operation
       
   129     MMPERF(("CMmMoveToFolderCommand::ExecuteActionL - START"));
       
   130     iItemId = GetIntL( *aEventParamList, KIdAttrName8 );
       
   131     iParentId = GetIntL( *aEventParamList, KFolderAttrName8 );
       
   132     TPtrC widget = GetStringL( *aEventParamList, KWidgetAttrName8 );
       
   133     TPtrC currentTempName = GetStringL( *aEventParamList, KName8 );
       
   134     
       
   135     iItemName.Close();
       
   136     iItemName.CreateL( currentTempName );
       
   137     
       
   138     iWidgetType.Close();
       
   139     iWidgetType.CreateL( widget );
       
   140     
       
   141     CMmFolder* rootFolder = CMmFolder::NewL();
       
   142     CleanupStack::PushL( rootFolder );
       
   143    
       
   144     rootFolder->SetNameL( iSharedResources->GetRootFolder());
       
   145     rootFolder->SetId( KRootId );
       
   146     iOpenedHierarchy.AppendL( rootFolder );
       
   147     CleanupStack::Pop( rootFolder );
       
   148     iLockDialog = EFalse;
       
   149 
       
   150     // Excute move to folder operation
       
   151     TInt err( KErrNone );
       
   152     
       
   153 	// Get folder list form MCS
       
   154 	GetFolderListL( CurrentFolder()->Id() );
       
   155 	
       
   156 	RPointerArray< CMmFolder > folders;
       
   157 	CleanupResetAndDestroyPushL( folders );
       
   158 
       
   159 	// Get folders from GetList output
       
   160 	GetFoldersL(folders);
       
   161 	
       
   162     // if foler already exists, reopen options menu
       
   163     do
       
   164     	{
       
   165     	TRAP( err, ExecuteMoveToFolderL());
       
   166     	}
       
   167     while ( err == KErrAlreadyExists && folders.Count() > 0 );
       
   168     
       
   169     // if any different leave was trapped, pass it on
       
   170     if ( err != KErrNone )
       
   171     	{
       
   172     	User::Leave( err );
       
   173     	}
       
   174     
       
   175     CleanupStack::PopAndDestroy( &folders );
       
   176     //MMPERF(("CFolderUiExtPlugin::AddFolderCommandL - END"));
       
   177     }
       
   178 
       
   179 
       
   180 // ---------------------------------------------------------------------------
       
   181 // 
       
   182 // ---------------------------------------------------------------------------
       
   183 //
       
   184 CMmFolder* CMmMoveToFolderCommand::CurrentFolder()
       
   185     {
       
   186     ASSERT( iOpenedHierarchy.Count() > 0 );
       
   187     return iOpenedHierarchy[ iOpenedHierarchy.Count() - 1 ];
       
   188     }
       
   189 
       
   190 // ---------------------------------------------------------------------------
       
   191 // 
       
   192 // ---------------------------------------------------------------------------
       
   193 //
       
   194 void CMmMoveToFolderCommand::MoveToFolderL( TInt aId, TInt aFolderId,
       
   195                                             TInt aBeforeItemId )
       
   196     {
       
   197     if( aFolderId != iParentId )
       
   198         {
       
   199         CHnMdBaseKey* inDataKey = HnMdKeyFactory::CreateL(
       
   200             KInData8, KKeyTypeMap, KDefaultParentId8 );
       
   201         CleanupStack::PushL( inDataKey );
       
   202         CHnMdBaseKey* listIds = HnMdKeyFactory::CreateL(
       
   203             KIdsList, KKeyTypeList, KNullDesC8 );
       
   204 
       
   205         HBufC8* id = HnConvUtils::NumToStr8LC( aId );
       
   206         AddSubKeyL( listIds, KIdParam, KKeyTypeBoolean, *id );
       
   207         CleanupStack::PopAndDestroy();
       
   208         
       
   209         inDataKey->AddSubKeyL( listIds );
       
   210         HBufC8* folderId = HnConvUtils::NumToStr8LC( aFolderId );
       
   211         AddSubKeyL( inDataKey, KFolderId8, KKeyTypeBoolean, *folderId );
       
   212         CleanupStack::PopAndDestroy( folderId );
       
   213 
       
   214         if( aBeforeItemId != KErrNotFound )
       
   215             {
       
   216             HBufC8* itemId = HnConvUtils::NumToStr8LC( aBeforeItemId );
       
   217             AddSubKeyL( inDataKey, KBeforeItemId8, KKeyTypeBoolean, *itemId );
       
   218             CleanupStack::PopAndDestroy( itemId );
       
   219             }
       
   220         MCSQueryExecutionL( KCmdOrganize8, inDataKey, NULL, this );
       
   221         iOpenedHierarchy.ResetAndDestroy();
       
   222 
       
   223         CleanupStack::PopAndDestroy( inDataKey );
       
   224         CLiwGenericParamList* list = CLiwGenericParamList::NewLC();
       
   225         TLiwGenericParam command( KHnRequest, TLiwVariant( KDisableActionsForItem ) );
       
   226         TLiwGenericParam itemCustomId(
       
   227                 KItemCustomId8, TLiwVariant( static_cast<TInt32>( aId ) ) );
       
   228         list->AppendL( itemCustomId );
       
   229         list->AppendL( command );
       
   230         iActionRequest->HandleRequestL( *list );
       
   231         CleanupStack::PopAndDestroy( list );  
       
   232         }
       
   233     else
       
   234         {
       
   235         NotificationItemAlreadyStoredL();
       
   236         if( iOpenedHierarchy.Count() > 0 && !iLockDialog )
       
   237             {
       
   238             if( CurrentFolder()->Id() == iParentId && iParentId != KRootId )
       
   239                 {
       
   240                 StepBackInHierarchy();
       
   241                 }
       
   242             else if ( iParentId == KRootId )
       
   243                 {
       
   244                 User::Leave( KErrAlreadyExists );
       
   245                 }
       
   246             }
       
   247         }
       
   248     }
       
   249 
       
   250 
       
   251 // ---------------------------------------------------------------------------
       
   252 // 
       
   253 // ---------------------------------------------------------------------------
       
   254 //
       
   255 void CMmMoveToFolderCommand::SelectFolderL(
       
   256         const RPointerArray< CMmFolder >& aFolderContent )
       
   257     {
       
   258     CDesCArrayFlat* folders =
       
   259         new( ELeave )CDesCArrayFlat( aFolderContent.Count() + 1 );
       
   260     CleanupStack::PushL( folders );
       
   261     RBuf currentFolder;
       
   262     CleanupClosePushL( currentFolder );
       
   263     currentFolder.CreateL(
       
   264         KFolderOpened().Length() + CurrentFolder()->Name().Length() );
       
   265     currentFolder.Append( KFolderOpened );
       
   266     currentFolder.Append( CurrentFolder()->Name() );
       
   267     folders->AppendL( currentFolder );
       
   268     
       
   269     for( int i( 0 ); i<aFolderContent.Count(); i++ )
       
   270         {
       
   271         CMmFolder* folder = aFolderContent[ i ];
       
   272         RBuf name;
       
   273         CleanupClosePushL( name );
       
   274         name.CreateL( KFolderClosed().Length() + folder->Name().Length() );
       
   275         name.Append( KFolderClosed );
       
   276         name.Append( folder->Name() );
       
   277         folders->AppendL( name );
       
   278         CleanupStack::PopAndDestroy( &name );
       
   279         }
       
   280     
       
   281     TInt selected( SelectFolderFromListL(
       
   282         folders, CurrentFolder()->Id() == KRootId ) );
       
   283     
       
   284     switch( selected )
       
   285         {
       
   286         case EAknSoftkeyBack:
       
   287             {
       
   288             if( iOpenedHierarchy.Count() > 1 && !iLockDialog )
       
   289                 {
       
   290                 StepBackInHierarchy();
       
   291                 break;
       
   292                 }
       
   293             }
       
   294         case EAknSoftkeyExit:
       
   295             {
       
   296             iItemName.Close();
       
   297             iFolderName.Close();
       
   298             iOpenedHierarchy.ResetAndDestroy();
       
   299             break;
       
   300             }
       
   301         default:
       
   302             {
       
   303             if( selected > 0 )
       
   304                 {
       
   305                 CMmFolder* folder = CMmFolder::NewL();
       
   306                 CleanupStack::PushL( folder );
       
   307                 folder->SetNameL( aFolderContent[ selected - 1 ]->Name() );
       
   308                 folder->SetId( aFolderContent[ selected - 1 ]->Id() );
       
   309                 iOpenedHierarchy.AppendL( folder );
       
   310                 CleanupStack::Pop( folder );
       
   311                 }
       
   312             else
       
   313                 {
       
   314                 iFolderName.Close();
       
   315                 iFolderName.CreateL( CurrentFolder()->Name() );
       
   316                 MoveToFolderL( iItemId, CurrentFolder()->Id() );
       
   317                 }
       
   318             break;
       
   319             }
       
   320         }
       
   321     
       
   322     CleanupStack::PopAndDestroy( &currentFolder );
       
   323     CleanupStack::PopAndDestroy( folders );
       
   324     }
       
   325 
       
   326 
       
   327 // ---------------------------------------------------------------------------
       
   328 // 
       
   329 // ---------------------------------------------------------------------------
       
   330 //
       
   331 TInt CMmMoveToFolderCommand::SelectFolderFromListL(
       
   332         CDesCArrayFlat* aItems, TBool aIsRoot )
       
   333     {
       
   334     TInt selected( KErrNotFound );
       
   335     
       
   336     CAknListQueryDialog* dialog =
       
   337         new ( ELeave ) CAknListQueryDialog( &selected );
       
   338     if( aIsRoot )
       
   339         {
       
   340         dialog->PrepareLC( R_MENU_EDIT_MOVE_TO_FOLDER_SELECT_CANCEL_QUERY );
       
   341         }
       
   342     else
       
   343         {
       
   344         dialog->PrepareLC( R_MENU_EDIT_MOVE_TO_FOLDER_SELECT_BACK_QUERY );
       
   345         }
       
   346     dialog->SetItemTextArray( aItems );
       
   347     dialog->SetOwnershipType( ELbmDoesNotOwnItemArray );
       
   348     CArrayPtr<CGulIcon>* icons = GetFolderIconsL();
       
   349     dialog->SetIconArrayL( icons );
       
   350     dialog->ListBox()->SetCurrentItemIndexAndDraw( 0 );
       
   351     
       
   352     if( !iLockDialog )
       
   353         {
       
   354         SetDialogL( dialog );
       
   355         TInt softkey ( KErrNotFound );
       
   356         softkey = dialog->RunLD();
       
   357         SetDialogL( NULL );
       
   358         
       
   359         if( softkey == KSoftkeyBack )
       
   360             {
       
   361             selected = EAknSoftkeyBack;
       
   362             }
       
   363         else if( selected < 0 ||
       
   364                 ( softkey != EAknSoftkeyOk && softkey != EAknSoftkeySelect ) )
       
   365             {
       
   366             selected = EAknSoftkeyExit;
       
   367             }
       
   368         }
       
   369     else
       
   370         {
       
   371         CleanupStack::PopAndDestroy( dialog );
       
   372         selected = EAknSoftkeyExit;
       
   373         }
       
   374 
       
   375     return selected;
       
   376     }
       
   377 
       
   378 
       
   379 // ---------------------------------------------------------------------------
       
   380 // Action resolving function.
       
   381 // ---------------------------------------------------------------------------
       
   382 //  
       
   383 CArrayPtr<CGulIcon>* CMmMoveToFolderCommand::GetFolderIconsL()
       
   384     {
       
   385     CArrayPtr<CGulIcon>* icons = new( ELeave )CAknIconArray( 10 );
       
   386     CleanupStack::PushL( icons );
       
   387     CFbsBitmap* folderClosed     = NULL;
       
   388     CFbsBitmap* folderClosedMask = NULL;
       
   389         
       
   390     AknIconUtils::CreateIconL( folderClosed, folderClosedMask,
       
   391             AknIconUtils::AvkonIconFileName(),
       
   392             EMbmAvkonQgn_prop_folder_small,
       
   393             EMbmAvkonQgn_prop_folder_small_mask );
       
   394     CleanupStack::PushL( folderClosed );
       
   395     CleanupStack::PushL( folderClosedMask );
       
   396     icons->AppendL( CGulIcon::NewL( folderClosed, folderClosedMask ) );
       
   397     CleanupStack::Pop( 2 );
       
   398 
       
   399     CFbsBitmap* folderOpened     = NULL;
       
   400     CFbsBitmap* folderOpenedMask = NULL;
       
   401     AknIconUtils::CreateIconL( folderOpened, folderOpenedMask,
       
   402             AknIconUtils::AvkonIconFileName(),
       
   403             EMbmAvkonQgn_prop_folder_current, 
       
   404             EMbmAvkonQgn_prop_folder_current_mask );
       
   405     CleanupStack::PushL( folderOpened );
       
   406     CleanupStack::PushL( folderOpenedMask );
       
   407     icons->AppendL( CGulIcon::NewL( folderOpened, folderOpenedMask ) );
       
   408     CleanupStack::Pop( 3 );
       
   409     return icons;
       
   410     }
       
   411 
       
   412 
       
   413 // ---------------------------------------------------------------------------
       
   414 // Action resolving function.
       
   415 // ---------------------------------------------------------------------------
       
   416 //  
       
   417 HBufC* CMmMoveToFolderCommand::GetFromResourceLC( TInt aIdentifier )
       
   418     {
       
   419     HBufC* string = StringLoader::LoadLC( aIdentifier );
       
   420     return string;
       
   421     }
       
   422 
       
   423 
       
   424 // ---------------------------------------------------------------------------
       
   425 // Action resolving function.
       
   426 // ---------------------------------------------------------------------------
       
   427 //  
       
   428 void CMmMoveToFolderCommand::NotificationMovingCompleteL()
       
   429     {
       
   430     CDesCArrayFlat* items = new(ELeave) CDesCArrayFlat( 1 );
       
   431     CleanupStack::PushL( items );
       
   432     items->AppendL( iItemName );
       
   433     items->AppendL( iFolderName );
       
   434     
       
   435     HBufC* msg = StringLoader::LoadLC( R_APPS_NOTE_MOVE_TO_FOLDER, *items );
       
   436     CAknNoteDialog* dialog = new (ELeave) CAknNoteDialog(
       
   437             CAknNoteDialog::EConfirmationTone,
       
   438             CAknNoteDialog::ELongTimeout );
       
   439     dialog->SetTextL( msg->Des() );
       
   440     dialog->ExecuteDlgLD( R_MENU_EDIT_MOVING_COMPLETE_NOTIFICATION );
       
   441     
       
   442     CleanupStack::PopAndDestroy( msg );
       
   443     CleanupStack::PopAndDestroy( items );
       
   444     }
       
   445 
       
   446 
       
   447 // ---------------------------------------------------------------------------
       
   448 // Action resolving function.
       
   449 // ---------------------------------------------------------------------------
       
   450 //  
       
   451 void CMmMoveToFolderCommand::NotificationItemAlreadyStoredL()
       
   452     {
       
   453     HBufC* message = StringLoader::LoadLC( R_APPS_NOTE_ITEM_ALREADY_STORED );
       
   454     CAknNoteDialog* dialog = new (ELeave) CAknNoteDialog(
       
   455             CAknNoteDialog::EConfirmationTone,
       
   456             CAknNoteDialog::ELongTimeout );
       
   457     dialog->SetTextL( message->Des() );
       
   458     dialog->ExecuteDlgLD( R_MENU_EDIT_MOVING_ABORT_NOTIFICATION );
       
   459     
       
   460     CleanupStack::PopAndDestroy( message );
       
   461     }
       
   462 
       
   463 // ---------------------------------------------------------------------------
       
   464 // 
       
   465 // ---------------------------------------------------------------------------
       
   466 //
       
   467 void CMmMoveToFolderCommand::StepBackInHierarchy()
       
   468 	{
       
   469 	// Remove last folder from iOpenedHierarchy
       
   470 	CMmFolder* folder = CurrentFolder();
       
   471 	iOpenedHierarchy.Remove( iOpenedHierarchy.Count() - 1 );
       
   472 	delete folder;
       
   473 	}
       
   474 
       
   475 
       
   476 
       
   477 // ---------------------------------------------------------------------------
       
   478 // 
       
   479 // ---------------------------------------------------------------------------
       
   480 //
       
   481 void CMmMoveToFolderCommand::ExecuteMoveToFolderL()
       
   482 	{
       
   483     while (iOpenedHierarchy.Count() > 0)
       
   484     	{
       
   485     	// Get folder list form MCS
       
   486     	GetFolderListL( CurrentFolder()->Id() );
       
   487     	
       
   488     	RPointerArray< CMmFolder > folders;
       
   489     	CleanupResetAndDestroyPushL( folders );
       
   490 
       
   491     	// Get folders from GetList output
       
   492     	GetFoldersL(folders);
       
   493 
       
   494     	// Perform further folder selection or move operation
       
   495     	if( folders.Count() > 0 )
       
   496     		{
       
   497     		SelectFolderL( folders );
       
   498     		}
       
   499     	else
       
   500     		{
       
   501     		iFolderName.Close();
       
   502     		iFolderName.CreateL( CurrentFolder()->Name() );
       
   503     		MoveToFolderL( iItemId, CurrentFolder()->Id() );
       
   504     		}
       
   505     	CleanupStack::PopAndDestroy( &folders );
       
   506     	}
       
   507 	}
       
   508 
       
   509 // ---------------------------------------------------------------------------
       
   510 // 
       
   511 // ---------------------------------------------------------------------------
       
   512 //
       
   513 void CMmMoveToFolderCommand::GetFoldersL(RPointerArray<CMmFolder >& aFolderArray)
       
   514 	{
       
   515 	TInt pos( 0 );
       
   516 	TInt count = iGetListOutParam->FindFirst(
       
   517 			pos, KReturnValue8() )->Value().AsList()->Count();
       
   518 	TLiwVariant var; var.PushL();
       
   519 	
       
   520 	// Get propper widget names depending from view type
       
   521 	// and append to aFolderArray
       
   522 	for( TInt i = 0; i < count; i++ )
       
   523 		{
       
   524 		HnLiwUtils::GetVariantL( *iGetListOutParam, KIdPath8, i, var );
       
   525 		TInt32 id;
       
   526 		var.Get( id );
       
   527 
       
   528 		if (id != iItemId)
       
   529 			{
       
   530 			CMmFolder* folder = CMmFolder::NewL();
       
   531 			CleanupStack::PushL( folder );
       
   532 			
       
   533 			folder->SetId( id );
       
   534 			
       
   535 			TPtrC title;
       
   536 			if( !iWidgetType.Compare( KWidgetTypeList ) )
       
   537 				{
       
   538 				HnLiwUtils::GetVariantL(
       
   539 						*iGetListOutParam, KLongNamePath8, i, var );
       
   540 				}
       
   541 			else if( !iWidgetType.Compare( KWidgetTypeGrid ) )
       
   542 				{
       
   543 				HnLiwUtils::GetVariantL(
       
   544 						*iGetListOutParam, KShortNamePath8, i, var );
       
   545 				}
       
   546 			else
       
   547 				{
       
   548 				HnLiwUtils::GetVariantL(
       
   549 						*iGetListOutParam, KAppGroupNamePath8, i, var );
       
   550 				}
       
   551 			var.Get( title );
       
   552 			folder->SetNameL( title );
       
   553 			aFolderArray.AppendL( folder );
       
   554 			
       
   555 			CleanupStack::Pop( folder );
       
   556 			}
       
   557 		}
       
   558 	CleanupStack::PopAndDestroy(&var);
       
   559 	}
       
   560 
       
   561 // ---------------------------------------------------------------------------
       
   562 // Symbian factory function.
       
   563 // ---------------------------------------------------------------------------
       
   564 //
       
   565 CMmFolder* CMmFolder::NewL()
       
   566     {
       
   567     CMmFolder* self = new( ELeave ) CMmFolder();
       
   568     CleanupStack::PushL( self );
       
   569     self->ConstructL();
       
   570     CleanupStack::Pop( self );
       
   571     return self;
       
   572     }
       
   573 
       
   574 // ---------------------------------------------------------------------------
       
   575 // Symbian second phase constructor.
       
   576 // ---------------------------------------------------------------------------
       
   577 //
       
   578 void CMmFolder::ConstructL()
       
   579     {
       
   580     }
       
   581 
       
   582 // ---------------------------------------------------------------------------
       
   583 // Destructor.
       
   584 // ---------------------------------------------------------------------------
       
   585 //
       
   586 CMmFolder::~CMmFolder()
       
   587     {
       
   588     iName.Close();
       
   589     }
       
   590 
       
   591 // ---------------------------------------------------------------------------
       
   592 // 
       
   593 // ---------------------------------------------------------------------------
       
   594 //
       
   595 CMmFolder::CMmFolder()
       
   596     {
       
   597     }
       
   598 
       
   599 // ---------------------------------------------------------------------------
       
   600 // 
       
   601 // ---------------------------------------------------------------------------
       
   602 //
       
   603 void CMmFolder::SetNameL( const TDesC& aName )
       
   604     {
       
   605     iName.Close();
       
   606     iName.CreateL( aName );
       
   607     }
       
   608 
       
   609 // ---------------------------------------------------------------------------
       
   610 // 
       
   611 // ---------------------------------------------------------------------------
       
   612 //
       
   613 const TDesC& CMmFolder::Name() const
       
   614     {
       
   615     return iName;
       
   616     }
       
   617 
       
   618 // ---------------------------------------------------------------------------
       
   619 // 
       
   620 // ---------------------------------------------------------------------------
       
   621 //
       
   622 void CMmFolder::SetId( TInt aId )
       
   623     {
       
   624     iId = aId;
       
   625     }
       
   626 
       
   627 // ---------------------------------------------------------------------------
       
   628 // 
       
   629 // ---------------------------------------------------------------------------
       
   630 //
       
   631 TInt CMmFolder::Id()
       
   632     {
       
   633     return iId;
       
   634     }
       
   635     
       
   636 // end of file
       
   637