Updating the source code for plugin manager, transport manager, smfserver and smfclient. sample plugins and tests are included
--- a/example/clientapi/example_usage.cpp Thu Apr 22 15:18:37 2010 +0530
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,336 +0,0 @@
-#include "smfglobal.h"
-#include "smfclient.h"
-#include "smfprovider.h"
-#include "smfgallery.h"
-#include "smfcontact.h"
-#include "smfpostprovider.h"
-#include "smfcontactfetcher.h"
-#include "smfmusic.h"
-#include "smfpicture.h"
-#include "smftrackinfo.h"
-#include "smfmusicprofile.h"
-#include "smflyrics.h"
-#include "smfactions.h"
-#include "smfactivityfetcher.h"
-#include <qalgorithms.h>
-#include "qtcontacts.h"
-#include <qdatastream.h>
-#include <QSharedData>
-#include <smfclientglobal.h>
-
-using namespace QtMobility;
-
-class MyAppView //: public QAbstractItemView
- {
-public:
- void add(QImage pic);
- void add(SmfTrackInfo trackInfo);
- void add(QContact qc);
- void setPicture(QImage image);
- void setTitle(QString cap);
- void setIcon(QImage image);
- void setDescription(QString desc);
- void setProvider(SmfProvider p);
- void setLyricsData(SmfLyrics l);
- };
-
-
-class MyApplication :public QObject
- {
- Q_OBJECT
-
-public slots:
- void displayGallery();
- void showPicsSlot(SmfPictureList* pics, QString err);
- void uploadPicture(QImage* picture, QList<SmfGallery> galleries);
- void uploaded(bool success);
-
- void displayFriends();
- void showlist(SmfContactList* friendsList);
- void postUpdate();
- void showPosts(SmfPostList* posts, QString err);
-
- void getMusic(SmfTrackInfo currTrack);
- void showTrackSearch(SmfTrackInfoList* songs);
- void showStore(SmfProviderList* stores);
- void updateCurrentPlaying(QList<SmfMusicSearch> musicServices, SmfTrackInfo currTrack);
- void displayLyrics(SmfTrackInfo currTrack);
- void showLyrics(SmfLyricsList* list);
-
- void getActivities();
- void showActivities(SmfActivityEntryList* entries);
-private:
- MyAppView* m_view;
- SmfClient client;
- SmfGallery* m_smfgl;
- SmfContactFetcher* m_smfcf;
- SmfMusicService* m_smfms;
- QList<SmfContact> m_myfrndz;
- };
-/** 1. Display a gallery on the screen for some remote service.
- * assume m_view is some gallery view object in the application.*/
-void MyApplication::displayGallery()
- {
- // Some common interface for finding implementations.
- QList<SmfProvider>* galleries = client.GetServices("org.symbian.smf.client.gallery\0.2");
-
- // We will use the first one now
- SmfProvider smfp = galleries->value(0);
- SmfGallery* myGallery = new SmfGallery(&smfp);
-
- // Adjust our view to show where these pictures came from
- QImage imge = smfp.serviceIcon();
- QString desc = smfp.description();
- QString name = smfp.serviceName();
- m_view->setIcon(imge);
- m_view->setProvider(smfp);
- m_view->setDescription(desc);
-
- /**
- * Asynchrnous request to fetch the pictures.
- * The picturesAvailable() signal is emitted
- * with SmfPictureList once the pictures have arrived.
- */
- myGallery->pictures();
- connect(myGallery,SIGNAL(picturesAvailable(SmfPictureList*, QString, SmfResultPage )),
- SLOT(showPicsSlot(SmfPictureList*, QString)));
-
- m_smfgl = myGallery;
- }
-
-void MyApplication::showPicsSlot(SmfPictureList* pics, QString err)
- {
- //check err string if there is any error
- if(err.compare("Err")) return;
- //if no error
- foreach(SmfPicture pic, *pics) {
- m_view->add(pic.picture() ); // do something with the picture in this gallery
- }
- }
-
-/** 2. Upload a picture captured by the user to some selection of galeries.*/
-void MyApplication::uploadPicture(QImage* picture, QList<SmfGallery> galleries)
- {
- /**
- * When uploading is finished we can check the success of the uploading
- */
- QObject::connect(m_smfcf,SIGNAL(uploadFinished(bool)),SLOT(uploaded(bool)));
- SmfPicture* smfPic = new SmfPicture(*picture);
- // The list could be from a selection of galleries chosen by the user,
- // think multiple TweetDeck accounts?
- foreach(SmfGallery gallery, galleries)
- {
- gallery.upload(smfPic);
- }
- }
-
-/**
- * Slot to catch the uploading finished event
- */
-void MyApplication::uploaded(bool success)
- {
- if(!success)
- {
- //error occured while uploading
- }
- }
-
-/**
- * 3. This is an example of displaying the friends profile image in a view from one or more
- * service provider. Note that this service can be provided by any kind of service provider,
- * e.g. last.fm music service where users maintain profiles and friends.
- */
-void MyApplication::displayFriends()
- {
- // Some common interface for finding implementations.
- QList<SmfProvider>* contactFetcherList = client.GetServices("org.symbian.smf.cleint.contact.fetcher\0.2");
- SmfProvider smfp = contactFetcherList->value(0);
- SmfContactFetcher* smfcf = new SmfContactFetcher(&smfp);
-
- //Request friend list, the friendsListAvailable() signal
- //is emitted with SmfContactList once data is arrived.
- QObject::connect(smfcf,SIGNAL(friendsListAvailable(SmfContactList*, QString, SmfResultPage )),
- SLOT(showlist(SmfContactList*)));
- smfcf->friends();
-
- m_smfcf = smfcf;
- }
-
-void MyApplication::showlist(SmfContactList* friendsList)
- {
-
- // Adjust our view to show where these pictures came from
- //display service name description and the logo
- m_view->setIcon( (m_smfcf->getProvider())->serviceIcon() );
- m_view->setDescription( (m_smfcf->getProvider())->description() );
-
- //now display the images
- foreach(SmfContact contact, *friendsList) {
- QVariant data = contact.value("Avatar");
- QImage pic = data.value<QImage>();
- QContact qc;
- contact.convert(qc);
- m_view->add(qc);
- m_myfrndz.append(contact);
- }
- }
-/**
- * 4. This is an example of posting and reading user updates to social netowrking sites
- */
-void MyApplication::postUpdate()
- {
- // Some common interface for finding implementations.
- QList<SmfProvider>* postServices = client.GetServices("org.symbian.smf.client.contact.posts\0.2");
-
- //let us use the first one
- QString servName = postServices->value(0).serviceName();
- if(!servName.compare("Facebook.com")) return;
- SmfProvider smfp = postServices->value(0);
- SmfPostProvider* myPostServer = new SmfPostProvider(&smfp);
-
- //Adjust our view to show where these posts came from (e.g. tweets from twitter)
- //display service name description and the logo
- m_view->setIcon((myPostServer->getProvider())->serviceIcon() );
- m_view->setProvider(myPostServer->getProvider());
- m_view->setDescription((myPostServer->getProvider())->description() );
-
- SmfPost reply("this is a text post", this);
- //post my udpate to be visible to all, connect to updatePostFinished()
- // signal of SmfPostProvider to track the success
- SmfContact frnd(m_myfrndz.value(0));
- myPostServer->postDirected(reply,frnd);
-
- //Asynchronously get all posts to me in my profle (e.g. twits from all friends)
- //connect to postsAvailable to show the post
- myPostServer->posts();
-
- QObject::connect(myPostServer,
- SIGNAL(postsAvailable(SmfPostList*, QString, SmfResultPage )),
- SLOT(showPosts(SmfPostList*, QString)));
- }
-void MyApplication::showPosts(SmfPostList* posts, QString /*err*/)
- {
- //Show the first post
- SmfPost post = posts->at(0);
- m_view->setDescription( post.toPlainText() );
- }
-/**
- * 5. This is an example of getting song recommendations from a social netowrking sites
- */
-void MyApplication::getMusic(SmfTrackInfo currTrack)
- {
- // Some common interface for finding implementations.
- QList<SmfProvider>* smfProList = client.GetServices("org.symbian.smf.client.music\0.2");
- SmfProvider smfp = smfProList->value(0);
- SmfMusicSearch* mServer = new SmfMusicSearch(&smfp);
-
- QObject::connect(mServer,SIGNAL(trackSearchAvailable(SmfTrackInfoList*, QString,SmfResultPage )),this,SLOT(showTrackSearch(SmfTrackInfoList*)));
- QObject::connect(mServer,SIGNAL(storeSearchAvailable(SmfProviderList*, QString,SmfResultPage )),this,SLOT(showStoreSearch(SmfProviderList*)));
- //search songs similar to currently playing,
- //connect to trackSearchAvailable signal to get the result
- mServer->recommendations(currTrack);
- //display to the user
- m_view->setIcon( mServer->getProvider()->serviceIcon() );
- m_view->setProvider( mServer->getProvider());
- m_view->setDescription( mServer->getProvider()->description() );
-
-
-
- }
-void MyApplication::showTrackSearch(SmfTrackInfoList* songs)
- {
- foreach(SmfTrackInfo track, *songs){
- m_view->add(track);
- }
- QList<SmfProvider>* smfProList = client.GetServices("org.symbian.smf.client.music.search\0.2");
- SmfProvider smfp = smfProList->value(0);
- SmfMusicSearch* mServer = new SmfMusicSearch(&smfp);
- //allow user to select a track and get purchase links
- //connect to showStoreSearch signal to display the stores for that track
- mServer->stores(songs->value(0));
- }
-void MyApplication::showStore(SmfProviderList* /*stores*/)
- {
- //show stores
- }
-void MyApplication::updateCurrentPlaying(QList<SmfMusicSearch> musicServices, SmfTrackInfo currTrack)
- {
- //after purchasing and downloading is over, user plays the track
- //now post the current platying track to all service providers
- //postFinished() signal of SmfMusicSearch can be tracked to check the success of the posts
- foreach(SmfMusicSearch provider, musicServices) {
- provider.postCurrentPlaying(currTrack);
- }
- //postCurrentPlaying is also a slot funtion, may be application can use connect
- }
-
-void MyApplication::displayLyrics(SmfTrackInfo currTrack)
- {
-
- // Some common interface for finding implementations.
- QList<SmfProvider>* smfProList = client.GetServices("org.symbian.smf.client.music.lyrics\0.2","lyricsfly.com");
- SmfProvider smfp = smfProList->value(0);
- SmfLyricsService* lyricsService = new SmfLyricsService(&smfp);
- QObject::connect(lyricsService,SIGNAL(lyricsAvailable(SmfLyricsList*, QString, SmfResultPage )),this,SLOT(showLyrics(SmfLyricsList*)));
-
- //Request to get the lyrics
- //lyricsAvailable() signal of SmfLyricsService is emitted when lyrics is available
- lyricsService->lyrics(currTrack);
-
- }
-void MyApplication::showLyrics(SmfLyricsList* list)
- {
- //now display the latest edited lyrics
- //qSort(list->begin(),list->end(),caseInsensitiveLessThan);
- m_view->setLyricsData(list->at(0));
- }
-
-void MyApplication::getActivities()
- {
- // Some common interface for finding implementations.
- QList<SmfProvider>* activityServices = client.GetServices("org.symbian.smf.client.activity.fetcher\0.2");
-
- //let us use the Facebook one
- QString servName = activityServices->value(0).serviceName();
- if(!servName.compare("Facebook.com")) return;
- SmfProvider smfp = activityServices->value(0);
- SmfActivityFetcher* myActivityServer = new SmfActivityFetcher(&smfp);
-
- //Adjust our view to show where these posts came from (e.g. streams from Facebook)
- //display service name description and the logo
- m_view->setIcon((myActivityServer->getProvider())->serviceIcon() );
- m_view->setProvider(myActivityServer->getProvider());
- m_view->setDescription((myActivityServer->getProvider())->description() );
-
- QObject::connect(myActivityServer,
- SIGNAL(resultsAvailable(SmfActivityEntryList*,QString,SmfResultPage)),
- this,SLOT(showActivities(SmfActivityEntryList*)));
-
- //get a list of updates to my wall
- myActivityServer->selfActivities();
- }
-
-void MyApplication::showActivities(SmfActivityEntryList* entries)
- {
- foreach(SmfActivityEntry entry, *entries) {
- SmfContact sc = entry.author();
- QString desc = (sc.value("Name")).toString();
- SmfPost details = entry.details();
- QList<SmfActivityObject> aol = entry.activities();
- SmfActivityObject sao = aol.value(0);
- if(SmfActivityMarkAsFavorite == entry.actionName() )
- {
- desc.append(" has marked ");
- QVariant qv = sao.objData();
- SmfActivityObjectType otype = sao.type();
- if((SmfActivityObjTypePhoto == otype ) && (qv.canConvert<SmfPicture>()))
- {
- SmfPicture pic = qv.value<SmfPicture>();
- desc.append( pic.description() );
- }
- desc.append(" as Favorite at");
- QDateTime qdt = sao.time();
- desc.append(qdt.toString("h:m:s ap"));
- }
- }
- }
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/example/example.pro Tue May 18 17:33:55 2010 +0530
@@ -0,0 +1,5 @@
+TEMPLATE = subdirs
+
+SUBDIRS = fbpostproviderplugin \
+ flickrcontactfetcherplugin \
+ smfclientapp
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/example/example_usage.cpp Tue May 18 17:33:55 2010 +0530
@@ -0,0 +1,336 @@
+#include "smfglobal.h"
+#include "smfclient.h"
+#include "smfprovider.h"
+#include "smfgallery.h"
+#include "smfcontact.h"
+#include "smfpostprovider.h"
+#include "smfcontactfetcher.h"
+#include "smfmusic.h"
+#include "smfpicture.h"
+#include "smftrackinfo.h"
+#include "smfmusicprofile.h"
+#include "smflyrics.h"
+#include "smfactions.h"
+#include "smfactivityfetcher.h"
+#include <qalgorithms.h>
+#include "qtcontacts.h"
+#include <qdatastream.h>
+#include <QSharedData>
+#include <smfclientglobal.h>
+
+using namespace QtMobility;
+
+class MyAppView //: public QAbstractItemView
+ {
+public:
+ void add(QImage pic);
+ void add(SmfTrackInfo trackInfo);
+ void add(QContact qc);
+ void setPicture(QImage image);
+ void setTitle(QString cap);
+ void setIcon(QImage image);
+ void setDescription(QString desc);
+ void setProvider(SmfProvider p);
+ void setLyricsData(SmfLyrics l);
+ };
+
+
+class MyApplication :public QObject
+ {
+ Q_OBJECT
+
+public slots:
+ void displayGallery();
+ void showPicsSlot(SmfPictureList* pics, QString err);
+ void uploadPicture(QImage* picture, QList<SmfGallery> galleries);
+ void uploaded(bool success);
+
+ void displayFriends();
+ void showlist(SmfContactList* friendsList);
+ void postUpdate();
+ void showPosts(SmfPostList* posts, QString err);
+
+ void getMusic(SmfTrackInfo currTrack);
+ void showTrackSearch(SmfTrackInfoList* songs);
+ void showStore(SmfProviderList* stores);
+ void updateCurrentPlaying(QList<SmfMusicSearch> musicServices, SmfTrackInfo currTrack);
+ void displayLyrics(SmfTrackInfo currTrack);
+ void showLyrics(SmfLyricsList* list);
+
+ void getActivities();
+ void showActivities(SmfActivityEntryList* entries);
+private:
+ MyAppView* m_view;
+ SmfClient client;
+ SmfGallery* m_smfgl;
+ SmfContactFetcher* m_smfcf;
+ SmfMusicService* m_smfms;
+ QList<SmfContact> m_myfrndz;
+ };
+/** 1. Display a gallery on the screen for some remote service.
+ * assume m_view is some gallery view object in the application.*/
+void MyApplication::displayGallery()
+ {
+ // Some common interface for finding implementations.
+ QList<SmfProvider>* galleries = client.GetServices("org.symbian.smf.client.gallery\0.2");
+
+ // We will use the first one now
+ SmfProvider smfp = galleries->value(0);
+ SmfGallery* myGallery = new SmfGallery(&smfp);
+
+ // Adjust our view to show where these pictures came from
+ QImage imge = smfp.serviceIcon();
+ QString desc = smfp.description();
+ QString name = smfp.serviceName();
+ m_view->setIcon(imge);
+ m_view->setProvider(smfp);
+ m_view->setDescription(desc);
+
+ /**
+ * Asynchrnous request to fetch the pictures.
+ * The picturesAvailable() signal is emitted
+ * with SmfPictureList once the pictures have arrived.
+ */
+ myGallery->pictures();
+ connect(myGallery,SIGNAL(picturesAvailable(SmfPictureList*, QString, SmfResultPage )),
+ SLOT(showPicsSlot(SmfPictureList*, QString)));
+
+ m_smfgl = myGallery;
+ }
+
+void MyApplication::showPicsSlot(SmfPictureList* pics, QString err)
+ {
+ //check err string if there is any error
+ if(err.compare("Err")) return;
+ //if no error
+ foreach(SmfPicture pic, *pics) {
+ m_view->add(pic.picture() ); // do something with the picture in this gallery
+ }
+ }
+
+/** 2. Upload a picture captured by the user to some selection of galeries.*/
+void MyApplication::uploadPicture(QImage* picture, QList<SmfGallery> galleries)
+ {
+ /**
+ * When uploading is finished we can check the success of the uploading
+ */
+ QObject::connect(m_smfcf,SIGNAL(uploadFinished(bool)),SLOT(uploaded(bool)));
+ SmfPicture* smfPic = new SmfPicture(*picture);
+ // The list could be from a selection of galleries chosen by the user,
+ // think multiple TweetDeck accounts?
+ foreach(SmfGallery gallery, galleries)
+ {
+ gallery.upload(smfPic);
+ }
+ }
+
+/**
+ * Slot to catch the uploading finished event
+ */
+void MyApplication::uploaded(bool success)
+ {
+ if(!success)
+ {
+ //error occured while uploading
+ }
+ }
+
+/**
+ * 3. This is an example of displaying the friends profile image in a view from one or more
+ * service provider. Note that this service can be provided by any kind of service provider,
+ * e.g. last.fm music service where users maintain profiles and friends.
+ */
+void MyApplication::displayFriends()
+ {
+ // Some common interface for finding implementations.
+ QList<SmfProvider>* contactFetcherList = client.GetServices("org.symbian.smf.cleint.contact.fetcher\0.2");
+ SmfProvider smfp = contactFetcherList->value(0);
+ SmfContactFetcher* smfcf = new SmfContactFetcher(&smfp);
+
+ //Request friend list, the friendsListAvailable() signal
+ //is emitted with SmfContactList once data is arrived.
+ QObject::connect(smfcf,SIGNAL(friendsListAvailable(SmfContactList*, QString, SmfResultPage )),
+ SLOT(showlist(SmfContactList*)));
+ smfcf->friends();
+
+ m_smfcf = smfcf;
+ }
+
+void MyApplication::showlist(SmfContactList* friendsList)
+ {
+
+ // Adjust our view to show where these pictures came from
+ //display service name description and the logo
+ m_view->setIcon( (m_smfcf->getProvider())->serviceIcon() );
+ m_view->setDescription( (m_smfcf->getProvider())->description() );
+
+ //now display the images
+ foreach(SmfContact contact, *friendsList) {
+ QVariant data = contact.value("Avatar");
+ QImage pic = data.value<QImage>();
+ QContact qc;
+ contact.convert(qc);
+ m_view->add(qc);
+ m_myfrndz.append(contact);
+ }
+ }
+/**
+ * 4. This is an example of posting and reading user updates to social netowrking sites
+ */
+void MyApplication::postUpdate()
+ {
+ // Some common interface for finding implementations.
+ QList<SmfProvider>* postServices = client.GetServices("org.symbian.smf.client.contact.posts\0.2");
+
+ //let us use the first one
+ QString servName = postServices->value(0).serviceName();
+ if(!servName.compare("Facebook.com")) return;
+ SmfProvider smfp = postServices->value(0);
+ SmfPostProvider* myPostServer = new SmfPostProvider(&smfp);
+
+ //Adjust our view to show where these posts came from (e.g. tweets from twitter)
+ //display service name description and the logo
+ m_view->setIcon((myPostServer->getProvider())->serviceIcon() );
+ m_view->setProvider(myPostServer->getProvider());
+ m_view->setDescription((myPostServer->getProvider())->description() );
+
+ SmfPost reply("this is a text post", this);
+ //post my udpate to be visible to all, connect to updatePostFinished()
+ // signal of SmfPostProvider to track the success
+ SmfContact frnd(m_myfrndz.value(0));
+ myPostServer->postDirected(reply,frnd);
+
+ //Asynchronously get all posts to me in my profle (e.g. twits from all friends)
+ //connect to postsAvailable to show the post
+ myPostServer->posts();
+
+ QObject::connect(myPostServer,
+ SIGNAL(postsAvailable(SmfPostList*, QString, SmfResultPage )),
+ SLOT(showPosts(SmfPostList*, QString)));
+ }
+void MyApplication::showPosts(SmfPostList* posts, QString /*err*/)
+ {
+ //Show the first post
+ SmfPost post = posts->at(0);
+ m_view->setDescription( post.toPlainText() );
+ }
+/**
+ * 5. This is an example of getting song recommendations from a social netowrking sites
+ */
+void MyApplication::getMusic(SmfTrackInfo currTrack)
+ {
+ // Some common interface for finding implementations.
+ QList<SmfProvider>* smfProList = client.GetServices("org.symbian.smf.client.music\0.2");
+ SmfProvider smfp = smfProList->value(0);
+ SmfMusicSearch* mServer = new SmfMusicSearch(&smfp);
+
+ QObject::connect(mServer,SIGNAL(trackSearchAvailable(SmfTrackInfoList*, QString,SmfResultPage )),this,SLOT(showTrackSearch(SmfTrackInfoList*)));
+ QObject::connect(mServer,SIGNAL(storeSearchAvailable(SmfProviderList*, QString,SmfResultPage )),this,SLOT(showStoreSearch(SmfProviderList*)));
+ //search songs similar to currently playing,
+ //connect to trackSearchAvailable signal to get the result
+ mServer->recommendations(currTrack);
+ //display to the user
+ m_view->setIcon( mServer->getProvider()->serviceIcon() );
+ m_view->setProvider( mServer->getProvider());
+ m_view->setDescription( mServer->getProvider()->description() );
+
+
+
+ }
+void MyApplication::showTrackSearch(SmfTrackInfoList* songs)
+ {
+ foreach(SmfTrackInfo track, *songs){
+ m_view->add(track);
+ }
+ QList<SmfProvider>* smfProList = client.GetServices("org.symbian.smf.client.music.search\0.2");
+ SmfProvider smfp = smfProList->value(0);
+ SmfMusicSearch* mServer = new SmfMusicSearch(&smfp);
+ //allow user to select a track and get purchase links
+ //connect to showStoreSearch signal to display the stores for that track
+ mServer->stores(songs->value(0));
+ }
+void MyApplication::showStore(SmfProviderList* /*stores*/)
+ {
+ //show stores
+ }
+void MyApplication::updateCurrentPlaying(QList<SmfMusicSearch> musicServices, SmfTrackInfo currTrack)
+ {
+ //after purchasing and downloading is over, user plays the track
+ //now post the current platying track to all service providers
+ //postFinished() signal of SmfMusicSearch can be tracked to check the success of the posts
+ foreach(SmfMusicSearch provider, musicServices) {
+ provider.postCurrentPlaying(currTrack);
+ }
+ //postCurrentPlaying is also a slot funtion, may be application can use connect
+ }
+
+void MyApplication::displayLyrics(SmfTrackInfo currTrack)
+ {
+
+ // Some common interface for finding implementations.
+ QList<SmfProvider>* smfProList = client.GetServices("org.symbian.smf.client.music.lyrics\0.2","lyricsfly.com");
+ SmfProvider smfp = smfProList->value(0);
+ SmfLyricsService* lyricsService = new SmfLyricsService(&smfp);
+ QObject::connect(lyricsService,SIGNAL(lyricsAvailable(SmfLyricsList*, QString, SmfResultPage )),this,SLOT(showLyrics(SmfLyricsList*)));
+
+ //Request to get the lyrics
+ //lyricsAvailable() signal of SmfLyricsService is emitted when lyrics is available
+ lyricsService->lyrics(currTrack);
+
+ }
+void MyApplication::showLyrics(SmfLyricsList* list)
+ {
+ //now display the latest edited lyrics
+ //qSort(list->begin(),list->end(),caseInsensitiveLessThan);
+ m_view->setLyricsData(list->at(0));
+ }
+
+void MyApplication::getActivities()
+ {
+ // Some common interface for finding implementations.
+ QList<SmfProvider>* activityServices = client.GetServices("org.symbian.smf.client.activity.fetcher\0.2");
+
+ //let us use the Facebook one
+ QString servName = activityServices->value(0).serviceName();
+ if(!servName.compare("Facebook.com")) return;
+ SmfProvider smfp = activityServices->value(0);
+ SmfActivityFetcher* myActivityServer = new SmfActivityFetcher(&smfp);
+
+ //Adjust our view to show where these posts came from (e.g. streams from Facebook)
+ //display service name description and the logo
+ m_view->setIcon((myActivityServer->getProvider())->serviceIcon() );
+ m_view->setProvider(myActivityServer->getProvider());
+ m_view->setDescription((myActivityServer->getProvider())->description() );
+
+ QObject::connect(myActivityServer,
+ SIGNAL(resultsAvailable(SmfActivityEntryList*,QString,SmfResultPage)),
+ this,SLOT(showActivities(SmfActivityEntryList*)));
+
+ //get a list of updates to my wall
+ myActivityServer->selfActivities();
+ }
+
+void MyApplication::showActivities(SmfActivityEntryList* entries)
+ {
+ foreach(SmfActivityEntry entry, *entries) {
+ SmfContact sc = entry.author();
+ QString desc = (sc.value("Name")).toString();
+ SmfPost details = entry.details();
+ QList<SmfActivityObject> aol = entry.activities();
+ SmfActivityObject sao = aol.value(0);
+ if(SmfActivityMarkAsFavorite == entry.actionName() )
+ {
+ desc.append(" has marked ");
+ QVariant qv = sao.objData();
+ SmfActivityObjectType otype = sao.type();
+ if((SmfActivityObjTypePhoto == otype ) && (qv.canConvert<SmfPicture>()))
+ {
+ SmfPicture pic = qv.value<SmfPicture>();
+ desc.append( pic.description() );
+ }
+ desc.append(" as Favorite at");
+ QDateTime qdt = sao.time();
+ desc.append(qdt.toString("h:m:s ap"));
+ }
+ }
+ }
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/example/fbpostproviderplugin/ABLD.BAT Tue May 18 17:33:55 2010 +0530
@@ -0,0 +1,15 @@
+@ECHO OFF
+
+REM Bldmake-generated batch file - ABLD.BAT
+REM ** DO NOT EDIT **
+
+perl -S ABLD.PL "\CarbideWorkspace\smfserver_cleaned\example\fbpostproviderplugin\\" %1 %2 %3 %4 %5 %6 %7 %8 %9
+if errorlevel==1 goto CheckPerl
+goto End
+
+:CheckPerl
+perl -v >NUL
+if errorlevel==1 echo Is Perl, version 5.003_07 or later, installed?
+goto End
+
+:End
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/example/fbpostproviderplugin/Makefile Tue May 18 17:33:55 2010 +0530
@@ -0,0 +1,213 @@
+# ==============================================================================
+# Generated by qmake (2.01a) (Qt 4.6.1) on: Tue May 18 16:00:33 2010
+# This file is generated by qmake and should not be modified by the
+# user.
+# Name : Makefile
+# Description : Wrapper Makefile for calling Symbian build tools
+#
+# ==============================================================================
+
+
+MAKEFILE = Makefile
+QMAKE = d:\Qt\4.6.1\bin\qmake
+DEL_FILE = del
+DEL_DIR = rmdir
+MOVE = move
+XCOPY = xcopy /d /f /h /r /y /i
+ABLD = ABLD.BAT
+DEBUG_PLATFORMS = winscw gcce armv5 armv6
+RELEASE_PLATFORMS = gcce armv5 armv6
+MAKE = make
+
+ifeq (WINS,$(findstring WINS, $(PLATFORM)))
+ZDIR=$(EPOCROOT)epoc32\release\$(PLATFORM)\$(CFG)\Z
+else
+ZDIR=$(EPOCROOT)epoc32\data\z
+endif
+
+DEFINES = -DSYMBIAN -DUNICODE -DQT_KEYPAD_NAVIGATION -DQT_SOFTKEYS_ENABLED -DQT_USE_MATH_H_FLOATS -DQT_PLUGIN -DQT_XML_LIB -DQT_GUI_LIB -DQT_NETWORK_LIB -DQT_CORE_LIB
+INCPATH = -I"D:/Qt/4.6.1/include/QtCore" -I"D:/Qt/4.6.1/include/QtCore/tmp" -I"D:/Qt/4.6.1/include/QtNetwork" -I"D:/Qt/4.6.1/include/QtNetwork/tmp" -I"D:/Qt/4.6.1/include/QtGui" -I"D:/Qt/4.6.1/include/QtGui/tmp" -I"D:/Qt/4.6.1/include/QtXml" -I"D:/Qt/4.6.1/include/QtXml/tmp" -I"D:/Qt/4.6.1/include" -I"D:/Qt/4.6.1/include/tmp" -I"D:/CarbideWorkspace/smfserver_cleaned/example/fbpostproviderplugin" -I"D:/CarbideWorkspace/smfserver_cleaned/example/fbpostproviderplugin/tmp" -I"D:/Qt/4.6.1/mkspecs/common/symbian" -I"D:/Qt/4.6.1/mkspecs/common/symbian/tmp" -I"D:/S60/devices/S60_5th_Edition_SDK_v0.9/epoc32/include" -I"D:/S60/devices/S60_5th_Edition_SDK_v0.9/epoc32/include/stdapis" -I"D:/S60/devices/S60_5th_Edition_SDK_v0.9/epoc32/include/stdapis/sys" -I"D:/S60/devices/S60_5th_Edition_SDK_v0.9/epoc32/include/middleware" -I"D:/S60/devices/S60_5th_Edition_SDK_v0.9/epoc32/include/domain/middleware" -I"D:/S60/devices/S60_5th_Edition_SDK_v0.9/epoc32/include/applications" -I"D:/S60/devices/S60_5th_Edition_SDK_v0.9/epoc32/include/domain/applications" -I"D:/S60/devices/S60_5th_Edition_SDK_v0.9/epoc32/include/domain/middleware/loc" -I"D:/S60/devices/S60_5th_Edition_SDK_v0.9/epoc32/include/stdapis/stlport"
+first: default
+default: debug-winscw
+all: debug release
+
+qmake:
+ $(QMAKE) -spec symbian-abld -o "bld.inf" "D:/CarbideWorkspace/smfserver_cleaned/example/fbpostproviderplugin/fbpostproviderplugin.pro"
+
+bld.inf:
+ $(QMAKE)
+
+$(ABLD): bld.inf
+ bldmake bldfiles
+
+debug: $(ABLD)
+ $(ABLD) build winscw udeb
+ $(ABLD) build gcce udeb
+ $(ABLD) build armv5 udeb
+ $(ABLD) build armv6 udeb
+
+release: $(ABLD)
+ $(ABLD) build gcce urel
+ $(ABLD) build armv5 urel
+ $(ABLD) build armv6 urel
+
+debug-winscw: $(ABLD)
+ $(ABLD) build winscw udeb
+debug-gcce: $(ABLD)
+ $(ABLD) build gcce udeb
+debug-armv5: $(ABLD)
+ $(ABLD) build armv5 udeb
+debug-armv6: $(ABLD)
+ $(ABLD) build armv6 udeb
+release-gcce: $(ABLD)
+ $(ABLD) build gcce urel
+release-armv5: $(ABLD)
+ $(ABLD) build armv5 urel
+release-armv6: $(ABLD)
+ $(ABLD) build armv6 urel
+
+export: $(ABLD)
+ $(ABLD) export
+
+cleanexport: $(ABLD)
+ $(ABLD) cleanexport
+
+D:\Qt\4.6.1\bin\moc.exe:
+ (cd $(QTDIR)/src/tools/moc && $(MAKE))
+
+mocclean: compiler_moc_header_clean compiler_moc_source_clean
+
+mocables: compiler_moc_header_make_all compiler_moc_source_make_all
+
+compiler_moc_header_make_all: moc_fbpostproviderplugin.cpp
+compiler_moc_header_clean:
+ -$(DEL_FILE) moc_fbpostproviderplugin.cpp 2> NUL
+moc_fbpostproviderplugin.cpp: fbpostproviderplugin.h \
+ ..\..\..\..\Qt\4.6.1\bin\moc.exe
+ D:\Qt\4.6.1\bin\moc.exe $(DEFINES) $(INCPATH) -DSYMBIAN fbpostproviderplugin.h -o moc_fbpostproviderplugin.cpp
+
+compiler_rcc_make_all:
+compiler_rcc_clean:
+compiler_image_collection_make_all: qmake_image_collection.cpp
+compiler_image_collection_clean:
+ -$(DEL_FILE) qmake_image_collection.cpp 2> NUL
+compiler_moc_source_make_all:
+compiler_moc_source_clean:
+compiler_uic_make_all:
+compiler_uic_clean:
+compiler_yacc_decl_make_all:
+compiler_yacc_decl_clean:
+compiler_yacc_impl_make_all:
+compiler_yacc_impl_clean:
+compiler_lex_make_all:
+compiler_lex_clean:
+compiler_clean: compiler_moc_header_clean
+
+create_temps:
+ -@ if NOT EXIST "D:\Qt\4.6.1\include\QtCore\tmp" mkdir "D:\Qt\4.6.1\include\QtCore\tmp"
+ -@ if NOT EXIST "D:\Qt\4.6.1\include\QtNetwork\tmp" mkdir "D:\Qt\4.6.1\include\QtNetwork\tmp"
+ -@ if NOT EXIST "D:\Qt\4.6.1\include\QtGui\tmp" mkdir "D:\Qt\4.6.1\include\QtGui\tmp"
+ -@ if NOT EXIST "D:\Qt\4.6.1\include\QtXml\tmp" mkdir "D:\Qt\4.6.1\include\QtXml\tmp"
+ -@ if NOT EXIST "D:\Qt\4.6.1\include\tmp" mkdir "D:\Qt\4.6.1\include\tmp"
+ -@ if NOT EXIST "D:\CarbideWorkspace\smfserver_cleaned\example\fbpostproviderplugin\tmp" mkdir "D:\CarbideWorkspace\smfserver_cleaned\example\fbpostproviderplugin\tmp"
+ -@ if NOT EXIST "D:\Qt\4.6.1\mkspecs\common\symbian\tmp" mkdir "D:\Qt\4.6.1\mkspecs\common\symbian\tmp"
+
+extension_clean: compiler_clean
+ -@ if EXIST "D:\Qt\4.6.1\include\QtCore\tmp" rmdir /S /Q "D:\Qt\4.6.1\include\QtCore\tmp"
+ -@ if EXIST "D:\Qt\4.6.1\include\QtNetwork\tmp" rmdir /S /Q "D:\Qt\4.6.1\include\QtNetwork\tmp"
+ -@ if EXIST "D:\Qt\4.6.1\include\QtGui\tmp" rmdir /S /Q "D:\Qt\4.6.1\include\QtGui\tmp"
+ -@ if EXIST "D:\Qt\4.6.1\include\QtXml\tmp" rmdir /S /Q "D:\Qt\4.6.1\include\QtXml\tmp"
+ -@ if EXIST "D:\Qt\4.6.1\include\tmp" rmdir /S /Q "D:\Qt\4.6.1\include\tmp"
+ -@ if EXIST "D:\CarbideWorkspace\smfserver_cleaned\example\fbpostproviderplugin\tmp" rmdir /S /Q "D:\CarbideWorkspace\smfserver_cleaned\example\fbpostproviderplugin\tmp"
+ -@ if EXIST "D:\Qt\4.6.1\mkspecs\common\symbian\tmp" rmdir /S /Q "D:\Qt\4.6.1\mkspecs\common\symbian\tmp"
+
+pre_targetdeps: \
+ generated_sources \
+ all_source_deps
+
+generated_sources: \
+ moc_fbpostproviderplugin.cpp
+
+all_source_deps: \
+ fbpostproviderplugin.h
+
+finalize:
+
+winscw_deployment:
+ -echo Deploying changed files...
+ -$(XCOPY) "d:\CarbideWorkspace\smfserver_cleaned\example\fbpostproviderplugin\qmakepluginstubs\fbpostproviderplugin.qtplugin" "\S60\devices\S60_5th_Edition_SDK_v0.9\epoc32\winscw\c\resource\qt\plugins\smf\plugin\contact.posts\"
+
+winscw_deployment_clean:
+ -@ if EXIST "\S60\devices\S60_5th_Edition_SDK_v0.9\epoc32\winscw\c\resource\qt\plugins\smf\plugin\contact.posts\fbpostproviderplugin.qtplugin" $(DEL_FILE) "\S60\devices\S60_5th_Edition_SDK_v0.9\epoc32\winscw\c\resource\qt\plugins\smf\plugin\contact.posts\fbpostproviderplugin.qtplugin"
+
+sis: restore_build
+ $(if $(wildcard fbpostproviderplugin_template.pkg),$(if $(wildcard .make.cache),$(MAKE) -s -f $(MAKEFILE) ok_sis,$(if $(QT_SIS_TARGET),$(MAKE) -s -f $(MAKEFILE) ok_sis,$(MAKE) -s -f $(MAKEFILE) fail_sis_nocache)),$(MAKE) -s -f $(MAKEFILE) fail_sis_nopkg)
+
+ok_sis:
+ createpackage.bat $(QT_SIS_OPTIONS) fbpostproviderplugin_template.pkg $(QT_SIS_TARGET) $(QT_SIS_CERTIFICATE) $(QT_SIS_KEY) $(QT_SIS_PASSPHRASE)
+
+fail_sis_nopkg:
+ $(error PKG file does not exist, 'SIS' target is only supported for executables or projects with DEPLOYMENT statement)
+
+fail_sis_nocache:
+ $(error Project has to be built or QT_SIS_TARGET environment variable has to be set before calling 'SIS' target)
+
+restore_build:
+-include .make.cache
+
+store_build:
+ @echo # ============================================================================== > .make.cache
+ @echo # This file is generated by make and should not be modified by the user >> .make.cache
+ @echo # Name : .make.cache >> .make.cache
+ @echo # Part of : fbpostproviderplugin >> .make.cache
+ @echo # Description : This file is used to cache last build target for >> .make.cache
+ @echo # make sis target. >> .make.cache
+ @echo # Version : >> .make.cache
+ @echo # >> .make.cache
+ @echo # ============================================================================== >> .make.cache
+ @echo. >> .make.cache
+ @echo QT_SIS_TARGET ?= $(QT_SIS_TARGET) >> .make.cache
+
+dodistclean:
+ -@ if EXIST "d:\CarbideWorkspace\smfserver_cleaned\example\fbpostproviderplugin\fbpostproviderplugin_template.pkg" $(DEL_FILE) "d:\CarbideWorkspace\smfserver_cleaned\example\fbpostproviderplugin\fbpostproviderplugin_template.pkg"
+ -@ if EXIST "d:\CarbideWorkspace\smfserver_cleaned\example\fbpostproviderplugin\qmakepluginstubs\fbpostproviderplugin.qtplugin" $(DEL_FILE) "d:\CarbideWorkspace\smfserver_cleaned\example\fbpostproviderplugin\qmakepluginstubs\fbpostproviderplugin.qtplugin"
+ -@ if EXIST "d:\CarbideWorkspace\smfserver_cleaned\example\fbpostproviderplugin\Makefile" $(DEL_FILE) "d:\CarbideWorkspace\smfserver_cleaned\example\fbpostproviderplugin\Makefile"
+ -@ if EXIST "d:\CarbideWorkspace\smfserver_cleaned\example\fbpostproviderplugin\Makefile_0xEa2c8e07.mk" $(DEL_FILE) "d:\CarbideWorkspace\smfserver_cleaned\example\fbpostproviderplugin\Makefile_0xEa2c8e07.mk"
+ -@ if EXIST "d:\CarbideWorkspace\smfserver_cleaned\example\fbpostproviderplugin\fbpostproviderplugin_0xEa2c8e07.mmp" $(DEL_FILE) "d:\CarbideWorkspace\smfserver_cleaned\example\fbpostproviderplugin\fbpostproviderplugin_0xEa2c8e07.mmp"
+ -@ if EXIST "d:\CarbideWorkspace\smfserver_cleaned\example\fbpostproviderplugin\plugin_commonU.def" $(DEL_FILE) "d:\CarbideWorkspace\smfserver_cleaned\example\fbpostproviderplugin\plugin_commonU.def"
+ -@ if EXIST "d:\CarbideWorkspace\smfserver_cleaned\example\fbpostproviderplugin\.make.cache" $(DEL_FILE) "d:\CarbideWorkspace\smfserver_cleaned\example\fbpostproviderplugin\.make.cache"
+ -@ if EXIST "d:\CarbideWorkspace\smfserver_cleaned\example\fbpostproviderplugin\bld.inf" $(DEL_FILE) "d:\CarbideWorkspace\smfserver_cleaned\example\fbpostproviderplugin\bld.inf"
+ -@ if EXIST "d:\CarbideWorkspace\smfserver_cleaned\example\fbpostproviderplugin\qmakepluginstubs" $(DEL_DIR) "d:\CarbideWorkspace\smfserver_cleaned\example\fbpostproviderplugin\qmakepluginstubs"
+
+distclean: clean dodistclean
+
+clean: $(ABLD)
+ -$(ABLD) reallyclean
+ -bldmake clean
+
+clean-debug: $(ABLD)
+ $(ABLD) reallyclean winscw udeb
+ $(ABLD) reallyclean gcce udeb
+ $(ABLD) reallyclean armv5 udeb
+ $(ABLD) reallyclean armv6 udeb
+
+clean-release: $(ABLD)
+ $(ABLD) reallyclean gcce urel
+ $(ABLD) reallyclean armv5 urel
+ $(ABLD) reallyclean armv6 urel
+
+clean-debug-winscw: $(ABLD)
+ $(ABLD) reallyclean winscw udeb
+clean-debug-gcce: $(ABLD)
+ $(ABLD) reallyclean gcce udeb
+clean-debug-armv5: $(ABLD)
+ $(ABLD) reallyclean armv5 udeb
+clean-debug-armv6: $(ABLD)
+ $(ABLD) reallyclean armv6 udeb
+clean-release-gcce: $(ABLD)
+ $(ABLD) reallyclean gcce urel
+clean-release-armv5: $(ABLD)
+ $(ABLD) reallyclean armv5 urel
+clean-release-armv6: $(ABLD)
+ $(ABLD) reallyclean armv6 urel
+
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/example/fbpostproviderplugin/bld.inf Tue May 18 17:33:55 2010 +0530
@@ -0,0 +1,24 @@
+// ============================================================================
+// * Makefile for building: fbpostproviderplugin
+// * Generated by qmake (2.01a) (Qt 4.6.1) on: 2010-05-18T16:00:33
+// * This file is generated by qmake and should not be modified by the
+// * user.
+// * Project: fbpostproviderplugin.pro
+// * Template: lib
+// ============================================================================
+
+#define BLD_INF_FBPOSTPROVIDERPLUGIN_F46A6C51
+
+
+prj_platforms
+
+WINSCW GCCE ARMV5 ARMV6
+
+
+prj_mmpfiles
+
+gnumakefile Makefile_0xEa2c8e07.mk
+fbpostproviderplugin_0xEa2c8e07.mmp
+
+prj_extensions
+
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/example/fbpostproviderplugin/fbpostproviderplugin.cpp Tue May 18 17:33:55 2010 +0530
@@ -0,0 +1,520 @@
+
+// Include files
+#include <QtPlugin>
+#include <QCryptographicHash>
+#include <QTextFormat>
+#include <QTextStream>
+#include <QFile>
+#include <QNetworkReply>
+#include <QXmlStreamReader>
+
+#include "fbpostproviderplugin.h"
+
+// Added for flickr testing - start - put your registered app's keys here
+static const QString apiKey = "";
+static const QString apiSecret = "";
+static const QString sessionKey = "";
+static const QString sessionSecret = "";
+
+
+/**
+ * Method called by plugins to generate a signature string from a base string
+ * @param aBaseString The base string
+ * @return The md5 hash of the base string
+ */
+QString FBPostProviderPlugin::generateSignature(const QString aBaseString)
+ {
+ writeLog("FBPostProviderPlugin::generateSignature");
+
+ // Create md5 hash of the signature string
+ QByteArray byteArray;
+ byteArray.insert(0, aBaseString.toAscii());
+
+ QByteArray md5Hash = QCryptographicHash::hash(byteArray,QCryptographicHash::Md5 ).toHex();
+ QString returnString (md5Hash);
+ return returnString;
+ }
+
+
+/**
+ * Method called by plugins for logging
+ * @param log string to be logged
+ */
+void FBPostProviderPlugin::writeLog(QString log) const
+ {
+ QFile file("c:\\data\\PluginLogs.txt");
+ if (!file.open(QIODevice::Append | QIODevice::Text))
+ ;
+ QTextStream out(&file);
+ out << log << "\n";
+ file.close();
+ }
+
+/**
+ * Destructor
+ */
+FBPostProviderPlugin::~FBPostProviderPlugin( )
+ {
+ if(m_provider)
+ delete m_provider;
+ }
+
+/**
+ * Method that returns maximum no of chars (unicode) that service
+ * provider can post without truncation. Negative value means
+ * no limit
+ * @return Max characters that can be posted without truncation
+ */
+qint32 FBPostProviderPlugin::maxCharsInPost( ) const
+ {
+ qint32 maxCharsInPost = 256;
+ return maxCharsInPost;
+ }
+/**
+ * Method that returns maximum no of items that can be returned
+ * in a single query to getPosts. Negative value means feature
+ * not supported.
+ * @return Max items that can be returned in a single query
+ */
+qint32 FBPostProviderPlugin::maxItems( ) const
+ {
+ qint32 maxItems = 10;
+ return maxItems;
+ }
+
+/**
+ * <Method that returns all the formatting of posts that this
+ * service provider supports. May return 0 items to mean
+ * only QString is supported.
+ * @return Supported formats of posts
+ */
+QVector<QTextFormat> FBPostProviderPlugin::supportedFormats ( ) const
+ {
+ QVector<QTextFormat> data;
+ return data;
+ }
+
+/**
+ * Method that returns whether this SP supports Appearence
+ * @return Returns true if Appearance is supported, else false.
+ * @see SmfAppearenceInfo
+ */
+bool FBPostProviderPlugin::supportsAppearence ( ) const
+ {
+ return false;
+ }
+
+/**
+ * Method to get the latest posts
+ * @param aRequest [out] The request data to be sent to network
+ * @param aUser The user's contact in this SP, omit for self contact
+ * @param aPageNum The page to be extracted
+ * @param aItemsPerPage Number of items per page
+ * @return SmfPluginError Plugin error if any, else SmfPluginErrNone
+ */
+SmfPluginError FBPostProviderPlugin::retrieve( SmfPluginRequestData &aRequest,
+ const SmfContact *aUser,
+ const int aPageNum ,
+ const int aItemsPerPage )
+ {
+ Q_UNUSED(aUser)
+ writeLog("Inside FBPostProviderPlugin::retrieve");
+
+ SmfPluginError error = SmfPluginErrInvalidRequest;
+
+ //// Currently considering for self contatc , ie, omitting aUser
+ // invalid arguments
+ if( aPageNum < 0 || aItemsPerPage < 0 )
+ return error;
+ else
+ {
+ // Get the current date and time and convert it to sec as a string
+ QString call_id = QString::number(QDateTime::currentDateTime().toTime_t(), 10);
+
+ // Create the API signature string
+ QString baseString;
+ baseString.append("api_key="+apiKey);
+ baseString.append("call_id="+call_id);
+ baseString.append("format=XML");
+ baseString.append("method=stream.get");
+ baseString.append("session_key="+sessionKey);
+ baseString.append("ss=1");
+ baseString.append("v=1.0");
+ baseString.append(sessionSecret);
+
+ // Create the url
+ QUrl url("http://api.facebook.com/restserver.php?");
+ url.addQueryItem("api_key", apiKey);
+ url.addQueryItem("call_id", call_id);
+ url.addQueryItem("format", "XML");
+ url.addQueryItem("method", "stream.get");
+ url.addQueryItem("session_key", sessionKey);
+ url.addQueryItem("ss", "1");
+ url.addQueryItem("v", "1.0");
+ url.addQueryItem("sig", generateSignature(baseString));
+
+ // Create the request, set the url
+ aRequest.iNetworkRequest.setUrl(url);
+ aRequest.iRequestType = SmfContactRetrievePosts;
+ aRequest.iPostData = NULL;
+ aRequest.iHttpOperationType = QNetworkAccessManager::GetOperation;
+ error = SmfPluginErrNone;
+ }
+ writeLog("Url string is : "+aRequest.iNetworkRequest.url().toString());
+ return error;
+ }
+
+/**
+ * Method to update a post to own area.
+ * @param aRequest [out] The request data to be sent to network
+ * @param aPostData The post data to be posted
+ * @param aLocation The location
+ * @return SmfPluginError Plugin error if any, else SmfPluginErrNone
+ */
+SmfPluginError FBPostProviderPlugin::post( SmfPluginRequestData &aRequest,
+ const SmfPost &aPostData,
+ const SmfLocation &aLocation )
+ {
+ Q_UNUSED(aRequest)
+Q_UNUSED(aPostData)
+Q_UNUSED(aLocation)
+ SmfPluginError error = SmfPluginErrInvalidRequest;
+ return error;
+ }
+
+/**
+ * Method to update the last post to own area with new data
+ * @param aRequest [out] The request data to be sent to network
+ * @param aPostData The edited/new data to be posted
+ * @return SmfPluginError Plugin error if any, else SmfPluginErrNone
+ */
+SmfPluginError FBPostProviderPlugin::updatePost( SmfPluginRequestData &aRequest,
+ const SmfPost &aPostData )
+ {
+ Q_UNUSED(aRequest)
+Q_UNUSED(aPostData)
+ SmfPluginError error = SmfPluginErrInvalidRequest;
+ return error;
+ }
+
+/**
+ * Method to update a post to a particular contact
+ * @param aRequest [out] The request data to be sent to network
+ * @param aPostData The post data to be posted
+ * @param aContact The contact where the data has to be posted
+ * @param aLocation The location
+ * @return SmfPluginError Plugin error if any, else SmfPluginErrNone
+ */
+SmfPluginError FBPostProviderPlugin::postDirected( SmfPluginRequestData &aRequest,
+ const SmfPost &aPostData,
+ const SmfContact &aContact,
+ const SmfLocation *aLocation )
+ {
+ Q_UNUSED(aRequest)
+Q_UNUSED(aPostData)
+Q_UNUSED(aContact)
+Q_UNUSED(aLocation)
+ SmfPluginError error = SmfPluginErrInvalidRequest;
+ return error;
+ }
+
+
+/**
+ * Method to post a comment on a post.
+ * @param aRequest [out] The request data to be sent to network
+ * @param aTarget Post on which comment has to be posted
+ * @param aComment comment to be posted
+ * @param aLocation location data
+ */
+SmfPluginError FBPostProviderPlugin::commentOnAPost(SmfPluginRequestData &aRequest,
+ const SmfPost &aTarget,
+ const SmfPost &aComment,
+ const SmfLocation *aLocation )
+ {
+ Q_UNUSED(aRequest)
+Q_UNUSED(aTarget)
+Q_UNUSED(aComment)
+Q_UNUSED(aLocation)
+ SmfPluginError error = SmfPluginErrInvalidRequest;
+ return error;
+ }
+
+/**
+ * Method to update the presence information of the user
+ * @param aRequest [out] The request data to be sent to network
+ * @param aAppearence The appearence information
+ * @param aStatus The status string
+ * @return SmfPluginError Plugin error if any, else SmfPluginErrNone
+ */
+SmfPluginError FBPostProviderPlugin::postAppearence( SmfPluginRequestData &aRequest,
+ const SmfPresenceInfo &aAppearence,
+ const QString &aStatus )
+ {
+ Q_UNUSED(aRequest)
+Q_UNUSED(aAppearence)
+Q_UNUSED(aStatus)
+ SmfPluginError error = SmfPluginErrInvalidRequest;
+ return error;
+ }
+
+/**
+ * Share a contact's post to user's friends and followers
+ * (e.g. retweet in twitter, share on facebook)
+ * @param aRequest [out] The request data to be sent to network
+ * @param aPostData data to be posted
+ * @param aContact contact to which the post belonged
+ * @param aEdited whether user changed items within the post
+ * @return SmfPluginError Plugin error if any, else SmfPluginErrNone
+ */
+SmfPluginError FBPostProviderPlugin::sharePost( SmfPluginRequestData &aRequest,
+ const SmfPost &aPostData,
+ const SmfContact &aContact,
+ const bool &aEdited)
+ {
+ Q_UNUSED(aRequest)
+Q_UNUSED(aPostData)
+Q_UNUSED(aContact)
+Q_UNUSED(aEdited)
+ SmfPluginError error = SmfPluginErrInvalidRequest;
+ return error;
+ }
+
+/**
+ * Customised method for SmfPostProviderPlugin interface
+ * @param aRequest [out] The request data to be sent to network
+ * @param aOperation The operation type (should be known between
+ * the client interface and the plugin)
+ * @param aData The data required to form the request (The type
+ * of data should be known between client and the plugin)
+ * @return SmfPluginError Plugin error if any, else SmfPluginErrNone
+ */
+SmfPluginError FBPostProviderPlugin::customRequest( SmfPluginRequestData &aRequest,
+ const int &aOperation, QByteArray *aData )
+ {
+ Q_UNUSED(aRequest)
+Q_UNUSED(aOperation)
+Q_UNUSED(aData)
+ SmfPluginError error = SmfPluginErrInvalidRequest;
+ return error;
+ }
+
+
+/**
+ * The first method to be called in the plugin that implements this interface.
+ * If this method is not called, plugin may not behave as expected.
+ * Plugins are expected to save the aUtil handle and use and when required.
+ * @param aUtil The instance of SmfPluginUtil
+ */
+void FBPostProviderPlugin::initialize( SmfPluginUtil *aUtil )
+ {
+ // Save the SmfPluginUtil handle
+ m_util = aUtil;
+
+ // Create an instance of FlickrProviderBase
+ m_provider = new FBProviderBase;
+ m_provider->initialize();
+ }
+
+/**
+ * Method to get the provider information
+ * @return Instance of SmfProviderBase
+ */
+SmfProviderBase* FBPostProviderPlugin::getProviderInfo( )
+ {
+ return m_provider;
+ }
+
+/**
+ * Method to get the result for a network request.
+ * @param aTransportResult The result of transport operation
+ * @param aResponse The QByteArray instance containing the network response.
+ * The plugins should delete this instance once they have read the
+ * data from it.
+ * @param aResult [out] An output parameter to the plugin manager.If the
+ * return value is SmfSendRequestAgain, QVariant will be of type
+ * SmfPluginRequestData.
+ * For SmfPostProviderPlugin: If last operation was retrieve(), aResult will be
+ * of type QList<SmfPost>. If last operation was post() or updatePost() or
+ * postDirected() or commentOnAPost() or postAppearence() or sharePost(),
+ * aResult will be of type bool
+ * @param aRetType [out] SmfPluginRetType
+ * @param aPageResult [out] The SmfResultPage structure variable
+ */
+SmfPluginError FBPostProviderPlugin::responseAvailable(
+ const SmfTransportResult &aTransportResult,
+ QByteArray *aResponse,
+ QVariant* aResult,
+ SmfPluginRetType &aRetType,
+ SmfResultPage &aPageResult )
+ {
+ writeLog("FBPostProviderPlugin::::responseAvailable");
+ Q_UNUSED(aPageResult)
+ //This API is slightly changed by Manasij
+ SmfPluginError error;
+ if(SmfTransportOpNoError == aTransportResult)
+ {
+ writeLog("No transport error");
+
+ // Write the response to a file
+ QFile file("c:\\data\\fbresponse.txt");
+ writeLog("response data written to c:\\data\\fbresponse.txt");
+ if (!file.open(QIODevice::Append | QIODevice::Text))
+ ;
+ file.write(aResponse->data());
+ file.close();
+
+ QList<SmfPost> list;
+
+ // For getting contacts
+ QXmlStreamReader xml(aResponse->data());
+ while (!xml.atEnd())
+ {
+ xml.readNext();
+ if (xml.tokenType() == QXmlStreamReader::StartElement)
+ {
+ // If the tag is contact
+ if (xml.name() == "message")
+ {
+ writeLog("message tag found");
+
+ SmfPost post;
+ QString descStr(xml.readElementText());
+ post.setDescription(descStr);
+
+ list.append(post);
+ }
+ }
+ }
+
+ aResult->setValue(list);
+ aRetType = SmfRequestComplete;
+ error = SmfPluginErrNone;
+ }
+
+ else
+ {
+ error = SmfPluginErrInvalidRequest;
+ aRetType = SmfRequestError;
+ }
+ delete aResponse;
+ return error;
+ }
+
+
+/**
+ * Destructor
+ */
+FBProviderBase::~FBProviderBase( )
+ {
+ }
+
+/**
+ * Method to get the Localisable name of the service.
+ * @return The Localisable name of the service.
+ */
+QString FBProviderBase::serviceName( ) const
+ {
+ return m_serviceName;
+ }
+
+/**
+ * Method to get the Logo of the service
+ * @return The Logo of the service
+ */
+QImage FBProviderBase::serviceIcon( ) const
+ {
+ return m_serviceIcon;
+ }
+
+/**
+ * Method to get the Readable service description
+ * @return The Readable service description
+ */
+QString FBProviderBase::description( ) const
+ {
+ return m_description;
+ }
+
+/**
+ * Method to get the Website of the service
+ * @return The Website of the service
+ */
+QUrl FBProviderBase::serviceUrl( ) const
+ {
+ return m_serviceUrl;
+ }
+
+/**
+ * Method to get the URL of the Application providing this service
+ * @return The URL of the Application providing this service
+ */
+QUrl FBProviderBase::applicationUrl( ) const
+ {
+ return m_applicationUrl;
+ }
+
+/**
+ * Method to get the Icon of the application
+ * @return The Icon of the application
+ */
+QImage FBProviderBase::applicationIcon( ) const
+ {
+ return m_applicationIcon;
+ }
+
+/**
+ * Method to get the Plugin specific ID
+ * @return The Plugin specific ID
+ */
+QString FBProviderBase::pluginId( ) const
+ {
+ return m_pluginId;
+ }
+
+/**
+ * Method to get the ID of the authentication application
+ * for this service
+ * @param aProgram The authentication application name
+ * @param aArguments List of arguments required for authentication app
+ * @param aMode Strting mode for authentication application
+ * @return The ID of the authentication application
+ */
+QString FBProviderBase::authenticationApp( QString &aProgram,
+ QStringList & aArguments,
+ QIODevice::OpenModeFlag aMode ) const
+ {
+ Q_UNUSED(aProgram)
+Q_UNUSED(aArguments)
+Q_UNUSED(aMode)
+ return m_authAppId;
+ }
+
+/**
+ * Method to get the unique registration ID provided by the
+ * Smf for authorised plugins
+ * @return The unique registration ID/token provided by the Smf for
+ * authorised plugins
+ */
+QString FBProviderBase::smfRegistrationId( ) const
+ {
+ return m_smfRegToken;
+ }
+
+void FBProviderBase::initialize()
+ {
+ m_serviceName = "Facebook";
+ m_description = "Facebook plugin description";
+ m_serviceUrl = QUrl(QString("http://api.facebook.com"));
+ m_pluginId = "fbpostproviderplugin.qtplugin";
+ m_authAppId = "Facebook AuthAppId";
+ m_smfRegToken = "Facebook RegToken";
+ }
+
+
+/*
+ * Export Macro
+ * plugin name : fbpostproviderplugin
+ * plugin class : FBPostProviderPlugin
+ */
+Q_EXPORT_PLUGIN2( fbpostproviderplugin, FBPostProviderPlugin )
+
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/example/fbpostproviderplugin/fbpostproviderplugin.h Tue May 18 17:33:55 2010 +0530
@@ -0,0 +1,293 @@
+#ifndef _FBPOSTPROVIDERPLUGIN_H
+#define _FBPOSTPROVIDERPLUGIN_H
+
+// Include files
+#include <smfpostproviderplugin.h>
+#include <smfpluginutil.h>
+
+// Forward declarations
+class FBProviderBase;
+class QVariant;
+class QNetworkReply;
+
+// Class declaration
+class FBPostProviderPlugin : public QObject, public SmfPostProviderPlugin
+{
+ Q_OBJECT
+ Q_INTERFACES( SmfPostProviderPlugin SmfPluginBase )
+
+public:
+ virtual ~FBPostProviderPlugin( );
+
+public: // From SmfPostProviderPlugin
+
+ /**
+ * Method that returns maximum no of chars (unicode) that service
+ * provider can post without truncation. Negative value means
+ * no limit
+ * @return Max characters that can be posted without truncation
+ */
+ qint32 maxCharsInPost( ) const;
+
+ /**
+ * Method that returns maximum no of items that can be returned
+ * in a single query to getPosts. Negative value means feature
+ * not supported.
+ * @return Max items that can be returned in a single query
+ */
+ qint32 maxItems( ) const;
+
+ /**
+ * <Method that returns all the formatting of posts that this
+ * service provider supports. May return 0 items to mean
+ * only QString is supported.
+ * @return Supported formats of posts
+ */
+ QVector<QTextFormat> supportedFormats ( ) const;
+
+ /**
+ * Method that returns whether this SP supports Appearence
+ * @return Returns true if Appearance is supported, else false.
+ * @see SmfAppearenceInfo
+ */
+ bool supportsAppearence ( ) const;
+
+ /**
+ * Method to get the latest posts
+ * @param aRequest [out] The request data to be sent to network
+ * @param aUser The user's contact in this SP, omit for self contact
+ * @param aPageNum The page to be extracted
+ * @param aItemsPerPage Number of items per page
+ * @return SmfPluginError Plugin error if any, else SmfPluginErrNone
+ */
+ SmfPluginError retrieve( SmfPluginRequestData &aRequest,
+ const SmfContact *aUser=0,
+ const int aPageNum = SMF_FIRST_PAGE,
+ const int aItemsPerPage = SMF_ITEMS_PER_PAGE );
+
+
+ /**
+ * Method to update a post to own area.
+ * @param aRequest [out] The request data to be sent to network
+ * @param aPostData The post data to be posted
+ * @param aLocation The location
+ * @return SmfPluginError Plugin error if any, else SmfPluginErrNone
+ */
+ SmfPluginError post( SmfPluginRequestData &aRequest,
+ const SmfPost &aPostData,
+ const SmfLocation &aLocation );
+
+ /**
+ * Method to update the last post to own area with new data
+ * @param aRequest [out] The request data to be sent to network
+ * @param aPostData The edited/new data to be posted
+ * @return SmfPluginError Plugin error if any, else SmfPluginErrNone
+ */
+ SmfPluginError updatePost( SmfPluginRequestData &aRequest,
+ const SmfPost &aPostData );
+
+ /**
+ * Method to update a post to a particular contact
+ * @param aRequest [out] The request data to be sent to network
+ * @param aPostData The post data to be posted
+ * @param aContact The contact where the data has to be posted
+ * @param aLocation The location
+ * @return SmfPluginError Plugin error if any, else SmfPluginErrNone
+ */
+ SmfPluginError postDirected( SmfPluginRequestData &aRequest,
+ const SmfPost &aPostData,
+ const SmfContact &aContact,
+ const SmfLocation *aLocation = NULL );
+
+
+ /**
+ * Method to post a comment on a post.
+ * @param aRequest [out] The request data to be sent to network
+ * @param aTarget Post on which comment has to be posted
+ * @param aComment comment to be posted
+ * @param aLocation location data
+ */
+ SmfPluginError commentOnAPost(SmfPluginRequestData &aRequest,
+ const SmfPost &aTarget,
+ const SmfPost &aComment,
+ const SmfLocation *aLocation = NULL);
+
+ /**
+ * Method to update the presence information of the user
+ * @param aRequest [out] The request data to be sent to network
+ * @param aAppearence The appearence information
+ * @param aStatus The status string
+ * @return SmfPluginError Plugin error if any, else SmfPluginErrNone
+ */
+ SmfPluginError postAppearence( SmfPluginRequestData &aRequest,
+ const SmfPresenceInfo &aAppearence,
+ const QString &aStatus );
+
+ /**
+ * Share /a contact's post to user's friends and followers
+ * (e.g. retweet in twitter, share on facebook)
+ * @param aRequest [out] The request data to be sent to network
+ * @param aPostData data to be posted
+ * @param aContact contact to which the post belonged
+ * @param aEdited whether user changed items within the post
+ * @return SmfPluginError Plugin error if any, else SmfPluginErrNone
+ */
+ SmfPluginError sharePost( SmfPluginRequestData &aRequest,
+ const SmfPost &aPostData,
+ const SmfContact &aContact,
+ const bool &aEdited);
+
+ /**
+ * Customised method for SmfPostProviderPlugin interface
+ * @param aRequest [out] The request data to be sent to network
+ * @param aOperation The operation type (should be known between
+ * the client interface and the plugin)
+ * @param aData The data required to form the request (The type
+ * of data should be known between client and the plugin)
+ * @return SmfPluginError Plugin error if any, else SmfPluginErrNone
+ */
+ SmfPluginError customRequest( SmfPluginRequestData &aRequest,
+ const int &aOperation, QByteArray *aData );
+
+public: // From SmfPluginBase
+ /**
+ * The first method to be called in the plugin that implements this interface.
+ * If this method is not called, plugin may not behave as expected.
+ * Plugins are expected to save the aUtil handle and use and when required.
+ * @param aUtil The instance of SmfPluginUtil
+ */
+ void initialize( SmfPluginUtil *aUtil );
+
+ /**
+ * Method to get the provider information
+ * @return Instance of SmfProviderBase
+ */
+ SmfProviderBase* getProviderInfo( );
+
+ /**
+ * Method to get the result for a network request.
+ * @param aTransportResult The result of transport operation
+ * @param aResponse The QByteArray instance containing the network response.
+ * The plugins should delete this instance once they have read the
+ * data from it.
+ * @param aResult [out] An output parameter to the plugin manager.If the
+ * return value is SmfSendRequestAgain, QVariant will be of type
+ * SmfPluginRequestData.
+ * For SmfPostProviderPlugin: If last operation was retrieve(), aResult will be
+ * of type QList<SmfPost>. If last operation was post() or updatePost() or
+ * postDirected() or commentOnAPost() or postAppearence() or sharePost(),
+ * aResult will be of type bool
+ * @param aRetType [out] SmfPluginRetType
+ * @param aPageResult [out] The SmfResultPage structure variable
+ */
+ SmfPluginError responseAvailable(
+ const SmfTransportResult &aTransportResult,
+ QByteArray *aResponse,
+ QVariant* aResult,
+ SmfPluginRetType &aRetType,
+ SmfResultPage &aPageResult );
+
+private:
+ /**
+ * Method called by plugins to generate a signature string from a base string
+ * @param aBaseString The base string
+ * @return The md5 hash of the base string
+ */
+ QString generateSignature(const QString aBaseString);
+
+ /**
+ * Method called by plugins for logging
+ * @param log string to be logged
+ */
+ void writeLog(QString log) const;
+
+private:
+ FBProviderBase *m_provider;
+ SmfPluginUtil *m_util;
+};
+
+// Class declaration
+class FBProviderBase : public QObject, public SmfProviderBase
+ {
+ Q_OBJECT
+ Q_INTERFACES( SmfProviderBase )
+
+public:
+ virtual ~FBProviderBase( );
+
+ /**
+ * Method to get the Localisable name of the service.
+ * @return The Localisable name of the service.
+ */
+ QString serviceName( ) const;
+
+ /**
+ * Method to get the Logo of the service
+ * @return The Logo of the service
+ */
+ QImage serviceIcon( ) const;
+
+ /**
+ * Method to get the Readable service description
+ * @return The Readable service description
+ */
+ QString description( ) const;
+
+ /**
+ * Method to get the Website of the service
+ * @return The Website of the service
+ */
+ QUrl serviceUrl( ) const;
+
+ /**
+ * Method to get the URL of the Application providing this service
+ * @return The URL of the Application providing this service
+ */
+ QUrl applicationUrl( ) const;
+
+ /**
+ * Method to get the Icon of the application
+ * @return The Icon of the application
+ */
+ QImage applicationIcon( ) const;
+
+ /**
+ * Method to get the Plugin specific ID
+ * @return The Plugin specific ID
+ */
+ QString pluginId( ) const;
+
+ /**
+ * Method to get the ID of the authentication application
+ * for this service
+ * @param aProgram The authentication application name
+ * @param aArguments List of arguments required for authentication app
+ * @param aMode Strting mode for authentication application
+ * @return The ID of the authentication application
+ */
+ QString authenticationApp( QString &aProgram, QStringList & aArguments,
+ QIODevice::OpenModeFlag aMode = QIODevice::ReadWrite ) const;
+
+ /**
+ * Method to get the unique registration ID provided by the
+ * Smf for authorised plugins
+ * @return The unique registration ID/token provided by the Smf for
+ * authorised plugins
+ */
+ QString smfRegistrationId( ) const;
+
+private:
+ friend class FBPostProviderPlugin;
+ void initialize();
+ QString m_serviceName;
+ QImage m_serviceIcon;
+ QString m_description;
+ QUrl m_serviceUrl;
+ QUrl m_applicationUrl;
+ QImage m_applicationIcon;
+ QString m_pluginId;
+ QString m_authAppId;
+ QString m_smfRegToken;
+ };
+
+#endif /*_FBPOSTPROVIDERPLUGIN_H*/
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/example/fbpostproviderplugin/fbpostproviderplugin.pro Tue May 18 17:33:55 2010 +0530
@@ -0,0 +1,42 @@
+TEMPLATE = lib
+
+CONFIG += plugin \
+ mobility
+
+MOBILITY += contacts \
+ location
+
+QT += core \
+ xml \
+ network
+
+HEADERS = fbpostproviderplugin.h
+
+SOURCES = fbpostproviderplugin.cpp
+
+TARGET = $$qtLibraryTarget(fbpostproviderplugin)
+
+symbian: {
+ # Load predefined include paths (e.g. QT_PLUGINS_BASE_DIR) to be used in the pro-files
+ load(data_caging_paths)
+
+ # EPOCALLOWDLLDATA have to set true because Qt macros has initialised global data
+ TARGET.EPOCALLOWDLLDATA = 1
+
+ # Defines plugin files into Symbian .pkg package
+ pluginDep.sources = fbpostproviderplugin.dll
+ pluginDep.path = $$QT_PLUGINS_BASE_DIR/smf/plugin/contact.posts
+ DEPLOYMENT += pluginDep
+
+ TARGET.CAPABILITY = ReadUserData \
+ WriteUserData \
+ LocalServices \
+ NetworkServices \
+ UserEnvironment
+
+ LIBS += -lsmfclient.dll
+}
+
+target.path += $$[QT_INSTALL_PLUGINS]/smf/plugin/contact.posts
+
+INSTALLS += target
\ No newline at end of file
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/example/fbpostproviderplugin/fbpostproviderplugin_template.pkg Tue May 18 17:33:55 2010 +0530
@@ -0,0 +1,33 @@
+; fbpostproviderplugin_template.pkg generated by qmake at 2010-05-18T16:00:33
+; This file is generated by qmake and should not be modified by the user
+;
+
+; Language
+&EN
+
+; SIS header: name, uid, version
+#{"fbpostproviderplugin"},(0xEa2c8e07),1,0,0
+
+; Localised Vendor name
+%{"Vendor"}
+
+; Unique Vendor name
+:"Vendor"
+
+; Manual PKG pre-rules from PRO files
+; Default HW/platform dependencies
+[0x101F7961],0,0,0,{"S60ProductID"}
+[0x102032BE],0,0,0,{"S60ProductID"}
+[0x102752AE],0,0,0,{"S60ProductID"}
+[0x1028315F],0,0,0,{"S60ProductID"}
+
+; Default dependency to Qt libraries
+(0x2001E61C), 4, 6, 1, {"Qt"}
+; Default dependency to QtMobility libraries
+(0x2002AC89), 0, 2, 0, {"QtMobility"}
+
+; DEPLOYMENT
+"d:/S60/devices/S60_5th_Edition_SDK_v0.9/epoc32/release/$(PLATFORM)/$(TARGET)/fbpostproviderplugin.dll" - "!:\sys\bin\fbpostproviderplugin.dll"
+"d:/CarbideWorkspace/smfserver_cleaned/example/fbpostproviderplugin/qmakepluginstubs/fbpostproviderplugin.qtplugin" - "!:\resource\qt\plugins\smf\plugin\contact.posts\fbpostproviderplugin.qtplugin"
+
+; Manual PKG post-rules from PRO files
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/example/fbpostproviderplugin/plugin_commonU.def Tue May 18 17:33:55 2010 +0530
@@ -0,0 +1,16 @@
+; ==============================================================================
+; Generated by qmake (2.01a) (Qt 4.6.1) on: 2010-05-18T16:00:33
+; This file is generated by qmake and should not be modified by the
+; user.
+; Name : plugin_commonU.def
+; Part of : fbpostproviderplugin
+; Description : Fixes common plugin symbols to known ordinals
+; Version :
+;
+; ==============================================================================
+
+
+EXPORTS
+ qt_plugin_query_verification_data @ 1 NONAME
+ qt_plugin_instance @ 2 NONAME
+
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/example/fbpostproviderplugin/qmakepluginstubs/fbpostproviderplugin.qtplugin Tue May 18 17:33:55 2010 +0530
@@ -0,0 +1,1 @@
+This file is a Qt plugin stub file. The real Qt plugin is located in \sys\bin. Created:2010-05-18T16:00:33
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/example/flickrcontactfetcherplugin/ABLD.BAT Tue May 18 17:33:55 2010 +0530
@@ -0,0 +1,15 @@
+@ECHO OFF
+
+REM Bldmake-generated batch file - ABLD.BAT
+REM ** DO NOT EDIT **
+
+perl -S ABLD.PL "\CarbideWorkspace\smfserver_cleaned\example\flickrcontactfetcherplugin\\" %1 %2 %3 %4 %5 %6 %7 %8 %9
+if errorlevel==1 goto CheckPerl
+goto End
+
+:CheckPerl
+perl -v >NUL
+if errorlevel==1 echo Is Perl, version 5.003_07 or later, installed?
+goto End
+
+:End
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/example/flickrcontactfetcherplugin/Makefile Tue May 18 17:33:55 2010 +0530
@@ -0,0 +1,213 @@
+# ==============================================================================
+# Generated by qmake (2.01a) (Qt 4.6.1) on: Tue May 18 16:01:40 2010
+# This file is generated by qmake and should not be modified by the
+# user.
+# Name : Makefile
+# Description : Wrapper Makefile for calling Symbian build tools
+#
+# ==============================================================================
+
+
+MAKEFILE = Makefile
+QMAKE = d:\Qt\4.6.1\bin\qmake
+DEL_FILE = del
+DEL_DIR = rmdir
+MOVE = move
+XCOPY = xcopy /d /f /h /r /y /i
+ABLD = ABLD.BAT
+DEBUG_PLATFORMS = winscw gcce armv5 armv6
+RELEASE_PLATFORMS = gcce armv5 armv6
+MAKE = make
+
+ifeq (WINS,$(findstring WINS, $(PLATFORM)))
+ZDIR=$(EPOCROOT)epoc32\release\$(PLATFORM)\$(CFG)\Z
+else
+ZDIR=$(EPOCROOT)epoc32\data\z
+endif
+
+DEFINES = -DSYMBIAN -DUNICODE -DQT_KEYPAD_NAVIGATION -DQT_SOFTKEYS_ENABLED -DQT_USE_MATH_H_FLOATS -DQT_PLUGIN -DQT_XML_LIB -DQT_GUI_LIB -DQT_NETWORK_LIB -DQT_CORE_LIB
+INCPATH = -I"D:/Qt/4.6.1/include/QtCore" -I"D:/Qt/4.6.1/include/QtCore/tmp" -I"D:/Qt/4.6.1/include/QtNetwork" -I"D:/Qt/4.6.1/include/QtNetwork/tmp" -I"D:/Qt/4.6.1/include/QtGui" -I"D:/Qt/4.6.1/include/QtGui/tmp" -I"D:/Qt/4.6.1/include/QtXml" -I"D:/Qt/4.6.1/include/QtXml/tmp" -I"D:/Qt/4.6.1/include" -I"D:/Qt/4.6.1/include/tmp" -I"D:/CarbideWorkspace/smfserver_cleaned/example/flickrcontactfetcherplugin" -I"D:/CarbideWorkspace/smfserver_cleaned/example/flickrcontactfetcherplugin/tmp" -I"D:/Qt/4.6.1/mkspecs/common/symbian" -I"D:/Qt/4.6.1/mkspecs/common/symbian/tmp" -I"D:/S60/devices/S60_5th_Edition_SDK_v0.9/epoc32/include" -I"D:/S60/devices/S60_5th_Edition_SDK_v0.9/epoc32/include/stdapis" -I"D:/S60/devices/S60_5th_Edition_SDK_v0.9/epoc32/include/stdapis/sys" -I"D:/S60/devices/S60_5th_Edition_SDK_v0.9/epoc32/include/middleware" -I"D:/S60/devices/S60_5th_Edition_SDK_v0.9/epoc32/include/domain/middleware" -I"D:/S60/devices/S60_5th_Edition_SDK_v0.9/epoc32/include/applications" -I"D:/S60/devices/S60_5th_Edition_SDK_v0.9/epoc32/include/domain/applications" -I"D:/S60/devices/S60_5th_Edition_SDK_v0.9/epoc32/include/domain/middleware/loc" -I"D:/S60/devices/S60_5th_Edition_SDK_v0.9/epoc32/include/stdapis/stlport"
+first: default
+default: debug-winscw
+all: debug release
+
+qmake:
+ $(QMAKE) -spec symbian-abld -o "bld.inf" "D:/CarbideWorkspace/smfserver_cleaned/example/flickrcontactfetcherplugin/flickrcontactfetcherplugin.pro"
+
+bld.inf:
+ $(QMAKE)
+
+$(ABLD): bld.inf
+ bldmake bldfiles
+
+debug: $(ABLD)
+ $(ABLD) build winscw udeb
+ $(ABLD) build gcce udeb
+ $(ABLD) build armv5 udeb
+ $(ABLD) build armv6 udeb
+
+release: $(ABLD)
+ $(ABLD) build gcce urel
+ $(ABLD) build armv5 urel
+ $(ABLD) build armv6 urel
+
+debug-winscw: $(ABLD)
+ $(ABLD) build winscw udeb
+debug-gcce: $(ABLD)
+ $(ABLD) build gcce udeb
+debug-armv5: $(ABLD)
+ $(ABLD) build armv5 udeb
+debug-armv6: $(ABLD)
+ $(ABLD) build armv6 udeb
+release-gcce: $(ABLD)
+ $(ABLD) build gcce urel
+release-armv5: $(ABLD)
+ $(ABLD) build armv5 urel
+release-armv6: $(ABLD)
+ $(ABLD) build armv6 urel
+
+export: $(ABLD)
+ $(ABLD) export
+
+cleanexport: $(ABLD)
+ $(ABLD) cleanexport
+
+D:\Qt\4.6.1\bin\moc.exe:
+ (cd $(QTDIR)/src/tools/moc && $(MAKE))
+
+mocclean: compiler_moc_header_clean compiler_moc_source_clean
+
+mocables: compiler_moc_header_make_all compiler_moc_source_make_all
+
+compiler_moc_header_make_all: moc_flickrcontactfetcherplugin.cpp
+compiler_moc_header_clean:
+ -$(DEL_FILE) moc_flickrcontactfetcherplugin.cpp 2> NUL
+moc_flickrcontactfetcherplugin.cpp: flickrcontactfetcherplugin.h \
+ ..\..\..\..\Qt\4.6.1\bin\moc.exe
+ D:\Qt\4.6.1\bin\moc.exe $(DEFINES) $(INCPATH) -DSYMBIAN flickrcontactfetcherplugin.h -o moc_flickrcontactfetcherplugin.cpp
+
+compiler_rcc_make_all:
+compiler_rcc_clean:
+compiler_image_collection_make_all: qmake_image_collection.cpp
+compiler_image_collection_clean:
+ -$(DEL_FILE) qmake_image_collection.cpp 2> NUL
+compiler_moc_source_make_all:
+compiler_moc_source_clean:
+compiler_uic_make_all:
+compiler_uic_clean:
+compiler_yacc_decl_make_all:
+compiler_yacc_decl_clean:
+compiler_yacc_impl_make_all:
+compiler_yacc_impl_clean:
+compiler_lex_make_all:
+compiler_lex_clean:
+compiler_clean: compiler_moc_header_clean
+
+create_temps:
+ -@ if NOT EXIST "D:\Qt\4.6.1\include\QtCore\tmp" mkdir "D:\Qt\4.6.1\include\QtCore\tmp"
+ -@ if NOT EXIST "D:\Qt\4.6.1\include\QtNetwork\tmp" mkdir "D:\Qt\4.6.1\include\QtNetwork\tmp"
+ -@ if NOT EXIST "D:\Qt\4.6.1\include\QtGui\tmp" mkdir "D:\Qt\4.6.1\include\QtGui\tmp"
+ -@ if NOT EXIST "D:\Qt\4.6.1\include\QtXml\tmp" mkdir "D:\Qt\4.6.1\include\QtXml\tmp"
+ -@ if NOT EXIST "D:\Qt\4.6.1\include\tmp" mkdir "D:\Qt\4.6.1\include\tmp"
+ -@ if NOT EXIST "D:\CarbideWorkspace\smfserver_cleaned\example\flickrcontactfetcherplugin\tmp" mkdir "D:\CarbideWorkspace\smfserver_cleaned\example\flickrcontactfetcherplugin\tmp"
+ -@ if NOT EXIST "D:\Qt\4.6.1\mkspecs\common\symbian\tmp" mkdir "D:\Qt\4.6.1\mkspecs\common\symbian\tmp"
+
+extension_clean: compiler_clean
+ -@ if EXIST "D:\Qt\4.6.1\include\QtCore\tmp" rmdir /S /Q "D:\Qt\4.6.1\include\QtCore\tmp"
+ -@ if EXIST "D:\Qt\4.6.1\include\QtNetwork\tmp" rmdir /S /Q "D:\Qt\4.6.1\include\QtNetwork\tmp"
+ -@ if EXIST "D:\Qt\4.6.1\include\QtGui\tmp" rmdir /S /Q "D:\Qt\4.6.1\include\QtGui\tmp"
+ -@ if EXIST "D:\Qt\4.6.1\include\QtXml\tmp" rmdir /S /Q "D:\Qt\4.6.1\include\QtXml\tmp"
+ -@ if EXIST "D:\Qt\4.6.1\include\tmp" rmdir /S /Q "D:\Qt\4.6.1\include\tmp"
+ -@ if EXIST "D:\CarbideWorkspace\smfserver_cleaned\example\flickrcontactfetcherplugin\tmp" rmdir /S /Q "D:\CarbideWorkspace\smfserver_cleaned\example\flickrcontactfetcherplugin\tmp"
+ -@ if EXIST "D:\Qt\4.6.1\mkspecs\common\symbian\tmp" rmdir /S /Q "D:\Qt\4.6.1\mkspecs\common\symbian\tmp"
+
+pre_targetdeps: \
+ generated_sources \
+ all_source_deps
+
+generated_sources: \
+ moc_flickrcontactfetcherplugin.cpp
+
+all_source_deps: \
+ flickrcontactfetcherplugin.h
+
+finalize:
+
+winscw_deployment:
+ -echo Deploying changed files...
+ -$(XCOPY) "d:\CarbideWorkspace\smfserver_cleaned\example\flickrcontactfetcherplugin\qmakepluginstubs\flickrcontactfetcherplugin.qtplugin" "\S60\devices\S60_5th_Edition_SDK_v0.9\epoc32\winscw\c\resource\qt\plugins\smf\plugin\contact.fetcher\"
+
+winscw_deployment_clean:
+ -@ if EXIST "\S60\devices\S60_5th_Edition_SDK_v0.9\epoc32\winscw\c\resource\qt\plugins\smf\plugin\contact.fetcher\flickrcontactfetcherplugin.qtplugin" $(DEL_FILE) "\S60\devices\S60_5th_Edition_SDK_v0.9\epoc32\winscw\c\resource\qt\plugins\smf\plugin\contact.fetcher\flickrcontactfetcherplugin.qtplugin"
+
+sis: restore_build
+ $(if $(wildcard flickrcontactfetcherplugin_template.pkg),$(if $(wildcard .make.cache),$(MAKE) -s -f $(MAKEFILE) ok_sis,$(if $(QT_SIS_TARGET),$(MAKE) -s -f $(MAKEFILE) ok_sis,$(MAKE) -s -f $(MAKEFILE) fail_sis_nocache)),$(MAKE) -s -f $(MAKEFILE) fail_sis_nopkg)
+
+ok_sis:
+ createpackage.bat $(QT_SIS_OPTIONS) flickrcontactfetcherplugin_template.pkg $(QT_SIS_TARGET) $(QT_SIS_CERTIFICATE) $(QT_SIS_KEY) $(QT_SIS_PASSPHRASE)
+
+fail_sis_nopkg:
+ $(error PKG file does not exist, 'SIS' target is only supported for executables or projects with DEPLOYMENT statement)
+
+fail_sis_nocache:
+ $(error Project has to be built or QT_SIS_TARGET environment variable has to be set before calling 'SIS' target)
+
+restore_build:
+-include .make.cache
+
+store_build:
+ @echo # ============================================================================== > .make.cache
+ @echo # This file is generated by make and should not be modified by the user >> .make.cache
+ @echo # Name : .make.cache >> .make.cache
+ @echo # Part of : flickrcontactfetcherplugin >> .make.cache
+ @echo # Description : This file is used to cache last build target for >> .make.cache
+ @echo # make sis target. >> .make.cache
+ @echo # Version : >> .make.cache
+ @echo # >> .make.cache
+ @echo # ============================================================================== >> .make.cache
+ @echo. >> .make.cache
+ @echo QT_SIS_TARGET ?= $(QT_SIS_TARGET) >> .make.cache
+
+dodistclean:
+ -@ if EXIST "d:\CarbideWorkspace\smfserver_cleaned\example\flickrcontactfetcherplugin\flickrcontactfetcherplugin_template.pkg" $(DEL_FILE) "d:\CarbideWorkspace\smfserver_cleaned\example\flickrcontactfetcherplugin\flickrcontactfetcherplugin_template.pkg"
+ -@ if EXIST "d:\CarbideWorkspace\smfserver_cleaned\example\flickrcontactfetcherplugin\qmakepluginstubs\flickrcontactfetcherplugin.qtplugin" $(DEL_FILE) "d:\CarbideWorkspace\smfserver_cleaned\example\flickrcontactfetcherplugin\qmakepluginstubs\flickrcontactfetcherplugin.qtplugin"
+ -@ if EXIST "d:\CarbideWorkspace\smfserver_cleaned\example\flickrcontactfetcherplugin\Makefile" $(DEL_FILE) "d:\CarbideWorkspace\smfserver_cleaned\example\flickrcontactfetcherplugin\Makefile"
+ -@ if EXIST "d:\CarbideWorkspace\smfserver_cleaned\example\flickrcontactfetcherplugin\Makefile_0xE341a8b4.mk" $(DEL_FILE) "d:\CarbideWorkspace\smfserver_cleaned\example\flickrcontactfetcherplugin\Makefile_0xE341a8b4.mk"
+ -@ if EXIST "d:\CarbideWorkspace\smfserver_cleaned\example\flickrcontactfetcherplugin\flickrcontactfetcherplugin_0xE341a8b4.mmp" $(DEL_FILE) "d:\CarbideWorkspace\smfserver_cleaned\example\flickrcontactfetcherplugin\flickrcontactfetcherplugin_0xE341a8b4.mmp"
+ -@ if EXIST "d:\CarbideWorkspace\smfserver_cleaned\example\flickrcontactfetcherplugin\plugin_commonU.def" $(DEL_FILE) "d:\CarbideWorkspace\smfserver_cleaned\example\flickrcontactfetcherplugin\plugin_commonU.def"
+ -@ if EXIST "d:\CarbideWorkspace\smfserver_cleaned\example\flickrcontactfetcherplugin\.make.cache" $(DEL_FILE) "d:\CarbideWorkspace\smfserver_cleaned\example\flickrcontactfetcherplugin\.make.cache"
+ -@ if EXIST "d:\CarbideWorkspace\smfserver_cleaned\example\flickrcontactfetcherplugin\bld.inf" $(DEL_FILE) "d:\CarbideWorkspace\smfserver_cleaned\example\flickrcontactfetcherplugin\bld.inf"
+ -@ if EXIST "d:\CarbideWorkspace\smfserver_cleaned\example\flickrcontactfetcherplugin\qmakepluginstubs" $(DEL_DIR) "d:\CarbideWorkspace\smfserver_cleaned\example\flickrcontactfetcherplugin\qmakepluginstubs"
+
+distclean: clean dodistclean
+
+clean: $(ABLD)
+ -$(ABLD) reallyclean
+ -bldmake clean
+
+clean-debug: $(ABLD)
+ $(ABLD) reallyclean winscw udeb
+ $(ABLD) reallyclean gcce udeb
+ $(ABLD) reallyclean armv5 udeb
+ $(ABLD) reallyclean armv6 udeb
+
+clean-release: $(ABLD)
+ $(ABLD) reallyclean gcce urel
+ $(ABLD) reallyclean armv5 urel
+ $(ABLD) reallyclean armv6 urel
+
+clean-debug-winscw: $(ABLD)
+ $(ABLD) reallyclean winscw udeb
+clean-debug-gcce: $(ABLD)
+ $(ABLD) reallyclean gcce udeb
+clean-debug-armv5: $(ABLD)
+ $(ABLD) reallyclean armv5 udeb
+clean-debug-armv6: $(ABLD)
+ $(ABLD) reallyclean armv6 udeb
+clean-release-gcce: $(ABLD)
+ $(ABLD) reallyclean gcce urel
+clean-release-armv5: $(ABLD)
+ $(ABLD) reallyclean armv5 urel
+clean-release-armv6: $(ABLD)
+ $(ABLD) reallyclean armv6 urel
+
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/example/flickrcontactfetcherplugin/bld.inf Tue May 18 17:33:55 2010 +0530
@@ -0,0 +1,24 @@
+// ============================================================================
+// * Makefile for building: flickrcontactfetcherplugin
+// * Generated by qmake (2.01a) (Qt 4.6.1) on: 2010-05-18T16:01:40
+// * This file is generated by qmake and should not be modified by the
+// * user.
+// * Project: flickrcontactfetcherplugin.pro
+// * Template: lib
+// ============================================================================
+
+#define BLD_INF_FLICKRCONTACTFETCHERPLUGIN_0E012629
+
+
+prj_platforms
+
+WINSCW GCCE ARMV5 ARMV6
+
+
+prj_mmpfiles
+
+gnumakefile Makefile_0xE341a8b4.mk
+flickrcontactfetcherplugin_0xE341a8b4.mmp
+
+prj_extensions
+
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/example/flickrcontactfetcherplugin/flickrcontactfetcherplugin.cpp Tue May 18 17:33:55 2010 +0530
@@ -0,0 +1,517 @@
+
+// Include files
+#include <QtPlugin>
+#include <QCryptographicHash>
+#include <QDataStream>
+#include <QTextStream>
+#include <QFile>
+#include <QNetworkReply>
+#include <QXmlStreamReader>
+#include <parser.h>
+#include <QMap>
+#include <QListIterator>
+
+#include "flickrcontactfetcherplugin.h"
+
+// HARD CODED AS CSM IS NOT AVAILABLE - START - use your rigistered app's keys here
+static const QString apiKey = "";
+static const QString apiSecret = "";
+static const QString miniToken = "";
+QString fullToken = "";
+// HARD CODED AS CSM IS NOT AVAILABLE - END
+
+
+/**
+ * Method called by plugins for logging
+ * @param log string to be logged
+ */
+void FlickrContactFetcherPlugin::writeLog(QString log) const
+ {
+ QFile file("c:\\data\\PluginLogs.txt");
+ if (!file.open(QIODevice::Append | QIODevice::Text))
+ ;
+ QTextStream out(&file);
+ out << log << "\n";
+ file.close();
+ }
+
+/**
+ * Destructor
+ */
+FlickrContactFetcherPlugin::~FlickrContactFetcherPlugin( )
+ {
+ if(m_provider)
+ delete m_provider;
+ }
+
+/**
+ * Method to get the list of friends
+ * @param aRequest [out] The request data to be sent to network
+ * @param aPageNum The page to be extracted
+ * @param aItemsPerPage Number of items per page
+ * @return SmfPluginError Plugin error if any, else SmfPluginErrNone
+ */
+SmfPluginError FlickrContactFetcherPlugin::friends( SmfPluginRequestData &aRequest,
+ const int aPageNum,
+ const int aItemsPerPage )
+ {
+ writeLog("FlickrContactFetcherPlugin::friends");
+
+ SmfPluginError error = SmfPluginErrInvalidRequest;
+
+ // invalid arguments
+ if( aPageNum < 0 || aItemsPerPage < 0 )
+ return error;
+ else
+ {
+ // Create the API signature string
+ QString baseString;
+ baseString.append(apiSecret);
+ baseString.append("api_key"+apiKey);
+ baseString.append("auth_token"+fullToken);
+ baseString.append("filterfriends");
+ baseString.append("formatjson");
+ 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("method", "flickr.contacts.getList");
+ url.addQueryItem("api_key", apiKey);
+ url.addQueryItem("filter", "friends");
+ url.addQueryItem("format", "json");
+ url.addQueryItem("page", QString::number(aPageNum));
+ url.addQueryItem("per_page", QString::number(aItemsPerPage));
+ url.addQueryItem("auth_token", fullToken);
+ url.addQueryItem("api_sig", generateSignature(baseString));
+
+ // Create the request, set the url
+ writeLog("final url = "+url.toString());
+ aRequest.iNetworkRequest.setUrl(url);
+ aRequest.iRequestType = SmfContactGetFriends;
+ aRequest.iPostData = NULL;
+ aRequest.iHttpOperationType = QNetworkAccessManager::GetOperation;
+ error = SmfPluginErrNone;
+ }
+ writeLog("Url string is : "+aRequest.iNetworkRequest.url().toString());
+ return error;
+ }
+
+/**
+ * Method called by plugins to generate a signature string from a base string
+ * @param aBaseString The base string
+ * @return The md5 hash of the base string
+ */
+QString FlickrContactFetcherPlugin::generateSignature(const QString aBaseString)
+ {
+ writeLog("FlickrContactFetcherPlugin::generateSignature");
+
+ // Create md5 hash of the signature string
+ QByteArray byteArray;
+ byteArray.insert(0, aBaseString.toAscii());
+
+ QByteArray md5Hash = QCryptographicHash::hash(byteArray,QCryptographicHash::Md5 ).toHex();
+ QString returnString (md5Hash);
+ writeLog("generated signature = "+QString(returnString));
+ return returnString;
+ }
+
+/**
+ * Method to get the list of followers
+ * @param aRequest [out] The request data to be sent to network
+ * @param aPageNum The page to be extracted
+ * @param aItemsPerPage Number of items per page
+ * @return SmfPluginError Plugin error if any, else SmfPluginErrNone
+ */
+SmfPluginError FlickrContactFetcherPlugin::followers( SmfPluginRequestData &aRequest,
+ const int aPageNum ,
+ const int aItemsPerPage )
+ {
+ Q_UNUSED(aRequest)
+Q_UNUSED(aPageNum)
+Q_UNUSED(aItemsPerPage)
+ SmfPluginError error = SmfPluginErrInvalidRequest;
+ return error;
+ }
+
+/**
+ * Method to search for a contact
+ * @param aRequest [out] The request data to be sent to network
+ * @param aContact contact to be searched
+ * @param aPageNum The page to be extracted
+ * @param aItemsPerPage Number of items per page
+ * @return SmfPluginError Plugin error if any, else SmfPluginErrNone
+ */
+SmfPluginError FlickrContactFetcherPlugin::search( SmfPluginRequestData &aRequest,
+ const SmfContact &aContact,
+ const int aPageNum ,
+ const int aItemsPerPage )
+ {
+ Q_UNUSED(aRequest)
+Q_UNUSED(aContact)
+Q_UNUSED(aPageNum)
+Q_UNUSED(aItemsPerPage)
+ SmfPluginError error = SmfPluginErrInvalidRequest;
+ return error;
+ }
+
+/**
+ * Method to search for contacts (friends) who are near the user.
+ * Proximity defines accuracy level
+ * @param aRequest [out] The request data to be sent to network
+ * @param aLocation The location search criteria
+ * @param aProximity location search boundary
+ * @param aPageNum The page to be extracted
+ * @param aItemsPerPage Number of items per page
+ * @return SmfPluginError Plugin error if any, else SmfPluginErrNone
+ */
+SmfPluginError FlickrContactFetcherPlugin::searchNear( SmfPluginRequestData &aRequest,
+ const SmfLocation &aLocation,
+ const SmfLocationSearchBoundary &aProximity,
+ const int aPageNum ,
+ const int aItemsPerPage )
+ {
+ Q_UNUSED(aRequest)
+Q_UNUSED(aLocation)
+Q_UNUSED(aProximity)
+Q_UNUSED(aPageNum)
+Q_UNUSED(aItemsPerPage)
+ SmfPluginError error = SmfPluginErrInvalidRequest;
+ return error;
+ }
+
+/**
+ * Method to get the list of groups
+ * @param aRequest [out] The request data to be sent to network
+ * @param aPageNum The page to be extracted
+ * @param aItemsPerPage Number of items per page
+ * @return SmfPluginError Plugin error if any, else SmfPluginErrNone
+ */
+SmfPluginError FlickrContactFetcherPlugin::groups( SmfPluginRequestData &aRequest,
+ const int aPageNum ,
+ const int aItemsPerPage )
+ {
+ Q_UNUSED(aRequest)
+Q_UNUSED(aPageNum)
+Q_UNUSED(aItemsPerPage)
+ SmfPluginError error = SmfPluginErrInvalidRequest;
+ return error;
+ }
+
+/**
+ * Method to search for a contact in a group
+ * @param aRequest [out] The request data to be sent to network
+ * @param aGroup the group in which to search
+ * @param aPageNum The page to be extracted
+ * @param aItemsPerPage Number of items per page
+ * @return SmfPluginError Plugin error if any, else SmfPluginErrNone
+ */
+SmfPluginError FlickrContactFetcherPlugin::searchInGroup( SmfPluginRequestData &aRequest,
+ const SmfGroup &aGroup,
+ const int aPageNum ,
+ const int aItemsPerPage )
+ {
+ Q_UNUSED(aRequest)
+Q_UNUSED(aGroup)
+Q_UNUSED(aPageNum)
+Q_UNUSED(aItemsPerPage)
+ SmfPluginError error = SmfPluginErrInvalidRequest;
+ return error;
+ }
+
+/**
+ * Customised method for SmfContactFetcherPlugin interface
+ * @param aRequest [out] The request data to be sent to network
+ * @param aOperation The operation type (should be known between
+ * the client interface and the plugin)
+ * @param aData The data required to form the request (The type
+ * of data should be known between client and the plugin)
+ * @return SmfPluginError Plugin error if any, else SmfPluginErrNone
+ */
+SmfPluginError FlickrContactFetcherPlugin::customRequest( SmfPluginRequestData &aRequest,
+ const int &aOperation, QByteArray *aData )
+ {
+ Q_UNUSED(aRequest)
+Q_UNUSED(aOperation)
+Q_UNUSED(aData)
+ SmfPluginError error = SmfPluginErrInvalidRequest;
+ return error;
+ }
+
+/**
+ * The first method to be called in the plugin that implements this interface.
+ * If this method is not called, plugin may not behave as expected.
+ * Plugins are expected to save the aUtil handle and use and when required.
+ * @param aUtil The instance of SmfPluginUtil
+ */
+void FlickrContactFetcherPlugin::initialize( SmfPluginUtil *aUtil )
+ {
+ // Save the SmfPluginUtil handle
+ m_util = aUtil;
+
+ // Create an instance of FlickrProviderBase
+ m_provider = new FlickrProviderBase;
+ m_provider->initialize();
+ }
+
+/**
+ * Method to get the provider information
+ * @return Instance of SmfProviderBase
+ */
+SmfProviderBase* FlickrContactFetcherPlugin::getProviderInfo( )
+ {
+ return m_provider;
+ }
+
+/**
+ * Method to get the result for a network request.
+ * @param aTransportResult The result of transport operation
+ * @param aResponse The QByteArray instance containing the network response.
+ * The plugins should delete this instance once they have read the
+ * data from it.
+ * @param aResult [out] An output parameter to the plugin manager.If the
+ * return value is SmfSendRequestAgain, QVariant will be of type
+ * SmfPluginRequestData.
+ * For SmfGalleryPlugin: If last operation was pictures(), aResult will
+ * be of type QList<SmfPicture>. If last operation was description(),
+ * aResult will be of type QString. If last operation was upload() or
+ * postComment(), aResult will be of type bool.
+ * @param aRetType [out] SmfPluginRetType
+ * @param aPageResult [out] The SmfResultPage structure variable
+ */
+SmfPluginError FlickrContactFetcherPlugin::responseAvailable(
+ const SmfTransportResult &aTransportResult,
+ QByteArray *aResponse,
+ QVariant* aResult,
+ SmfPluginRetType &aRetType,
+ SmfResultPage &aPageResult )
+ {
+ writeLog("FlickrContactFetcherPlugin::responseAvailable");
+ Q_UNUSED(aPageResult)
+ SmfPluginError error;
+ QList<SmfContact> list;
+
+ if(SmfTransportOpNoError == aTransportResult)
+ {
+ writeLog("No transport error");
+
+ QByteArray response(aResponse->data());
+ delete aResponse;
+ writeLog("Flickr response = "+QString(response));
+
+#if 1
+ // For getting contacts from json response
+ QJson::Parser parser;
+ bool ok;
+
+ // To remove the "jsonFlickrApi(" and also remove the last ")" from the response,
+ // as these gives a Json parsing error
+ response.remove(0, 14);
+ response.chop(1);
+
+ QVariantMap result = parser.parse(response, &ok).toMap();
+ if (!ok) {
+ writeLog("An error occurred during json parsing");
+ aResult->setValue(list);
+ error = SmfPluginErrParsingFailed;
+ return error;
+ }
+
+ QVariantMap map1 = result["contacts"].toMap();
+ writeLog("page = "+map1["page"].toString());
+ writeLog("pages = "+map1["pages"].toString());
+ writeLog("per_page = "+map1["per_page"].toString());
+ writeLog("perpage = "+map1["perpage"].toString());
+ writeLog("total = "+map1["perpage"].toString());
+
+ QList<QVariant> list1 = map1["contact"].toList();
+
+ QListIterator<QVariant> i(list1);
+ while(i.hasNext())
+ {
+ SmfContact contact;
+ QVariantMap map2 = i.next().toMap();
+ writeLog("nsid = "+map2["nsid"].toString());
+ writeLog("username = "+map2["username"].toString());
+ writeLog("iconserver = "+map2["iconserver"].toString());
+ writeLog("iconfarm = "+map2["iconfarm"].toString());
+ writeLog("ignored = "+map2["ignored"].toString());
+ writeLog("realname = "+map2["realname"].toString());
+ writeLog("friend = "+map2["friend"].toString());
+ writeLog("family = "+map2["family"].toString());
+ writeLog("path_alias = "+map2["path_alias"].toString());
+ writeLog("location = "+map2["location"].toString());
+
+ QContactName contactname;
+ QString username = map2["username"].toString();
+ writeLog("Username = "+username);
+ contactname.setFirstName(username);
+ contactname.setLastName(username);
+ QVariant nameVar = QVariant::fromValue(contactname);
+ contact.setValue("Name",nameVar);
+ list.append(contact);
+ }
+#endif
+
+#if 0
+ // For getting contacts from xml response
+ QXmlStreamReader xml(response);
+ while (!xml.atEnd())
+ {
+ xml.readNext();
+ if (xml.tokenType() == QXmlStreamReader::StartElement)
+ {
+ // If the tag is contact
+ if (xml.name() == "contact")
+ {
+ writeLog("Contact tag found");
+ SmfContact contact;
+ QStringRef str;
+ QContactName contactname;
+ QString username = xml.attributes().value("username").toString();
+ writeLog("Username = ");
+ writeLog(username);
+ contactname.setFirstName(username);
+ contactname.setLastName(username);
+ QVariant namevar1 = QVariant::fromValue(contactname);
+ contact.setValue("Name",namevar1);
+ list.append(contact);
+ }
+ }
+ }
+#endif
+
+ writeLog("list count = "+QString::number(list.count(),10));
+ aRetType = SmfRequestComplete;
+ error = SmfPluginErrNone;
+ }
+
+ else
+ {
+ error = SmfPluginErrInvalidRequest;
+ aRetType = SmfRequestError;
+ }
+
+ aResult->setValue(list);
+ return error;
+ }
+
+
+/**
+ * Destructor
+ */
+FlickrProviderBase::~FlickrProviderBase( )
+ {
+ }
+
+/**
+ * Method to get the Localisable name of the service.
+ * @return The Localisable name of the service.
+ */
+QString FlickrProviderBase::serviceName( ) const
+ {
+ return m_serviceName;
+ }
+
+/**
+ * Method to get the Logo of the service
+ * @return The Logo of the service
+ */
+QImage FlickrProviderBase::serviceIcon( ) const
+ {
+ return m_serviceIcon;
+ }
+
+/**
+ * Method to get the Readable service description
+ * @return The Readable service description
+ */
+QString FlickrProviderBase::description( ) const
+ {
+ return m_description;
+ }
+
+/**
+ * Method to get the Website of the service
+ * @return The Website of the service
+ */
+QUrl FlickrProviderBase::serviceUrl( ) const
+ {
+ return m_serviceUrl;
+ }
+
+/**
+ * Method to get the URL of the Application providing this service
+ * @return The URL of the Application providing this service
+ */
+QUrl FlickrProviderBase::applicationUrl( ) const
+ {
+ return m_applicationUrl;
+ }
+
+/**
+ * Method to get the Icon of the application
+ * @return The Icon of the application
+ */
+QImage FlickrProviderBase::applicationIcon( ) const
+ {
+ return m_applicationIcon;
+ }
+
+/**
+ * Method to get the Plugin specific ID
+ * @return The Plugin specific ID
+ */
+QString FlickrProviderBase::pluginId( ) const
+ {
+ return m_pluginId;
+ }
+
+/**
+ * Method to get the ID of the authentication application
+ * for this service
+ * @param aProgram The authentication application name
+ * @param aArguments List of arguments required for authentication app
+ * @param aMode Strting mode for authentication application
+ * @return The ID of the authentication application
+ */
+QString FlickrProviderBase::authenticationApp( QString &aProgram,
+ QStringList & aArguments,
+ QIODevice::OpenModeFlag aMode ) const
+ {
+ Q_UNUSED(aProgram)
+Q_UNUSED(aArguments)
+Q_UNUSED(aMode)
+ return m_authAppId;
+ }
+
+/**
+ * Method to get the unique registration ID provided by the
+ * Smf for authorised plugins
+ * @return The unique registration ID/token provided by the Smf for
+ * authorised plugins
+ */
+QString FlickrProviderBase::smfRegistrationId( ) const
+ {
+ return m_smfRegToken;
+ }
+
+void FlickrProviderBase::initialize()
+ {
+ m_serviceName = "Flickr";
+ m_description = "Flickr plugin description";
+ m_serviceUrl = QUrl(QString("http://api.flickr.com"));
+ m_pluginId = "flickrcontactfetcherplugin.qtplugin";
+ m_authAppId = "Flickr AuthAppId";
+ m_smfRegToken = "Flickr RegToken";
+ }
+
+
+/*
+ * Export Macro
+ * plugin name : flickrcontactfetcherplugin
+ * plugin class : FlickrContactFetcherPlugin
+ */
+Q_EXPORT_PLUGIN2( flickrcontactfetcherplugin, FlickrContactFetcherPlugin )
+
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/example/flickrcontactfetcherplugin/flickrcontactfetcherplugin.h Tue May 18 17:33:55 2010 +0530
@@ -0,0 +1,273 @@
+#ifndef _FLICKRCONTACTFETCHERPLUGIN_H
+#define _FLICKRCONTACTFETCHERPLUGIN_H
+
+// Include files
+#include <smfcontactfetcherplugin.h>
+#include <smfpluginutil.h>
+
+// Forward declarations
+class FlickrProviderBase;
+class QVariant;
+class QNetworkReply;
+
+// Class declaration
+class FlickrContactFetcherPlugin : public QObject, public SmfContactFetcherPlugin
+ {
+ Q_OBJECT
+ Q_INTERFACES( SmfContactFetcherPlugin SmfPluginBase )
+
+public:
+ virtual ~FlickrContactFetcherPlugin( );
+
+public: // From SmfContactFetcherPlugin
+
+ /**
+ * Method to get the list of friends
+ * @param aRequest [out] The request data to be sent to network
+ * @param aPageNum The page to be extracted
+ * @param aItemsPerPage Number of items per page
+ * @return SmfPluginError Plugin error if any, else SmfPluginErrNone
+ */
+ SmfPluginError friends( SmfPluginRequestData &aRequest,
+ const int aPageNum = SMF_FIRST_PAGE,
+ const int aItemsPerPage = SMF_ITEMS_PER_PAGE );
+
+ /**
+ * Method to get the list of followers
+ * @param aRequest [out] The request data to be sent to network
+ * @param aPageNum The page to be extracted
+ * @param aItemsPerPage Number of items per page
+ * @return SmfPluginError Plugin error if any, else SmfPluginErrNone
+ */
+ SmfPluginError followers( SmfPluginRequestData &aRequest,
+ const int aPageNum = SMF_FIRST_PAGE,
+ const int aItemsPerPage = SMF_ITEMS_PER_PAGE );
+
+ /**
+ * Method to search for a contact
+ * @param aRequest [out] The request data to be sent to network
+ * @param aContact contact to be searched
+ * @param aPageNum The page to be extracted
+ * @param aItemsPerPage Number of items per page
+ * @return SmfPluginError Plugin error if any, else SmfPluginErrNone
+ */
+ SmfPluginError search( SmfPluginRequestData &aRequest,
+ const SmfContact &aContact,
+ const int aPageNum = SMF_FIRST_PAGE,
+ const int aItemsPerPage = SMF_ITEMS_PER_PAGE );
+
+ /**
+ * Method to search for contacts (friends) who are near the user.
+ * Proximity defines accuracy level
+ * @param aRequest [out] The request data to be sent to network
+ * @param aLocation The location search criteria
+ * @param aProximity location search boundary
+ * @param aPageNum The page to be extracted
+ * @param aItemsPerPage Number of items per page
+ * @return SmfPluginError Plugin error if any, else SmfPluginErrNone
+ */
+ SmfPluginError searchNear( SmfPluginRequestData &aRequest,
+ const SmfLocation &aLocation,
+ const SmfLocationSearchBoundary &aProximity,
+ const int aPageNum = SMF_FIRST_PAGE,
+ const int aItemsPerPage = SMF_ITEMS_PER_PAGE );
+
+ /**
+ * Method to get the list of groups
+ * @param aRequest [out] The request data to be sent to network
+ * @param aPageNum The page to be extracted
+ * @param aItemsPerPage Number of items per page
+ * @return SmfPluginError Plugin error if any, else SmfPluginErrNone
+ */
+ SmfPluginError groups( SmfPluginRequestData &aRequest,
+ const int aPageNum = SMF_FIRST_PAGE,
+ const int aItemsPerPage = SMF_ITEMS_PER_PAGE );
+
+ /**
+ * Method to search for a contact in a group
+ * @param aRequest [out] The request data to be sent to network
+ * @param aGroup the group in which to search
+ * @param aPageNum The page to be extracted
+ * @param aItemsPerPage Number of items per page
+ * @return SmfPluginError Plugin error if any, else SmfPluginErrNone
+ */
+ SmfPluginError searchInGroup( SmfPluginRequestData &aRequest,
+ const SmfGroup &aGroup,
+ const int aPageNum = SMF_FIRST_PAGE,
+ const int aItemsPerPage = SMF_ITEMS_PER_PAGE );
+
+ /**
+ * Customised method for SmfContactFetcherPlugin interface
+ * @param aRequest [out] The request data to be sent to network
+ * @param aOperation The operation type (should be known between
+ * the client interface and the plugin)
+ * @param aData The data required to form the request (The type
+ * of data should be known between client and the plugin)
+ * @return SmfPluginError Plugin error if any, else SmfPluginErrNone
+ */
+ SmfPluginError customRequest( SmfPluginRequestData &aRequest,
+ const int &aOperation, QByteArray *aData );
+
+public: // From SmfPluginBase
+ /**
+ * The first method to be called in the plugin that implements this interface.
+ * If this method is not called, plugin may not behave as expected.
+ * Plugins are expected to save the aUtil handle and use and when required.
+ * @param aUtil The instance of SmfPluginUtil
+ */
+ void initialize( SmfPluginUtil *aUtil );
+
+ /**
+ * Method to get the provider information
+ * @return Instance of SmfProviderBase
+ */
+ SmfProviderBase* getProviderInfo( );
+
+ /**
+ * Method to get the result for a network request.
+ * @param aTransportResult The result of transport operation
+ * @param aResponse The QByteArray instance containing the network response.
+ * The plugins should delete this instance once they have read the
+ * data from it.
+ * @param aResult [out] An output parameter to the plugin manager.If the
+ * return value is SmfSendRequestAgain, QVariant will be of type
+ * SmfPluginRequestData.
+ * For SmfGalleryPlugin: If last operation was pictures(), aResult will
+ * be of type QList<SmfPicture>. If last operation was description(),
+ * aResult will be of type QString. If last operation was upload() or
+ * postComment(), aResult will be of type bool.
+ * @param aRetType [out] SmfPluginRetType
+ * @param aPageResult [out] The SmfResultPage structure variable
+ */
+ SmfPluginError responseAvailable(
+ const SmfTransportResult &aTransportResult,
+ QByteArray *aResponse,
+ QVariant* aResult,
+ SmfPluginRetType &aRetType,
+ SmfResultPage &aPageResult );
+
+private:
+ /**
+ * Method called by plugins to generate a signature string from a base string
+ * @param aBaseString The base string
+ * @return The md5 hash of the base string
+ */
+ QString generateSignature(const QString aBaseString);
+
+ /**
+ * Method called by plugins for logging
+ * @param log string to be logged
+ */
+ void writeLog(QString log) const;
+
+private:
+ /**
+ * Method called by plugins to generate a request data
+ * @param aRequest [out] The request data to be sent to network
+ * @param aOperation The type of http operation
+ * @param aSignatureMethod The signature method to be used
+ * @param aParams A map of parameters to its values
+ * @param aMode The mode of creation of the request
+ * @param aPostData The data to be posted (for HTTP POST
+ * only, else it will be NULL)
+ * @return SmfPluginError Plugin error if any, else SmfPluginErrNone
+ */
+ SmfPluginError createRequest( SmfPluginRequestData &aRequest,
+ const QNetworkAccessManager::Operation aOperation,
+ const SmfSignatureMethod aSignatureMethod,
+ QMultiMap<QByteArray, QByteArray> &aParams,
+ const SmfParsingMode aMode,
+ QBuffer *aPostData );
+
+private:
+ FlickrProviderBase *m_provider;
+ SmfPluginUtil *m_util;
+
+ };
+
+
+// Class declaration
+class FlickrProviderBase : public QObject, public SmfProviderBase
+ {
+ Q_OBJECT
+ Q_INTERFACES( SmfProviderBase )
+
+public:
+ virtual ~FlickrProviderBase( );
+
+ /**
+ * Method to get the Localisable name of the service.
+ * @return The Localisable name of the service.
+ */
+ QString serviceName( ) const;
+
+ /**
+ * Method to get the Logo of the service
+ * @return The Logo of the service
+ */
+ QImage serviceIcon( ) const;
+
+ /**
+ * Method to get the Readable service description
+ * @return The Readable service description
+ */
+ QString description( ) const;
+
+ /**
+ * Method to get the Website of the service
+ * @return The Website of the service
+ */
+ QUrl serviceUrl( ) const;
+
+ /**
+ * Method to get the URL of the Application providing this service
+ * @return The URL of the Application providing this service
+ */
+ QUrl applicationUrl( ) const;
+
+ /**
+ * Method to get the Icon of the application
+ * @return The Icon of the application
+ */
+ QImage applicationIcon( ) const;
+
+ /**
+ * Method to get the Plugin specific ID
+ * @return The Plugin specific ID
+ */
+ QString pluginId( ) const;
+
+ /**
+ * Method to get the ID of the authentication application
+ * for this service
+ * @param aProgram The authentication application name
+ * @param aArguments List of arguments required for authentication app
+ * @param aMode Strting mode for authentication application
+ * @return The ID of the authentication application
+ */
+ QString authenticationApp( QString &aProgram, QStringList & aArguments,
+ QIODevice::OpenModeFlag aMode = QIODevice::ReadWrite ) const;
+
+ /**
+ * Method to get the unique registration ID provided by the
+ * Smf for authorised plugins
+ * @return The unique registration ID/token provided by the Smf for
+ * authorised plugins
+ */
+ QString smfRegistrationId( ) const;
+
+private:
+ friend class FlickrContactFetcherPlugin;
+ void initialize();
+ QString m_serviceName;
+ QImage m_serviceIcon;
+ QString m_description;
+ QUrl m_serviceUrl;
+ QUrl m_applicationUrl;
+ QImage m_applicationIcon;
+ QString m_pluginId;
+ QString m_authAppId;
+ QString m_smfRegToken;
+ };
+
+#endif /*_FLICKRCONTACTFETCHERPLUGIN_H*/
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/example/flickrcontactfetcherplugin/flickrcontactfetcherplugin.pkg Tue May 18 17:33:55 2010 +0530
@@ -0,0 +1,33 @@
+; flickrcontactfetcherplugin.pkg generated by qmake at 2010-04-29T11:33:57
+; This file is generated by qmake and should not be modified by the user
+;
+
+; Language
+&EN
+
+; SIS header: name, uid, version
+#{"flickrcontactfetcherplugin"},(0xE6cb7163),1,0,0
+
+; Localised Vendor name
+%{"Vendor"}
+
+; Unique Vendor name
+:"Vendor"
+
+; Manual PKG pre-rules from PRO files
+; Default HW/platform dependencies
+[0x101F7961],0,0,0,{"S60ProductID"}
+[0x102032BE],0,0,0,{"S60ProductID"}
+[0x102752AE],0,0,0,{"S60ProductID"}
+[0x1028315F],0,0,0,{"S60ProductID"}
+
+; Default dependency to Qt libraries
+(0x2001E61C), 4, 6, 1, {"Qt"}
+; Default dependency to QtMobility libraries
+(0x2002AC89), 0, 2, 0, {"QtMobility"}
+
+; DEPLOYMENT
+"/S60/devices/S60_5th_Edition_SDK_v0.9/epoc32/release/$(PLATFORM)/$(TARGET)/flickrcontactfetcherplugin.dll" - "!:\sys\bin\flickrcontactfetcherplugin.dll"
+"/CarbideWorkspace/svnrepo/example/flickrcontactfetcherplugin/qmakepluginstubs/flickrcontactfetcherplugin.qtplugin" - "!:\resource\qt\plugins\smf\plugin\contact\flickrcontactfetcherplugin.qtplugin"
+
+; Manual PKG post-rules from PRO files
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/example/flickrcontactfetcherplugin/flickrcontactfetcherplugin.pro Tue May 18 17:33:55 2010 +0530
@@ -0,0 +1,42 @@
+TEMPLATE = lib
+
+CONFIG += plugin \
+ mobility
+
+MOBILITY += contacts \
+ location
+
+QT += core \
+ xml \
+ network
+
+HEADERS = flickrcontactfetcherplugin.h
+
+SOURCES = flickrcontactfetcherplugin.cpp
+
+TARGET = $$qtLibraryTarget(flickrcontactfetcherplugin)
+
+symbian: {
+ # Load predefined include paths (e.g. QT_PLUGINS_BASE_DIR) to be used in the pro-files
+ load(data_caging_paths)
+
+ # EPOCALLOWDLLDATA have to set true because Qt macros has initialised global data
+ TARGET.EPOCALLOWDLLDATA = 1
+
+ # Defines plugin files into Symbian .pkg package
+ pluginDep.sources = flickrcontactfetcherplugin.dll
+ pluginDep.path = $$QT_PLUGINS_BASE_DIR/smf/plugin/contact.fetcher
+ DEPLOYMENT += pluginDep
+
+ TARGET.CAPABILITY = ReadUserData \
+ WriteUserData \
+ LocalServices \
+ NetworkServices \
+ UserEnvironment
+
+ LIBS += -lsmfclient.dll -lqjson.dll
+}
+
+target.path += $$[QT_INSTALL_PLUGINS]/smf/plugin/contact.fetcher
+
+INSTALLS += target
\ No newline at end of file
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/example/flickrcontactfetcherplugin/flickrcontactfetcherplugin_template.pkg Tue May 18 17:33:55 2010 +0530
@@ -0,0 +1,33 @@
+; flickrcontactfetcherplugin_template.pkg generated by qmake at 2010-05-18T16:01:40
+; This file is generated by qmake and should not be modified by the user
+;
+
+; Language
+&EN
+
+; SIS header: name, uid, version
+#{"flickrcontactfetcherplugin"},(0xE341a8b4),1,0,0
+
+; Localised Vendor name
+%{"Vendor"}
+
+; Unique Vendor name
+:"Vendor"
+
+; Manual PKG pre-rules from PRO files
+; Default HW/platform dependencies
+[0x101F7961],0,0,0,{"S60ProductID"}
+[0x102032BE],0,0,0,{"S60ProductID"}
+[0x102752AE],0,0,0,{"S60ProductID"}
+[0x1028315F],0,0,0,{"S60ProductID"}
+
+; Default dependency to Qt libraries
+(0x2001E61C), 4, 6, 1, {"Qt"}
+; Default dependency to QtMobility libraries
+(0x2002AC89), 0, 2, 0, {"QtMobility"}
+
+; DEPLOYMENT
+"d:/S60/devices/S60_5th_Edition_SDK_v0.9/epoc32/release/$(PLATFORM)/$(TARGET)/flickrcontactfetcherplugin.dll" - "!:\sys\bin\flickrcontactfetcherplugin.dll"
+"d:/CarbideWorkspace/smfserver_cleaned/example/flickrcontactfetcherplugin/qmakepluginstubs/flickrcontactfetcherplugin.qtplugin" - "!:\resource\qt\plugins\smf\plugin\contact.fetcher\flickrcontactfetcherplugin.qtplugin"
+
+; Manual PKG post-rules from PRO files
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/example/flickrcontactfetcherplugin/plugin_commonU.def Tue May 18 17:33:55 2010 +0530
@@ -0,0 +1,16 @@
+; ==============================================================================
+; Generated by qmake (2.01a) (Qt 4.6.1) on: 2010-05-18T16:01:40
+; This file is generated by qmake and should not be modified by the
+; user.
+; Name : plugin_commonU.def
+; Part of : flickrcontactfetcherplugin
+; Description : Fixes common plugin symbols to known ordinals
+; Version :
+;
+; ==============================================================================
+
+
+EXPORTS
+ qt_plugin_query_verification_data @ 1 NONAME
+ qt_plugin_instance @ 2 NONAME
+
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/example/flickrcontactfetcherplugin/qmakepluginstubs/flickrcontactfetcherplugin.qtplugin Tue May 18 17:33:55 2010 +0530
@@ -0,0 +1,1 @@
+This file is a Qt plugin stub file. The real Qt plugin is located in \sys\bin. Created:2010-05-18T16:01:40
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/example/sampleplugin.cpp Tue May 18 17:33:55 2010 +0530
@@ -0,0 +1,511 @@
+
+// Include files
+#include "sampleplugin.h"
+#include <QNetworkRequest>
+#include <QNetworkAccessManager>
+#include <qfile.h>
+#include <stdio.h>
+
+/**
+ * Constructor with default argument
+ * @param aUtil The SmfPluginUtil instance. The plugins can
+ * call the method getAuthKeys() of this class, with its pluginID to
+ * get the OAuth keys, keys are returned only if this plugin is
+ * authorised by Smf franework
+ */
+SamplePlugin::SamplePlugin( SmfPluginUtil *aUtil )
+ {
+ m_provider = new SampleProviderBase();
+ m_util = aUtil;
+ }
+
+/**
+ * Destructor
+ */
+SamplePlugin::~SamplePlugin( )
+ {
+ if(m_provider)
+ delete m_provider;
+ }
+
+/**
+ * Method to get a list of pictures
+ * @param aRequest [out] The request data to be sent to network
+ * @param aPageNum The page to be extracted
+ * @param aItemsPerPage Number of items per page
+ * @return SmfPluginError Plugin error if any, else SmfPluginErrNone
+ */
+SmfPluginError SamplePlugin::pictures( SmfPluginRequestData &aRequest,
+ const int aPageNum,
+ const int aItemsPerPage )
+ {
+ SmfPluginError error = SmfPluginErrInvalidRequest;
+
+ // invalid arguments
+ if( aPageNum < 0 || aItemsPerPage < 0 )
+ return error;
+ else
+ {
+ // Create a map of the arguments keys and their repective values
+ QMultiMap<QByteArray, QByteArray> params;
+ QString pageNum, itemPerPage;
+ pageNum.number(aPageNum);
+ itemPerPage.number(aItemsPerPage);
+ params.insert("method", "getpictures");
+ params.insert("pagenumber", pageNum.toAscii());
+ params.insert("itemsperpage", itemPerPage.toAscii());
+
+ QNetworkAccessManager::Operation type = QNetworkAccessManager::GetOperation;
+ SmfSignatureMethod signMethod = HMAC_SHA1;
+ SmfParsingMode mode = ParseForInlineQuery;
+
+ error = createRequest(aRequest, type, signMethod, params, mode, NULL);
+ }
+ return error;
+ }
+
+
+/**
+ * Method called by plugins to generate a request data
+ * @param aRequest [out] The request data to be sent to network
+ * @param aOperation The type of http operation
+ * @param aSignatureMethod The signature method to be used
+ * @param aParams A map of parameters to its values
+ * @param aMode The mode of creation of the request
+ * @param aPostData The data to be posted (for HTTP POST
+ * only, else it will be NULL)
+ * @return SmfPluginError Plugin error if any, else SmfPluginErrNone
+ */
+SmfPluginError SamplePlugin::createRequest( SmfPluginRequestData &aRequest,
+ const QNetworkAccessManager::Operation aOperation,
+ const SmfSignatureMethod aSignatureMethod,
+ QMultiMap<QByteArray, QByteArray> &aParams,
+ const SmfParsingMode aMode,
+ QBuffer *aPostData )
+ {
+ SmfPluginError error;
+ QString url = m_provider->serviceUrl().toString();
+
+ // Get the oAuth keys from The Smf Server
+ QMap<QString, QString> keys;
+ QString registrationToken = retrievePrivateRegToken();
+ m_util->getAuthKeys(keys, registrationToken, m_provider->pluginId());
+
+ // Unable to get the tokens
+ if(keys.isEmpty())
+ error = SmfPluginErrInvalidApplication;
+ else
+ {
+
+ // Get the token and token secret from keys
+ QByteArray token;
+ QByteArray tokenSecret;
+ token.append(keys.value("oauth_token"));
+ tokenSecret.append(keys.value("oauth_token_secret"));
+
+ // convert the parameters to string and sign it
+ QByteArray content = m_util->createParameterString(url, aOperation, token, tokenSecret,
+ aSignatureMethod, aParams, aMode );
+
+ // Unable to create the signed string
+ if(content.isEmpty())
+ error = SmfPluginErrInvalidRequest;
+ else
+ {
+ // add the parameter string to the URL
+ url.append(content);
+
+ // set the url of the request
+ aRequest.iNetworkRequest.setUrl(QUrl(url));
+
+ // set the type of http operation to be performed
+ aRequest.iHttpOperationType = aOperation;
+
+ // As it is a GET operation, set iPostData to NULL
+ aRequest.iPostData = aPostData;
+
+ // For successful creation of request
+ error = SmfPluginErrNone;
+ }
+ }
+ return error;
+ }
+
+
+/**
+ * Method to get a description
+ * @param aRequest [out] The request data to be sent to network
+ * @param aImage The image abot which the description is required
+ * @return SmfPluginError Plugin error if any, else SmfPluginErrNone
+ */
+SmfPluginError SamplePlugin::description( SmfPluginRequestData &aRequest,
+ const SmfPicture &aImage )
+ {
+ SmfPluginError error;
+
+ // Create a map of the arguments keys and their repective values
+ QMultiMap<QByteArray, QByteArray> params;
+ params.insert("method", "getpictureDescription");
+ params.insert("photoId", aImage.id().toAscii());
+
+ QNetworkAccessManager::Operation type = QNetworkAccessManager::GetOperation;
+ SmfSignatureMethod signMethod = HMAC_SHA1;
+ SmfParsingMode mode = ParseForInlineQuery;
+
+ error = createRequest(aRequest, type, signMethod, params, mode, NULL);
+
+ return error;
+ }
+
+/**
+ * Method to upload a picture
+ * @param aRequest [out] The request data to be sent to network
+ * @param aImage The image to be uploaded
+ * @return SmfPluginError Plugin error if any, else SmfPluginErrNone
+ */
+SmfPluginError SamplePlugin::upload( SmfPluginRequestData &aRequest,
+ const SmfPicture &aImage )
+ {
+ SmfPluginError error = SmfPluginErrInvalidRequest;
+
+ // Create a map of the arguments keys and their repective values
+ QMultiMap<QByteArray, QByteArray> params;
+ params.insert("method", "upload");
+ params.insert("title", aImage.title().toAscii());
+ params.insert("owner", aImage.owner().toAscii());
+ params.insert("description", aImage.description().toAscii());
+ params.insert("tags", aImage.tags().join(" ").toAscii());
+ switch(aImage.visibility())
+ {
+ case SMFVisibilityFriend:
+ params.insert("isFriend", "true");
+ break;
+ case SMFVisibilityPublic:
+ params.insert("isPublic", "true");
+ break;
+ case SMFVisibilityFamily:
+ params.insert("isFamily", "true");
+ break;
+ case SMFVisibilityGroup:
+ params.insert("isGroup", "true");
+ break;
+ default:// SMFVisibilityPersonal
+ params.insert("isPrivate", "true");
+ }
+
+ QNetworkAccessManager::Operation type = QNetworkAccessManager::PostOperation;
+ SmfSignatureMethod signMethod = HMAC_SHA1;
+ SmfParsingMode mode = ParseForRequestContent;
+
+ // Write the image as png format to the buffer
+ QByteArray ba;
+ QBuffer buffer(&ba);
+ buffer.open(QIODevice::WriteOnly);
+ aImage.picture().save(&buffer, "PNG");
+
+ error = createRequest(aRequest, type, signMethod, params, mode, &buffer);
+
+ return error;
+ }
+
+/**
+ * Method to upload a list of pictures
+ * @param aRequest [out] The request data to be sent to network
+ * @param aImages The list of images to be uploaded
+ * @return SmfPluginError Plugin error if any, else SmfPluginErrNone
+ */
+SmfPluginError SamplePlugin::upload( SmfPluginRequestData &aRequest,
+ const QList<SmfPicture> &aImages )
+ {
+ SmfPluginError error;
+
+ for(int index = 0; index < aImages.count(); index++)
+ {
+ error = upload(aRequest, aImages.value(index));
+ if(SmfPluginErrNone != error)
+ break;
+ }
+ return error;
+ }
+
+/**
+ * Method to post comment on a picture is available
+ * @param aRequest [out] The request data to be sent to network
+ * @param aImage The image on which comment is to be posted
+ * @param aComment The comment to be posted
+ * @return SmfPluginError Plugin error if any, else SmfPluginErrNone
+ */
+SmfPluginError SamplePlugin::postComment( SmfPluginRequestData &aRequest,
+ const SmfPicture &aImage,
+ const SmfComment &aComment )
+ {
+ SmfPluginError error = SmfPluginErrInvalidRequest;
+
+ // Create a map of the arguments keys and their repective values
+ QMultiMap<QByteArray, QByteArray> params;
+ params.insert("method", "postComment");
+ params.insert("photoId", aImage.id().toAscii());
+ params.insert("comment", "excellent Himalaya");
+
+ QNetworkAccessManager::Operation type = QNetworkAccessManager::GetOperation;
+ SmfSignatureMethod signMethod = HMAC_SHA1;
+ SmfParsingMode mode = ParseForInlineQuery;
+
+ error = createRequest(aRequest, type, signMethod, params, mode, NULL);
+ return error;
+ }
+
+/**
+ * This function retrieves the registration token that was provided to Authentication App
+ * while authenticatiing user with the service
+ *
+ * Plugin source codes are not open source - so free to use anything they like
+ */
+QString SamplePlugin::retrievePrivateRegToken()
+ {
+
+ /**
+ * This is a private implementation -
+ * implementer might choose to use registry to store/retrieve this token
+ * or to write encrypted (symmetric) token to a file kept at known dir
+ */
+ QFile qf("/resource/data/sampleplugindata.dat");
+ qf.open(QIODevice::ReadOnly);
+ QByteArray qba = qf.read(20);
+ qba.chop(5);
+ QString rs(qba.toBase64());
+ return rs;
+ }
+
+
+/**
+ * Method to get the provider information
+ * @return Instance of SmfProviderBase
+ */
+SmfProviderBase* SamplePlugin::getProviderInfo( )
+ {
+ return m_provider;
+ }
+
+/**
+ * Method to get the result for a network request.
+ * @param aTransportResult The result of transport operation
+ * @param aReply The QNetworkReply instance for the request
+ * @param aResult [out] An output parameter to the plugin manager.If the
+ * return value is SmfSendRequestAgain, QVariant will be of type
+ * SmfPluginRequestData.
+ * For SmfGalleryPlugin: If last operation was pictures(), aResult will
+ * be of type QList<SmfPicture>. If last operation was description(),
+ * aResult will be of type QString. If last operation was upload() or
+ * postComment(), aResult will be of type bool.
+ * @param aRetType [out] SmfPluginRetType
+ * @param aPageResult [out] The SmfResultPage structure variable
+ */
+SmfPluginError SamplePlugin::responseAvailable(
+ const SmfTransportResult &aTransportResult,
+ QNetworkReply *aReply,
+ QVariant* aResult,
+ SmfPluginRetType &aRetType,
+ SmfResultPage &aPageResult )
+ {
+ SmfPluginError error;
+ if(SmfTransportOpNoError == aTransportResult)
+ {
+ // Assuming a JSON response, parse the response
+ QByteArray response = aReply->readAll();
+ m_provider->updateDataUsage(0, aReply->readBufferSize());
+ bool parseResult = false;
+ QVariant *result = new QVariant();
+ /** see http://qjson.sourceforge.net/usage.html for more details */
+ parseResult = m_util->getJsonHandle()->parse(response, &parseResult);
+
+ // For parsing error
+ if(!parseResult)
+ {
+ aRetType = SmfRequestError;
+ error = SmfPluginErrInvalidRequest;
+ }
+
+ else
+ {
+ // The plugins should convert the result to suitable format,
+ // like if last operation was pictures(), result should be converted to the
+ // type QList<SmfPicture>. If last operation was description(), result should
+ // be converted to the type QString. If last operation was upload() or
+ // postComment(), result should be converted to the type bool.
+
+ // After conversion, assign the value os result to aResult
+ aResult = result;
+
+ // if the request is complete
+ aRetType = SmfRequestComplete;
+
+ // if request need to be sent again
+ aRetType = SmfSendRequestAgain;
+
+ error = SmfPluginErrNone;
+ }
+ }
+ else
+ {
+ error = SmfPluginErrInvalidRequest;
+ aRetType = SmfRequestError;
+ }
+
+ return error;
+ }
+
+
+/**
+ * Constructor with default argument
+ * @param aParent The parent object
+ */
+SampleProviderBase::SampleProviderBase( QObject* aParent )
+ : SmfProviderBase(aParent)
+ {
+ }
+
+/**
+ * Copy Constructor
+ * @param aOther The reference object
+ */
+SampleProviderBase::SampleProviderBase( const SampleProviderBase &aOther )
+ {
+ }
+
+/**
+ * Destructor
+ */
+SampleProviderBase::~SampleProviderBase( )
+ {
+ }
+
+/**
+ * Method to get the Localisable name of the service.
+ * @return The Localisable name of the service.
+ */
+QString SampleProviderBase::serviceName( ) const
+ {
+ return m_serviceName;
+ }
+
+/**
+ * Method to get the Logo of the service
+ * @return The Logo of the service
+ */
+QImage SampleProviderBase::serviceIcon( ) const
+ {
+ return m_serviceIcon;
+ }
+
+/**
+ * Method to get the Readable service description
+ * @return The Readable service description
+ */
+QString SampleProviderBase::description( ) const
+ {
+ return m_description;
+ }
+
+/**
+ * Method to get the Website of the service
+ * @return The Website of the service
+ */
+QUrl SampleProviderBase::serviceUrl( ) const
+ {
+ return m_serviceUrl;
+ }
+
+/**
+ * Method to get the URL of the Application providing this service
+ * @return The URL of the Application providing this service
+ */
+QUrl SampleProviderBase::applicationUrl( ) const
+ {
+ return m_applicationUrl;
+ }
+
+/**
+ * Method to get the Icon of the application
+ * @return The Icon of the application
+ */
+QImage SampleProviderBase::applicationIcon( ) const
+ {
+ return m_applicationIcon;
+ }
+
+/**
+ * Method to get the Plugin specific ID
+ * @return The Plugin specific ID
+ */
+QString SampleProviderBase::pluginId( ) const
+ {
+ return m_pluginId;
+ }
+
+/**
+ * Method to get the ID of the authentication application
+ * for this service
+ * @param aProgram The authentication application name
+ * @param aArguments List of arguments required for authentication app
+ * @param aMode Strting mode for authentication application
+ * @return The ID of the authentication application
+ */
+QString SampleProviderBase::authenticationApp( QString &aProgram,
+ QStringList & aArguments,
+ QIODevice::OpenModeFlag aMode ) const
+ {
+ return m_authAppId;
+ }
+
+/**
+ * Method to get the unique registration ID provided by the
+ * Smf for authorised plugins
+ * @return The unique registration ID/token provided by the Smf for
+ * authorised plugins
+ */
+QString SampleProviderBase::smfRegistrationId( ) const
+ {
+ return m_smfRegToken;
+ }
+
+/**
+ * Method to get the data usage of each plugin
+ * @return The data usage structure
+ */
+SmfPluginDataUsage SampleProviderBase::getDataUsage( ) const
+ {
+ return m_dataUsage;
+ }
+
+/**
+ * Method to update the data usage of this plugin. This method is called
+ * after the plugin sends request to Plugin manager and after it receives
+ * data from plugin manager.
+ * @param aBytesSent The number of bytes sent, when this argument has
+ * some value other than 1, aBytesReceived should be zero.
+ * @param aBytesReceived The number of bytes received, when this argument
+ * has some value other than 1, aBytesSent should be zero.
+ * @return Returns true if success else returns false
+ */
+bool SampleProviderBase::updateDataUsage( const uint &aBytesSent,
+ const uint &aBytesReceived )
+ {
+ bool ret = true;
+ if( aBytesSent && !aBytesReceived )
+ m_dataUsage.iBytesSent += aBytesSent;
+ else if( !aBytesSent && aBytesReceived )
+ m_dataUsage.iBytesReceived += aBytesReceived;
+ else
+ // don't update m_dataUsage, error in arguments
+ ret = false;
+
+ return ret;
+ }
+
+/*
+ * Export Macro
+ * plugin name : sampleplugin
+ * plugin class : SamplePlugin
+ */
+//Q_EXPORT_PLUGIN2( sampleplugin, SamplePlugin )
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/example/sampleplugin.h Tue May 18 17:33:55 2010 +0530
@@ -0,0 +1,267 @@
+#ifndef _SAMPLEPLUGIN_H
+#define _SAMPLEPLUGIN_H
+
+// Include files
+#include <QVariant>
+#include <qplugin.h>
+
+#include "smfglobal.h"
+#include "smfpicture.h"
+#include "smfcomment.h"
+#include "smfpluginbase.h"
+#include "smfproviderbase.h"
+#include "smfgalleryplugin.h"
+#include "smfpluginutil.h"
+
+
+// Forward declarations
+class SampleProviderBase;
+
+
+// Class declaration
+class SamplePlugin : public SmfGalleryPlugin
+{
+ Q_OBJECT
+ Q_INTERFACES( SmfGalleryPlugin )
+
+public:
+ /**
+ * Constructor with default argument
+ * @param aUtil The SmfPluginUtil instance. The plugins can
+ * call the method getAuthKeys() of this class, with its pluginID to
+ * get the OAuth keys, keys are returned only if this plugin is
+ * authorised by Smf franework
+ */
+ SamplePlugin( SmfPluginUtil *aUtil );
+
+ /**
+ * Destructor
+ */
+ ~SamplePlugin( );
+
+public: // From SmfGalleryPlugin
+
+ /**
+ * Method to get a list of pictures
+ * @param aRequest [out] The request data to be sent to network
+ * @param aPageNum The page to be extracted
+ * @param aItemsPerPage Number of items per page
+ * @return SmfPluginError Plugin error if any, else SmfPluginErrNone
+ */
+ SmfPluginError pictures( SmfPluginRequestData &aRequest,
+ const int aPageNum = SMF_FIRST_PAGE,
+ const int aItemsPerPage = SMF_ITEMS_PER_PAGE );
+
+ /**
+ * Method to get a description
+ * @param aRequest [out] The request data to be sent to network
+ * @param aImage The image abot which the description is required
+ * @return SmfPluginError Plugin error if any, else SmfPluginErrNone
+ */
+ SmfPluginError description( SmfPluginRequestData &aRequest,
+ const SmfPicture &aImage );
+
+ /**
+ * Method to upload a picture
+ * @param aRequest [out] The request data to be sent to network
+ * @param aImage The image to be uploaded
+ * @return SmfPluginError Plugin error if any, else SmfPluginErrNone
+ */
+ SmfPluginError upload( SmfPluginRequestData &aRequest,
+ const SmfPicture &aImage );
+
+ /**
+ * Method to upload a list of pictures
+ * @param aRequest [out] The request data to be sent to network
+ * @param aImages The list of images to be uploaded
+ * @return SmfPluginError Plugin error if any, else SmfPluginErrNone
+ */
+ SmfPluginError upload( SmfPluginRequestData &aRequest,
+ const QList<SmfPicture> &aImages );
+
+ /**
+ * Method to post comment on a picture is available
+ * @param aRequest [out] The request data to be sent to network
+ * @param aImage The image on which comment is to be posted
+ * @param aComment The comment to be posted
+ * @return SmfPluginError Plugin error if any, else SmfPluginErrNone
+ */
+ SmfPluginError postComment( SmfPluginRequestData &aRequest,
+ const SmfPicture &aImage,
+ const SmfComment &aComment );
+
+public: // From SmfPluginBase
+ /**
+ * Method to get the provider information
+ * @return Instance of SmfProviderBase
+ */
+ SmfProviderBase* getProviderInfo( );
+
+ /**
+ * Method to get the result for a network request.
+ * @param aTransportResult The result of transport operation
+ * @param aReply The QNetworkReply instance for the request
+ * @param aResult [out] An output parameter to the plugin manager.If the
+ * return value is SmfSendRequestAgain, QVariant will be of type
+ * SmfPluginRequestData.
+ * For SmfGalleryPlugin: If last operation was pictures(), aResult will
+ * be of type QList<SmfPicture>. If last operation was description(),
+ * aResult will be of type QString. If last operation was upload() or
+ * postComment(), aResult will be of type bool.
+ * @param aRetType [out] SmfPluginRetType
+ * @param aPageResult [out] The SmfResultPage structure variable
+ */
+ SmfPluginError responseAvailable(
+ const SmfTransportResult &aTransportResult,
+ QNetworkReply *aReply,
+ QVariant* aResult,
+ SmfPluginRetType &aRetType,
+ SmfResultPage &aPageResult );
+
+private:
+ /**
+ * Method called by plugins to generate a request data
+ * @param aRequest [out] The request data to be sent to network
+ * @param aOperation The type of http operation
+ * @param aSignatureMethod The signature method to be used
+ * @param aParams A map of parameters to its values
+ * @param aMode The mode of creation of the request
+ * @param aPostData The data to be posted (for HTTP POST
+ * only, else it will be NULL)
+ * @return SmfPluginError Plugin error if any, else SmfPluginErrNone
+ */
+ SmfPluginError createRequest( SmfPluginRequestData &aRequest,
+ const QNetworkAccessManager::Operation aOperation,
+ const SmfSignatureMethod aSignatureMethod,
+ QMultiMap<QByteArray, QByteArray> &aParams,
+ const SmfParsingMode aMode,
+ QBuffer *aPostData );
+ /**
+ * Function to retrieve registration token supplied by SMF to authentication app.
+ */
+ QString retrievePrivateRegToken();
+private:
+ SampleProviderBase *m_provider;
+ SmfPluginUtil *m_util;
+};
+
+
+// Class declaration
+class SampleProviderBase : public SmfProviderBase
+ {
+ Q_OBJECT
+
+public:
+ /**
+ * Constructor with default argument
+ * @param aParent The parent object
+ */
+ SampleProviderBase( QObject* aParent = 0 );
+
+ /**
+ * Copy Constructor
+ * @param aOther The reference object
+ */
+ SampleProviderBase( const SampleProviderBase &aOther );
+
+ /**
+ * Destructor
+ */
+ ~SampleProviderBase( );
+
+ /**
+ * Method to get the Localisable name of the service.
+ * @return The Localisable name of the service.
+ */
+ QString serviceName( ) const;
+
+ /**
+ * Method to get the Logo of the service
+ * @return The Logo of the service
+ */
+ QImage serviceIcon( ) const;
+
+ /**
+ * Method to get the Readable service description
+ * @return The Readable service description
+ */
+ QString description( ) const;
+
+ /**
+ * Method to get the Website of the service
+ * @return The Website of the service
+ */
+ QUrl serviceUrl( ) const;
+
+ /**
+ * Method to get the URL of the Application providing this service
+ * @return The URL of the Application providing this service
+ */
+ QUrl applicationUrl( ) const;
+
+ /**
+ * Method to get the Icon of the application
+ * @return The Icon of the application
+ */
+ QImage applicationIcon( ) const;
+
+ /**
+ * Method to get the Plugin specific ID
+ * @return The Plugin specific ID
+ */
+ QString pluginId( ) const;
+
+ /**
+ * Method to get the ID of the authentication application
+ * for this service
+ * @param aProgram The authentication application name
+ * @param aArguments List of arguments required for authentication app
+ * @param aMode Strting mode for authentication application
+ * @return The ID of the authentication application
+ */
+ QString authenticationApp( QString &aProgram, QStringList & aArguments,
+ QIODevice::OpenModeFlag aMode = QIODevice::ReadWrite ) const;
+
+ /**
+ * Method to get the unique registration ID provided by the
+ * Smf for authorised plugins
+ * @return The unique registration ID/token provided by the Smf for
+ * authorised plugins
+ */
+ QString smfRegistrationId( ) const;
+
+ /**
+ * Method to get the data usage of each plugin
+ * @return The data usage structure
+ */
+ SmfPluginDataUsage getDataUsage( ) const;
+
+private:
+ /**
+ * Method to update the data usage of this plugin. This method is called
+ * after the plugin sends request to Plugin manager and after it receives
+ * data from plugin manager.
+ * @param aBytesSent The number of bytes sent, when this argument has
+ * some value other than 1, aBytesReceived should be zero.
+ * @param aBytesReceived The number of bytes received, when this argument
+ * has some value other than 1, aBytesSent should be zero.
+ * @return Returns true if success else returns false
+ */
+ bool updateDataUsage( const uint &aBytesSent, const uint &aBytesReceived );
+
+ friend class SamplePlugin;
+
+private:
+ QString m_serviceName;
+ QImage m_serviceIcon;
+ QString m_description;
+ QUrl m_serviceUrl;
+ QUrl m_applicationUrl;
+ QImage m_applicationIcon;
+ QString m_pluginId;
+ QString m_authAppId;
+ QString m_smfRegToken;
+ SmfPluginDataUsage m_dataUsage;
+ };
+
+#endif /*_SAMPLEPLUGIN_H*/
--- a/example/sampleplugin/sampleplugin.cpp Thu Apr 22 15:18:37 2010 +0530
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,511 +0,0 @@
-
-// Include files
-#include "sampleplugin.h"
-#include <QNetworkRequest>
-#include <QNetworkAccessManager>
-#include <qfile.h>
-#include <stdio.h>
-
-/**
- * Constructor with default argument
- * @param aUtil The SmfPluginUtil instance. The plugins can
- * call the method getAuthKeys() of this class, with its pluginID to
- * get the OAuth keys, keys are returned only if this plugin is
- * authorised by Smf franework
- */
-SamplePlugin::SamplePlugin( SmfPluginUtil *aUtil )
- {
- m_provider = new SampleProviderBase();
- m_util = aUtil;
- }
-
-/**
- * Destructor
- */
-SamplePlugin::~SamplePlugin( )
- {
- if(m_provider)
- delete m_provider;
- }
-
-/**
- * Method to get a list of pictures
- * @param aRequest [out] The request data to be sent to network
- * @param aPageNum The page to be extracted
- * @param aItemsPerPage Number of items per page
- * @return SmfPluginError Plugin error if any, else SmfPluginErrNone
- */
-SmfPluginError SamplePlugin::pictures( SmfPluginRequestData &aRequest,
- const int aPageNum,
- const int aItemsPerPage )
- {
- SmfPluginError error = SmfPluginErrInvalidRequest;
-
- // invalid arguments
- if( aPageNum < 0 || aItemsPerPage < 0 )
- return error;
- else
- {
- // Create a map of the arguments keys and their repective values
- QMultiMap<QByteArray, QByteArray> params;
- QString pageNum, itemPerPage;
- pageNum.number(aPageNum);
- itemPerPage.number(aItemsPerPage);
- params.insert("method", "getpictures");
- params.insert("pagenumber", pageNum.toAscii());
- params.insert("itemsperpage", itemPerPage.toAscii());
-
- QNetworkAccessManager::Operation type = QNetworkAccessManager::GetOperation;
- SmfSignatureMethod signMethod = HMAC_SHA1;
- SmfParsingMode mode = ParseForInlineQuery;
-
- error = createRequest(aRequest, type, signMethod, params, mode, NULL);
- }
- return error;
- }
-
-
-/**
- * Method called by plugins to generate a request data
- * @param aRequest [out] The request data to be sent to network
- * @param aOperation The type of http operation
- * @param aSignatureMethod The signature method to be used
- * @param aParams A map of parameters to its values
- * @param aMode The mode of creation of the request
- * @param aPostData The data to be posted (for HTTP POST
- * only, else it will be NULL)
- * @return SmfPluginError Plugin error if any, else SmfPluginErrNone
- */
-SmfPluginError SamplePlugin::createRequest( SmfPluginRequestData &aRequest,
- const QNetworkAccessManager::Operation aOperation,
- const SmfSignatureMethod aSignatureMethod,
- QMultiMap<QByteArray, QByteArray> &aParams,
- const SmfParsingMode aMode,
- QBuffer *aPostData )
- {
- SmfPluginError error;
- QString url = m_provider->serviceUrl().toString();
-
- // Get the oAuth keys from The Smf Server
- QMap<QString, QString> keys;
- QString registrationToken = retrievePrivateRegToken();
- m_util->getAuthKeys(keys, registrationToken, m_provider->pluginId());
-
- // Unable to get the tokens
- if(keys.isEmpty())
- error = SmfPluginErrInvalidApplication;
- else
- {
-
- // Get the token and token secret from keys
- QByteArray token;
- QByteArray tokenSecret;
- token.append(keys.value("oauth_token"));
- tokenSecret.append(keys.value("oauth_token_secret"));
-
- // convert the parameters to string and sign it
- QByteArray content = m_util->createParameterString(url, aOperation, token, tokenSecret,
- aSignatureMethod, aParams, aMode );
-
- // Unable to create the signed string
- if(content.isEmpty())
- error = SmfPluginErrInvalidRequest;
- else
- {
- // add the parameter string to the URL
- url.append(content);
-
- // set the url of the request
- aRequest.iNetworkRequest.setUrl(QUrl(url));
-
- // set the type of http operation to be performed
- aRequest.iHttpOperationType = aOperation;
-
- // As it is a GET operation, set iPostData to NULL
- aRequest.iPostData = aPostData;
-
- // For successful creation of request
- error = SmfPluginErrNone;
- }
- }
- return error;
- }
-
-
-/**
- * Method to get a description
- * @param aRequest [out] The request data to be sent to network
- * @param aImage The image abot which the description is required
- * @return SmfPluginError Plugin error if any, else SmfPluginErrNone
- */
-SmfPluginError SamplePlugin::description( SmfPluginRequestData &aRequest,
- const SmfPicture &aImage )
- {
- SmfPluginError error;
-
- // Create a map of the arguments keys and their repective values
- QMultiMap<QByteArray, QByteArray> params;
- params.insert("method", "getpictureDescription");
- params.insert("photoId", aImage.id().toAscii());
-
- QNetworkAccessManager::Operation type = QNetworkAccessManager::GetOperation;
- SmfSignatureMethod signMethod = HMAC_SHA1;
- SmfParsingMode mode = ParseForInlineQuery;
-
- error = createRequest(aRequest, type, signMethod, params, mode, NULL);
-
- return error;
- }
-
-/**
- * Method to upload a picture
- * @param aRequest [out] The request data to be sent to network
- * @param aImage The image to be uploaded
- * @return SmfPluginError Plugin error if any, else SmfPluginErrNone
- */
-SmfPluginError SamplePlugin::upload( SmfPluginRequestData &aRequest,
- const SmfPicture &aImage )
- {
- SmfPluginError error = SmfPluginErrInvalidRequest;
-
- // Create a map of the arguments keys and their repective values
- QMultiMap<QByteArray, QByteArray> params;
- params.insert("method", "upload");
- params.insert("title", aImage.title().toAscii());
- params.insert("owner", aImage.owner().toAscii());
- params.insert("description", aImage.description().toAscii());
- params.insert("tags", aImage.tags().join(" ").toAscii());
- switch(aImage.visibility())
- {
- case SMFVisibilityFriend:
- params.insert("isFriend", "true");
- break;
- case SMFVisibilityPublic:
- params.insert("isPublic", "true");
- break;
- case SMFVisibilityFamily:
- params.insert("isFamily", "true");
- break;
- case SMFVisibilityGroup:
- params.insert("isGroup", "true");
- break;
- default:// SMFVisibilityPersonal
- params.insert("isPrivate", "true");
- }
-
- QNetworkAccessManager::Operation type = QNetworkAccessManager::PostOperation;
- SmfSignatureMethod signMethod = HMAC_SHA1;
- SmfParsingMode mode = ParseForRequestContent;
-
- // Write the image as png format to the buffer
- QByteArray ba;
- QBuffer buffer(&ba);
- buffer.open(QIODevice::WriteOnly);
- aImage.picture().save(&buffer, "PNG");
-
- error = createRequest(aRequest, type, signMethod, params, mode, &buffer);
-
- return error;
- }
-
-/**
- * Method to upload a list of pictures
- * @param aRequest [out] The request data to be sent to network
- * @param aImages The list of images to be uploaded
- * @return SmfPluginError Plugin error if any, else SmfPluginErrNone
- */
-SmfPluginError SamplePlugin::upload( SmfPluginRequestData &aRequest,
- const QList<SmfPicture> &aImages )
- {
- SmfPluginError error;
-
- for(int index = 0; index < aImages.count(); index++)
- {
- error = upload(aRequest, aImages.value(index));
- if(SmfPluginErrNone != error)
- break;
- }
- return error;
- }
-
-/**
- * Method to post comment on a picture is available
- * @param aRequest [out] The request data to be sent to network
- * @param aImage The image on which comment is to be posted
- * @param aComment The comment to be posted
- * @return SmfPluginError Plugin error if any, else SmfPluginErrNone
- */
-SmfPluginError SamplePlugin::postComment( SmfPluginRequestData &aRequest,
- const SmfPicture &aImage,
- const SmfComment &aComment )
- {
- SmfPluginError error = SmfPluginErrInvalidRequest;
-
- // Create a map of the arguments keys and their repective values
- QMultiMap<QByteArray, QByteArray> params;
- params.insert("method", "postComment");
- params.insert("photoId", aImage.id().toAscii());
- params.insert("comment", "excellent Himalaya");
-
- QNetworkAccessManager::Operation type = QNetworkAccessManager::GetOperation;
- SmfSignatureMethod signMethod = HMAC_SHA1;
- SmfParsingMode mode = ParseForInlineQuery;
-
- error = createRequest(aRequest, type, signMethod, params, mode, NULL);
- return error;
- }
-
-/**
- * This function retrieves the registration token that was provided to Authentication App
- * while authenticatiing user with the service
- *
- * Plugin source codes are not open source - so free to use anything they like
- */
-QString SamplePlugin::retrievePrivateRegToken()
- {
-
- /**
- * This is a private implementation -
- * implementer might choose to use registry to store/retrieve this token
- * or to write encrypted (symmetric) token to a file kept at known dir
- */
- QFile qf("/resource/data/sampleplugindata.dat");
- qf.open(QIODevice::ReadOnly);
- QByteArray qba = qf.read(20);
- qba.chop(5);
- QString rs(qba.toBase64());
- return rs;
- }
-
-
-/**
- * Method to get the provider information
- * @return Instance of SmfProviderBase
- */
-SmfProviderBase* SamplePlugin::getProviderInfo( )
- {
- return m_provider;
- }
-
-/**
- * Method to get the result for a network request.
- * @param aTransportResult The result of transport operation
- * @param aReply The QNetworkReply instance for the request
- * @param aResult [out] An output parameter to the plugin manager.If the
- * return value is SmfSendRequestAgain, QVariant will be of type
- * SmfPluginRequestData.
- * For SmfGalleryPlugin: If last operation was pictures(), aResult will
- * be of type QList<SmfPicture>. If last operation was description(),
- * aResult will be of type QString. If last operation was upload() or
- * postComment(), aResult will be of type bool.
- * @param aRetType [out] SmfPluginRetType
- * @param aPageResult [out] The SmfResultPage structure variable
- */
-SmfPluginError SamplePlugin::responseAvailable(
- const SmfTransportResult &aTransportResult,
- QNetworkReply *aReply,
- QVariant* aResult,
- SmfPluginRetType &aRetType,
- SmfResultPage &aPageResult )
- {
- SmfPluginError error;
- if(SmfTransportOpNoError == aTransportResult)
- {
- // Assuming a JSON response, parse the response
- QByteArray response = aReply->readAll();
- m_provider->updateDataUsage(0, aReply->readBufferSize());
- bool parseResult = false;
- QVariant *result = new QVariant();
- /** see http://qjson.sourceforge.net/usage.html for more details */
- parseResult = m_util->getJsonHandle()->parse(response, &parseResult);
-
- // For parsing error
- if(!parseResult)
- {
- aRetType = SmfRequestError;
- error = SmfPluginErrInvalidRequest;
- }
-
- else
- {
- // The plugins should convert the result to suitable format,
- // like if last operation was pictures(), result should be converted to the
- // type QList<SmfPicture>. If last operation was description(), result should
- // be converted to the type QString. If last operation was upload() or
- // postComment(), result should be converted to the type bool.
-
- // After conversion, assign the value os result to aResult
- aResult = result;
-
- // if the request is complete
- aRetType = SmfRequestComplete;
-
- // if request need to be sent again
- aRetType = SmfSendRequestAgain;
-
- error = SmfPluginErrNone;
- }
- }
- else
- {
- error = SmfPluginErrInvalidRequest;
- aRetType = SmfRequestError;
- }
-
- return error;
- }
-
-
-/**
- * Constructor with default argument
- * @param aParent The parent object
- */
-SampleProviderBase::SampleProviderBase( QObject* aParent )
- : SmfProviderBase(aParent)
- {
- }
-
-/**
- * Copy Constructor
- * @param aOther The reference object
- */
-SampleProviderBase::SampleProviderBase( const SampleProviderBase &aOther )
- {
- }
-
-/**
- * Destructor
- */
-SampleProviderBase::~SampleProviderBase( )
- {
- }
-
-/**
- * Method to get the Localisable name of the service.
- * @return The Localisable name of the service.
- */
-QString SampleProviderBase::serviceName( ) const
- {
- return m_serviceName;
- }
-
-/**
- * Method to get the Logo of the service
- * @return The Logo of the service
- */
-QImage SampleProviderBase::serviceIcon( ) const
- {
- return m_serviceIcon;
- }
-
-/**
- * Method to get the Readable service description
- * @return The Readable service description
- */
-QString SampleProviderBase::description( ) const
- {
- return m_description;
- }
-
-/**
- * Method to get the Website of the service
- * @return The Website of the service
- */
-QUrl SampleProviderBase::serviceUrl( ) const
- {
- return m_serviceUrl;
- }
-
-/**
- * Method to get the URL of the Application providing this service
- * @return The URL of the Application providing this service
- */
-QUrl SampleProviderBase::applicationUrl( ) const
- {
- return m_applicationUrl;
- }
-
-/**
- * Method to get the Icon of the application
- * @return The Icon of the application
- */
-QImage SampleProviderBase::applicationIcon( ) const
- {
- return m_applicationIcon;
- }
-
-/**
- * Method to get the Plugin specific ID
- * @return The Plugin specific ID
- */
-QString SampleProviderBase::pluginId( ) const
- {
- return m_pluginId;
- }
-
-/**
- * Method to get the ID of the authentication application
- * for this service
- * @param aProgram The authentication application name
- * @param aArguments List of arguments required for authentication app
- * @param aMode Strting mode for authentication application
- * @return The ID of the authentication application
- */
-QString SampleProviderBase::authenticationApp( QString &aProgram,
- QStringList & aArguments,
- QIODevice::OpenModeFlag aMode ) const
- {
- return m_authAppId;
- }
-
-/**
- * Method to get the unique registration ID provided by the
- * Smf for authorised plugins
- * @return The unique registration ID/token provided by the Smf for
- * authorised plugins
- */
-QString SampleProviderBase::smfRegistrationId( ) const
- {
- return m_smfRegToken;
- }
-
-/**
- * Method to get the data usage of each plugin
- * @return The data usage structure
- */
-SmfPluginDataUsage SampleProviderBase::getDataUsage( ) const
- {
- return m_dataUsage;
- }
-
-/**
- * Method to update the data usage of this plugin. This method is called
- * after the plugin sends request to Plugin manager and after it receives
- * data from plugin manager.
- * @param aBytesSent The number of bytes sent, when this argument has
- * some value other than 1, aBytesReceived should be zero.
- * @param aBytesReceived The number of bytes received, when this argument
- * has some value other than 1, aBytesSent should be zero.
- * @return Returns true if success else returns false
- */
-bool SampleProviderBase::updateDataUsage( const uint &aBytesSent,
- const uint &aBytesReceived )
- {
- bool ret = true;
- if( aBytesSent && !aBytesReceived )
- m_dataUsage.iBytesSent += aBytesSent;
- else if( !aBytesSent && aBytesReceived )
- m_dataUsage.iBytesReceived += aBytesReceived;
- else
- // don't update m_dataUsage, error in arguments
- ret = false;
-
- return ret;
- }
-
-/*
- * Export Macro
- * plugin name : sampleplugin
- * plugin class : SamplePlugin
- */
-//Q_EXPORT_PLUGIN2( sampleplugin, SamplePlugin )
--- a/example/sampleplugin/sampleplugin.h Thu Apr 22 15:18:37 2010 +0530
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,267 +0,0 @@
-#ifndef _SAMPLEPLUGIN_H
-#define _SAMPLEPLUGIN_H
-
-// Include files
-#include <QVariant>
-#include <qplugin.h>
-
-#include "smfglobal.h"
-#include "smfpicture.h"
-#include "smfcomment.h"
-#include "smfpluginbase.h"
-#include "smfproviderbase.h"
-#include "smfgalleryplugin.h"
-#include "smfpluginutil.h"
-
-
-// Forward declarations
-class SampleProviderBase;
-
-
-// Class declaration
-class SamplePlugin : public SmfGalleryPlugin
-{
- Q_OBJECT
- Q_INTERFACES( SmfGalleryPlugin )
-
-public:
- /**
- * Constructor with default argument
- * @param aUtil The SmfPluginUtil instance. The plugins can
- * call the method getAuthKeys() of this class, with its pluginID to
- * get the OAuth keys, keys are returned only if this plugin is
- * authorised by Smf franework
- */
- SamplePlugin( SmfPluginUtil *aUtil );
-
- /**
- * Destructor
- */
- ~SamplePlugin( );
-
-public: // From SmfGalleryPlugin
-
- /**
- * Method to get a list of pictures
- * @param aRequest [out] The request data to be sent to network
- * @param aPageNum The page to be extracted
- * @param aItemsPerPage Number of items per page
- * @return SmfPluginError Plugin error if any, else SmfPluginErrNone
- */
- SmfPluginError pictures( SmfPluginRequestData &aRequest,
- const int aPageNum = SMF_FIRST_PAGE,
- const int aItemsPerPage = SMF_ITEMS_PER_PAGE );
-
- /**
- * Method to get a description
- * @param aRequest [out] The request data to be sent to network
- * @param aImage The image abot which the description is required
- * @return SmfPluginError Plugin error if any, else SmfPluginErrNone
- */
- SmfPluginError description( SmfPluginRequestData &aRequest,
- const SmfPicture &aImage );
-
- /**
- * Method to upload a picture
- * @param aRequest [out] The request data to be sent to network
- * @param aImage The image to be uploaded
- * @return SmfPluginError Plugin error if any, else SmfPluginErrNone
- */
- SmfPluginError upload( SmfPluginRequestData &aRequest,
- const SmfPicture &aImage );
-
- /**
- * Method to upload a list of pictures
- * @param aRequest [out] The request data to be sent to network
- * @param aImages The list of images to be uploaded
- * @return SmfPluginError Plugin error if any, else SmfPluginErrNone
- */
- SmfPluginError upload( SmfPluginRequestData &aRequest,
- const QList<SmfPicture> &aImages );
-
- /**
- * Method to post comment on a picture is available
- * @param aRequest [out] The request data to be sent to network
- * @param aImage The image on which comment is to be posted
- * @param aComment The comment to be posted
- * @return SmfPluginError Plugin error if any, else SmfPluginErrNone
- */
- SmfPluginError postComment( SmfPluginRequestData &aRequest,
- const SmfPicture &aImage,
- const SmfComment &aComment );
-
-public: // From SmfPluginBase
- /**
- * Method to get the provider information
- * @return Instance of SmfProviderBase
- */
- SmfProviderBase* getProviderInfo( );
-
- /**
- * Method to get the result for a network request.
- * @param aTransportResult The result of transport operation
- * @param aReply The QNetworkReply instance for the request
- * @param aResult [out] An output parameter to the plugin manager.If the
- * return value is SmfSendRequestAgain, QVariant will be of type
- * SmfPluginRequestData.
- * For SmfGalleryPlugin: If last operation was pictures(), aResult will
- * be of type QList<SmfPicture>. If last operation was description(),
- * aResult will be of type QString. If last operation was upload() or
- * postComment(), aResult will be of type bool.
- * @param aRetType [out] SmfPluginRetType
- * @param aPageResult [out] The SmfResultPage structure variable
- */
- SmfPluginError responseAvailable(
- const SmfTransportResult &aTransportResult,
- QNetworkReply *aReply,
- QVariant* aResult,
- SmfPluginRetType &aRetType,
- SmfResultPage &aPageResult );
-
-private:
- /**
- * Method called by plugins to generate a request data
- * @param aRequest [out] The request data to be sent to network
- * @param aOperation The type of http operation
- * @param aSignatureMethod The signature method to be used
- * @param aParams A map of parameters to its values
- * @param aMode The mode of creation of the request
- * @param aPostData The data to be posted (for HTTP POST
- * only, else it will be NULL)
- * @return SmfPluginError Plugin error if any, else SmfPluginErrNone
- */
- SmfPluginError createRequest( SmfPluginRequestData &aRequest,
- const QNetworkAccessManager::Operation aOperation,
- const SmfSignatureMethod aSignatureMethod,
- QMultiMap<QByteArray, QByteArray> &aParams,
- const SmfParsingMode aMode,
- QBuffer *aPostData );
- /**
- * Function to retrieve registration token supplied by SMF to authentication app.
- */
- QString retrievePrivateRegToken();
-private:
- SampleProviderBase *m_provider;
- SmfPluginUtil *m_util;
-};
-
-
-// Class declaration
-class SampleProviderBase : public SmfProviderBase
- {
- Q_OBJECT
-
-public:
- /**
- * Constructor with default argument
- * @param aParent The parent object
- */
- SampleProviderBase( QObject* aParent = 0 );
-
- /**
- * Copy Constructor
- * @param aOther The reference object
- */
- SampleProviderBase( const SampleProviderBase &aOther );
-
- /**
- * Destructor
- */
- ~SampleProviderBase( );
-
- /**
- * Method to get the Localisable name of the service.
- * @return The Localisable name of the service.
- */
- QString serviceName( ) const;
-
- /**
- * Method to get the Logo of the service
- * @return The Logo of the service
- */
- QImage serviceIcon( ) const;
-
- /**
- * Method to get the Readable service description
- * @return The Readable service description
- */
- QString description( ) const;
-
- /**
- * Method to get the Website of the service
- * @return The Website of the service
- */
- QUrl serviceUrl( ) const;
-
- /**
- * Method to get the URL of the Application providing this service
- * @return The URL of the Application providing this service
- */
- QUrl applicationUrl( ) const;
-
- /**
- * Method to get the Icon of the application
- * @return The Icon of the application
- */
- QImage applicationIcon( ) const;
-
- /**
- * Method to get the Plugin specific ID
- * @return The Plugin specific ID
- */
- QString pluginId( ) const;
-
- /**
- * Method to get the ID of the authentication application
- * for this service
- * @param aProgram The authentication application name
- * @param aArguments List of arguments required for authentication app
- * @param aMode Strting mode for authentication application
- * @return The ID of the authentication application
- */
- QString authenticationApp( QString &aProgram, QStringList & aArguments,
- QIODevice::OpenModeFlag aMode = QIODevice::ReadWrite ) const;
-
- /**
- * Method to get the unique registration ID provided by the
- * Smf for authorised plugins
- * @return The unique registration ID/token provided by the Smf for
- * authorised plugins
- */
- QString smfRegistrationId( ) const;
-
- /**
- * Method to get the data usage of each plugin
- * @return The data usage structure
- */
- SmfPluginDataUsage getDataUsage( ) const;
-
-private:
- /**
- * Method to update the data usage of this plugin. This method is called
- * after the plugin sends request to Plugin manager and after it receives
- * data from plugin manager.
- * @param aBytesSent The number of bytes sent, when this argument has
- * some value other than 1, aBytesReceived should be zero.
- * @param aBytesReceived The number of bytes received, when this argument
- * has some value other than 1, aBytesSent should be zero.
- * @return Returns true if success else returns false
- */
- bool updateDataUsage( const uint &aBytesSent, const uint &aBytesReceived );
-
- friend class SamplePlugin;
-
-private:
- QString m_serviceName;
- QImage m_serviceIcon;
- QString m_description;
- QUrl m_serviceUrl;
- QUrl m_applicationUrl;
- QImage m_applicationIcon;
- QString m_pluginId;
- QString m_authAppId;
- QString m_smfRegToken;
- SmfPluginDataUsage m_dataUsage;
- };
-
-#endif /*_SAMPLEPLUGIN_H*/
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/example/smfclientapp/ABLD.BAT Tue May 18 17:33:55 2010 +0530
@@ -0,0 +1,15 @@
+@ECHO OFF
+
+REM Bldmake-generated batch file - ABLD.BAT
+REM ** DO NOT EDIT **
+
+perl -S ABLD.PL "\CarbideWorkspace\smfserver_cleaned\example\smfclientapp\\" %1 %2 %3 %4 %5 %6 %7 %8 %9
+if errorlevel==1 goto CheckPerl
+goto End
+
+:CheckPerl
+perl -v >NUL
+if errorlevel==1 echo Is Perl, version 5.003_07 or later, installed?
+goto End
+
+:End
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/example/smfclientapp/Makefile Tue May 18 17:33:55 2010 +0530
@@ -0,0 +1,243 @@
+# ==============================================================================
+# Generated by qmake (2.01a) (Qt 4.6.1) on: Tue May 18 15:54:38 2010
+# This file is generated by qmake and should not be modified by the
+# user.
+# Name : Makefile
+# Description : Wrapper Makefile for calling Symbian build tools
+#
+# ==============================================================================
+
+
+MAKEFILE = Makefile
+QMAKE = d:\Qt\4.6.1\bin\qmake
+DEL_FILE = del
+DEL_DIR = rmdir
+MOVE = move
+XCOPY = xcopy /d /f /h /r /y /i
+ABLD = ABLD.BAT
+DEBUG_PLATFORMS = winscw gcce armv5 armv6
+RELEASE_PLATFORMS = gcce armv5 armv6
+MAKE = make
+
+ifeq (WINS,$(findstring WINS, $(PLATFORM)))
+ZDIR=$(EPOCROOT)epoc32\release\$(PLATFORM)\$(CFG)\Z
+else
+ZDIR=$(EPOCROOT)epoc32\data\z
+endif
+
+DEFINES = -DSYMBIAN -DUNICODE -DQT_KEYPAD_NAVIGATION -DQT_SOFTKEYS_ENABLED -DQT_USE_MATH_H_FLOATS -DWRITE_LOG -DQT_WEBKIT_LIB -DQT_GUI_LIB -DQT_NETWORK_LIB -DQT_CORE_LIB
+INCPATH = -I"D:/Qt/4.6.1/include/QtCore" -I"D:/Qt/4.6.1/include/QtCore/tmp" -I"D:/Qt/4.6.1/include/QtNetwork" -I"D:/Qt/4.6.1/include/QtNetwork/tmp" -I"D:/Qt/4.6.1/include/QtGui" -I"D:/Qt/4.6.1/include/QtGui/tmp" -I"D:/Qt/4.6.1/include/QtWebKit" -I"D:/Qt/4.6.1/include/QtWebKit/tmp" -I"D:/Qt/4.6.1/include" -I"D:/Qt/4.6.1/include/tmp" -I"D:/CarbideWorkspace/smfserver_cleaned/example/smfclientapp" -I"D:/CarbideWorkspace/smfserver_cleaned/example/smfclientapp/tmp" -I"D:/Qt/4.6.1/mkspecs/common/symbian" -I"D:/Qt/4.6.1/mkspecs/common/symbian/tmp" -I"D:/S60/devices/S60_5th_Edition_SDK_v0.9/epoc32/include" -I"D:/S60/devices/S60_5th_Edition_SDK_v0.9/epoc32/include/stdapis" -I"D:/S60/devices/S60_5th_Edition_SDK_v0.9/epoc32/include/stdapis/sys" -I"D:/S60/devices/S60_5th_Edition_SDK_v0.9/epoc32/include/middleware" -I"D:/S60/devices/S60_5th_Edition_SDK_v0.9/epoc32/include/domain/middleware" -I"D:/S60/devices/S60_5th_Edition_SDK_v0.9/epoc32/include/applications" -I"D:/S60/devices/S60_5th_Edition_SDK_v0.9/epoc32/include/domain/applications" -I"D:/S60/devices/S60_5th_Edition_SDK_v0.9/epoc32/include/domain/middleware/loc" -I"D:/S60/devices/S60_5th_Edition_SDK_v0.9/epoc32/include/stdapis/stlport" -I"D:/Qt/4.6.1/include/QtXmlPatterns" -I"D:/Qt/4.6.1/include/QtXmlPatterns/tmp"
+first: default
+default: debug-winscw
+all: debug release
+
+qmake:
+ $(QMAKE) -spec symbian-abld -o "bld.inf" "D:/CarbideWorkspace/smfserver_cleaned/example/smfclientapp/smfclientapp.pro"
+
+bld.inf:
+ $(QMAKE)
+
+$(ABLD): bld.inf
+ bldmake bldfiles
+
+debug: $(ABLD)
+ $(ABLD) build winscw udeb
+ $(ABLD) build gcce udeb
+ $(ABLD) build armv5 udeb
+ $(ABLD) build armv6 udeb
+
+release: $(ABLD)
+ $(ABLD) build gcce urel
+ $(ABLD) build armv5 urel
+ $(ABLD) build armv6 urel
+
+debug-winscw: $(ABLD)
+ $(ABLD) build winscw udeb
+debug-gcce: $(ABLD)
+ $(ABLD) build gcce udeb
+debug-armv5: $(ABLD)
+ $(ABLD) build armv5 udeb
+debug-armv6: $(ABLD)
+ $(ABLD) build armv6 udeb
+release-gcce: $(ABLD)
+ $(ABLD) build gcce urel
+release-armv5: $(ABLD)
+ $(ABLD) build armv5 urel
+release-armv6: $(ABLD)
+ $(ABLD) build armv6 urel
+
+export: $(ABLD)
+ $(ABLD) export
+
+cleanexport: $(ABLD)
+ $(ABLD) cleanexport
+
+D:\Qt\4.6.1\bin\moc.exe:
+ (cd $(QTDIR)/src/tools/moc && $(MAKE))
+
+mocclean: compiler_moc_header_clean compiler_moc_source_clean
+
+mocables: compiler_moc_header_make_all compiler_moc_source_make_all
+
+compiler_moc_header_make_all: moc_displaywidget.cpp moc_testscreen.cpp moc_smfclientapp.cpp
+compiler_moc_header_clean:
+ -$(DEL_FILE) moc_displaywidget.cpp moc_testscreen.cpp moc_smfclientapp.cpp 2> NUL
+moc_displaywidget.cpp: ui_displaywidget.h \
+ displaywidget.h \
+ ..\..\..\..\Qt\4.6.1\bin\moc.exe
+ D:\Qt\4.6.1\bin\moc.exe $(DEFINES) $(INCPATH) -DSYMBIAN displaywidget.h -o moc_displaywidget.cpp
+
+moc_testscreen.cpp: ui_SmfClientApp.h \
+ testscreen.h \
+ ..\..\..\..\Qt\4.6.1\bin\moc.exe
+ D:\Qt\4.6.1\bin\moc.exe $(DEFINES) $(INCPATH) -DSYMBIAN testscreen.h -o moc_testscreen.cpp
+
+moc_smfclientapp.cpp: ui_SmfClientApp.h \
+ smfclientapp.h \
+ ..\..\..\..\Qt\4.6.1\bin\moc.exe
+ D:\Qt\4.6.1\bin\moc.exe $(DEFINES) $(INCPATH) -DSYMBIAN smfclientapp.h -o moc_smfclientapp.cpp
+
+compiler_rcc_make_all:
+compiler_rcc_clean:
+compiler_image_collection_make_all: qmake_image_collection.cpp
+compiler_image_collection_clean:
+ -$(DEL_FILE) qmake_image_collection.cpp 2> NUL
+compiler_moc_source_make_all:
+compiler_moc_source_clean:
+compiler_uic_make_all: ui_displaywidget.h ui_smfclientapp.h
+compiler_uic_clean:
+ -$(DEL_FILE) ui_displaywidget.h ui_smfclientapp.h 2> NUL
+ui_displaywidget.h: displaywidget.ui
+ d:\Qt\4.6.1\bin\uic.exe displaywidget.ui -o ui_displaywidget.h
+
+ui_smfclientapp.h: smfclientapp.ui
+ d:\Qt\4.6.1\bin\uic.exe smfclientapp.ui -o ui_smfclientapp.h
+
+compiler_yacc_decl_make_all:
+compiler_yacc_decl_clean:
+compiler_yacc_impl_make_all:
+compiler_yacc_impl_clean:
+compiler_lex_make_all:
+compiler_lex_clean:
+compiler_clean: compiler_moc_header_clean compiler_uic_clean
+
+create_temps:
+ -@ if NOT EXIST "D:\Qt\4.6.1\include\QtCore\tmp" mkdir "D:\Qt\4.6.1\include\QtCore\tmp"
+ -@ if NOT EXIST "D:\Qt\4.6.1\include\QtNetwork\tmp" mkdir "D:\Qt\4.6.1\include\QtNetwork\tmp"
+ -@ if NOT EXIST "D:\Qt\4.6.1\include\QtGui\tmp" mkdir "D:\Qt\4.6.1\include\QtGui\tmp"
+ -@ if NOT EXIST "D:\Qt\4.6.1\include\QtWebKit\tmp" mkdir "D:\Qt\4.6.1\include\QtWebKit\tmp"
+ -@ if NOT EXIST "D:\Qt\4.6.1\include\tmp" mkdir "D:\Qt\4.6.1\include\tmp"
+ -@ if NOT EXIST "D:\CarbideWorkspace\smfserver_cleaned\example\smfclientapp\tmp" mkdir "D:\CarbideWorkspace\smfserver_cleaned\example\smfclientapp\tmp"
+ -@ if NOT EXIST "D:\Qt\4.6.1\mkspecs\common\symbian\tmp" mkdir "D:\Qt\4.6.1\mkspecs\common\symbian\tmp"
+ -@ if NOT EXIST "D:\Qt\4.6.1\include\QtXmlPatterns\tmp" mkdir "D:\Qt\4.6.1\include\QtXmlPatterns\tmp"
+
+extension_clean: compiler_clean
+ -@ if EXIST "D:\Qt\4.6.1\include\QtCore\tmp" rmdir /S /Q "D:\Qt\4.6.1\include\QtCore\tmp"
+ -@ if EXIST "D:\Qt\4.6.1\include\QtNetwork\tmp" rmdir /S /Q "D:\Qt\4.6.1\include\QtNetwork\tmp"
+ -@ if EXIST "D:\Qt\4.6.1\include\QtGui\tmp" rmdir /S /Q "D:\Qt\4.6.1\include\QtGui\tmp"
+ -@ if EXIST "D:\Qt\4.6.1\include\QtWebKit\tmp" rmdir /S /Q "D:\Qt\4.6.1\include\QtWebKit\tmp"
+ -@ if EXIST "D:\Qt\4.6.1\include\tmp" rmdir /S /Q "D:\Qt\4.6.1\include\tmp"
+ -@ if EXIST "D:\CarbideWorkspace\smfserver_cleaned\example\smfclientapp\tmp" rmdir /S /Q "D:\CarbideWorkspace\smfserver_cleaned\example\smfclientapp\tmp"
+ -@ if EXIST "D:\Qt\4.6.1\mkspecs\common\symbian\tmp" rmdir /S /Q "D:\Qt\4.6.1\mkspecs\common\symbian\tmp"
+ -@ if EXIST "D:\Qt\4.6.1\include\QtXmlPatterns\tmp" rmdir /S /Q "D:\Qt\4.6.1\include\QtXmlPatterns\tmp"
+
+pre_targetdeps: \
+ generated_sources \
+ all_source_deps \
+ ui_displaywidget.h \
+ ui_smfclientapp.h
+
+generated_sources: \
+ moc_displaywidget.cpp \
+ moc_testscreen.cpp \
+ moc_smfclientapp.cpp
+
+all_source_deps: \
+ displaywidget.h \
+ ui_displaywidget.h \
+ testscreen.h \
+ ui_SmfClientApp.h \
+ SmfClientApp.h
+
+finalize:
+
+winscw_deployment:
+
+winscw_deployment_clean:
+
+sis: restore_build
+ $(if $(wildcard smfclientapp_template.pkg),$(if $(wildcard .make.cache),$(MAKE) -s -f $(MAKEFILE) ok_sis,$(if $(QT_SIS_TARGET),$(MAKE) -s -f $(MAKEFILE) ok_sis,$(MAKE) -s -f $(MAKEFILE) fail_sis_nocache)),$(MAKE) -s -f $(MAKEFILE) fail_sis_nopkg)
+
+ok_sis:
+ createpackage.bat $(QT_SIS_OPTIONS) smfclientapp_template.pkg $(QT_SIS_TARGET) $(QT_SIS_CERTIFICATE) $(QT_SIS_KEY) $(QT_SIS_PASSPHRASE)
+
+fail_sis_nopkg:
+ $(error PKG file does not exist, 'SIS' target is only supported for executables or projects with DEPLOYMENT statement)
+
+fail_sis_nocache:
+ $(error Project has to be built or QT_SIS_TARGET environment variable has to be set before calling 'SIS' target)
+
+restore_build:
+-include .make.cache
+
+store_build:
+ @echo # ============================================================================== > .make.cache
+ @echo # This file is generated by make and should not be modified by the user >> .make.cache
+ @echo # Name : .make.cache >> .make.cache
+ @echo # Part of : smfclientapp >> .make.cache
+ @echo # Description : This file is used to cache last build target for >> .make.cache
+ @echo # make sis target. >> .make.cache
+ @echo # Version : >> .make.cache
+ @echo # >> .make.cache
+ @echo # ============================================================================== >> .make.cache
+ @echo. >> .make.cache
+ @echo QT_SIS_TARGET ?= $(QT_SIS_TARGET) >> .make.cache
+
+dodistclean:
+ -@ if EXIST "d:\CarbideWorkspace\smfserver_cleaned\example\smfclientapp\smfclientapp_template.pkg" $(DEL_FILE) "d:\CarbideWorkspace\smfserver_cleaned\example\smfclientapp\smfclientapp_template.pkg"
+ -@ if EXIST "d:\CarbideWorkspace\smfserver_cleaned\example\smfclientapp\Makefile" $(DEL_FILE) "d:\CarbideWorkspace\smfserver_cleaned\example\smfclientapp\Makefile"
+ -@ if EXIST "d:\CarbideWorkspace\smfserver_cleaned\example\smfclientapp\Makefile_0xE08059D4.mk" $(DEL_FILE) "d:\CarbideWorkspace\smfserver_cleaned\example\smfclientapp\Makefile_0xE08059D4.mk"
+ -@ if EXIST "d:\CarbideWorkspace\smfserver_cleaned\example\smfclientapp\smfclientapp_0xE08059D4.mmp" $(DEL_FILE) "d:\CarbideWorkspace\smfserver_cleaned\example\smfclientapp\smfclientapp_0xE08059D4.mmp"
+ -@ if EXIST "d:\CarbideWorkspace\smfserver_cleaned\example\smfclientapp\smfclientapp_reg.rss" $(DEL_FILE) "d:\CarbideWorkspace\smfserver_cleaned\example\smfclientapp\smfclientapp_reg.rss"
+ -@ if EXIST "d:\CarbideWorkspace\smfserver_cleaned\example\smfclientapp\smfclientapp.rss" $(DEL_FILE) "d:\CarbideWorkspace\smfserver_cleaned\example\smfclientapp\smfclientapp.rss"
+ -@ if EXIST "d:\CarbideWorkspace\smfserver_cleaned\example\smfclientapp\smfclientapp.loc" $(DEL_FILE) "d:\CarbideWorkspace\smfserver_cleaned\example\smfclientapp\smfclientapp.loc"
+ -@ if EXIST "d:\CarbideWorkspace\smfserver_cleaned\example\smfclientapp\.make.cache" $(DEL_FILE) "d:\CarbideWorkspace\smfserver_cleaned\example\smfclientapp\.make.cache"
+ -@ if EXIST "d:\CarbideWorkspace\smfserver_cleaned\example\smfclientapp\bld.inf" $(DEL_FILE) "d:\CarbideWorkspace\smfserver_cleaned\example\smfclientapp\bld.inf"
+
+distclean: clean dodistclean
+
+clean: $(ABLD)
+ -$(ABLD) reallyclean
+ -bldmake clean
+
+clean-debug: $(ABLD)
+ $(ABLD) reallyclean winscw udeb
+ $(ABLD) reallyclean gcce udeb
+ $(ABLD) reallyclean armv5 udeb
+ $(ABLD) reallyclean armv6 udeb
+
+clean-release: $(ABLD)
+ $(ABLD) reallyclean gcce urel
+ $(ABLD) reallyclean armv5 urel
+ $(ABLD) reallyclean armv6 urel
+
+clean-debug-winscw: $(ABLD)
+ $(ABLD) reallyclean winscw udeb
+clean-debug-gcce: $(ABLD)
+ $(ABLD) reallyclean gcce udeb
+clean-debug-armv5: $(ABLD)
+ $(ABLD) reallyclean armv5 udeb
+clean-debug-armv6: $(ABLD)
+ $(ABLD) reallyclean armv6 udeb
+clean-release-gcce: $(ABLD)
+ $(ABLD) reallyclean gcce urel
+clean-release-armv5: $(ABLD)
+ $(ABLD) reallyclean armv5 urel
+clean-release-armv6: $(ABLD)
+ $(ABLD) reallyclean armv6 urel
+
+run:
+ -call /S60/devices/S60_5th_Edition_SDK_v0.9/epoc32/release/winscw/udeb/smfclientapp.exe $(QT_RUN_OPTIONS)
+runonphone: sis
+ runonphone $(QT_RUN_ON_PHONE_OPTIONS) --sis smfclientapp_$(QT_SIS_TARGET).sis smfclientapp.exe $(QT_RUN_OPTIONS)
+
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/example/smfclientapp/bld.inf Tue May 18 17:33:55 2010 +0530
@@ -0,0 +1,24 @@
+// ============================================================================
+// * Makefile for building: smfclientapp
+// * Generated by qmake (2.01a) (Qt 4.6.1) on: 2010-05-18T15:54:38
+// * This file is generated by qmake and should not be modified by the
+// * user.
+// * Project: smfclientapp.pro
+// * Template: app
+// ============================================================================
+
+#define BLD_INF_SMFCLIENTAPP_FA72E4FA
+
+
+prj_platforms
+
+WINSCW GCCE ARMV5 ARMV6
+
+
+prj_mmpfiles
+
+gnumakefile Makefile_0xE08059D4.mk
+smfclientapp_0xE08059D4.mmp
+
+prj_extensions
+
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/example/smfclientapp/displaywidget.cpp Tue May 18 17:33:55 2010 +0530
@@ -0,0 +1,199 @@
+/**
+ * Copyright (c) 2010 Sasken Communication Technologies Ltd.
+ * All rights reserved.
+ * This component and the accompanying materials are made available
+ * under the terms of the "Eclipse Public License v1.0"
+ * which accompanies this distribution, and is available
+ * at the URL "http://www.eclipse.org/legal/epl-v10.html"
+ *
+ * Initial Contributors:
+ * Chandradeep Gandhi, Sasken Communication Technologies Ltd - Initial contribution
+ *
+ * Contributors:
+ * Manasij Roy, Nalina Hariharan
+ */
+
+
+
+#include "displaywidget.h"
+#include <QApplication>
+#include <QDesktopWidget>
+
+DisplayWidget::DisplayWidget(QWidget *parent)
+ : QWidget(parent)
+{
+ ui.setupUi(this);
+ ui.verticalLayout->setGeometry(QApplication::desktop()->availableGeometry());
+ //Add item as and when they are implemented
+ ui.comboBox_intf->addItem("Contact Fetcher");
+ ui.comboBox_intf->addItem("Post Provider");
+// connect(ui.comboBox_intf,
+// SIGNAL(currentIndexChanged(int)),
+// this,
+// SLOT(interfaceSelected(int)));
+ connect(ui.pushButton_intf,SIGNAL(clicked()),this,SLOT(interfaceSelected()));
+ connect(ui.pushButton_SP,SIGNAL(clicked()),this,SLOT(serviceProviderSelected()));
+ connect(ui.pushButton_service,SIGNAL(clicked()),this,SLOT(serviceSelected()));
+ writeLog("Start");
+}
+void DisplayWidget::interfaceSelected()
+ {
+ SmfClient client;
+ //TODO:- PM should use commented interface name instead
+// QString name("org.symbian.smf.client.contact.posts");
+ QString intfName;
+ switch(ui.comboBox_intf->currentIndex())
+ {
+ case 0:
+ intfName = "org.symbian.smf.client.contact.fetcher";
+ break;
+ case 1:
+ intfName = "posts";
+ break;
+ default:
+ //should not reach here!!!!
+ break;
+ }
+ writeLog("Before client.GetServices");
+ providerList= client.GetServices(intfName);
+ ui.comboBox__SP->clear();
+ //add provider names to the combobox
+ for(int i=0; i< providerList->count();i++)
+ {
+ SmfProvider provider = providerList->at(i);
+ ui.comboBox__SP->addItem(provider.serviceName());
+ }
+
+ //logging for debugging purpose
+ writeLog("GetServices count=");
+ QString c = QString::number(providerList->count());
+ writeLog(c);
+ //serviceProviderSelected
+// connect(ui.comboBox__SP,
+// SIGNAL(currentIndexChanged(int)),
+// this,
+// SLOT(serviceProviderSelected(int)));
+ }
+void DisplayWidget::serviceProviderSelected()
+ {
+
+ switch(ui.comboBox_intf->currentIndex())
+ {
+ case 0:
+ ui.comboBox_service->addItem("Get Friend List");
+ //ui.comboBox_3->addItem("Get Group List");
+ break;
+ case 1:
+ ui.comboBox_service->addItem("Get Own Posts");
+ //ui.comboBox_3->addItem("Get Friend's Posts");
+ break;
+ }
+// connect(ui.comboBox_service,
+// SIGNAL(currentIndexChanged(int)),
+// this,
+// SLOT(serviceSelected(int)));
+ }
+void DisplayWidget::serviceSelected()
+ {
+ SmfProvider smfP(providerList->at(ui.comboBox_service->currentIndex()));
+
+ writeLog("Selected SmfProvider=");
+ writeLog(smfP.m_description);
+ writeLog(smfP.m_serviceUrl.toString());
+ writeLog(smfP.m_appUrl.toString());
+ switch(ui.comboBox_intf->currentIndex())
+ {
+ case 1:
+ m_postProvider = new SmfPostProvider(&smfP);
+ //TODO:- it should be nested switch case as there are multiple APIs under one interface
+ //connect to appropriate slot
+ connect(m_postProvider,
+ SIGNAL(postsAvailable(SmfPostList*, SmfError, SmfResultPage)),
+ this,
+ SLOT(showPosts(SmfPostList* , SmfError , SmfResultPage )));
+
+ writeLog("Before m_postProvider->posts=");
+ //request for self posts
+ m_postProvider->posts();
+ break;
+ case 0:
+ m_contactFetcher = new SmfContactFetcher(&smfP);
+ //connect to appropriate slot
+ connect(m_contactFetcher,
+ SIGNAL(friendsListAvailable(SmfContactList*, SmfError , SmfResultPage)),
+ this,
+ SLOT(showFriends(SmfContactList*, SmfError , SmfResultPage)));
+
+ writeLog("Before m_contactFetcher->friends=");
+ //request for friends, excluding paging info
+ m_contactFetcher->friends();
+ break;
+ }
+ }
+void DisplayWidget::showPosts(SmfPostList* postlist, SmfError error, SmfResultPage resultPage)
+ {
+ writeLog("TestScreen::showPosts");
+ ui.listWidget->clear();
+ ui.listWidget->setVerticalScrollBar(ui.verticalScrollBar_list);
+ writeLog("TestScreen::showPosts count=");
+ writeLog(QString::number(postlist->count()));
+ writeLog("Error=");
+ writeLog(QString::number(error));
+ if(error)
+ {
+ QString smferrString("Smf Error code=");
+ smferrString += QString::number(error);
+ QMessageBox::information(this,"Error",smferrString,QMessageBox::Ok);
+ }
+ //display post description
+
+ foreach(SmfPost post, *postlist)
+ {
+ QString desc = post.description();
+ ui.listWidget->addItem(desc);
+ }
+ ui.listWidget->show();
+ }
+void DisplayWidget::showFriends(SmfContactList* frnds, SmfError err, SmfResultPage)
+ {
+ splash.finish(this);
+ writeLog("TestScreen::showFriends count=");
+ writeLog(QString::number(frnds->count()));
+ writeLog("Error=");
+ writeLog(QString::number(err));
+ //display friends
+
+ foreach(SmfContact frnd, *frnds)
+ {
+ //lets display only street
+ QVariant nameVar = frnd.value("Name");
+ QContactName name = nameVar.value<QContactName>();
+ QString fname;
+ QString lname;
+#ifdef OLDER_QT_MOBILITY
+ fname = name.first();
+ lname = name.last();
+#else
+ fname = name.firstName();
+ lname = name.lastName();
+#endif
+
+ ui.listWidget->addItem(fname);
+ }
+ ui.listWidget->show();
+ }
+void DisplayWidget::writeLog(QString log) const
+ {
+#ifdef WRITE_LOG
+ QFile file("c:\\data\\SmfClientLogs.txt");
+ if (!file.open(QIODevice::Append | QIODevice::Text))
+ ;
+ QTextStream out(&file);
+ out << log << "\n";
+ file.close();
+#endif
+ }
+DisplayWidget::~DisplayWidget()
+{
+
+}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/example/smfclientapp/displaywidget.h Tue May 18 17:33:55 2010 +0530
@@ -0,0 +1,57 @@
+/**
+ * Copyright (c) 2010 Sasken Communication Technologies Ltd.
+ * All rights reserved.
+ * This component and the accompanying materials are made available
+ * under the terms of the "Eclipse Public License v1.0"
+ * which accompanies this distribution, and is available
+ * at the URL "http://www.eclipse.org/legal/epl-v10.html"
+ *
+ * Initial Contributors:
+ * Chandradeep Gandhi, Sasken Communication Technologies Ltd - Initial contribution
+ *
+ * Contributors:
+ * Manasij Roy, Nalina Hariharan
+ */
+
+#ifndef DISPLAYWIDGET_H
+#define DISPLAYWIDGET_H
+
+#include <QtGui/QWidget>
+#include "ui_displaywidget.h"
+#include "smfclient.h"
+#include <QFile>
+#include <QMessageBox>
+#include <QTextStream>
+#include <smfcontactfetcher.h>
+#include <smfpostprovider.h>
+#include <QSplashScreen>
+class DisplayWidget : public QWidget
+{
+ Q_OBJECT
+
+public:
+ DisplayWidget(QWidget *parent = 0);
+ ~DisplayWidget();
+ //debugging
+ void writeLog(QString log) const;
+public slots:
+ //void friendsButtonClicked();
+ //void postsButtonClicked();
+ // void showGroups(SmfGroupList* grps, SmfError , SmfResultPage);
+ void showFriends(SmfContactList* frnds, SmfError , SmfResultPage);
+ void showPosts(SmfPostList* postlist, SmfError error, SmfResultPage resultPage);
+ //void getData(int index);
+ void interfaceSelected();
+ void serviceProviderSelected();
+ void serviceSelected();
+private:
+ SmfProvider* m_provider;
+ SmfContactFetcher* m_contactFetcher;
+ SmfPostProvider* m_postProvider;
+ QList<SmfProvider>* providerList;
+ QPixmap pixmap;
+ QSplashScreen splash;
+ Ui::DisplayWidgetClass ui;
+};
+
+#endif // DISPLAYWIDGET_H
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/example/smfclientapp/displaywidget.ui Tue May 18 17:33:55 2010 +0530
@@ -0,0 +1,99 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<ui version="4.0">
+ <class>DisplayWidgetClass</class>
+ <widget class="QWidget" name="DisplayWidgetClass">
+ <property name="geometry">
+ <rect>
+ <x>0</x>
+ <y>0</y>
+ <width>400</width>
+ <height>489</height>
+ </rect>
+ </property>
+ <property name="windowTitle">
+ <string>DisplayWidget</string>
+ </property>
+ <widget class="QWidget" name="verticalLayoutWidget">
+ <property name="geometry">
+ <rect>
+ <x>10</x>
+ <y>10</y>
+ <width>371</width>
+ <height>461</height>
+ </rect>
+ </property>
+ <layout class="QVBoxLayout" name="verticalLayout">
+ <item>
+ <widget class="QLabel" name="label">
+ <property name="text">
+ <string>Select Interface</string>
+ </property>
+ </widget>
+ </item>
+ <item>
+ <widget class="QComboBox" name="comboBox_intf"/>
+ </item>
+ <item>
+ <widget class="QPushButton" name="pushButton_intf">
+ <property name="text">
+ <string>Ok</string>
+ </property>
+ </widget>
+ </item>
+ <item>
+ <widget class="QLabel" name="label_2">
+ <property name="text">
+ <string>Select Service Provider</string>
+ </property>
+ </widget>
+ </item>
+ <item>
+ <widget class="QComboBox" name="comboBox__SP"/>
+ </item>
+ <item>
+ <widget class="QPushButton" name="pushButton_SP">
+ <property name="text">
+ <string>Ok</string>
+ </property>
+ </widget>
+ </item>
+ <item>
+ <widget class="QLabel" name="label_3">
+ <property name="text">
+ <string>Select Service</string>
+ </property>
+ </widget>
+ </item>
+ <item>
+ <widget class="QComboBox" name="comboBox_service"/>
+ </item>
+ <item>
+ <widget class="QPushButton" name="pushButton_service">
+ <property name="text">
+ <string>Ok</string>
+ </property>
+ </widget>
+ </item>
+ <item>
+ <widget class="QListWidget" name="listWidget"/>
+ </item>
+ </layout>
+ </widget>
+ <widget class="QScrollBar" name="verticalScrollBar_list">
+ <property name="geometry">
+ <rect>
+ <x>380</x>
+ <y>242</y>
+ <width>20</width>
+ <height>221</height>
+ </rect>
+ </property>
+ <property name="orientation">
+ <enum>Qt::Vertical</enum>
+ </property>
+ </widget>
+ </widget>
+ <layoutdefault spacing="6" margin="11"/>
+ <resources/>
+ <connections/>
+</ui>
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/example/smfclientapp/main.cpp Tue May 18 17:33:55 2010 +0530
@@ -0,0 +1,44 @@
+/****************************************************************************
+**
+** Trolltech hereby grants a license to use the Qt/Eclipse Integration
+** plug-in (the software contained herein), in binary form, solely for the
+** purpose of creating code to be used with Trolltech's Qt software.
+**
+** Qt Designer is licensed under the terms of the GNU General Public
+** License versions 2.0 and 3.0 ("GPL License"). Trolltech offers users the
+** right to use certain no GPL licensed software under the terms of its GPL
+** Exception version 1.2 (http://trolltech.com/products/qt/gplexception).
+**
+** THIS SOFTWARE IS PROVIDED BY TROLLTECH AND ITS CONTRIBUTORS (IF ANY) "AS
+** IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
+** TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A
+** PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER
+** OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+** EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+** PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
+** PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
+** LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
+** NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
+** SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
+**
+** Since we now have the GPL exception I think that the "special exception
+** is no longer needed. The license text proposed above (other than the
+** special exception portion of it) is the BSD license and we have added
+** the BSD license as a permissible license under the exception.
+**
+****************************************************************************/
+
+#include "displaywidget.h"
+//#include "testscreen.h"
+
+#include <QtGui>
+#include <QApplication>
+
+int main(int argc, char *argv[])
+{
+ QApplication a(argc, argv);
+ DisplayWidget screen;
+ //TestScreen screen;
+ screen.showMaximized();
+ return a.exec();
+}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/example/smfclientapp/smfclientapp.cpp Tue May 18 17:33:55 2010 +0530
@@ -0,0 +1,42 @@
+/****************************************************************************
+**
+** Trolltech hereby grants a license to use the Qt/Eclipse Integration
+** plug-in (the software contained herein), in binary form, solely for the
+** purpose of creating code to be used with Trolltech's Qt software.
+**
+** Qt Designer is licensed under the terms of the GNU General Public
+** License versions 2.0 and 3.0 ("GPL License"). Trolltech offers users the
+** right to use certain no GPL licensed software under the terms of its GPL
+** Exception version 1.2 (http://trolltech.com/products/qt/gplexception).
+**
+** THIS SOFTWARE IS PROVIDED BY TROLLTECH AND ITS CONTRIBUTORS (IF ANY) "AS
+** IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
+** TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A
+** PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER
+** OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+** EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+** PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
+** PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
+** LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
+** NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
+** SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
+**
+** Since we now have the GPL exception I think that the "special exception
+** is no longer needed. The license text proposed above (other than the
+** special exception portion of it) is the BSD license and we have added
+** the BSD license as a permissible license under the exception.
+**
+****************************************************************************/
+
+#include "SmfClientApp.h"
+
+SmfClientApp::SmfClientApp(QWidget *parent)
+ : QWidget(parent)
+{
+ ui.setupUi(this);
+}
+
+SmfClientApp::~SmfClientApp()
+{
+
+}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/example/smfclientapp/smfclientapp.h Tue May 18 17:33:55 2010 +0530
@@ -0,0 +1,49 @@
+/****************************************************************************
+**
+** Trolltech hereby grants a license to use the Qt/Eclipse Integration
+** plug-in (the software contained herein), in binary form, solely for the
+** purpose of creating code to be used with Trolltech's Qt software.
+**
+** Qt Designer is licensed under the terms of the GNU General Public
+** License versions 2.0 and 3.0 ("GPL License"). Trolltech offers users the
+** right to use certain no GPL licensed software under the terms of its GPL
+** Exception version 1.2 (http://trolltech.com/products/qt/gplexception).
+**
+** THIS SOFTWARE IS PROVIDED BY TROLLTECH AND ITS CONTRIBUTORS (IF ANY) "AS
+** IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
+** TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A
+** PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER
+** OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+** EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+** PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
+** PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
+** LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
+** NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
+** SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
+**
+** Since we now have the GPL exception I think that the "special exception
+** is no longer needed. The license text proposed above (other than the
+** special exception portion of it) is the BSD license and we have added
+** the BSD license as a permissible license under the exception.
+**
+****************************************************************************/
+
+#ifndef SMFCLIENTAPP_H
+#define SMFCLIENTAPP_H
+
+#include <QtGui/QWidget>
+#include "ui_SmfClientApp.h"
+
+class SmfClientApp : public QWidget
+{
+ Q_OBJECT
+
+public:
+ SmfClientApp(QWidget *parent = 0);
+ ~SmfClientApp();
+
+private:
+ Ui::SmfClientApp ui;
+};
+
+#endif // SMFCLIENTAPP_H
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/example/smfclientapp/smfclientapp.loc Tue May 18 17:33:55 2010 +0530
@@ -0,0 +1,13 @@
+// ============================================================================
+// * Generated by qmake (2.01a) (Qt 4.6.1) on: 2010-05-18T15:54:38
+// * This file is generated by qmake and should not be modified by the
+// * user.
+// ============================================================================
+
+#ifdef LANGUAGE_SC
+#define STRING_r_short_caption "smfclientapp"
+#define STRING_r_caption "smfclientapp"
+#else
+#define STRING_r_short_caption "smfclientapp"
+#define STRING_r_caption "smfclientapp"
+#endif
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/example/smfclientapp/smfclientapp.pkg Tue May 18 17:33:55 2010 +0530
@@ -0,0 +1,36 @@
+; smfclientapp.pkg generated by qmake at 2010-04-29T11:34:18
+; This file is generated by qmake and should not be modified by the user
+;
+
+; Language
+&EN
+
+; SIS header: name, uid, version
+#{"smfclientapp"},(0xE08059D4),1,0,0
+
+; Localised Vendor name
+%{"Vendor"}
+
+; Unique Vendor name
+:"Vendor"
+
+; Manual PKG pre-rules from PRO files
+; Default HW/platform dependencies
+[0x101F7961],0,0,0,{"S60ProductID"}
+[0x102032BE],0,0,0,{"S60ProductID"}
+[0x102752AE],0,0,0,{"S60ProductID"}
+[0x1028315F],0,0,0,{"S60ProductID"}
+
+; Default dependency to Qt libraries
+(0x2001E61C), 4, 6, 1, {"Qt"}
+; Dependency to Qt Webkit
+(0x200267C2), 4, 6, 1, {"QtWebKit"}
+; Default dependency to QtMobility libraries
+(0x2002AC89), 0, 2, 0, {"QtMobility"}
+
+; Executable and default resource files
+"/S60/devices/S60_5th_Edition_SDK_v0.9/epoc32/release/$(PLATFORM)/$(TARGET)/smfclientapp.exe" - "!:\sys\bin\smfclientapp.exe"
+"/S60/devices/S60_5th_Edition_SDK_v0.9/epoc32/data/z/resource/apps/smfclientapp.rsc" - "!:\resource\apps\smfclientapp.rsc"
+"/S60/devices/S60_5th_Edition_SDK_v0.9/epoc32/data/z/private/10003a3f/import/apps/smfclientapp_reg.rsc" - "!:\private\10003a3f\import\apps\smfclientapp_reg.rsc"
+
+; Manual PKG post-rules from PRO files
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/example/smfclientapp/smfclientapp.pro Tue May 18 17:33:55 2010 +0530
@@ -0,0 +1,29 @@
+TEMPLATE = app
+TARGET = smfclientapp
+DEFINES += WRITE_LOG #\
+ #OLDER_QT_MOBILITY
+QT += core \
+ gui \
+ network \
+ webkit
+CONFIG += mobility
+MOBILITY = contacts \
+ location
+HEADERS += displaywidget.h \
+ testscreen.h \
+ smfclientapp.h
+SOURCES += displaywidget.cpp \
+ testscreen.cpp \
+ smfclientapp_reg.rss \
+ main.cpp \
+ smfclientapp.cpp
+FORMS += displaywidget.ui \
+ smfclientapp.ui
+RESOURCES +=
+symbian:TARGET.UID3 = 0xE08059D4
+symbian:LIBS += -lsmfclient.dll
+symbian:TARGET.CAPABILITY = ReadUserData \
+ WriteUserData \
+ LocalServices \
+ NetworkServices \
+ UserEnvironment
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/example/smfclientapp/smfclientapp.ui Tue May 18 17:33:55 2010 +0530
@@ -0,0 +1,79 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<ui version="4.0">
+ <class>SmfClientApp</class>
+ <widget class="QWidget" name="SmfClientApp">
+ <property name="geometry">
+ <rect>
+ <x>0</x>
+ <y>0</y>
+ <width>340</width>
+ <height>600</height>
+ </rect>
+ </property>
+ <property name="windowTitle">
+ <string>SmfClientApp</string>
+ </property>
+ <widget class="QListWidget" name="listWidget">
+ <property name="geometry">
+ <rect>
+ <x>20</x>
+ <y>230</y>
+ <width>256</width>
+ <height>271</height>
+ </rect>
+ </property>
+ </widget>
+ <widget class="QComboBox" name="comboBox">
+ <property name="geometry">
+ <rect>
+ <x>20</x>
+ <y>90</y>
+ <width>201</width>
+ <height>51</height>
+ </rect>
+ </property>
+ </widget>
+ <widget class="QPushButton" name="pushButton">
+ <property name="geometry">
+ <rect>
+ <x>20</x>
+ <y>150</y>
+ <width>75</width>
+ <height>51</height>
+ </rect>
+ </property>
+ <property name="text">
+ <string>Friends</string>
+ </property>
+ </widget>
+ <widget class="QLabel" name="label">
+ <property name="geometry">
+ <rect>
+ <x>40</x>
+ <y>19</y>
+ <width>271</width>
+ <height>51</height>
+ </rect>
+ </property>
+ <property name="text">
+ <string>Supported Social Networking Sites</string>
+ </property>
+ </widget>
+ <widget class="QPushButton" name="pushButton_2">
+ <property name="geometry">
+ <rect>
+ <x>110</x>
+ <y>150</y>
+ <width>75</width>
+ <height>51</height>
+ </rect>
+ </property>
+ <property name="text">
+ <string>Posts</string>
+ </property>
+ </widget>
+ </widget>
+ <layoutdefault spacing="6" margin="11"/>
+ <resources/>
+ <connections/>
+</ui>
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/example/smfclientapp/smfclientapp_template.pkg Tue May 18 17:33:55 2010 +0530
@@ -0,0 +1,36 @@
+; smfclientapp_template.pkg generated by qmake at 2010-05-18T15:54:38
+; This file is generated by qmake and should not be modified by the user
+;
+
+; Language
+&EN
+
+; SIS header: name, uid, version
+#{"smfclientapp"},(0xE08059D4),1,0,0
+
+; Localised Vendor name
+%{"Vendor"}
+
+; Unique Vendor name
+:"Vendor"
+
+; Manual PKG pre-rules from PRO files
+; Default HW/platform dependencies
+[0x101F7961],0,0,0,{"S60ProductID"}
+[0x102032BE],0,0,0,{"S60ProductID"}
+[0x102752AE],0,0,0,{"S60ProductID"}
+[0x1028315F],0,0,0,{"S60ProductID"}
+
+; Default dependency to Qt libraries
+(0x2001E61C), 4, 6, 1, {"Qt"}
+; Dependency to Qt Webkit
+(0x200267C2), 4, 6, 1, {"QtWebKit"}
+; Default dependency to QtMobility libraries
+(0x2002AC89), 0, 2, 0, {"QtMobility"}
+
+; Executable and default resource files
+"/S60/devices/S60_5th_Edition_SDK_v0.9/epoc32/release/$(PLATFORM)/$(TARGET)/smfclientapp.exe" - "!:\sys\bin\smfclientapp.exe"
+"/S60/devices/S60_5th_Edition_SDK_v0.9/epoc32/data/z/resource/apps/smfclientapp.rsc" - "!:\resource\apps\smfclientapp.rsc"
+"/S60/devices/S60_5th_Edition_SDK_v0.9/epoc32/data/z/private/10003a3f/import/apps/smfclientapp_reg.rsc" - "!:\private\10003a3f\import\apps\smfclientapp_reg.rsc"
+
+; Manual PKG post-rules from PRO files
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/example/smfclientapp/testscreen.cpp Tue May 18 17:33:55 2010 +0530
@@ -0,0 +1,193 @@
+#include "testscreen.h"
+#include "smfclient.h"
+#include <QFile>
+#include <QMessageBox>
+#include <QTextStream>
+
+TestScreen::TestScreen(QWidget *parent)
+ : QWidget(parent)
+{
+ ui.setupUi(this);
+
+ connect(ui.pushButton,SIGNAL(clicked()),this,SLOT(friendsButtonClicked()));
+ connect(ui.pushButton_2,SIGNAL(clicked()),this,SLOT(postsButtonClicked()));
+ writeLog("Start");
+ SmfClient client;
+
+ //Getting list of provider who implement this interface
+// QString name("org.symbian.smf.client.contact.fetcher");
+ //TODO:- PM should use commented interface name instead
+// QString name("org.symbian.smf.client.contact.posts");
+ QString name("posts");
+ writeLog("Before client.GetServices");
+ providerList= client.GetServices(name);
+ //add provider names to the combobox
+ for(int i=0; i< providerList->count();i++)
+ {
+ SmfProvider provider = providerList->at(i);
+ ui.comboBox->addItem(provider.serviceName());
+ }
+
+ //logging for debugging purpose
+ writeLog("GetServices count=");
+ QString c = QString::number(providerList->count());
+ writeLog(c);
+ SmfProvider smfP(providerList->at(0));
+
+ writeLog("0th SmfProvider=");
+ writeLog(smfP.m_description);
+ writeLog(smfP.m_serviceUrl.toString());
+ writeLog(smfP.m_appUrl.toString());
+ m_postProvider = new SmfPostProvider(&smfP);
+ //connect to appropriate slot
+ connect(m_postProvider,
+ SIGNAL(postsAvailable(SmfPostList*, SmfError, SmfResultPage)),
+ this,
+ SLOT(showPosts(SmfPostList* , SmfError , SmfResultPage )));
+
+ writeLog("Before m_postProvider->posts=");
+ //request for self posts
+ m_postProvider->posts();
+}
+void TestScreen::friendsButtonClicked()
+ {
+ ui.listWidget->clear();
+// pixmap.load("c:\\data\\smfpix.bmp");
+// splash.setPixmap(pixmap);
+// splash.show();
+ //get the current index of combobox to get the SmfProvider
+ int providerIndex = ui.comboBox->currentIndex();
+ //now create contact fetcher with 0th
+ SmfProvider smfP(providerList->at(providerIndex));
+
+ writeLog("0th SmfProvider=");
+ writeLog(smfP.m_description);
+ writeLog(smfP.m_serviceUrl.toString());
+ writeLog(smfP.m_appUrl.toString());
+ m_contactFetcher = new SmfContactFetcher(&smfP);
+ //connect to appropriate slot
+ connect(m_contactFetcher,SIGNAL(friendsListAvailable(SmfContactList*, SmfError , SmfResultPage)),
+ this,SLOT(showFriends(SmfContactList*, SmfError , SmfResultPage)));
+ /*connect(m_contactFetcher,SIGNAL(groupListAvailable(SmfGroupList*, SmfError , SmfResultPage)),
+ this,SLOT(showFriends(SmfGroupList*, SmfError , SmfResultPage)));*/
+
+ writeLog("Before m_contactFetcher->friends=");
+ //request for friends, excluding paging info
+ m_contactFetcher->friends();
+ //m_contactFetcher->groups();
+ }
+void TestScreen::postsButtonClicked()
+ {
+ //get the current index of combobox to get the SmfProvider
+ int providerIndex = ui.comboBox->currentIndex();
+ //now create contact fetcher with 0th
+ SmfProvider smfP(providerList->at(providerIndex));
+
+ writeLog("0th SmfProvider=");
+ writeLog(smfP.m_description);
+ writeLog(smfP.m_serviceUrl.toString());
+ writeLog(smfP.m_appUrl.toString());
+ m_postProvider = new SmfPostProvider(&smfP);
+// //connect to appropriate slot
+ connect(m_postProvider,
+ SIGNAL(postsAvailable(SmfPostList*, SmfError, SmfResultPage)),
+ this,
+ SLOT(showPosts(SmfPostList*, SmfError, SmfResultPage)));
+
+ writeLog("Before m_contactFetcher->posts=");
+ //request for self posts
+ m_postProvider->posts();
+ }
+void TestScreen::writeLog(QString log) const
+ {
+#ifdef WRITE_LOG
+ QFile file("c:\\data\\SmfClientLogs.txt");
+ if (!file.open(QIODevice::Append | QIODevice::Text))
+ ;
+ QTextStream out(&file);
+ out << log << "\n";
+ file.close();
+#endif
+ }
+void TestScreen::showGroups(SmfGroupList* grps, SmfError err, SmfResultPage)
+ {
+ writeLog("TestScreen::showFriends count=");
+ writeLog(QString::number(grps->count()));
+ writeLog("Error=");
+ writeLog(QString::number(err));
+ //display friends
+ QMessageBox::information(this,QString("Name"),grps->at(0).name(),QMessageBox::Ok);
+ QMessageBox::information(this,QString("Name"),grps->at(1).name(),QMessageBox::Ok);
+// SmfContact frnd1 = frnds->at(0);
+// SmfContact frnd2 = frnds->at(1);
+// QString name = frnd1.value("Name").toString();
+// QMessageBox::information(this,QString("Name"),name,QMessageBox::Ok);
+// QString name2 = frnd2.value("Name").toString();
+// QMessageBox::information(this,QString("Name"),name2,QMessageBox::Ok);
+// foreach(SmfContact frnd, *frnds)
+// {
+// //lets display only street
+//// QContactNickname name = frnd.value("Nickname").value<QContactNickname>();
+//// QString nick = name.value("Nickname");
+// QString name = frnd.value("Name").toString();
+// QMessageBox::information(this,QString("Name"),name,QMessageBox::Ok);
+// }
+ }
+void TestScreen::showFriends(SmfContactList* frnds, SmfError err, SmfResultPage)
+ {
+ splash.finish(this);
+ writeLog("TestScreen::showFriends count=");
+ writeLog(QString::number(frnds->count()));
+ writeLog("Error=");
+ writeLog(QString::number(err));
+ //display friends
+
+ foreach(SmfContact frnd, *frnds)
+ {
+ //lets display only street
+ QVariant nameVar = frnd.value("Name");
+ QContactName name = nameVar.value<QContactName>();
+// QString nick = name.value("Nickname");
+ QString fname;
+ QString lname;
+#ifdef OLDER_QT_MOBILITY
+ fname = name.first();
+ lname = name.last();
+#else
+ fname = name.firstName();
+ lname = name.lastName();
+#endif
+
+ ui.listWidget->addItem(fname);
+// QMessageBox::information(this,QString("First Name"),fname,QMessageBox::Ok);
+// QMessageBox::information(this,QString("Last Name"),lname,QMessageBox::Ok);
+ }
+ ui.listWidget->show();
+ }
+void TestScreen::showPosts(SmfPostList* postlist, SmfError error, SmfResultPage resultPage)
+ {
+ writeLog("TestScreen::showPosts");
+ ui.listWidget->clear();
+ writeLog("TestScreen::showPosts count=");
+ writeLog(QString::number(postlist->count()));
+ writeLog("Error=");
+ writeLog(QString::number(error));
+ if(error)
+ {
+ QString smferrString("Smf Error code=");
+ smferrString += QString::number(error);
+ QMessageBox::information(this,"Error",smferrString,QMessageBox::Ok);
+ }
+ //display post description
+
+ foreach(SmfPost post, *postlist)
+ {
+ QString desc = post.description();
+ ui.listWidget->addItem(desc);
+ }
+ ui.listWidget->show();
+ }
+TestScreen::~TestScreen()
+{
+
+}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/example/smfclientapp/testscreen.h Tue May 18 17:33:55 2010 +0530
@@ -0,0 +1,34 @@
+#ifndef TESTSCREEN_H
+#define TESTSCREEN_H
+
+#include <QtGui/QWidget>
+#include "ui_SmfClientApp.h"
+#include <smfcontactfetcher.h>
+#include <smfpostprovider.h>
+#include <QSplashScreen>
+class TestScreen : public QWidget
+{
+ Q_OBJECT
+
+public:
+ TestScreen(QWidget *parent = 0);
+ ~TestScreen();
+ //debugging
+ void writeLog(QString log) const;
+public slots:
+ void friendsButtonClicked();
+ void postsButtonClicked();
+ void showGroups(SmfGroupList* grps, SmfError , SmfResultPage);
+ void showFriends(SmfContactList* frnds, SmfError , SmfResultPage);
+ void showPosts(SmfPostList* postlist, SmfError error, SmfResultPage resultPage);
+private:
+ Ui::SmfClientApp ui;
+ SmfProvider* m_provider;
+ SmfContactFetcher* m_contactFetcher;
+ SmfPostProvider* m_postProvider;
+ QList<SmfProvider>* providerList;
+ QPixmap pixmap;
+ QSplashScreen splash;
+};
+
+#endif // TESTSCREEN_H
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/example/smfclientapp/ui_displaywidget.h Tue May 18 17:33:55 2010 +0530
@@ -0,0 +1,137 @@
+/********************************************************************************
+** Form generated from reading UI file 'displaywidget.ui'
+**
+** Created: Fri May 7 18:24:44 2010
+** by: Qt User Interface Compiler version 4.6.1
+**
+** WARNING! All changes made in this file will be lost when recompiling UI file!
+********************************************************************************/
+
+#ifndef UI_DISPLAYWIDGET_H
+#define UI_DISPLAYWIDGET_H
+
+#include <QtCore/QVariant>
+#include <QtGui/QAction>
+#include <QtGui/QApplication>
+#include <QtGui/QButtonGroup>
+#include <QtGui/QComboBox>
+#include <QtGui/QHeaderView>
+#include <QtGui/QLabel>
+#include <QtGui/QListWidget>
+#include <QtGui/QPushButton>
+#include <QtGui/QScrollBar>
+#include <QtGui/QVBoxLayout>
+#include <QtGui/QWidget>
+
+QT_BEGIN_NAMESPACE
+
+class Ui_DisplayWidgetClass
+{
+public:
+ QWidget *verticalLayoutWidget;
+ QVBoxLayout *verticalLayout;
+ QLabel *label;
+ QComboBox *comboBox_intf;
+ QPushButton *pushButton_intf;
+ QLabel *label_2;
+ QComboBox *comboBox__SP;
+ QPushButton *pushButton_SP;
+ QLabel *label_3;
+ QComboBox *comboBox_service;
+ QPushButton *pushButton_service;
+ QListWidget *listWidget;
+ QScrollBar *verticalScrollBar_list;
+
+ void setupUi(QWidget *DisplayWidgetClass)
+ {
+ if (DisplayWidgetClass->objectName().isEmpty())
+ DisplayWidgetClass->setObjectName(QString::fromUtf8("DisplayWidgetClass"));
+ DisplayWidgetClass->resize(400, 489);
+ verticalLayoutWidget = new QWidget(DisplayWidgetClass);
+ verticalLayoutWidget->setObjectName(QString::fromUtf8("verticalLayoutWidget"));
+ verticalLayoutWidget->setGeometry(QRect(10, 10, 371, 461));
+ verticalLayout = new QVBoxLayout(verticalLayoutWidget);
+ verticalLayout->setSpacing(6);
+ verticalLayout->setContentsMargins(11, 11, 11, 11);
+ verticalLayout->setObjectName(QString::fromUtf8("verticalLayout"));
+ verticalLayout->setContentsMargins(0, 0, 0, 0);
+ label = new QLabel(verticalLayoutWidget);
+ label->setObjectName(QString::fromUtf8("label"));
+
+ verticalLayout->addWidget(label);
+
+ comboBox_intf = new QComboBox(verticalLayoutWidget);
+ comboBox_intf->setObjectName(QString::fromUtf8("comboBox_intf"));
+
+ verticalLayout->addWidget(comboBox_intf);
+
+ pushButton_intf = new QPushButton(verticalLayoutWidget);
+ pushButton_intf->setObjectName(QString::fromUtf8("pushButton_intf"));
+
+ verticalLayout->addWidget(pushButton_intf);
+
+ label_2 = new QLabel(verticalLayoutWidget);
+ label_2->setObjectName(QString::fromUtf8("label_2"));
+
+ verticalLayout->addWidget(label_2);
+
+ comboBox__SP = new QComboBox(verticalLayoutWidget);
+ comboBox__SP->setObjectName(QString::fromUtf8("comboBox__SP"));
+
+ verticalLayout->addWidget(comboBox__SP);
+
+ pushButton_SP = new QPushButton(verticalLayoutWidget);
+ pushButton_SP->setObjectName(QString::fromUtf8("pushButton_SP"));
+
+ verticalLayout->addWidget(pushButton_SP);
+
+ label_3 = new QLabel(verticalLayoutWidget);
+ label_3->setObjectName(QString::fromUtf8("label_3"));
+
+ verticalLayout->addWidget(label_3);
+
+ comboBox_service = new QComboBox(verticalLayoutWidget);
+ comboBox_service->setObjectName(QString::fromUtf8("comboBox_service"));
+
+ verticalLayout->addWidget(comboBox_service);
+
+ pushButton_service = new QPushButton(verticalLayoutWidget);
+ pushButton_service->setObjectName(QString::fromUtf8("pushButton_service"));
+
+ verticalLayout->addWidget(pushButton_service);
+
+ listWidget = new QListWidget(verticalLayoutWidget);
+ listWidget->setObjectName(QString::fromUtf8("listWidget"));
+
+ verticalLayout->addWidget(listWidget);
+
+ verticalScrollBar_list = new QScrollBar(DisplayWidgetClass);
+ verticalScrollBar_list->setObjectName(QString::fromUtf8("verticalScrollBar_list"));
+ verticalScrollBar_list->setGeometry(QRect(380, 242, 20, 221));
+ verticalScrollBar_list->setOrientation(Qt::Vertical);
+
+ retranslateUi(DisplayWidgetClass);
+
+ QMetaObject::connectSlotsByName(DisplayWidgetClass);
+ } // setupUi
+
+ void retranslateUi(QWidget *DisplayWidgetClass)
+ {
+ DisplayWidgetClass->setWindowTitle(QApplication::translate("DisplayWidgetClass", "DisplayWidget", 0, QApplication::UnicodeUTF8));
+ label->setText(QApplication::translate("DisplayWidgetClass", "Select Interface", 0, QApplication::UnicodeUTF8));
+ pushButton_intf->setText(QApplication::translate("DisplayWidgetClass", "Ok", 0, QApplication::UnicodeUTF8));
+ label_2->setText(QApplication::translate("DisplayWidgetClass", "Select Service Provider", 0, QApplication::UnicodeUTF8));
+ pushButton_SP->setText(QApplication::translate("DisplayWidgetClass", "Ok", 0, QApplication::UnicodeUTF8));
+ label_3->setText(QApplication::translate("DisplayWidgetClass", "Select Service", 0, QApplication::UnicodeUTF8));
+ pushButton_service->setText(QApplication::translate("DisplayWidgetClass", "Ok", 0, QApplication::UnicodeUTF8));
+ } // retranslateUi
+
+};
+
+namespace Ui {
+ class DisplayWidgetClass: public Ui_DisplayWidgetClass {};
+} // namespace Ui
+
+QT_END_NAMESPACE
+
+#endif // UI_DISPLAYWIDGET_H
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/example/smfclientapp/ui_smfclientapp.h Tue May 18 17:33:55 2010 +0530
@@ -0,0 +1,77 @@
+/********************************************************************************
+** Form generated from reading UI file 'smfclientapp.ui'
+**
+** Created: Fri May 7 15:23:58 2010
+** by: Qt User Interface Compiler version 4.6.1
+**
+** WARNING! All changes made in this file will be lost when recompiling UI file!
+********************************************************************************/
+
+#ifndef UI_SMFCLIENTAPP_H
+#define UI_SMFCLIENTAPP_H
+
+#include <QtCore/QVariant>
+#include <QtGui/QAction>
+#include <QtGui/QApplication>
+#include <QtGui/QButtonGroup>
+#include <QtGui/QComboBox>
+#include <QtGui/QHeaderView>
+#include <QtGui/QLabel>
+#include <QtGui/QListWidget>
+#include <QtGui/QPushButton>
+#include <QtGui/QWidget>
+
+QT_BEGIN_NAMESPACE
+
+class Ui_SmfClientApp
+{
+public:
+ QListWidget *listWidget;
+ QComboBox *comboBox;
+ QPushButton *pushButton;
+ QLabel *label;
+ QPushButton *pushButton_2;
+
+ void setupUi(QWidget *SmfClientApp)
+ {
+ if (SmfClientApp->objectName().isEmpty())
+ SmfClientApp->setObjectName(QString::fromUtf8("SmfClientApp"));
+ SmfClientApp->resize(340, 600);
+ listWidget = new QListWidget(SmfClientApp);
+ listWidget->setObjectName(QString::fromUtf8("listWidget"));
+ listWidget->setGeometry(QRect(20, 230, 256, 271));
+ comboBox = new QComboBox(SmfClientApp);
+ comboBox->setObjectName(QString::fromUtf8("comboBox"));
+ comboBox->setGeometry(QRect(20, 90, 201, 51));
+ pushButton = new QPushButton(SmfClientApp);
+ pushButton->setObjectName(QString::fromUtf8("pushButton"));
+ pushButton->setGeometry(QRect(20, 150, 75, 51));
+ label = new QLabel(SmfClientApp);
+ label->setObjectName(QString::fromUtf8("label"));
+ label->setGeometry(QRect(40, 19, 271, 51));
+ pushButton_2 = new QPushButton(SmfClientApp);
+ pushButton_2->setObjectName(QString::fromUtf8("pushButton_2"));
+ pushButton_2->setGeometry(QRect(110, 150, 75, 51));
+
+ retranslateUi(SmfClientApp);
+
+ QMetaObject::connectSlotsByName(SmfClientApp);
+ } // setupUi
+
+ void retranslateUi(QWidget *SmfClientApp)
+ {
+ SmfClientApp->setWindowTitle(QApplication::translate("SmfClientApp", "SmfClientApp", 0, QApplication::UnicodeUTF8));
+ pushButton->setText(QApplication::translate("SmfClientApp", "Friends", 0, QApplication::UnicodeUTF8));
+ label->setText(QApplication::translate("SmfClientApp", "Supported Social Networking Sites", 0, QApplication::UnicodeUTF8));
+ pushButton_2->setText(QApplication::translate("SmfClientApp", "Posts", 0, QApplication::UnicodeUTF8));
+ } // retranslateUi
+
+};
+
+namespace Ui {
+ class SmfClientApp: public Ui_SmfClientApp {};
+} // namespace Ui
+
+QT_END_NAMESPACE
+
+#endif // UI_SMFCLIENTAPP_H