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 |
41 |
42 |
42 #include "glxcommandfactory.h" |
43 #include "glxcommandfactory.h" |
43 |
44 |
44 namespace |
|
45 { |
|
46 const TInt KNameMaxLength = 128; |
|
47 } |
|
48 |
45 |
49 // --------------------------------------------------------------------------- |
46 // --------------------------------------------------------------------------- |
50 // Two-phased constructor. |
47 // Two-phased constructor. |
51 // --------------------------------------------------------------------------- |
48 // --------------------------------------------------------------------------- |
52 // |
49 // |
79 // Symbian 2nd phase constructor can leave. |
76 // Symbian 2nd phase constructor can leave. |
80 // --------------------------------------------------------------------------- |
77 // --------------------------------------------------------------------------- |
81 // |
78 // |
82 void CGlxCommandHandlerRename::ConstructL(const TDesC& aFileName) |
79 void CGlxCommandHandlerRename::ConstructL(const TDesC& aFileName) |
83 { |
80 { |
84 iRenameText = HBufC::NewL(KNameMaxLength); |
81 iRenameText = HBufC::NewL(KMaxMediaPopupTextLength); |
85 |
82 |
86 iResourceOffset = CCoeEnv::Static()->AddResourceFileL(aFileName); |
83 iResourceOffset = CCoeEnv::Static()->AddResourceFileL(aFileName); |
87 |
84 |
88 // Add supported command |
85 // Add supported command |
89 TCommandInfo info(EGlxCmdRename); |
86 TCommandInfo info(EGlxCmdRename); |
135 // |
132 // |
136 // Show popup with the item's current title |
133 // Show popup with the item's current title |
137 TPtr textPtr = iRenameText->Des(); |
134 TPtr textPtr = iRenameText->Des(); |
138 GetTitleL( textPtr, aMediaList ); |
135 GetTitleL( textPtr, aMediaList ); |
139 // store the current name. |
136 // store the current name. |
140 TBuf<KNameMaxLength> currentName; |
137 TBuf<KMaxMediaPopupTextLength> currentName; |
141 currentName.Copy(textPtr); |
138 currentName.Copy(textPtr); |
142 |
139 |
143 // Load the title for the popup |
140 // Load the title for the popup |
144 HBufC* title = StringLoader::LoadLC( R_GLX_POPUP_RENAME_TITLE ); |
141 HBufC* title = StringLoader::LoadLC( R_GLX_POPUP_RENAME_TITLE ); |
145 CGlxTextEntryPopup* popup = CGlxTextEntryPopup::NewL( *title, |
142 CGlxTextEntryPopup* popup = CGlxTextEntryPopup::NewL( *title, |
146 textPtr ); |
143 textPtr ); |
147 |
|
148 |
|
149 |
|
150 if ( popup->ExecuteLD() == EEikBidOk && currentName != *iRenameText) |
144 if ( popup->ExecuteLD() == EEikBidOk && currentName != *iRenameText) |
151 { |
145 { |
152 // Text entry was successful |
146 // Text entry was successful |
153 // There can be no selection when renaming, so assume that path contains focused item |
147 // There can be no selection when renaming, so assume that path contains focused item |
154 CMPXCollectionPath* path = aMediaList.PathLC( NGlxListDefs::EPathFocusOrSelection ); |
148 CMPXCollectionPath* path = aMediaList.PathLC( NGlxListDefs::EPathFocusOrSelection ); |