18
|
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 |
#include "smfprovider.h"
|
|
21 |
|
|
22 |
/**
|
|
23 |
* Constructor
|
|
24 |
*/
|
|
25 |
SmfProvider::SmfProvider()
|
|
26 |
{
|
|
27 |
|
|
28 |
}
|
|
29 |
|
|
30 |
/**
|
|
31 |
* Destructor
|
|
32 |
*/
|
|
33 |
SmfProvider::~SmfProvider()
|
|
34 |
{
|
|
35 |
|
|
36 |
}
|
|
37 |
|
|
38 |
/**
|
|
39 |
* Localizable name of the service
|
|
40 |
* @return service name
|
|
41 |
*/
|
|
42 |
QString SmfProvider::serviceName() const
|
|
43 |
{
|
|
44 |
return m_serviceName;
|
|
45 |
}
|
|
46 |
|
|
47 |
/**
|
|
48 |
* Logo of the service
|
|
49 |
* @return logo image of the service
|
|
50 |
*/
|
|
51 |
QImage SmfProvider::serviceIcon() const
|
|
52 |
{
|
|
53 |
return m_serviceIcon;
|
|
54 |
}
|
|
55 |
|
|
56 |
/**
|
|
57 |
* Readable service description
|
|
58 |
* @return service description
|
|
59 |
*/
|
|
60 |
QString SmfProvider::description() const
|
|
61 |
{
|
|
62 |
return m_description;
|
|
63 |
}
|
|
64 |
|
|
65 |
/*
|
|
66 |
* Website of the service
|
|
67 |
* @return service url
|
|
68 |
*/
|
|
69 |
QUrl SmfProvider::serviceUrl() const
|
|
70 |
{
|
|
71 |
return m_serviceUrl;
|
|
72 |
}
|
|
73 |
|
|
74 |
/**
|
|
75 |
* URL of the application providing this service
|
|
76 |
* @return application url
|
|
77 |
*/
|
|
78 |
QUrl SmfProvider::applicationUrl() const
|
|
79 |
{
|
|
80 |
return m_appUrl;
|
|
81 |
}
|
|
82 |
|
|
83 |
/**
|
|
84 |
* List of interfaces that this provider support
|
|
85 |
* @return List of supported interface names
|
|
86 |
*/
|
|
87 |
QList<QString> SmfProvider::supportedInterfaces() const
|
|
88 |
{
|
|
89 |
return m_serviceTypes;
|
|
90 |
}
|
|
91 |
|
|
92 |
/**
|
|
93 |
* List of languages supported by this service provider
|
|
94 |
* @return a QStringList of languages supported by this service
|
|
95 |
* provider in 2 letter ISO 639-1 format.
|
|
96 |
*/
|
|
97 |
QStringList SmfProvider::supportedLanguages() const
|
|
98 |
{
|
|
99 |
return m_supportedLanguages;
|
|
100 |
}
|
|
101 |
|
|
102 |
/**
|
|
103 |
* Sets Localizable name of the service
|
|
104 |
* @param name service name
|
|
105 |
*/
|
|
106 |
void SmfProvider::setServiceName(QString& name)
|
|
107 |
{
|
|
108 |
m_serviceName = name;
|
|
109 |
}
|
|
110 |
|
|
111 |
/**
|
|
112 |
* Sets Logo of the service
|
|
113 |
* @param image service icon
|
|
114 |
*/
|
|
115 |
void SmfProvider::setServiceIcon(QImage& image)
|
|
116 |
{
|
|
117 |
m_serviceIcon = image;
|
|
118 |
}
|
|
119 |
|
|
120 |
/**
|
|
121 |
* Sets Readable service description
|
|
122 |
* @param desc description text
|
|
123 |
*/
|
|
124 |
void SmfProvider::setDescription(QString& desc)
|
|
125 |
{
|
|
126 |
m_description = desc;
|
|
127 |
}
|
|
128 |
|
|
129 |
/*
|
|
130 |
* Sets Website of the service
|
|
131 |
* @param name service url
|
|
132 |
*/
|
|
133 |
void SmfProvider::setServiceUrl(QUrl& url)
|
|
134 |
{
|
|
135 |
m_serviceUrl = url;
|
|
136 |
}
|
|
137 |
|
|
138 |
/**
|
|
139 |
* Sets URL of the application providing this service
|
|
140 |
* @param url application url
|
|
141 |
*/
|
|
142 |
void SmfProvider::setApplicationUrl(QUrl& url)
|
|
143 |
{
|
|
144 |
m_appUrl = url;
|
|
145 |
}
|
|
146 |
|
|
147 |
/**
|
|
148 |
* Sets list of interfaces that this provider supports
|
|
149 |
* @param types List of supported interface names
|
|
150 |
*/
|
|
151 |
void SmfProvider::setSupportedInterfaces( QStringList& types)
|
|
152 |
{
|
|
153 |
m_serviceTypes = types;
|
|
154 |
}
|
|
155 |
|
|
156 |
|
|
157 |
/**
|
|
158 |
* Sets the list of languages supported by this service provider
|
|
159 |
* @param lang A QStringList of languages supported by this service
|
|
160 |
* provider in 2 letter ISO 639-1 format.
|
|
161 |
*/
|
|
162 |
void SmfProvider::setSupportedLanguages( QStringList& lang )
|
|
163 |
{
|
|
164 |
m_supportedLanguages = lang;
|
|
165 |
}
|
|
166 |
|
|
167 |
/**
|
|
168 |
* Method for Externalization. Writes the SmfProvider object to
|
|
169 |
* the stream and returns a reference to the stream.
|
|
170 |
* @param out Stream to be written
|
|
171 |
* @param base The SmfProvider object to be externalized
|
|
172 |
* @return reference to the written stream
|
|
173 |
*/
|
|
174 |
QDataStream &operator<<(QDataStream& out, const SmfProvider& base)
|
|
175 |
{
|
|
176 |
out<<base.m_serviceName;
|
|
177 |
out<<base.m_serviceIcon;
|
|
178 |
out<<base.m_description;
|
|
179 |
out<<base.m_serviceUrl;
|
|
180 |
out<<base.m_appUrl;
|
|
181 |
out<<base.m_serviceTypes;
|
|
182 |
out<<base.m_supportedLanguages;
|
|
183 |
return out;
|
|
184 |
}
|
|
185 |
|
|
186 |
/**
|
|
187 |
* Method for Internalization. Reads a SmfProvider object from
|
|
188 |
* the stream and returns a reference to the stream.
|
|
189 |
* @param in Stream to be read
|
|
190 |
* @param base The SmfProvider object to be internalized
|
|
191 |
* @return reference to the stream
|
|
192 |
*/
|
|
193 |
QDataStream &operator>>(QDataStream& in, SmfProvider& base)
|
|
194 |
{
|
|
195 |
in>>base.m_serviceName;
|
|
196 |
in>>base.m_serviceIcon;
|
|
197 |
in>>base.m_description;
|
|
198 |
in>>base.m_serviceUrl;
|
|
199 |
in>>base.m_appUrl;
|
|
200 |
in>>base.m_serviceTypes;
|
|
201 |
in>>base.m_supportedLanguages;
|
|
202 |
return in;
|
|
203 |
}
|