MeeGo 1.2 Harmattan Developer Documentation Develop for the Nokia N9

QServiceContext Class Reference

The QServiceContext class provides context information to services. More...

 #include <QServiceContext>

Inherits: QObject.

This class was introduced in Qt Mobility 1.0.

Public Types

enum ContextType { DisplayContext, ScriptContext, UserDefined }

Properties

  • 1 property inherited from QObject

Public Functions

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 )
  • 29 public functions inherited from QObject

Additional Inherited Members

  • 1 public slot inherited from QObject
  • 1 signal inherited from QObject
  • 1 public variable inherited from QObject
  • 4 static public members inherited from QObject
  • 7 protected functions inherited from QObject
  • 2 protected variables inherited from QObject

Detailed Description

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.

Member Type Documentation

enum QServiceContext::ContextType

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.

Property Documentation

clientId : QString

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 )

clientName : QString

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 )

Member Function Documentation

QServiceContext::QServiceContext ( QObject * parent = 0 )

Constructs a service context with the given parent.

QServiceContext::~QServiceContext () [virtual]

Destroys the service context object.

QVariant QServiceContext::clientData ( const QString & key ) const

Returns the client data associated to key.

This function was introduced in Qt Mobility 1.1.

See also setClientData() and resetClientData().

void QServiceContext::notify ( ContextType type, const QVariant & data ) [pure virtual]

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.

void QServiceContext::resetClientData ()

Deletes all client data associated to the service context.

This function was introduced in Qt Mobility 1.1.

See also clientData() and setClientData().

void QServiceContext::setClientData ( const QString & key, const QVariant & value )

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().