phoneapp/phoneuiqtviewadapter/tsrc/ut_phonemessagecontroller/xqservicerequest.h
author Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
Wed, 23 Jun 2010 18:12:20 +0300
changeset 45 6b911d05207e
permissions -rw-r--r--
Revision: 201023 Kit: 2010125

/*!
* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). 
* All rights reserved.
* This component and the accompanying materials are made available
* under the terms of "Eclipse Public License v1.0"
* which accompanies this distribution, and is available
* at the URL "http://www.eclipse.org/legal/epl-v10.html".
*
* Initial Contributors:
* Nokia Corporation - initial contribution.
*
* Contributors:
*
* Description:  Unit tests for PhoneNoteController.
*
*/

#ifndef T_XQSERVICEREQUEST_H
#define T_XQSERVICEREQUEST_H

#include <QObject>
#include <QVariant>
#include <QtTest/qtestcase.h>

extern QString mService;
extern QString mMessage;
extern bool mSend;
extern QList<QVariant> mList;


/*!
    \class XQServiceRequest
*/
class XQServiceRequest : public QObject
{
Q_OBJECT

public:

    XQServiceRequest(const QString &service,
                     const QString &message,
                     const bool &synchronous = true)
    {
        mService = service;
        mMessage = message;
    }

    ~XQServiceRequest()
    {
    }

    bool send(QVariant &retValue)
    {
        mSend = true;
        return mSend;
    }
    
    template <typename T>
    inline bool send(T& retValue)
    {
        QVariant retData;
        bool ret=send(retData);
        retValue = qVariantValue<T>(retData);
        return ret;
    }

    void setArguments(QList<QVariant> list)
    {
        mList = list;
    }

Q_SIGNALS:

    void requestCompleted(const QVariant &value);

};

#endif //T_XQSERVICEREQUEST_H