photosgallery/viewframework/commandhandlers/commoncommandhandlers/src/glxcommandhandlerrename.cpp
branchRCL_3
changeset 75 01504893d9cb
parent 60 5b3385a43d68
equal deleted inserted replaced
68:5b238bc8ffb6 75:01504893d9cb
    36 #include <glxresourceutilities.h>                // for CGlxResourceUtilities
    36 #include <glxresourceutilities.h>                // for CGlxResourceUtilities
    37 #include <glxgeneraluiutilities.h>
    37 #include <glxgeneraluiutilities.h>
    38 #include <glxicons.mbg>
    38 #include <glxicons.mbg>
    39 #include <glxtracer.h>
    39 #include <glxtracer.h>
    40 #include <glxlog.h>
    40 #include <glxlog.h>
    41 #include <glxmediageneraldefs.h>    // for KMaxMediaPopupTextLength
       
    42 
    41 
    43 #include "glxcommandfactory.h"
    42 #include "glxcommandfactory.h"
    44 
    43 
       
    44 namespace
       
    45 	{
       
    46 	const TInt KNameMaxLength = 128;
       
    47 	}
    45 
    48 
    46 // ---------------------------------------------------------------------------
    49 // ---------------------------------------------------------------------------
    47 // Two-phased constructor.
    50 // Two-phased constructor.
    48 // ---------------------------------------------------------------------------
    51 // ---------------------------------------------------------------------------
    49 //
    52 //
    76 // Symbian 2nd phase constructor can leave.
    79 // Symbian 2nd phase constructor can leave.
    77 // ---------------------------------------------------------------------------
    80 // ---------------------------------------------------------------------------
    78 //
    81 //
    79 void CGlxCommandHandlerRename::ConstructL(const TDesC& aFileName)
    82 void CGlxCommandHandlerRename::ConstructL(const TDesC& aFileName)
    80 	{
    83 	{
    81 	iRenameText = HBufC::NewL(KMaxMediaPopupTextLength);
    84 	iRenameText = HBufC::NewL(KNameMaxLength);
    82 
    85 
    83 	iResourceOffset = CCoeEnv::Static()->AddResourceFileL(aFileName);
    86 	iResourceOffset = CCoeEnv::Static()->AddResourceFileL(aFileName);
    84 
    87 
    85 	// Add supported command
    88 	// Add supported command
    86 	TCommandInfo info(EGlxCmdRename);
    89 	TCommandInfo info(EGlxCmdRename);
   132     // 
   135     // 
   133     // Show popup with the item's current title
   136     // Show popup with the item's current title
   134     TPtr textPtr = iRenameText->Des();
   137     TPtr textPtr = iRenameText->Des();
   135     GetTitleL( textPtr, aMediaList );
   138     GetTitleL( textPtr, aMediaList );
   136     // store the current name.
   139     // store the current name.
   137     TBuf<KMaxMediaPopupTextLength> currentName; 
   140     TBuf<KNameMaxLength> currentName; 
   138     currentName.Copy(textPtr);  
   141     currentName.Copy(textPtr);  
   139 
   142 
   140  	// Load the title for the popup 
   143  	// Load the title for the popup 
   141     HBufC* title = StringLoader::LoadLC( R_GLX_POPUP_RENAME_TITLE );
   144     HBufC* title = StringLoader::LoadLC( R_GLX_POPUP_RENAME_TITLE );
   142     CGlxTextEntryPopup* popup = CGlxTextEntryPopup::NewL( *title,
   145     CGlxTextEntryPopup* popup = CGlxTextEntryPopup::NewL( *title,
   143     	textPtr );
   146     	textPtr );
       
   147 
       
   148 
       
   149     	
   144 	if ( popup->ExecuteLD() == EEikBidOk && currentName != *iRenameText)
   150 	if ( popup->ExecuteLD() == EEikBidOk && currentName != *iRenameText)
   145 		{
   151 		{
   146 		// Text entry was successful
   152 		// Text entry was successful
   147 		// There can be no selection when renaming, so assume that path contains focused item
   153 		// There can be no selection when renaming, so assume that path contains focused item
   148 	   	CMPXCollectionPath* path = aMediaList.PathLC( NGlxListDefs::EPathFocusOrSelection );
   154 	   	CMPXCollectionPath* path = aMediaList.PathLC( NGlxListDefs::EPathFocusOrSelection );