smf/smfservermodule/smfcommon/smfprovider.h
changeset 18 013a02bf2bb0
child 26 83d6a149c755
equal deleted inserted replaced
17:106a4bfcb866 18:013a02bf2bb0
       
     1 /**
       
     2  * Copyright (c) 2010 Sasken Communication Technologies Ltd.
       
     3  * All rights reserved.
       
     4  * This component and the accompanying materials are made available
       
     5  * under the terms of the "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  * Chandradeep Gandhi, Sasken Communication Technologies Ltd - Initial contribution
       
    11  *
       
    12  * Contributors:
       
    13  * Manasij Roy, Nalina Hariharan
       
    14  * 
       
    15  * Description:
       
    16  * Interface for a base service provider
       
    17  *
       
    18  */
       
    19 
       
    20 #ifndef SMFPROVIDER_H
       
    21 #define SMFPROVIDER_H
       
    22 
       
    23 #include <QObject>
       
    24 #include <QImage>
       
    25 #include <QUrl>
       
    26 #include <QStringList>
       
    27 #include <QMetaType>
       
    28 
       
    29 #include "smfclientglobal.h"
       
    30 
       
    31 /**
       
    32  * @ingroup smf_client_group 
       
    33  * Interface for a base service provider. Other service provider classes contains 
       
    34  * implementation of this base class so that each has access to service provider 
       
    35  * information.
       
    36  * All of the functionality described here should be implemented by a service
       
    37  * specific plug-in object.
       
    38  */
       
    39 class SMFCOMMON_EXPORT SmfProvider
       
    40 	{
       
    41 	
       
    42 public:
       
    43 	/**
       
    44 	 * Constructor
       
    45 	 */
       
    46 	SmfProvider();
       
    47 	/**
       
    48 	 * Destructor
       
    49 	 */
       
    50 	~SmfProvider();
       
    51 
       
    52 public:
       
    53 	/**
       
    54 	 * Localizable name of the service 
       
    55 	 * @return service name
       
    56 	 */
       
    57 	QString serviceName() const; 
       
    58 	
       
    59 	/**
       
    60 	 * Logo of the service
       
    61 	 * @return logo image of the service
       
    62 	 */
       
    63 	QImage serviceIcon() const; 
       
    64 	
       
    65 	/**
       
    66 	 * Readable service description
       
    67 	 * @return service description
       
    68 	 */
       
    69 	QString description() const; 
       
    70 	
       
    71 	/*
       
    72 	 * Website of the service
       
    73 	 * @return service url 
       
    74 	 */
       
    75 	QUrl serviceUrl() const;
       
    76 	
       
    77 	/**
       
    78 	 * URL of the application providing this service
       
    79 	 * @return application url
       
    80 	 */
       
    81 	QUrl applicationUrl() const;
       
    82 	
       
    83 	/**
       
    84 	 * List of interfaces that this provider support
       
    85 	 * @return List of supported interface names
       
    86 	 */
       
    87 	QList<QString> supportedInterfaces() const;
       
    88 	
       
    89 	/**
       
    90 	 * List of languages supported by this service provider
       
    91 	 * @return a QStringList of languages supported by this service 
       
    92 	 * provider in 2 letter ISO 639-1 format.
       
    93 	 */
       
    94 	QStringList supportedLanguages() const;
       
    95 	
       
    96 	/**
       
    97 	 * Sets Localizable name of the service 
       
    98 	 * @param name service name
       
    99 	 */
       
   100 	void setServiceName(QString& name); 
       
   101 	
       
   102 	/**
       
   103 	 * Sets Logo of the service
       
   104 	 * @param image service icon
       
   105 	 */
       
   106 	void setServiceIcon(QImage& image) ; 
       
   107 	
       
   108 	/**
       
   109 	 * Sets Readable service description
       
   110 	 * @param desc description text
       
   111 	 */
       
   112 	void setDescription(QString& desc) ; 
       
   113 	
       
   114 	/*
       
   115 	 * Sets Website of the service
       
   116 	 * @param name service url
       
   117 	 */
       
   118 	void setServiceUrl(QUrl& url) ;
       
   119 	
       
   120 	/**
       
   121 	 * Sets URL of the application providing this service
       
   122 	 * @param url application url
       
   123 	 */
       
   124 	void setApplicationUrl(QUrl& url) ; 
       
   125 	
       
   126 	/**
       
   127 	 * Sets list of interfaces that this provider supports
       
   128 	 * @param types List of supported interface names
       
   129 	 */
       
   130 	void setSupportedInterfaces( QStringList& types);
       
   131 	
       
   132 	/**
       
   133 	 * Sets the list of languages supported by this service provider
       
   134 	 * @param lang A QStringList of languages supported by this service 
       
   135 	 * provider in 2 letter ISO 639-1 format.
       
   136 	 */
       
   137 	void setSupportedLanguages( QStringList& lang );
       
   138  
       
   139 private:
       
   140 	QString m_serviceName;
       
   141 	QImage m_serviceIcon;
       
   142 	QString m_description;
       
   143 	QUrl m_serviceUrl;
       
   144 	QUrl m_appUrl;
       
   145 	QStringList m_serviceTypes;
       
   146 	QStringList m_supportedLanguages;
       
   147 	
       
   148 	friend QDataStream &operator<<(QDataStream &, const SmfProvider&);
       
   149 	friend QDataStream &operator>>(QDataStream &, SmfProvider&);
       
   150 	};
       
   151 
       
   152 /**
       
   153  * Method for Externalization. Writes the SmfProvider object to 
       
   154  * the stream and returns a reference to the stream.
       
   155  * @param aDataStream Stream to be written
       
   156  * @param aProvider The SmfProvider object to be externalized
       
   157  * @return reference to the written stream
       
   158  */
       
   159 SMFCOMMON_EXPORT QDataStream& operator<<(QDataStream &aDataStream, 
       
   160 		const SmfProvider &aProvider);
       
   161 
       
   162 /**
       
   163  * Method for Internalization. Reads a SmfProvider object from 
       
   164  * the stream and returns a reference to the stream.
       
   165  * @param aDataStream Stream to be read
       
   166  * @param aProvider The SmfProvider object to be internalized
       
   167  * @return reference to the stream
       
   168  */
       
   169 SMFCOMMON_EXPORT QDataStream& operator>>(QDataStream &aDataStream, 
       
   170 		SmfProvider &aProvider);
       
   171 
       
   172 typedef QList<SmfProvider> SmfProviderList;
       
   173 
       
   174 // Make the class SmfProvider known to QMetaType, so that as to register it.
       
   175 Q_DECLARE_METATYPE(SmfProvider)
       
   176 Q_DECLARE_METATYPE(QList<SmfProvider>)
       
   177 
       
   178 #endif // SMFPROVIDER_H