24 |
24 |
25 #include <glxcommandhandlers.hrh> |
25 #include <glxcommandhandlers.hrh> |
26 #include <glxmedia.h> |
26 #include <glxmedia.h> |
27 #include <glxuiutilities.rsg> |
27 #include <glxuiutilities.rsg> |
28 |
28 |
|
29 #include <glxnavigationalstate.h> |
|
30 #include <mpxcollectionpath.h> |
|
31 #include <glxcollectionpluginimageviewer.hrh> |
|
32 |
29 #include "glxaiwservicehandler.h" |
33 #include "glxaiwservicehandler.h" |
30 #include <StringLoader.h> |
34 #include <StringLoader.h> |
31 #include <glxmedialist.h> |
35 #include <glxmedialist.h> |
32 #include <glxtracer.h> |
36 #include <glxtracer.h> |
33 #include <glxlog.h> |
37 #include <glxlog.h> |
|
38 #include <AiwGenericParam.h> // for passing data between applications |
|
39 #include "AiwServiceHandler.h" // AIW service handler |
|
40 #include "glxmedia.h" |
|
41 |
34 const TInt KGlxAiwEditCommandSpace = 0x00000200; |
42 const TInt KGlxAiwEditCommandSpace = 0x00000200; |
35 |
43 |
36 // ----------------------------------------------------------------------------- |
44 // ----------------------------------------------------------------------------- |
37 // NewL |
45 // NewL |
38 // ----------------------------------------------------------------------------- |
46 // ----------------------------------------------------------------------------- |
39 // |
47 // |
40 EXPORT_C CGlxCommandHandlerAiwEdit* CGlxCommandHandlerAiwEdit::NewL( |
48 EXPORT_C CGlxCommandHandlerAiwEdit* CGlxCommandHandlerAiwEdit::NewL(MGlxMediaListProvider* aMediaListProvider, TBool aCommandSingleClick) |
41 MGlxMediaListProvider* aMediaListProvider, TInt aMenuResource, |
|
42 TBool aCommandSingleClick) |
|
43 { |
49 { |
44 CGlxCommandHandlerAiwEdit* self = new ( ELeave ) |
50 CGlxCommandHandlerAiwEdit* self = new (ELeave) CGlxCommandHandlerAiwEdit(aMediaListProvider, aCommandSingleClick); |
45 CGlxCommandHandlerAiwEdit(aMediaListProvider, aMenuResource); |
51 CleanupStack::PushL(self); |
46 CleanupStack::PushL( self ); |
52 self->ConstructL(); |
47 self->ConstructL(aCommandSingleClick); |
53 CleanupStack::Pop(self); |
48 CleanupStack::Pop( self ); |
|
49 return self; |
54 return self; |
50 } |
55 } |
51 |
56 |
52 // --------------------------------------------------------------------------- |
57 // ----------------------------------------------------------------------------- |
53 // Symbian 2nd phase constructor can leave. |
58 // ~CGlxCommandHandlerAiwEdit |
54 // --------------------------------------------------------------------------- |
59 // ----------------------------------------------------------------------------- |
55 // |
60 // |
56 void CGlxCommandHandlerAiwEdit::ConstructL(TBool aCommandSingleClick) |
61 EXPORT_C CGlxCommandHandlerAiwEdit::~CGlxCommandHandlerAiwEdit() |
57 { |
62 { |
58 TRACER("CGlxCommandHandlerAiwEdit::ConstructL"); |
63 delete iServiceHandler; |
59 CGlxCommandHandlerAiwBase::ConstructL(); |
|
60 iCommandSingleClick = aCommandSingleClick; |
|
61 } |
64 } |
62 |
65 |
63 // ----------------------------------------------------------------------------- |
66 // ----------------------------------------------------------------------------- |
64 // CGlxCommandHandlerAiwEdit::DoGetRequiredAttributesL |
67 // ConstructL |
65 // ----------------------------------------------------------------------------- |
68 // ----------------------------------------------------------------------------- |
66 // |
69 // |
67 void CGlxCommandHandlerAiwEdit::DoGetRequiredAttributesL |
70 void CGlxCommandHandlerAiwEdit::ConstructL() |
68 (RArray<TMPXAttribute>& aAttributes, TBool aFilterUsingSelection) const |
|
69 { |
|
70 if (!aFilterUsingSelection || SelectionLength() <= MaxSelectedItems()) |
|
71 { |
|
72 // Add MIME type and fileaname attributes |
|
73 aAttributes.AppendL(KMPXMediaGeneralMimeType); |
|
74 aAttributes.AppendL(KMPXMediaGeneralUri); |
|
75 } |
|
76 } |
|
77 |
|
78 // ----------------------------------------------------------------------------- |
|
79 // Constructor |
|
80 // ----------------------------------------------------------------------------- |
|
81 // |
|
82 CGlxCommandHandlerAiwEdit::CGlxCommandHandlerAiwEdit( |
|
83 MGlxMediaListProvider* aMediaListProvider, TInt aMenuResource) |
|
84 : CGlxCommandHandlerAiwBase(aMediaListProvider, aMenuResource) |
|
85 { |
71 { |
86 } |
72 TRAP_IGNORE( |
|
73 { |
|
74 iServiceHandler = CAiwServiceHandler::NewL(); |
|
75 iServiceHandler->AttachL( R_GLX_AIW_EDIT_INTEREST ); |
|
76 iEditSupported = ETrue; |
|
77 } ); |
87 |
78 |
88 // ----------------------------------------------------------------------------- |
79 if(iCommandSingleClick) |
89 // CommandId |
|
90 // ----------------------------------------------------------------------------- |
|
91 // |
|
92 TInt CGlxCommandHandlerAiwEdit::CommandId() const |
|
93 { |
|
94 if (iCommandSingleClick) |
|
95 { |
80 { |
96 return EGlxCmdAiwSingleClickEdit; |
81 TCommandInfo info(EGlxCmdAiwSingleClickEdit); |
|
82 AddCommandL(info); |
97 } |
83 } |
98 return EGlxCmdAiwEdit; |
84 else |
99 } |
|
100 |
|
101 // ----------------------------------------------------------------------------- |
|
102 // AiwCommandId |
|
103 // ----------------------------------------------------------------------------- |
|
104 // |
|
105 TInt CGlxCommandHandlerAiwEdit::AiwCommandId() const |
|
106 { |
|
107 return KAiwCmdEdit; |
|
108 } |
|
109 |
|
110 // ----------------------------------------------------------------------------- |
|
111 // AiwInterestResource |
|
112 // ----------------------------------------------------------------------------- |
|
113 // |
|
114 TInt CGlxCommandHandlerAiwEdit::AiwInterestResource() const |
|
115 { |
|
116 if (iCommandSingleClick) |
|
117 { |
85 { |
118 return R_GLX_AIW_SINGLE_CLICK_EDIT_INTEREST; |
86 TCommandInfo info(EGlxCmdAiwEdit); |
119 } |
87 AddCommandL(info); |
120 return R_GLX_AIW_EDIT_INTEREST; |
88 } |
121 } |
|
122 |
|
123 // ----------------------------------------------------------------------------- |
|
124 // AppendAiwParameterL |
|
125 // ----------------------------------------------------------------------------- |
|
126 // |
|
127 TBool CGlxCommandHandlerAiwEdit::AppendAiwParameterL(const TGlxMedia& aItem, |
|
128 CGlxAiwServiceHandler& aAiwServiceHandler) |
|
129 { |
|
130 return AppendDefaultAiwParameterL( aItem, |
|
131 aAiwServiceHandler, |
|
132 ETrue, // Add the Uri |
|
133 ETrue); // Add the Mime Type |
|
134 |
|
135 } |
89 } |
136 |
90 |
137 // ----------------------------------------------------------------------------- |
91 // ----------------------------------------------------------------------------- |
138 // CommandSpace |
92 // CGlxCommandHandlerAiwEdit |
139 // ----------------------------------------------------------------------------- |
93 // ----------------------------------------------------------------------------- |
140 // |
94 // |
141 TInt CGlxCommandHandlerAiwEdit::CommandSpace() const |
95 CGlxCommandHandlerAiwEdit::CGlxCommandHandlerAiwEdit( MGlxMediaListProvider* aMediaListProvider, TBool aCommandSingleClick ) |
|
96 :CGlxMediaListCommandHandler(aMediaListProvider), |
|
97 iCommandSingleClick(aCommandSingleClick) |
142 { |
98 { |
143 return KGlxAiwEditCommandSpace; |
99 // Do Nothing |
144 } |
100 } |
145 |
101 |
146 // ----------------------------------------------------------------------------- |
102 // ----------------------------------------------------------------------------- |
147 // AiwDoDynInitMenuPaneL |
103 // DoActivateL |
148 // ----------------------------------------------------------------------------- |
104 // ----------------------------------------------------------------------------- |
149 // |
105 // |
150 void CGlxCommandHandlerAiwEdit::AiwDoDynInitMenuPaneL(TInt /*aResourceId*/, |
106 void CGlxCommandHandlerAiwEdit::DoActivateL(TInt /*aViewId*/) |
151 CEikMenuPane* aMenuPane) |
|
152 { |
107 { |
153 TRACER("CGlxCommandHandlerAiwEdit::AiwDoDynInitMenuPaneL()"); |
108 // DO Nothing |
154 HBufC* currentTitle = StringLoader::LoadLC( R_QTN_LGAL_OPTIONS_EDIT ); |
109 } |
155 TInt cmdId = AiwMenuCmdIdL( *currentTitle,aMenuPane ) ; |
|
156 CleanupStack::PopAndDestroy(currentTitle); |
|
157 |
110 |
158 if (KErrNotFound != cmdId) |
111 // ----------------------------------------------------------------------------- |
|
112 // DynInitMenuPaneL |
|
113 // ----------------------------------------------------------------------------- |
|
114 // |
|
115 void CGlxCommandHandlerAiwEdit::DynInitMenuPaneL(TInt aResourceId, CEikMenuPane* aMenuPane) |
|
116 { |
|
117 MGlxMediaList& mediaList = MediaList(); |
|
118 TInt pos; |
|
119 |
|
120 if (aMenuPane && iCommandSingleClick && aMenuPane->MenuItemExists(EGlxCmdAiwSingleClickEdit, pos) |
|
121 && (mediaList.SelectionCount() > 1)) |
159 { |
122 { |
160 if (iCommandSingleClick && (MediaList().SelectionCount() > 1)) |
123 aMenuPane->SetItemDimmed(EGlxCmdAiwSingleClickEdit, ETrue); |
|
124 } |
|
125 else if (aMenuPane && aMenuPane->MenuItemExists(EGlxCmdAiwEdit, pos) |
|
126 && (mediaList.SelectionCount() != 1) && !IsInFullScreenViewingModeL()) |
|
127 { |
|
128 aMenuPane->SetItemDimmed(EGlxCmdAiwEdit, ETrue); |
|
129 } |
|
130 |
|
131 } |
|
132 |
|
133 // ----------------------------------------------------------------------------- |
|
134 // DoExecuteL |
|
135 // ----------------------------------------------------------------------------- |
|
136 // |
|
137 TBool CGlxCommandHandlerAiwEdit::DoExecuteL( TInt aCommandId , MGlxMediaList& aList) |
|
138 { |
|
139 TBool handled = EFalse; |
|
140 if (iEditSupported && (EGlxCmdAiwEdit == aCommandId || EGlxCmdAiwSingleClickEdit == aCommandId)) |
|
141 { |
|
142 CAiwGenericParamList& inputParams = iServiceHandler->InParamListL(); |
|
143 |
|
144 TGlxSelectionIterator iterator; |
|
145 iterator.SetToFirst(&aList); |
|
146 TInt index = iterator++; |
|
147 const TGlxMedia& mediaItem = aList.Item(index); |
|
148 |
|
149 TAiwGenericParam param( EGenericParamFile, TAiwVariant(mediaItem.Uri())); |
|
150 inputParams.AppendL( param ); |
|
151 |
|
152 TAiwGenericParam param2( EGenericParamMIMEType, TAiwVariant(mediaItem.MimeType())); |
|
153 inputParams.AppendL( param2 ); |
|
154 |
|
155 // Execute the KAiwCmdUpload command EGlxCmdAiwEdit |
|
156 iServiceHandler->ExecuteServiceCmdL(KAiwCmdEdit, inputParams, iServiceHandler->OutParamListL()); |
|
157 |
|
158 handled = ETrue; |
|
159 } |
|
160 return handled; |
|
161 } |
|
162 |
|
163 // ----------------------------------------------------------------------------- |
|
164 // IsInFullScreenViewingModeL |
|
165 // ----------------------------------------------------------------------------- |
|
166 // |
|
167 TBool CGlxCommandHandlerAiwEdit::IsInFullScreenViewingModeL() |
|
168 { |
|
169 TRACER("CGlxCommandHandlerAiwEdit::IsInFullScreenViewingModeL()"); |
|
170 TBool fullscreenViewingMode = EFalse; |
|
171 CGlxNavigationalState* aNavigationalState = CGlxNavigationalState::InstanceL(); |
|
172 CMPXCollectionPath* naviState = aNavigationalState->StateLC(); |
|
173 |
|
174 if ( naviState->Levels() >= 1) |
|
175 { |
|
176 if (aNavigationalState->ViewingMode() == NGlxNavigationalState::EBrowse) |
161 { |
177 { |
162 aMenuPane->SetItemDimmed(cmdId,ETrue); |
178 // For image viewer collection, goto view mode |
163 } |
179 if (naviState->Id() == TMPXItemId(KGlxCollectionPluginImageViewerImplementationUid)) |
164 else if ( MediaList().SelectionCount() != 1) |
180 { |
|
181 //it means we are in img viewer |
|
182 fullscreenViewingMode = ETrue; |
|
183 } |
|
184 } |
|
185 else |
165 { |
186 { |
166 // Enable ONLY when a single item marked |
187 //it means we are in Fullscreen |
167 aMenuPane->SetItemDimmed(cmdId,ETrue); |
188 fullscreenViewingMode = ETrue; |
168 } |
189 } |
169 } |
190 } |
|
191 CleanupStack::PopAndDestroy( naviState ); |
|
192 aNavigationalState->Close(); |
|
193 return fullscreenViewingMode; |
170 } |
194 } |