The QServiceContext class provides context information to services. More...
#include <QServiceContext>
Inherits: QObject.
This class was introduced in Qt Mobility 1.0.
enum | ContextType { DisplayContext, ScriptContext, UserDefined } |
QServiceContext ( QObject * parent = 0 ) | |
virtual | ~QServiceContext () |
QVariant | clientData ( const QString & key ) const |
QString | clientId () const |
QString | clientName () const |
virtual void | notify ( ContextType type, const QVariant & data ) = 0 |
void | resetClientData () |
void | setClientData ( const QString & key, const QVariant & value ) |
void | setClientId ( const QString & id ) |
void | setClientName ( const QString & name ) |
The QServiceContext class provides context information to services.
A service context is created by clients and passed on to the service. It enables the opportunity to pass additional context information and errors between services, clients and the service framework.
Clients must implement this abstract class to receive context information.
See also QServiceManager.
This enum describes the type of context information.
Constant | Value | Description |
---|---|---|
QServiceContext::DisplayContext | 0 | The service provides user visible display text such as an error message. |
QServiceContext::ScriptContext | 1 | The service provides a script which may be executed by the client. |
QServiceContext::UserDefined | 100 | The first context type that can be used for service specific context information. |
This property holds the id of the client using the service.
By default, this value is empty but you can change this by calling setClientId().
This property was introduced in Qt Mobility 1.0.
Access functions:
QString | clientId () const |
void | setClientId ( const QString & id ) |
This property holds the name of the client using the service.
By default, this value is empty but you can change this by calling setClientName(). This string is translated and can be shown to the user.
This property was introduced in Qt Mobility 1.0.
Access functions:
QString | clientName () const |
void | setClientName ( const QString & name ) |
Constructs a service context with the given parent.
Destroys the service context object.
Returns the client data associated to key.
This function was introduced in Qt Mobility 1.1.
See also setClientData() and resetClientData().
Services may call this function to notify the service client about service related context information of the given type. The contextual information is stored in data.
This function was introduced in Qt Mobility 1.0.
Deletes all client data associated to the service context.
This function was introduced in Qt Mobility 1.1.
See also clientData() and setClientData().
Attaches arbitrary data value to the context object. The value can be retrieved via key.
This function was introduced in Qt Mobility 1.1.
See also clientData() and resetClientData().