|
1 /* |
|
2 * Copyright (c) 2008-2009 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: Rename command handler |
|
15 * |
|
16 */ |
|
17 |
|
18 |
|
19 |
|
20 |
|
21 #ifndef __C_GLXCOMMANDHANDLERRENAME_H__ |
|
22 #define __C_GLXCOMMANDHANDLERRENAME_H__ |
|
23 |
|
24 #include <e32base.h> |
|
25 #include <glxmpxcommandcommandhandler.h> |
|
26 |
|
27 class MGlxMediaListProvider; |
|
28 |
|
29 /** |
|
30 * @class CGlxCommandHandlerRename |
|
31 * |
|
32 * Command handler that renames a container item except if multiple items are |
|
33 * marked, or the selected item is a static or system item |
|
34 * or if the view is empty. |
|
35 * @author Rhodri Byles |
|
36 * @internal reviewed 21/06/2007 by Loughlin |
|
37 * |
|
38 */ |
|
39 NONSHARABLE_CLASS(CGlxCommandHandlerRename) : |
|
40 public CGlxMpxCommandCommandHandler |
|
41 { |
|
42 public: |
|
43 /** |
|
44 * Two-phase constructor |
|
45 * @param aMediaListProvider object that provides the media list |
|
46 * @param aHasToolbarItem Whether Command Should be toolbar item (ETrue - if toolbar item) |
|
47 */ |
|
48 IMPORT_C static CGlxCommandHandlerRename* NewL( |
|
49 MGlxMediaListProvider* aMediaListProvider, TBool aHasToolbarItem ); |
|
50 |
|
51 /** Destructor */ |
|
52 IMPORT_C ~CGlxCommandHandlerRename(); |
|
53 |
|
54 protected: |
|
55 /* |
|
56 * |
|
57 */ |
|
58 void PopulateToolbarL(); |
|
59 |
|
60 private: // From CGlxMpxCommandCommandHandler |
|
61 |
|
62 /** @ref CGlxMpxCommandCommandHandler::CreateCommandL */ |
|
63 CMPXCommand* CreateCommandL( TInt aCommandId, MGlxMediaList& aList, |
|
64 TBool& aConsume ) const; |
|
65 |
|
66 /** @ref CGlxMpxCommandCommandHandler::HandleErrorL */ |
|
67 void HandleErrorL( TInt aErrorCode ); |
|
68 |
|
69 private: |
|
70 /** |
|
71 * Callback functions to handle an error |
|
72 */ |
|
73 static TBool HandleErrorL(TAny* aPtr); |
|
74 inline void HandleErrorL(); |
|
75 |
|
76 private: |
|
77 /** Second phase constructor */ |
|
78 void ConstructL(); |
|
79 |
|
80 /** |
|
81 * Constructor |
|
82 * @param aMediaListProvider object that provides the media list |
|
83 */ |
|
84 CGlxCommandHandlerRename( MGlxMediaListProvider* aMediaListProvider, |
|
85 TBool aHasToolbarItem ); |
|
86 |
|
87 /** |
|
88 * Helper function to retrieve the title of the currently selected item. |
|
89 * If none is selected, the title of the item with focus is returned. |
|
90 * @param aTitle the title of the selected item |
|
91 * @param aList the media list containing the item |
|
92 */ |
|
93 void GetTitleL( TDes& aTitle, MGlxMediaList& aList ) const; |
|
94 |
|
95 private: |
|
96 /// Owned, the resource file offset |
|
97 TInt iResourceOffset; |
|
98 // Owned, new name |
|
99 HBufC* iRenameText; |
|
100 /// Owned, error value from HandleErrorL |
|
101 TInt iError; |
|
102 /// Owned, callback object for HandleErrorL |
|
103 CAsyncCallBack* iErrorCallback; |
|
104 }; |
|
105 |
|
106 #endif // __C_GLXCOMMANDHANDLERRENAME_H__ |