qtmobility/src/serviceframework/qservicecontext.cpp
changeset 1 2b40d63a9c3d
child 11 06b8e2af4411
equal deleted inserted replaced
0:cfcbf08528c4 1:2b40d63a9c3d
       
     1 /****************************************************************************
       
     2 **
       
     3 ** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
       
     4 ** All rights reserved.
       
     5 ** Contact: Nokia Corporation (qt-info@nokia.com)
       
     6 **
       
     7 ** This file is part of the Qt Mobility Components.
       
     8 **
       
     9 ** $QT_BEGIN_LICENSE:LGPL$
       
    10 ** No Commercial Usage
       
    11 ** This file contains pre-release code and may not be distributed.
       
    12 ** You may use this file in accordance with the terms and conditions
       
    13 ** contained in the Technology Preview License Agreement accompanying
       
    14 ** this package.
       
    15 **
       
    16 ** GNU Lesser General Public License Usage
       
    17 ** Alternatively, this file may be used under the terms of the GNU Lesser
       
    18 ** General Public License version 2.1 as published by the Free Software
       
    19 ** Foundation and appearing in the file LICENSE.LGPL included in the
       
    20 ** packaging of this file.  Please review the following information to
       
    21 ** ensure the GNU Lesser General Public License version 2.1 requirements
       
    22 ** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
       
    23 **
       
    24 ** In addition, as a special exception, Nokia gives you certain additional
       
    25 ** rights.  These rights are described in the Nokia Qt LGPL Exception
       
    26 ** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
       
    27 **
       
    28 ** If you have questions regarding the use of this file, please contact
       
    29 ** Nokia at qt-info@nokia.com.
       
    30 **
       
    31 **
       
    32 **
       
    33 **
       
    34 **
       
    35 **
       
    36 **
       
    37 **
       
    38 ** $QT_END_LICENSE$
       
    39 **
       
    40 ****************************************************************************/
       
    41 
       
    42 #include "qservicecontext.h"
       
    43 
       
    44 QTM_BEGIN_NAMESPACE
       
    45 
       
    46 /*!
       
    47     \class QServiceContext
       
    48     \ingroup servicefw
       
    49     \brief The QServiceContext class provides context information to 
       
    50     services.
       
    51 
       
    52     A service context is created by clients and passed on to the service.
       
    53     It enables the opportunity to pass additional context information 
       
    54     and errors between services, clients and the service framework.
       
    55     
       
    56     Clients must implement this abstract class to receive context information.
       
    57 
       
    58     \sa QServiceManager
       
    59 
       
    60 */
       
    61 
       
    62 /*!
       
    63     \enum QServiceContext::ContextType
       
    64 
       
    65     This enum describes the type of context information.
       
    66 
       
    67     \value  DisplayContext              The service provides user visible display 
       
    68                                         text such as an error message.
       
    69     \value  ScriptContext               The service provides a script which may 
       
    70                                         be executed by the client.
       
    71     \value  UserDefined                 The first context type that can be used for service
       
    72                                         specific context information.
       
    73 */
       
    74 
       
    75 /*!
       
    76     \fn void QServiceContext::notify(ContextType type, const QVariant& data) = 0
       
    77 
       
    78     Services may call this function to notify the service client about service related
       
    79     context information of the given \a type. The contextual information is stored in \a data.  
       
    80 */
       
    81 
       
    82 /*!
       
    83     Constrcuts a service context with the given \a parent.
       
    84 */
       
    85 QServiceContext::QServiceContext(QObject* parent)
       
    86     : QObject(parent)
       
    87 {
       
    88 
       
    89 }
       
    90 
       
    91 /*!
       
    92     Destroys the service context object.
       
    93 */
       
    94 QServiceContext::~QServiceContext() 
       
    95 {
       
    96 }
       
    97 
       
    98 /*!
       
    99     \property QServiceContext::clientId
       
   100     \brief the id of the client using the service.
       
   101 
       
   102     By default, this value is empty but you can change this by calling
       
   103     setClientId().
       
   104 */
       
   105 QString QServiceContext::clientId() const
       
   106 {
       
   107     return m_id;
       
   108 }
       
   109 
       
   110 /*!
       
   111     Sets the \a id of the client using the service.
       
   112 */
       
   113 void QServiceContext::setClientId(const QString& id)
       
   114 {
       
   115     m_id = id;
       
   116 }
       
   117 
       
   118 /*!
       
   119     \property QServiceContext::clientName
       
   120     \brief the name of the client using the service.
       
   121 
       
   122     By default, this value is empty but you can change this by calling
       
   123     setClientName(). This string is translated and can be shown to the user.
       
   124 */
       
   125 QString QServiceContext::clientName() const
       
   126 {
       
   127     return m_displayName;
       
   128 }
       
   129 
       
   130 void QServiceContext::setClientName(const QString& name)
       
   131 {
       
   132     m_displayName = name;
       
   133 }
       
   134 
       
   135 #include "moc_qservicecontext.cpp"
       
   136 
       
   137 QTM_END_NAMESPACE