ui/commandhandlers/commoncommandhandlers/src/glxcommandhandlercropimage.cpp
changeset 49 f291796e213d
equal deleted inserted replaced
48:d0b4e67b3a60 49:f291796e213d
       
     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 #include "glxcommandhandlercropimage.h"
       
    19 
       
    20 #include <glxcommandfactory.h>
       
    21 #include <photoeditor_highway.hrh>
       
    22 #include <glxcommandhandlers.hrh>
       
    23 #include <XQServiceRequest.h>
       
    24 #include <XQAiwRequest.h>
       
    25 #include <glxmodelparm.h>
       
    26 #include <glxmediamodel.h>
       
    27 
       
    28 
       
    29 GlxCommandHandlerCropImage::GlxCommandHandlerCropImage() : mReq(NULL)
       
    30     {
       
    31     //Nothing to do here for now
       
    32     }
       
    33 
       
    34 GlxCommandHandlerCropImage::~GlxCommandHandlerCropImage()
       
    35     {
       
    36     delete mReq;
       
    37     mReq = NULL;
       
    38     }
       
    39 
       
    40 void GlxCommandHandlerCropImage::doHandleUserAction(GlxMediaModel* model,
       
    41         QList<QModelIndex> /*indexList*/) const
       
    42     {
       
    43     const QString interface = QLatin1String("com.nokia.symbian.imageeditor");
       
    44     const QString operation = QLatin1String("view(QString,int)");
       
    45     const QString service = QLatin1String("PhotoEditor");
       
    46     
       
    47     if(mReq == NULL)
       
    48         {
       
    49         //Connect to service provider    
       
    50         mReq = mAppmgr.create(service, interface, operation, true);
       
    51         mReq->setEmbedded(true);
       
    52         mReq->setSynchronous(true);
       
    53         }
       
    54     
       
    55     if(mReq == NULL)
       
    56         {
       
    57         qDebug("QtSamplePhotos::launchPhotoEditor request not Created");
       
    58         return;
       
    59         }
       
    60     
       
    61     //Get the file path for the item selected
       
    62     QString imagePath = (model->data(model->index(model->data(model->index(0,0),GlxFocusIndexRole).value<int>(),0),GlxUriRole)).value<QString>();
       
    63        
       
    64     QList<QVariant> args;
       
    65     args << imagePath;
       
    66     args << EEditorHighwayFreeCrop;
       
    67     mReq->setArguments(args);
       
    68     
       
    69     // Send the request
       
    70     bool res = mReq->send();
       
    71     if  (!res) 
       
    72         {
       
    73        // Request failed. 
       
    74         qDebug("QtSamplePhotos::launchPhotoEditor request cannot be send");
       
    75         }
       
    76     
       
    77     }