26
|
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: Temporary rotate command implementation
|
|
15 |
*
|
|
16 |
*/
|
|
17 |
|
|
18 |
|
|
19 |
|
|
20 |
|
|
21 |
// INCLUDE FILES
|
|
22 |
|
|
23 |
#include "glxcommandhandlerrotate.h"
|
|
24 |
|
|
25 |
#include <data_caging_path_literals.hrh>
|
|
26 |
#include <alf/alfdisplay.h>
|
|
27 |
|
|
28 |
#include <glxattributecontext.h>
|
|
29 |
#include <glxuiutility.h>
|
|
30 |
#include <glxmediageneraldefs.h>
|
|
31 |
#include <glxsettingsmodel.h>
|
|
32 |
#include <glxthumbnailcontext.h>
|
|
33 |
#include <glxuistd.h>
|
|
34 |
#include <glxvisuallistmanager.h>
|
|
35 |
#include <mglxmedialist.h>
|
|
36 |
#include <mglxvisuallist.h>
|
|
37 |
#include <glxlog.h>
|
|
38 |
#include <glxtracer.h>
|
|
39 |
#include <mglxlayoutowner.h>
|
|
40 |
|
|
41 |
#include <glxcommandhandlers.hrh>
|
|
42 |
#include <glxuiutilities.rsg>
|
|
43 |
#include <glxicons.mbg>
|
|
44 |
|
|
45 |
#include <ExifRead.h>
|
|
46 |
#include <glxcommandfactory.h>
|
|
47 |
#include <mpxcommandgeneraldefs.h> // Content ID identifying general category of content provided
|
|
48 |
#include <glxtexturemanager.h>
|
|
49 |
|
|
50 |
#include<bautils.h>
|
|
51 |
|
|
52 |
// ======== MEMBER FUNCTIONS ========
|
|
53 |
|
|
54 |
// ---------------------------------------------------------------------------
|
|
55 |
// Two-phased constructor.
|
|
56 |
// ---------------------------------------------------------------------------
|
|
57 |
//
|
|
58 |
EXPORT_C CGlxCommandHandlerRotate*
|
|
59 |
CGlxCommandHandlerRotate::NewL(
|
|
60 |
MGlxMediaListProvider* aMediaListProvider,
|
|
61 |
MGlxLayoutOwner* aLayoutOwner,
|
|
62 |
TInt aLayoutIndex)
|
|
63 |
{
|
|
64 |
TRACER("CGlxCommandHandlerRotate* CGlxCommandHandlerRotate::NewL()");
|
|
65 |
CGlxCommandHandlerRotate* self
|
|
66 |
= new (ELeave) CGlxCommandHandlerRotate(aMediaListProvider,
|
|
67 |
aLayoutOwner, aLayoutIndex);
|
|
68 |
CleanupStack::PushL(self);
|
|
69 |
self->ConstructL();
|
|
70 |
CleanupStack::Pop(self);
|
|
71 |
return self;
|
|
72 |
}
|
|
73 |
|
|
74 |
// ---------------------------------------------------------------------------
|
|
75 |
// Destructor
|
|
76 |
// ---------------------------------------------------------------------------
|
|
77 |
//
|
|
78 |
CGlxCommandHandlerRotate::~CGlxCommandHandlerRotate()
|
|
79 |
{
|
|
80 |
TRACER("CGlxCommandHandlerRotate::~CGlxCommandHandlerRotate");
|
|
81 |
if ( iVisualListManager )
|
|
82 |
{
|
|
83 |
iVisualListManager->Close();
|
|
84 |
}
|
|
85 |
|
|
86 |
if ( iUiUtility )
|
|
87 |
{
|
|
88 |
iUiUtility->Close();
|
|
89 |
}
|
|
90 |
iFs.Close();
|
|
91 |
|
|
92 |
if ( iExifData )
|
|
93 |
{
|
|
94 |
delete iExifData;
|
|
95 |
iExifData = NULL;
|
|
96 |
}
|
|
97 |
if ( iExifWriter )
|
|
98 |
{
|
|
99 |
delete iExifWriter;
|
|
100 |
iExifWriter = NULL;
|
|
101 |
}
|
|
102 |
}
|
|
103 |
|
|
104 |
// ---------------------------------------------------------------------------
|
|
105 |
// DoExecuteL
|
|
106 |
// ---------------------------------------------------------------------------
|
|
107 |
//
|
|
108 |
TBool CGlxCommandHandlerRotate::DoExecuteL(TInt aCommandId,
|
|
109 |
MGlxMediaList& aList)
|
|
110 |
{
|
|
111 |
TRACER("CGlxCommandHandlerRotate::DoExecuteL");
|
|
112 |
TBool handled = EFalse;
|
|
113 |
TInt rotationAngle ;
|
|
114 |
iMediaList = &aList;
|
|
115 |
switch ( aCommandId )
|
|
116 |
{
|
|
117 |
case EGlxCmdRotateLeft:
|
|
118 |
rotationAngle = -90;
|
|
119 |
break;
|
|
120 |
case EGlxCmdRotateRight:
|
|
121 |
rotationAngle = 90;
|
|
122 |
break;
|
|
123 |
default:
|
|
124 |
return handled;
|
|
125 |
}
|
|
126 |
DoRotateL(aList, rotationAngle);
|
|
127 |
|
|
128 |
return handled;
|
|
129 |
}
|
|
130 |
|
|
131 |
// ---------------------------------------------------------------------------
|
|
132 |
// DoActivateL
|
|
133 |
// ---------------------------------------------------------------------------
|
|
134 |
//
|
|
135 |
void CGlxCommandHandlerRotate::DoActivateL(TInt aViewId)
|
|
136 |
{
|
|
137 |
TRACER("CGlxCommandHandlerRotate::DoActivateL");
|
|
138 |
iViewId = aViewId;
|
|
139 |
}
|
|
140 |
|
|
141 |
// ---------------------------------------------------------------------------
|
|
142 |
// Deactivate
|
|
143 |
// ---------------------------------------------------------------------------
|
|
144 |
//
|
|
145 |
void CGlxCommandHandlerRotate::Deactivate()
|
|
146 |
{
|
|
147 |
TRACER("CGlxCommandHandlerRotate::Deactivate");
|
|
148 |
|
|
149 |
iViewId = 0;
|
|
150 |
}
|
|
151 |
|
|
152 |
|
|
153 |
|
|
154 |
|
|
155 |
// ---------------------------------------------------------------------------
|
|
156 |
// HandleItemAddedL
|
|
157 |
// ---------------------------------------------------------------------------
|
|
158 |
//
|
|
159 |
void CGlxCommandHandlerRotate::HandleItemAddedL(TInt /*aStartIndex*/,
|
|
160 |
TInt /*aEndIndex*/, MGlxMediaList* /*aList*/)
|
|
161 |
{
|
|
162 |
}
|
|
163 |
|
|
164 |
// ---------------------------------------------------------------------------
|
|
165 |
// HandleMediaL
|
|
166 |
// ---------------------------------------------------------------------------
|
|
167 |
//
|
|
168 |
void CGlxCommandHandlerRotate::HandleMediaL(TInt /*aListIndex*/,
|
|
169 |
MGlxMediaList* /*aList*/)
|
|
170 |
{
|
|
171 |
}
|
|
172 |
|
|
173 |
// ---------------------------------------------------------------------------
|
|
174 |
// HandleItemRemovedL
|
|
175 |
// ---------------------------------------------------------------------------
|
|
176 |
//
|
|
177 |
void CGlxCommandHandlerRotate::HandleItemRemovedL(TInt /*aStartIndex*/,
|
|
178 |
TInt /*aEndIndex*/, MGlxMediaList* /*aList*/)
|
|
179 |
{
|
|
180 |
}
|
|
181 |
|
|
182 |
// ---------------------------------------------------------------------------
|
|
183 |
// HandleItemModifiedL
|
|
184 |
// ---------------------------------------------------------------------------
|
|
185 |
//
|
|
186 |
void CGlxCommandHandlerRotate::HandleItemModifiedL(
|
|
187 |
const RArray<TInt>& /*aItemIndexes*/, MGlxMediaList* /*aList*/)
|
|
188 |
{
|
|
189 |
}
|
|
190 |
|
|
191 |
// ---------------------------------------------------------------------------
|
|
192 |
// HandleAttributesAvailableL
|
|
193 |
// ---------------------------------------------------------------------------
|
|
194 |
//
|
|
195 |
void CGlxCommandHandlerRotate::HandleAttributesAvailableL(
|
|
196 |
TInt /*aItemIndex*/, const RArray<TMPXAttribute>& /*aAttributes*/,
|
|
197 |
MGlxMediaList* /*aList*/)
|
|
198 |
{
|
|
199 |
TRACER("CGlxCommandHandlerRotate::HandleAttributesAvailableL");
|
|
200 |
|
|
201 |
}
|
|
202 |
|
|
203 |
// ---------------------------------------------------------------------------
|
|
204 |
// HandleFocusChangedL
|
|
205 |
// ---------------------------------------------------------------------------
|
|
206 |
//
|
|
207 |
void CGlxCommandHandlerRotate::HandleFocusChangedL(
|
|
208 |
NGlxListDefs::TFocusChangeType /*aType*/, TInt /*aNewIndex*/,
|
|
209 |
TInt /*aOldIndex*/, MGlxMediaList* /*aList*/)
|
|
210 |
{
|
|
211 |
TRACER("CGlxCommandHandlerRotate::HandleFocusChangedL");
|
|
212 |
DoCleanupRotationParametersL();
|
|
213 |
|
|
214 |
iMediaList = NULL;
|
|
215 |
}
|
|
216 |
|
|
217 |
// ---------------------------------------------------------------------------
|
|
218 |
// HandleItemSelectedL
|
|
219 |
// ---------------------------------------------------------------------------
|
|
220 |
//
|
|
221 |
void CGlxCommandHandlerRotate::HandleItemSelectedL(TInt /*aIndex*/,
|
|
222 |
TBool /*aSelected*/, MGlxMediaList* /*aList*/)
|
|
223 |
{
|
|
224 |
}
|
|
225 |
|
|
226 |
// ---------------------------------------------------------------------------
|
|
227 |
// HandleMessageL
|
|
228 |
// ---------------------------------------------------------------------------
|
|
229 |
//
|
|
230 |
void CGlxCommandHandlerRotate::HandleMessageL(
|
|
231 |
const CMPXMessage& /*aMessage*/, MGlxMediaList* /*aList*/)
|
|
232 |
{
|
|
233 |
}
|
|
234 |
|
|
235 |
// ---------------------------------------------------------------------------
|
|
236 |
// C++ default constructor can NOT contain any code that might leave.
|
|
237 |
// ---------------------------------------------------------------------------
|
|
238 |
//
|
|
239 |
CGlxCommandHandlerRotate::CGlxCommandHandlerRotate(
|
|
240 |
MGlxMediaListProvider* aMediaListProvider,
|
|
241 |
MGlxLayoutOwner* aLayoutOwner,
|
|
242 |
TInt aLayoutIndex) :
|
|
243 |
CGlxMediaListCommandHandler(aMediaListProvider),
|
|
244 |
iLayoutOwner(aLayoutOwner),
|
|
245 |
iLayoutIndex(aLayoutIndex)
|
|
246 |
{
|
|
247 |
TRACER("CGlxCommandHandlerRotate::CGlxCommandHandlerRotate");
|
|
248 |
}
|
|
249 |
|
|
250 |
// ---------------------------------------------------------------------------
|
|
251 |
// Symbian 2nd phase constructor can leave.
|
|
252 |
// ---------------------------------------------------------------------------
|
|
253 |
//
|
|
254 |
void CGlxCommandHandlerRotate::ConstructL()
|
|
255 |
{
|
|
256 |
TRACER("CGlxCommandHandlerRotate::ConstructL");
|
|
257 |
iUiUtility = CGlxUiUtility::UtilityL();
|
|
258 |
|
|
259 |
// Add rotate command for images only
|
|
260 |
TCommandInfo rotate(EGlxCmdRotate);
|
|
261 |
rotate.iCategoryFilter = EMPXImage;
|
|
262 |
rotate.iCategoryRule = TCommandInfo::ERequireAll;
|
|
263 |
AddCommandL(rotate);
|
|
264 |
TCommandInfo rotateLeft(EGlxCmdRotateLeft);
|
|
265 |
rotateLeft.iCategoryFilter = EMPXImage;
|
|
266 |
rotateLeft.iCategoryRule = TCommandInfo::ERequireAll;
|
|
267 |
AddCommandL(rotateLeft);
|
|
268 |
TCommandInfo rotateRight(EGlxCmdRotateRight);
|
|
269 |
rotateLeft.iCategoryFilter = EMPXImage;
|
|
270 |
rotateLeft.iCategoryRule = TCommandInfo::ERequireAll;
|
|
271 |
AddCommandL(rotateRight);
|
|
272 |
|
|
273 |
// Add view state dummy commands
|
|
274 |
TCommandInfo view(EGlxCmdStateView);
|
|
275 |
AddCommandL(view);
|
|
276 |
TCommandInfo browse(EGlxCmdStateBrowse);
|
|
277 |
AddCommandL(browse);
|
|
278 |
|
|
279 |
//File system
|
|
280 |
User::LeaveIfError(iFs.Connect());
|
|
281 |
iAddedObserver=EFalse;
|
|
282 |
}
|
|
283 |
|
|
284 |
|
|
285 |
// ---------------------------------------------------------------------------
|
|
286 |
// DoIsDisabled
|
|
287 |
// ---------------------------------------------------------------------------
|
|
288 |
//
|
|
289 |
TBool CGlxCommandHandlerRotate::DoIsDisabled(TInt aCommandId,
|
|
290 |
MGlxMediaList& aList) const
|
|
291 |
{
|
|
292 |
TRACER("CGlxCommandHandlerRotate::DoIsDisabled");
|
|
293 |
TBool disabled = EFalse;
|
|
294 |
/**/
|
|
295 |
if( ViewingState() == TCommandInfo::EViewingStateView )
|
|
296 |
{
|
|
297 |
return ETrue;
|
|
298 |
}
|
|
299 |
switch (aCommandId)
|
|
300 |
{
|
|
301 |
case EGlxCmdRotate:
|
|
302 |
case EGlxCmdRotateLeft:
|
|
303 |
case EGlxCmdRotateRight:
|
|
304 |
{
|
|
305 |
if((aList.Count()<=0) || aList.Item(aList.FocusIndex()).IsStatic())
|
|
306 |
{
|
|
307 |
disabled = ETrue;
|
|
308 |
}
|
|
309 |
break;
|
|
310 |
}
|
|
311 |
|
|
312 |
default:
|
|
313 |
break;
|
|
314 |
}
|
|
315 |
|
|
316 |
return disabled;
|
|
317 |
}
|
|
318 |
// ---------------------------------------------------------------------------
|
|
319 |
// DoRotateL
|
|
320 |
// ---------------------------------------------------------------------------
|
|
321 |
//
|
|
322 |
void CGlxCommandHandlerRotate::DoRotateL(MGlxMediaList& /*aList*/, TInt aAngle)
|
|
323 |
{
|
|
324 |
TRACER("CGlxCommandHandlerRotate::DoRotateL");
|
|
325 |
const TGlxMedia& item = MediaList().Item( MediaList().FocusIndex() );
|
|
326 |
iGlxItem = &item;
|
|
327 |
GLX_LOG_INFO("CGlxCommandHandlerRotate::DoRotateL1");
|
|
328 |
TSize imageSize(0,0);
|
|
329 |
item.GetDimensions(imageSize);
|
|
330 |
iRotationAngle += aAngle;
|
|
331 |
if(aAngle<0)
|
|
332 |
{
|
|
333 |
if (iRotationAngle < 0)
|
|
334 |
{
|
|
335 |
iRotationAngle = 270;
|
|
336 |
}
|
|
337 |
}
|
|
338 |
else
|
|
339 |
{
|
|
340 |
if (iRotationAngle > 270)
|
|
341 |
{
|
|
342 |
iRotationAngle = 0;
|
|
343 |
}
|
|
344 |
}
|
|
345 |
iFileToBeRotated.Copy(item.Uri());
|
|
346 |
DoInitializeRotationParametersL();
|
|
347 |
if(iInitialOrientation > 4)
|
|
348 |
{
|
|
349 |
imageSize.SetSize(imageSize.iHeight,imageSize.iWidth);
|
|
350 |
}
|
|
351 |
iUiUtility->SetRotatedImageSize(imageSize);
|
|
352 |
//Perform Rotation Here itself rather than Calling it each time
|
|
353 |
DoPreserveOrientationL();
|
|
354 |
}
|
|
355 |
|
|
356 |
// ---------------------------------------------------------------------------
|
|
357 |
// DoCalculateOrientationL
|
|
358 |
// ---------------------------------------------------------------------------
|
|
359 |
//
|
|
360 |
TInt CGlxCommandHandlerRotate::DoCalculateOrientationL(TInt aInitialOrientation)
|
|
361 |
{
|
|
362 |
TRACER("CGlxCommandHandlerRotate::DoCalculateOrientationL");
|
|
363 |
/*
|
|
364 |
* possible orientation state with angles for rotation
|
|
365 |
* Possible Angles 0 - 90 - 180 - 270
|
|
366 |
* Possible states 1 - 6 - 3 - 8 without a Flip
|
|
367 |
* Possible states 2 - 5 - 4 - 7 when Flip is on
|
|
368 |
*/
|
|
369 |
GLX_LOG_INFO("CGlxCommandHandlerRotate::DoCalculateOrientationL");
|
|
370 |
TInt finalOrientation = aInitialOrientation;
|
|
371 |
if(aInitialOrientation >8 || aInitialOrientation <0 )
|
|
372 |
{
|
|
373 |
return finalOrientation;
|
|
374 |
}
|
|
375 |
|
|
376 |
TInt rotOffset = iRotationAngle/90;
|
|
377 |
TInt isOrientationOdd = aInitialOrientation % 2;
|
|
378 |
TInt initStateIndex = 0;
|
|
379 |
TInt finalStateIndex = 0;
|
|
380 |
//Setting the orientation states for the initial unflipped orientation combinations
|
|
381 |
TInt orientationStateArray[] = {1,6,3,8};
|
|
382 |
//Seting the index for current orientation
|
|
383 |
if(aInitialOrientation < 3)
|
|
384 |
{
|
|
385 |
initStateIndex = 0;
|
|
386 |
}
|
|
387 |
else if(aInitialOrientation >= 3 && aInitialOrientation < 5)
|
|
388 |
{
|
|
389 |
initStateIndex = 2;
|
|
390 |
}
|
|
391 |
else if(aInitialOrientation >= 5 && aInitialOrientation < 7)
|
|
392 |
{
|
|
393 |
initStateIndex = 1;
|
|
394 |
}
|
|
395 |
else if(aInitialOrientation >= 7 && aInitialOrientation <= 8)
|
|
396 |
{
|
|
397 |
initStateIndex = 3;
|
|
398 |
}
|
|
399 |
//Calculating the final orientation using the cyclic orientationStateArray.
|
|
400 |
//folding final index so that it behaves like a cyclic machine
|
|
401 |
finalStateIndex = (initStateIndex+rotOffset)%4;
|
|
402 |
finalOrientation = orientationStateArray[finalStateIndex];
|
|
403 |
//Checking if a Flip was present
|
|
404 |
if(aInitialOrientation>4 && isOrientationOdd )
|
|
405 |
{
|
|
406 |
finalOrientation -= 1;
|
|
407 |
}
|
|
408 |
if(aInitialOrientation<5 && !isOrientationOdd)
|
|
409 |
{
|
|
410 |
finalOrientation += 1;
|
|
411 |
}
|
|
412 |
GLX_LOG_INFO1("CGlxCommandHandlerRotate::DoCalculateOrientationL finalOrientation=%d",finalOrientation);
|
|
413 |
return finalOrientation;
|
|
414 |
}
|
|
415 |
|
|
416 |
|
|
417 |
// ---------------------------------------------------------------------------
|
|
418 |
// DoPreserveOrientationL
|
|
419 |
// ---------------------------------------------------------------------------
|
|
420 |
//
|
|
421 |
void CGlxCommandHandlerRotate::DoPreserveOrientationL()
|
|
422 |
{
|
|
423 |
TRACER("CGlxCommandHandlerRotate::DoPreserveOrientationL");
|
|
424 |
TUint16 finalOrientation = DoCalculateOrientationL(iInitialOrientation);
|
|
425 |
if(finalOrientation != iInitialOrientation && iDoAttemptToSaveFile)
|
|
426 |
{
|
|
427 |
iExifWriter->SetOrientationL(finalOrientation);
|
|
428 |
HBufC8* ModifiedexifData=NULL;
|
|
429 |
//need only first KGlxMaxExifSize bytes of data as exif cannot bypass this size
|
|
430 |
TRAPD(err,ModifiedexifData = iExifWriter->WriteDataL(iExifData->Des()));
|
|
431 |
if(err == KErrNone)
|
|
432 |
{
|
|
433 |
iFileHandle.Write(0,ModifiedexifData->Des());
|
|
434 |
delete ModifiedexifData;
|
|
435 |
}
|
|
436 |
else
|
|
437 |
{
|
|
438 |
iDoAttemptToSaveFile = EFalse;
|
|
439 |
}
|
|
440 |
|
|
441 |
//Reinitializing some class variables
|
|
442 |
iInitialOrientation = finalOrientation;
|
|
443 |
iRotationAngle = 0;
|
|
444 |
|
|
445 |
}
|
|
446 |
iFileHandle.Close();
|
|
447 |
iInitialOrientation = 9;
|
|
448 |
iRotationAngle = 0;
|
|
449 |
iRotationApplied = EFalse;
|
|
450 |
if ( iExifData )
|
|
451 |
{
|
|
452 |
delete iExifData;
|
|
453 |
iExifData = NULL;
|
|
454 |
}
|
|
455 |
if ( iExifWriter )
|
|
456 |
{
|
|
457 |
delete iExifWriter;
|
|
458 |
iExifWriter = NULL;
|
|
459 |
}
|
|
460 |
}
|
|
461 |
// ---------------------------------------------------------------------------
|
|
462 |
// DoInitializeRotationParameters
|
|
463 |
// ---------------------------------------------------------------------------
|
|
464 |
//
|
|
465 |
void CGlxCommandHandlerRotate::DoInitializeRotationParametersL()
|
|
466 |
{
|
|
467 |
TRACER("CGlxCommandHandlerRotate::DoInitializeRotationParametersL");
|
|
468 |
if((!iDoAttemptToSaveFile)&& (!iAddedObserver))
|
|
469 |
{
|
|
470 |
iAddedObserver=ETrue;
|
|
471 |
iMediaList->AddMediaListObserverL(this);
|
|
472 |
}
|
|
473 |
if(!iRotationApplied)
|
|
474 |
{
|
|
475 |
|
|
476 |
iTempFile.Copy(_L("c:\\data\\temp.ext"));
|
|
477 |
User::LeaveIfError(iFileHandle.Open(iFs,
|
|
478 |
iFileToBeRotated, EFileWrite));
|
|
479 |
iRotationApplied = ETrue;
|
|
480 |
TInt filesize;
|
|
481 |
User::LeaveIfError(iFileHandle.Size(filesize));
|
|
482 |
iExifData = HBufC8::NewL(filesize);
|
|
483 |
TPtr8 ptr(iExifData->Des());
|
|
484 |
User::LeaveIfError(iFileHandle.Read(ptr));
|
|
485 |
const CExifRead* exifReader = NULL;
|
|
486 |
TRAPD(Exiferr,iExifWriter = CExifModify::NewL(*iExifData,CExifModify::EModify,CExifModify::ENoJpegParsing));
|
|
487 |
if(Exiferr == KErrNone)
|
|
488 |
{
|
|
489 |
iDoAttemptToSaveFile = ETrue;
|
|
490 |
exifReader = iExifWriter->Reader();
|
|
491 |
TInt err = exifReader->GetOrientation(iInitialOrientation);
|
|
492 |
if(err != KErrNone)
|
|
493 |
{
|
|
494 |
iInitialOrientation = 9;
|
|
495 |
}
|
|
496 |
}
|
|
497 |
else
|
|
498 |
{
|
|
499 |
iDoAttemptToSaveFile = EFalse;
|
|
500 |
}
|
|
501 |
}
|
|
502 |
}
|
|
503 |
// ---------------------------------------------------------------------------
|
|
504 |
// DoCleanupRotationParameters
|
|
505 |
// ---------------------------------------------------------------------------
|
|
506 |
//
|
|
507 |
void CGlxCommandHandlerRotate::DoCleanupRotationParametersL()
|
|
508 |
{
|
|
509 |
TRACER("CGlxCommandHandlerRotate::DoCleanupRotationParametersL()");
|
|
510 |
if(iDoAttemptToSaveFile)
|
|
511 |
{
|
|
512 |
//This is done just to get an MDS callback
|
|
513 |
BaflUtils::CopyFile(iFs,iFileToBeRotated,iTempFile);
|
|
514 |
BaflUtils::CopyFile(iFs,iTempFile,iFileToBeRotated);
|
|
515 |
BaflUtils::DeleteFile(iFs,iTempFile);
|
|
516 |
iDoAttemptToSaveFile = EFalse;
|
|
517 |
}
|
|
518 |
|
|
519 |
iTempFile.Zero();
|
|
520 |
iInitialOrientation = 9;
|
|
521 |
iRotationAngle = 0;
|
|
522 |
//Cleanup the thumbnail DB using Cleanup command as MDS takes a Long time for a callback.
|
|
523 |
CMPXCommand* command = TGlxCommandFactory::ThumbnailCleanupCommandLC();
|
|
524 |
command->SetTObjectValueL<TAny*>(KMPXCommandGeneralSessionId, static_cast<TAny*>(this));
|
|
525 |
|
|
526 |
//To Do Initialize cleanup command Just for the respective Media Items
|
|
527 |
iMediaList->CommandL(*command);
|
|
528 |
CleanupStack::PopAndDestroy(command);
|
|
529 |
iMediaList->RemoveMediaListObserver(this);
|
|
530 |
iAddedObserver=EFalse;
|
|
531 |
iMediaList = NULL;
|
|
532 |
iGlxItem = NULL;
|
|
533 |
|
|
534 |
iRotationApplied = EFalse;
|
|
535 |
if ( iExifData )
|
|
536 |
{
|
|
537 |
delete iExifData;
|
|
538 |
iExifData = NULL;
|
|
539 |
}
|
|
540 |
if ( iExifWriter )
|
|
541 |
{
|
|
542 |
delete iExifWriter;
|
|
543 |
iExifWriter = NULL;
|
|
544 |
}
|
|
545 |
}
|
|
546 |
// End of File
|