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: |
|
15 * |
|
16 */ |
|
17 |
|
18 |
|
19 |
|
20 #include <glxcommandfactory.h> |
|
21 #include <photoeditor_highway.hrh> |
|
22 #include "glxcommandhandlerrotateimage.h" |
|
23 #include <glxcommandhandlers.hrh> |
|
24 #include <glxmodelparm.h> |
|
25 #include <glxmediamodel.h> |
|
26 #include <XQServiceRequest.h> |
|
27 #include <XQAiwRequest.h> |
|
28 |
|
29 GlxCommandHandlerRotateImage::GlxCommandHandlerRotateImage() : mReq(NULL) |
|
30 { |
|
31 //Nothing to do here |
|
32 } |
|
33 |
|
34 GlxCommandHandlerRotateImage::~GlxCommandHandlerRotateImage() |
|
35 { |
|
36 delete mReq; |
|
37 mReq = NULL; |
|
38 } |
|
39 |
|
40 void GlxCommandHandlerRotateImage::executeCommand(int commandId,int collectionId, QList<QModelIndex> /*indexList*/) |
|
41 //void GlxCommandHandlerRotateImage::doHandleUserAction(GlxMediaModel* model,QList<QModelIndex> indexList) const |
|
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(EGlxCmdRotateImgCW == commandId) |
|
70 { |
|
71 args << EEditorHighwayRotateCW; |
|
72 } |
|
73 else // if(EGlxCmdRotateImgCCW == aCommandId) |
|
74 { |
|
75 args << EEditorHighwayRotateCCW; |
|
76 } |
|
77 mReq->setArguments(args); |
|
78 |
|
79 // Send the request |
|
80 bool res = mReq->send(); |
|
81 if (!res) |
|
82 { |
|
83 // Request failed. |
|
84 qDebug("QtSamplePhotos::launchPhotoEditor request cannot be send"); |
|
85 } |
|
86 } |
|
87 |
|
88 void GlxCommandHandlerRotateImage::doHandleUserAction(GlxMediaModel* /*model*/,QList<QModelIndex> /*indexList*/) const |
|
89 { |
|
90 //Dummy, to keepup with compiler errore |
|
91 } |
|