phonebookui/cntcommonui/tsrc/ut_contactcard/cntactionextensionexample/inc/cntexamplebaseaction.h
changeset 81 640d30f4fb64
parent 72 6abfb1094884
equal deleted inserted replaced
77:c18f9fa7f42e 81:640d30f4fb64
       
     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:
       
    15 *
       
    16 */
       
    17 
       
    18 #ifndef MOBBASEACTION_H
       
    19 #define MOBBASEACTION_H
       
    20 
       
    21 #include <qcontactaction.h>
       
    22 #include <qcontactactiondescriptor.h>
       
    23 
       
    24 #include <QSharedData>
       
    25 #include <QString>
       
    26 #include <QVariantMap>
       
    27 
       
    28 QTM_USE_NAMESPACE
       
    29 
       
    30 class MobBaseAction : public QContactAction
       
    31 {
       
    32     Q_OBJECT
       
    33 
       
    34 public:   
       
    35     MobBaseAction(const QString &actionName, const QString& vendorName);
       
    36     virtual ~MobBaseAction();
       
    37 
       
    38 public: 
       
    39 	enum ErrorCodes {
       
    40 		GeneralError = 1,
       
    41 		DetailNotSupported
       
    42 	};
       
    43     
       
    44 
       
    45 public: //QContactAction
       
    46 	QContactActionDescriptor actionDescriptor() const;
       
    47     bool invokeAction(const QContact& contact, const QContactDetail& detail = QContactDetail(), const QVariantMap& parameters = QVariantMap());
       
    48     QVariantMap results() const;
       
    49 
       
    50 public:
       
    51 	virtual void resetAction();
       
    52 	virtual MobBaseAction* clone() const = 0;
       
    53 
       
    54 public:   
       
    55     //returns whether the actionDescription is supported by this action
       
    56     bool actionDescriptionSupported(const QContactActionDescriptor& descriptor) const;
       
    57     void emitResult(int errorCode, const QVariant &retValue);
       
    58     
       
    59     
       
    60 protected:
       
    61     QString m_actionName;
       
    62 	QString m_vendorName;
       
    63 	int m_implementationVersion;
       
    64 	
       
    65 	QVariantMap m_result; 		//result returned to client
       
    66 	QContact m_contact;    		//contact passed to invokeAction
       
    67 	QContactDetail m_detail; 	//detail passed to invokeAction
       
    68 };
       
    69 
       
    70 #endif //MOBBASEACTION_H