42 // ----------------------------------------------------------------------------- |
42 // ----------------------------------------------------------------------------- |
43 // NewL |
43 // NewL |
44 // ----------------------------------------------------------------------------- |
44 // ----------------------------------------------------------------------------- |
45 // |
45 // |
46 EXPORT_C CGlxCommandHandlerAiwEdit* CGlxCommandHandlerAiwEdit::NewL( |
46 EXPORT_C CGlxCommandHandlerAiwEdit* CGlxCommandHandlerAiwEdit::NewL( |
47 MGlxMediaListProvider* aMediaListProvider, TBool aCommandSingleClick) |
47 MGlxMediaListProvider* aMediaListProvider) |
48 { |
48 { |
49 CGlxCommandHandlerAiwEdit* self = new (ELeave) CGlxCommandHandlerAiwEdit( |
49 CGlxCommandHandlerAiwEdit* self = new (ELeave) CGlxCommandHandlerAiwEdit( |
50 aMediaListProvider, aCommandSingleClick); |
50 aMediaListProvider); |
51 CleanupStack::PushL(self); |
51 CleanupStack::PushL(self); |
52 self->ConstructL(); |
52 self->ConstructL(); |
53 CleanupStack::Pop(self); |
53 CleanupStack::Pop(self); |
54 return self; |
54 return self; |
55 } |
55 } |
75 void CGlxCommandHandlerAiwEdit::ConstructL() |
75 void CGlxCommandHandlerAiwEdit::ConstructL() |
76 { |
76 { |
77 CFeatureDiscovery* featManager = CFeatureDiscovery::NewL(); |
77 CFeatureDiscovery* featManager = CFeatureDiscovery::NewL(); |
78 CleanupStack::PushL(featManager); |
78 CleanupStack::PushL(featManager); |
79 |
79 |
80 if(featManager->IsFeatureSupportedL(KFeatureIdFfImageEditor) |
80 if(featManager->IsFeatureSupportedL(KFeatureIdFfImageEditor)) |
81 && featManager->IsFeatureSupportedL(KFeatureIdFfVideoEditor)) |
81 { |
|
82 iIsImageEditSupported = ETrue; |
|
83 } |
|
84 |
|
85 if(featManager->IsFeatureSupportedL(KFeatureIdFfVideoEditor)) |
|
86 { |
|
87 iIsVideoEditSupported = ETrue; |
|
88 } |
|
89 |
|
90 if(iIsVideoEditSupported || iIsImageEditSupported) |
82 { |
91 { |
83 TRAP_IGNORE( |
92 TRAP_IGNORE( |
84 { |
93 { |
85 iServiceHandler = CAiwServiceHandler::NewL(); |
94 iServiceHandler = CAiwServiceHandler::NewL(); |
86 iServiceHandler->AttachL( R_GLX_AIW_EDIT_INTEREST ); |
95 iServiceHandler->AttachL( R_GLX_AIW_EDIT_INTEREST ); |
87 iEditSupported = ETrue; |
|
88 }); |
96 }); |
89 } |
97 } |
90 CleanupStack::PopAndDestroy(featManager); |
98 CleanupStack::PopAndDestroy(featManager); |
91 |
99 |
92 if (iCommandSingleClick) |
100 TCommandInfo info(EGlxCmdAiwEdit); |
93 { |
101 AddCommandL(info); |
94 TCommandInfo info(EGlxCmdAiwSingleClickEdit); |
|
95 AddCommandL(info); |
|
96 } |
|
97 else |
|
98 { |
|
99 TCommandInfo info(EGlxCmdAiwEdit); |
|
100 AddCommandL(info); |
|
101 } |
|
102 |
102 |
103 iImageViewerInstance = CGlxImageViewerManager::InstanceL(); |
103 iImageViewerInstance = CGlxImageViewerManager::InstanceL(); |
104 |
104 |
105 iIsFullScreenMode = IsInFullScreenViewingModeL(); |
105 iIsFullScreenMode = IsInFullScreenViewingModeL(); |
106 } |
106 } |
108 // ----------------------------------------------------------------------------- |
108 // ----------------------------------------------------------------------------- |
109 // CGlxCommandHandlerAiwEdit |
109 // CGlxCommandHandlerAiwEdit |
110 // ----------------------------------------------------------------------------- |
110 // ----------------------------------------------------------------------------- |
111 // |
111 // |
112 CGlxCommandHandlerAiwEdit::CGlxCommandHandlerAiwEdit( |
112 CGlxCommandHandlerAiwEdit::CGlxCommandHandlerAiwEdit( |
113 MGlxMediaListProvider* aMediaListProvider, TBool aCommandSingleClick) : |
113 MGlxMediaListProvider* aMediaListProvider) : |
114 CGlxMediaListCommandHandler(aMediaListProvider), iCommandSingleClick( |
114 CGlxMediaListCommandHandler(aMediaListProvider) |
115 aCommandSingleClick) |
|
116 { |
115 { |
117 // Do Nothing |
116 // Do Nothing |
118 } |
117 } |
119 |
118 |
120 // ----------------------------------------------------------------------------- |
119 // ----------------------------------------------------------------------------- |
135 { |
134 { |
136 |
135 |
137 if (aMenuPane) |
136 if (aMenuPane) |
138 { |
137 { |
139 MGlxMediaList& mediaList = MediaList(); |
138 MGlxMediaList& mediaList = MediaList(); |
140 TInt pos; |
139 TInt pos = 0; |
141 //If stylus menu is present, hide it for multiple selection |
140 |
142 if (iCommandSingleClick && aMenuPane->MenuItemExists( |
141 TBool editSupported = EFalse; |
143 EGlxCmdAiwSingleClickEdit, pos) |
142 TGlxSelectionIterator iterator; |
144 |
143 iterator.SetToFirst(&mediaList); |
145 && (((!mediaList.Count()) || (mediaList.SelectionCount() > 1)) |
144 TInt index = iterator++; |
146 || !iEditSupported)) |
145 if ( index != KErrNotFound ) |
147 { |
146 { |
148 aMenuPane->SetItemDimmed(EGlxCmdAiwSingleClickEdit, ETrue); |
147 TMPXGeneralCategory cat = mediaList.Item(index).Category(); |
149 } |
148 |
150 //For Edit menu item present in Options CBA |
149 if ( cat == EMPXImage && iIsImageEditSupported) |
151 else if (aMenuPane->MenuItemExists(EGlxCmdAiwEdit, pos)) |
150 { |
|
151 editSupported = ETrue; |
|
152 } |
|
153 else if ( cat == EMPXVideo && iIsVideoEditSupported) |
|
154 { |
|
155 editSupported = ETrue; |
|
156 } |
|
157 } |
|
158 if (aMenuPane->MenuItemExists(EGlxCmdAiwEdit, pos)) |
152 { |
159 { |
153 // If the image path is private or view is in grid & |
160 // If the image path is private or view is in grid & |
154 // selection is not equal to 1, we should hide Edit menu item |
161 // selection is greater than 1, we should hide Edit menu item |
155 if ((iImageViewerInstance->IsPrivate() |
162 if (iImageViewerInstance->IsPrivate() |
156 || (mediaList.SelectionCount() != 1 |
163 || ((!mediaList.Count() || (mediaList.SelectionCount() > 1)) |
157 && !iIsFullScreenMode)) |
164 || !editSupported)) |
158 || !iEditSupported) |
|
159 { |
165 { |
160 aMenuPane->SetItemDimmed(EGlxCmdAiwEdit, ETrue); |
166 aMenuPane->SetItemDimmed(EGlxCmdAiwEdit, ETrue); |
161 } |
167 } |
162 } |
168 } |
163 } |
169 } |
169 // |
175 // |
170 TBool CGlxCommandHandlerAiwEdit::DoExecuteL(TInt aCommandId, |
176 TBool CGlxCommandHandlerAiwEdit::DoExecuteL(TInt aCommandId, |
171 MGlxMediaList& aList) |
177 MGlxMediaList& aList) |
172 { |
178 { |
173 TBool handled = EFalse; |
179 TBool handled = EFalse; |
174 if (iEditSupported && (EGlxCmdAiwEdit == aCommandId |
180 if ((iIsImageEditSupported || iIsVideoEditSupported) |
175 || EGlxCmdAiwSingleClickEdit == aCommandId)) |
181 && (EGlxCmdAiwEdit == aCommandId)) |
176 { |
182 { |
177 CAiwGenericParamList& inputParams = iServiceHandler->InParamListL(); |
183 CAiwGenericParamList& inputParams = iServiceHandler->InParamListL(); |
178 |
184 |
179 TGlxSelectionIterator iterator; |
185 TGlxSelectionIterator iterator; |
180 iterator.SetToFirst(&aList); |
186 iterator.SetToFirst(&aList); |