diff -r b2eb79881f9d -r 574948b60dab example/flickrcontactfetcherplugin/flickrcontactfetcherplugin.cpp --- a/example/flickrcontactfetcherplugin/flickrcontactfetcherplugin.cpp Thu Sep 16 11:15:30 2010 +0530 +++ b/example/flickrcontactfetcherplugin/flickrcontactfetcherplugin.cpp Thu Sep 23 17:15:03 2010 +0530 @@ -183,11 +183,70 @@ const int aPageNum , const int aItemsPerPage ) { +#ifndef TESTINGTHISFUNCTION Q_UNUSED(aRequest) Q_UNUSED(aPageNum) Q_UNUSED(aItemsPerPage) qDebug()<<"Inside FlickrContactFetcherPlugin::followers()"; return SmfPluginErrServiceNotSupported; +#else + SmfPluginError error = SmfPluginErrInvalidArguments; + + // invalid arguments + if( aPageNum < 0 || aItemsPerPage < 0 ) + { + qDebug()<<"Invalid arguments"; + return error; + } + + qDebug()<<"Valid arguments"; + + // Get the key sets from SMF Plugin Utility class. + QString apiKey; + QString apiSecret; + QString authToken; + fetchKeys(apiKey, apiSecret, authToken ); + + // Create the API signature string + QString baseString; + baseString.append(apiSecret); + baseString.append("api_key"+apiKey); + baseString.append("auth_token"+authToken); + baseString.append("filterfriends"); +#ifdef SMF_XMLPARSING + baseString.append("formatxml"); +#else + baseString.append("formatjson"); +#endif + baseString.append("methodflickr.contacts.getList"); + baseString.append("page"+QString::number(aPageNum)); + baseString.append("per_page"+QString::number(aItemsPerPage)); + + // Create the url + QUrl url("http://api.flickr.com/services/rest/?"); + url.addQueryItem("api_key", apiKey); + url.addQueryItem("auth_token", authToken); + url.addQueryItem("filter", "friends"); +#ifdef SMF_XMLPARSING + url.addQueryItem("format", "x"); +#else + url.addQueryItem("format", "json"); +#endif + url.addQueryItem("method", "flickr.contacts.getList"); + url.addQueryItem("page", QString::number(aPageNum)); + url.addQueryItem("per_page", QString::number(aItemsPerPage)); + url.addQueryItem("api_sig", generateSignature(baseString)); + + // Create the request, set the url + aRequest.iNetworkRequest.setUrl(url); + aRequest.iRequestType = SmfContactGetFollowers; + aRequest.iPostData = NULL; + aRequest.iHttpOperationType = QNetworkAccessManager::GetOperation; + error = SmfPluginErrNone; + + qDebug()<<"Url string is : "<().firstName())); + + + // Create the url + QUrl url("http://api.flickr.com/services/rest/?"); + url.addQueryItem("api_key", apiKey); + url.addQueryItem("auth_token", authToken); + url.addQueryItem("format", "json"); + url.addQueryItem("method", "flickr.people.findByUsername"); + url.addQueryItem("username",aContact.value("Name").value().firstName()); + //url.addQueryItem("page", QString::number(10)); + //url.addQueryItem("per_page", QString::number(10)); + + url.addQueryItem("api_sig", generateSignature(baseString)); + + // Create the request, set the url + aRequest.iNetworkRequest.setUrl(url); + aRequest.iRequestType = SmfContactSearch; + aRequest.iPostData = NULL; + aRequest.iHttpOperationType = QNetworkAccessManager::GetOperation; + error = SmfPluginErrNone; +// writeLog("Url string is :"+aRequest.iNetworkRequest.url().toString()); + return error; + +#endif } /** @@ -227,6 +330,7 @@ const int aPageNum , const int aItemsPerPage ) { +#ifndef TESTINGTHISFUNCTION Q_UNUSED(aRequest) Q_UNUSED(aLocation) Q_UNUSED(aProximity) @@ -234,6 +338,64 @@ Q_UNUSED(aItemsPerPage) qDebug()<<"Inside FlickrContactFetcherPlugin::searchNear()"; return SmfPluginErrServiceNotSupported; +#else + SmfPluginError error = SmfPluginErrInvalidArguments; + + // invalid arguments + if( aPageNum < 0 || aItemsPerPage < 0 ) + { + qDebug()<<"Invalid arguments"; + return error; + } + + qDebug()<<"Valid arguments"; + + // Get the key sets from SMF Plugin Utility class. + QString apiKey; + QString apiSecret; + QString authToken; + fetchKeys(apiKey, apiSecret, authToken ); + + // Create the API signature string + QString baseString; + baseString.append(apiSecret); + baseString.append("api_key"+apiKey); + baseString.append("auth_token"+authToken); + baseString.append("filterfriends"); +#ifdef SMF_XMLPARSING + baseString.append("formatxml"); +#else + baseString.append("formatjson"); +#endif + baseString.append("methodflickr.contacts.getList"); + baseString.append("page"+QString::number(aPageNum)); + baseString.append("per_page"+QString::number(aItemsPerPage)); + + // Create the url + QUrl url("http://api.flickr.com/services/rest/?"); + url.addQueryItem("api_key", apiKey); + url.addQueryItem("auth_token", authToken); + url.addQueryItem("filter", "friends"); +#ifdef SMF_XMLPARSING + url.addQueryItem("format", "x"); +#else + url.addQueryItem("format", "json"); +#endif + url.addQueryItem("method", "flickr.contacts.getList"); + url.addQueryItem("page", QString::number(aPageNum)); + url.addQueryItem("per_page", QString::number(aItemsPerPage)); + url.addQueryItem("api_sig", generateSignature(baseString)); + + // Create the request, set the url + aRequest.iNetworkRequest.setUrl(url); + aRequest.iRequestType = SmfContactSearchNear; + aRequest.iPostData = NULL; + aRequest.iHttpOperationType = QNetworkAccessManager::GetOperation; + error = SmfPluginErrNone; + + qDebug()<<"Url string is : "< list; + QVariantMap map2 = map1["groups"].toMap(); + int page = map2["page"].toInt(&ok); + qDebug()<<"PAGE = "< list1 = map2["group"].toList(); + QListIterator iter(list1); + + //Getting the group list from QJson Parser + while(iter.hasNext()) + { + QVariantMap map2 = iter.next().toMap(); + qDebug()<<"name = "<