50
|
1 |
/*
|
|
2 |
* Copyright (c) 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: Handles command related to mediaeditors in fullscreen
|
|
15 |
* for image Rotate, Crop & Set as Wallpaper
|
|
16 |
*
|
|
17 |
*/
|
|
18 |
|
|
19 |
|
|
20 |
|
|
21 |
#include <glxcommandfactory.h>
|
|
22 |
#include <photoeditor_highway.hrh>
|
|
23 |
#include "glxcommandhandlereditimage.h"
|
|
24 |
#include <glxcommandhandlers.hrh>
|
|
25 |
#include <glxmodelparm.h>
|
|
26 |
#include <glxmediamodel.h>
|
|
27 |
#include <XQServiceRequest.h>
|
|
28 |
#include <XQAiwRequest.h>
|
|
29 |
|
|
30 |
GlxCommandHandlerEditImage::GlxCommandHandlerEditImage() : mReq(NULL)
|
|
31 |
{
|
|
32 |
//Nothing to do here
|
|
33 |
}
|
|
34 |
|
|
35 |
GlxCommandHandlerEditImage::~GlxCommandHandlerEditImage()
|
|
36 |
{
|
|
37 |
delete mReq;
|
|
38 |
mReq = NULL;
|
|
39 |
}
|
|
40 |
|
|
41 |
void GlxCommandHandlerEditImage::executeCommand(int commandId,int collectionId, QList<QModelIndex> /*indexList*/)
|
|
42 |
{
|
|
43 |
const QString service = QLatin1String("PhotoEditor");
|
|
44 |
const QString interface = QLatin1String("com.nokia.symbian.imageeditor");
|
|
45 |
const QString operation = QLatin1String("view(QString,int)");
|
|
46 |
|
|
47 |
//Connect to service provider
|
|
48 |
if(mReq == NULL)
|
|
49 |
{
|
|
50 |
mReq = mAppmgr.create(service, interface, operation, true);
|
|
51 |
mReq->setEmbedded(true);
|
|
52 |
mReq->setSynchronous(true);
|
|
53 |
}
|
|
54 |
|
|
55 |
if(mReq == NULL)
|
|
56 |
{
|
|
57 |
return;
|
|
58 |
}
|
|
59 |
|
|
60 |
GlxModelParm modelParm (collectionId, 0);
|
|
61 |
GlxMediaModel* mediaModel = new GlxMediaModel (modelParm);
|
|
62 |
|
|
63 |
//Get the file path for the item selected
|
|
64 |
QString imagePath = (mediaModel->data(mediaModel->index(mediaModel->data(mediaModel->index(0,0),GlxFocusIndexRole).value<int>(),0),GlxUriRole)).value<QString>();
|
|
65 |
delete mediaModel;
|
|
66 |
|
|
67 |
QList<QVariant> args;
|
|
68 |
args << imagePath;
|
|
69 |
if(EGlxCmdSetWallpaper == commandId)
|
|
70 |
{
|
|
71 |
args << EEditorHighwayWallpaperCrop;
|
|
72 |
}
|
|
73 |
else if(EGlxCmdRotateImgCrop == commandId)
|
|
74 |
{
|
|
75 |
args << EEditorHighwayFreeCrop;
|
|
76 |
}
|
|
77 |
else if(EGlxCmdRotateImgCW == commandId)
|
|
78 |
{
|
|
79 |
args << EEditorHighwayRotateCW;
|
|
80 |
}
|
|
81 |
else // if(EGlxCmdRotateImgCCW == aCommandId)
|
|
82 |
{
|
|
83 |
args << EEditorHighwayRotateCCW;
|
|
84 |
}
|
|
85 |
mReq->setArguments(args);
|
|
86 |
|
|
87 |
// Send the request
|
|
88 |
bool res = mReq->send();
|
|
89 |
if (!res)
|
|
90 |
{
|
|
91 |
// Request failed.
|
|
92 |
qDebug("QtSamplePhotos::launchPhotoEditor request cannot be send");
|
|
93 |
}
|
|
94 |
}
|
|
95 |
|
|
96 |
void GlxCommandHandlerEditImage::doHandleUserAction(GlxMediaModel* /*model*/,QList<QModelIndex> /*indexList*/) const
|
|
97 |
{
|
|
98 |
//Dummy, to keepup with compiler errore
|
|
99 |
}
|