43 |
43 |
44 // --------------------------------------------------------------------------- |
44 // --------------------------------------------------------------------------- |
45 // Two-phased constructor. |
45 // Two-phased constructor. |
46 // --------------------------------------------------------------------------- |
46 // --------------------------------------------------------------------------- |
47 // |
47 // |
48 EXPORT_C CGlxCommandHandlerCopyAndMove* CGlxCommandHandlerCopyAndMove::NewL(MGlxMediaListProvider* aMediaListProvider, TInt aMenuResource) |
48 EXPORT_C CGlxCommandHandlerCopyAndMove* CGlxCommandHandlerCopyAndMove::NewL( |
49 { |
49 MGlxMediaListProvider* aMediaListProvider, TInt aMenuResource, |
50 CGlxCommandHandlerCopyAndMove* self = new (ELeave) CGlxCommandHandlerCopyAndMove(aMediaListProvider, aMenuResource); |
50 const TDesC& aFileName) |
51 CleanupStack::PushL(self); |
51 { |
52 self->ConstructL(); |
52 CGlxCommandHandlerCopyAndMove* self = |
53 CleanupStack::Pop(self); |
53 new (ELeave) CGlxCommandHandlerCopyAndMove(aMediaListProvider, |
54 return self; |
54 aMenuResource); |
55 } |
55 CleanupStack::PushL(self); |
|
56 self->ConstructL(aFileName); |
|
57 CleanupStack::Pop(self); |
|
58 return self; |
|
59 } |
56 |
60 |
57 // --------------------------------------------------------------------------- |
61 // --------------------------------------------------------------------------- |
58 // Destructor. |
62 // Destructor. |
59 // --------------------------------------------------------------------------- |
63 // --------------------------------------------------------------------------- |
60 // |
64 // |
145 |
149 |
146 // --------------------------------------------------------------------------- |
150 // --------------------------------------------------------------------------- |
147 // Symbian 2nd phase constructor can leave. |
151 // Symbian 2nd phase constructor can leave. |
148 // --------------------------------------------------------------------------- |
152 // --------------------------------------------------------------------------- |
149 // |
153 // |
150 void CGlxCommandHandlerCopyAndMove::ConstructL() |
154 void CGlxCommandHandlerCopyAndMove::ConstructL(const TDesC& aFileName) |
151 { |
155 { |
152 // Load resource file |
156 // Load resource file |
153 TParse parse; |
157 |
154 parse.Set(KGlxUiUtilitiesResource, &KDC_APP_RESOURCE_DIR, NULL); |
158 iResourceOffset = CCoeEnv::Static()->AddResourceFileL(aFileName); |
155 TFileName resourceFile; |
159 |
156 resourceFile.Append(parse.FullName()); |
160 // Add supported command |
157 CGlxResourceUtilities::GetResourceFilenameL(resourceFile); |
161 TCommandInfo copyInfo(EGlxCmdCopy); |
158 |
162 copyInfo.iMinSelectionLength = 1; |
159 iResourceOffset = CCoeEnv::Static()->AddResourceFileL(resourceFile); |
163 copyInfo.iMaxSelectionLength = KMaxTInt; |
160 |
164 // Filter out static items |
161 // Add supported command |
165 AddCommandL(copyInfo); |
162 TCommandInfo copyInfo(EGlxCmdCopy); |
166 |
163 copyInfo.iMinSelectionLength = 1; |
167 TCommandInfo moveInfo(EGlxCmdMove); |
164 copyInfo.iMaxSelectionLength = KMaxTInt; |
168 moveInfo.iMinSelectionLength = 1; |
165 // Filter out static items |
169 moveInfo.iMaxSelectionLength = KMaxTInt; |
166 AddCommandL(copyInfo); |
170 // Filter out static items |
167 |
171 AddCommandL(moveInfo); |
168 TCommandInfo moveInfo(EGlxCmdMove); |
172 |
169 moveInfo.iMinSelectionLength = 1; |
173 TCommandInfo copyAndMoveSubmenuInfo(EGlxCmdCopyMoveSubmenu); |
170 moveInfo.iMaxSelectionLength = KMaxTInt; |
174 copyAndMoveSubmenuInfo.iMinSelectionLength = 1; |
171 // Filter out static items |
175 copyAndMoveSubmenuInfo.iMaxSelectionLength = KMaxTInt; |
172 AddCommandL(moveInfo); |
176 // Show in Grid View |
173 |
177 copyAndMoveSubmenuInfo.iViewingState = TCommandInfo::EViewingStateBrowse; |
174 TCommandInfo copyAndMoveSubmenuInfo(EGlxCmdCopyMoveSubmenu); |
178 // Filter out static items |
175 copyAndMoveSubmenuInfo.iMinSelectionLength = 1; |
179 // (The whole sub menu should be filtered out if a static item is selected) |
176 copyAndMoveSubmenuInfo.iMaxSelectionLength = KMaxTInt; |
180 AddCommandL(copyAndMoveSubmenuInfo); |
177 // Show in Grid View |
181 |
178 copyAndMoveSubmenuInfo.iViewingState = TCommandInfo::EViewingStateBrowse; |
182 TCommandInfo browseInfo(EGlxCmdStateBrowse); |
179 // Filter out static items |
183 browseInfo.iMinSelectionLength = 0; |
180 // (The whole sub menu should be filtered out if a static item is selected) |
184 browseInfo.iMaxSelectionLength = KMaxTInt; |
181 AddCommandL(copyAndMoveSubmenuInfo); |
185 // Filter out static items |
182 |
186 AddCommandL(browseInfo); |
183 TCommandInfo browseInfo(EGlxCmdStateBrowse); |
187 |
184 browseInfo.iMinSelectionLength = 0; |
188 TCommandInfo viewInfo(EGlxCmdStateView); |
185 browseInfo.iMaxSelectionLength = KMaxTInt; |
189 viewInfo.iMinSelectionLength = 0; |
186 // Filter out static items |
190 viewInfo.iMaxSelectionLength = KMaxTInt; |
187 AddCommandL(browseInfo); |
191 // Filter out static items |
188 |
192 AddCommandL(viewInfo); |
189 TCommandInfo viewInfo(EGlxCmdStateView); |
193 } |
190 viewInfo.iMinSelectionLength = 0; |
|
191 viewInfo.iMaxSelectionLength = KMaxTInt; |
|
192 // Filter out static items |
|
193 AddCommandL(viewInfo); |
|
194 } |
|
195 |
194 |
196 // --------------------------------------------------------------------------- |
195 // --------------------------------------------------------------------------- |
197 // C++ default constructor can NOT contain any code, that |
196 // C++ default constructor can NOT contain any code, that |
198 // might leave. |
197 // might leave. |
199 // --------------------------------------------------------------------------- |
198 // --------------------------------------------------------------------------- |