author | cgandhi |
Tue, 12 Oct 2010 15:23:52 +0530 | |
changeset 27 | b3e1347ac96a |
parent 26 | 83d6a149c755 |
permissions | -rw-r--r-- |
26 | 1 |
/**************************************************************************** |
2 |
** |
|
3 |
** Trolltech hereby grants a license to use the Qt/Eclipse Integration |
|
4 |
** plug-in (the software contained herein), in binary form, solely for the |
|
5 |
** purpose of creating code to be used with Trolltech's Qt software. |
|
6 |
** |
|
7 |
** Qt Designer is licensed under the terms of the GNU General Public |
|
8 |
** License versions 2.0 and 3.0 ("GPL License"). Trolltech offers users the |
|
9 |
** right to use certain no GPL licensed software under the terms of its GPL |
|
10 |
** Exception version 1.2 (http://trolltech.com/products/qt/gplexception). |
|
11 |
** |
|
12 |
** THIS SOFTWARE IS PROVIDED BY TROLLTECH AND ITS CONTRIBUTORS (IF ANY) "AS |
|
13 |
** IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED |
|
14 |
** TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A |
|
15 |
** PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER |
|
16 |
** OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, |
|
17 |
** EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, |
|
18 |
** PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR |
|
19 |
** PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF |
|
20 |
** LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING |
|
21 |
** NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS |
|
22 |
** SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE." |
|
23 |
** |
|
24 |
** Since we now have the GPL exception I think that the "special exception |
|
25 |
** is no longer needed. The license text proposed above (other than the |
|
26 |
** special exception portion of it) is the BSD license and we have added |
|
27 |
** the BSD license as a permissible license under the exception. |
|
28 |
** |
|
29 |
****************************************************************************/ |
|
30 |
||
31 |
#include <qdebug.h> |
|
32 |
#include <smfclient.h> |
|
33 |
#include <smfcontactfetcher.h> |
|
34 |
||
35 |
#include "SmfMusicEventsnService.h" |
|
36 |
||
37 |
SmfTestApp::SmfTestApp(QWidget *parent) |
|
38 |
: QWidget(parent) |
|
39 |
{ |
|
40 |
ui.setupUi(this); |
|
41 |
m_contactFetcher = NULL; |
|
42 |
m_providerList = NULL; |
|
43 |
} |
|
44 |
||
45 |
SmfTestApp::~SmfTestApp() |
|
46 |
{ |
|
47 |
if(m_contactFetcher) |
|
48 |
delete m_contactFetcher; |
|
49 |
if(m_providerList) |
|
50 |
delete m_providerList; |
|
51 |
} |
|
52 |
||
53 |
void SmfTestApp::getFacebookFriends() |
|
54 |
{ |
|
55 |
qDebug()<<"Inside SmfTestApp::getFacebookFriends()"; |
|
56 |
||
57 |
// Get the list of providers |
|
58 |
SmfClient client; |
|
59 |
QString intfName("org.symbian.smf.plugin.contact.fetcher"); |
|
60 |
||
61 |
m_providerList = client.GetServices(intfName); |
|
62 |
qDebug()<<"client.GetServices returned a list with count = "<<m_providerList->count(); |
|
63 |
||
64 |
// flag to check if required plugin is there |
|
65 |
bool pluginFound = false; |
|
66 |
foreach(SmfProvider provider, *m_providerList) |
|
67 |
{ |
|
68 |
if("Facebook" == provider.serviceName()) |
|
69 |
{ |
|
70 |
qDebug()<<"Plugin for Facebook found"; |
|
71 |
pluginFound = true; |
|
72 |
m_contactFetcher = new SmfContactFetcher(&provider); |
|
73 |
SmfError err = m_contactFetcher->friends(1, 10); |
|
74 |
qDebug()<<"Ret value of friends() = "<<err; |
|
75 |
||
76 |
bool connected = connect(m_contactFetcher, SIGNAL(friendsListAvailable(SmfContactList*, SmfError , SmfResultPage)), |
|
77 |
this, SLOT(friendsListAvailable(SmfContactList*, SmfError , SmfResultPage))); |
|
78 |
qDebug()<<"Signal-slot connected ? = "<<connected; |
|
79 |
} |
|
80 |
} |
|
81 |
||
82 |
if(!pluginFound) |
|
83 |
{ |
|
84 |
qDebug()<<"Plugin for Facebook not found!!!"; |
|
85 |
} |
|
86 |
||
87 |
qDebug()<<"Returning from SmfTestApp::getFacebookFriends()"; |
|
88 |
} |
|
89 |
||
90 |
||
91 |
void SmfTestApp::friendsListAvailable ( SmfContactList* list, SmfError error, SmfResultPage resultPage ) |
|
92 |
{ |
|
93 |
Q_UNUSED(resultPage) |
|
94 |
qDebug()<<"Inside SmfTestApp::friendsListAvailable()"; |
|
95 |
||
96 |
if(error) |
|
97 |
{ |
|
98 |
SmfClient client; |
|
99 |
QString errStr = client.errorString(error); |
|
100 |
qDebug()<<"Error found, code = "<<error; |
|
101 |
qDebug()<<"Error string is = "<<errStr; |
|
102 |
||
103 |
return; |
|
104 |
} |
|
105 |
||
106 |
//display friends information |
|
107 |
qDebug()<<"Number of friends retrieved = "<<list->count(); |
|
108 |
if(0 == list->count()) |
|
109 |
{ |
|
110 |
qDebug()<<"No friends available!!!"; |
|
111 |
return; |
|
112 |
} |
|
113 |
||
114 |
foreach(SmfContact contact, *list) |
|
115 |
{ |
|
116 |
qDebug()<<"Friends name = "<<contact.value("Name").value<QContactName>().firstName(); |
|
117 |
qDebug()<<"Friends status msg desc = "<<contact.value("Presence").value<QContactPresence>().customMessage(); |
|
118 |
qDebug()<<"Friends profile image URL = "<<contact.value("Avatar").value<QContactAvatar>().imageUrl(); |
|
119 |
qDebug()<<""; |
|
120 |
} |
|
121 |
||
122 |
delete list; |
|
123 |
} |
|
124 |
//chinmaya |
|
125 |
void SmfTestApp::lastFm() |
|
126 |
{ |
|
127 |
qDebug()<<"Inside SmfTestApp::lastFm()"; |
|
128 |
||
129 |
// Get the list of providers |
|
130 |
SmfClient client; |
|
131 |
QString intfName("org.symbian.smf.plugin.music.service"); |
|
132 |
||
133 |
m_providerList = client.GetServices(intfName); |
|
134 |
qDebug()<<"client.GetServices returned a list with count = "<<m_providerList->count(); |
|
135 |
||
136 |
// flag to check if required plugin is there |
|
137 |
bool pluginFound = false; |
|
138 |
foreach(SmfProvider provider, *m_providerList) |
|
139 |
{ |
|
140 |
if("last.fm" == provider.serviceName()) |
|
141 |
{ |
|
142 |
qDebug()<<"Plugin for last.fm found"; |
|
143 |
pluginFound = true; |
|
144 |
SmfMusicService *m_musicService = new SmfMusicService(&provider); |
|
145 |
SmfError err = m_musicService->userMusicInfo(); |
|
146 |
bool connected = QObject::connect(m_musicService,SIGNAL(userMusicInfoAvailable(SmfMusicProfile*,SmfError)), |
|
147 |
this,SLOT(userMusicInfoAvlbl(SmfMusicProfile*,SmfError))); |
|
148 |
qDebug() <<"Smfmusicservice::userMusicInfo" ; |
|
149 |
qDebug()<<"Signal-slot connected ? = "<<connected; |
|
150 |
} |
|
151 |
} |
|
152 |
||
153 |
if(!pluginFound) |
|
154 |
{ |
|
155 |
qDebug()<<"Plugin for last.fm not found!!!"; |
|
156 |
} |
|
157 |
||
158 |
qDebug()<<"Returning from SmfTestApp::last.fm()"; |
|
159 |
} |
|
160 |
void SmfTestApp::userMusicInfoAvlbl(SmfMusicProfile*,SmfError) |
|
161 |
{ |
|
162 |
qDebug()<<"User music info"; |
|
163 |
} |
|
164 |
||
165 |
||
166 |
||
167 |
||
168 |
||
169 |
void SmfTestApp::FacebookFiltered() |
|
170 |
{ |
|
171 |
qDebug()<<"Inside SmfTestApp::FacebookFiltered()"; |
|
172 |
||
173 |
// Get the list of providers |
|
174 |
SmfClient client; |
|
175 |
QString intfName("org.symbian.smf.client.activity.fetcher"); |
|
176 |
||
177 |
m_providerList = client.GetServices(intfName); |
|
178 |
qDebug()<<"client.GetServices returned a list with count = "<<m_providerList->count(); |
|
179 |
||
180 |
// flag to check if required plugin is there |
|
181 |
bool pluginFound = false; |
|
182 |
foreach(SmfProvider provider, *m_providerList) |
|
183 |
{ |
|
184 |
if("Facebook" == provider.serviceName()) |
|
185 |
{ |
|
186 |
qDebug()<<"Plugin for Facebook found"; |
|
187 |
pluginFound = true; |
|
188 |
SmfActivityFetcher *p_smfActivityFetcher = new SmfActivityFetcher(&provider); |
|
189 |
QList<SmfActivityObjectType> Article; |
|
190 |
||
191 |
SmfActivityObjectType SmfActivityObjTypeComment; |
|
192 |
Article.append(SmfActivityObjTypeComment); |
|
193 |
||
194 |
// specify some dummy value for Article |
|
27
b3e1347ac96a
Updating the information for test applications and results.
cgandhi
parents:
26
diff
changeset
|
195 |
SmfError err = p_smfActivityFetcher->filtered(Article); |
26 | 196 |
bool connected = QObject::connect(p_smfActivityFetcher,SIGNAL(resultsAvailable(SmfActivityEntryList*, SmfError, SmfResultPage)), |
197 |
this,SLOT(resultsAvailableSlot(SmfActivityEntryList*, SmfError, SmfResultPage))); |
|
198 |
qDebug() <<"SmfActivityFetcher::filter" ; |
|
199 |
qDebug()<<"Signal-slot connected ? = "<<connected; |
|
200 |
} |
|
201 |
} |
|
202 |
||
203 |
if(!pluginFound) |
|
204 |
{ |
|
205 |
qDebug()<<"Plugin for Facebook not found!!!"; |
|
206 |
} |
|
207 |
||
208 |
qDebug()<<"Returning from SmfTestApp::getFacebookFriends()"; |
|
209 |
} |
|
210 |
||
211 |
void SmfTestApp::FacebookActivities() |
|
212 |
{ |
|
213 |
qDebug()<<"Inside SmfTestApp::FacebookFiltered()"; |
|
214 |
||
215 |
// Get the list of providers |
|
216 |
SmfClient client; |
|
217 |
QString intfName("org.symbian.smf.client.activity.fetcher"); |
|
218 |
||
219 |
m_providerList = client.GetServices(intfName); |
|
220 |
qDebug()<<"client.GetServices returned a list with count = "<<m_providerList->count(); |
|
221 |
||
222 |
// flag to check if required plugin is there |
|
223 |
bool pluginFound = false; |
|
224 |
foreach(SmfProvider provider, *m_providerList) |
|
225 |
{ |
|
226 |
if("Facebook" == provider.serviceName()) |
|
227 |
{ |
|
228 |
qDebug()<<"Plugin for Facebook found"; |
|
229 |
pluginFound = true; |
|
230 |
SmfActivityFetcher *p_smfActivityFetcher = new SmfActivityFetcher(&provider); |
|
231 |
QContactName Name; |
|
232 |
//Name.setFirstName("Siddartha"); |
|
233 |
//Name.setLastName("Chandra"); |
|
234 |
||
235 |
SmfContact aFriend; |
|
236 |
// add some dummy values to aFriend methods |
|
237 |
QString str; |
|
238 |
str.append("Name"); |
|
239 |
QVariant var = QVariant::fromValue<QContactName>(Name); |
|
240 |
||
241 |
aFriend.setValue(str,var); |
|
242 |
QContactGuid guid; |
|
243 |
||
244 |
// contact->value("Guid").value<QContactGuid>() ; |
|
245 |
||
246 |
QString userId = "558588290"; |
|
247 |
||
248 |
guid.setGuid(userId); |
|
249 |
||
250 |
QVariant contactId = QVariant::fromValue<QContactGuid>(guid); |
|
251 |
||
252 |
aFriend.setValue("Guid",contactId); |
|
253 |
int pageNum = 1,perPage=2; |
|
254 |
SmfError err = p_smfActivityFetcher->friendsActivities(aFriend,pageNum,perPage); |
|
255 |
bool connected = QObject::connect(p_smfActivityFetcher,SIGNAL(resultsAvailable(SmfActivityEntryList*, SmfError, SmfResultPage)), |
|
256 |
this,SLOT(resultsAvailableSlot(SmfActivityEntryList*, SmfError, SmfResultPage))); |
|
257 |
qDebug() <<"SmfActivityFetcher::filter" ; |
|
258 |
qDebug()<<"Signal-slot connected ? = "<<connected; |
|
259 |
} |
|
260 |
} |
|
261 |
||
262 |
if(!pluginFound) |
|
263 |
{ |
|
264 |
qDebug()<<"Plugin for Facebook not found!!!"; |
|
265 |
} |
|
266 |
||
267 |
qDebug()<<"Returning from SmfTestApp::getFacebookFriends()"; |
|
268 |
} |
|
269 |
||
270 |
||
271 |
void SmfTestApp::resultsAvailableSlot(SmfActivityEntryList *ptr, SmfError _t2, SmfResultPage _t3) |
|
272 |
{ |
|
273 |
qDebug()<<"inside resultsAvailableSlot"; |
|
274 |
//qDebug()<<"data"<<SmfActivityEntryList->_t3; |
|
275 |
qDebug()<<ptr->at(0).id(); |
|
276 |
foreach(SmfActivityEntry contact, (*ptr)) |
|
277 |
{ |
|
278 |
qDebug()<<"SmfActivityEntry id = "<<contact.id(); |
|
279 |
/*qDebug()<<"Friends status msg desc = "<<contact.; |
|
280 |
qDebug()<<"Friends profile image URL = "<<contact.value("Avatar").value<QContactAvatar>().imageUrl(); |
|
281 |
qDebug()<<"";*/ |
|
282 |
} |
|
283 |
||
284 |
delete ptr; |
|
285 |
} |