37 #include <glxlog.h> |
37 #include <glxlog.h> |
38 #include <AiwGenericParam.h> // for passing data between applications |
38 #include <AiwGenericParam.h> // for passing data between applications |
39 #include "AiwServiceHandler.h" // AIW service handler |
39 #include "AiwServiceHandler.h" // AIW service handler |
40 #include "glxmedia.h" |
40 #include "glxmedia.h" |
41 |
41 |
42 const TInt KGlxAiwEditCommandSpace = 0x00000200; |
|
43 |
42 |
44 // ----------------------------------------------------------------------------- |
43 // ----------------------------------------------------------------------------- |
45 // NewL |
44 // NewL |
46 // ----------------------------------------------------------------------------- |
45 // ----------------------------------------------------------------------------- |
47 // |
46 // |
48 EXPORT_C CGlxCommandHandlerAiwEdit* CGlxCommandHandlerAiwEdit::NewL(MGlxMediaListProvider* aMediaListProvider, TBool aCommandSingleClick) |
47 EXPORT_C CGlxCommandHandlerAiwEdit* CGlxCommandHandlerAiwEdit::NewL( |
49 { |
48 MGlxMediaListProvider* aMediaListProvider, TBool aCommandSingleClick) |
50 CGlxCommandHandlerAiwEdit* self = new (ELeave) CGlxCommandHandlerAiwEdit(aMediaListProvider, aCommandSingleClick); |
49 { |
|
50 CGlxCommandHandlerAiwEdit* self = new (ELeave) CGlxCommandHandlerAiwEdit( |
|
51 aMediaListProvider, aCommandSingleClick); |
51 CleanupStack::PushL(self); |
52 CleanupStack::PushL(self); |
52 self->ConstructL(); |
53 self->ConstructL(); |
53 CleanupStack::Pop(self); |
54 CleanupStack::Pop(self); |
54 return self; |
55 return self; |
55 } |
56 } |
59 // ----------------------------------------------------------------------------- |
60 // ----------------------------------------------------------------------------- |
60 // |
61 // |
61 EXPORT_C CGlxCommandHandlerAiwEdit::~CGlxCommandHandlerAiwEdit() |
62 EXPORT_C CGlxCommandHandlerAiwEdit::~CGlxCommandHandlerAiwEdit() |
62 { |
63 { |
63 delete iServiceHandler; |
64 delete iServiceHandler; |
|
65 |
|
66 if (NULL != iImageViewerInstance) |
|
67 { |
|
68 iImageViewerInstance->DeleteInstance(); |
|
69 } |
64 } |
70 } |
65 |
71 |
66 // ----------------------------------------------------------------------------- |
72 // ----------------------------------------------------------------------------- |
67 // ConstructL |
73 // ConstructL |
68 // ----------------------------------------------------------------------------- |
74 // ----------------------------------------------------------------------------- |
69 // |
75 // |
70 void CGlxCommandHandlerAiwEdit::ConstructL() |
76 void CGlxCommandHandlerAiwEdit::ConstructL() |
71 { |
77 { |
72 TRAP_IGNORE( |
78 TRAP_IGNORE( |
73 { |
79 { |
74 iServiceHandler = CAiwServiceHandler::NewL(); |
80 iServiceHandler = CAiwServiceHandler::NewL(); |
75 iServiceHandler->AttachL( R_GLX_AIW_EDIT_INTEREST ); |
81 iServiceHandler->AttachL( R_GLX_AIW_EDIT_INTEREST ); |
76 iEditSupported = ETrue; |
82 iEditSupported = ETrue; |
77 } ); |
83 }); |
78 |
84 |
79 if(iCommandSingleClick) |
85 if (iCommandSingleClick) |
80 { |
86 { |
81 TCommandInfo info(EGlxCmdAiwSingleClickEdit); |
87 TCommandInfo info(EGlxCmdAiwSingleClickEdit); |
82 AddCommandL(info); |
88 AddCommandL(info); |
83 } |
89 } |
84 else |
90 else |
85 { |
91 { |
86 TCommandInfo info(EGlxCmdAiwEdit); |
92 TCommandInfo info(EGlxCmdAiwEdit); |
87 AddCommandL(info); |
93 AddCommandL(info); |
88 } |
94 } |
|
95 |
|
96 iImageViewerInstance = CGlxImageViewerManager::InstanceL(); |
89 } |
97 } |
90 |
98 |
91 // ----------------------------------------------------------------------------- |
99 // ----------------------------------------------------------------------------- |
92 // CGlxCommandHandlerAiwEdit |
100 // CGlxCommandHandlerAiwEdit |
93 // ----------------------------------------------------------------------------- |
101 // ----------------------------------------------------------------------------- |
94 // |
102 // |
95 CGlxCommandHandlerAiwEdit::CGlxCommandHandlerAiwEdit( MGlxMediaListProvider* aMediaListProvider, TBool aCommandSingleClick ) |
103 CGlxCommandHandlerAiwEdit::CGlxCommandHandlerAiwEdit( |
96 :CGlxMediaListCommandHandler(aMediaListProvider), |
104 MGlxMediaListProvider* aMediaListProvider, TBool aCommandSingleClick) : |
97 iCommandSingleClick(aCommandSingleClick) |
105 CGlxMediaListCommandHandler(aMediaListProvider), iCommandSingleClick( |
|
106 aCommandSingleClick) |
98 { |
107 { |
99 // Do Nothing |
108 // Do Nothing |
100 } |
109 } |
101 |
110 |
102 // ----------------------------------------------------------------------------- |
111 // ----------------------------------------------------------------------------- |
110 |
119 |
111 // ----------------------------------------------------------------------------- |
120 // ----------------------------------------------------------------------------- |
112 // DynInitMenuPaneL |
121 // DynInitMenuPaneL |
113 // ----------------------------------------------------------------------------- |
122 // ----------------------------------------------------------------------------- |
114 // |
123 // |
115 void CGlxCommandHandlerAiwEdit::DynInitMenuPaneL(TInt aResourceId, CEikMenuPane* aMenuPane) |
124 void CGlxCommandHandlerAiwEdit::DynInitMenuPaneL(TInt aResourceId, |
|
125 CEikMenuPane* aMenuPane) |
116 { |
126 { |
117 MGlxMediaList& mediaList = MediaList(); |
127 MGlxMediaList& mediaList = MediaList(); |
118 TInt pos; |
128 TInt pos; |
119 |
129 |
120 if (aMenuPane && iCommandSingleClick && aMenuPane->MenuItemExists(EGlxCmdAiwSingleClickEdit, pos) |
130 if (aMenuPane) |
121 && (mediaList.SelectionCount() > 1)) |
131 { |
122 { |
132 //If stylus menu is present, hide it for multiple selection |
123 aMenuPane->SetItemDimmed(EGlxCmdAiwSingleClickEdit, ETrue); |
133 if (iCommandSingleClick && aMenuPane->MenuItemExists( |
124 } |
134 EGlxCmdAiwSingleClickEdit, pos) |
125 else if (aMenuPane && aMenuPane->MenuItemExists(EGlxCmdAiwEdit, pos) |
135 && (mediaList.SelectionCount() > 1)) |
126 && (mediaList.SelectionCount() != 1) && !IsInFullScreenViewingModeL()) |
136 { |
127 { |
137 aMenuPane->SetItemDimmed(EGlxCmdAiwSingleClickEdit, ETrue); |
128 aMenuPane->SetItemDimmed(EGlxCmdAiwEdit, ETrue); |
138 } |
129 } |
139 //For Edit menu item present in Options CBA |
130 |
140 else if (aMenuPane->MenuItemExists(EGlxCmdAiwEdit, pos)) |
|
141 { |
|
142 // If the image path is private or view is in grid & |
|
143 // selection is not equal to 1, we should hide Edit menu item |
|
144 if (iImageViewerInstance->IsPrivate() || |
|
145 (mediaList.SelectionCount() != 1 |
|
146 && !IsInFullScreenViewingModeL())) |
|
147 { |
|
148 aMenuPane->SetItemDimmed(EGlxCmdAiwEdit, ETrue); |
|
149 } |
|
150 } |
|
151 } |
131 } |
152 } |
132 |
153 |
133 // ----------------------------------------------------------------------------- |
154 // ----------------------------------------------------------------------------- |
134 // DoExecuteL |
155 // DoExecuteL |
135 // ----------------------------------------------------------------------------- |
156 // ----------------------------------------------------------------------------- |
136 // |
157 // |
137 TBool CGlxCommandHandlerAiwEdit::DoExecuteL( TInt aCommandId , MGlxMediaList& aList) |
158 TBool CGlxCommandHandlerAiwEdit::DoExecuteL(TInt aCommandId, |
|
159 MGlxMediaList& aList) |
138 { |
160 { |
139 TBool handled = EFalse; |
161 TBool handled = EFalse; |
140 if (iEditSupported && (EGlxCmdAiwEdit == aCommandId || EGlxCmdAiwSingleClickEdit == aCommandId)) |
162 if (iEditSupported && (EGlxCmdAiwEdit == aCommandId |
141 { |
163 || EGlxCmdAiwSingleClickEdit == aCommandId)) |
|
164 { |
142 CAiwGenericParamList& inputParams = iServiceHandler->InParamListL(); |
165 CAiwGenericParamList& inputParams = iServiceHandler->InParamListL(); |
143 |
166 |
144 TGlxSelectionIterator iterator; |
167 TGlxSelectionIterator iterator; |
145 iterator.SetToFirst(&aList); |
168 iterator.SetToFirst(&aList); |
146 TInt index = iterator++; |
169 TInt index = iterator++; |
147 const TGlxMedia& mediaItem = aList.Item(index); |
170 const TGlxMedia& mediaItem = aList.Item(index); |
148 |
171 |
149 TAiwGenericParam param( EGenericParamFile, TAiwVariant(mediaItem.Uri())); |
172 TAiwGenericParam param(EGenericParamFile, |
150 inputParams.AppendL( param ); |
173 TAiwVariant(mediaItem.Uri())); |
151 |
174 inputParams.AppendL(param); |
152 TAiwGenericParam param2( EGenericParamMIMEType, TAiwVariant(mediaItem.MimeType())); |
175 |
153 inputParams.AppendL( param2 ); |
176 TAiwGenericParam param2(EGenericParamMIMEType, TAiwVariant( |
|
177 mediaItem.MimeType())); |
|
178 inputParams.AppendL(param2); |
154 |
179 |
155 // Execute the KAiwCmdUpload command EGlxCmdAiwEdit |
180 // Execute the KAiwCmdUpload command EGlxCmdAiwEdit |
156 iServiceHandler->ExecuteServiceCmdL(KAiwCmdEdit, inputParams, iServiceHandler->OutParamListL()); |
181 iServiceHandler->ExecuteServiceCmdL(KAiwCmdEdit, inputParams, |
|
182 iServiceHandler->OutParamListL()); |
157 |
183 |
158 handled = ETrue; |
184 handled = ETrue; |
159 } |
185 } |
160 return handled; |
186 return handled; |
161 } |
187 } |
162 |
188 |
163 // ----------------------------------------------------------------------------- |
189 // ----------------------------------------------------------------------------- |
164 // IsInFullScreenViewingModeL |
190 // IsInFullScreenViewingModeL |
166 // |
192 // |
167 TBool CGlxCommandHandlerAiwEdit::IsInFullScreenViewingModeL() |
193 TBool CGlxCommandHandlerAiwEdit::IsInFullScreenViewingModeL() |
168 { |
194 { |
169 TRACER("CGlxCommandHandlerAiwEdit::IsInFullScreenViewingModeL()"); |
195 TRACER("CGlxCommandHandlerAiwEdit::IsInFullScreenViewingModeL()"); |
170 TBool fullscreenViewingMode = EFalse; |
196 TBool fullscreenViewingMode = EFalse; |
171 CGlxNavigationalState* aNavigationalState = CGlxNavigationalState::InstanceL(); |
197 CGlxNavigationalState* aNavigationalState = |
|
198 CGlxNavigationalState::InstanceL(); |
172 CMPXCollectionPath* naviState = aNavigationalState->StateLC(); |
199 CMPXCollectionPath* naviState = aNavigationalState->StateLC(); |
173 |
200 |
174 if ( naviState->Levels() >= 1) |
201 if (naviState->Levels() >= 1) |
175 { |
202 { |
176 if (aNavigationalState->ViewingMode() == NGlxNavigationalState::EBrowse) |
203 if (aNavigationalState->ViewingMode() |
|
204 == NGlxNavigationalState::EBrowse) |
177 { |
205 { |
178 // For image viewer collection, goto view mode |
206 // For image viewer collection, goto view mode |
179 if (naviState->Id() == TMPXItemId(KGlxCollectionPluginImageViewerImplementationUid)) |
207 if (naviState->Id() == TMPXItemId( |
|
208 KGlxCollectionPluginImageViewerImplementationUid)) |
180 { |
209 { |
181 //it means we are in img viewer |
210 //it means we are in img viewer |
182 fullscreenViewingMode = ETrue; |
211 fullscreenViewingMode = ETrue; |
183 } |
212 } |
184 } |
213 } |
185 else |
214 else |
186 { |
215 { |
187 //it means we are in Fullscreen |
216 //it means we are in Fullscreen |
188 fullscreenViewingMode = ETrue; |
217 fullscreenViewingMode = ETrue; |
189 } |
218 } |
190 } |
219 } |
191 CleanupStack::PopAndDestroy( naviState ); |
220 CleanupStack::PopAndDestroy(naviState); |
192 aNavigationalState->Close(); |
221 aNavigationalState->Close(); |
193 return fullscreenViewingMode; |
222 return fullscreenViewingMode; |
194 } |
223 } |