60
|
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: AIW assign command handler
|
|
15 |
*
|
|
16 |
*/
|
|
17 |
|
|
18 |
|
|
19 |
|
|
20 |
|
|
21 |
#include "glxcommandhandleraiwassign.h"
|
|
22 |
|
|
23 |
#include <eikmenup.h>
|
|
24 |
#include <StringLoader.h>
|
|
25 |
#include <glxattributecontext.h>
|
|
26 |
#include <glxcommandhandlers.hrh>
|
|
27 |
#include <glxmedia.h>
|
|
28 |
#include <glxtracer.h>
|
|
29 |
#include <mglxmedialist.h>
|
|
30 |
#include <glxuiutilities.rsg>
|
|
31 |
#include <glxnavigationalstate.h>
|
|
32 |
#include <mpxcollectionpath.h>
|
|
33 |
#include <glxcollectionpluginimageviewer.hrh>
|
|
34 |
#include "glxaiwservicehandler.h"
|
|
35 |
#include <featdiscovery.h>
|
|
36 |
#include <glximageviewermanager.h> // for CGlxImageViewerManager
|
|
37 |
|
|
38 |
const TInt KGlxAiwAssignCommandSpace = 0x00000100;
|
|
39 |
|
|
40 |
// -----------------------------------------------------------------------------
|
|
41 |
// NewL
|
|
42 |
// -----------------------------------------------------------------------------
|
|
43 |
//
|
|
44 |
EXPORT_C CGlxCommandHandlerAiwAssign* CGlxCommandHandlerAiwAssign::NewL(
|
|
45 |
MGlxMediaListProvider* aMediaListProvider, TInt aMenuResource,
|
|
46 |
const TDesC& aFileName)
|
|
47 |
{
|
|
48 |
TRACER("CGlxCommandHandlerAiwAssign* CGlxCommandHandlerAiwAssign::NewL");
|
|
49 |
CGlxCommandHandlerAiwAssign* self =
|
|
50 |
new (ELeave) CGlxCommandHandlerAiwAssign(aMediaListProvider,
|
|
51 |
aMenuResource);
|
|
52 |
CleanupStack::PushL(self);
|
|
53 |
self->ConstructL(aFileName);
|
|
54 |
CleanupStack::Pop(self);
|
|
55 |
return self;
|
|
56 |
}
|
|
57 |
|
|
58 |
// -----------------------------------------------------------------------------
|
|
59 |
// Constructor
|
|
60 |
// -----------------------------------------------------------------------------
|
|
61 |
//
|
|
62 |
CGlxCommandHandlerAiwAssign::CGlxCommandHandlerAiwAssign(
|
|
63 |
MGlxMediaListProvider* aMediaListProvider, TInt aMenuResource)
|
|
64 |
: CGlxCommandHandlerAiwBase(aMediaListProvider, aMenuResource)
|
|
65 |
{
|
|
66 |
TRACER("CGlxCommandHandlerAiwAssign::CGlxCommandHandlerAiwAssign");
|
|
67 |
}
|
|
68 |
|
|
69 |
CGlxCommandHandlerAiwAssign::~CGlxCommandHandlerAiwAssign()
|
|
70 |
{
|
|
71 |
delete iFeatManager;
|
|
72 |
}
|
|
73 |
|
|
74 |
void CGlxCommandHandlerAiwAssign::ConstructL(const TDesC& aFileName)
|
|
75 |
{
|
|
76 |
//Calling base class implementation
|
|
77 |
CGlxCommandHandlerAiwBase::ConstructL(aFileName);
|
|
78 |
|
|
79 |
iFeatManager = CFeatureDiscovery::NewL();
|
|
80 |
}
|
|
81 |
|
|
82 |
// -----------------------------------------------------------------------------
|
|
83 |
// CGlxCommandHandlerAiwAssign::DoGetRequiredAttributesL
|
|
84 |
// -----------------------------------------------------------------------------
|
|
85 |
//
|
|
86 |
void CGlxCommandHandlerAiwAssign::DoGetRequiredAttributesL
|
|
87 |
(RArray<TMPXAttribute>& aAttributes, TBool aFilterUsingSelection) const
|
|
88 |
{
|
|
89 |
TRACER("void CGlxCommandHandlerAiwAssign::DoGetRequiredAttributesL");
|
|
90 |
// Add MIME type and filename attributes
|
|
91 |
if (!aFilterUsingSelection || SelectionLength() <= MaxSelectedItems())
|
|
92 |
{
|
|
93 |
aAttributes.AppendL(KMPXMediaGeneralMimeType);
|
|
94 |
aAttributes.AppendL(KMPXMediaGeneralUri);
|
|
95 |
aAttributes.AppendL(KMPXMediaGeneralCategory);
|
|
96 |
}
|
|
97 |
}
|
|
98 |
|
|
99 |
// -----------------------------------------------------------------------------
|
|
100 |
// CommandId
|
|
101 |
// -----------------------------------------------------------------------------
|
|
102 |
//
|
|
103 |
TInt CGlxCommandHandlerAiwAssign::CommandId() const
|
|
104 |
{
|
|
105 |
TRACER("TInt CGlxCommandHandlerAiwAssign::CommandId() const");
|
|
106 |
return EGlxCmdAiwAssign;
|
|
107 |
}
|
|
108 |
|
|
109 |
// -----------------------------------------------------------------------------
|
|
110 |
// AiwCommandId
|
|
111 |
// -----------------------------------------------------------------------------
|
|
112 |
//
|
|
113 |
TInt CGlxCommandHandlerAiwAssign::AiwCommandId() const
|
|
114 |
{
|
|
115 |
TRACER("TInt CGlxCommandHandlerAiwAssign::AiwCommandId() const");
|
|
116 |
return KAiwCmdAssign;
|
|
117 |
}
|
|
118 |
|
|
119 |
// -----------------------------------------------------------------------------
|
|
120 |
// AiwInterestResource
|
|
121 |
// -----------------------------------------------------------------------------
|
|
122 |
//
|
|
123 |
TInt CGlxCommandHandlerAiwAssign::AiwInterestResource() const
|
|
124 |
{
|
|
125 |
int resource = R_GLX_AIW_ASSIGN_TO_CONTACT_INTEREST;
|
|
126 |
if(iFeatManager->IsFeatureSupportedL(KFeatureIdFfImageEditor) || iFeatManager->IsFeatureSupportedL(KFeatureIdFfVideoEditor))
|
|
127 |
{
|
|
128 |
resource = R_GLX_AIW_ASSIGN_TO_CONTACT_INTEREST_MEDIAEDITOR;
|
|
129 |
}
|
|
130 |
|
|
131 |
return resource;
|
|
132 |
}
|
|
133 |
|
|
134 |
// -----------------------------------------------------------------------------
|
|
135 |
// AppendAiwParameterL
|
|
136 |
// -----------------------------------------------------------------------------
|
|
137 |
//
|
|
138 |
TBool CGlxCommandHandlerAiwAssign::AppendAiwParameterL(const TGlxMedia& aItem,
|
|
139 |
CGlxAiwServiceHandler& aAiwServiceHandler)
|
|
140 |
{
|
|
141 |
return AppendDefaultAiwParameterL( aItem,
|
|
142 |
aAiwServiceHandler,
|
|
143 |
ETrue, // Add the Uri
|
|
144 |
ETrue); // Add the Mime Type
|
|
145 |
}
|
|
146 |
|
|
147 |
// -----------------------------------------------------------------------------
|
|
148 |
// AiwDoDynInitMenuPaneL
|
|
149 |
// -----------------------------------------------------------------------------
|
|
150 |
//
|
|
151 |
void CGlxCommandHandlerAiwAssign::AiwDoDynInitMenuPaneL(TInt /*aResourceId*/,
|
|
152 |
CEikMenuPane* aMenuPane)
|
|
153 |
{
|
|
154 |
TRACER("void CGlxCommandHandlerAiwAssign::AiwDoDynInitMenuPaneL");
|
|
155 |
TBool fullscreenViewingMode = EFalse;
|
|
156 |
TBool privateFile = EFalse;
|
|
157 |
CGlxNavigationalState* aNavigationalState = CGlxNavigationalState::InstanceL();
|
|
158 |
CMPXCollectionPath* naviState = aNavigationalState->StateLC();
|
|
159 |
|
|
160 |
if ( naviState->Levels() >= 1)
|
|
161 |
{
|
|
162 |
if (aNavigationalState->ViewingMode() == NGlxNavigationalState::EBrowse)
|
|
163 |
{
|
|
164 |
// For image viewer collection, goto view mode
|
|
165 |
if (naviState->Id() == TMPXItemId(KGlxCollectionPluginImageViewerImplementationUid))
|
|
166 |
{
|
|
167 |
//it means we are in img viewer.
|
|
168 |
fullscreenViewingMode = ETrue;
|
|
169 |
}
|
|
170 |
else
|
|
171 |
{
|
|
172 |
//it means we are in grid view.
|
|
173 |
fullscreenViewingMode = EFalse;
|
|
174 |
}
|
|
175 |
}
|
|
176 |
else
|
|
177 |
{
|
|
178 |
//it means we are in Fullscreen.
|
|
179 |
fullscreenViewingMode = ETrue;
|
|
180 |
}
|
|
181 |
}
|
|
182 |
CleanupStack::PopAndDestroy( naviState );
|
|
183 |
aNavigationalState->Close();
|
|
184 |
|
|
185 |
if (fullscreenViewingMode)
|
|
186 |
{
|
|
187 |
CGlxImageViewerManager* viewerInst =
|
|
188 |
CGlxImageViewerManager::InstanceL();
|
|
189 |
if (viewerInst && viewerInst->IsPrivate())
|
|
190 |
{
|
|
191 |
privateFile = ETrue;
|
|
192 |
}
|
|
193 |
viewerInst->DeleteInstance();
|
|
194 |
}
|
|
195 |
|
|
196 |
HBufC* currentTitle = StringLoader::LoadLC( R_QTN_LGAL_OPTIONS_USE_ITEMS );
|
|
197 |
// get commandId for the current menupane item title
|
|
198 |
TInt cmdId = AiwMenuCmdIdL( *currentTitle,aMenuPane ) ;
|
|
199 |
|
|
200 |
CleanupStack::PopAndDestroy(currentTitle);
|
|
201 |
|
|
202 |
if( KErrNotFound != cmdId )
|
|
203 |
{
|
|
204 |
MGlxMediaList& mediaList = MediaList();
|
|
205 |
|
|
206 |
if (mediaList.SelectionCount() == 1 || (fullscreenViewingMode
|
|
207 |
&& !privateFile))
|
|
208 |
{
|
|
209 |
TGlxSelectionIterator iterator;
|
|
210 |
|
|
211 |
iterator.SetToFirst(&mediaList);
|
|
212 |
|
|
213 |
TInt index = iterator++;
|
|
214 |
if ( index != KErrNotFound )
|
|
215 |
{
|
|
216 |
TMPXGeneralCategory cat = mediaList.Item(index).Category();
|
|
217 |
TInt resId(0);
|
|
218 |
|
|
219 |
if ( cat == EMPXImage )
|
|
220 |
{
|
|
221 |
resId = R_QTN_LGAL_OPTIONS_USE_IMAGE_AS;
|
|
222 |
}
|
|
223 |
else if ( cat == EMPXVideo )
|
|
224 |
{
|
|
225 |
resId = R_QTN_LGAL_OPTIONS_USE_VIDEO_AS;
|
|
226 |
}
|
|
227 |
|
|
228 |
if ( resId )
|
|
229 |
{
|
|
230 |
HBufC* menuTitle = StringLoader::LoadLC( resId );
|
|
231 |
if ( menuTitle )
|
|
232 |
{
|
|
233 |
aMenuPane->SetItemTextL(cmdId,
|
|
234 |
*menuTitle);
|
|
235 |
}
|
|
236 |
CleanupStack::PopAndDestroy(menuTitle);
|
|
237 |
}
|
|
238 |
}
|
|
239 |
}
|
|
240 |
// In case there are Multiple Media Items Marked
|
|
241 |
else
|
|
242 |
{
|
|
243 |
// Setting the " Use Items " Main Menu Option to Invisible
|
|
244 |
aMenuPane->SetItemDimmed(cmdId,ETrue);
|
|
245 |
}
|
|
246 |
}
|
|
247 |
}
|
|
248 |
|
|
249 |
// -----------------------------------------------------------------------------
|
|
250 |
// CommandSpace
|
|
251 |
// -----------------------------------------------------------------------------
|
|
252 |
//
|
|
253 |
TInt CGlxCommandHandlerAiwAssign::CommandSpace() const
|
|
254 |
{
|
|
255 |
return KGlxAiwAssignCommandSpace;
|
|
256 |
}
|