homescreenapp/stateplugins/hshomescreenstateplugin/tsrc/t_hshomescreenstateplugin/src/hsimagehandlingclient_mock.cpp
changeset 96 458d8c8d9580
equal deleted inserted replaced
92:6727c5d0afc7 96:458d8c8d9580
       
     1 /*
       
     2 * Copyright (c) 2010 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:  Mocked Photos image handling client.
       
    15 *
       
    16 */
       
    17 
       
    18 
       
    19 #include "hsimagehandlingclient.h"
       
    20 #include <QVariant>
       
    21 
       
    22 // ---------------------------------------------------------------------------
       
    23 // ---------------------------------------------------------------------------
       
    24 //
       
    25 #ifdef Q_OS_SYMBIAN
       
    26 HsImageHandlingClient::HsImageHandlingClient(QObject *parent)
       
    27     : QObject(parent),
       
    28       mReq(0)
       
    29 #else
       
    30 HsImageHandlingClient::HsImageHandlingClient(QObject *parent)
       
    31     : QObject(parent)
       
    32 #endif
       
    33 {
       
    34     setProperty("testSetToFail", QVariant(true));
       
    35 }
       
    36 
       
    37 // ---------------------------------------------------------------------------
       
    38 // ---------------------------------------------------------------------------
       
    39 //
       
    40 HsImageHandlingClient::~HsImageHandlingClient()
       
    41 {
       
    42 #ifdef Q_OS_SYMBIAN
       
    43     delete mReq;
       
    44 #endif
       
    45 }
       
    46 
       
    47 // ---------------------------------------------------------------------------
       
    48 // ---------------------------------------------------------------------------
       
    49 //
       
    50 void HsImageHandlingClient::fetch()
       
    51 {
       
    52     if (property("testSetToFail").value<bool>() == true)
       
    53     {
       
    54         handleError(-1,"KErrNotFound");
       
    55     }
       
    56     else
       
    57     {
       
    58          handleOk("");
       
    59     }
       
    60 }
       
    61 
       
    62 // ---------------------------------------------------------------------------
       
    63 // ---------------------------------------------------------------------------
       
    64 //
       
    65 void HsImageHandlingClient::edit(const QString &imagePath)
       
    66 {
       
    67     Q_UNUSED(imagePath);
       
    68 
       
    69     if (property("testSetToFail").value<bool>() == true)
       
    70     {
       
    71         handleEditorError(-1,"KErrNotFound");
       
    72     }
       
    73     else
       
    74     {
       
    75         handleEditorOk("");
       
    76     }    
       
    77 }
       
    78 
       
    79 // Aiw request responses
       
    80 void HsImageHandlingClient::handleOk(const QVariant& result)
       
    81 {
       
    82     emit fetchCompleted(result.toString());
       
    83 }
       
    84 
       
    85 void HsImageHandlingClient::handleError(int errorCode, const QString& errorMessage)
       
    86 {
       
    87     Q_UNUSED(errorCode);
       
    88     Q_UNUSED(errorMessage);
       
    89     emit fetchFailed(-1, "KErrNotFound");
       
    90 }
       
    91 
       
    92 void HsImageHandlingClient::handleEditorOk(const QVariant& result)
       
    93 {
       
    94     Q_UNUSED(result)
       
    95     emit editorCompleted();
       
    96 }
       
    97 
       
    98 void HsImageHandlingClient::handleEditorError(int errorCode,
       
    99                                              const QString& errorMessage)
       
   100 {
       
   101     emit editorFailed(errorCode, errorMessage);
       
   102 }