--- a/example/AuthApp/AuthApp.cpp Thu Aug 05 16:35:33 2010 +0530
+++ b/example/AuthApp/AuthApp.cpp Thu Aug 05 16:46:37 2010 +0530
@@ -19,19 +19,23 @@
#include <QDebug>
#include <QMessageBox>
+#include "keys.h"
AuthApp::AuthApp(QWidget *parent)
: QMainWindow(parent),
ui(new Ui::AuthAppClass)
{
+ qDebug()<<"Inside AuthApp::AuthApp()";
ui->setupUi(this);
//iFBSession = FBSession::sessionForApplication("df51def3e750a350ddb961a70b5ab5ab", "3b86a756f77967dea4674f080fa5d345", QString());
- iFBSession = FBSession::sessionForApplication("ed6d6d36813f0fbae8061776beb68daf", "fb10f1c758fc285b2a6113344ef4c893", QString()); //NArasimha's APP
- //iFBSession = FBSession::sessionForApplication("077fd6b8881f39c2dc23207323cca439", "cb13436999afde9338ecd8b0bfb82508", QString()); //Nalina's App
+ //iFBSession = FBSession::sessionForApplication("ed6d6d36813f0fbae8061776beb68daf", "fb10f1c758fc285b2a6113344ef4c893", QString()); //NArasimha's APP
+ iFBSession = FBSession::sessionForApplication(kApiKey,kApiSecret, QString()); //Nalina's App
+ //iFBSession = FBSession::sessionForApplication("114354298600019", "fb10f1c758fc285b2a6113344ef4c893", QString());//Sid's App
+ //iFBSession = FBSession::sessionForApplication("283d4e964b2754505cbbcf69c1d68f3c", "eb8723a3b5921250df442f9695e6bd29", QString());//Sid's App
connect (iFBSession,SIGNAL(sessionDidLogin(QString)), this, SLOT(sessionDidLogin(QString)));
connect (iFBSession, SIGNAL(sessionDidLogout()), this, SLOT(sessionDidLogout()));
- CheckforLogin();
+ //CheckforLogin();
}
AuthApp::~AuthApp()
@@ -53,6 +57,7 @@
}
void AuthApp::CheckforLogin()
{
+ qDebug()<<"Inside AuthApp::CheckforLogin()";
iLoginDialog = NULL;
if ( !( iFBSession->resume() ) ){
ui->buttonForget->setDisabled(true);
@@ -61,12 +66,13 @@
}
void AuthApp::on_pushButton_clicked()
{
+ qDebug()<<"Inside AuthApp::on_pushButton_clicked()";
iLoginDialog = new FBLoginDialog();
iLoginDialog->show();
}
void AuthApp::sessionDidLogin(QString sessionkey)
{
-
+ qDebug()<<"Inside AuthApp::sessionDidLogin()";
if (iLoginDialog )
{
QMessageBox msgbox;
@@ -89,6 +95,7 @@
void AuthApp::sessionDidLogout()
{
+ qDebug()<<"Inside AuthApp::sessionDidLogout()";
QMessageBox msgbox;
msgbox.setText("logged out successfully!!");
msgbox.exec();
@@ -104,5 +111,6 @@
void AuthApp::on_buttonForget_clicked()
{
+ qDebug()<<"Inside AuthApp::on_buttonForget_clicked()";
iFBSession->logout();
}
--- a/example/AuthApp/AuthApp.loc Thu Aug 05 16:35:33 2010 +0530
+++ b/example/AuthApp/AuthApp.loc Thu Aug 05 16:46:37 2010 +0530
@@ -1,5 +1,5 @@
// ============================================================================
-// * Generated by qmake (2.01a) (Qt 4.6.3) on: 2010-06-22T14:10:40
+// * Generated by qmake (2.01a) (Qt 4.6.2) on: 2010-07-30T14:11:44
// * This file is generated by qmake and should not be modified by the
// * user.
// ============================================================================
--- a/example/AuthApp/AuthApp.pkg Thu Aug 05 16:35:33 2010 +0530
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,34 +0,0 @@
-; Installation file for AuthApp GUI App
-;
-; This is an auto-generated PKG file by Carbide.
-; This file uses variables specific to Carbide builds that will not work
-; on command-line builds. If you want to use this generated PKG file from the
-; command-line tools you will need to modify the variables with the appropriate
-; values: $(EPOCROOT), $(PLATFORM), $(TARGET)
-;
-;Language - standard language definitions
-&EN
-
-; standard SIS file header
-#{"AuthApp"},(0xEFE2FD23),1,0,0
-
-;Localised Vendor name
-%{"Vendor-EN"}
-
-;Unique Vendor name
-:"Vendor"
-
-;Supports Series 60 v 3.0
-[0x101F7961], 0, 0, 0, {"Series60ProductID"}
-
-;Files to install
-;<source> <destination>
-"$(EPOCROOT)Epoc32\release\$(PLATFORM)\$(TARGET)\AuthApp.exe" -"!:\sys\bin\AuthApp.exe"
-"$(EPOCROOT)Epoc32\data\z\private\10003a3f\import\apps\AuthApp_reg.rsc" -"!:\private\10003a3f\import\apps\AuthApp_reg.rsc"
-
-; Add any installation notes if applicable
-;"AuthApp.txt" -"!:\private\EFE2FD23\AuthApp.txt"
-
-;required for application to be covered by backup/restore facility
-"backup_registration.xml" -"!:\private\EFE2FD23\backup_registration.xml"
-
--- a/example/AuthApp/AuthApp.pro Thu Aug 05 16:35:33 2010 +0530
+++ b/example/AuthApp/AuthApp.pro Thu Aug 05 16:46:37 2010 +0530
@@ -6,7 +6,8 @@
webkit \
xml
LIBS += -lsmfcredmgrclient
-HEADERS += progressbar.h \
+HEADERS += inc/keys.h \
+ progressbar.h \
inc/requestSP.h \
inc/xmlParser.h \
inc/sessionSP.h \
@@ -27,7 +28,8 @@
AuthApp.ui
RESOURCES +=
symbian: {
+ TARGET.EPOCHEAPSIZE = 0x020000 \
+ 0x3200000
TARGET.UID3 = 0xEFE2FD23 # Symbian specific, unprotected uid3 from symbiansigned.com
TARGET.CAPABILITY = NetworkServices # Symbian specific, we just need network access
- #ICON = smfdemo.svg
}
--- a/example/AuthApp/AuthApp.rss Thu Aug 05 16:35:33 2010 +0530
+++ b/example/AuthApp/AuthApp.rss Thu Aug 05 16:46:37 2010 +0530
@@ -1,5 +1,5 @@
// ============================================================================
-// * Generated by qmake (2.01a) (Qt 4.6.3) on: 2010-06-22T14:10:40
+// * Generated by qmake (2.01a) (Qt 4.6.2) on: 2010-07-30T14:11:44
// * This file is generated by qmake and should not be modified by the
// * user.
// ============================================================================
--- a/example/AuthApp/AuthApp_installer.pkg Thu Aug 05 16:35:33 2010 +0530
+++ b/example/AuthApp/AuthApp_installer.pkg Thu Aug 05 16:46:37 2010 +0530
@@ -1,11 +1,10 @@
-; AuthApp_installer.pkg generated by qmake at 2010-06-22T14:10:40
+; AuthApp_installer.pkg generated by qmake at 2010-07-30T14:11:44
; This file is generated by qmake and should not be modified by the user
;
; Language
&EN
-
; SIS header: name, uid, version
#{"AuthApp installer"},(0xA000D7CE),1,0,0
@@ -17,15 +16,15 @@
; Manual PKG pre-rules from PRO files
-; Dependency to Qt Webkit
-; Default dependency to Qt libraries
; 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
+; Dependency to Qt Webkit
-"F:/Nokia/devices/Nokia_Symbian3_SDK_v0.8/SMFCode/smf_baseline_22june_latest/example/AuthApp/AuthApp.sis" - "c:\adm\AuthApp.sis"
-@"F:/Qt/4.6.3/smartinstaller.sis",(0x2002CCCD)
+"D:/smf/MissingCode/smfrepo/example/AuthApp/AuthApp.sis" - "c:\adm\AuthApp.sis"
+@"D:/Qt/4.6.2/smartinstaller.sis",(0x2002CCCD)
--- a/example/AuthApp/AuthApp_reg.rss Thu Aug 05 16:35:33 2010 +0530
+++ b/example/AuthApp/AuthApp_reg.rss Thu Aug 05 16:46:37 2010 +0530
@@ -1,5 +1,5 @@
// ============================================================================
-// * Generated by qmake (2.01a) (Qt 4.6.3) on: 2010-06-22T14:10:40
+// * Generated by qmake (2.01a) (Qt 4.6.2) on: 2010-07-30T14:11:44
// * This file is generated by qmake and should not be modified by the
// * user.
// ============================================================================
--- a/example/AuthApp/AuthApp_template.pkg Thu Aug 05 16:35:33 2010 +0530
+++ b/example/AuthApp/AuthApp_template.pkg Thu Aug 05 16:46:37 2010 +0530
@@ -1,11 +1,10 @@
-; AuthApp_template.pkg generated by qmake at 2010-06-22T14:10:40
+; AuthApp_template.pkg generated by qmake at 2010-07-30T14:11:44
; This file is generated by qmake and should not be modified by the user
;
; Language
&EN
-
; SIS header: name, uid, version
#{"AuthApp"},(0xEFE2FD23),1,0,0
@@ -17,20 +16,20 @@
; Manual PKG pre-rules from PRO files
-; Dependency to Qt Webkit
-(0x200267C2), 4, 6, 3, {"QtWebKit"}
-; Default dependency to Qt libraries
-(0x2001E61C), 4, 6, 3, {"Qt"}
; 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, 2, {"Qt"}
+; Dependency to Qt Webkit
+(0x200267C2), 4, 6, 2, {"QtWebKit"}
; Executable and default resource files
-"/Nokia/devices/Nokia_Symbian3_SDK_v0.8/epoc32/release/$(PLATFORM)/$(TARGET)/AuthApp.exe" - "!:\sys\bin\AuthApp.exe"
-"/Nokia/devices/Nokia_Symbian3_SDK_v0.8/epoc32/data/z/resource/apps/AuthApp.rsc" - "!:\resource\apps\AuthApp.rsc"
-"/Nokia/devices/Nokia_Symbian3_SDK_v0.8/epoc32/data/z/private/10003a3f/import/apps/AuthApp_reg.rsc" - "!:\private\10003a3f\import\apps\AuthApp_reg.rsc"
+"/S60/devices/Nokia_Symbian3_SDK_v0.8/epoc32/release/$(PLATFORM)/$(TARGET)/AuthApp.exe" - "!:\sys\bin\AuthApp.exe"
+"/S60/devices/Nokia_Symbian3_SDK_v0.8/epoc32/data/z/resource/apps/AuthApp.rsc" - "!:\resource\apps\AuthApp.rsc"
+"/S60/devices/Nokia_Symbian3_SDK_v0.8/epoc32/data/z/private/10003a3f/import/apps/AuthApp_reg.rsc" - "!:\private\10003a3f\import\apps\AuthApp_reg.rsc"
; Manual PKG post-rules from PRO files
--- a/example/AuthApp/inc/baseDialog.h Thu Aug 05 16:35:33 2010 +0530
+++ b/example/AuthApp/inc/baseDialog.h Thu Aug 05 16:46:37 2010 +0530
@@ -29,8 +29,6 @@
class FBError;
class QNetworkReply;
-#define __WINSCW__
-
const QString KSuccessurl = "http://www.facebook.com/connect/login_success.html";
/**
* The base Dialoggg
@@ -146,7 +144,7 @@
void setTitle ( const QString& aTitle );
virtual void GetSessionKey(const QUrl& aUrl);
-
+ virtual void FetchKeyFromUrl(const QUrl& aUrl);
private:
void createControls();
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/example/AuthApp/inc/keys.h Thu Aug 05 16:46:37 2010 +0530
@@ -0,0 +1,15 @@
+/*
+ * keys.h
+ *
+ * Created on: Jul 16, 2010
+ * Author: satishkk
+ */
+
+#ifndef KEYS_H_
+#define KEYS_H_
+
+static const QString kApiKey = "077fd6b8881f39c2dc23207323cca439";
+static const QString kApiSecret = "cb13436999afde9338ecd8b0bfb82508";
+static const QString kAppId = "118421274862377";
+
+#endif /* KEYS_H_ */
--- a/example/AuthApp/inc/loginDialog.h Thu Aug 05 16:35:33 2010 +0530
+++ b/example/AuthApp/inc/loginDialog.h Thu Aug 05 16:46:37 2010 +0530
@@ -49,7 +49,7 @@
protected:
virtual void dialogWillDisappear();
void GetSessionKey(const QUrl& aUrl);
-
+ void FetchKeyFromUrl(const QUrl& aUrl);
private:
void connectToGetSession(const QString& aToken);
void loadLoginPage();
--- a/example/AuthApp/main.cpp Thu Aug 05 16:35:33 2010 +0530
+++ b/example/AuthApp/main.cpp Thu Aug 05 16:46:37 2010 +0530
@@ -33,9 +33,42 @@
#include <QtGui>
#include <QApplication>
+void debugOutput(QtMsgType type, const char *msg)
+ {
+ QFile logFile("c://data//FaceBookLog.txt");
+ Q_ASSERT(logFile.open( QIODevice::WriteOnly | QIODevice::Text | QIODevice::Append ));
+ QTextStream stream(&logFile);
+
+ switch (type)
+ {
+ case QtDebugMsg:
+ stream<<msg<<"\n";
+ break;
+
+ case QtWarningMsg:
+ stream<<"Warning: ";
+ stream<<msg<<"\n";
+ break;
+
+ case QtCriticalMsg:
+ stream<<"Critical: ";
+ stream<<msg<<"\n";
+ break;
+
+ case QtFatalMsg:
+ stream<<"Fatal: ";
+ stream<<msg<<"\n";
+ break;
+
+ default:;
+ }
+ }
+
int main(int argc, char *argv[])
{
+ qInstallMsgHandler(debugOutput);
QApplication a(argc, argv);
+ qDebug()<<"Inside main()";
AuthApp w;
#if defined(Q_OS_SYMBIAN)
--- a/example/AuthApp/src/baseDialog.cpp Thu Aug 05 16:35:33 2010 +0530
+++ b/example/AuthApp/src/baseDialog.cpp Thu Aug 05 16:46:37 2010 +0530
@@ -15,6 +15,7 @@
* Base class of All dialogs
*/
+#define EMULATORTESTING // UnComment for Emulator build
#include <QNetworkCookie>
#include <QNetworkRequest>
@@ -64,7 +65,7 @@
progressbar = new QProgressBar(this);
layout->addWidget(iWebView);
- layout->addWidget(progressbar);
+ //layout->addWidget(progressbar);
setLayout(layout);
@@ -87,6 +88,7 @@
}
QString FBDialog::generateURL( const QString& aUrl, const QHash<QString, QString>& aParams) const
{
+ qDebug()<<"Inside FBDialog::generateURL()";
QString url ( aUrl );
QStringList pairs;
@@ -111,6 +113,7 @@
QByteArray FBDialog::generatePostBody (const QHash<QString, QString>& aParams) const
{
+ qDebug()<<"Inside FBDialog::generatePostBody()";
QByteArray body;
if (!aParams.count())
@@ -143,6 +146,7 @@
}
void FBDialog::dismiss (bool /*aAnimated*/) {
+ qDebug()<<"Inside FBDialog::dismiss()";
dialogWillDisappear();
iLoadingUrl.clear();
@@ -153,6 +157,7 @@
void FBDialog::dismissWithSuccess( bool aSuccess, bool aAnimated)
{
+ qDebug()<<"Inside FBDialog::dismissWithSuccess()";
if (aSuccess) {
emit dialogDidSucceed();
} else {
@@ -164,6 +169,7 @@
void FBDialog::dismissWithError (const FBError& aError, bool aAnimated)
{
+ qDebug()<<"Inside FBDialog::dismissWithError()";
emit dialogDidFailWithError( aError );
dismiss(aAnimated);
}
@@ -188,11 +194,13 @@
void FBDialog::cancel()
{}
-void FBDialog::load() {}
+void FBDialog::load() {
+ qDebug()<<"Inside FBDialog::load()";
+}
void FBDialog::show()
{
-
+ qDebug()<<"Inside FBDialog::show()";
load();
showMaximized();
dialogWillAppear();
@@ -201,6 +209,7 @@
void FBDialog::loadURL(const QString& aUrl, QNetworkAccessManager::Operation aMethod, const QHash<QString, QString>& aGetParams, const QHash<QString, QString>& aPostParams)
{
+ qDebug()<<"Inside FBDialog::loadURL()";
//proxysettings();
iIgnorePageLoadCompleteEvent = false;
@@ -228,24 +237,38 @@
request.setHeader (QNetworkRequest::ContentTypeHeader, contentType);
body = generatePostBody (aPostParams);
}
- #ifdef __WINSCW__
proxysettings();
- #endif
qDebug()<< "Check URL : " << iLoadingUrl;
iWebView->load ( request, aMethod, body);
-
+
}
void FBDialog::proxysettings()
{
-
+#ifdef EMULATORTESTING
qDebug()<<"proxysettings";
+
+ // Reading the keys, CSM Stubbed - START
+ QFile file("c:\\data\\DoNotShare.txt");
+ if (!file.open(QIODevice::ReadOnly))
+ {
+ qDebug()<<"File to read the windows username and password could not be opened, returning!!!";
+ return;
+ }
+
+ QByteArray arr = file.readAll();
+ QList<QByteArray> list = arr.split(' ');
+ file.close();
+
+ QString username(list[0]);
+ QString password(list[1]);
+
QString httpProxy = "10.1.0.214";//ipwproxy.sasken.com
QString httpPort = "3128";
- QString httpUser ="";/* This could be taken thru an QDialog implmentation to remove the Hard coding */
- QString httpPass ="";/* This could be taken thru an QDialog implmentation to remove the Hard coding */
+ QString httpUser =username;/* This could be taken thru an QDialog implmentation to remove the Hard coding */
+ QString httpPass =password;/* This could be taken thru an QDialog implmentation to remove the Hard coding */
/*==Classes used from Network Module==*/
QNetworkProxy proxy;
@@ -257,7 +280,7 @@
proxy.setPassword(httpPass);
QNetworkProxy::setApplicationProxy(proxy);
-
+#endif
}
void FBDialog::dialogWillAppear() {}
@@ -272,13 +295,16 @@
{
qDebug() << "Loading the url: " << url;
+
proxysettings();
+
iWebView->load(url);
}
void FBDialog::loadStarted()
{
qDebug() << "Load started: " << iWebView->url();
+ layout->addWidget(progressbar);
progressbar->setVisible(true);
}
void FBDialog::loadProgress(int progress)
@@ -289,10 +315,15 @@
{
}
+void FBDialog::FetchKeyFromUrl(const QUrl& aUrl)
+{
+
+}
void FBDialog::loadFinished ( bool ok )
{
qDebug() << "Load " << (ok ? "" : "un") << "successfull for: " << iWebView->url();
progressbar->setVisible(false);
+ layout->removeWidget(progressbar);
if (ok)
{
QString PAth = iWebView->url().toString();
@@ -307,6 +338,7 @@
if(URL.contains("auth_token"))
{
+ qDebug() << "URL contains auth token";
iWebView->setHidden(true);
QMessageBox msgbox;
QString msg ("Logged in Success!!!Complete the Authorization?");
@@ -317,8 +349,13 @@
}
}
+ else if(URL.contains("session_key") && URL.contains("uid"))
+ {
+ FetchKeyFromUrl(iWebView->url());
+ }
else
{
+ qDebug() << "URL doesnt have auth_token field";
iWebView->setHidden(true);
QMessageBox msgbox;
QString msg ("Permissions Success!!!continue login?");
--- a/example/AuthApp/src/loginDialog.cpp Thu Aug 05 16:35:33 2010 +0530
+++ b/example/AuthApp/src/loginDialog.cpp Thu Aug 05 16:46:37 2010 +0530
@@ -15,6 +15,8 @@
* Login Dialog class of Authentication Application
*/
+#include <qdebug.h>
+
#include "authAppConstants.h"
#include "sessionSP.h"
#include "errorCodes.h"
@@ -29,6 +31,7 @@
///////////////////////////////////////////////////////////////////////////////////////////////////
void FBLoginDialog::connectToGetSession(const QString& aToken)
{
+ qDebug()<<"Inside FBLoginDialog::connectToGetSession()";
iGetSessionRequest = FBRequest::requestWithSession(iSession);
connect(iGetSessionRequest, SIGNAL(requestDidLoad(QVariant)), this, SLOT(requestDidLoad(QVariant)));
@@ -55,20 +58,18 @@
void FBLoginDialog::loadLoginPage()
{
+ qDebug()<<"Inside FBLoginDialog::loadLoginPage()";
Dictionary getParams, postParams;
-
- getParams["fbconnect"] = "1";
-
- #ifdef __WINSCW__
- getParams["connect_display"] = "touch";
- #else
- getParams["connect_display"] = "popup";
- #endif
-
getParams["api_key"] = iSession->apiKey();
+ getParams["connect_display"] = "popup";
+ getParams["v"]="1.0";
getParams["next"] = KSuccessurl;
getParams["cancel_url"] = "http://www.facebook.com/connect/login_failure.html";
- getParams["req_perms"] = "read_stream,publish_stream,offline_access";
+ getParams["fbconnect"] = "1";
+ getParams["return_session"]="1"; // Uncomment this to get session in the url
+ getParams["session_key_only"]="1"; // Uncomment this to get session in the url
+ getParams["ext_perm"/*"req_perms"*/] = "read_stream,publish_stream,offline_access,user_photos,friends_photos,user_status,friends_status,user_location,friends_location,user_activities,friends_activities,user_relationships,friends_relationships,read_requests,read_friendlists";
+ // req_perms=read_stream,publish_stream,offline_access
loadURL(kLoginURL,QNetworkAccessManager::GetOperation, getParams, postParams);
@@ -84,11 +85,13 @@
void FBLoginDialog::load()
{
+ qDebug()<<"Inside FBLoginDialog::load()";
loadLoginPage();
}
void FBLoginDialog::dialogWillDisappear()
{
+ qDebug()<<"Inside FBLoginDialog::dialogWillDisappear()";
iGetSessionRequest->cancel();
if (!iSession->isConnected())
@@ -99,6 +102,7 @@
void FBLoginDialog::GetSessionKey(const QUrl& aUrl)
{
+ qDebug()<<"Inside FBLoginDialog::GetSessionKey()";
const QString authToken = "auth_token=";
const QString url ( aUrl.toString() );
@@ -120,12 +124,48 @@
connectToGetSession(token);
}
}
-
+void FBLoginDialog::FetchKeyFromUrl(const QUrl& aUrl)
+{
+ const QString url ( aUrl.toString() );
+ QStringList varList = url.split("{");
+ QString newvar = varList[1];
+ varList.clear();
+ varList = newvar.split(",");
+ QString session_key = varList[0];
+ QString uid = varList[1];
+ QString expires = varList[2];
+ QString secret = varList[3];
+ varList.clear();
+ varList = session_key.split(":");
+ session_key = varList[1];
+ session_key = session_key.mid(1,session_key.length()-2);
+ varList.clear();
+ varList = uid.split(":");
+ uid = varList[1];
+ varList.clear();
+ varList = expires.split(":");
+ expires = varList[1];
+ varList.clear();
+ varList = secret.split(":");
+ secret = varList[1];
+ secret = secret.mid(1,secret.length()-2);
+ varList.clear();
+ qDebug()<<"session_key"<<session_key<<"\n";
+ qDebug()<<"uid"<<uid<<"\n";
+ qDebug()<<"expires"<<expires<<"\n";
+ qDebug()<<"secret"<<secret<<"\n";
+ bool ok = false;
+ uint expiry = expires.toUInt();//.toUInt(&conversionError);
+ QDateTime expiration; expiration.setTime_t( expiry );
+ iSession->beginSession(session_key, secret,expiration);
+ iSession->resume();
+}
///////////////////////////////////////////////////////////////////////////////////////////////////
// slots for signals from FBRequest
void FBLoginDialog::requestDidLoad(const QVariant& aResult)
{
+ qDebug()<<"Inside FBLoginDialog::requestDidLoad";
bool conversionError = false;
QVariantHash object = aResult.toHash();
QString sessionKey = object.value("session_key").toString();
@@ -143,10 +183,12 @@
void FBLoginDialog::requestFailedWithFacebookError (const FBError& aCode )
{
+ qDebug()<<"Inside FBLoginDialog::requestFailedWithFacebookError()";
dismissWithError(aCode, true);
}
void FBLoginDialog::requestFailedWithNetworkError( QNetworkReply::NetworkError aCode )
{
+ qDebug()<<"Inside FBLoginDialog::requestFailedWithNetworkError()";
dismissWithError(aCode, true);
}
--- a/example/AuthApp/src/requestSP.cpp Thu Aug 05 16:35:33 2010 +0530
+++ b/example/AuthApp/src/requestSP.cpp Thu Aug 05 16:46:37 2010 +0530
@@ -70,6 +70,7 @@
void FBRequest::connect()
{
+ qDebug()<<"Inside FBRequest::connect()";
emit requestLoading();
QString url ;
@@ -139,6 +140,7 @@
QString FBRequest::generateGetURL() const
{
+ qDebug()<<"Inside FBRequest::generateGetURL()";
const QUrl url(iUrl);
const QString queryPrefix = url.hasQuery() ? "&" : "?";
@@ -197,6 +199,7 @@
void FBRequest::generatePostBody( QByteArray& body )
{
+ qDebug()<<"Inside FBRequest::generatePostBody()";
QString endLine = "\r\n--" + kStringBoundary + "\r\n";
body.append( "--" + kStringBoundary.toUtf8() + "\r\n" ) ;
@@ -234,6 +237,7 @@
void FBRequest::handleResponseData( const QByteArray& aResponseData )
{
+ qDebug()<<"Inside FBRequest::handleResponseData()";
FBError error;
QVariant result = parseXMLResponse( aResponseData, error);
if (error.code() != 0)
@@ -250,6 +254,7 @@
void FBRequest::post( const QString& aUrl, const Dictionary& aParams)
{
+ qDebug()<<"Inside FBRequest::post()";
iUrl = aUrl;
iParams = aParams;
@@ -258,7 +263,7 @@
void FBRequest::cancel()
{
-
+ qDebug()<<"Inside FBRequest::cancel()";
}
@@ -303,6 +308,7 @@
QVariant FBRequest::parseXMLResponse ( const QByteArray& aResponseData, FBError& aError)
{
+ qDebug()<<"Inside FBRequest::handleResponseData()";
QXmlInputSource input;
input.setData(aResponseData);
@@ -348,7 +354,7 @@
void FBRequest::networkReplyFinished ()
{
-
+qDebug()<<"Inside FBRequest::networkReplyFinished()";
QNetworkReply* reply = static_cast<QNetworkReply*> ( sender() );
QByteArray responseData = reply->readAll();
--- a/example/AuthApp/src/sessionSP.cpp Thu Aug 05 16:35:33 2010 +0530
+++ b/example/AuthApp/src/sessionSP.cpp Thu Aug 05 16:46:37 2010 +0530
@@ -20,12 +20,16 @@
#include <qfile.h>
#include <QTimer>
#include <qdebug.h>
+
+#include "keys.h"
+
///////////////////////////////////////////////////////////////////////////////////////////////////
// global
static const QString kAPIRestURL = "http://api.facebook.com/restserver.php";
static const QString kAPIRestSecureURL = "https://api.facebook.com/restserver.php";
+
static const int kMaxBurstRequests = 3;
static const int kBurstDuration = 2;
@@ -93,6 +97,7 @@
void FBSession::beginSession (const QString& aSessionKey, const QString& aSessionSecret, const QDateTime& aExpires )
{
+ qDebug()<<"Inside FBSession::beginSession()";
iSessionKey = aSessionKey;
iSessionSecret = aSessionSecret;
@@ -104,10 +109,11 @@
bool FBSession::resume()
{
- QString CMRegToken = iSettings.value("CMRegToken").toString();
- QDateTime ExpiryTime = iSettings.value("ExpiryTime").toDateTime();
+ qDebug()<<"Inside FBSession::resume()";
+ QString fbCMRegToken = iSettings.value("FBCMRegToken").toString();
+ QDateTime fbExpiryTime = iSettings.value("FBExpiryTime").toDateTime();
SmfAuthParams Params;
- if(m_Client->AuthDataSet(CMRegToken,ExpiryTime,Params))
+ if(m_Client->AuthDataSet(fbCMRegToken,fbExpiryTime,Params))
{
QByteArray accessToken = Params.value("accessToken");
emit sessionDidLogin( accessToken );
@@ -117,13 +123,14 @@
}
void FBSession::cancelLogin() {
+ qDebug()<<"Inside FBSession::cancelLogin()";
if (!isConnected()) {
emit sessionDidNotLogin();
}
}
void FBSession::logout() {
-
+ qDebug()<<"Inside FBSession::logout()";
iExpirationDate = QDateTime();
iSessionKey.clear();
iSessionSecret.clear();
@@ -134,6 +141,7 @@
}
void FBSession::send (FBRequest* aRequest) {
+ qDebug()<<"Inside FBSession::send()";
performRequest (aRequest, true);
}
@@ -142,15 +150,23 @@
// instance private functions
void FBSession::save()
{
-
+ qDebug()<<"Inside FBSession::save()";
SmfAuthParams Params;
- Params.insert("accessToken",iSessionKey.toAscii());
+ Params.insert("ApiKey",kApiKey.toAscii());
+ Params.insert("ApiSecret",kApiSecret.toAscii());
+ Params.insert("AppId",kAppId.toAscii());
+ Params.insert("SessionKey",iSessionKey.toAscii());
+ Params.insert("SessionSecret",iSessionSecret.toAscii());
+
QList<QUrl> UrlList;
+ UrlList.append(QUrl("http://api.facebook.com"));
UrlList.append(QUrl("http://www.facebook.com"));
QStringList PluginList;
- PluginList.append(QString("facebook"));
+ PluginList.append(QString("fbactivityfetcherplugin.qtplugin"));
+ PluginList.append(QString("fbcontactfetcherplugin.qtplugin"));
+ PluginList.append(QString("fbpostproviderplugin.qtplugin"));
QString UID("0xEFE2FD23");
@@ -158,16 +174,21 @@
iExpirationDate = QDateTime::currentDateTime();
iExpirationDate.addYears(1);
- QString CMRegToken = m_Client->StoreAuthData(Params,iExpirationDate,UrlList,PluginList,UID,true);
+ QString fbCMRegToken = m_Client->StoreAuthData(Params,iExpirationDate,UrlList,PluginList,UID,true);
+ qDebug()<<"Reg token returned by auth app = "<<fbCMRegToken;
- if(CMRegToken.size()){
- iSettings.setValue("CMRegToken", CMRegToken);
- iSettings.setValue("ExpiryTime", iExpirationDate);
+ iSettings.remove("FBCMRegToken");
+ iSettings.remove("FBExpiryTime");
+
+ if(fbCMRegToken.size()){
+ iSettings.setValue("FBCMRegToken", fbCMRegToken);
+ iSettings.setValue("FBExpiryTime", iExpirationDate);
}
}
void FBSession::unsave()
{
+ qDebug()<<"Inside FBSession::unsave()";
//Delete saved keys from Credential Manager.
}
--- a/example/AuthApp/ui_AuthApp.h Thu Aug 05 16:35:33 2010 +0530
+++ b/example/AuthApp/ui_AuthApp.h Thu Aug 05 16:46:37 2010 +0530
@@ -1,8 +1,8 @@
/********************************************************************************
** Form generated from reading UI file 'AuthApp.ui'
**
-** Created: Tue Jun 22 13:45:16 2010
-** by: Qt User Interface Compiler version 4.6.3
+** Created: Fri Jul 30 14:06:33 2010
+** by: Qt User Interface Compiler version 4.6.2
**
** WARNING! All changes made in this file will be lost when recompiling UI file!
********************************************************************************/
--- a/example/AuthApp/ui_progressbar.h Thu Aug 05 16:35:33 2010 +0530
+++ b/example/AuthApp/ui_progressbar.h Thu Aug 05 16:46:37 2010 +0530
@@ -1,8 +1,8 @@
/********************************************************************************
** Form generated from reading UI file 'progressbar.ui'
**
-** Created: Tue Jun 22 13:45:04 2010
-** by: Qt User Interface Compiler version 4.6.3
+** Created: Fri Jul 30 14:06:30 2010
+** by: Qt User Interface Compiler version 4.6.2
**
** WARNING! All changes made in this file will be lost when recompiling UI file!
********************************************************************************/
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/example/FlickrAuthApp/AuthApp.cpp Thu Aug 05 16:46:37 2010 +0530
@@ -0,0 +1,113 @@
+/**
+* Copyright (c) 2010 Sasken Communication Technologies Ltd.
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of the "{License}"
+* which accompanies this distribution, and is available
+* at the URL "{LicenseUrl}".
+*
+* Initial Contributors:
+* Narasimhulu Kavadapu, Sasken Communication Technologies Ltd - Initial contribution
+*
+* Contributors:
+*
+* Description:
+* UI Class of Authentication Application
+*/
+
+#include "AuthApp.h"
+#include <QDebug>
+#include <QMessageBox>
+
+#include "keys.h"
+
+AuthApp::AuthApp(QWidget *parent)
+ : QMainWindow(parent),
+ ui(new Ui::AuthAppClass)
+{
+ ui->setupUi(this);
+ //iFBSession = FBSession::sessionForApplication("df51def3e750a350ddb961a70b5ab5ab", "3b86a756f77967dea4674f080fa5d345", QString());
+ //iFBSession = FBSession::sessionForApplication("114354298600019", "fb10f1c758fc285b2a6113344ef4c893", QString()); //Facebook keys
+ //iFBSession = FBSession::sessionForApplication("697207f5f3610334e02d828450e66589", "520edd7afff9b79f", QString()); //Flickr Mobile Based
+ //iFBSession = FBSession::sessionForApplication("2d03ca48309291ee6815410c3a5bb278", "1bb754981c7c6974", QString()); //Flickr Web based
+ iFBSession = FBSession::sessionForApplication(kApiKey,kApiSecret, QString()); //Flickr Web based
+ connect (iFBSession, SIGNAL(sessionDidLogout()), this, SLOT(sessionDidLogout()));
+ connect (iFBSession,SIGNAL(sessionDidLogin(QString)), this, SLOT(sessionDidLogin(QString)));
+
+ //CheckforLogin();
+}
+
+AuthApp::~AuthApp()
+{
+ delete iFBSession;
+ delete ui;
+}
+
+void AuthApp::changeEvent(QEvent *e)
+{
+ QMainWindow::changeEvent(e);
+ switch (e->type()) {
+ case QEvent::LanguageChange:
+ ui->retranslateUi(this);
+ break;
+ default:
+ break;
+ }
+}
+void AuthApp::CheckforLogin()
+{
+ iLoginDialog = NULL;
+ if ( !( iFBSession->resume() ) ){
+ ui->buttonForget->setDisabled(true);
+ ui->pushButton->setEnabled(true);
+ }
+}
+void AuthApp::on_pushButton_clicked()
+{
+ qDebug()<<"Inside AuthApp::on_pushButton_clicked";
+ iLoginDialog = new FBLoginDialog();
+ iLoginDialog->connecttoGetFrob();
+
+}
+void AuthApp::sessionDidLogin(QString Token)
+{
+
+ if (iLoginDialog )
+ {
+ QMessageBox msgbox;
+ QString msg ("Authorization completes!!");
+ msgbox.setText(msg);
+ msgbox.exec();
+
+ iLoginDialog->deleteLater();
+ iLoginDialog = NULL;
+ }else{
+ QMessageBox msgbox;
+ QString msg ("your already authorized,Please logout and Login again for new authorization!!");
+ msgbox.setText(msg);
+ msgbox.exec();
+ }
+
+ ui->pushButton->setDisabled(true);
+ ui->buttonForget->setEnabled(true);
+}
+
+void AuthApp::sessionDidLogout()
+{
+ QMessageBox msgbox;
+ msgbox.setText("logged out successfully!!");
+ msgbox.exec();
+
+ ui->pushButton->setEnabled(true);
+ ui->buttonForget->setDisabled(true);
+
+}
+void AuthApp::requestFailedWithFacebookError ( const FBError& aError )
+{
+ qDebug() << "facebook error is " << aError.code() << " - " << aError.description();
+}
+
+void AuthApp::on_buttonForget_clicked()
+{
+ iFBSession->logout();
+}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/example/FlickrAuthApp/AuthApp.h Thu Aug 05 16:46:37 2010 +0530
@@ -0,0 +1,54 @@
+/**
+* Copyright (c) 2010 Sasken Communication Technologies Ltd.
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of the "{License}"
+* which accompanies this distribution, and is available
+* at the URL "{LicenseUrl}".
+*
+* Initial Contributors:
+* Narasimhulu Kavadapu, Sasken Communication Technologies Ltd - Initial contribution
+*
+* Contributors:
+*
+* Description:
+* UI Class of Authentication Application
+*/
+
+#ifndef AUTHAPP_H
+#define AUTHAPP_H
+
+#include <QtGui/QMainWindow>
+#include "ui_AuthApp.h"
+#include "errorCodes.h"
+#include "loginDialog.h"
+#include "sessionSP.h"
+
+class AuthApp : public QMainWindow
+{
+ Q_OBJECT
+
+public:
+ AuthApp(QWidget *parent = 0);
+ ~AuthApp();
+private:
+ void CheckforLogin();
+private slots:
+ void on_buttonForget_clicked();
+ void on_pushButton_clicked();
+
+ void sessionDidLogin(QString sessionkey);
+ void sessionDidLogout();
+
+ void requestFailedWithFacebookError ( const FBError& aError );
+
+protected:
+ void changeEvent(QEvent *e);
+
+private:
+ FBSession* iFBSession;
+ FBLoginDialog* iLoginDialog;
+ Ui::AuthAppClass *ui;
+};
+
+#endif // AUTHAPP_H
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/example/FlickrAuthApp/AuthApp.loc Thu Aug 05 16:46:37 2010 +0530
@@ -0,0 +1,13 @@
+// ============================================================================
+// * Generated by qmake (2.01a) (Qt 4.6.1) on: 2010-06-23T11:36:56
+// * This file is generated by qmake and should not be modified by the
+// * user.
+// ============================================================================
+
+#ifdef LANGUAGE_SC
+#define STRING_r_short_caption "AuthApp"
+#define STRING_r_caption "AuthApp"
+#else
+#define STRING_r_short_caption "AuthApp"
+#define STRING_r_caption "AuthApp"
+#endif
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/example/FlickrAuthApp/AuthApp.ui Thu Aug 05 16:46:37 2010 +0530
@@ -0,0 +1,50 @@
+<ui version="4.0" >
+ <class>AuthAppClass</class>
+ <widget class="QMainWindow" name="AuthAppClass" >
+ <property name="geometry" >
+ <rect>
+ <x>0</x>
+ <y>0</y>
+ <width>275</width>
+ <height>310</height>
+ </rect>
+ </property>
+ <property name="windowTitle" >
+ <string>MainWindow</string>
+ </property>
+ <widget class="QWidget" name="centralWidget" >
+ <layout class="QVBoxLayout" name="verticalLayout" >
+ <item>
+ <widget class="QPushButton" name="buttonForget" >
+ <property name="text" >
+ <string>Logout</string>
+ </property>
+ </widget>
+ </item>
+ <item>
+ <widget class="QPushButton" name="pushButton" >
+ <property name="text" >
+ <string>Login to Flickr</string>
+ </property>
+ </widget>
+ </item>
+ <item>
+ <spacer name="verticalSpacer" >
+ <property name="orientation" >
+ <enum>Qt::Vertical</enum>
+ </property>
+ <property name="sizeHint" stdset="0" >
+ <size>
+ <width>20</width>
+ <height>40</height>
+ </size>
+ </property>
+ </spacer>
+ </item>
+ </layout>
+ </widget>
+ </widget>
+ <layoutdefault spacing="6" margin="11" />
+ <resources/>
+ <connections/>
+</ui>
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/example/FlickrAuthApp/Flickr.loc Thu Aug 05 16:46:37 2010 +0530
@@ -0,0 +1,13 @@
+// ============================================================================
+// * Generated by qmake (2.01a) (Qt 4.6.2) on: 2010-07-30T14:11:44
+// * This file is generated by qmake and should not be modified by the
+// * user.
+// ============================================================================
+
+#ifdef LANGUAGE_SC
+#define STRING_r_short_caption "Flickr"
+#define STRING_r_caption "Flickr"
+#else
+#define STRING_r_short_caption "Flickr"
+#define STRING_r_caption "Flickr"
+#endif
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/example/FlickrAuthApp/Flickr.rss Thu Aug 05 16:46:37 2010 +0530
@@ -0,0 +1,21 @@
+// ============================================================================
+// * Generated by qmake (2.01a) (Qt 4.6.2) on: 2010-07-30T14:11:44
+// * This file is generated by qmake and should not be modified by the
+// * user.
+// ============================================================================
+
+#include <appinfo.rh>
+#include "Flickr.loc"
+
+RESOURCE LOCALISABLE_APP_INFO r_localisable_app_info
+ {
+ short_caption = STRING_r_short_caption;
+ caption_and_icon =
+ CAPTION_AND_ICON_INFO
+ {
+ caption = STRING_r_caption;
+ number_of_icons = 0;
+ icon_file = "";
+ };
+ }
+
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/example/FlickrAuthApp/FlickrAuthApp.pro Thu Aug 05 16:46:37 2010 +0530
@@ -0,0 +1,39 @@
+TEMPLATE = app
+TARGET = Flickr
+QT += core \
+ gui \
+ network \
+ webkit \
+ xml
+LIBS += -lsmfcredmgrclient
+HEADERS += inc/keys.h \
+ Flickr.loc \
+ progressbar.h \
+ inc/requestSP.h \
+ inc/xmlParser.h \
+ inc/sessionSP.h \
+ inc/loginDialog.h \
+ inc/errorCodes.h \
+ inc/baseDialog.h \
+ inc/authAppConstants.h \
+ inc/keys.h \
+ AuthApp.h
+SOURCES += Flickr_reg.rss \
+ Flickr.rss \
+ progressbar.cpp \
+ src/requestSP.cpp \
+ src/xmlParser.cpp \
+ src/sessionSP.cpp \
+ src/loginDialog.cpp \
+ src/baseDialog.cpp \
+ main.cpp \
+ AuthApp.cpp
+FORMS += progressbar.ui \
+ AuthApp.ui
+RESOURCES +=
+symbian: {
+ TARGET.EPOCHEAPSIZE = 0x020000 \
+ 0x3200000
+ TARGET.UID3 = 0xE1D8C7D7 # Symbian specific, unprotected uid3 from symbiansigned.com
+ TARGET.CAPABILITY = NetworkServices # Symbian specific, we just need network access
+}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/example/FlickrAuthApp/Flickr_installer.pkg Thu Aug 05 16:46:37 2010 +0530
@@ -0,0 +1,30 @@
+; Flickr_installer.pkg generated by qmake at 2010-07-30T14:11:44
+; This file is generated by qmake and should not be modified by the user
+;
+
+; Language
+&EN
+
+; SIS header: name, uid, version
+#{"Flickr installer"},(0xA000D7CE),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
+; Dependency to Qt Webkit
+
+
+"D:/smf/MissingCode/smfrepo/example/FlickrAuthApp/Flickr.sis" - "c:\adm\Flickr.sis"
+@"D:/Qt/4.6.2/smartinstaller.sis",(0x2002CCCD)
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/example/FlickrAuthApp/Flickr_reg.rss Thu Aug 05 16:46:37 2010 +0530
@@ -0,0 +1,18 @@
+// ============================================================================
+// * Generated by qmake (2.01a) (Qt 4.6.2) on: 2010-07-30T14:11:44
+// * This file is generated by qmake and should not be modified by the
+// * user.
+// ============================================================================
+
+#include <Flickr.rsg>
+#include <appinfo.rh>
+
+UID2 KUidAppRegistrationResourceFile
+UID3 0xE1D8C7D7
+
+RESOURCE APP_REGISTRATION_INFO
+ {
+ app_file="Flickr";
+ localisable_resource_file="\\resource\\apps\\Flickr";
+
+ }
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/example/FlickrAuthApp/Flickr_template.pkg Thu Aug 05 16:46:37 2010 +0530
@@ -0,0 +1,35 @@
+; Flickr_template.pkg generated by qmake at 2010-07-30T14:11:44
+; This file is generated by qmake and should not be modified by the user
+;
+
+; Language
+&EN
+
+; SIS header: name, uid, version
+#{"Flickr"},(0xE1D8C7D7),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, 2, {"Qt"}
+; Dependency to Qt Webkit
+(0x200267C2), 4, 6, 2, {"QtWebKit"}
+
+; Executable and default resource files
+"/S60/devices/Nokia_Symbian3_SDK_v0.8/epoc32/release/$(PLATFORM)/$(TARGET)/Flickr.exe" - "!:\sys\bin\Flickr.exe"
+"/S60/devices/Nokia_Symbian3_SDK_v0.8/epoc32/data/z/resource/apps/Flickr.rsc" - "!:\resource\apps\Flickr.rsc"
+"/S60/devices/Nokia_Symbian3_SDK_v0.8/epoc32/data/z/private/10003a3f/import/apps/Flickr_reg.rsc" - "!:\private\10003a3f\import\apps\Flickr_reg.rsc"
+
+; Manual PKG post-rules from PRO files
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/example/FlickrAuthApp/backup_registration.xml Thu Aug 05 16:46:37 2010 +0530
@@ -0,0 +1,5 @@
+<?xml version="1.0" standalone="yes"?>
+<backup_registration>
+ <system_backup/>
+ <restore requires_reboot = "no"/>
+</backup_registration>
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/example/FlickrAuthApp/inc/authAppConstants.h Thu Aug 05 16:46:37 2010 +0530
@@ -0,0 +1,30 @@
+/**
+* Copyright (c) 2010 Sasken Communication Technologies Ltd.
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of the "{License}"
+* which accompanies this distribution, and is available
+* at the URL "{LicenseUrl}".
+*
+* Initial Contributors:
+* Narasimhulu Kavadapu, Sasken Communication Technologies Ltd - Initial contribution
+*
+* Contributors:
+*
+* Description:
+* Common variable declarations
+*/
+
+#ifndef FBCONNECTGLOBAL_H
+#define FBCONNECTGLOBAL_H
+
+#include <QtGlobal>
+#include <QHash>
+#include <QString>
+
+typedef QHash<QString,QString> Dictionary;
+typedef QHashIterator<QString, QString> DictionaryIterator;
+
+
+
+#endif // FBCONNECTGLOBAL_H
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/example/FlickrAuthApp/inc/baseDialog.h Thu Aug 05 16:46:37 2010 +0530
@@ -0,0 +1,159 @@
+/**
+* Copyright (c) 2010 Sasken Communication Technologies Ltd.
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of the "{License}"
+* which accompanies this distribution, and is available
+* at the URL "{LicenseUrl}".
+*
+* Initial Contributors:
+* Narasimhulu Kavadapu, Sasken Communication Technologies Ltd - Initial contribution
+*
+* Contributors:
+*
+* Description:
+* Base class of All dialogs
+*/
+
+#ifndef FB_DIALOG_H_
+#define FB_DIALOH_H_
+
+#include <QDialog>
+#include <QWebView>
+#include <qprogressbar.h>
+#include <qboxlayout.h>
+#include "authAppConstants.h"
+
+// FORWARD DECLARATIONS
+class FBSession;
+class FBError;
+class QNetworkReply;
+
+//#define __WINSCW__
+
+/**
+ * The base Dialoggg
+ */
+class FBDialog : public QWidget
+{
+ Q_OBJECT
+
+protected:
+
+ /**
+ * The session for which the login is taking place.
+ */
+ FBSession* iSession;
+ QWebView* iWebView;
+ QString iLoadingUrl;
+ bool iIgnorePageLoadCompleteEvent;
+ QProgressBar* progressbar;
+ QVBoxLayout* layout;
+
+signals:
+
+ /**
+ * Called when the dialog succeeds and is about to be dismissed.
+ */
+ void dialogDidSucceed ();
+
+ /**
+ * Called when the dialog is cancelled and is about to be dismissed.
+ */
+ void dialogDidCancel();
+
+ /**
+ * Called when dialog failed to load due to an error.
+ */
+ void dialogDidFailWithError ( const FBError& error );
+
+
+
+private slots:
+ void cancel();
+
+ /* slots for signals from QWebView.page() */
+ void linkClicked ( const QUrl & url );
+ void loadStarted ();
+ void loadProgress(int progress);
+ void loadFinished ( bool ok );
+ //void urlChanged ( const QUrl & url );
+ //Network Error Slots
+ void slotAuthenticationRequired( QNetworkReply* reply, QAuthenticator* authenticator );
+ void slotsslErrors( QNetworkReply* reply, const QList<QSslError>& errors );
+ void slotproxyAuthenticationRequired( const QNetworkProxy& proxy, QAuthenticator* authenticator );
+
+public:
+
+ void proxysettings();
+ /**
+ * Creates the view but does not display it.
+ */
+ FBDialog(FBSession* aSession);
+ FBDialog();
+
+ /**
+ * Displays the view with an animation.
+ *
+ * The view will be added to the top of the current key window.
+ */
+ void show();
+
+ /** Displays the first page of the dialog.
+ *
+ * Do not ever call this directly. It is intended to be overriden by subclasses.
+ */
+ virtual void load ();
+
+ /**
+ * Displays a URL in the dialog.
+ */
+ void loadURL(const QString& aUrl, QNetworkAccessManager::Operation aMethod, const QHash<QString, QString>& aGetParams,
+ const QHash<QString, QString>& aPostParams);
+
+
+ void dismiss(bool aAnimated);
+
+ /**
+ * Hides the view and notifies delegates of success or cancellation.
+ */
+ void dismissWithSuccess (bool aSuccess, bool aAnimated);
+
+ /**
+ * Hides the view and notifies delegates of an error.
+ */
+ void dismissWithError (const FBError& aError);
+
+ /**
+ * Subclasses may override to perform actions just prior to showing the dialog.
+ */
+ virtual void dialogWillAppear();
+
+ /**
+ * Subclasses may override to perform actions just after the dialog is hidden.
+ */
+ virtual void dialogWillDisappear();
+
+ /**
+ * Subclasses should override to process data returned from the server in a 'fbconnect' url.
+ *
+ * Implementations must call dismissWithSuccess:YES at some point to hide the dialog.
+ */
+ virtual void dialogDidSucceed(const QUrl& aUrl);
+
+ QString title() const;
+ void setTitle ( const QString& aTitle );
+
+ virtual void GetSessionKey(const QUrl& aUrl);
+
+ virtual void connectToGetFullToken();
+
+private:
+ void createControls();
+ QString generateURL( const QString& aUrl, const QHash<QString, QString>& aParams) const;
+ QByteArray generatePostBody (const QHash<QString, QString>& aParams) const;
+
+ void postDismissCleanup();
+
+ };
+#endif
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/example/FlickrAuthApp/inc/errorCodes.h Thu Aug 05 16:46:37 2010 +0530
@@ -0,0 +1,221 @@
+/**
+* Copyright (c) 2010 Sasken Communication Technologies Ltd.
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of the "{License}"
+* which accompanies this distribution, and is available
+* at the URL "{LicenseUrl}".
+*
+* Initial Contributors:
+* Narasimhulu Kavadapu, Sasken Communication Technologies Ltd - Initial contribution
+*
+* Contributors:
+*
+* Description:
+* Common Errors Declaration
+*/
+
+#ifndef FBERROR_H_
+#define FBERROR_H_
+
+
+#include "authAppConstants.h"
+
+///////////////////////////////////////////////////////////////////////////////////////////////////
+// Error codes
+/* defined by this proj*/
+#define FBRESPONSE_PARSE_ERROR 13 /* the xml parser was unable to parse the response returned by the server */
+
+/* defined and returned by facebook */
+#define FBAPI_EC_SUCCESS 0
+#define FBAPI_EC_UNKNOWN 1
+#define FBAPI_EC_SERVICE 2
+#define FBAPI_EC_METHOD 3
+#define FBAPI_EC_TOO_MANY_CALLS 4
+#define FBAPI_EC_BAD_IP 5
+#define FBAPI_EC_HOST_API 6
+#define FBAPI_EC_HOST_UP 7
+#define FBAPI_EC_SECURE 8
+#define FBAPI_EC_RATE 9
+#define FBAPI_EC_PERMISSION_DENIED 10
+#define FBAPI_EC_DEPRECATED 11
+#define FBAPI_EC_VERSION 12
+
+#define FBAPI_EC_PARAM 100
+#define FBAPI_EC_PARAM_FBAPI_KEY 101
+#define FBAPI_EC_PARAM_SESSION_KEY 102
+#define FBAPI_EC_PARAM_CALL_ID 103
+#define FBAPI_EC_PARAM_SIGNATURE 104
+#define FBAPI_EC_PARAM_TOO_MANY 105
+#define FBAPI_EC_PARAM_USER_ID 110
+#define FBAPI_EC_PARAM_USER_FIELD 111
+#define FBAPI_EC_PARAM_SOCIAL_FIELD 112
+#define FBAPI_EC_PARAM_EMAIL 113
+#define FBAPI_EC_PARAM_ALBUM_ID 120
+#define FBAPI_EC_PARAM_PHOTO_ID 121
+#define FBAPI_EC_PARAM_FEED_PRIORITY 130
+#define FBAPI_EC_PARAM_CATEGORY 140
+#define FBAPI_EC_PARAM_SUBCATEGORY 141
+#define FBAPI_EC_PARAM_TITLE 142
+#define FBAPI_EC_PARAM_DESCRIPTION 143
+#define FBAPI_EC_PARAM_BAD_JSON 144
+#define FBAPI_EC_PARAM_BAD_EID 150
+#define FBAPI_EC_PARAM_UNKNOWN_CITY 151
+#define FBAPI_EC_PARAM_BAD_PAGE_TYPE 152
+
+#define FBAPI_EC_PERMISSION 200
+#define FBAPI_EC_PERMISSION_USER 210
+#define FBAPI_EC_PERMISSION_ALBUM 220
+#define FBAPI_EC_PERMISSION_PHOTO 221
+#define FBAPI_EC_PERMISSION_MESSAGE 230
+#define FBAPI_EC_PERMISSION_MARKUP_OTHER_USER 240
+#define FBAPI_EC_PERMISSION_STATUS_UPDATE 250
+#define FBAPI_EC_PERMISSION_PHOTO_UPLOAD 260
+#define FBAPI_EC_PERMISSION_SMS 270
+#define FBAPI_EC_PERMISSION_CREATE_LISTING 280
+#define FBAPI_EC_PERMISSION_EVENT 290
+#define FBAPI_EC_PERMISSION_LARGE_FBML_TEMPLATE 291
+#define FBAPI_EC_PERMISSION_LIVEMESSAGE 292
+#define FBAPI_EC_PERMISSION_RSVP_EVENT 299
+
+#define FBAPI_EC_EDIT 300
+#define FBAPI_EC_EDIT_USER_DATA 310
+#define FBAPI_EC_EDIT_PHOTO 320
+#define FBAPI_EC_EDIT_ALBUM_SIZE 321
+#define FBAPI_EC_EDIT_PHOTO_TAG_SUBJECT 322
+#define FBAPI_EC_EDIT_PHOTO_TAG_PHOTO 323
+#define FBAPI_EC_EDIT_PHOTO_FILE 324
+#define FBAPI_EC_EDIT_PHOTO_PENDING_LIMIT 325
+#define FBAPI_EC_EDIT_PHOTO_TAG_LIMIT 326
+#define FBAPI_EC_EDIT_ALBUM_REORDER_PHOTO_NOT_IN_ALBUM 327
+#define FBAPI_EC_EDIT_ALBUM_REORDER_TOO_FEW_PHOTOS 328
+#define FBAPI_EC_MALFORMED_MARKUP 329
+#define FBAPI_EC_EDIT_MARKUP 330
+#define FBAPI_EC_EDIT_FEED_TOO_MANY_USER_CALLS 340
+#define FBAPI_EC_EDIT_FEED_TOO_MANY_USER_ACTION_CALLS 341
+#define FBAPI_EC_EDIT_FEED_TITLE_LINK 342
+#define FBAPI_EC_EDIT_FEED_TITLE_LENGTH 343
+#define FBAPI_EC_EDIT_FEED_TITLE_NAME 344
+#define FBAPI_EC_EDIT_FEED_TITLE_BLANK 345
+#define FBAPI_EC_EDIT_FEED_BODY_LENGTH 346
+#define FBAPI_EC_EDIT_FEED_PHOTO_SRC 347
+#define FBAPI_EC_EDIT_FEED_PHOTO_LINK 348
+#define FBAPI_EC_EDIT_VIDEO_SIZE 350
+#define FBAPI_EC_EDIT_VIDEO_INVALID_FILE 351
+#define FBAPI_EC_EDIT_VIDEO_INVALID_TYPE 352
+#define FBAPI_EC_EDIT_FEED_TITLE_ARRAY 360
+#define FBAPI_EC_EDIT_FEED_TITLE_PARAMS 361
+#define FBAPI_EC_EDIT_FEED_BODY_ARRAY 362
+#define FBAPI_EC_EDIT_FEED_BODY_PARAMS 363
+#define FBAPI_EC_EDIT_FEED_PHOTO 364
+#define FBAPI_EC_EDIT_FEED_TEMPLATE 365
+#define FBAPI_EC_EDIT_FEED_TARGET 366
+#define FBAPI_EC_USERS_CREATE_INVALID_EMAIL 370
+#define FBAPI_EC_USERS_CREATE_EXISTING_EMAIL 371
+#define FBAPI_EC_USERS_CREATE_BIRTHDAY 372
+#define FBAPI_EC_USERS_CREATE_PASSWORD 373
+#define FBAPI_EC_USERS_REGISTER_INVALID_CREDENTIAL 374
+#define FBAPI_EC_USERS_REGISTER_CONF_FAILURE 375
+#define FBAPI_EC_USERS_REGISTER_EXISTING 376
+#define FBAPI_EC_USERS_REGISTER_DEFAULT_ERROR 377
+#define FBAPI_EC_USERS_REGISTER_PASSWORD_BLANK 378
+#define FBAPI_EC_USERS_REGISTER_PASSWORD_INVALID_CHARS 379
+#define FBAPI_EC_USERS_REGISTER_PASSWORD_SHORT 380
+#define FBAPI_EC_USERS_REGISTER_PASSWORD_WEAK 381
+#define FBAPI_EC_USERS_REGISTER_USERNAME_ERROR 382
+#define FBAPI_EC_USERS_REGISTER_MISSING_INPUT 383
+#define FBAPI_EC_USERS_REGISTER_INCOMPLETE_BDAY 384
+#define FBAPI_EC_USERS_REGISTER_INVALID_EMAIL 385
+#define FBAPI_EC_USERS_REGISTER_EMAIL_DISABLED 386
+#define FBAPI_EC_USERS_REGISTER_ADD_USER_FAILED 387
+#define FBAPI_EC_USERS_REGISTER_NO_GENDER 388
+
+#define FBAPI_EC_AUTH_EMAIL 400
+#define FBAPI_EC_AUTH_LOGIN 401
+#define FBAPI_EC_AUTH_SIG 402
+#define FBAPI_EC_AUTH_TIME 403
+
+#define FBAPI_EC_SESSION_METHOD 451
+#define FBAPI_EC_SESSION_REQUIRED 453
+#define FBAPI_EC_SESSION_REQUIRED_FOR_SECRET 454
+#define FBAPI_EC_SESSION_CANNOT_USE_SESSION_SECRET 455
+
+#define FBAPI_EC_MESG_BANNED 500
+#define FBAPI_EC_MESG_NO_BODY 501
+#define FBAPI_EC_MESG_TOO_LONG 502
+#define FBAPI_EC_MESG_RATE 503
+#define FBAPI_EC_MESG_INVALID_THREAD 504
+#define FBAPI_EC_MESG_INVALID_RECIP 505
+#define FBAPI_EC_POKE_INVALID_RECIP 510
+#define FBAPI_EC_POKE_OUTSTANDING 511
+#define FBAPI_EC_POKE_RATE 512
+
+#define FQL_EC_UNKNOWN_ERROR 600
+#define FQL_EC_PARSER_ERROR 601
+#define FQL_EC_UNKNOWN_FIELD 602
+#define FQL_EC_UNKNOWN_TABLE 603
+#define FQL_EC_NO_INDEX 604
+#define FQL_EC_UNKNOWN_FUNCTION 605
+#define FQL_EC_INVALID_PARAM 606
+#define FQL_EC_INVALID_FIELD 607
+#define FQL_EC_INVALID_SESSION 608
+
+#define FBAPI_EC_REF_SET_FAILED 700
+#define FBAPI_EC_FB_APP_UNKNOWN_ERROR 750
+#define FBAPI_EC_FB_APP_FETCH_FAILED 751
+#define FBAPI_EC_FB_APP_NO_DATA 752
+#define FBAPI_EC_FB_APP_NO_PERMISSIONS 753
+#define FBAPI_EC_FB_APP_TAG_MISSING 754
+
+#define FBAPI_EC_DATA_UNKNOWN_ERROR 800
+#define FBAPI_EC_DATA_INVALID_OPERATION 801
+#define FBAPI_EC_DATA_QUOTA_EXCEEDED 802
+#define FBAPI_EC_DATA_OBJECT_NOT_FOUND 803
+#define FBAPI_EC_DATA_OBJECT_ALREADY_EXISTS 804
+#define FBAPI_EC_DATA_DATABASE_ERROR 805
+#define FBAPI_EC_DATA_CREATE_TEMPLATE_ERROR 806
+#define FBAPI_EC_DATA_TEMPLATE_EXISTS_ERROR 807
+#define FBAPI_EC_DATA_TEMPLATE_HANDLE_TOO_LONG 808
+#define FBAPI_EC_DATA_TEMPLATE_HANDLE_ALREADY_IN_USE 809
+#define FBAPI_EC_DATA_TOO_MANY_TEMPLATE_BUNDLES 810
+#define FBAPI_EC_DATA_MALFORMED_ACTION_LINK 811
+#define FBAPI_EC_DATA_TEMPLATE_USES_RESERVED_TOKEN 812
+
+#define FBAPI_EC_NO_SUCH_APP 900
+#define FBAPI_BATCH_TOO_MANY_ITEMS 950
+#define FBAPI_EC_BATCH_ALREADY_STARTED 951
+#define FBAPI_EC_BATCH_NOT_STARTED 952
+#define FBAPI_EC_BATCH_METHOD_NOT_ALLOWED_IN_BATCH_MODE 953
+
+#define FBAPI_EC_EVENT_INVALID_TIME 1000
+#define FBAPI_EC_INFO_NO_INFORMATION 1050
+#define FBAPI_EC_INFO_SET_FAILED 1051
+
+#define FBAPI_EC_LIVEMESSAGE_SEND_FAILED 1100
+#define FBAPI_EC_LIVEMESSAGE_EVENT_NAME_TOO_LONG 1101
+#define FBAPI_EC_LIVEMESSAGE_MESSAGE_TOO_LONG 1102
+
+#define FBAPI_EC_PAGES_CREATE 1201
+
+///////////////////////////////////////////////////////////////////////////////////////////////////
+
+///////////////////////////////////////////////////////////////////////////////////////////////////
+class FBError
+{
+
+public:
+ FBError(quint8 aErrorCode) : iErrorCode (aErrorCode) {}
+ FBError() : iErrorCode(0) {}
+
+ inline quint8 code() const { return iErrorCode; }
+ inline void setCode( quint8 aErrorCode ) { iErrorCode = aErrorCode; }
+
+ inline QString description() const { return iErrorDescription; }
+ inline void setDescription( const QString& aErrorDescription ) { iErrorDescription = aErrorDescription; }
+
+private:
+ quint8 iErrorCode;
+ QString iErrorDescription;
+};
+
+#endif // FBERROR_H_
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/example/FlickrAuthApp/inc/keys.h Thu Aug 05 16:46:37 2010 +0530
@@ -0,0 +1,14 @@
+/*
+ * keys.h
+ *
+ * Created on: Jul 16, 2010
+ * Author: satishkk
+ */
+
+#ifndef KEYS_H_
+#define KEYS_H_
+
+static const QString kApiKey = "2835574777f7421bc0d058f5a1ad5a56";
+static const QString kApiSecret = "f902dad777efa173";
+
+#endif /* KEYS_H_ */
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/example/FlickrAuthApp/inc/loginDialog.h Thu Aug 05 16:46:37 2010 +0530
@@ -0,0 +1,55 @@
+/**
+* Copyright (c) 2010 Sasken Communication Technologies Ltd.
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of the "{License}"
+* which accompanies this distribution, and is available
+* at the URL "{LicenseUrl}".
+*
+* Initial Contributors:
+* Narasimhulu Kavadapu, Sasken Communication Technologies Ltd - Initial contribution
+*
+* Contributors:
+*
+* Description:
+* Login Dialog class of Authentication Application
+*/
+
+
+#ifndef FB_LOGIN_DIALOG_H_
+#define FB_LOGIN_DIALOG_H_
+
+#include "baseDialog.h"
+#include "requestSP.h"
+#include <QNetworkReply>
+
+// FORWARD DECLARATIONS
+class FBRequest;
+
+class FBLoginDialog : public FBDialog
+{
+ Q_OBJECT
+
+private:
+ FBRequest* iGetSessionRequest;
+
+private slots:
+ /* slots for handling signals from FBRequest iGetSessionRequest */
+ void requestDidLoad (const QVariant& aResult);
+
+ void requestFailedWithFlickrError ( const FBError& aError );
+ void requestFailedWithNetworkError( QNetworkReply::NetworkError code );
+
+public:
+ FBLoginDialog(FBSession* aSession);
+ FBLoginDialog();
+ void connecttoGetFrob();
+ void load();
+
+private:
+ void connectToGetFullToken();
+
+ void loadLoginPage();
+
+ };
+#endif
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/example/FlickrAuthApp/inc/requestSP.h Thu Aug 05 16:46:37 2010 +0530
@@ -0,0 +1,216 @@
+/**
+* Copyright (c) 2010 Sasken Communication Technologies Ltd.
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of the "{License}"
+* which accompanies this distribution, and is available
+* at the URL "{LicenseUrl}".
+*
+* Initial Contributors:
+* Narasimhulu Kavadapu, Sasken Communication Technologies Ltd - Initial contribution
+*
+* Contributors:
+*
+* Description:
+* class to handle calls to rest Server API's
+*/
+#ifndef FBREQUEST_H
+#define FBREQUEST_H
+
+#include <QObject>
+#include <QString>
+#include <QDateTime>
+#include <QHttp>
+#include <QHash>
+#include <QNetworkAccessManager>
+#include <QNetworkReply>
+#include "progressbar.h"
+#include "authAppConstants.h"
+#include "xmlParser.h"
+
+// FORWARD DECLARATIONS
+class FBSession;
+class FBError;
+
+///////////////////////////////////////////////////////////////////////////////////////////////////
+class FBRequest : public QObject
+{
+ Q_OBJECT
+
+private:
+
+ /* pointer to the session that owns this request */
+ FBSession* iSession;
+
+ /**
+ * The URL which will be contacted to execute the request.
+ */
+ QString iUrl;
+
+ /**
+ * The API method which will be called.
+ */
+ QString iMethod;
+
+ /**
+ * An object used by the user of the request to help identify the meaning of the request.
+ */
+ void* iUserInfo;
+
+ /**
+ * The dictionary of parameters to pass to the method.
+ *
+ * These values in the dictionary will be converted to strings using the
+ * standard Objective-C object-to-string conversion facilities.
+ */
+ Dictionary iParams;
+
+ /**
+ * A data parameter.
+ *
+ * Used for methods such as photos.upload, video.upload, events.create, and
+ * events.edit.
+ */
+ QByteArray iDataParam;
+
+ /**
+ * true if iDataParam holds picture data
+ */
+ bool iDataParamPicture;
+
+ /**
+ * The timestamp of when the request was sent to the server.
+ */
+ QDateTime iTimestamp;
+ QHttp iConnection;
+ QByteArray iResponseText;
+
+ QNetworkAccessManager iNetworkAccessManager;
+ progressbar* pbar;
+
+signals: /* the signals ommitted by FBRequest */
+
+ /**
+ * Called just before the request is sent to the server.
+ */
+ void requestLoading();
+
+ /**
+ * Called when an error prevents the request from completing successfully.
+ */
+ void requestFailedWithNetworkError( QNetworkReply::NetworkError code );
+ void requestFailedWithFlickrError ( const FBError& aError );
+
+ /**
+ * Called when a request returns and its response has been parsed into an object.
+ *
+ * The resulting object may be a dictionary, an array, a string, or a number, depending
+ * on thee format of the API response.
+ */
+ void requestDidLoad ( const QVariant& aResult);
+
+
+
+private slots:
+ void networkReplyError ( QNetworkReply::NetworkError code );
+ void networkReplyFinished ();
+
+public: /* class functions */
+ /**
+ * Creates a new API request for the global session.
+ */
+ static FBRequest* request();
+
+ /**
+ * Creates a new API request for a particular session.
+ */
+ static FBRequest* requestWithSession (FBSession* aSession);
+
+public: /* instance functions */
+
+ /**
+ * Creates a new request paired to a session.
+ */
+ FBRequest (FBSession* aSession);
+
+ /**
+ * Calls a method on the server asynchronously.
+ *
+ * The delegate will be called for each stage of the loading process.
+ */
+ void call (const QString& aMethod, const Dictionary& aParams);
+
+ void callforToken ();
+
+ /**
+ * Calls a method on the server asynchronously, with a file upload component.
+ *
+ * The delegate will be called for each stage of the loading process.
+ */
+ void callWithDataParams (const QString& aMethod, const Dictionary& aParams, const QByteArray& aDataParam, bool aDataParamPicture);
+
+ /**
+ * Calls a URL on the server asynchronously.
+ *
+ * The delegate will be called for each stage of the loading process.
+ */
+ void post( const QString& aUrl, const Dictionary& aParams);
+
+ /**
+ * Stops an active request before the response has returned.
+ */
+ void cancel();
+
+ /**
+ * returns the time stamp of when the request was sent to the server
+ */
+ const QDateTime& timeStamp() const;
+
+ void connect();
+
+ QString generateSig(Dictionary Params);
+
+ void proxysettings();
+
+private:
+ /**
+ * Given a string returns its hex coded md5 hash
+ */
+ static QString md5(const QString&);
+
+ /**
+ * @return true if the current request method is a special method
+ */
+ bool isSpecialMethod() const;
+
+ /**
+ * @return QString a url to use for the given method
+ */
+ QString urlForMethod (const QString& aMethod) const;
+
+ /**
+ * @return the Get Url for the request
+ */
+ QString generateGetURL() const;
+
+ QString generateCallId() const;
+
+
+ void generatePostBody(QByteArray& body);
+
+ /**
+ * handles the data received from the server
+ * @param aResponseData is the data received from the server
+ */
+ void handleResponseData( const QByteArray& aResponseData );
+
+ /**
+ * @param aResponseData is the data received from the server
+ * @param aError will get error codes if any error occurs ( this will change in the future )
+ * @return a void* pointer, this will change
+ */
+ QVariant parseXMLResponse ( const QByteArray& aResponseData, FBError& aError);
+
+};
+
+#endif // FBREQUEST_H
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/example/FlickrAuthApp/inc/sessionSP.h Thu Aug 05 16:46:37 2010 +0530
@@ -0,0 +1,209 @@
+/**
+* Copyright (c) 2010 Sasken Communication Technologies Ltd.
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of the "{License}"
+* which accompanies this distribution, and is available
+* at the URL "{LicenseUrl}".
+*
+* Initial Contributors:
+* Narasimhulu Kavadapu, Sasken Communication Technologies Ltd - Initial contribution
+*
+* Contributors:
+*
+* Description:
+* class to maintian session & all credential keys.
+*/
+
+#ifndef FBSESSION_H
+#define FBSESSION_H
+
+#include <QObject>
+#include <QList>
+#include <QString>
+#include <QSettings>
+#include <QDateTime>
+#include "smfcredmgrclient.h"
+#include "authAppConstants.h"
+
+// FORWARD DECLARATIONS
+class FBRequest;
+
+const QString KFacebokkKeysFileName = "c://Data//FacebookKeys.txt";
+
+///////////////////////////////////////////////////////////////////////////////////////////////////
+/**
+ * An FBSession represents a single user's authenticated session for a Facebook application.
+ *
+ * To create a session, you must use the session key of your application (which can
+ * be found on the Facebook developer website). You may then use the login dialog to ask
+ * the user to enter their email address and password. If successful, you will get back a
+ * session key which can be used to make requests to the Facebook API.
+ *
+ * Session keys are cached and stored on the disk of the device so that you do not need to ask
+ * the user to login every time they launch the app. To restore the last active session, call the
+ * resume method after instantiating your session.
+ */
+class FBSession : public QObject
+{
+ Q_OBJECT
+
+private:
+ /**
+ * Your application's API key, as passed to the constructor.
+ */
+ QString iApiKey;
+
+ /**
+ * Your application's API secret, as passed to the constructor.
+ */
+ QString iApiSecret;
+
+ /**
+ * The current user's Frob key.
+ */
+ QString iFrobKey;
+
+ /**
+ * The current user's Full token
+ */
+ QString iToken;
+
+ /**
+ * The settings object used to restore session from the disk.
+ */
+ QSettings iSettings;
+ /**
+ * The Credentail Object used to store auth data
+ */
+ SmfCredMgrClient* m_Client;
+ /**
+ * Variable to store
+ */
+ QString iCMRegToken;
+
+signals: /* the signals ommitted by FBSession */
+
+ /**
+ * Called when session logged in sucessfully
+ * @param SessionKey is the fb assigned session key
+ */
+ void sessionDidLogin (QString SessionKey);
+
+ /**
+ * Called when a user closes the login dialog without logging in.
+ */
+ void sessionDidNotLogin ();
+
+ /**
+ * Called when a session is about to log out.
+ * @param aUid is the fb assigned session id
+ */
+ void sessionWillLogout ();
+
+ /**
+ * Called when a session has logged out.
+ */
+ void sessionDidLogout ();
+
+public: /* class functions */
+
+ /**
+ * The globally shared session instance.
+ */
+ static FBSession* session();
+
+ /**
+ * Sets the globally shared session instance.
+ *
+ * This session is not retained, so you are still responsible for retaining it yourself. The
+ * first session that is created is automatically stored here.
+ */
+ static void setSession(FBSession* aSession);
+
+ /**
+ * Constructs a session and stores it as the globally shared session instance.
+ *
+ * @param aSessionProxy a url to that proxies auth.getSession
+ */
+ static FBSession* sessionForApplication ( const QString& aKey, const QString& aSecret, const QString& aSessionProxy);
+
+public: /* instance functions */
+
+ /**
+ * Constructs a session for an application.
+ *
+ * @param secret the application secret (optional)
+ * @param getSessionProxy a url to that proxies auth.getSession (optional)
+ */
+ FBSession( const QString& aKey, const QString& aSecret, const QString& aSessionProxy );
+
+ /**
+ * Destructor
+ */
+ ~FBSession();
+
+ /**
+ * Saves Frob Key
+ */
+ void SaveFrobKey ( const QString& aFrob);
+
+ /**
+ * Saves Token
+ */
+ void Savetoken (const QString& token );
+
+ /**
+ * Resumes a previous session whose uid, session key, and secret are cached on disk.
+ */
+ bool resume();
+
+ /**
+ * Ends the current session and deletes the uid, session key, and secret from disk.
+ */
+ void logout();
+
+ /**
+ * Sends a fully configured request to the server for execution.
+ */
+ void send (FBRequest* aRequest);
+
+ /**
+ * @return const QString& http:// URL to the facebook REST server
+ */
+ const QString& apiURL() const;
+ /**
+ * @return const QString& the api secret
+ */
+ const QString& apiSecret() const { return iApiSecret; }
+
+ /**
+ * @return api key for this session
+ */
+ const QString& apiKey() const { return iApiKey; }
+
+ /**
+ * @return the Frob key
+ */
+ const QString& frobKey() const { return iFrobKey; }
+
+private:
+
+ /**
+ * Saves the fb connect session information to disk
+ */
+ void save();
+ /**
+ * Forgets any fb connect session information saved to disk
+ */
+ void unsave();
+ /**
+ * @param aRequest, the request to perform.
+ * @param aEnqueue, if true add to queue if cant perform the request right now
+ */
+ bool performRequest(FBRequest* aRequest, bool aEnqueue);
+
+
+};
+
+#endif // FBSESSION_H
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/example/FlickrAuthApp/inc/xmlParser.h Thu Aug 05 16:46:37 2010 +0530
@@ -0,0 +1,84 @@
+/**
+* Copyright (c) 2010 Sasken Communication Technologies Ltd.
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of the "{License}"
+* which accompanies this distribution, and is available
+* at the URL "{LicenseUrl}".
+*
+* Initial Contributors:
+* Narasimhulu Kavadapu, Sasken Communication Technologies Ltd - Initial contribution
+*
+* Contributors:
+*
+* Description:
+* XML Parser class
+*/
+
+#ifndef FB_XML_HANDLER_H
+#define FB_XML_HANDLER_H
+
+#include <QObject>
+#include <QString>
+#include <QXmlDefaultHandler>
+#include <QVariantList>
+
+#include "authAppConstants.h"
+
+// FORWARD DECLARATIONS
+class FBRequest;
+
+///////////////////////////////////////////////////////////////////////////////////////////////////
+class FBXMLHandler : public QObject, public QXmlDefaultHandler
+{
+ Q_OBJECT
+
+private:
+ QVariantList iStack;
+ QList<QString> iNameStack;
+ QVariant iRootObject;
+ QString iRootName;
+ QString iChars;
+
+ QString iParseErrorMessage;
+ bool iError;
+
+public: /* class functions */
+
+ FBXMLHandler();
+ ~FBXMLHandler();
+
+ inline const QString& rootName() const { return iRootName; }
+ inline QVariant rootObject() const { return iRootObject; }
+
+ inline bool parseError() const { return iError; }
+
+private:
+ /* methods from QXmlDefaultHandler */
+ bool startElement( const QString & namespaceURI,
+ const QString & localName,
+ const QString & qName,
+ const QXmlAttributes & atts);
+ bool characters(const QString& text);
+ bool endElement( const QString & namespaceURI,
+ const QString & localName,
+ const QString & qName );
+
+ /* methods from QXmlErrorHandler */
+ bool error(const QXmlParseException& exception);
+ bool fatalError(const QXmlParseException& exception);
+
+ /* private functions*/
+ const QString& topName() const;
+ void flushCharacters();
+ QVariant topObject(bool aCreate);
+
+ QVariant topContainer();
+
+
+ void initWhiteSpaceHash();
+ QHash<QChar, bool> iWhiteSpaceAndNewLineCharSet;
+
+};
+
+#endif // FB_XML_HANDLER_H
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/example/FlickrAuthApp/main.cpp Thu Aug 05 16:46:37 2010 +0530
@@ -0,0 +1,80 @@
+/****************************************************************************
+**
+** 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 "AuthApp.h"
+
+#include <QtGui>
+#include <QApplication>
+
+void debugOutput(QtMsgType type, const char *msg)
+ {
+ QFile logFile("c://data//FlickrLog.txt");
+ Q_ASSERT(logFile.open( QIODevice::WriteOnly | QIODevice::Text | QIODevice::Append ));
+ QTextStream stream(&logFile);
+
+ switch (type)
+ {
+ case QtDebugMsg:
+ stream<<msg<<"\n";
+ break;
+
+ case QtWarningMsg:
+ stream<<"Warning: ";
+ stream<<msg<<"\n";
+ break;
+
+ case QtCriticalMsg:
+ stream<<"Critical: ";
+ stream<<msg<<"\n";
+ break;
+
+ case QtFatalMsg:
+ stream<<"Fatal: ";
+ stream<<msg<<"\n";
+ break;
+
+ default:;
+ }
+ }
+
+int main(int argc, char *argv[])
+{
+ qInstallMsgHandler(debugOutput);
+ QApplication a(argc, argv);
+ AuthApp w;
+
+ #if defined(Q_OS_SYMBIAN)
+ w.showMaximized();
+ #else
+ w.show();
+ #endif
+
+ return a.exec();
+}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/example/FlickrAuthApp/progressbar.cpp Thu Aug 05 16:46:37 2010 +0530
@@ -0,0 +1,14 @@
+#include "progressbar.h"
+
+progressbar::progressbar(QWidget *parent)
+ : QWidget(parent)
+{
+ ui.setupUi(this);
+ ui.progressBar->setTextVisible(false);
+}
+
+
+progressbar::~progressbar()
+{
+
+}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/example/FlickrAuthApp/progressbar.h Thu Aug 05 16:46:37 2010 +0530
@@ -0,0 +1,19 @@
+#ifndef PROGRESSBAR_H
+#define PROGRESSBAR_H
+
+#include <QtGui/QWidget>
+#include "ui_progressbar.h"
+
+class progressbar : public QWidget
+{
+ Q_OBJECT
+
+public:
+ progressbar(QWidget *parent = 0);
+ ~progressbar();
+
+private:
+ Ui::progressbarClass ui;
+};
+
+#endif // PROGRESSBAR_H
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/example/FlickrAuthApp/progressbar.ui Thu Aug 05 16:46:37 2010 +0530
@@ -0,0 +1,31 @@
+<ui version="4.0" >
+ <class>progressbarClass</class>
+ <widget class="QWidget" name="progressbarClass" >
+ <property name="windowTitle" >
+ <string>progressbar</string>
+ </property>
+ <layout class="QVBoxLayout" name="verticalLayout" >
+ <item>
+ <widget class="QLabel" name="label" >
+ <property name="text" >
+ <string><!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0//EN" "http://www.w3.org/TR/REC-html40/strict.dtd">
+<html><head><meta name="qrichtext" content="1" /><style type="text/css">
+p, li { white-space: pre-wrap; }
+</style></head><body style=" font-family:'MS Shell Dlg 2'; font-size:8.25pt; font-weight:400; font-style:normal;">
+<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><span style=" font-size:10pt;">Loading,Please wait.....</span></p></body></html></string>
+ </property>
+ </widget>
+ </item>
+ <item>
+ <widget class="QProgressBar" name="progressBar" >
+ <property name="value" >
+ <number>24</number>
+ </property>
+ </widget>
+ </item>
+ </layout>
+ </widget>
+ <layoutdefault spacing="6" margin="11" />
+ <resources/>
+ <connections/>
+</ui>
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/example/FlickrAuthApp/src/baseDialog.cpp Thu Aug 05 16:46:37 2010 +0530
@@ -0,0 +1,360 @@
+/**
+* Copyright (c) 2010 Sasken Communication Technologies Ltd.
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of the "{License}"
+* which accompanies this distribution, and is available
+* at the URL "{LicenseUrl}".
+*
+* Initial Contributors:
+* Narasimhulu Kavadapu, Sasken Communication Technologies Ltd - Initial contribution
+*
+* Contributors:
+*
+* Description:
+* Base class of All dialogs
+*/
+
+#define EMULATORTESTING
+
+#include <QNetworkCookie>
+#include <QNetworkRequest>
+#include <QNetworkReply>
+#include <QWebFrame>
+#include <QFile>
+#include <QDesktopServices>
+#include <QResizeEvent>
+#include <QDebug>
+#include <qmessagebox.h>
+#include <QNetworkAccessManager>
+#include <QPropertyAnimation>
+ #include <qnetworkproxy.h>
+#include <qdesktopwidget.h>
+#include <qapplication.h>
+//#include <qboxlayout.h>
+#include "baseDialog.h"
+#include "sessionSP.h"
+#include "errorCodes.h"
+
+static const QString kDefaultTitle = "Connect to Facebook";
+static const QString kStringBoundary = "3i2ndDfv2rTHiSisAbouNdArYfORhtTPEefj3q2f";
+static const QString kMinitokensuccessURL = "http://m.flickr.com/services/auth/";
+static const QString kInvalidUrl = "http://mlogin.yahoo.com/w/login";
+
+static QNetworkAccessManager namanager;
+
+/////////////////////////////////////////////////////////////////////////////////////////////////////////////
+
+FBDialog::FBDialog() : iSession(FBSession::session()), /*iWebView ( this ),*/ iIgnorePageLoadCompleteEvent( false )
+{
+ createControls();
+}
+
+FBDialog::FBDialog(FBSession* aSession) : iSession ( aSession ), /*iWebView ( this ) ,*/ iIgnorePageLoadCompleteEvent ( false )
+{
+ createControls();
+}
+void FBDialog::createControls()
+{
+ iWebView = new QWebView(this);
+ iWebView->page()->setNetworkAccessManager(&namanager);
+
+ iWebView->page()->setLinkDelegationPolicy(QWebPage::DelegateAllLinks);
+
+ layout = new QVBoxLayout(this);
+
+
+ progressbar = new QProgressBar(this);
+
+ layout->addWidget(iWebView);
+ layout->addWidget(progressbar);
+
+ setLayout(layout);
+
+ progressbar->setOrientation(Qt::Horizontal);
+
+
+ connect( iWebView->page(), SIGNAL(linkClicked(const QUrl &)),
+ this, SLOT(linkClicked(const QUrl &)));
+
+ connect ( iWebView->page(), SIGNAL(loadFinished(bool)), this, SLOT(loadFinished(bool)));
+
+ connect ( iWebView->page(), SIGNAL(loadStarted()), this, SLOT ( loadStarted()));
+
+ connect ( iWebView->page(), SIGNAL(loadProgress(int)), this, SLOT ( loadProgress(int)));
+
+ //connect ( iWebView->page(), SIGNAL(urlChanged ( const QUrl & url )), this, SLOT (urlChanged ( const QUrl & url ) ));
+
+ connect (iWebView->page()->networkAccessManager(),SIGNAL( authenticationRequired( QNetworkReply*, QAuthenticator*)),this,SLOT( slotAuthenticationRequired( QNetworkReply*, QAuthenticator*)));
+ connect (iWebView->page()->networkAccessManager(),SIGNAL( sslErrors( QNetworkReply*,QList<QSslError>&)),this,SLOT( slotsslErrors( QNetworkReply*,QList<QSslError>&)) );
+ connect (iWebView->page()->networkAccessManager(),SIGNAL( proxyAuthenticationRequired(QNetworkProxy&, QAuthenticator*)),this,SLOT( slotproxyAuthenticationRequired(QNetworkProxy&, QAuthenticator*)) );
+
+}
+QString FBDialog::generateURL( const QString& aUrl, const QHash<QString, QString>& aParams) const
+{
+ QString url ( aUrl );
+
+ QStringList pairs;
+ QHashIterator<QString, QString> i(aParams);
+
+ while (i.hasNext()) {
+ i.next();
+
+ QUrl url (i.value());
+ QString pair = i.key() + "=" + url.toEncoded();
+ pairs << pair.toUtf8();
+ }
+
+ if (pairs.count())
+ {
+ url = url + "?" + pairs.join("&");
+ }
+
+ return url;
+
+}
+
+QByteArray FBDialog::generatePostBody (const QHash<QString, QString>& aParams) const
+{
+ QByteArray body;
+
+ if (!aParams.count())
+ return body;
+
+
+ QString endLine = "\r\n--" + kStringBoundary + "\r\n", kStringBoundary;
+
+ QString tmp = "--" + kStringBoundary + "\r\n";
+ body.append(tmp.toUtf8());
+
+
+ QHashIterator<QString, QString> i(aParams);
+ while (i.hasNext()) {
+ i.next();
+
+ tmp = "Content-Disposition: form-data; name=\"" + i.key().toUtf8() + "\"\r\n\r\n" ;
+ body.append(tmp.toUtf8());
+ body.append(i.value().toUtf8());
+ body.append(endLine.toUtf8());
+ }
+
+ return body;
+}
+
+void FBDialog::postDismissCleanup()
+{
+ //accept();
+ // could also be reject()?
+}
+
+void FBDialog::dismiss (bool /*aAnimated*/) {
+ dialogWillDisappear();
+ iLoadingUrl.clear();
+
+ //todo: do some animations if aAnimated == true !
+ postDismissCleanup();
+}
+
+
+void FBDialog::dismissWithSuccess( bool aSuccess, bool aAnimated)
+{
+ if (aSuccess) {
+ emit dialogDidSucceed();
+ } else {
+ emit dialogDidCancel();
+ }
+
+ dismiss(aAnimated);
+}
+
+void FBDialog::dismissWithError (const FBError& aError)
+{
+ QMessageBox msgbox;
+ QString msg ("Error!Please try again!");
+ msgbox.setText(msg);
+}
+void FBDialog::slotAuthenticationRequired( QNetworkReply* reply, QAuthenticator* authenticator )
+ {
+ QMessageBox msgbox;
+ QString msg ("Error!Authentication Required");
+ msgbox.setText(msg);
+ }
+void FBDialog::slotsslErrors( QNetworkReply* reply, const QList<QSslError>& errors )
+ {
+ QMessageBox msgbox;
+ QString msg ("Error!SSL Error");
+ msgbox.setText(msg);
+ }
+void FBDialog::slotproxyAuthenticationRequired( const QNetworkProxy& proxy, QAuthenticator* authenticator )
+ {
+ QMessageBox msgbox;
+ QString msg ("Error!Proxy Authenticatio Required");
+ msgbox.setText(msg);
+ }
+void FBDialog::cancel()
+{}
+
+void FBDialog::load() {}
+
+void FBDialog::show()
+{
+
+ load();
+ showMaximized();
+ dialogWillAppear();
+
+}
+
+void FBDialog::loadURL(const QString& aUrl, QNetworkAccessManager::Operation aMethod, const QHash<QString, QString>& aGetParams, const QHash<QString, QString>& aPostParams)
+{
+ //proxysettings();
+ iIgnorePageLoadCompleteEvent = false;
+
+ QNetworkCookieJar* cookieJar = iWebView->page()->networkAccessManager()->cookieJar();
+ QByteArray body;
+
+ // iLoadingUrl = aUrl;
+ iLoadingUrl = generateURL(aUrl, aGetParams);
+
+ // This "test cookie" is required by login.php, or it complains that you need to enable JavaScript
+ QNetworkCookie testCookie ("test_cookie", "1");
+ testCookie.setDomain ( "www.flickr.com" );
+ testCookie.setPath ( "/" );
+
+ QList<QNetworkCookie> cookieList;
+ cookieList.append(testCookie);
+
+ cookieJar->setCookiesFromUrl ( cookieList, QUrl(iLoadingUrl) );
+
+ QUrl url (iLoadingUrl);
+ QNetworkRequest request(aUrl);
+
+ if (aMethod == QNetworkAccessManager::PostOperation)
+ {
+ const QString contentType = "multipart/form-data; boundary=" + kStringBoundary;
+ request.setHeader (QNetworkRequest::ContentTypeHeader, contentType);
+ body = generatePostBody (aPostParams);
+ }
+
+ proxysettings();
+
+
+ qDebug()<< "Check URL : " << iLoadingUrl;
+
+ //iWebView->load ( request, aMethod, body);
+ iWebView->load(url);
+ qDebug() << "Loading url: " << iLoadingUrl;
+}
+void FBDialog::proxysettings()
+{
+#ifdef EMULATORTESTING
+ qDebug()<<"proxysettings";
+
+ // Reading the keys, CSM Stubbed - START
+ QFile file("c://data//DoNotShare.txt");
+ if (!file.open(QIODevice::ReadOnly))
+ {
+ qDebug()<<"File to read the windows username and password could not be opened, returning!!!";
+ return;
+ }
+
+ QByteArray arr = file.readAll();
+ QList<QByteArray> list = arr.split(' ');
+ file.close();
+
+ QString username(list[0]);
+ QString password(list[1]);
+
+ QString httpProxy = "10.1.0.214";//ipwproxy.sasken.com
+ QString httpPort = "3128";
+
+ QString httpUser =username;/* This could be taken thru an QDialog implmentation to remove the Hard coding */
+ QString httpPass =password;/* This could be taken thru an QDialog implmentation to remove the Hard coding */
+
+ /*==Classes used from Network Module==*/
+ QNetworkProxy proxy;
+
+ proxy.setType(QNetworkProxy::HttpProxy);
+ proxy.setHostName(httpProxy);
+ proxy.setPort(httpPort.toInt());
+ proxy.setUser(httpUser);
+ proxy.setPassword(httpPass);
+
+ QNetworkProxy::setApplicationProxy(proxy);
+#endif
+}
+void FBDialog::dialogWillAppear() {}
+
+void FBDialog::dialogWillDisappear() {}
+
+void FBDialog::dialogDidSucceed (const QUrl& /*aUrl*/) {
+ dismissWithSuccess(true,true);
+}
+
+/////////////////////////////////////////////////////////////////////////////////////////////////////////////
+void FBDialog::linkClicked ( const QUrl & url )
+ {
+
+ qDebug() << "Loading the url: " << url;
+
+ proxysettings();
+ iWebView->load(url);
+}
+
+void FBDialog::loadStarted()
+{
+ qDebug() << "Load started: " << iWebView->url();
+ progressbar->setVisible(true);
+}
+void FBDialog::loadProgress(int progress)
+{
+ progressbar->setValue(progress);
+}
+/*void FBDialog::urlChanged ( const QUrl & url )
+ {
+ if(url.toString().contains(kInvalidUrl))
+ {
+ QUrl newurl(iWebView->url().toString());
+ qDebug()<<"url changed"<<iWebView->url().toString()<<"\n";
+ iWebView->setUrl(newurl);
+ iWebView->load(iWebView->url().toString());
+ }
+ }*/
+void FBDialog::GetSessionKey(const QUrl& aUrl)
+{
+
+}
+void FBDialog::connectToGetFullToken()
+{
+
+}
+void FBDialog::loadFinished ( bool ok )
+{
+ qDebug() << "Load " << (ok ? "" : "un") << "successfull for: " << iWebView->url();
+ progressbar->setVisible(false);
+ if (ok)
+ {
+ QString url = iWebView->url().toString();
+ qDebug() << "Loaded URL " << url;
+ qDebug() << "To be compared URL " << kMinitokensuccessURL;
+ if(url.compare(kMinitokensuccessURL) == 0)
+ {
+ iWebView->setHidden(true);
+ QMessageBox msgbox;
+ QString msg ("Complete the Authorization?");
+ msgbox.setText(msg);
+ msgbox.exec();
+
+ connectToGetFullToken();
+
+ }
+ }
+ else
+ {
+ if (iIgnorePageLoadCompleteEvent)
+ return;
+
+ FBError err;
+ dismissWithError(err);
+ }
+}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/example/FlickrAuthApp/src/loginDialog.cpp Thu Aug 05 16:46:37 2010 +0530
@@ -0,0 +1,131 @@
+/**
+* Copyright (c) 2010 Sasken Communication Technologies Ltd.
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of the "{License}"
+* which accompanies this distribution, and is available
+* at the URL "{LicenseUrl}".
+*
+* Initial Contributors:
+* Narasimhulu Kavadapu, Sasken Communication Technologies Ltd - Initial contribution
+*
+* Contributors:
+*
+* Description:
+* Login Dialog class of Authentication Application
+*/
+
+#include "authAppConstants.h"
+#include "sessionSP.h"
+#include "errorCodes.h"
+#include "loginDialog.h"
+#include <qdebug.h>
+
+///////////////////////////////////////////////////////////////////////////////////////////////////
+// global
+
+static const QString kLoginURL = "http://www.flickr.com/services/auth/";
+//static const QString kLoginURL = "http://www.flickr.com/auth-72157623913597531";
+
+
+///////////////////////////////////////////////////////////////////////////////////////////////////
+void FBLoginDialog::connectToGetFullToken()
+{
+ if(iGetSessionRequest == NULL ){
+
+ iGetSessionRequest = FBRequest::requestWithSession(iSession);
+
+ connect(iGetSessionRequest, SIGNAL(requestDidLoad(QVariant)), this, SLOT(requestDidLoad(QVariant)));
+ connect(iGetSessionRequest, SIGNAL(requestFailedWithNetworkError(QNetworkReply::NetworkError)), this, SLOT(requestFailedWithNetworkError(QNetworkReply::NetworkError)));
+ connect(iGetSessionRequest, SIGNAL(requestFailedWithFlickrError(FBError)), this, SLOT(requestFailedWithFlickrError(FBError)));
+
+ }
+
+ iGetSessionRequest->callforToken();
+}
+void FBLoginDialog::connecttoGetFrob()
+{
+ qDebug()<<"Inside FBLoginDialog::connecttoGetFrob";
+ iGetSessionRequest = FBRequest::requestWithSession(iSession);
+
+ connect(iGetSessionRequest, SIGNAL(requestDidLoad(QVariant)), this, SLOT(requestDidLoad(QVariant)));
+ connect(iGetSessionRequest, SIGNAL(requestFailedWithNetworkError(QNetworkReply::NetworkError)), this, SLOT(requestFailedWithNetworkError(QNetworkReply::NetworkError)));
+ connect(iGetSessionRequest, SIGNAL(requestFailedWithFlickrError(FBError)), this, SLOT(requestFailedWithFacebookError(FBError)));
+
+ Dictionary params;
+
+ iGetSessionRequest->call("flickr.auth.getFrob", params);
+
+}
+void FBLoginDialog::loadLoginPage()
+{
+ Dictionary getParams, postParams;
+
+ getParams["api_key"] = iSession->apiKey();
+ getParams["perms"] = "delete";
+ getParams["frob"] = iSession->frobKey();
+
+ FBRequest* req = FBRequest::requestWithSession(iSession);
+ QString sig = req->generateSig(getParams);
+
+ getParams["api_sig"] = sig;
+
+ QString fullURL;
+ fullURL = kLoginURL /*+ "?" + "api_key=" + iSession->apiKey() + "&perms=delete&frob=" + iSession->frobKey() + "&api_sig=" + sig*/;
+
+ loadURL(fullURL,QNetworkAccessManager::GetOperation, getParams, postParams);
+
+}
+///////////////////////////////////////////////////////////////////////////////////////////////////
+
+FBLoginDialog::FBLoginDialog() : FBDialog () {}
+
+FBLoginDialog::FBLoginDialog(FBSession* aSession) : FBDialog(aSession) {}
+
+///////////////////////////////////////////////////////////////////////////////////////////////////
+// FBDialog
+
+void FBLoginDialog::load()
+{
+ loadLoginPage();
+}
+///////////////////////////////////////////////////////////////////////////////////////////////////
+// slots for signals from FBRequest
+
+void FBLoginDialog::requestDidLoad(const QVariant& aResult)
+{
+ qDebug()<<"Inside FBLoginDialog::requestDidLoad";
+ bool conversionError = false;
+ QVariantHash object = aResult.toHash();
+
+ QString frob = object.value("frob").toString();
+ if(frob.length()){
+ iSession->SaveFrobKey(frob);
+ show();
+ }
+ qDebug()<<"frob = "<<frob;
+ qDebug() << "Root Object key : " << object.keys().takeFirst() << endl;
+
+ if(object.keys().takeFirst().compare("auth") == 0)
+ {
+
+ QVariantHash childobject = object.value("auth").toHash();
+ qDebug() << "Child Object data : " << childobject << endl;
+ QString token = childobject.value("token").toString();
+ qDebug() << "Read Token value : " << token << endl;
+ if(token.length()){
+ iSession->Savetoken(token);
+ }
+
+ }
+}
+
+void FBLoginDialog::requestFailedWithFlickrError (const FBError& aCode )
+{
+ dismissWithError(aCode);
+}
+
+void FBLoginDialog::requestFailedWithNetworkError( QNetworkReply::NetworkError aCode )
+{
+ dismissWithError(aCode);
+}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/example/FlickrAuthApp/src/requestSP.cpp Thu Aug 05 16:46:37 2010 +0530
@@ -0,0 +1,412 @@
+/**
+* Copyright (c) 2010 Sasken Communication Technologies Ltd.
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of the "{License}"
+* which accompanies this distribution, and is available
+* at the URL "{LicenseUrl}".
+*
+* Initial Contributors:
+* Narasimhulu Kavadapu, Sasken Communication Technologies Ltd - Initial contribution
+*
+* Contributors:
+*
+* Description:
+* class to handle calls to rest Server API's
+*/
+
+#define EMULATORTESTING
+
+#include "requestSP.h"
+#include "sessionSP.h"
+#include "xmlParser.h"
+#include "errorCodes.h"
+
+#include <QNetworkRequest>
+#include <QXmlSimpleReader>
+#include <QXmlInputSource>
+#include <QCryptographicHash>
+#include <QtAlgorithms>
+#include <QDebug>
+ #include <qnetworkproxy.h>
+
+///////////////////////////////////////////////////////////////////////////////////////////////////
+// global
+
+static const QString kAPIVersion = "1.0";
+static const QString kAPIFormat = "XML";
+static const QString kStringBoundary = "3i2ndDfv2rTHiSisAbouNdArYfORhtTPEefj3q2f";
+
+static const double kTimeoutInterval = 180.0;
+
+
+///////////////////////////////////////////////////////////////////////////////////////////////////
+
+static bool caseInsensitiveLessThan(const QString &s1, const QString &s2)
+{
+ return s1.toLower() < s2.toLower();
+}
+
+///////////////////////////////////////////////////////////////////////////////////////////////////
+// Static class functions
+
+FBRequest* FBRequest::request()
+{
+ return FBRequest::requestWithSession(FBSession::session());
+}
+
+FBRequest* FBRequest::requestWithSession (FBSession* aSession)
+{
+ FBRequest* request = new FBRequest(aSession);
+ return request;
+}
+
+///////////////////////////////////////////////////////////////////////////////////////////////////
+// instance public functions
+FBRequest::FBRequest(FBSession* aSession) : iSession ( aSession ), iNetworkAccessManager ( this )
+{}
+
+const QDateTime& FBRequest::timeStamp() const
+{
+ return iTimestamp;
+}
+
+void FBRequest::connect()
+{
+ qDebug()<<"Inside FBRequest::connect";
+ emit requestLoading();
+
+
+
+ QString url ;
+ /*if (iMethod.length())
+ url = iUrl;
+ else*/
+ url = generateGetURL();
+
+ qDebug() << "Complete URL : " << url;
+
+ QNetworkRequest request;
+ request.setUrl(QUrl(url));
+
+ /* from the Qt docs on QNetworkAccessManager:
+ QNetworkAccessManager by default does not have a set cache.
+ Qt provides a simple disk cache, QNetworkDiskCache, which can be used.
+
+ However we will not use it.*/
+
+ request.setAttribute(QNetworkRequest::CacheLoadControlAttribute, QNetworkRequest::AlwaysNetwork);
+ request.setAttribute(QNetworkRequest::CacheSaveControlAttribute, false);
+
+ iTimestamp = QDateTime::currentDateTime();
+
+ if (iMethod.length())
+ {
+ const QString contentType = "multipart/form-data; boundary=" + kStringBoundary;
+ request.setRawHeader("Content-Type", contentType.toUtf8());
+
+ /* connect all signals from iNetWorkAccessManager to this */
+ QByteArray postBody ;
+ generatePostBody (postBody);
+
+ pbar = new progressbar;
+ pbar->show();
+
+ #ifdef __WINSCW__
+ proxysettings();
+ #endif
+ QNetworkReply* reply = iNetworkAccessManager.get(request);
+
+ QObject::connect(reply, SIGNAL(finished()), this, SLOT(networkReplyFinished()));
+ QObject::connect(reply, SIGNAL(error(QNetworkReply::NetworkError)),
+ this, SLOT(networkReplyError(QNetworkReply::NetworkError)));
+
+ }
+}
+void FBRequest::proxysettings()
+{
+#ifdef EMULATORTESTING
+ qDebug()<<"proxysettings";
+
+ // Reading the keys, CSM Stubbed - START
+ QFile file("c://data//DoNotShare.txt");
+ if (!file.open(QIODevice::ReadOnly))
+ {
+ qDebug()<<"File to read the windows username and password could not be opened, returning!!!";
+ return;
+ }
+
+ QByteArray arr = file.readAll();
+ QList<QByteArray> list = arr.split(' ');
+ file.close();
+
+ QString username(list[0]);
+ QString password(list[1]);
+
+ QString httpProxy = "10.1.0.214";//ipwproxy.sasken.com
+ QString httpPort = "3128";
+
+ QString httpUser =username;/* This could be taken thru an QDialog implmentation to remove the Hard coding */
+ QString httpPass =password;/* This could be taken thru an QDialog implmentation to remove the Hard coding */
+
+ /*==Classes used from Network Module==*/
+ QNetworkProxy proxy;
+
+ proxy.setType(QNetworkProxy::HttpProxy);
+ proxy.setHostName(httpProxy);
+ proxy.setPort(httpPort.toInt());
+ proxy.setUser(httpUser);
+ proxy.setPassword(httpPass);
+
+ QNetworkProxy::setApplicationProxy(proxy);
+#endif
+}
+///////////////////////////////////////////////////////////////////////////////////////////////////
+// instance private functions
+QString FBRequest::md5(const QString& aData)
+{
+ QByteArray byteArray;
+ byteArray.insert(0, aData.toUtf8());
+
+ QByteArray md5Hash = QCryptographicHash::hash(byteArray,QCryptographicHash::Md5 ).toHex();
+ QString returnString ( md5Hash );
+
+ return returnString;
+}
+
+bool FBRequest::isSpecialMethod() const {
+ return ( iMethod.compare("facebook.auth.getSession", Qt::CaseInsensitive) == 0
+ || iMethod.compare("facebook.auth.createToken", Qt::CaseInsensitive) == 0 );
+}
+
+QString FBRequest::urlForMethod (const QString& aMethod) const {
+
+ return iSession->apiURL();
+}
+
+QString FBRequest::generateGetURL() const
+{
+ const QUrl url(iUrl);
+ const QString queryPrefix = url.hasQuery() ? "&" : "?";
+
+ QStringList pairs;
+ DictionaryIterator i(iParams);
+
+ while (i.hasNext()) {
+ i.next();
+ pairs << i.key().toUtf8() + "=" + i.value().toUtf8();
+ }
+
+ return iUrl + queryPrefix + pairs.join("&");
+}
+
+QString FBRequest::generateCallId() const {
+ QDateTime dateTime = QDateTime::currentDateTime();
+ uint secs = dateTime.toTime_t();
+ QString result = QString::number(secs, 10);
+ return result;
+}
+
+QString FBRequest::generateSig(Dictionary Params)
+{
+ QString joined;
+ QStringList keys = Params.keys();
+
+ qSort(keys.begin(), keys.end(), caseInsensitiveLessThan);
+
+ QListIterator<QString> i(keys);
+
+ joined.append(iSession->apiSecret().toUtf8());
+
+ while (i.hasNext())
+ {
+ const QString key = i.next();
+ joined.append(key.toUtf8());
+ //joined.append("=");
+ joined.append(Params.value(key).toUtf8());
+ }
+
+ return md5(joined);
+}
+
+void FBRequest::generatePostBody( QByteArray& body )
+{
+ QString endLine = "\r\n--" + kStringBoundary + "\r\n";
+ body.append( "--" + kStringBoundary.toUtf8() + "\r\n" ) ;
+
+
+ DictionaryIterator i (iParams);
+
+ while (i.hasNext())
+ {
+ i.next();
+
+ body.append("Content-Disposition: form-data; name=\"" + i.key().toUtf8() + "\"\r\n\r\n" );
+ body.append(i.value().toUtf8());
+ body.append(endLine.toUtf8());
+ }
+
+
+ if (iDataParam.size())
+ {
+ if (iDataParamPicture)
+ {
+ body.append("Content-Disposition: form-data; filename=\"photo\"\r\n" );
+ body.append("Content-Type: image/png\r\n\r\n" );
+ }
+ else
+ {
+ body.append("Content-Disposition: form-data; filename=\"data\"\r\n");
+ body.append("Content-Type: content/unknown\r\n\r\n");
+ }
+
+ body.append(iDataParam);
+ body.append(endLine.toUtf8());
+
+ }
+}
+
+void FBRequest::handleResponseData( const QByteArray& aResponseData )
+{
+ qDebug()<<"Inside FBRequest::handleResponseData";
+ FBError error;
+ QVariant result = parseXMLResponse( aResponseData, error);
+
+ qDebug() << "parsed result : " << result;
+
+ if (error.code() != 0)
+ {
+ emit requestFailedWithFlickrError(error);
+ }
+ else
+ {
+ emit requestDidLoad(result);
+ }
+
+ delete pbar;
+}
+
+void FBRequest::post( const QString& aUrl, const Dictionary& aParams)
+{
+ iUrl = aUrl;
+ iParams = aParams;
+
+ iSession->send(this);
+}
+
+void FBRequest::cancel()
+{
+
+}
+
+
+void FBRequest::call (const QString& aMethod, const Dictionary& aParams)
+{
+ qDebug()<<"Inside FBRequest::call";
+ QByteArray dataParams;
+ callWithDataParams(aMethod, aParams, dataParams, false);
+
+}
+void FBRequest::callforToken ()
+{
+
+ iUrl = iSession->apiURL();
+ iMethod = "flickr.auth.getToken";
+
+ Dictionary params;
+ params["method"] = iMethod;
+ params["api_key"] = iSession->apiKey();
+ params["frob"] = iSession->frobKey();
+
+ // XXX: workaround what seems to be a Qt bug with the extras-devel libraries.
+ QString signature = generateSig(params);
+
+ params["api_sig"] = signature;
+
+ iParams = params;
+ // XXX: end workaround.
+
+ iSession->send(this);
+}
+
+void FBRequest::callWithDataParams (const QString& aMethod, const Dictionary& aParams, const QByteArray& aDataParam, bool aDataParamPicture)
+{
+ qDebug()<<"Inside FBRequest::callWithDataParams";
+ iUrl = urlForMethod(aMethod);
+ iMethod = aMethod;
+ iParams = aParams;
+ iDataParam = aDataParam;
+ iDataParamPicture = aDataParamPicture;
+
+
+ iParams["method"] = iMethod;
+ iParams["api_key"] = iSession->apiKey();
+
+ // XXX: workaround what seems to be a Qt bug with the extras-devel libraries.
+ QString signature = generateSig(iParams);
+ iParams["api_sig"] = signature;
+ // XXX: end workaround.
+
+ iSession->send(this);
+}
+
+
+QVariant FBRequest::parseXMLResponse ( const QByteArray& aResponseData, FBError& aError)
+{
+ qDebug()<<"Inside FBRequest::parseXMLResponse";
+ QXmlInputSource input;
+ input.setData(aResponseData);
+
+ FBXMLHandler handler;
+ QXmlSimpleReader parser;
+ parser.setContentHandler(&handler);
+ bool result = parser.parse(&input);
+
+ QVariant rootObject = handler.rootObject();
+
+
+ if (handler.parseError() || !result)
+ {
+ aError.setCode( FBRESPONSE_PARSE_ERROR );
+ aError.setDescription("parser was unable to parse the xml response from facebook server.");
+
+ return QVariant();
+ }
+ else if (handler.rootName().compare("error_response")==0)
+ {
+ QVariantHash errorDict = rootObject.toHash();
+
+ bool result;
+ int errorCode = errorDict.value("error_code").toInt(&result);
+
+ aError.setCode( errorCode );
+ aError.setDescription( errorDict.value("error_msg").toString() );
+
+ return rootObject;
+ }
+ else
+ {
+ return rootObject;
+ }
+
+}
+
+///////////////////////////////////////////////////////////////////////////////////////////////////
+// instance provate slots
+void FBRequest::networkReplyError ( QNetworkReply::NetworkError aCode )
+{
+ emit requestFailedWithNetworkError(aCode );
+}
+
+void FBRequest::networkReplyFinished ()
+{
+ qDebug()<<"Inside FBRequest::networkReplyFinished";
+ QNetworkReply* reply = static_cast<QNetworkReply*> ( sender() );
+ QByteArray responseData = reply->readAll();
+
+ qDebug() << "Response Data(QByteArray) : " << responseData;
+ QString str(responseData);
+ qDebug() << "Response Data(QString) : " << str;
+ handleResponseData ( responseData );
+
+}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/example/FlickrAuthApp/src/sessionSP.cpp Thu Aug 05 16:46:37 2010 +0530
@@ -0,0 +1,190 @@
+/**
+* Copyright (c) 2010 Sasken Communication Technologies Ltd.
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of the "{License}"
+* which accompanies this distribution, and is available
+* at the URL "{LicenseUrl}".
+*
+* Initial Contributors:
+* Narasimhulu Kavadapu, Sasken Communication Technologies Ltd - Initial contribution
+*
+* Contributors:
+*
+* Description:
+* class to maintian session & all credential keys.
+*/
+
+#include "sessionSP.h"
+#include "requestSP.h"
+#include <qfile.h>
+#include <QTimer>
+#include <qdebug.h>
+
+#include "keys.h"
+
+///////////////////////////////////////////////////////////////////////////////////////////////////
+// global
+
+static const QString kAPIRestURL = "http://api.flickr.com/services/rest/";
+
+static const int kMaxBurstRequests = 3;
+static const int kBurstDuration = 2;
+
+static FBSession* sharedSession = NULL;
+
+///////////////////////////////////////////////////////////////////////////////////////////////////
+// Static class functions
+FBSession* FBSession::session()
+{
+ return sharedSession;
+}
+
+void FBSession::setSession(FBSession* aSession)
+{
+ sharedSession = aSession;
+}
+
+
+FBSession* FBSession::sessionForApplication ( const QString& aAppKey, const QString& aAppSecret, const QString& aSessionProxy)
+{
+ FBSession* session = new FBSession ( aAppKey, aAppSecret, aSessionProxy );
+ return session;
+}
+
+///////////////////////////////////////////////////////////////////////////////////////////////////
+// instance public functions
+FBSession::FBSession( const QString& aAppKey, const QString& aAppSecret, const QString& aGetSessionProxy ) :
+ iApiKey (aAppKey),
+ iApiSecret ( aAppSecret ),
+ m_Client(new SmfCredMgrClient(this))
+{
+ if (!sharedSession)
+ {
+ sharedSession = this;
+ }
+}
+
+FBSession::~FBSession()
+{
+ if(m_Client){
+ delete m_Client;
+ m_Client = NULL;
+ }
+}
+
+const QString& FBSession::apiURL() const
+{
+ return kAPIRestURL;
+}
+void FBSession::SaveFrobKey (const QString& frob )
+{
+ iFrobKey = frob;
+ //save();
+}
+void FBSession::Savetoken (const QString& token )
+{
+ qDebug()<<"Inside FBSession::Savetoken";
+ qDebug()<<"token argument = "<<token;
+ iToken = token;
+ save();
+ emit sessionDidLogin(token);
+}
+bool FBSession::resume()
+{
+ QString CMRegToken = iSettings.value("CMFlickrRegToken", "NA" ).toString();
+ QDateTime ExpiryTime = iSettings.value("FlckrExpiryTime","NA").toDateTime();
+
+ qDebug() << "CMRegToken = :" << CMRegToken;
+ qDebug() << "ExpiryTime = :" << ExpiryTime;
+
+ SmfAuthParams Params;
+ if(m_Client->AuthDataSet(CMRegToken,ExpiryTime,Params))
+ {
+ QByteArray accessToken = Params.value("finalToken");
+ emit sessionDidLogin( accessToken );
+ return true;
+ }
+ return false;
+}
+void FBSession::logout() {
+
+ iToken.clear();
+ iFrobKey.clear();
+
+ unsave();
+
+ emit sessionDidLogout();
+}
+
+void FBSession::send (FBRequest* aRequest) {
+ qDebug()<<"Inside FBSession::send";
+ performRequest (aRequest, true);
+}
+
+
+///////////////////////////////////////////////////////////////////////////////////////////////////
+// instance private functions
+void FBSession::save()
+{
+ qDebug()<<"Inside FBSession::save()";
+ qDebug()<<"Auth token = "<<iToken;
+ /* if (iFrobKey.length()) {
+ iSettings.setValue("FrobKey", iFrobKey);
+ } else {
+ iSettings.remove("FrobKey");
+ }
+ if (iToken.length()) {
+ iSettings.setValue("FullToken", iToken);
+ } else {
+ iSettings.remove("FullToken");
+ }
+
+ iSettings.sync();*/
+
+
+ SmfAuthParams Params;
+ Params.insert("ApiKey",kApiKey.toAscii());
+ Params.insert("ApiSecret",kApiSecret.toAscii());
+ Params.insert("AuthToken",iToken.toAscii());
+
+ QList<QUrl> UrlList;
+ UrlList.append(QUrl("http://api.flickr.com"));
+
+ QStringList PluginList;
+ PluginList.append(QString("flickrcontactfetcherplugin.qtplugin"));
+ PluginList.append(QString("flickrgalleryplugin.qtplugin"));
+
+ QString UID("0xE1D8C7D7");
+
+ //Currently Hardcoded with current time bcoz CM is not handling expiry time as '0' value
+ QDateTime ExpirationDate = QDateTime::currentDateTime();
+ ExpirationDate.addYears(1);
+
+ QString CMRegToken = m_Client->StoreAuthData(Params,ExpirationDate,UrlList,PluginList,UID,true);
+
+ qDebug()<<"Reg token from CSM = "<<CMRegToken;
+ qDebug()<<"Reg token size = "<<CMRegToken.count();
+ qDebug()<<"Exp date from CSM = "<<ExpirationDate;
+
+ iSettings.remove("CMFlickrRegToken");
+ iSettings.remove("FlckrExpiryTime");
+
+ if(CMRegToken.size())
+ {
+ iSettings.setValue("CMFlickrRegToken", CMRegToken);
+ iSettings.setValue("FlckrExpiryTime", ExpirationDate);
+ }
+}
+
+void FBSession::unsave()
+{
+
+}
+bool FBSession::performRequest(FBRequest* aRequest, bool aEnqueue) {
+ // Stagger requests that happen in short bursts to prevent the server from rejecting
+ // them for making too many requests in a short time
+ qDebug()<<"Inside FBSession::performRequest";
+ aRequest->connect();
+ return true;
+}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/example/FlickrAuthApp/src/xmlParser.cpp Thu Aug 05 16:46:37 2010 +0530
@@ -0,0 +1,208 @@
+/**
+* Copyright (c) 2010 Sasken Communication Technologies Ltd.
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of the "{License}"
+* which accompanies this distribution, and is available
+* at the URL "{LicenseUrl}".
+*
+* Initial Contributors:
+* Narasimhulu Kavadapu, Sasken Communication Technologies Ltd - Initial contribution
+*
+* Contributors:
+*
+* Description:
+* XML Parser class
+*/
+#include "xmlParser.h"
+
+#include <QVariantList>
+///////////////////////////////////////////////////////////////////////////////////////////////////
+// instance public functions
+
+FBXMLHandler::FBXMLHandler() : iError(false)
+{
+ initWhiteSpaceHash();
+}
+
+FBXMLHandler::~FBXMLHandler()
+{
+ iWhiteSpaceAndNewLineCharSet.clear();
+}
+
+///////////////////////////////////////////////////////////////////////////////////////////////////
+// instance private functions
+
+void FBXMLHandler::initWhiteSpaceHash()
+{
+ iWhiteSpaceAndNewLineCharSet.insert(QChar(0x20), true);
+ iWhiteSpaceAndNewLineCharSet.insert(QChar(0x9), true);
+ iWhiteSpaceAndNewLineCharSet.insert(QChar(0xA), true);
+ iWhiteSpaceAndNewLineCharSet.insert(QChar(0xB), true);
+ iWhiteSpaceAndNewLineCharSet.insert(QChar(0xC), true);
+ iWhiteSpaceAndNewLineCharSet.insert(QChar(0xD), true);
+ iWhiteSpaceAndNewLineCharSet.insert(QChar(0x85), true);
+}
+
+/* methods from QXmlErrorHandler */
+bool FBXMLHandler::error(const QXmlParseException& exception)
+{
+ iParseErrorMessage = exception.message();
+ iError = true;
+ return false;
+}
+
+bool FBXMLHandler::fatalError(const QXmlParseException& exception)
+{
+ iParseErrorMessage = exception.message();
+ iError = true;
+ return false;
+}
+
+/* methods from QXmlDefaultHandler */
+bool FBXMLHandler::startElement( const QString & /*namespaceURI*/,
+ const QString & localName,
+ const QString & /*qName*/,
+ const QXmlAttributes & atts)
+{
+ flushCharacters();
+
+ QVariant item ;
+
+ if (atts.value("list").compare("true")==0)
+ {
+ item = QVariantList();
+ }
+
+ iStack.append(item);
+ iNameStack.append(localName);
+
+ return true;
+}
+
+bool FBXMLHandler::characters(const QString& aText)
+{
+ iChars.append(aText);
+ return true;
+}
+
+bool FBXMLHandler::endElement( const QString & /*namespaceURI*/,
+ const QString & /*localName*/,
+ const QString & /*qName*/ )
+{
+ flushCharacters();
+
+ QVariant c = iStack [iStack.count() - 1] ;
+ QString name = topName();
+
+ iStack.removeLast();
+ iNameStack.removeLast();
+
+ if (!iStack.count())
+ {
+ iRootObject = c;
+ iRootName = name;
+ }
+ else
+ {
+ QVariant tC = iStack[iStack.count() - 1] ;
+ if (tC.isNull())
+ {
+ tC = QVariantHash();
+ iStack.replace(iStack.count() - 1, tC);
+ }
+
+ if (tC.type() == QVariant::List)
+ {
+ QVariantList list = tC.toList();
+ list.append( c.toHash() );
+
+ iStack.replace( iStack.count() - 1 , list);
+
+ }
+ else if (tC.type() == QVariant::Hash)
+ {
+ QVariantHash hash = tC.toHash();
+ if (c.isNull())
+ {
+ c = QString("");
+ }
+ hash.insert( name, c );
+
+ iStack.replace( iStack.count() - 1 , hash);
+ }
+ }
+
+ return true;
+}
+
+
+/* */
+const QString& FBXMLHandler::topName() const
+{
+ return iNameStack.last();
+}
+
+QVariant FBXMLHandler::topObject(bool /*aCreate*/)
+{
+ QVariant item ;
+ {
+ iStack.replace(iStack.count() - 1, item);
+ }
+ return item;
+}
+
+QVariant FBXMLHandler::topContainer()
+{
+ if (iStack.count() < 2)
+ {
+ return QVariant();
+ }
+ else
+ {
+
+ QVariant item = iStack[iStack.count() - 2 ];
+ {
+ iStack.replace( iStack.count() - 2 , item);
+ }
+
+ return item;
+ }
+}
+
+void FBXMLHandler::flushCharacters()
+{
+ for ( int i = 0; i < iChars.length(); i ++)
+ {
+ QChar uniChar = iChars.at(i);
+
+ if (!iWhiteSpaceAndNewLineCharSet.contains(uniChar))
+ {
+
+ QVariant container;
+ if (iStack.count() >= 2)
+ {
+ container = iStack[iStack.count() - 2];
+ if (container.isNull())
+ {
+ container = QVariantHash();
+ iStack.replace( iStack.count() - 2 , container);
+ }
+ }
+
+ if (container.type() == QVariant::List)
+ {
+ QVariantHash object;
+ object.insert( topName(), iChars );
+ iStack.replace (iStack.count() - 1, object);
+ } else {
+ QVariant object(iChars);
+ iStack.replace (iStack.count() - 1, object);
+ }
+ break;
+ }
+
+ }
+
+ iChars.clear();
+}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/example/FlickrAuthApp/ui_AuthApp.h Thu Aug 05 16:46:37 2010 +0530
@@ -0,0 +1,82 @@
+/********************************************************************************
+** Form generated from reading UI file 'AuthApp.ui'
+**
+** Created: Fri Jul 30 14:06:39 2010
+** by: Qt User Interface Compiler version 4.6.2
+**
+** WARNING! All changes made in this file will be lost when recompiling UI file!
+********************************************************************************/
+
+#ifndef UI_AUTHAPP_H
+#define UI_AUTHAPP_H
+
+#include <QtCore/QVariant>
+#include <QtGui/QAction>
+#include <QtGui/QApplication>
+#include <QtGui/QButtonGroup>
+#include <QtGui/QHeaderView>
+#include <QtGui/QMainWindow>
+#include <QtGui/QPushButton>
+#include <QtGui/QSpacerItem>
+#include <QtGui/QVBoxLayout>
+#include <QtGui/QWidget>
+
+QT_BEGIN_NAMESPACE
+
+class Ui_AuthAppClass
+{
+public:
+ QWidget *centralWidget;
+ QVBoxLayout *verticalLayout;
+ QPushButton *buttonForget;
+ QPushButton *pushButton;
+ QSpacerItem *verticalSpacer;
+
+ void setupUi(QMainWindow *AuthAppClass)
+ {
+ if (AuthAppClass->objectName().isEmpty())
+ AuthAppClass->setObjectName(QString::fromUtf8("AuthAppClass"));
+ AuthAppClass->resize(275, 310);
+ centralWidget = new QWidget(AuthAppClass);
+ centralWidget->setObjectName(QString::fromUtf8("centralWidget"));
+ verticalLayout = new QVBoxLayout(centralWidget);
+ verticalLayout->setSpacing(6);
+ verticalLayout->setContentsMargins(11, 11, 11, 11);
+ verticalLayout->setObjectName(QString::fromUtf8("verticalLayout"));
+ buttonForget = new QPushButton(centralWidget);
+ buttonForget->setObjectName(QString::fromUtf8("buttonForget"));
+
+ verticalLayout->addWidget(buttonForget);
+
+ pushButton = new QPushButton(centralWidget);
+ pushButton->setObjectName(QString::fromUtf8("pushButton"));
+
+ verticalLayout->addWidget(pushButton);
+
+ verticalSpacer = new QSpacerItem(20, 40, QSizePolicy::Minimum, QSizePolicy::Expanding);
+
+ verticalLayout->addItem(verticalSpacer);
+
+ AuthAppClass->setCentralWidget(centralWidget);
+
+ retranslateUi(AuthAppClass);
+
+ QMetaObject::connectSlotsByName(AuthAppClass);
+ } // setupUi
+
+ void retranslateUi(QMainWindow *AuthAppClass)
+ {
+ AuthAppClass->setWindowTitle(QApplication::translate("AuthAppClass", "MainWindow", 0, QApplication::UnicodeUTF8));
+ buttonForget->setText(QApplication::translate("AuthAppClass", "Logout", 0, QApplication::UnicodeUTF8));
+ pushButton->setText(QApplication::translate("AuthAppClass", "Login to Flickr", 0, QApplication::UnicodeUTF8));
+ } // retranslateUi
+
+};
+
+namespace Ui {
+ class AuthAppClass: public Ui_AuthAppClass {};
+} // namespace Ui
+
+QT_END_NAMESPACE
+
+#endif // UI_AUTHAPP_H
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/example/FlickrAuthApp/ui_progressbar.h Thu Aug 05 16:46:37 2010 +0530
@@ -0,0 +1,75 @@
+/********************************************************************************
+** Form generated from reading UI file 'progressbar.ui'
+**
+** Created: Fri Jul 30 14:06:35 2010
+** by: Qt User Interface Compiler version 4.6.2
+**
+** WARNING! All changes made in this file will be lost when recompiling UI file!
+********************************************************************************/
+
+#ifndef UI_PROGRESSBAR_H
+#define UI_PROGRESSBAR_H
+
+#include <QtCore/QVariant>
+#include <QtGui/QAction>
+#include <QtGui/QApplication>
+#include <QtGui/QButtonGroup>
+#include <QtGui/QHeaderView>
+#include <QtGui/QLabel>
+#include <QtGui/QProgressBar>
+#include <QtGui/QVBoxLayout>
+#include <QtGui/QWidget>
+
+QT_BEGIN_NAMESPACE
+
+class Ui_progressbarClass
+{
+public:
+ QVBoxLayout *verticalLayout;
+ QLabel *label;
+ QProgressBar *progressBar;
+
+ void setupUi(QWidget *progressbarClass)
+ {
+ if (progressbarClass->objectName().isEmpty())
+ progressbarClass->setObjectName(QString::fromUtf8("progressbarClass"));
+ verticalLayout = new QVBoxLayout(progressbarClass);
+ verticalLayout->setSpacing(6);
+ verticalLayout->setContentsMargins(11, 11, 11, 11);
+ verticalLayout->setObjectName(QString::fromUtf8("verticalLayout"));
+ label = new QLabel(progressbarClass);
+ label->setObjectName(QString::fromUtf8("label"));
+
+ verticalLayout->addWidget(label);
+
+ progressBar = new QProgressBar(progressbarClass);
+ progressBar->setObjectName(QString::fromUtf8("progressBar"));
+ progressBar->setValue(24);
+
+ verticalLayout->addWidget(progressBar);
+
+
+ retranslateUi(progressbarClass);
+
+ QMetaObject::connectSlotsByName(progressbarClass);
+ } // setupUi
+
+ void retranslateUi(QWidget *progressbarClass)
+ {
+ progressbarClass->setWindowTitle(QApplication::translate("progressbarClass", "progressbar", 0, QApplication::UnicodeUTF8));
+ label->setText(QApplication::translate("progressbarClass", "<!DOCTYPE HTML PUBLIC \"-//W3C//DTD HTML 4.0//EN\" \"http://www.w3.org/TR/REC-html40/strict.dtd\">\n"
+"<html><head><meta name=\"qrichtext\" content=\"1\" /><style type=\"text/css\">\n"
+"p, li { white-space: pre-wrap; }\n"
+"</style></head><body style=\" font-family:'MS Shell Dlg 2'; font-size:8.25pt; font-weight:400; font-style:normal;\">\n"
+"<p style=\" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;\"><span style=\" font-size:10pt;\">Loading,Please wait.....</span></p></body></html>", 0, QApplication::UnicodeUTF8));
+ } // retranslateUi
+
+};
+
+namespace Ui {
+ class progressbarClass: public Ui_progressbarClass {};
+} // namespace Ui
+
+QT_END_NAMESPACE
+
+#endif // UI_PROGRESSBAR_H
--- a/example/example.pro Thu Aug 05 16:35:33 2010 +0530
+++ b/example/example.pro Thu Aug 05 16:46:37 2010 +0530
@@ -1,7 +1,11 @@
TEMPLATE = subdirs
-
SUBDIRS = AuthApp \
+ FlickrAuthApp \
+ fbactivityfetcherplugin \
fbcontactfetcherplugin \
fbpostproviderplugin \
flickrcontactfetcherplugin \
- smfclientapp
+ flickrgalleryplugin \
+ smfclientapp \
+ DemoGUI
+CONFIG += ordered
\ No newline at end of file
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/example/fbactivityfetcherplugin/fbactivityfetcherplugin.cpp Thu Aug 05 16:46:37 2010 +0530
@@ -0,0 +1,1002 @@
+/**
+ * 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:
+ * Nalina Hariharan
+ *
+ * Description:
+ * The Plugin that fetches activities from the logged in user's facebook account
+ *
+ */
+
+// Include files
+#include <QtPlugin>
+#include <QDebug>
+#include <QCryptographicHash>
+#include <QFile>
+#include <QMap>
+#include <QXmlStreamReader>
+#include <QSettings>
+#include <smfactions.h>
+#include <smfpluginutil.h>
+
+#include "fbactivityfetcherplugin.h"
+
+// Global and static global variables
+static int chance = 0;
+QString currentUserId;
+SmfActivityEntry myEntry;
+SmfContact currentAuthor;
+QList<SmfActivityObject> currentObjectList;
+SmfActivityObject currentObject;
+bool forEntryXmlTag;
+bool forActivityObjectXmlTag;
+
+/**
+ * Destructor
+ */
+FBActivityFetcherPlugin::~FBActivityFetcherPlugin( )
+ {
+ if(m_provider)
+ delete m_provider;
+ }
+
+
+/**
+ * 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 FBActivityFetcherPlugin::generateSignature(const QString aBaseString)
+ {
+ qDebug()<<"Inside FBActivityFetcherPlugin::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 to interpret the key sets obtained from credential manager
+ * @param aApiKey [out] The api key
+ * @param aApiSecret [out] The api secret
+ * @param aSessionKey [out] The session key
+ * @param aSessionSecret [out] The session secret
+ * @param aAppId [out] The application ID
+ */
+void FBActivityFetcherPlugin::fetchKeys( QString &aApiKey,
+ QString &aApiSecret,
+ QString &aSessionKey,
+ QString &aSessionSecret,
+ QString &aAppId)
+ {
+ qDebug()<<"Inside FBActivityFetcherPlugin::fetchKeys()";
+
+ qDebug()<<"Reg Token = "<<m_provider->m_smfRegToken;
+ qDebug()<<"Expiry Date as int = "<<m_provider->m_validity.toTime_t();
+
+ SmfAuthParams keys;
+ SmfPluginUtil util;
+ util.getAuthKeys(keys, m_provider->m_smfRegToken,
+ m_provider->m_validity, m_provider->m_pluginId);
+
+ qDebug()<<"Number of key-value pairs = "<<keys.count();
+
+ QByteArray keyName;
+ keyName.append("ApiKey");
+ aApiKey.append(keys.value(keyName));
+
+ keyName.clear();
+ keyName.append("ApiSecret");
+ aApiSecret.append(keys.value(keyName));
+
+ keyName.clear();
+ keyName.append("SessionKey");
+ aSessionKey.append(keys.value(keyName));
+
+ keyName.clear();
+ keyName.append("SessionSecret");
+ aSessionSecret.append(keys.value(keyName));
+
+ keyName.clear();
+ keyName.append("AppId");
+ aAppId.append(keys.value(keyName));
+
+ qDebug()<<"Api Key = "<<aApiKey;
+ qDebug()<<"Api Secret = "<<aApiSecret;
+ qDebug()<<"session Key = "<<aSessionKey;
+ qDebug()<<"session Secret = "<<aSessionSecret;
+ qDebug()<<"App Id Secret = "<<aAppId;
+ }
+
+
+/**
+ * Method to get the list of self activities, e.g. shown in own wall
+ * @param aRequest [out] The request data that plugin generates (to be sent to network)
+ * @param aPageNum[in] The page to be extracted
+ * @param aItemsPerPage[in] Number of items per page
+ * @return SmfPluginError Plugin error if any, else SmfPluginErrNone
+ */
+SmfPluginError FBActivityFetcherPlugin::selfActivities( SmfPluginRequestData &aRequest,
+ const int aPageNum,
+ const int aItemsPerPage )
+ {
+ qDebug()<<"Inside FBActivityFetcherPlugin::selfActivities()";
+
+ //// Currently considering for self contact , ie, omitting aUser
+ if(0 == chance)
+ return getFacebookUserId(aRequest);
+ else
+ return getSelfActivities(aRequest, aPageNum, aItemsPerPage);
+ }
+
+
+/**
+ * Method to get the user's facebook ID
+ * @param aRequest [out] The request data to be sent to network
+ * @return SmfPluginError Plugin error if any, else SmfPluginErrNone
+ */
+SmfPluginError FBActivityFetcherPlugin::getFacebookUserId(
+ SmfPluginRequestData &aRequest )
+ {
+ qDebug()<<"Inside FBActivityFetcherPlugin::getFacebookUserId()";
+
+ SmfPluginError error = SmfPluginErrUserNotLoggedIn;
+
+ // Get the key sets from SMF Plugin Utility class.
+ QString apiKey;
+ QString apiSecret;
+ QString sessionKey;
+ QString sessionSecret;
+ QString appId;
+ fetchKeys(apiKey, apiSecret, sessionKey, sessionSecret, appId);
+
+ // 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=JSON");
+ baseString.append("method=users.getLoggedInUser");
+ 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", "JSON");
+ url.addQueryItem("method", "users.getLoggedInUser");
+ 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 = SmfActivitySelfActivity;
+ aRequest.iPostData = NULL;
+ aRequest.iHttpOperationType = QNetworkAccessManager::GetOperation;
+ error = SmfPluginErrNone;
+
+ qDebug()<<"Url string is : "<<aRequest.iNetworkRequest.url().toString();
+ return error;
+ }
+
+/**
+ * Method to get the list of self activities, e.g. shown in own wall
+ * @param aRequest [out] The request data that plugin generates (to be sent to network)
+ * @param aPageNum[in] The page to be extracted
+ * @param aItemsPerPage[in] Number of items per page
+ * @return SmfPluginError Plugin error if any, else SmfPluginErrNone
+ */
+SmfPluginError FBActivityFetcherPlugin::getSelfActivities( SmfPluginRequestData &aRequest,
+ const int aPageNum,
+ const int aItemsPerPage )
+ {
+ qDebug()<<"Inside FBActivityFetcherPlugin::getSelfActivities()";
+
+ SmfPluginError error = SmfPluginErrInvalidArguments;
+
+ // invalid arguments
+ if( aPageNum < 0 || aItemsPerPage < 0 )
+ {
+ qDebug()<<"Invalid arguments";
+ return error;
+ }
+
+ qDebug()<<"Valid arguments";
+
+ // Get the key sets from SMF Plugin Utility class.
+ QString apiKey;
+ QString apiSecret;
+ QString sessionKey;
+ QString sessionSecret;
+ QString applicationId;
+ fetchKeys(apiKey, apiSecret, sessionKey, sessionSecret, applicationId);
+
+ // Create the API signature string
+ QString baseString;
+ baseString.append("app_id="+applicationId);
+ baseString.append("session_key="+sessionKey);
+ baseString.append("source_id="+currentUserId);
+ baseString.append(sessionSecret);
+
+ // Create the url
+ QUrl url("http://www.facebook.com/activitystreams/feed.php?");
+ url.addQueryItem("app_id", applicationId);
+ url.addQueryItem("session_key", sessionKey);
+ url.addQueryItem("source_id", currentUserId);
+ url.addQueryItem("sig", generateSignature(baseString));
+ url.addQueryItem("v", "0.7");
+ QString str(url.toString());
+ str.append("&read");
+
+ // Create the request, set the url
+ aRequest.iNetworkRequest.setUrl(QUrl(str));
+ aRequest.iRequestType = SmfActivitySelfActivity;
+ aRequest.iPostData = NULL;
+ aRequest.iHttpOperationType = QNetworkAccessManager::GetOperation;
+ error = SmfPluginErrNone;
+
+ qDebug()<<"Url string is : "<<aRequest.iNetworkRequest.url().toString();
+ return error;
+ }
+
+/**
+ * Method to get the list of activities for other, e.g. shown in a friends wall
+ * @param aRequest [out] The request data plugin generated (to be sent to network)
+ * @param aContact [in] The contact containing the URI, name or id of the user
+ * @param aPageNum[in] The page to be extracted
+ * @param aItemsPerPage[in] Number of items per page
+ * @return SmfPluginError Plugin error if any, else SmfPluginErrNone
+ */
+SmfPluginError FBActivityFetcherPlugin::friendsActivities( SmfPluginRequestData &aRequest,
+ const SmfContact &aContact,
+ const int aPageNum,
+ const int aItemsPerPage )
+ {
+ qDebug()<<"Inside FBActivityFetcherPlugin::friendsActivities()";
+
+ SmfPluginError error = SmfPluginErrInvalidArguments;
+ chance = 1;
+
+ // invalid arguments
+ if( aPageNum < 0 || aItemsPerPage < 0 )
+ {
+ qDebug()<<"Invalid arguments";
+ return error;
+ }
+
+ qDebug()<<"Valid arguments";
+
+ // Get the key sets from SMF Plugin Utility class.
+ QString apiKey;
+ QString apiSecret;
+ QString sessionKey;
+ QString sessionSecret;
+ QString applicationId;
+ fetchKeys(apiKey, apiSecret, sessionKey, sessionSecret, applicationId);
+
+ // ToDo :- Taking QContactGuid for the time being
+ QString sourceId = aContact.value("Guid").value<QContactGuid>().guid();
+ qDebug()<<"Friends facebook ID = "<<sourceId;
+
+ // Create the API signature string
+ QString baseString;
+ baseString.append("app_id="+applicationId);
+ baseString.append("session_key="+sessionKey);
+ baseString.append("source_id="+sourceId);
+ baseString.append(sessionSecret);
+
+ // Create the url
+ QUrl url("http://www.facebook.com/activitystreams/feed.php?");
+ url.addQueryItem("app_id", applicationId);
+ url.addQueryItem("session_key", sessionKey);
+ url.addQueryItem("source_id", sourceId);
+ url.addQueryItem("sig", generateSignature(baseString));
+ url.addQueryItem("v", "0.7");
+ QString str(url.toString());
+ str.append("&read");
+
+ // Create the request, set the url
+ aRequest.iNetworkRequest.setUrl(QUrl(str));
+ aRequest.iRequestType = SmfActivityFriendsActivities;
+ aRequest.iPostData = NULL;
+ aRequest.iHttpOperationType = QNetworkAccessManager::GetOperation;
+ error = SmfPluginErrNone;
+
+ qDebug()<<"Url string is : "<<aRequest.iNetworkRequest.url().toString();
+ return error;
+ }
+
+/**
+ * Method to get list of self activities filtered by activity type, e.g. only photo updates in own wall
+ * @param aRequest [out] The request data plugin generated (to be sent to network)
+ * @param aFilters [in] The list of activity types to be included in result
+ * @param aPageNum[in] The page to be extracted
+ * @param aItemsPerPage[in] Number of items per page
+ * @return SmfPluginError Plugin error if any, else SmfPluginErrNone
+ */
+SmfPluginError FBActivityFetcherPlugin::filtered( SmfPluginRequestData &aRequest,
+ QList<SmfActivityObjectType> &aFilters,
+ const int aPageNum,
+ const int aItemsPerPage )
+ {
+ qDebug()<<"Inside FBActivityFetcherPlugin::filtered()";
+
+ Q_UNUSED(aRequest)
+ Q_UNUSED(aFilters)
+ Q_UNUSED(aPageNum)
+ Q_UNUSED(aItemsPerPage)
+ return SmfPluginErrServiceNotSupported;
+ }
+
+/**
+ * Customised method for SmfActivityFetcherPlugin 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 FBActivityFetcherPlugin::customRequest( SmfPluginRequestData &aRequest,
+ const int &aOperation, QByteArray *aData )
+ {
+ Q_UNUSED(aRequest)
+ Q_UNUSED(aOperation)
+ Q_UNUSED(aData)
+ qDebug()<<"Inside FBActivityFetcherPlugin::customRequest()";
+ return SmfPluginErrServiceNotSupported;
+ }
+
+
+/**
+ * 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.
+ */
+void FBActivityFetcherPlugin::initialize( )
+ {
+ // Set the global value
+ forActivityObjectXmlTag = false;
+ forEntryXmlTag = false;
+
+ // Create an instance of FBActivityProviderBase
+ m_provider = new FBActivityProviderBase;
+ m_provider->initialize();
+ }
+
+
+/**
+ * Method to get the provider information
+ * @return Instance of SmfProviderBase
+ */
+SmfProviderBase* FBActivityFetcherPlugin::getProviderInfo( )
+ {
+ return m_provider;
+ }
+
+
+/**
+ * Method to get the result for a network request.
+ * @param aOperation The type of operation to be requested
+ * @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 SmfActivityFetcherPlugin: If last operation was selfActivities() or
+ * friendsActivities() or filtered(), aResult will be of type
+ * QList<SmfActivityEntry>.
+ * @param aRetType [out] SmfPluginRetType
+ * @param aPageResult [out] The SmfResultPage structure variable
+ */
+SmfPluginError FBActivityFetcherPlugin::responseAvailable(
+ const SmfRequestTypeID aOperation,
+ const SmfTransportResult &aTransportResult,
+ QByteArray *aResponse,
+ QVariant* aResult,
+ SmfPluginRetType &aRetType,
+ SmfResultPage &aPageResult )
+ {
+ Q_UNUSED(aPageResult)
+ qDebug()<<"Inside FBActivityFetcherPlugin::responseAvailable()";
+
+ SmfPluginError error = SmfPluginErrNetworkError;
+
+ if( !aResponse || (0 == aResponse->size()) )
+ {
+ qDebug()<<"Response is NULL or empty";
+ aRetType = SmfRequestError;
+ return error;
+ }
+
+ QByteArray response(*aResponse);
+ delete aResponse;
+
+ QFile respFile("c://data//SmfPluginActivityResponse.txt");
+ if(!respFile.open(QIODevice::WriteOnly))
+ qDebug()<<"File to write the response could not be opened";
+ else
+ {
+ respFile.write(response);
+ respFile.close();
+ qDebug()<<"Writing FB response to a file named 'SmfPluginActivityResponse.txt'";
+ }
+ qDebug()<<"FB response size = "<<response.size();
+
+
+ if(SmfTransportOpNoError == aTransportResult)
+ {
+ qDebug()<<"No transport error";
+
+ if((SmfActivitySelfActivity == aOperation) ||
+ (SmfActivityFriendsActivities == aOperation))
+ {
+ qDebug()<<"Response for retrieving self/friends activities";
+ if(0 == chance)
+ {
+ chance = 1;
+ qDebug()<<"For Getting Current logged in User for self activity";
+
+ QString errStr;
+ errStr.clear();
+ currentUserId.clear();
+
+ if(response.contains(QByteArray("error_msg")))
+ {
+ qDebug()<<"Response contains error, so parse and get the error code";
+
+ bool ok;
+ SmfPluginUtil util;
+ QVariant result = util.parse(response, &ok);
+ if (!ok)
+ {
+ qDebug()<<"An error occurred during json parsing, error = "<<util.errorString();
+ aRetType = SmfRequestError;
+ return SmfPluginErrParsingFailed;
+ }
+ else
+ {
+ QVariantMap map = result.toMap();
+ errStr.append(map["error_msg"].toString());
+ }
+ }
+ else
+ {
+ qDebug()<<"Response is ok, so don't parse";
+ currentUserId.append(response);
+ }
+
+ if(errStr.size())
+ {
+ qDebug()<<"Response error found = "<<errStr;
+ error = SmfPluginErrInvalidRequest;
+ aRetType = SmfRequestError;
+ aResult->setValue(errStr);
+ }
+ else
+ {
+ qDebug()<<"current logged in uid = "<<currentUserId;
+ aRetType = SmfSendRequestAgain;
+ error = SmfPluginErrNone;
+ }
+ }
+ else // chance == 1
+ {
+ qDebug()<<"For Fetching self/friends activities";
+ chance = 0;
+
+ QList<SmfActivityEntry> list;
+ QString errStr;
+ errStr.clear();
+
+ qDebug()<<"Xml parsing";
+
+ // For getting contacts from xml response
+ QXmlStreamReader xml(response);
+ while (!xml.atEnd())
+ {
+ xml.readNext();
+
+ if (xml.tokenType() == QXmlStreamReader::StartElement)
+ {
+ if (xml.qualifiedName().toString() == "entry")
+ {
+ currentObjectList.clear();
+ forEntryXmlTag = true;
+ }
+ else if (xml.qualifiedName().toString() == "title")
+ {
+ if(forEntryXmlTag)
+ {
+ SmfPost post;
+ post.setTitle(xml.readElementText());
+ myEntry.setTitle(post);
+ qDebug()<<"entry title = "<<myEntry.title().title();
+ }
+ }
+ else if (xml.qualifiedName().toString() == "fb:id")
+ {
+ if(forEntryXmlTag)
+ {
+ myEntry.setId(xml.readElementText());
+ qDebug()<<"entry id = "<<myEntry.id();
+ }
+ }
+ else if (xml.qualifiedName().toString() == "name") // author name
+ {
+ if(forEntryXmlTag)
+ {
+ QContactName name;
+ name.setFirstName(xml.readElementText());
+ QVariant var = QVariant::fromValue<QContactName>(name);
+ currentAuthor.setValue("Name", var);
+ }
+ }
+ else if(xml.qualifiedName().toString() == "uri")
+ {
+ if(forEntryXmlTag)
+ {
+ QContactUrl url;
+ url.setUrl(xml.readElementText());
+ QVariant var = QVariant::fromValue<QContactUrl>(url);
+ currentAuthor.setValue("Url", var);
+ myEntry.setAuthor(currentAuthor);
+ qDebug()<<"entry author name = "<<myEntry.author().value("Name").value<QContactName>().firstName();
+ //qDebug()<<"entry author uri = "<<myEntry.author().value("Url").value<QContactUrl>().url();
+ }
+ }
+ else if(xml.qualifiedName().toString() == "activity:verb")
+ {
+ if(forEntryXmlTag)
+ {
+ QString str(xml.readElementText());
+ str.remove(' ');
+ str.remove('\n');
+ SmfActivityVerb verb = convertActivityverb(str);
+ myEntry.setActionName(verb);
+ //qDebug()<<"entry actionname = "<<myEntry.actionName();
+ }
+ }
+ else if(xml.qualifiedName().toString() == "category")
+ {
+ if(forEntryXmlTag)
+ {
+ QStringRef str = xml.attributes().value("term");
+ SmfPost post;
+ post.setDescription(str.toString());
+ myEntry.setDetails(post);
+ qDebug()<<"entry details = "<<myEntry.details().description();
+ }
+ }
+ else if(xml.qualifiedName().toString() == "activity:object")
+ {
+ forActivityObjectXmlTag = true;
+ }
+ else if(xml.qualifiedName().toString() == "id")
+ {
+ if(forActivityObjectXmlTag)
+ currentObject.setId(xml.readElementText());
+ }
+ else if(xml.qualifiedName().toString() == "caption")
+ {
+ if(forActivityObjectXmlTag)
+ currentObject.setCaption(xml.readElementText());
+ }
+ else if(xml.qualifiedName().toString() == "link")
+ {
+ if(forActivityObjectXmlTag)
+ {
+ QStringRef str = xml.attributes().value("href");
+ currentObject.setLink(str.toString());
+ }
+ }
+ else if(xml.qualifiedName().toString() == "activity:object-type")
+ {
+ if(forActivityObjectXmlTag)
+ {
+ QString str(xml.readElementText());
+ str.remove(' ');
+ str.remove('\n');
+ SmfActivityObjectType type = convertActivityObjectType(str);
+ currentObject.setType(type);
+ }
+ }
+ else if(xml.qualifiedName().toString() == "published")
+ {
+ if(forActivityObjectXmlTag)
+ {
+ QDateTime dateTime = QDateTime::fromString(xml.readElementText(), Qt::ISODate);
+ currentObject.setTime(dateTime);
+ }
+ }
+ else if(xml.qualifiedName().toString() == "content")
+ {
+ if(forActivityObjectXmlTag)
+ {
+ currentObject.setContent(xml.readElementText());
+ }
+ }
+ else if("error_msg" == xml.qualifiedName().toString())
+ {
+ qDebug()<<"error_msg tag found";
+ errStr.append(xml.readElementText());
+ break;
+ }
+ }
+ if (xml.tokenType() == QXmlStreamReader::EndElement)
+ {
+ if (xml.qualifiedName().toString() == "entry")
+ {
+ forEntryXmlTag = false;
+ myEntry.setTargetObj(currentObjectList[0]);
+ myEntry.setActivities(currentObjectList);
+ list.append(myEntry);
+ if(list.count() == 5)
+ break;
+ }
+ else if(xml.qualifiedName().toString() == "activity:object")
+ {
+ forActivityObjectXmlTag = false;
+
+ //qDebug()<<"object id = "<<currentObject.id();
+ //qDebug()<<"object caption = "<<currentObject.caption();
+ //qDebug()<<"object type = "<<currentObject.type();
+ //qDebug()<<"object link = "<<currentObject.link();
+ //qDebug()<<"object time = "<<currentObject.time().toString(Qt::TextDate);
+ //qDebug()<<"object content = "<<currentObject.content();
+
+ currentObjectList.append(currentObject);
+ }
+ }
+ }
+ if(errStr.size())
+ {
+ qDebug()<<"Response error found = "<<errStr;
+ error = SmfPluginErrInvalidRequest;
+ aRetType = SmfRequestError;
+ aResult->setValue(errStr);
+ }
+ else
+ {
+ qDebug()<<"list count = "<<list.count();
+ aResult->setValue(list);
+ aRetType = SmfRequestComplete;
+ error = SmfPluginErrNone;
+ }
+ }
+ }
+ else
+ {
+ qDebug()<<"Service unsupported, currently only SmfActivitySelfActivity and SmfActivityFriendsActivities!!!";
+ aRetType = SmfRequestError;
+ error = SmfPluginErrServiceNotSupported;
+ }
+ }
+
+ else if(SmfTransportOpOperationCanceledError == aTransportResult)
+ {
+ qDebug()<<"Operation Cancelled !!!";
+ error = SmfPluginErrCancelComplete;
+ aRetType = SmfRequestComplete;
+ }
+
+ else
+ {
+ qDebug()<<"Transport Error !!!";
+ error = SmfPluginErrNetworkError;
+ aRetType = SmfRequestError;
+ }
+
+ return error;
+ }
+
+
+/**
+ * Method to convert the Activity verb string obtained from facebook to the
+ * enum SmfActivityVerb
+ * @param verbStr The activity verb as a string
+ * @return The corresponding enum SmfActivityVerb
+ */
+SmfActivityVerb FBActivityFetcherPlugin::convertActivityverb( const QString& verbStr )
+ {
+ //qDebug()<<"verb as a string = "<<verbStr;
+
+ SmfActivityVerb verb = (SmfActivityVerb)-1;
+
+ if(QString("http://activitystrea.ms/schema/1.0/favorite/") == verbStr) //0
+ verb = SmfActivityMarkAsFavorite;
+
+ else if(QString("http://activitystrea.ms/schema/1.0/follow/") == verbStr) //1
+ verb = SmfActivityStartFollowing;
+
+ else if(QString("http://activitystrea.ms/schema/1.0/like/") == verbStr) //2
+ verb = SmfActivityMarkLiked;
+
+ else if(QString("http://activitystrea.ms/schema/1.0/make-friend/") == verbStr) //3
+ verb = SmfActivityMakeFriend;
+
+ else if(QString("http://activitystrea.ms/schema/1.0/join/") == verbStr) //4
+ verb = SmfActivityJoin;
+
+ else if(QString("http://activitystrea.ms/schema/1.0/play/") == verbStr) //5
+ verb = SmfActivityPlay;
+
+ else if(QString("http://activitystrea.ms/schema/1.0/post/") == verbStr) //6
+ verb = SmfActivityPost;
+
+ else if(QString("http://activitystrea.ms/schema/1.0/save/") == verbStr) //7
+ verb = SmfActivitySave;
+
+ else if(QString("http://activitystrea.ms/schema/1.0/share/") == verbStr) //8
+ verb = SmfActivityShare;
+
+ else if(QString("http://activitystrea.ms/schema/1.0/tag/") == verbStr) //9
+ verb = SmfActivityTag;
+
+ else if(QString("http://activitystrea.ms/schema/1.0/update/") == verbStr) //10
+ verb = SmfActivityUpdate;
+
+ //qDebug()<<"returned verb enum = "<<verb;
+ return verb;
+ }
+
+
+/**
+ * Method to convert the Activity object type string obtained from
+ * facebook to the enum SmfActivityObjectType
+ * @param objType The activity object type as a string
+ * @return The corresponding enum SmfActivityObjectType
+ */
+SmfActivityObjectType FBActivityFetcherPlugin::convertActivityObjectType( const QString& objType )
+ {
+ //qDebug()<<"type as a string = "<<objType;
+
+ SmfActivityObjectType type = (SmfActivityObjectType)-1;
+
+ if(QString("http://activitystrea.ms/schema/1.0/article/") == objType) //0
+ type = SmfActivityObjTypeArticle;
+
+ else if(QString("http://activitystrea.ms/schema/1.0/audio/") == objType) //1
+ type = SmfActivityObjTypeAudio;
+
+ else if(QString("http://activitystrea.ms/schema/1.0/bookmark/") == objType) //2
+ type = SmfActivityObjTypeBookmark;
+
+ else if(QString("http://activitystrea.ms/schema/1.0/comment/") == objType) //3
+ type = SmfActivityObjTypeComment;
+
+ else if(QString("http://activitystrea.ms/schema/1.0/file/") == objType) //4
+ type = SmfActivityObjTypeFile;
+
+ else if(QString("http://activitystrea.ms/schema/1.0/folder/") == objType) //5
+ type = SmfActivityObjTypeFolder;
+
+ else if(QString("http://activitystrea.ms/schema/1.0/group/") == objType) //6
+ type = SmfActivityObjTypeGroup;
+
+ else if(QString("http://activitystrea.ms/schema/1.0/list/") == objType) // 7, ToDo :- Note sure about this string
+ type = SmfActivityObjTypeList;
+
+ else if(QString("http://activitystrea.ms/schema/1.0/note/") == objType) //8
+ type = SmfActivityObjTypeNote;
+
+ else if(QString("http://activitystrea.ms/schema/1.0/person/") == objType) //9
+ type = SmfActivityObjTypePerson;
+
+ else if(QString("http://activitystrea.ms/schema/1.0/photo/") == objType) //10
+ type = SmfActivityObjTypePhoto;
+
+ else if(QString("http://activitystrea.ms/schema/1.0/photo-album/") == objType) //11
+ type = SmfActivityObjTypePhotoAlbum;
+
+ else if(QString("http://activitystrea.ms/schema/1.0/place/") == objType) //12
+ type = SmfActivityObjTypePlace;
+
+ else if(QString("http://activitystrea.ms/schema/1.0/playlist/") == objType) //13
+ type = SmfActivityObjTypePlaylist;
+
+ else if(QString("http://activitystrea.ms/schema/1.0/product/") == objType) //14
+ type = SmfActivityObjTypeProduct;
+
+ else if(QString("http://activitystrea.ms/schema/1.0/review/") == objType) //15
+ type = SmfActivityObjTypeReview;
+
+ else if(QString("http://activitystrea.ms/schema/1.0/service/") == objType) //16
+ type = SmfActivityObjTypeService;
+
+ else if(QString("http://activitystrea.ms/schema/1.0/status/") == objType) //17
+ type = SmfActivityObjTypeStatus;
+
+ else if(QString("http://activitystrea.ms/schema/1.0/video/") == objType) //18
+ type = SmfActivityObjTypeVideo;
+
+ else if(QString("http://activitystrea.ms/schema/1.0/song/") == objType) //19
+ type = SmfActivityObjTypeMusic;
+
+ else if(QString("http://activitystrea.ms/schema/1.0/event/") == objType) //20
+ type = SmfActivityObjTypeEvent;
+
+ // ToDo :- No strings found for 'SmfActivityObjTypeAdvanced" in
+ // http://activitystrea.ms/schema/1.0/activity-schema-01.html
+ // So setting it as default when no standard string is found
+ else
+ type = SmfActivityObjTypeAdvanced; //21
+
+ //qDebug()<<"returned type enum = "<<type;
+ return type;
+ }
+
+/**
+ * Destructor
+ */
+FBActivityProviderBase::~FBActivityProviderBase( )
+ {
+ }
+
+
+/**
+ * Method to get the Localisable name of the service.
+ * @return The Localisable name of the service.
+ */
+QString FBActivityProviderBase::serviceName( ) const
+ {
+ return m_serviceName;
+ }
+
+
+/**
+ * Method to get the Logo of the service
+ * @return The Logo of the service
+ */
+QImage FBActivityProviderBase::serviceIcon( ) const
+ {
+ return m_serviceIcon;
+ }
+
+
+/**
+ * Method to get the Readable service description
+ * @return The Readable service description
+ */
+QString FBActivityProviderBase::description( ) const
+ {
+ return m_description;
+ }
+
+
+/**
+ * Method to get the Website of the service
+ * @return The Website of the service
+ */
+QUrl FBActivityProviderBase::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 FBActivityProviderBase::applicationUrl( ) const
+ {
+ return m_applicationUrl;
+ }
+
+
+/**
+ * Method to get the Icon of the application
+ * @return The Icon of the application
+ */
+QImage FBActivityProviderBase::applicationIcon( ) const
+ {
+ return m_applicationIcon;
+ }
+
+/**
+* Method to get the list of interfaces that this provider support
+* @return List of supported Interafces
+*/
+QList<QString> FBActivityProviderBase::supportedInterfaces( ) const
+ {
+ return m_supportedInterfaces;
+ }
+
+/**
+* Method to get the list of languages supported by this service provider
+* @return a QStringList of languages supported by this service
+* provider in 2 letter ISO 639-1 format.
+*/
+QStringList FBActivityProviderBase::supportedLanguages( ) const
+ {
+ return m_supportedLangs;
+ }
+
+/**
+ * Method to get the Plugin specific ID
+ * @return The Plugin specific ID
+ */
+QString FBActivityProviderBase::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 FBActivityProviderBase::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 FBActivityProviderBase::smfRegistrationId( ) const
+ {
+ return m_smfRegToken;
+ }
+
+
+/**
+ * Method that initializes this class. This method should be called
+ * from the initialize() method of the FBActivityFetcherPlugin class
+ */
+void FBActivityProviderBase::initialize()
+ {
+ m_serviceName = "Facebook";
+ m_description = "Facebook activity fetcher plugin description";
+ m_serviceUrl = QUrl(QString("http://www.facebook.com"));
+ m_pluginId = "fbactivityfetcherplugin.qtplugin";
+ m_authAppId = "0xEFE2FD23";
+ m_supportedInterfaces.append("org.symbian.smf.plugin.activity.fetcher/v0.2");
+ QSettings iSettings;
+ m_smfRegToken = iSettings.value("FBCMRegToken").toString();
+ m_validity = iSettings.value("FBExpiryTime").toDateTime();
+ }
+
+
+/*
+ * Export Macro
+ * plugin name : fbactivityfetcherplugin
+ * plugin class : FBActivityFetcherPlugin
+ */
+Q_EXPORT_PLUGIN2( fbactivityfetcherplugin, FBActivityFetcherPlugin )
+
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/example/fbactivityfetcherplugin/fbactivityfetcherplugin.h Thu Aug 05 16:46:37 2010 +0530
@@ -0,0 +1,307 @@
+/**
+ * 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:
+ * Nalina Hariharan
+ *
+ * Description:
+ * The Plugin that fetches activities from the logged in user's facebook account
+ *
+ */
+
+#ifndef _FBACTIVITYFETCHERPLUGIN_H
+#define _FBACTIVITYFETCHERPLUGIN_H
+
+// Include files
+#include <QDateTime>
+#include <smfactivityfetcherplugin.h>
+
+// Forward declarations
+class FBActivityProviderBase;
+class QVariant;
+
+/**
+ * The Plugin class that fetches activities from the logged in user's
+ * facebook account
+ */
+class FBActivityFetcherPlugin : public QObject, public SmfActivityFetcherPlugin
+ {
+ Q_OBJECT
+ Q_INTERFACES( SmfActivityFetcherPlugin SmfPluginBase )
+
+public:
+ /**
+ * Destructor
+ */
+ virtual ~FBActivityFetcherPlugin( );
+
+public: // From SmfActivityFetcherPlugin interface
+
+ /**
+ * Method to get the list of self activities, e.g. shown in own wall
+ * @param aRequest [out] The request data that plugin generates (to be sent to network)
+ * @param aPageNum[in] The page to be extracted
+ * @param aItemsPerPage[in] Number of items per page
+ * @return SmfPluginError Plugin error if any, else SmfPluginErrNone
+ */
+ SmfPluginError selfActivities( SmfPluginRequestData &aRequest,
+ const int aPageNum = SMF_FIRST_PAGE,
+ const int aItemsPerPage = SMF_ITEMS_PER_PAGE );
+
+ /**
+ * Method to get the list of activities for other, e.g. shown in a friends wall
+ * @param aRequest [out] The request data plugin generated (to be sent to network)
+ * @param aContact [in] The contact containing the URI, name or id of the user
+ * @param aPageNum[in] The page to be extracted
+ * @param aItemsPerPage[in] Number of items per page
+ * @return SmfPluginError Plugin error if any, else SmfPluginErrNone
+ */
+ SmfPluginError friendsActivities( SmfPluginRequestData &aRequest,
+ const SmfContact &aContact,
+ const int aPageNum = SMF_FIRST_PAGE,
+ const int aItemsPerPage = SMF_ITEMS_PER_PAGE );
+
+ /**
+ * Method to get list of self activities filtered by activity type, e.g. only photo updates in own wall
+ * @param aRequest [out] The request data plugin generated (to be sent to network)
+ * @param aFilters [in] The list of activity types to be included in result
+ * @param aPageNum[in] The page to be extracted
+ * @param aItemsPerPage[in] Number of items per page
+ * @return SmfPluginError Plugin error if any, else SmfPluginErrNone
+ */
+ SmfPluginError filtered( SmfPluginRequestData &aRequest,
+ QList<SmfActivityObjectType> &aFilters,
+ const int aPageNum = SMF_FIRST_PAGE,
+ const int aItemsPerPage = SMF_ITEMS_PER_PAGE );
+
+ /**
+ * Customised method for SmfActivityFetcherPlugin 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 interface
+ /**
+ * 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.
+ */
+ void initialize( );
+
+ /**
+ * Method to get the provider information
+ * @return Instance of SmfProviderBase
+ */
+ SmfProviderBase* getProviderInfo( );
+
+ /**
+ * Method to get the result for a network request.
+ * @param aOperation The type of operation to be requested
+ * @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 SmfActivityFetcherPlugin: If last operation was selfActivities() or
+ * friendsActivities() or filtered(), aResult will be of type
+ * QList<SmfActivityEntry>.
+ * @param aRetType [out] SmfPluginRetType
+ * @param aPageResult [out] The SmfResultPage structure variable
+ */
+ SmfPluginError responseAvailable(
+ const SmfRequestTypeID aOperation,
+ 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 to get the user's facebook ID
+ * @param aRequest [out] The request data to be sent to network
+ * @return SmfPluginError Plugin error if any, else SmfPluginErrNone
+ */
+ SmfPluginError getFacebookUserId( SmfPluginRequestData &aRequest );
+
+ /**
+ * Method to get the list of self activities, e.g. shown in own wall
+ * @param aRequest [out] The request data that plugin generates (to be sent to network)
+ * @param aPageNum[in] The page to be extracted
+ * @param aItemsPerPage[in] Number of items per page
+ * @return SmfPluginError Plugin error if any, else SmfPluginErrNone
+ */
+ SmfPluginError getSelfActivities( SmfPluginRequestData &aRequest,
+ const int aPageNum = SMF_FIRST_PAGE,
+ const int aItemsPerPage = SMF_ITEMS_PER_PAGE );
+
+ /**
+ * Method to convert the Activity verb string obtained from facebook to the
+ * enum SmfActivityVerb
+ * @param verbStr The activity verb as a string
+ * @return The corresponding enum SmfActivityVerb
+ */
+ SmfActivityVerb convertActivityverb( const QString& verbStr );
+
+ /**
+ * Method to convert the Activity object type string obtained from
+ * facebook to the enum SmfActivityObjectType
+ * @param objType The activity object type as a string
+ * @return The corresponding enum SmfActivityObjectType
+ */
+ SmfActivityObjectType convertActivityObjectType( const QString& verbStr );
+
+ /**
+ * Method to interpret the key sets obtained from credential manager
+ * @param aApiKey [out] The api key
+ * @param aApiSecret [out] The api secret
+ * @param aSessionKey [out] The session key
+ * @param aSessionSecret [out] The session secret
+ * @param aAppId [out] The application ID
+ */
+ void fetchKeys( QString &aApiKey,
+ QString &aApiSecret,
+ QString &aSessionKey,
+ QString &aSessionSecret,
+ QString &aAppId);
+
+private:
+ FBActivityProviderBase *m_provider;
+ };
+
+
+
+/**
+ * The Plugin class that implements SmfProviderBase for this facebook plugin
+ */
+class FBActivityProviderBase : public QObject, public SmfProviderBase
+ {
+ Q_OBJECT
+ Q_INTERFACES( SmfProviderBase )
+
+public:
+ /**
+ * Destructor
+ */
+ virtual ~FBActivityProviderBase( );
+
+ /**
+ * 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 list of interfaces that this provider support
+ * @return List of supported Interafces
+ */
+ QList<QString> supportedInterfaces( ) const;
+
+ /**
+ * Method to get the list of languages supported by this service provider
+ * @return a QStringList of languages supported by this service
+ * provider in 2 letter ISO 639-1 format.
+ */
+ QStringList supportedLanguages( ) 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:
+ /**
+ * Method that initializes this class. This method should be called
+ * from the initialize() method of the FBActivityFetcherPlugin class
+ */
+ void initialize();
+
+private:
+ friend class FBActivityFetcherPlugin;
+ 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;
+ QList<QString> m_supportedInterfaces;
+ QStringList m_supportedLangs;
+ QDateTime m_validity;
+ };
+
+#endif /*_FBACTIVITYFETCHERPLUGIN_H*/
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/example/fbactivityfetcherplugin/fbactivityfetcherplugin.pro Thu Aug 05 16:46:37 2010 +0530
@@ -0,0 +1,43 @@
+TEMPLATE = lib
+
+CONFIG += plugin \
+ mobility
+
+MOBILITY += contacts
+
+QT += core \
+ xml \
+ network
+
+HEADERS = fbactivityfetcherplugin.h
+
+SOURCES = fbactivityfetcherplugin.cpp
+
+TARGET = $$qtLibraryTarget(fbactivityfetcherplugin)
+
+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 = fbactivityfetcherplugin.dll
+ pluginDep.path = $$QT_PLUGINS_BASE_DIR/smf/plugin/activity.fetcher
+ DEPLOYMENT += pluginDep
+
+ TARGET.CAPABILITY = NetworkServices \
+ ReadUserData \
+ WriteUserData \
+ LocalServices \
+ UserEnvironment \
+ ReadDeviceData \
+ WriteDeviceData
+
+ LIBS += -lsmfcommon
+}
+
+target.path += $$[QT_INSTALL_PLUGINS]/smf/plugin/activity.fetcher
+
+INSTALLS += target
\ No newline at end of file
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/example/fbactivityfetcherplugin/fbactivityfetcherplugin_installer.pkg Thu Aug 05 16:46:37 2010 +0530
@@ -0,0 +1,30 @@
+; fbactivityfetcherplugin_installer.pkg generated by qmake at 2010-07-30T14:11:44
+; This file is generated by qmake and should not be modified by the user
+;
+
+; Language
+&EN
+
+; SIS header: name, uid, version
+#{"fbactivityfetcherplugin installer"},(0xA000D7CE),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
+; Default dependency to QtMobility libraries
+
+
+"D:/smf/MissingCode/smfrepo/example/fbactivityfetcherplugin/fbactivityfetcherplugin.sis" - "c:\adm\fbactivityfetcherplugin.sis"
+@"D:/Qt/4.6.2/smartinstaller.sis",(0x2002CCCD)
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/example/fbactivityfetcherplugin/fbactivityfetcherplugin_template.pkg Thu Aug 05 16:46:37 2010 +0530
@@ -0,0 +1,34 @@
+; fbactivityfetcherplugin_template.pkg generated by qmake at 2010-07-30T14:11:44
+; This file is generated by qmake and should not be modified by the user
+;
+
+; Language
+&EN
+
+; SIS header: name, uid, version
+#{"fbactivityfetcherplugin"},(0xEbecd096),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, 2, {"Qt"}
+; Default dependency to QtMobility libraries
+(0x2002AC89), 1, 0, 0, {"QtMobility"}
+
+; DEPLOYMENT
+"d:/S60/devices/Nokia_Symbian3_SDK_v0.8/epoc32/release/$(PLATFORM)/$(TARGET)/fbactivityfetcherplugin.dll" - "!:\sys\bin\fbactivityfetcherplugin.dll"
+"d:/smf/MissingCode/smfrepo/example/fbactivityfetcherplugin/qmakepluginstubs/fbactivityfetcherplugin.qtplugin" - "!:\resource\qt\plugins\smf\plugin\activity.fetcher\fbactivityfetcherplugin.qtplugin"
+
+; Manual PKG post-rules from PRO files
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/example/fbactivityfetcherplugin/plugin_commonU.def Thu Aug 05 16:46:37 2010 +0530
@@ -0,0 +1,16 @@
+; ==============================================================================
+; Generated by qmake (2.01a) (Qt 4.6.2) on: 2010-07-30T14:11:44
+; This file is generated by qmake and should not be modified by the
+; user.
+; Name : plugin_commonU.def
+; Part of : fbactivityfetcherplugin
+; 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/fbactivityfetcherplugin/qmakepluginstubs/fbactivityfetcherplugin.qtplugin Thu Aug 05 16:46:37 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-07-30T14:11:44
--- a/example/fbcontactfetcherplugin/fbcontactfetcherplugin.cpp Thu Aug 05 16:35:33 2010 +0530
+++ b/example/fbcontactfetcherplugin/fbcontactfetcherplugin.cpp Thu Aug 05 16:46:37 2010 +0530
@@ -25,6 +25,8 @@
#include <QFile>
#include <QMap>
#include <QListIterator>
+#include <QSettings>
+#include <smfpluginutil.h>
#ifdef SMF_XMLPARSING
#include <QXmlStreamReader>
#endif
@@ -39,6 +41,9 @@
SmfContact contact;
#endif
+// Todo:- Macro added for limiting items fetched to recent 5
+// Remove after demo
+#define SETLIMITOFFIVEFORSMFDEMO 1
/**
* Destructor
@@ -50,6 +55,54 @@
}
/**
+ * Method to interpret the key sets obtained from credential manager
+ * @param aApiKey [out] The api key
+ * @param aApiSecret [out] The api secret
+ * @param aSessionKey [out] The session key
+ * @param aSessionSecret [out] The session secret
+ * @param aAppId [out] The application ID
+ */
+void FBContactFetcherPlugin::fetchKeys( QString &aApiKey,
+ QString &aApiSecret,
+ QString &aSessionKey,
+ QString &aSessionSecret )
+ {
+ qDebug()<<"Inside FBContactFetcherPlugin::fetchKeys()";
+
+ qDebug()<<"Reg Token = "<<m_provider->m_smfRegToken;
+ qDebug()<<"Expiry Date as int = "<<m_provider->m_validity.toTime_t();
+
+ SmfAuthParams keys;
+ SmfPluginUtil util;
+ util.getAuthKeys(keys, m_provider->m_smfRegToken,
+ m_provider->m_validity, m_provider->m_pluginId);
+
+ qDebug()<<"Number of key-value pairs = "<<keys.count();
+
+ QByteArray keyName;
+ keyName.append("ApiKey");
+ aApiKey.append(keys.value(keyName));
+
+ keyName.clear();
+ keyName.append("ApiSecret");
+ aApiSecret.append(keys.value(keyName));
+
+ keyName.clear();
+ keyName.append("SessionKey");
+ aSessionKey.append(keys.value(keyName));
+
+ keyName.clear();
+ keyName.append("SessionSecret");
+ aSessionSecret.append(keys.value(keyName));
+
+ qDebug()<<"Api Key = "<<aApiKey;
+ qDebug()<<"Api Secret = "<<aApiSecret;
+ qDebug()<<"session Key = "<<aSessionKey;
+ qDebug()<<"session Secret = "<<aSessionSecret;
+ }
+
+
+/**
* 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
@@ -66,7 +119,6 @@
return getFriendsUids(aRequest, aPageNum, aItemsPerPage);
else// if(1 == chance)
return getFriendsDetails(aRequest, aPageNum, aItemsPerPage);
-
}
/**
@@ -93,32 +145,12 @@
qDebug()<<"Valid arguments";
-#if 1
-// Reading the keys, CSM Stubbed - START
- QFile file("c:\\data\\FacebookKeys.txt");
- if (!file.open(QIODevice::ReadOnly))
- {
- qDebug()<<"File to read the keys could not be opened";
- return SmfPluginErrUserNotLoggedIn;
- }
-
- qDebug()<<"Key file read, going to parse the key values from file";
-
- QByteArray arr = file.readAll();
- QList<QByteArray> list = arr.split('\n');
- file.close();
-
- QString apiKey(list[0]);
- QString apiSecret(list[1]);
- QString sessionKey(list[2]);
- QString sessionSecret(list[3]);
-
- qDebug()<<"Api Key = "<<apiKey;
- qDebug()<<"Api Secret = "<<apiSecret;
- qDebug()<<"session Key = "<<sessionKey;
- qDebug()<<"session Secret = "<<sessionSecret;
-// Reading the keys, CSM Stubbed - END
-#endif
+ // Get the key sets from SMF Plugin Utility class.
+ QString apiKey;
+ QString apiSecret;
+ QString sessionKey;
+ QString sessionSecret;
+ fetchKeys(apiKey, apiSecret, sessionKey, sessionSecret);
// Get the current date and time and convert it to seconds as a string
QString call_id = QString::number(QDateTime::currentDateTime().toTime_t(), 10);
@@ -190,32 +222,12 @@
SmfPluginError error = SmfPluginErrUserNotLoggedIn;
-#if 1
-// Reading the keys, CSM Stubbed - START
- QFile file("c:\\data\\FacebookKeys.txt");
- if (!file.open(QIODevice::ReadOnly))
- {
- qDebug()<<"File to read the keys could not be opened";
- return error;
- }
-
- qDebug()<<"Key file read, going to parse the key values from file";
-
- QByteArray arr = file.readAll();
- QList<QByteArray> list = arr.split('\n');
- file.close();
-
- QString apiKey(list[0]);
- QString apiSecret(list[1]);
- QString sessionKey(list[2]);
- QString sessionSecret(list[3]);
-
- qDebug()<<"Api Key = "<<apiKey;
- qDebug()<<"Api Secret = "<<apiSecret;
- qDebug()<<"session Key = "<<sessionKey;
- qDebug()<<"session Secret = "<<sessionSecret;
-// Reading the keys, CSM Stubbed - END
-#endif
+ // Get the key sets from SMF Plugin Utility class.
+ QString apiKey;
+ QString apiSecret;
+ QString sessionKey;
+ QString sessionSecret;
+ fetchKeys(apiKey, apiSecret, sessionKey, sessionSecret);
// Get the current date and time and convert it to sec as a string
QString call_id = QString::number(QDateTime::currentDateTime().toTime_t(), 10);
@@ -224,7 +236,7 @@
QString baseString;
baseString.append("api_key="+apiKey);
baseString.append("call_id="+call_id);
- baseString.append("fields=uid,name,pic,pic_square");
+ baseString.append("fields=uid,name,pic,pic_square,status");
#ifdef SMF_XMLPARSING
baseString.append("format=XML");
#else
@@ -233,6 +245,23 @@
baseString.append("method=users.getInfo");
baseString.append("session_key="+sessionKey);
baseString.append("ss=1");
+
+#ifdef SETLIMITOFFIVEFORSMFDEMO // limiting to fetch only first 5 contact details
+
+ QStringList firstFiveUids = uids.split(',');
+ uids.clear();
+ int i = 0;
+ while(i < 5)
+ {
+ uids.append(firstFiveUids.at(i));
+ uids.append(",");
+ i++;
+ }
+ if(firstFiveUids.count()>5)
+ uids.chop(1);
+ qDebug()<<"Limited to 5 uid string = "<<uids;
+#endif
+
baseString.append("uids="+uids);
baseString.append("v=1.0");
baseString.append(sessionSecret);
@@ -241,7 +270,7 @@
QUrl url("http://api.facebook.com/restserver.php?");
url.addQueryItem("api_key", apiKey);
url.addQueryItem("call_id", call_id);
- url.addQueryItem("fields", "uid,name,pic,pic_square");
+ url.addQueryItem("fields", "uid,name,pic,pic_square,status");
#ifdef SMF_XMLPARSING
url.addQueryItem("format", "XML");
#else
@@ -417,14 +446,9 @@
/**
* 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 FBContactFetcherPlugin::initialize( SmfPluginUtil *aUtil )
+void FBContactFetcherPlugin::initialize( )
{
- // Save the SmfPluginUtil handle
- m_util = aUtil;
-
// Create an instance of FBContactProviderBase
m_provider = new FBContactProviderBase;
m_provider->initialize();
@@ -480,8 +504,21 @@
QByteArray response(*aResponse);
delete aResponse;
- qDebug()<<"FB response = "<<QString(response);
- qDebug()<<"FB response size = "<<response.size();
+
+ QFile respFile("c://data//SmfPluginFBContactResponse.txt");
+ if(!respFile.open(QIODevice::WriteOnly))
+ {
+ qDebug()<<"File to write the response could not be opened, so writing to this file";
+ qDebug()<<"Flickr response = "<<QString(response);
+ }
+ else
+ {
+ respFile.write(response);
+ respFile.close();
+ qDebug()<<"Writing FB response to a file named 'SmfPluginFBContactResponse.txt'";
+ }
+
+ qDebug()<<"Response size = "<<response.size();
if(SmfTransportOpNoError == aTransportResult)
@@ -518,8 +555,10 @@
uids.append(message);
uids.append(",");
count++;
+#ifdef SETLIMITOFFIVEFORSMFDEMO
if(5 == count)
break;
+#endif
}
else if("error_msg" == xml.name())
{
@@ -541,10 +580,11 @@
qDebug()<<"Response contains error, so parse and get the error code";
bool ok;
- QVariant result = m_util->parse(response, &ok);
+ SmfPluginUtil util;
+ QVariant result = util.parse(response, &ok);
if (!ok)
{
- qDebug()<<"An error occurred during json parsing, error = "<<m_util->errorString();
+ qDebug()<<"An error occurred during json parsing, error = "<<util.errorString();
aRetType = SmfRequestError;
return SmfPluginErrParsingFailed;
}
@@ -646,7 +686,8 @@
qDebug()<<"Json parsing";
bool ok;
- QVariant result = m_util->parse(response, &ok);
+ SmfPluginUtil util;
+ QVariant result = util.parse(response, &ok);
if (!ok)
{
qDebug()<<"An error occurred during json parsing";
@@ -679,7 +720,11 @@
contact.setValue("Name",nameVar);
QContactAvatar avatar;
- QUrl url(map2["pic_square"].toString());
+ QUrl url;
+ if(0 != map2["pic_square"].toString().size())
+ url = map2["pic_square"].toString();
+ else
+ url = QString("http://static.ak.fbcdn.net/rsrc.php/z5HB7/hash/ecyu2wwn.gif");
avatar.setImageUrl(url);
QVariant avatarVar = QVariant::fromValue(avatar);
contact.setValue("Avatar", avatarVar);
@@ -689,6 +734,11 @@
QVariant guidVar = QVariant::fromValue(guid);
contact.setValue("Guid", guidVar);
+ QContactPresence presence;
+ presence.setCustomMessage(map2["status"].toString());
+ QVariant presVar = QVariant::fromValue(presence);
+ contact.setValue("Presence", presVar);
+
#if 0 // tesing SmfContact serialization
QContactAddress address;
@@ -1031,9 +1081,11 @@
m_description = "Facebook contact fetcher plugin description";
m_serviceUrl = QUrl(QString("http://api.facebook.com"));
m_pluginId = "fbcontactfetcherplugin.qtplugin";
- m_authAppId = "Facebook AuthAppId";
- m_smfRegToken = "Facebook RegToken";
+ m_authAppId = "0xEFE2FD23";
m_supportedInterfaces.append("org.symbian.smf.plugin.contact.fetcher/v0.2");
+ QSettings iSettings;
+ m_smfRegToken = iSettings.value("FBCMRegToken").toString();
+ m_validity = iSettings.value("FBExpiryTime").toDateTime();
}
--- a/example/fbcontactfetcherplugin/fbcontactfetcherplugin.h Thu Aug 05 16:35:33 2010 +0530
+++ b/example/fbcontactfetcherplugin/fbcontactfetcherplugin.h Thu Aug 05 16:46:37 2010 +0530
@@ -21,13 +21,13 @@
#define _FBCONTACTFETCHERPLUGIN_H
// Include files
+#include <QDateTime>
#include <smfcontactfetcherplugin.h>
-#include <smfpluginutil.h>
// Forward declarations
class FBContactProviderBase;
class QVariant;
-class QNetworkReply;
+
/**
* The Plugin class that fetches contacts from the logged in user's
@@ -137,10 +137,8 @@
/**
* 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 );
+ void initialize( );
/**
* Method to get the provider information
@@ -203,9 +201,20 @@
const int aPageNum,
const int aItemsPerPage );
+ /**
+ * Method to interpret the key sets obtained from credential manager
+ * @param aApiKey [out] The api key
+ * @param aApiSecret [out] The api secret
+ * @param aSessionKey [out] The session key
+ * @param aSessionSecret [out] The session secret
+ */
+ void fetchKeys( QString &aApiKey,
+ QString &aApiSecret,
+ QString &aSessionKey,
+ QString &aSessionSecret );
+
private:
FBContactProviderBase *m_provider;
- SmfPluginUtil *m_util;
};
@@ -318,6 +327,7 @@
QString m_smfRegToken;
QList<QString> m_supportedInterfaces;
QStringList m_supportedLangs;
+ QDateTime m_validity;
};
#endif /*_FBCONTACTFETCHERPLUGIN_H*/
--- a/example/fbcontactfetcherplugin/fbcontactfetcherplugin.pro Thu Aug 05 16:35:33 2010 +0530
+++ b/example/fbcontactfetcherplugin/fbcontactfetcherplugin.pro Thu Aug 05 16:46:37 2010 +0530
@@ -36,7 +36,7 @@
ReadDeviceData \
WriteDeviceData
- LIBS += -lsmfclient.dll
+ LIBS += -lsmfcommon
}
target.path += $$[QT_INSTALL_PLUGINS]/smf/plugin/contact.fetcher
--- a/example/fbcontactfetcherplugin/fbcontactfetcherplugin_installer.pkg Thu Aug 05 16:35:33 2010 +0530
+++ b/example/fbcontactfetcherplugin/fbcontactfetcherplugin_installer.pkg Thu Aug 05 16:46:37 2010 +0530
@@ -1,11 +1,10 @@
-; fbcontactfetcherplugin_installer.pkg generated by qmake at 2010-06-22T14:10:41
+; fbcontactfetcherplugin_installer.pkg generated by qmake at 2010-07-30T14:11:44
; This file is generated by qmake and should not be modified by the user
;
; Language
&EN
-
; SIS header: name, uid, version
#{"fbcontactfetcherplugin installer"},(0xA000D7CE),1,0,0
@@ -17,15 +16,15 @@
; Manual PKG pre-rules from PRO files
-; Default dependency to Qt libraries
; 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
; Default dependency to QtMobility libraries
-"F:/Nokia/devices/Nokia_Symbian3_SDK_v0.8/SMFCode/smf_baseline_22june_latest/example/fbcontactfetcherplugin/fbcontactfetcherplugin.sis" - "c:\adm\fbcontactfetcherplugin.sis"
-@"F:/Qt/4.6.3/smartinstaller.sis",(0x2002CCCD)
+"D:/smf/MissingCode/smfrepo/example/fbcontactfetcherplugin/fbcontactfetcherplugin.sis" - "c:\adm\fbcontactfetcherplugin.sis"
+@"D:/Qt/4.6.2/smartinstaller.sis",(0x2002CCCD)
--- a/example/fbcontactfetcherplugin/fbcontactfetcherplugin_template.pkg Thu Aug 05 16:35:33 2010 +0530
+++ b/example/fbcontactfetcherplugin/fbcontactfetcherplugin_template.pkg Thu Aug 05 16:46:37 2010 +0530
@@ -1,13 +1,12 @@
-; fbcontactfetcherplugin_template.pkg generated by qmake at 2010-06-22T14:10:41
+; fbcontactfetcherplugin_template.pkg generated by qmake at 2010-07-30T14:11:44
; This file is generated by qmake and should not be modified by the user
;
; Language
&EN
-
; SIS header: name, uid, version
-#{"fbcontactfetcherplugin"},(0xEc03b6cf),1,0,0
+#{"fbcontactfetcherplugin"},(0xE8630234),1,0,0
; Localised Vendor name
%{"Vendor"}
@@ -17,19 +16,19 @@
; Manual PKG pre-rules from PRO files
-; Default dependency to Qt libraries
-(0x2001E61C), 4, 6, 3, {"Qt"}
; 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, 2, {"Qt"}
; Default dependency to QtMobility libraries
(0x2002AC89), 1, 0, 0, {"QtMobility"}
; DEPLOYMENT
-"/Nokia/devices/Nokia_Symbian3_SDK_v0.8/epoc32/release/$(PLATFORM)/$(TARGET)/fbcontactfetcherplugin.dll" - "!:\sys\bin\fbcontactfetcherplugin.dll"
-"/Nokia/devices/Nokia_Symbian3_SDK_v0.8/epoc32/data/z/resource/qt/plugins/smf/plugin/contact.fetcher/fbcontactfetcherplugin.qtplugin" - "!:\resource\qt\plugins\smf\plugin\contact.fetcher\fbcontactfetcherplugin.qtplugin"
+"d:/S60/devices/Nokia_Symbian3_SDK_v0.8/epoc32/release/$(PLATFORM)/$(TARGET)/fbcontactfetcherplugin.dll" - "!:\sys\bin\fbcontactfetcherplugin.dll"
+"d:/smf/MissingCode/smfrepo/example/fbcontactfetcherplugin/qmakepluginstubs/fbcontactfetcherplugin.qtplugin" - "!:\resource\qt\plugins\smf\plugin\contact.fetcher\fbcontactfetcherplugin.qtplugin"
; Manual PKG post-rules from PRO files
--- a/example/fbcontactfetcherplugin/plugin_commonU.def Thu Aug 05 16:35:33 2010 +0530
+++ b/example/fbcontactfetcherplugin/plugin_commonU.def Thu Aug 05 16:46:37 2010 +0530
@@ -1,5 +1,5 @@
; ==============================================================================
-; Generated by qmake (2.01a) (Qt 4.6.3) on: 2010-06-22T14:10:41
+; Generated by qmake (2.01a) (Qt 4.6.2) on: 2010-07-30T14:11:44
; This file is generated by qmake and should not be modified by the
; user.
; Name : plugin_commonU.def
--- a/example/fbcontactfetcherplugin/qmakepluginstubs/fbcontactfetcherplugin.qtplugin Thu Aug 05 16:35:33 2010 +0530
+++ b/example/fbcontactfetcherplugin/qmakepluginstubs/fbcontactfetcherplugin.qtplugin Thu Aug 05 16:46:37 2010 +0530
@@ -1,1 +1,1 @@
-This file is a Qt plugin stub file. The real Qt plugin is located in /sys/bin. Created:2010-06-22T14:10:41
+This file is a Qt plugin stub file. The real Qt plugin is located in \sys\bin. Created:2010-07-30T14:11:44
--- a/example/fbpostproviderplugin/ABLD.BAT Thu Aug 05 16:35:33 2010 +0530
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,15 +0,0 @@
-@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
--- a/example/fbpostproviderplugin/Makefile Thu Aug 05 16:35:33 2010 +0530
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,239 +0,0 @@
-# ==============================================================================
-# Generated by qmake (2.01a) (Qt 4.6.3) on: Tue Jun 22 14:10:41 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 = f:\Qt\4.6.3\bin\qmake
-DEL_FILE = del
-DEL_DIR = rmdir
-MOVE = move
-CHK_DIR_EXISTS = if not exist
-MKDIR = mkdir
-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"F:/Qt/4.6.3/include/QtCore" -I"F:/Qt/4.6.3/include/QtCore/tmp" -I"F:/Qt/4.6.3/include/QtNetwork" -I"F:/Qt/4.6.3/include/QtNetwork/tmp" -I"F:/Qt/4.6.3/include/QtGui" -I"F:/Qt/4.6.3/include/QtGui/tmp" -I"F:/Qt/4.6.3/include/QtXml" -I"F:/Qt/4.6.3/include/QtXml/tmp" -I"F:/Qt/4.6.3/include" -I"F:/Qt/4.6.3/include/tmp" -I"F:/Qt/4.6.3/include/QtContacts" -I"F:/Qt/4.6.3/include/QtContacts/tmp" -I"F:/Qt/4.6.3/include/QtLocation" -I"F:/Qt/4.6.3/include/QtLocation/tmp" -I"F:/Qt/4.6.3/mkspecs/common/symbian" -I"F:/Qt/4.6.3/mkspecs/common/symbian/tmp" -I"F:/Nokia/devices/Nokia_Symbian3_SDK_v0.8/epoc32/include" -I"F:/Nokia/devices/Nokia_Symbian3_SDK_v0.8/epoc32/include/stdapis" -I"F:/Nokia/devices/Nokia_Symbian3_SDK_v0.8/epoc32/include/stdapis/sys" -I"F:/Nokia/devices/Nokia_Symbian3_SDK_v0.8/epoc32/include/mw" -I"F:/Nokia/devices/Nokia_Symbian3_SDK_v0.8/epoc32/include/platform/mw" -I"F:/Nokia/devices/Nokia_Symbian3_SDK_v0.8/epoc32/include/platform" -I"F:/Nokia/devices/Nokia_Symbian3_SDK_v0.8/epoc32/include/app" -I"F:/Nokia/devices/Nokia_Symbian3_SDK_v0.8/epoc32/include/platform/app" -I"F:/Nokia/devices/Nokia_Symbian3_SDK_v0.8/epoc32/include/platform/loc" -I"F:/Nokia/devices/Nokia_Symbian3_SDK_v0.8/epoc32/include/platform/mw/loc" -I"F:/Nokia/devices/Nokia_Symbian3_SDK_v0.8/epoc32/include/platform/app/loc" -I"F:/Nokia/devices/Nokia_Symbian3_SDK_v0.8/epoc32/include/platform/loc/sc" -I"F:/Nokia/devices/Nokia_Symbian3_SDK_v0.8/epoc32/include/platform/mw/loc/sc" -I"F:/Nokia/devices/Nokia_Symbian3_SDK_v0.8/epoc32/include/platform/app/loc/sc" -I"F:/Nokia/devices/Nokia_Symbian3_SDK_v0.8/epoc32/include/stdapis/stlportv5" -I"F:/Nokia/devices/Nokia_Symbian3_SDK_v0.8/SMFCode/smf_baseline_22june_latest/example/fbpostproviderplugin" -I"F:/Nokia/devices/Nokia_Symbian3_SDK_v0.8/SMFCode/smf_baseline_22june_latest/example/fbpostproviderplugin/tmp"
-first: default
-default: debug-winscw
-all: debug release
-
-qmake:
- $(QMAKE) -spec symbian-abld -o "bld.inf" "F:/Nokia/devices/Nokia_Symbian3_SDK_v0.8/SMFCode/smf_baseline_22june_latest/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
-
-check: first
-
-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
- F:\Qt\4.6.3\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 "F:\Qt\4.6.3\include\QtCore\tmp" mkdir "F:\Qt\4.6.3\include\QtCore\tmp"
- -@ if NOT EXIST "F:\Qt\4.6.3\include\QtNetwork\tmp" mkdir "F:\Qt\4.6.3\include\QtNetwork\tmp"
- -@ if NOT EXIST "F:\Qt\4.6.3\include\QtGui\tmp" mkdir "F:\Qt\4.6.3\include\QtGui\tmp"
- -@ if NOT EXIST "F:\Qt\4.6.3\include\QtXml\tmp" mkdir "F:\Qt\4.6.3\include\QtXml\tmp"
- -@ if NOT EXIST "F:\Qt\4.6.3\include\tmp" mkdir "F:\Qt\4.6.3\include\tmp"
- -@ if NOT EXIST "F:\Qt\4.6.3\include\QtContacts\tmp" mkdir "F:\Qt\4.6.3\include\QtContacts\tmp"
- -@ if NOT EXIST "F:\Qt\4.6.3\include\QtLocation\tmp" mkdir "F:\Qt\4.6.3\include\QtLocation\tmp"
- -@ if NOT EXIST "F:\Qt\4.6.3\mkspecs\common\symbian\tmp" mkdir "F:\Qt\4.6.3\mkspecs\common\symbian\tmp"
- -@ if NOT EXIST "F:\Nokia\devices\Nokia_Symbian3_SDK_v0.8\SMFCode\smf_baseline_22june_latest\example\fbpostproviderplugin\tmp" mkdir "F:\Nokia\devices\Nokia_Symbian3_SDK_v0.8\SMFCode\smf_baseline_22june_latest\example\fbpostproviderplugin\tmp"
-
-extension_clean: compiler_clean
- -@ if EXIST "F:\Qt\4.6.3\include\QtCore\tmp" rmdir /S /Q "F:\Qt\4.6.3\include\QtCore\tmp"
- -@ if EXIST "F:\Qt\4.6.3\include\QtNetwork\tmp" rmdir /S /Q "F:\Qt\4.6.3\include\QtNetwork\tmp"
- -@ if EXIST "F:\Qt\4.6.3\include\QtGui\tmp" rmdir /S /Q "F:\Qt\4.6.3\include\QtGui\tmp"
- -@ if EXIST "F:\Qt\4.6.3\include\QtXml\tmp" rmdir /S /Q "F:\Qt\4.6.3\include\QtXml\tmp"
- -@ if EXIST "F:\Qt\4.6.3\include\tmp" rmdir /S /Q "F:\Qt\4.6.3\include\tmp"
- -@ if EXIST "F:\Qt\4.6.3\include\QtContacts\tmp" rmdir /S /Q "F:\Qt\4.6.3\include\QtContacts\tmp"
- -@ if EXIST "F:\Qt\4.6.3\include\QtLocation\tmp" rmdir /S /Q "F:\Qt\4.6.3\include\QtLocation\tmp"
- -@ if EXIST "F:\Qt\4.6.3\mkspecs\common\symbian\tmp" rmdir /S /Q "F:\Qt\4.6.3\mkspecs\common\symbian\tmp"
- -@ if EXIST "F:\Nokia\devices\Nokia_Symbian3_SDK_v0.8\SMFCode\smf_baseline_22june_latest\example\fbpostproviderplugin\tmp" rmdir /S /Q "F:\Nokia\devices\Nokia_Symbian3_SDK_v0.8\SMFCode\smf_baseline_22june_latest\example\fbpostproviderplugin\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) "f:\Nokia\devices\Nokia_Symbian3_SDK_v0.8\SMFCode\smf_baseline_22june_latest\example\fbpostproviderplugin\qmakepluginstubs\fbpostproviderplugin.qtplugin" "\Nokia\devices\Nokia_Symbian3_SDK_v0.8\epoc32\winscw\c\resource\qt\plugins\smf\plugin\contact.posts\"
-
-winscw_deployment_clean:
- -@ if EXIST "\Nokia\devices\Nokia_Symbian3_SDK_v0.8\epoc32\winscw\c\resource\qt\plugins\smf\plugin\contact.posts\fbpostproviderplugin.qtplugin" $(DEL_FILE) "\Nokia\devices\Nokia_Symbian3_SDK_v0.8\epoc32\winscw\c\resource\qt\plugins\smf\plugin\contact.posts\fbpostproviderplugin.qtplugin"
-
-deployment:
- -echo Deploying changed files...
- -$(XCOPY) "f:\Nokia\devices\Nokia_Symbian3_SDK_v0.8\SMFCode\smf_baseline_22june_latest\example\fbpostproviderplugin\qmakepluginstubs\fbpostproviderplugin.qtplugin" "\Nokia\devices\Nokia_Symbian3_SDK_v0.8\epoc32\data\z\resource\qt\plugins\smf\plugin\contact.posts\"
-
-deployment_clean:
- -@ if EXIST "\Nokia\devices\Nokia_Symbian3_SDK_v0.8\epoc32\data\z\resource\qt\plugins\smf\plugin\contact.posts\fbpostproviderplugin.qtplugin" $(DEL_FILE) "\Nokia\devices\Nokia_Symbian3_SDK_v0.8\epoc32\data\z\resource\qt\plugins\smf\plugin\contact.posts\fbpostproviderplugin.qtplugin"
-
--include .make.cache
-
-sis:
- $(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)
-
-fbpostproviderplugin.sis:
- $(MAKE) -s -f $(MAKEFILE) sis
-
-stub_sis:
- $(if $(wildcard fbpostproviderplugin_template.pkg),$(if $(wildcard .make.cache),$(MAKE) -s -f $(MAKEFILE) ok_stub_sis,$(if $(QT_SIS_TARGET),$(MAKE) -s -f $(MAKEFILE) ok_stub_sis,$(MAKE) -s -f $(MAKEFILE) fail_sis_nocache)),$(MAKE) -s -f $(MAKEFILE) fail_sis_nopkg)
-
-ok_stub_sis:
- createpackage.bat -s $(QT_SIS_OPTIONS) fbpostproviderplugin_template.pkg $(QT_SIS_TARGET) $(QT_SIS_CERTIFICATE) $(QT_SIS_KEY) $(QT_SIS_PASSPHRASE)
-
-installer_sis: fbpostproviderplugin.sis
- $(if $(wildcard fbpostproviderplugin_installer.pkg),$(MAKE) -s -f $(MAKEFILE) ok_installer_sis,$(MAKE) -s -f $(MAKEFILE) fail_sis_nopkg)
-
-ok_installer_sis:
- createpackage.bat $(QT_SIS_OPTIONS) fbpostproviderplugin_installer.pkg - $(QT_SIS_CERTIFICATE) $(QT_SIS_KEY) $(QT_SIS_PASSPHRASE)
-
-fail_sis_nopkg:
- $(error PKG file does not exist, 'sis' and 'installer_sis' target are 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)
-
-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 "f:\Nokia\devices\Nokia_Symbian3_SDK_v0.8\SMFCode\smf_baseline_22june_latest\example\fbpostproviderplugin\fbpostproviderplugin_template.pkg" $(DEL_FILE) "f:\Nokia\devices\Nokia_Symbian3_SDK_v0.8\SMFCode\smf_baseline_22june_latest\example\fbpostproviderplugin\fbpostproviderplugin_template.pkg"
- -@ if EXIST "f:\Nokia\devices\Nokia_Symbian3_SDK_v0.8\SMFCode\smf_baseline_22june_latest\example\fbpostproviderplugin\qmakepluginstubs\fbpostproviderplugin.qtplugin" $(DEL_FILE) "f:\Nokia\devices\Nokia_Symbian3_SDK_v0.8\SMFCode\smf_baseline_22june_latest\example\fbpostproviderplugin\qmakepluginstubs\fbpostproviderplugin.qtplugin"
- -@ if EXIST "f:\Nokia\devices\Nokia_Symbian3_SDK_v0.8\SMFCode\smf_baseline_22june_latest\example\fbpostproviderplugin\fbpostproviderplugin_installer.pkg" $(DEL_FILE) "f:\Nokia\devices\Nokia_Symbian3_SDK_v0.8\SMFCode\smf_baseline_22june_latest\example\fbpostproviderplugin\fbpostproviderplugin_installer.pkg"
- -@ if EXIST "f:\Nokia\devices\Nokia_Symbian3_SDK_v0.8\SMFCode\smf_baseline_22june_latest\example\fbpostproviderplugin\Makefile" $(DEL_FILE) "f:\Nokia\devices\Nokia_Symbian3_SDK_v0.8\SMFCode\smf_baseline_22june_latest\example\fbpostproviderplugin\Makefile"
- -@ if EXIST "f:\Nokia\devices\Nokia_Symbian3_SDK_v0.8\SMFCode\smf_baseline_22june_latest\example\fbpostproviderplugin\Makefile_0xEfa582ee.mk" $(DEL_FILE) "f:\Nokia\devices\Nokia_Symbian3_SDK_v0.8\SMFCode\smf_baseline_22june_latest\example\fbpostproviderplugin\Makefile_0xEfa582ee.mk"
- -@ if EXIST "f:\Nokia\devices\Nokia_Symbian3_SDK_v0.8\SMFCode\smf_baseline_22june_latest\example\fbpostproviderplugin\fbpostproviderplugin_0xEfa582ee.mmp" $(DEL_FILE) "f:\Nokia\devices\Nokia_Symbian3_SDK_v0.8\SMFCode\smf_baseline_22june_latest\example\fbpostproviderplugin\fbpostproviderplugin_0xEfa582ee.mmp"
- -@ if EXIST "f:\Nokia\devices\Nokia_Symbian3_SDK_v0.8\SMFCode\smf_baseline_22june_latest\example\fbpostproviderplugin\plugin_commonU.def" $(DEL_FILE) "f:\Nokia\devices\Nokia_Symbian3_SDK_v0.8\SMFCode\smf_baseline_22june_latest\example\fbpostproviderplugin\plugin_commonU.def"
- -@ if EXIST "f:\Nokia\devices\Nokia_Symbian3_SDK_v0.8\SMFCode\smf_baseline_22june_latest\example\fbpostproviderplugin\.make.cache" $(DEL_FILE) "f:\Nokia\devices\Nokia_Symbian3_SDK_v0.8\SMFCode\smf_baseline_22june_latest\example\fbpostproviderplugin\.make.cache"
- -@ if EXIST "f:\Nokia\devices\Nokia_Symbian3_SDK_v0.8\SMFCode\smf_baseline_22june_latest\example\fbpostproviderplugin\bld.inf" $(DEL_FILE) "f:\Nokia\devices\Nokia_Symbian3_SDK_v0.8\SMFCode\smf_baseline_22june_latest\example\fbpostproviderplugin\bld.inf"
- -@ if EXIST "f:\Nokia\devices\Nokia_Symbian3_SDK_v0.8\SMFCode\smf_baseline_22june_latest\example\fbpostproviderplugin\qmakepluginstubs" $(DEL_DIR) "f:\Nokia\devices\Nokia_Symbian3_SDK_v0.8\SMFCode\smf_baseline_22june_latest\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
-
--- a/example/fbpostproviderplugin/bld.inf Thu Aug 05 16:35:33 2010 +0530
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,24 +0,0 @@
-// ============================================================================
-// * 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
-
--- a/example/fbpostproviderplugin/fbpostproviderplugin.cpp Thu Aug 05 16:35:33 2010 +0530
+++ b/example/fbpostproviderplugin/fbpostproviderplugin.cpp Thu Aug 05 16:46:37 2010 +0530
@@ -25,6 +25,8 @@
#include <QVariant>
#include <QListIterator>
#include <QDebug>
+#include <QSettings>
+#include <smfpluginutil.h>
#ifdef SMF_XMLPARSING
#include <QXmlStreamReader>
#endif
@@ -39,6 +41,12 @@
QString currentId;
#endif
QMap<QString, QString> idNameMap;
+QMap<QString, QString> idPicMap;
+
+
+// Todo:- Macro added for limiting items fetched to recent 5
+// Remove after demo
+#define SETLIMITOFFIVEFORSMFDEMO 1
/**
* Method called by plugins to generate a signature string from a base string
@@ -58,6 +66,54 @@
return returnString;
}
+
+/**
+ * Method to interpret the key sets obtained from credential manager
+ * @param aApiKey [out] The api key
+ * @param aApiSecret [out] The api secret
+ * @param aSessionKey [out] The session key
+ * @param aSessionSecret [out] The session secret
+ */
+void FBPostProviderPlugin::fetchKeys( QString &aApiKey,
+ QString &aApiSecret,
+ QString &aSessionKey,
+ QString &aSessionSecret )
+ {
+ qDebug()<<"Inside FBPostProviderPlugin::fetchKeys()";
+
+ qDebug()<<"Reg Token = "<<m_provider->m_smfRegToken;
+ qDebug()<<"Expiry Date as int = "<<m_provider->m_validity.toTime_t();
+
+ SmfAuthParams keys;
+ SmfPluginUtil util;
+ util.getAuthKeys(keys, m_provider->m_smfRegToken,
+ m_provider->m_validity, m_provider->m_pluginId);
+
+ qDebug()<<"Number of key-value pairs = "<<keys.count();
+
+ QByteArray keyName;
+ keyName.append("ApiKey");
+ aApiKey.append(keys.value(keyName));
+
+ keyName.clear();
+ keyName.append("ApiSecret");
+ aApiSecret.append(keys.value(keyName));
+
+ keyName.clear();
+ keyName.append("SessionKey");
+ aSessionKey.append(keys.value(keyName));
+
+ keyName.clear();
+ keyName.append("SessionSecret");
+ aSessionSecret.append(keys.value(keyName));
+
+ qDebug()<<"Api Key = "<<aApiKey;
+ qDebug()<<"Api Secret = "<<aApiSecret;
+ qDebug()<<"session Key = "<<aSessionKey;
+ qDebug()<<"session Secret = "<<aSessionSecret;
+ }
+
+
/**
* Destructor
*/
@@ -101,7 +157,10 @@
QVector<QTextFormat> FBPostProviderPlugin::supportedFormats ( ) const
{
qDebug()<<"Inside FBPostProviderPlugin::supportedFormats()";
+ QTextFormat f1, f2;
QVector<QTextFormat> data;
+ data.append(f1);
+ data.append(f2);
return data;
}
@@ -113,7 +172,7 @@
bool FBPostProviderPlugin::supportsAppearence ( ) const
{
qDebug()<<"Inside FBPostProviderPlugin::supportsAppearence()";
- return false;
+ return true;
}
/**
@@ -129,14 +188,16 @@
const int aPageNum ,
const int aItemsPerPage )
{
- Q_UNUSED(aUser)
qDebug()<<"Inside FBPostProviderPlugin::retrieve()";
+ if(0 != aUser->value("Guid").value<QContactGuid>().guid().size())
+ chance = 1;
+
//// Currently considering for self contact , ie, omitting aUser
if(0 == chance)
return getFacebookUserId(aRequest);
else
- return getPosts(aRequest, aPageNum , aItemsPerPage);
+ return getPosts(aRequest, aUser, aPageNum , aItemsPerPage);
}
@@ -152,32 +213,12 @@
SmfPluginError error = SmfPluginErrUserNotLoggedIn;
-#if 1
-// Reading the keys, CSM Stubbed - START
- QFile file("c:\\data\\FacebookKeys.txt");
- if (!file.open(QIODevice::ReadOnly))
- {
- qDebug()<<"File to read the keys could not be opened";
- return error;
- }
-
- qDebug()<<"Key file read, going to parse the key values from file";
-
- QByteArray arr = file.readAll();
- QList<QByteArray> list = arr.split('\n');
- file.close();
-
- QString apiKey(list[0]);
- QString apiSecret(list[1]);
- QString sessionKey(list[2]);
- QString sessionSecret(list[3]);
-
- qDebug()<<"Api Key = "+apiKey;
- qDebug()<<"Api Secret = "+apiSecret;
- qDebug()<<"session Key = "+sessionKey;
- qDebug()<<"session Secret = "+sessionSecret;
-// Reading the keys, CSM Stubbed - END
-#endif
+ // Get the key sets from SMF Plugin Utility class.
+ QString apiKey;
+ QString apiSecret;
+ QString sessionKey;
+ QString sessionSecret;
+ fetchKeys(apiKey, apiSecret, sessionKey, sessionSecret);
// Get the current date and time and convert it to sec as a string
QString call_id = QString::number(QDateTime::currentDateTime().toTime_t(), 10);
@@ -226,16 +267,19 @@
/**
* Method to get the user's 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::getPosts(
SmfPluginRequestData &aRequest,
+ const SmfContact *aUser,
const int aPageNum ,
const int aItemsPerPage )
{
qDebug()<<"Inside FBPostProviderPlugin::getPosts()";
+ qDebug()<<"Required guid = "<<aUser->value("Guid").value<QContactGuid>().guid();
qDebug()<<"aPageNum = "<<aPageNum;
qDebug()<<"aItemsPerPage = "<<aItemsPerPage;
@@ -250,32 +294,12 @@
qDebug()<<"Valid arguments";
-#if 1
-// Reading the keys, CSM Stubbed - START
- QFile file("c:\\data\\FacebookKeys.txt");
- if (!file.open(QIODevice::ReadOnly))
- {
- qDebug()<<"File to read the keys could not be opened";
- return SmfPluginErrUserNotLoggedIn;
- }
-
- qDebug()<<"Key file read, going to parse the key values from file";
-
- QByteArray arr = file.readAll();
- QList<QByteArray> list = arr.split('\n');
- file.close();
-
- QString apiKey(list[0]);
- QString apiSecret(list[1]);
- QString sessionKey(list[2]);
- QString sessionSecret(list[3]);
-
- qDebug()<<"Api Key = "+apiKey;
- qDebug()<<"Api Secret = "+apiSecret;
- qDebug()<<"session Key = "+sessionKey;
- qDebug()<<"session Secret = "+sessionSecret;
-// Reading the keys, CSM Stubbed - END
-#endif
+ // Get the key sets from SMF Plugin Utility class.
+ QString apiKey;
+ QString apiSecret;
+ QString sessionKey;
+ QString sessionSecret;
+ fetchKeys(apiKey, apiSecret, sessionKey, sessionSecret);
// Get the current date and time and convert it to sec as a string
QString call_id = QString::number(QDateTime::currentDateTime().toTime_t(), 10);
@@ -289,17 +313,23 @@
#else
baseString.append("format=JSON");
#endif
+
+#ifdef SETLIMITOFFIVEFORSMFDEMO // Hard coding the number of posts fetched as recent 5
+ qDebug()<<"Hardcoding pagenumber and itemperpage to fetch 5 recent posts";
+ int val = 5;
+ baseString.append("limit="+QString::number(val));
+#else
if(0 == aPageNum)
- {
- //baseString.append("limit="+QString::number((aItemsPerPage*(aPageNum+1)), 10));
- qDebug()<<"Hardcoding pagenumber and itemperpage to fetch 5 posts";
- int val = 5;
- baseString.append("limit="+QString::number(val));
- }
+ baseString.append("limit="+QString::number((aItemsPerPage*(aPageNum+1)), 10));
else
baseString.append("limit="+QString::number((aItemsPerPage*aPageNum), 10));
+#endif
+
baseString.append("method=stream.get");
baseString.append("session_key="+sessionKey);
+ if(0 != aUser->value("Guid").value<QContactGuid>().guid().size())
+ baseString.append("source_ids="+aUser->value("Guid").value<QContactGuid>().guid());
+ else
baseString.append("source_ids="+uid);
baseString.append("ss=1");
baseString.append("v=1.0");
@@ -314,17 +344,23 @@
#else
url.addQueryItem("format", "JSON");
#endif
+
+#ifdef SETLIMITOFFIVEFORSMFDEMO // Hard coding the number of posts fetched as recent 5
+ qDebug()<<"Hardcoding pagenumber and itemperpage to fetch 5 recent posts";
+ val = 5;
+ url.addQueryItem("limit", QString::number(val));
+#else
if(0 == aPageNum)
- {
-// url.addQueryItem("limit", QString::number((aItemsPerPage*(aPageNum+1)), 10));
- qDebug()<<"Hardcoding pagenumber and itemperpage to fetch 5 posts";
- int val = 5;
- url.addQueryItem("limit", QString::number(val));
- }
+ url.addQueryItem("limit", QString::number((aItemsPerPage*(aPageNum+1)), 10));
else
url.addQueryItem("limit", QString::number((aItemsPerPage*aPageNum), 10));
+#endif
+
url.addQueryItem("method", "stream.get");
url.addQueryItem("session_key", sessionKey);
+ if(0 != aUser->value("Guid").value<QContactGuid>().guid().size())
+ url.addQueryItem("source_ids",aUser->value("Guid").value<QContactGuid>().guid());
+ else
url.addQueryItem("source_ids",uid);
url.addQueryItem("ss", "1");
url.addQueryItem("v", "1.0");
@@ -406,32 +442,12 @@
qDebug()<<"Valid arguments";
-#if 1
-// Reading the keys, CSM Stubbed - START
- QFile file("c:\\data\\FacebookKeys.txt");
- if (!file.open(QIODevice::ReadOnly))
- {
- qDebug()<<"File to read the keys could not be opened";
- return SmfPluginErrUserNotLoggedIn;
- }
-
- qDebug()<<"Key file read, going to parse the key values from file";
-
- QByteArray arr = file.readAll();
- QList<QByteArray> list = arr.split('\n');
- file.close();
-
- QString apiKey(list[0]);
- QString apiSecret(list[1]);
- QString sessionKey(list[2]);
- QString sessionSecret(list[3]);
-
- qDebug()<<"Api Key = "<<apiKey;
- qDebug()<<"Api Secret = "<<apiSecret;
- qDebug()<<"session Key = "<<sessionKey;
- qDebug()<<"session Secret = "<<sessionSecret;
-// Reading the keys, CSM Stubbed - END
-#endif
+ // Get the key sets from SMF Plugin Utility class.
+ QString apiKey;
+ QString apiSecret;
+ QString sessionKey;
+ QString sessionSecret;
+ fetchKeys(apiKey, apiSecret, sessionKey, sessionSecret);
// Get the current date and time and convert it to sec as a string
QString call_id = QString::number(QDateTime::currentDateTime().toTime_t(), 10);
@@ -570,14 +586,9 @@
/**
* 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 )
+void FBPostProviderPlugin::initialize( )
{
- // Save the SmfPluginUtil handle
- m_util = aUtil;
-
// Create an instance of FlickrProviderBase
m_provider = new FBProviderBase;
m_provider->initialize();
@@ -630,7 +641,20 @@
QByteArray response(*aResponse);
delete aResponse;
- qDebug()<<"FB response = "<<QString(response);
+
+ QFile respFile("c://data//SmfPluginFBPostResponse.txt");
+ if(!respFile.open(QIODevice::WriteOnly))
+ {
+ qDebug()<<"File to write the response could not be opened, so writing to this file";
+ qDebug()<<"Flickr response = "<<QString(response);
+ }
+ else
+ {
+ respFile.write(response);
+ respFile.close();
+ qDebug()<<"Writing FB response to a file named 'SmfPluginFBPostResponse.txt'";
+ }
+
qDebug()<<"FB response size = "<<response.size();
if(SmfTransportOpNoError == aTransportResult)
@@ -679,10 +703,11 @@
qDebug()<<"Response contains error, so parse and get the error code";
bool ok;
- QVariant result = m_util->parse(response, &ok);
+ SmfPluginUtil util;
+ QVariant result = util.parse(response, &ok);
if (!ok)
{
- qDebug()<<"An error occurred during json parsing, error = "<<m_util->errorString();
+ qDebug()<<"An error occurred during json parsing, error = "<<util.errorString();
aRetType = SmfRequestError;
return SmfPluginErrParsingFailed;
}
@@ -813,7 +838,8 @@
qDebug()<<"Json parsing";
bool ok;
- QVariantMap result = m_util->parse(response, &ok).toMap();
+ SmfPluginUtil util;
+ QVariantMap result = util.parse(response, &ok).toMap();
if (!ok)
{
qDebug()<<"An error occurred during json parsing";
@@ -873,7 +899,9 @@
QVariantMap map2 = iter2.next().toMap();
qDebug()<<"owner's id = "<<map2["id"].toString();
qDebug()<<"owner's name = "<<map2["name"].toString();
+ qDebug()<<"owner's profile image url = "<<map2["pic_square"].toString();
idNameMap.insert(map2["id"].toString(), map2["name"].toString());
+ idPicMap.insert(map2["id"].toString(), map2["pic_square"].toString());
}
// Loop for setting the "Name" of actor_id
@@ -887,6 +915,13 @@
QVariant nameVar = QVariant::fromValue(contactName);
contact.setValue("Name", nameVar);
+ QContactAvatar avatar;
+ QUrl url(idPicMap.value(contact.value("Guid").value<QContactGuid>().guid()));
+ avatar.setImageUrl(url);
+ qDebug()<<"Profile Image Url = "<<url.toString();
+ QVariant urlVar = QVariant::fromValue<QContactAvatar>(avatar);
+ contact.setValue("Avatar", urlVar);
+
list[i].setOwner(contact);
}
}
@@ -936,7 +971,8 @@
}
#else
bool ok;
- QVariantMap result = m_util->parse(response, &ok).toMap();
+ SmfPluginUtil util;
+ QVariantMap result = util.parse(response, &ok).toMap();
if (!ok)
{
qDebug()<<"Response cannot be parsed";
@@ -1106,12 +1142,14 @@
void FBProviderBase::initialize()
{
m_serviceName = "Facebook";
- m_description = "Facebook plugin description";
+ m_description = "Facebook post plugin description";
m_serviceUrl = QUrl(QString("http://api.facebook.com"));
m_pluginId = "fbpostproviderplugin.qtplugin";
- m_authAppId = "Facebook AuthAppId";
- m_smfRegToken = "Facebook RegToken";
+ m_authAppId = "0xEFE2FD23";
m_supportedInterfaces.append("org.symbian.smf.plugin.contact.posts/v0.2");
+ QSettings iSettings;
+ m_smfRegToken = iSettings.value("FBCMRegToken").toString();
+ m_validity = iSettings.value("FBExpiryTime").toDateTime();
}
--- a/example/fbpostproviderplugin/fbpostproviderplugin.h Thu Aug 05 16:35:33 2010 +0530
+++ b/example/fbpostproviderplugin/fbpostproviderplugin.h Thu Aug 05 16:46:37 2010 +0530
@@ -21,13 +21,12 @@
#define _FBPOSTPROVIDERPLUGIN_H
// Include files
+#include <QDateTime>
#include <smfpostproviderplugin.h>
-#include <smfpluginutil.h>
// Forward declarations
class FBProviderBase;
class QVariant;
-class QNetworkReply;
/**
@@ -179,10 +178,8 @@
/**
* 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 );
+ void initialize( );
/**
* Method to get the provider information
@@ -233,17 +230,30 @@
/**
* Method to get the user's 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 getPosts( SmfPluginRequestData &aRequest,
+ const SmfContact *aUser,
const int aPageNum ,
const int aItemsPerPage );
+ /**
+ * Method to interpret the key sets obtained from credential manager
+ * @param aApiKey [out] The api key
+ * @param aApiSecret [out] The api secret
+ * @param aSessionKey [out] The session key
+ * @param aSessionSecret [out] The session secret
+ */
+ void fetchKeys( QString &aApiKey,
+ QString &aApiSecret,
+ QString &aSessionKey,
+ QString &aSessionSecret );
+
private:
FBProviderBase *m_provider;
- SmfPluginUtil *m_util;
};
@@ -355,6 +365,7 @@
QString m_smfRegToken;
QList<QString> m_supportedInterfaces;
QStringList m_supportedLangs;
+ QDateTime m_validity;
};
#endif /*_FBPOSTPROVIDERPLUGIN_H*/
--- a/example/fbpostproviderplugin/fbpostproviderplugin.pro Thu Aug 05 16:35:33 2010 +0530
+++ b/example/fbpostproviderplugin/fbpostproviderplugin.pro Thu Aug 05 16:46:37 2010 +0530
@@ -36,7 +36,7 @@
ReadDeviceData \
WriteDeviceData
- LIBS += -lsmfclient.dll
+ LIBS += -lsmfcommon
}
target.path += $$[QT_INSTALL_PLUGINS]/smf/plugin/contact.posts
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/example/fbpostproviderplugin/fbpostproviderplugin_installer.pkg Thu Aug 05 16:46:37 2010 +0530
@@ -0,0 +1,30 @@
+; fbpostproviderplugin_installer.pkg generated by qmake at 2010-07-30T14:11:44
+; This file is generated by qmake and should not be modified by the user
+;
+
+; Language
+&EN
+
+; SIS header: name, uid, version
+#{"fbpostproviderplugin installer"},(0xA000D7CE),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
+; Default dependency to QtMobility libraries
+
+
+"D:/smf/MissingCode/smfrepo/example/fbpostproviderplugin/fbpostproviderplugin.sis" - "c:\adm\fbpostproviderplugin.sis"
+@"D:/Qt/4.6.2/smartinstaller.sis",(0x2002CCCD)
--- a/example/fbpostproviderplugin/fbpostproviderplugin_template.pkg Thu Aug 05 16:35:33 2010 +0530
+++ b/example/fbpostproviderplugin/fbpostproviderplugin_template.pkg Thu Aug 05 16:46:37 2010 +0530
@@ -1,13 +1,12 @@
-; fbpostproviderplugin_template.pkg generated by qmake at 2010-06-22T14:10:41
+; fbpostproviderplugin_template.pkg generated by qmake at 2010-07-30T14:11:44
; This file is generated by qmake and should not be modified by the user
;
; Language
&EN
-
; SIS header: name, uid, version
-#{"fbpostproviderplugin"},(0xEfa582ee),1,0,0
+#{"fbpostproviderplugin"},(0xEb57b616),1,0,0
; Localised Vendor name
%{"Vendor"}
@@ -17,19 +16,19 @@
; Manual PKG pre-rules from PRO files
-; Default dependency to Qt libraries
-(0x2001E61C), 4, 6, 3, {"Qt"}
; 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, 2, {"Qt"}
; Default dependency to QtMobility libraries
(0x2002AC89), 1, 0, 0, {"QtMobility"}
; DEPLOYMENT
-"/Nokia/devices/Nokia_Symbian3_SDK_v0.8/epoc32/release/$(PLATFORM)/$(TARGET)/fbpostproviderplugin.dll" - "!:\sys\bin\fbpostproviderplugin.dll"
-"/Nokia/devices/Nokia_Symbian3_SDK_v0.8/epoc32/data/z/resource/qt/plugins/smf/plugin/contact.posts/fbpostproviderplugin.qtplugin" - "!:\resource\qt\plugins\smf\plugin\contact.posts\fbpostproviderplugin.qtplugin"
+"d:/S60/devices/Nokia_Symbian3_SDK_v0.8/epoc32/release/$(PLATFORM)/$(TARGET)/fbpostproviderplugin.dll" - "!:\sys\bin\fbpostproviderplugin.dll"
+"d:/smf/MissingCode/smfrepo/example/fbpostproviderplugin/qmakepluginstubs/fbpostproviderplugin.qtplugin" - "!:\resource\qt\plugins\smf\plugin\contact.posts\fbpostproviderplugin.qtplugin"
; Manual PKG post-rules from PRO files
--- a/example/fbpostproviderplugin/plugin_commonU.def Thu Aug 05 16:35:33 2010 +0530
+++ b/example/fbpostproviderplugin/plugin_commonU.def Thu Aug 05 16:46:37 2010 +0530
@@ -1,5 +1,5 @@
; ==============================================================================
-; Generated by qmake (2.01a) (Qt 4.6.3) on: 2010-06-22T14:10:41
+; Generated by qmake (2.01a) (Qt 4.6.2) on: 2010-07-30T14:11:44
; This file is generated by qmake and should not be modified by the
; user.
; Name : plugin_commonU.def
--- a/example/fbpostproviderplugin/qmakepluginstubs/fbpostproviderplugin.qtplugin Thu Aug 05 16:35:33 2010 +0530
+++ b/example/fbpostproviderplugin/qmakepluginstubs/fbpostproviderplugin.qtplugin Thu Aug 05 16:46:37 2010 +0530
@@ -1,1 +1,1 @@
-This file is a Qt plugin stub file. The real Qt plugin is located in /sys/bin. Created:2010-06-22T14:10:41
+This file is a Qt plugin stub file. The real Qt plugin is located in \sys\bin. Created:2010-07-30T14:11:44
--- a/example/flickrcontactfetcherplugin/ABLD.BAT Thu Aug 05 16:35:33 2010 +0530
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,15 +0,0 @@
-@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
--- a/example/flickrcontactfetcherplugin/Makefile Thu Aug 05 16:35:33 2010 +0530
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,239 +0,0 @@
-# ==============================================================================
-# Generated by qmake (2.01a) (Qt 4.6.3) on: Tue Jun 22 14:10:41 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 = f:\Qt\4.6.3\bin\qmake
-DEL_FILE = del
-DEL_DIR = rmdir
-MOVE = move
-CHK_DIR_EXISTS = if not exist
-MKDIR = mkdir
-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"F:/Qt/4.6.3/include/QtCore" -I"F:/Qt/4.6.3/include/QtCore/tmp" -I"F:/Qt/4.6.3/include/QtNetwork" -I"F:/Qt/4.6.3/include/QtNetwork/tmp" -I"F:/Qt/4.6.3/include/QtGui" -I"F:/Qt/4.6.3/include/QtGui/tmp" -I"F:/Qt/4.6.3/include/QtXml" -I"F:/Qt/4.6.3/include/QtXml/tmp" -I"F:/Qt/4.6.3/include" -I"F:/Qt/4.6.3/include/tmp" -I"F:/Qt/4.6.3/include/QtContacts" -I"F:/Qt/4.6.3/include/QtContacts/tmp" -I"F:/Qt/4.6.3/include/QtLocation" -I"F:/Qt/4.6.3/include/QtLocation/tmp" -I"F:/Qt/4.6.3/mkspecs/common/symbian" -I"F:/Qt/4.6.3/mkspecs/common/symbian/tmp" -I"F:/Nokia/devices/Nokia_Symbian3_SDK_v0.8/epoc32/include" -I"F:/Nokia/devices/Nokia_Symbian3_SDK_v0.8/epoc32/include/stdapis" -I"F:/Nokia/devices/Nokia_Symbian3_SDK_v0.8/epoc32/include/stdapis/sys" -I"F:/Nokia/devices/Nokia_Symbian3_SDK_v0.8/epoc32/include/mw" -I"F:/Nokia/devices/Nokia_Symbian3_SDK_v0.8/epoc32/include/platform/mw" -I"F:/Nokia/devices/Nokia_Symbian3_SDK_v0.8/epoc32/include/platform" -I"F:/Nokia/devices/Nokia_Symbian3_SDK_v0.8/epoc32/include/app" -I"F:/Nokia/devices/Nokia_Symbian3_SDK_v0.8/epoc32/include/platform/app" -I"F:/Nokia/devices/Nokia_Symbian3_SDK_v0.8/epoc32/include/platform/loc" -I"F:/Nokia/devices/Nokia_Symbian3_SDK_v0.8/epoc32/include/platform/mw/loc" -I"F:/Nokia/devices/Nokia_Symbian3_SDK_v0.8/epoc32/include/platform/app/loc" -I"F:/Nokia/devices/Nokia_Symbian3_SDK_v0.8/epoc32/include/platform/loc/sc" -I"F:/Nokia/devices/Nokia_Symbian3_SDK_v0.8/epoc32/include/platform/mw/loc/sc" -I"F:/Nokia/devices/Nokia_Symbian3_SDK_v0.8/epoc32/include/platform/app/loc/sc" -I"F:/Nokia/devices/Nokia_Symbian3_SDK_v0.8/epoc32/include/stdapis/stlportv5" -I"F:/Nokia/devices/Nokia_Symbian3_SDK_v0.8/SMFCode/smf_baseline_22june_latest/example/flickrcontactfetcherplugin" -I"F:/Nokia/devices/Nokia_Symbian3_SDK_v0.8/SMFCode/smf_baseline_22june_latest/example/flickrcontactfetcherplugin/tmp"
-first: default
-default: debug-winscw
-all: debug release
-
-qmake:
- $(QMAKE) -spec symbian-abld -o "bld.inf" "F:/Nokia/devices/Nokia_Symbian3_SDK_v0.8/SMFCode/smf_baseline_22june_latest/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
-
-check: first
-
-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
- F:\Qt\4.6.3\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 "F:\Qt\4.6.3\include\QtCore\tmp" mkdir "F:\Qt\4.6.3\include\QtCore\tmp"
- -@ if NOT EXIST "F:\Qt\4.6.3\include\QtNetwork\tmp" mkdir "F:\Qt\4.6.3\include\QtNetwork\tmp"
- -@ if NOT EXIST "F:\Qt\4.6.3\include\QtGui\tmp" mkdir "F:\Qt\4.6.3\include\QtGui\tmp"
- -@ if NOT EXIST "F:\Qt\4.6.3\include\QtXml\tmp" mkdir "F:\Qt\4.6.3\include\QtXml\tmp"
- -@ if NOT EXIST "F:\Qt\4.6.3\include\tmp" mkdir "F:\Qt\4.6.3\include\tmp"
- -@ if NOT EXIST "F:\Qt\4.6.3\include\QtContacts\tmp" mkdir "F:\Qt\4.6.3\include\QtContacts\tmp"
- -@ if NOT EXIST "F:\Qt\4.6.3\include\QtLocation\tmp" mkdir "F:\Qt\4.6.3\include\QtLocation\tmp"
- -@ if NOT EXIST "F:\Qt\4.6.3\mkspecs\common\symbian\tmp" mkdir "F:\Qt\4.6.3\mkspecs\common\symbian\tmp"
- -@ if NOT EXIST "F:\Nokia\devices\Nokia_Symbian3_SDK_v0.8\SMFCode\smf_baseline_22june_latest\example\flickrcontactfetcherplugin\tmp" mkdir "F:\Nokia\devices\Nokia_Symbian3_SDK_v0.8\SMFCode\smf_baseline_22june_latest\example\flickrcontactfetcherplugin\tmp"
-
-extension_clean: compiler_clean
- -@ if EXIST "F:\Qt\4.6.3\include\QtCore\tmp" rmdir /S /Q "F:\Qt\4.6.3\include\QtCore\tmp"
- -@ if EXIST "F:\Qt\4.6.3\include\QtNetwork\tmp" rmdir /S /Q "F:\Qt\4.6.3\include\QtNetwork\tmp"
- -@ if EXIST "F:\Qt\4.6.3\include\QtGui\tmp" rmdir /S /Q "F:\Qt\4.6.3\include\QtGui\tmp"
- -@ if EXIST "F:\Qt\4.6.3\include\QtXml\tmp" rmdir /S /Q "F:\Qt\4.6.3\include\QtXml\tmp"
- -@ if EXIST "F:\Qt\4.6.3\include\tmp" rmdir /S /Q "F:\Qt\4.6.3\include\tmp"
- -@ if EXIST "F:\Qt\4.6.3\include\QtContacts\tmp" rmdir /S /Q "F:\Qt\4.6.3\include\QtContacts\tmp"
- -@ if EXIST "F:\Qt\4.6.3\include\QtLocation\tmp" rmdir /S /Q "F:\Qt\4.6.3\include\QtLocation\tmp"
- -@ if EXIST "F:\Qt\4.6.3\mkspecs\common\symbian\tmp" rmdir /S /Q "F:\Qt\4.6.3\mkspecs\common\symbian\tmp"
- -@ if EXIST "F:\Nokia\devices\Nokia_Symbian3_SDK_v0.8\SMFCode\smf_baseline_22june_latest\example\flickrcontactfetcherplugin\tmp" rmdir /S /Q "F:\Nokia\devices\Nokia_Symbian3_SDK_v0.8\SMFCode\smf_baseline_22june_latest\example\flickrcontactfetcherplugin\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) "f:\Nokia\devices\Nokia_Symbian3_SDK_v0.8\SMFCode\smf_baseline_22june_latest\example\flickrcontactfetcherplugin\qmakepluginstubs\flickrcontactfetcherplugin.qtplugin" "\Nokia\devices\Nokia_Symbian3_SDK_v0.8\epoc32\winscw\c\resource\qt\plugins\smf\plugin\contact.fetcher\"
-
-winscw_deployment_clean:
- -@ if EXIST "\Nokia\devices\Nokia_Symbian3_SDK_v0.8\epoc32\winscw\c\resource\qt\plugins\smf\plugin\contact.fetcher\flickrcontactfetcherplugin.qtplugin" $(DEL_FILE) "\Nokia\devices\Nokia_Symbian3_SDK_v0.8\epoc32\winscw\c\resource\qt\plugins\smf\plugin\contact.fetcher\flickrcontactfetcherplugin.qtplugin"
-
-deployment:
- -echo Deploying changed files...
- -$(XCOPY) "f:\Nokia\devices\Nokia_Symbian3_SDK_v0.8\SMFCode\smf_baseline_22june_latest\example\flickrcontactfetcherplugin\qmakepluginstubs\flickrcontactfetcherplugin.qtplugin" "\Nokia\devices\Nokia_Symbian3_SDK_v0.8\epoc32\data\z\resource\qt\plugins\smf\plugin\contact.fetcher\"
-
-deployment_clean:
- -@ if EXIST "\Nokia\devices\Nokia_Symbian3_SDK_v0.8\epoc32\data\z\resource\qt\plugins\smf\plugin\contact.fetcher\flickrcontactfetcherplugin.qtplugin" $(DEL_FILE) "\Nokia\devices\Nokia_Symbian3_SDK_v0.8\epoc32\data\z\resource\qt\plugins\smf\plugin\contact.fetcher\flickrcontactfetcherplugin.qtplugin"
-
--include .make.cache
-
-sis:
- $(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)
-
-flickrcontactfetcherplugin.sis:
- $(MAKE) -s -f $(MAKEFILE) sis
-
-stub_sis:
- $(if $(wildcard flickrcontactfetcherplugin_template.pkg),$(if $(wildcard .make.cache),$(MAKE) -s -f $(MAKEFILE) ok_stub_sis,$(if $(QT_SIS_TARGET),$(MAKE) -s -f $(MAKEFILE) ok_stub_sis,$(MAKE) -s -f $(MAKEFILE) fail_sis_nocache)),$(MAKE) -s -f $(MAKEFILE) fail_sis_nopkg)
-
-ok_stub_sis:
- createpackage.bat -s $(QT_SIS_OPTIONS) flickrcontactfetcherplugin_template.pkg $(QT_SIS_TARGET) $(QT_SIS_CERTIFICATE) $(QT_SIS_KEY) $(QT_SIS_PASSPHRASE)
-
-installer_sis: flickrcontactfetcherplugin.sis
- $(if $(wildcard flickrcontactfetcherplugin_installer.pkg),$(MAKE) -s -f $(MAKEFILE) ok_installer_sis,$(MAKE) -s -f $(MAKEFILE) fail_sis_nopkg)
-
-ok_installer_sis:
- createpackage.bat $(QT_SIS_OPTIONS) flickrcontactfetcherplugin_installer.pkg - $(QT_SIS_CERTIFICATE) $(QT_SIS_KEY) $(QT_SIS_PASSPHRASE)
-
-fail_sis_nopkg:
- $(error PKG file does not exist, 'sis' and 'installer_sis' target are 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)
-
-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 "f:\Nokia\devices\Nokia_Symbian3_SDK_v0.8\SMFCode\smf_baseline_22june_latest\example\flickrcontactfetcherplugin\flickrcontactfetcherplugin_template.pkg" $(DEL_FILE) "f:\Nokia\devices\Nokia_Symbian3_SDK_v0.8\SMFCode\smf_baseline_22june_latest\example\flickrcontactfetcherplugin\flickrcontactfetcherplugin_template.pkg"
- -@ if EXIST "f:\Nokia\devices\Nokia_Symbian3_SDK_v0.8\SMFCode\smf_baseline_22june_latest\example\flickrcontactfetcherplugin\qmakepluginstubs\flickrcontactfetcherplugin.qtplugin" $(DEL_FILE) "f:\Nokia\devices\Nokia_Symbian3_SDK_v0.8\SMFCode\smf_baseline_22june_latest\example\flickrcontactfetcherplugin\qmakepluginstubs\flickrcontactfetcherplugin.qtplugin"
- -@ if EXIST "f:\Nokia\devices\Nokia_Symbian3_SDK_v0.8\SMFCode\smf_baseline_22june_latest\example\flickrcontactfetcherplugin\flickrcontactfetcherplugin_installer.pkg" $(DEL_FILE) "f:\Nokia\devices\Nokia_Symbian3_SDK_v0.8\SMFCode\smf_baseline_22june_latest\example\flickrcontactfetcherplugin\flickrcontactfetcherplugin_installer.pkg"
- -@ if EXIST "f:\Nokia\devices\Nokia_Symbian3_SDK_v0.8\SMFCode\smf_baseline_22june_latest\example\flickrcontactfetcherplugin\Makefile" $(DEL_FILE) "f:\Nokia\devices\Nokia_Symbian3_SDK_v0.8\SMFCode\smf_baseline_22june_latest\example\flickrcontactfetcherplugin\Makefile"
- -@ if EXIST "f:\Nokia\devices\Nokia_Symbian3_SDK_v0.8\SMFCode\smf_baseline_22june_latest\example\flickrcontactfetcherplugin\Makefile_0xE1f540a6.mk" $(DEL_FILE) "f:\Nokia\devices\Nokia_Symbian3_SDK_v0.8\SMFCode\smf_baseline_22june_latest\example\flickrcontactfetcherplugin\Makefile_0xE1f540a6.mk"
- -@ if EXIST "f:\Nokia\devices\Nokia_Symbian3_SDK_v0.8\SMFCode\smf_baseline_22june_latest\example\flickrcontactfetcherplugin\flickrcontactfetcherplugin_0xE1f540a6.mmp" $(DEL_FILE) "f:\Nokia\devices\Nokia_Symbian3_SDK_v0.8\SMFCode\smf_baseline_22june_latest\example\flickrcontactfetcherplugin\flickrcontactfetcherplugin_0xE1f540a6.mmp"
- -@ if EXIST "f:\Nokia\devices\Nokia_Symbian3_SDK_v0.8\SMFCode\smf_baseline_22june_latest\example\flickrcontactfetcherplugin\plugin_commonU.def" $(DEL_FILE) "f:\Nokia\devices\Nokia_Symbian3_SDK_v0.8\SMFCode\smf_baseline_22june_latest\example\flickrcontactfetcherplugin\plugin_commonU.def"
- -@ if EXIST "f:\Nokia\devices\Nokia_Symbian3_SDK_v0.8\SMFCode\smf_baseline_22june_latest\example\flickrcontactfetcherplugin\.make.cache" $(DEL_FILE) "f:\Nokia\devices\Nokia_Symbian3_SDK_v0.8\SMFCode\smf_baseline_22june_latest\example\flickrcontactfetcherplugin\.make.cache"
- -@ if EXIST "f:\Nokia\devices\Nokia_Symbian3_SDK_v0.8\SMFCode\smf_baseline_22june_latest\example\flickrcontactfetcherplugin\bld.inf" $(DEL_FILE) "f:\Nokia\devices\Nokia_Symbian3_SDK_v0.8\SMFCode\smf_baseline_22june_latest\example\flickrcontactfetcherplugin\bld.inf"
- -@ if EXIST "f:\Nokia\devices\Nokia_Symbian3_SDK_v0.8\SMFCode\smf_baseline_22june_latest\example\flickrcontactfetcherplugin\qmakepluginstubs" $(DEL_DIR) "f:\Nokia\devices\Nokia_Symbian3_SDK_v0.8\SMFCode\smf_baseline_22june_latest\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
-
--- a/example/flickrcontactfetcherplugin/bld.inf Thu Aug 05 16:35:33 2010 +0530
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,24 +0,0 @@
-// ============================================================================
-// * 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
-
--- a/example/flickrcontactfetcherplugin/flickrcontactfetcherplugin.cpp Thu Aug 05 16:35:33 2010 +0530
+++ b/example/flickrcontactfetcherplugin/flickrcontactfetcherplugin.cpp Thu Aug 05 16:46:37 2010 +0530
@@ -25,6 +25,8 @@
#include <QMap>
#include <QListIterator>
#include <QDebug>
+#include <QSettings>
+#include <smfpluginutil.h>
#ifdef SMF_XMLPARSING
#include <QXmlStreamReader>
#endif
@@ -41,6 +43,46 @@
}
/**
+ * Method to interpret the key sets obtained from credential manager
+ * @param aApiKey [out] The api key
+ * @param aApiSecret [out] The api secret
+ * @param aAuthToken [out] The auth token provided by Flickr
+ */
+void FlickrContactFetcherPlugin::fetchKeys( QString &aApiKey,
+ QString &aApiSecret,
+ QString &aAuthToken )
+ {
+ qDebug()<<"Inside FlickrContactFetcherPlugin::fetchKeys()";
+
+ qDebug()<<"Reg Token = "<<m_provider->m_smfRegToken;
+ qDebug()<<"Expiry Date as int = "<<m_provider->m_validity.toTime_t();
+
+ SmfAuthParams keys;
+ SmfPluginUtil util;
+ util.getAuthKeys(keys, m_provider->m_smfRegToken,
+ m_provider->m_validity, m_provider->m_pluginId);
+
+ qDebug()<<"Number of key-value pairs = "<<keys.count();
+
+ QByteArray keyName;
+ keyName.append("ApiKey");
+ aApiKey.append(keys.value(keyName));
+
+ keyName.clear();
+ keyName.append("ApiSecret");
+ aApiSecret.append(keys.value(keyName));
+
+ keyName.clear();
+ keyName.append("AuthToken");
+ aAuthToken.append(keys.value(keyName));
+
+ qDebug()<<"Api Key = "<<aApiKey;
+ qDebug()<<"Api Secret = "<<aApiSecret;
+ qDebug()<<"Auth Token = "<<aAuthToken;
+ }
+
+
+/**
* 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
@@ -64,30 +106,11 @@
qDebug()<<"Valid arguments";
-#if 1
-// Reading the keys, CSM Stubbed - START
- QFile file("c:\\data\\FlickrKeys.txt");
- if (!file.open(QIODevice::ReadOnly))
- {
- qDebug()<<"File to read the keys could not be opened";
- return SmfPluginErrUserNotLoggedIn;
- }
-
- qDebug()<<"Key file read, going to parse the key values from file";
-
- QByteArray arr = file.readAll();
- QList<QByteArray> list = arr.split('\n');
- file.close();
-
- QString apiKey(list[0]);
- QString apiSecret(list[1]);
- QString authToken(list[2]);
-
- qDebug()<<"Api Key = "<<apiKey;
- qDebug()<<"Api Secret = "<<apiSecret;
- qDebug()<<"Auth Token = "<<authToken;
-// Reading the keys, CSM Stubbed - END
-#endif
+ // Get the key sets from SMF Plugin Utility class.
+ QString apiKey;
+ QString apiSecret;
+ QString authToken;
+ fetchKeys(apiKey, apiSecret, authToken );
// Create the API signature string
QString baseString;
@@ -274,14 +297,9 @@
/**
* 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 )
+void FlickrContactFetcherPlugin::initialize( )
{
- // Save the SmfPluginUtil handle
- m_util = aUtil;
-
// Create an instance of FlickrProviderBase
m_provider = new FlickrProviderBase;
m_provider->initialize();
@@ -335,7 +353,19 @@
QByteArray response(*aResponse);
delete aResponse;
- qDebug()<<"FB response = "<<QString(response);
+
+ QFile respFile("c://data//SmfPluginFlickrContactResponse.txt");
+ if(!respFile.open(QIODevice::WriteOnly))
+ {
+ qDebug()<<"File to write the response could not be opened, so writing to this file";
+ qDebug()<<"Flickr response = "<<QString(response);
+ }
+ else
+ {
+ respFile.write(response);
+ respFile.close();
+ qDebug()<<"Writing FB response to a file named 'SmfPluginFlickrContactResponse.txt'";
+ }
qDebug()<<"FB response size = "<<response.size();
if(SmfTransportOpNoError == aTransportResult)
@@ -381,7 +411,8 @@
// For getting contacts from json response
bool ok;
- QVariantMap result = m_util->parse(response, &ok).toMap();
+ SmfPluginUtil util;
+ QVariantMap result = util.parse(response, &ok).toMap();
if (!ok) {
qDebug()<<"An error occurred during json parsing";
aResult->setValue(list);
@@ -414,6 +445,7 @@
qDebug()<<"path_alias = "<<map2["path_alias"].toString();
qDebug()<<"location = "<<map2["location"].toString();
+ // Contact Name
QContactName contactname;
QString username = map2["username"].toString();
qDebug()<<"Username = "<<username;
@@ -421,6 +453,35 @@
contactname.setLastName(username);
QVariant nameVar = QVariant::fromValue(contactname);
contact.setValue("Name",nameVar);
+
+ // Contact's Flickr Specific ID to QContactGuid
+ QContactGuid guid;
+ guid.setGuid(map2["nsid"].toString());
+ QVariant guidVar = QVariant::fromValue(guid);
+ contact.setValue("Guid",guidVar);
+
+ // Contact's profile image url
+ QUrl url;
+ if((0 == map2["iconfarm"].toInt()) && (0 == map2["iconserver"].toInt()))
+ url = QString("http://www.flickr.com/images/buddyicon.jpg");
+ else
+ {
+ QString str("http://farm");
+ str.append(map2["iconfarm"].toString());
+ str.append(".static.flickr.com/");
+ str.append(map2["iconserver"].toString());
+ str.append("/buddyicons/");
+ str.append(map2["nsid"].toString());
+ str.append(".jpg");
+ url = str;
+ }
+ QContactAvatar avatar;
+ qDebug()<<"Profile image URL = "<<url.toString();
+ avatar.setImageUrl(url);
+ QVariant avatarVar = QVariant::fromValue(avatar);
+ contact.setValue("Avatar",avatarVar);
+
+
list.append(contact);
}
#endif
@@ -580,9 +641,11 @@
m_description = "Flickr contact fetcher plugin description";
m_serviceUrl = QUrl(QString("http://api.flickr.com"));
m_pluginId = "flickrcontactfetcherplugin.qtplugin";
- m_authAppId = "Flickr AuthAppId";
- m_smfRegToken = "Flickr RegToken";
+ m_authAppId = "0xE1D8C7D7";
m_supportedInterfaces.append("org.symbian.smf.plugin.contact.fetcher/v0.2");
+ QSettings iSettings;
+ m_smfRegToken = iSettings.value("CMFlickrRegToken").toString();
+ m_validity = iSettings.value("FlckrExpiryTime").toDateTime();
}
--- a/example/flickrcontactfetcherplugin/flickrcontactfetcherplugin.h Thu Aug 05 16:35:33 2010 +0530
+++ b/example/flickrcontactfetcherplugin/flickrcontactfetcherplugin.h Thu Aug 05 16:46:37 2010 +0530
@@ -21,13 +21,12 @@
#define _FLICKRCONTACTFETCHERPLUGIN_H
// Include files
+#include <QDateTime>
#include <smfcontactfetcherplugin.h>
-#include <smfpluginutil.h>
// Forward declarations
class FlickrProviderBase;
class QVariant;
-class QNetworkReply;
/**
@@ -137,10 +136,8 @@
/**
* 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 );
+ void initialize( );
/**
* Method to get the provider information
@@ -180,10 +177,19 @@
* @return The md5 hash of the base string
*/
QString generateSignature( const QString aBaseString );
+
+ /**
+ * Method to interpret the key sets obtained from credential manager
+ * @param aApiKey [out] The api key
+ * @param aApiSecret [out] The api secret
+ * @param aAuthToken [out] The auth token provided by Flickr
+ */
+ void fetchKeys( QString &aApiKey,
+ QString &aApiSecret,
+ QString &aAuthToken );
private:
FlickrProviderBase *m_provider;
- SmfPluginUtil *m_util;
};
@@ -295,6 +301,7 @@
QString m_smfRegToken;
QList<QString> m_supportedInterfaces;
QStringList m_supportedLangs;
+ QDateTime m_validity;
};
#endif /*_FLICKRCONTACTFETCHERPLUGIN_H*/
--- a/example/flickrcontactfetcherplugin/flickrcontactfetcherplugin.pkg Thu Aug 05 16:35:33 2010 +0530
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,33 +0,0 @@
-; 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
--- a/example/flickrcontactfetcherplugin/flickrcontactfetcherplugin.pro Thu Aug 05 16:35:33 2010 +0530
+++ b/example/flickrcontactfetcherplugin/flickrcontactfetcherplugin.pro Thu Aug 05 16:46:37 2010 +0530
@@ -38,7 +38,7 @@
ReadDeviceData \
WriteDeviceData
- LIBS += -lsmfclient.dll
+ LIBS += -lsmfcommon
}
target.path += $$[QT_INSTALL_PLUGINS]/smf/plugin/contact.fetcher
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/example/flickrcontactfetcherplugin/flickrcontactfetcherplugin_installer.pkg Thu Aug 05 16:46:37 2010 +0530
@@ -0,0 +1,30 @@
+; flickrcontactfetcherplugin_installer.pkg generated by qmake at 2010-07-30T14:11:44
+; This file is generated by qmake and should not be modified by the user
+;
+
+; Language
+&EN
+
+; SIS header: name, uid, version
+#{"flickrcontactfetcherplugin installer"},(0xA000D7CE),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
+; Default dependency to QtMobility libraries
+
+
+"D:/smf/MissingCode/smfrepo/example/flickrcontactfetcherplugin/flickrcontactfetcherplugin.sis" - "c:\adm\flickrcontactfetcherplugin.sis"
+@"D:/Qt/4.6.2/smartinstaller.sis",(0x2002CCCD)
--- a/example/flickrcontactfetcherplugin/flickrcontactfetcherplugin_template.pkg Thu Aug 05 16:35:33 2010 +0530
+++ b/example/flickrcontactfetcherplugin/flickrcontactfetcherplugin_template.pkg Thu Aug 05 16:46:37 2010 +0530
@@ -1,13 +1,12 @@
-; flickrcontactfetcherplugin_template.pkg generated by qmake at 2010-06-22T14:10:41
+; flickrcontactfetcherplugin_template.pkg generated by qmake at 2010-07-30T14:11:44
; This file is generated by qmake and should not be modified by the user
;
; Language
&EN
-
; SIS header: name, uid, version
-#{"flickrcontactfetcherplugin"},(0xE1f540a6),1,0,0
+#{"flickrcontactfetcherplugin"},(0xE5d0d77b),1,0,0
; Localised Vendor name
%{"Vendor"}
@@ -17,19 +16,19 @@
; Manual PKG pre-rules from PRO files
-; Default dependency to Qt libraries
-(0x2001E61C), 4, 6, 3, {"Qt"}
; 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, 2, {"Qt"}
; Default dependency to QtMobility libraries
(0x2002AC89), 1, 0, 0, {"QtMobility"}
; DEPLOYMENT
-"/Nokia/devices/Nokia_Symbian3_SDK_v0.8/epoc32/release/$(PLATFORM)/$(TARGET)/flickrcontactfetcherplugin.dll" - "!:\sys\bin\flickrcontactfetcherplugin.dll"
-"/Nokia/devices/Nokia_Symbian3_SDK_v0.8/epoc32/data/z/resource/qt/plugins/smf/plugin/contact.fetcher/flickrcontactfetcherplugin.qtplugin" - "!:\resource\qt\plugins\smf\plugin\contact.fetcher\flickrcontactfetcherplugin.qtplugin"
+"d:/S60/devices/Nokia_Symbian3_SDK_v0.8/epoc32/release/$(PLATFORM)/$(TARGET)/flickrcontactfetcherplugin.dll" - "!:\sys\bin\flickrcontactfetcherplugin.dll"
+"d:/smf/MissingCode/smfrepo/example/flickrcontactfetcherplugin/qmakepluginstubs/flickrcontactfetcherplugin.qtplugin" - "!:\resource\qt\plugins\smf\plugin\contact.fetcher\flickrcontactfetcherplugin.qtplugin"
; Manual PKG post-rules from PRO files
--- a/example/flickrcontactfetcherplugin/plugin_commonU.def Thu Aug 05 16:35:33 2010 +0530
+++ b/example/flickrcontactfetcherplugin/plugin_commonU.def Thu Aug 05 16:46:37 2010 +0530
@@ -1,5 +1,5 @@
; ==============================================================================
-; Generated by qmake (2.01a) (Qt 4.6.3) on: 2010-06-22T14:10:41
+; Generated by qmake (2.01a) (Qt 4.6.2) on: 2010-07-30T14:11:44
; This file is generated by qmake and should not be modified by the
; user.
; Name : plugin_commonU.def
--- a/example/flickrcontactfetcherplugin/qmakepluginstubs/flickrcontactfetcherplugin.qtplugin Thu Aug 05 16:35:33 2010 +0530
+++ b/example/flickrcontactfetcherplugin/qmakepluginstubs/flickrcontactfetcherplugin.qtplugin Thu Aug 05 16:46:37 2010 +0530
@@ -1,1 +1,1 @@
-This file is a Qt plugin stub file. The real Qt plugin is located in /sys/bin. Created:2010-06-22T14:10:41
+This file is a Qt plugin stub file. The real Qt plugin is located in \sys\bin. Created:2010-07-30T14:11:44
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/example/flickrgalleryplugin/flickrgalleryplugin.cpp Thu Aug 05 16:46:37 2010 +0530
@@ -0,0 +1,1396 @@
+/**
+ * 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:
+ * Sangeetha Prasad, Nalina Hariharan
+ *
+ * Description:
+ * The Plugin that fetches gallery related items from the logged in user's flickr account
+ *
+ */
+
+// Include files
+#include <QtPlugin>
+#include <QCryptographicHash>
+#include <QDataStream>
+#include <QFile>
+#include <QDebug>
+#include <QMap>
+#include <QListIterator>
+#include <QXmlStreamReader>
+#include <QSettings>
+#include <smfpluginutil.h>
+
+#include "flickrgalleryplugin.h"
+
+static int count = 1;
+static int chance = 0; // 0 = for pics from album, 1 = pics not in any album
+static int listIndex = 0;// For Mutliple Load
+QByteArray payload;
+QByteArray boundary("---ThIsIsAsAmPleBouNDaRyStrInGFrOmNaliNa---");
+
+// Todo:- Macro added for limiting items fetched to recent 5
+// Remove after demo
+#define SETLIMITOFFIVEFORSMFDEMO 1
+
+/**
+ * Method to interpret the key sets obtained from credential manager
+ * @param aApiKey [out] The api key
+ * @param aApiSecret [out] The api secret
+ * @param aAuthToken [out] The auth token provided by Flickr
+ */
+void FlickrGalleryPlugin::fetchKeys( QString &aApiKey,
+ QString &aApiSecret,
+ QString &aAuthToken )
+ {
+ qDebug()<<"Inside FlickrGalleryPlugin::fetchKeys()";
+
+ qDebug()<<"Reg Token = "<<m_provider->m_smfRegToken;
+ qDebug()<<"Expiry Date as int = "<<m_provider->m_validity.toTime_t();
+
+ SmfAuthParams keys;
+ SmfPluginUtil util;
+ util.getAuthKeys(keys, m_provider->m_smfRegToken,
+ m_provider->m_validity, m_provider->m_pluginId);
+
+ qDebug()<<"Number of key-value pairs = "<<keys.count();
+
+ QByteArray keyName;
+ keyName.append("ApiKey");
+ aApiKey.append(keys.value(keyName));
+
+ keyName.clear();
+ keyName.append("ApiSecret");
+ aApiSecret.append(keys.value(keyName));
+
+ keyName.clear();
+ keyName.append("AuthToken");
+ aAuthToken.append(keys.value(keyName));
+
+ qDebug()<<"Api Key = "<<aApiKey;
+ qDebug()<<"Api Secret = "<<aApiSecret;
+ qDebug()<<"Auth Token = "<<aAuthToken;
+ }
+
+/**
+ * Destructor
+ */
+FlickrGalleryPlugin::~FlickrGalleryPlugin( )
+ {
+ if(m_provider)
+ delete m_provider;
+ }
+
+/**
+ * Method to get a list of albums
+ * @param aRequest [out] The request data to be sent to network
+ * @param aNames The subject or any keywords to be used to filter albums with that name
+ * @param aUser The user whose albums are requested
+ * @param aPageNum The page to be extracted
+ * @param aItemsPerPage Number of items per page
+ * @return SmfPluginError Plugin error if any, else SmfPluginErrNone
+ */
+SmfPluginError FlickrGalleryPlugin::albums( SmfPluginRequestData &aRequest,
+ const QStringList &aNames,
+ const SmfContact *aUser,
+ const int aPageNum,
+ const int aItemsPerPage )
+ {
+ qDebug()<<"Inside FlickrGalleryPlugin::albums()";
+ Q_UNUSED(aNames)
+ Q_UNUSED(aPageNum)
+ Q_UNUSED(aItemsPerPage)
+
+ SmfPluginError error = SmfPluginErrUserNotLoggedIn;
+
+ // Get the key sets from SMF Plugin Utility class.
+ QString apiKey;
+ QString apiSecret;
+ QString authToken;
+ fetchKeys(apiKey, apiSecret, authToken );
+
+ QString userId = aUser->value("Guid").value<QContactGuid>().guid();
+ qDebug()<<"Flickr user's ID for fetching photos = "<<userId;
+
+ // Create the API signature string
+ QString baseString;
+ baseString.append(apiSecret);
+ baseString.append("api_key"+apiKey);
+ baseString.append("auth_token"+authToken);
+ baseString.append("formatjson");
+ baseString.append("methodflickr.photosets.getList");
+#ifdef SETLIMITOFFIVEFORSMFDEMO
+ baseString.append("page"+QString::number(1));
+ baseString.append("per_page"+QString::number(5));
+#else
+ baseString.append("page"+QString::number(aPageNum));
+ baseString.append("per_page"+QString::number(aItemsPerPage));
+#endif
+ if(userId.length())
+ baseString.append("user_id"+userId);
+
+ // Create the url
+ QUrl url("http://api.flickr.com/services/rest/?");
+ url.addQueryItem("api_key", apiKey);
+ url.addQueryItem("auth_token", authToken);
+ url.addQueryItem("format","json");
+ if(userId.length())
+ url.addQueryItem("user_id", userId);
+ url.addQueryItem("method", "flickr.photosets.getList");
+#ifdef SETLIMITOFFIVEFORSMFDEMO
+ url.addQueryItem("page", QString::number(1));
+ url.addQueryItem("per_page", QString::number(5));
+#else
+ url.addQueryItem("page", QString::number(aPageNum));
+ url.addQueryItem("per_page", QString::number(aItemsPerPage));
+#endif
+ url.addQueryItem("api_sig", generateSignature(baseString));
+
+ // Create the request, set the url
+ aRequest.iNetworkRequest.setUrl(url);
+ aRequest.iRequestType = SmfPictureGetAlbums;
+ aRequest.iPostData = NULL;
+ aRequest.iHttpOperationType = QNetworkAccessManager::GetOperation;
+ error = SmfPluginErrNone;
+
+ qDebug()<<"Url string is : "<<aRequest.iNetworkRequest.url().toString();
+ return error;
+ }
+
+/**
+ * Method to get a list of pictures
+ * @param aRequest [out] The request data to be sent to network
+ * @param aAlbums The album(s) whose pictures are being requested
+ * @param aPageNum The page to be extracted
+ * @param aItemsPerPage Number of items per page
+ * @return SmfPluginError Plugin error if any, else SmfPluginErrNone
+ */
+SmfPluginError FlickrGalleryPlugin::pictures( SmfPluginRequestData &aRequest,
+ const SmfPictureAlbumList &aAlbums,
+ const int aPageNum,
+ const int aItemsPerPage )
+ {
+ qDebug()<<"Inside FlickrGalleryPlugin::pictures()";
+
+ SmfPluginError error = SmfPluginErrInvalidArguments;
+
+ if( (aPageNum < 0) || (aItemsPerPage < 0))
+ {
+ qDebug()<<"Invalid arguments";
+ return error;
+ }
+
+ // Get the key sets from SMF Plugin Utility class.
+ QString apiKey;
+ QString apiSecret;
+ QString authToken;
+ fetchKeys(apiKey, apiSecret, authToken );
+
+ QString albumId;
+ albumId.clear();
+ if(aAlbums.count())
+ {
+ chance = 0;
+ albumId = aAlbums.at(0).id();
+ qDebug()<<"Fetching photos from a photoset with its id = "<<albumId;
+ }
+ else
+ {
+ qDebug()<<"Fetching photos which are not in any sets";
+ chance = 1;
+ }
+
+ QString extras("date_upload,description,owner_name,tags,url_sq,url_t,url_s,url_m,url_o");
+
+ // Create the API signature string
+ QString baseString;
+ baseString.append(apiSecret);
+ baseString.append("api_key"+apiKey);
+ baseString.append("auth_token"+authToken);
+ baseString.append("extras"+extras);
+ baseString.append("formatjson");
+ if(aAlbums.count())
+ baseString.append("methodflickr.photosets.getPhotos");
+ else
+ baseString.append("methodflickr.photos.getNotInSet");
+#ifdef SETLIMITOFFIVEFORSMFDEMO
+ baseString.append("page"+QString::number(1));
+ baseString.append("per_page"+QString::number(5));
+#else
+ baseString.append("page"+QString::number(aPageNum));
+ baseString.append("per_page"+QString::number(aItemsPerPage));
+#endif
+ if(aAlbums.count())
+ baseString.append("photoset_id"+albumId);
+
+ // Create the url
+ QUrl url("http://api.flickr.com/services/rest/?");
+ url.addQueryItem("api_key", apiKey);
+ url.addQueryItem("auth_token", authToken);
+ url.addQueryItem("extras", extras);
+ url.addQueryItem("format","json");
+ if(aAlbums.count())
+ url.addQueryItem("method", "flickr.photosets.getPhotos");
+ else
+ url.addQueryItem("method", "flickr.photos.getNotInSet");
+#ifdef SETLIMITOFFIVEFORSMFDEMO
+ url.addQueryItem("page", QString::number(1));
+ url.addQueryItem("per_page", QString::number(5));
+#else
+ url.addQueryItem("page", QString::number(aPageNum));
+ url.addQueryItem("per_page", QString::number(aItemsPerPage));
+#endif
+ if(aAlbums.count())
+ url.addQueryItem("photoset_id", albumId);
+ url.addQueryItem("api_sig", generateSignature(baseString));
+
+ // Create the request, set the url
+ aRequest.iNetworkRequest.setUrl(url);
+ aRequest.iRequestType = SmfPictureGetPictures;
+ aRequest.iPostData = NULL;
+ aRequest.iHttpOperationType = QNetworkAccessManager::GetOperation;
+ error = SmfPluginErrNone;
+
+ qDebug()<<"Url string is : "<<aRequest.iNetworkRequest.url().toString();
+ 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 FlickrGalleryPlugin::description(SmfPluginRequestData &aRequest,
+ const SmfPicture &aImage)
+ {
+ qDebug()<<"Inside FlickrGalleryPlugin::description()";
+
+ SmfPluginError error = SmfPluginErrInvalidArguments;
+
+ if( 0 == aImage.id().size())
+ {
+ qDebug()<<"Invalid arguments";
+ return error;
+ }
+
+ // Get the key sets from SMF Plugin Utility class.
+ QString apiKey;
+ QString apiSecret;
+ QString authToken;
+ fetchKeys(apiKey, apiSecret, authToken );
+
+ // Create the API signature string
+ QString baseString;
+ baseString.append(apiSecret);
+ baseString.append("api_key"+apiKey);
+ baseString.append("auth_token"+authToken);
+ baseString.append("formatjson");
+ baseString.append("methodflickr.photos.getInfo");
+ baseString.append("photo_id"+aImage.id());
+
+ // Create the url
+ QUrl url("http://api.flickr.com/services/rest/?");
+ url.addQueryItem("api_key", apiKey);
+ url.addQueryItem("auth_token", authToken);
+ url.addQueryItem("format","json");
+ url.addQueryItem("method", "flickr.photos.getInfo");
+ url.addQueryItem("photo_id",aImage.id());
+ url.addQueryItem("api_sig", generateSignature(baseString));
+
+ // Create the request, set the url
+ aRequest.iNetworkRequest.setUrl(url);
+ aRequest.iRequestType = SmfPictureDescription;
+ aRequest.iPostData = NULL;
+ aRequest.iHttpOperationType = QNetworkAccessManager::GetOperation;
+ error = SmfPluginErrNone;
+
+ qDebug()<<"Url string is : "<<aRequest.iNetworkRequest.url().toString();
+ 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
+ * @param aAlbum the optional destination album name
+ * @return SmfPluginError Plugin error if any, else SmfPluginErrNone
+ */
+SmfPluginError FlickrGalleryPlugin::upload( SmfPluginRequestData &aRequest,
+ const SmfPicture &aImage,
+ const SmfPictureAlbum* aAlbum )
+ {
+ qDebug()<<"Inside FlickrGalleryPlugin::upload()";
+ Q_UNUSED(aAlbum)
+ SmfPluginError error = SmfPluginErrInvalidArguments;
+
+ if( 0 == aImage.picture().byteCount())
+ {
+ qDebug()<<"Invalid arguments";
+ return error;
+ }
+
+ // Get the key sets from SMF Plugin Utility class.
+ QString apiKey;
+ QString apiSecret;
+ QString authToken;
+ fetchKeys(apiKey, apiSecret, authToken );
+
+ // Create the Payload data
+ QDataStream stream(&payload, QIODevice::WriteOnly);
+ int bytes = 0;
+
+ // Create the api_key field
+ QByteArray keyField = constructField ( "api_key", apiKey, boundary );
+ bytes = stream.writeRawData(keyField.data(), keyField.length());
+ qDebug()<<"Bytes written for API key field = "<<QString::number(bytes, 10);
+
+ // Create the auth_token field
+ QByteArray tokenField = constructField ( "auth_token", authToken, boundary );
+ bytes = stream.writeRawData(tokenField.data(), tokenField.length());
+ qDebug()<<"Bytes written for Auth token field = "<<QString::number(bytes, 10);
+
+ // Create the API signature string
+ QString baseString;
+ baseString.append(apiSecret);
+ baseString.append("api_key"+apiKey);
+ baseString.append("auth_token"+authToken);
+ baseString = generateSignature(baseString);
+
+ // Create the signature field
+ QByteArray sigField = constructField ( "api_sig", baseString, boundary );
+ bytes = stream.writeRawData(sigField.data(), sigField.length());
+ qDebug()<<"Bytes written for API signature field = "<<QString::number(bytes, 10);
+
+ // Create the file header field
+ QByteArray fileField = constructField ( "photo", "", boundary, "c:\\data\\TestUploadPics\\BlueHills.jpg" );
+ bytes = stream.writeRawData(fileField.data(), fileField.length());
+ qDebug()<<"Bytes written for File header field = "<<QString::number(bytes, 10);
+
+ // GEt the image data into a Bytearray
+ QByteArray pic;
+ QBuffer buffer(&pic);
+ buffer.open(QIODevice::WriteOnly);
+ aImage.picture().save(&buffer, "JPG");
+
+ qDebug()<<"Number of bytes in the pic = "<<QString::number(pic.size(), 10);
+
+ // Add the file content to the stream
+ if(pic.size())
+ {
+ bytes = stream.writeRawData ( pic.data(), pic.length() );
+ qDebug()<<"Bytes written for File content field = "<<QString::number(bytes, 10);
+ }
+
+ // Create the end field
+ QByteArray endField;
+ endField.append ( "\r\n--" );
+ endField.append ( boundary );
+ endField.append ( "--\r\n\r\n" );
+ bytes = stream.writeRawData(endField.data(), endField.length());
+ qDebug()<<"Bytes written for end field = "<<QString::number(bytes, 10);
+
+ QUrl url("http://api.flickr.com/services/upload/");
+
+ // Create the request, set the url
+ aRequest.iNetworkRequest.setUrl(url);
+ aRequest.iNetworkRequest.setRawHeader("Content-Type", "multipart/form-data; boundary="+boundary);
+ aRequest.iRequestType = SmfPictureUpload;
+ aRequest.iPostData = new QBuffer(&payload);
+ aRequest.iHttpOperationType = QNetworkAccessManager::PostOperation;
+ error = SmfPluginErrNone;
+
+ qDebug()<<"Url string is : "<<aRequest.iNetworkRequest.url().toString();
+ return error;
+ }
+
+
+/**
+ * Method to construct individual fields for photo upload
+ * @param aName The name argument
+ * @param aContent The content of this field
+ * @param aBoundary The boundary string (need to be unique in the payload data)
+ * @param aFilename The filename if for photo field
+ * @return The field data constructed by this method
+ */
+QByteArray FlickrGalleryPlugin::constructField( const QString &aName,
+ const QString &aContent,
+ const QByteArray &aBoundary,
+ const QString & aFilename )
+ {
+ QByteArray data;
+ data.append ( "--" );
+ data.append ( aBoundary );
+ data.append ( "\r\n" );
+ data.append ( "Content-Disposition: form-data; name=\"" );
+ data.append ( aName.toAscii() );
+ if ( aFilename.isEmpty() )
+ {
+ data.append ( "\"\r\n\r\n" );
+ data.append ( aContent.toAscii() );
+ data.append ( "\r\n" );
+ }
+ else
+ {
+ data.append ( "\"; filename=\"" );
+ data.append ( aFilename.toAscii() );
+ data.append ( "\"\r\n" );
+ data.append ( "Content-Type: image/jpeg\r\n\r\n" );
+ }
+ return data;
+ }
+
+
+/**
+* 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 FlickrGalleryPlugin::upload( SmfPluginRequestData &aRequest,
+ const QList<SmfPicture> &aImages,
+ const SmfPictureAlbum* aAlbum )
+ {
+ SmfPluginError error = SmfPluginErrUserNotLoggedIn;
+ qDebug()<<("\r\n multiple Uploaded Pictures.....= "+QString::number(aImages.count(),10));
+ Q_UNUSED(aAlbum)
+ // Get the key sets from SMF Plugin Utility class.
+ QString apiKey;
+ QString apiSecret;
+ QString authToken;
+ fetchKeys(apiKey, apiSecret, authToken );
+
+ count =aImages.count();
+
+
+ QByteArray boundary("---ThIsIsAsAmPleBouNDaRyStrInGFrOmSaNgEeTa---");
+ QDataStream stream(&payload, QIODevice::WriteOnly);
+ int bytes = 0;
+
+ // Create the api_key field
+ QByteArray keyField = constructField("api_key",apiKey,boundary,"");//,apiKey,boundary);
+ bytes = stream.writeRawData(keyField.data(), keyField.length());
+ qDebug()<<("Bytes written for API key field = "+QString::number(bytes, 10));
+
+ // Create the auth_token field
+ QByteArray tokenField = constructField ( "auth_token", authToken, boundary,"");
+ bytes = stream.writeRawData(tokenField.data(), tokenField.length());
+ qDebug()<<("Bytes written for Auth token field = "+QString::number(bytes, 10));
+
+ //Create the API signature string
+ QString baseString;
+ baseString.append(apiSecret);
+ baseString.append("api_key"+apiKey);
+ baseString.append("auth_token"+authToken);
+ //baseString.append("formatjson"); //not working this format
+ baseString = generateSignature(baseString);
+
+ //extract the smfpicture object
+ SmfPicture aImage=aImages[listIndex];
+
+ //Create the signature field
+ QByteArray sigField = constructField ("api_sig", baseString, boundary,"" );
+ bytes = stream.writeRawData(sigField.data(), sigField.length());
+
+ qDebug()<<("QImage String = "+aImage.url().toString());
+
+ //Create the file header field
+ QByteArray fileField = constructField ( "photo", "", boundary, aImage.url().toString());
+ bytes = stream.writeRawData(fileField.data(), fileField.length());
+
+
+ //QByteArray pic ;
+ QImage image=aImage.picture();
+
+ //for checking only
+ int byte=image.numBytes();
+ qDebug()<<("Bytes written for QImage = "+QString::number(byte,10));
+
+ //For finding the format of Image file (eg. c:\\data\\image.jpg);
+ QString fileName=aImage.url().toString();
+ int last = fileName.lastIndexOf(".",-1);
+ qDebug()<<("last QImage = "+QString::number(last,10));
+ QString Format=fileName.right(fileName.size()-last-1); //-1 for removing "." from .jpg
+ qDebug()<<("Format of QImage = "+Format);
+
+
+ QByteArray pic;
+ QBuffer buffer(&pic);
+ buffer.open(QIODevice::WriteOnly);
+ image.save(&buffer,Format.toLatin1(),-1); // writes image into format given by Format
+
+ qDebug()<<("Number of bytes in the picture = "+QString::number(buffer.size(), 10));
+
+ // Add the file content to the stream
+ if (pic.size())
+ {
+ bytes = stream.writeRawData ( pic.data(), pic.length() );
+ qDebug()<<("Bytes written for File content field = "+QString::number(bytes, 10));
+ }
+ qDebug()<<("Before Url string is : "+QString(payload));
+
+ // Create the end field
+ QByteArray endField;
+ endField.append ( "\r\n--" );
+ endField.append ( boundary );
+ endField.append ( "--\r\n\r\n" );
+ bytes = stream.writeRawData(endField.data(), endField.length());
+ qDebug()<<("Bytes written for end field = "+QString::number(bytes, 10));
+
+ //Create the url
+ QUrl url("http://api.flickr.com/services/upload/");
+ //url.addQueryItem("format","json"); //Not working
+
+
+ //Create the request, set the url
+ aRequest.iNetworkRequest.setUrl(url);
+
+ aRequest.iNetworkRequest.setRawHeader("Content-Type", "multipart/form-data; boundary="+boundary);
+ aRequest.iNetworkRequest.setRawHeader("Host", "api.flickr.com");
+ aRequest.iRequestType = SmfPictureUpload;
+ aRequest.iPostData=new QBuffer(&payload);
+
+
+ aRequest.iHttpOperationType = QNetworkAccessManager::PostOperation;
+ error = SmfPluginErrNone;
+ 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 FlickrGalleryPlugin::postComment( SmfPluginRequestData &aRequest,
+ const SmfPicture &aImage,
+ const SmfComment &aComment )
+ {
+ qDebug()<<"Inside FlickrGalleryPlugin::postComment()";
+
+ SmfPluginError error = SmfPluginErrInvalidArguments;
+
+ if( 0 == aImage.id().size() || (0 == aComment.text().size()) )
+ {
+ qDebug()<<"Invalid arguments";
+ return error;
+ }
+
+ // Get the key sets from SMF Plugin Utility class.
+ QString apiKey;
+ QString apiSecret;
+ QString authToken;
+ fetchKeys(apiKey, apiSecret, authToken );
+
+ // Create the API signature string
+ QString baseString;
+ baseString.append(apiSecret);
+ baseString.append("api_key"+apiKey);
+ baseString.append("auth_token"+authToken);
+ baseString.append("comment_text"+aComment.text());
+ baseString.append("formatjson");
+ baseString.append("methodflickr.photos.comments.addComment");
+ baseString.append("photo_id"+aImage.id());
+
+ // Create the url
+ QUrl url("http://api.flickr.com/services/rest/?");
+ url.addQueryItem("api_key", apiKey);
+ url.addQueryItem("auth_token", authToken);
+ url.addQueryItem("comment_text", aComment.text());
+ url.addQueryItem("format","json");
+ url.addQueryItem("method", "flickr.photos.comments.addComment");
+ url.addQueryItem("photo_id",aImage.id());
+ url.addQueryItem("api_sig", generateSignature(baseString));
+
+ // Create the request, set the url
+ aRequest.iNetworkRequest.setUrl(url);
+ aRequest.iRequestType = SmfPicturePostComment;
+ aRequest.iPostData = NULL;
+ aRequest.iHttpOperationType = QNetworkAccessManager::GetOperation;
+ error = SmfPluginErrNone;
+
+ qDebug()<<"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 FlickrGalleryPlugin::generateSignature(const QString aBaseString)
+ {
+ qDebug()<<("FlickrGalleryPlugin::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;
+ }
+
+/**
+ * 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 FlickrGalleryPlugin::customRequest( SmfPluginRequestData &aRequest,
+ const int &aOperation, QByteArray *aData )
+ {
+ Q_UNUSED(aRequest)
+ Q_UNUSED(aOperation)
+ Q_UNUSED(aData)
+ return SmfPluginErrServiceNotSupported;
+ }
+
+/**
+ * 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.
+ */
+void FlickrGalleryPlugin::initialize( )
+ {
+ // Create an instance of FBContactProviderBase
+ m_provider = new FlickrProviderBase;
+ m_provider->initialize();
+ }
+
+/**
+ * Method to get the provider information
+ * @return Instance of SmfProviderBase
+ */
+SmfProviderBase* FlickrGalleryPlugin::getProviderInfo( )
+ {
+ return m_provider;
+ }
+
+/**
+ * Method to get the result for a network request.
+ * @param aOperation The type of operation to be requested
+ * @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 albums, aResult will be of
+ * type QList<SmfPictureAlbum>. If the 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 FlickrGalleryPlugin::responseAvailable(
+ const SmfRequestTypeID aOperation,
+ const SmfTransportResult &aTransportResult,
+ QByteArray *aResponse,
+ QVariant* aResult,
+ SmfPluginRetType &aRetType,
+ SmfResultPage &aPageResult )
+ {
+
+ qDebug()<<"Inside FlickrGalleryPlugin::responseAvailable()";
+ Q_UNUSED(aPageResult)
+ SmfPluginError error = SmfPluginErrNetworkError;
+
+ if( !aResponse || (0 == aResponse->size()) )
+ {
+ qDebug()<<"Response is NULL or empty";
+ aRetType = SmfRequestError;
+ return error;
+ }
+
+ QByteArray response(*aResponse);
+ delete aResponse;
+
+ QFile respFile("c://data//SmfPluginFlickrResponse.txt");
+ if(!respFile.open(QIODevice::WriteOnly))
+ {
+ qDebug()<<"File to write the response could not be opened, so writing to this file";
+ qDebug()<<"Flickr response = "<<QString(response);
+ }
+ else
+ {
+ respFile.write(response);
+ respFile.close();
+ qDebug()<<"Writing FB response to a file named 'SmfPluginFlickrResponse.txt'";
+ }
+
+ qDebug()<<"Response size = "<<response.size();
+
+
+ if(SmfTransportOpNoError == aTransportResult)
+ {
+ qDebug()<<"No transport error";
+
+ if(SmfPictureGetAlbums == aOperation)
+ {
+ qDebug()<<"Response for retrieving album lists";
+
+ QList<SmfPictureAlbum> albumList;
+ QString errStr;
+ errStr.clear();
+
+ // Remove the "jsonFlickrApi(" from starting of the response and ")" from its end
+ response.remove(0, 14);
+ response.chop(1);
+
+ bool ok;
+ SmfPluginUtil util;
+ QVariantMap result = util.parse(response, &ok).toMap();
+ if (!ok)
+ {
+ qDebug()<<"An error occurred during json parsing";
+ aRetType = SmfRequestError;
+ return SmfPluginErrParsingFailed;
+ }
+
+
+ if(response.contains(QByteArray("fail")))
+ {
+ errStr.append(result["message"].toString());
+ }
+ else
+ {
+ QVariantMap map1 = result["photosets"].toMap();
+
+ QList<QVariant> list1 = map1["photoset"].toList();
+ QListIterator<QVariant> iter(list1);
+ while(iter.hasNext())
+ {
+ SmfPictureAlbum album;
+
+ QVariantMap map2 = iter.next().toMap();
+
+ // Set the album's title
+ QVariantMap map3 = map2["title"].toMap();
+ album.setTitle(map3["_content"].toString());
+ qDebug()<<"title = "<<album.title();
+
+ // Set the album's description
+ QVariantMap map4 = map2["description"].toMap();
+ album.setDescription(map4["_content"].toString());
+ qDebug()<<"desc = "<<album.description();
+
+ // Set the album's picture count
+ album.setPictureCount(map2["photos"].toInt());
+ qDebug()<<"pic count = "<<album.pictureCount();
+
+ // Set the album's id
+ album.setId(map2["id"].toString());
+ qDebug()<<"id = "<<album.id();
+
+ albumList.append(album);
+#ifdef SETLIMITOFFIVEFORSMFDEMO
+ if(5 == albumList.count())
+ break;
+#endif
+ }
+ }
+
+ if(errStr.size())
+ {
+ qDebug()<<"Response error found = "<<errStr;
+ error = SmfPluginErrInvalidRequest;
+ aRetType = SmfRequestError;
+ aResult->setValue(errStr);
+ }
+ else
+ {
+ qDebug()<<"list count = "<<albumList.count();
+ aResult->setValue(albumList);
+ aRetType = SmfRequestComplete;
+ error = SmfPluginErrNone;
+ }
+ }
+ else if(SmfPictureGetPictures == aOperation)
+ {
+ qDebug()<<"Response for retrieving photos";
+
+ QList<SmfPicture> picList;
+ QString errStr;
+ errStr.clear();
+
+ // Remove the "jsonFlickrApi(" from starting of the response and ")" from its end
+ response.remove(0, 14);
+ response.chop(1);
+
+ bool ok;
+ SmfPluginUtil util;
+ QVariantMap result = util.parse(response, &ok).toMap();
+ if (!ok)
+ {
+ qDebug()<<"An error occurred during json parsing";
+ aRetType = SmfRequestError;
+ return SmfPluginErrParsingFailed;
+ }
+
+
+ if(response.contains(QByteArray("fail")))
+ {
+ errStr.append(result["message"].toString());
+ }
+ else
+ {
+ QVariantMap map1;
+ if(0 == chance)
+ map1 = result["photoset"].toMap();
+ else
+ map1 = result["photos"].toMap();
+
+ QList<QVariant> list1 = map1["photo"].toList();
+ QListIterator<QVariant> iter(list1);
+ while(iter.hasNext())
+ {
+ SmfPicture pic;
+
+ QVariantMap map2 = iter.next().toMap();
+
+ // Set the pic's id
+ pic.setId(map2["id"].toString());
+
+ // Set the pic's description
+ QVariantMap map3 = map2["description"].toMap();
+ pic.setDescription(map3["_content"].toString());
+
+ // Set the pic's title
+ pic.setTitle(map2["title"].toString());
+ qDebug()<<"title = "<<map2["title"].toString();
+
+ // Set the pic's owner
+ pic.setOwner(map2["ownername"].toString());
+
+ // Set the pic's posted date
+ QDateTime date = QDateTime::fromTime_t(map2["dateupload"].toUInt());
+ qDebug()<<"time = "<<date;
+ pic.setPostedDate(date);
+
+ // Set the pic's tags
+ QString tags(map2["tags"].toString());
+ QStringList tagList = tags.split(' ');
+ pic.addTags(tagList);
+
+ // Set the pic's url
+ // url_sq,url_t,url_s,url_m,url_o
+ if(map2["url_o"].toString().size())
+ pic.setUrl(map2["url_o"].toString());
+ else if(map2["url_m"].toString().size())
+ pic.setUrl(map2["url_m"].toString());
+ else if(map2["url_sq"].toString().size())
+ pic.setUrl(map2["url_sq"].toString());
+ else if(map2["url_s"].toString().size())
+ pic.setUrl(map2["url_s"].toString());
+ else if(map2["url_t"].toString().size())
+ pic.setUrl(map2["url_t"].toString());
+
+ qDebug()<<"url = "<<pic.url();
+ picList.append(pic);
+ }
+ }
+
+ if(errStr.size())
+ {
+ qDebug()<<"Response error found = "<<errStr;
+ error = SmfPluginErrInvalidRequest;
+ aRetType = SmfRequestError;
+ aResult->setValue(errStr);
+ }
+ else
+ {
+ qDebug()<<"list count = "<<picList.count();
+ aResult->setValue(picList);
+ aRetType = SmfRequestComplete;
+ error = SmfPluginErrNone;
+ }
+ }
+ else if(SmfPictureDescription == aOperation)
+ {
+ qDebug()<<"Response for photo decscription";
+
+ QString description;
+ QString errStr;
+ errStr.clear();
+
+ // Remove the "jsonFlickrApi(" from starting of the response and ")" from its end
+ response.remove(0, 14);
+ response.chop(1);
+
+ bool ok;
+ SmfPluginUtil util;
+ QVariantMap result = util.parse(response, &ok).toMap();
+ if (!ok)
+ {
+ qDebug()<<"An error occurred during json parsing";
+ aRetType = SmfRequestError;
+ return SmfPluginErrParsingFailed;
+ }
+
+ if(response.contains(QByteArray("fail")))
+ {
+ errStr.append(result["message"].toString());
+ }
+ else
+ {
+ QVariantMap map1 = result["photo"].toMap();
+ QVariantMap map2 = map1["description"].toMap();
+
+ description = map2["_content"].toString();
+ }
+
+ if(errStr.size())
+ {
+ qDebug()<<"Response error found = "<<errStr;
+ error = SmfPluginErrInvalidRequest;
+ aRetType = SmfRequestError;
+ aResult->setValue(errStr);
+ }
+ else
+ {
+ qDebug()<<"description = "<<description;
+ aResult->setValue(description);
+ aRetType = SmfRequestComplete;
+ error = SmfPluginErrNone;
+ }
+ }
+ else if (SmfPictureUpload == aOperation)
+ {
+#if 1
+ qDebug()<<"Response for single photo upload";
+
+ bool uploaded = false;
+ QString errStr;
+ errStr.clear();
+
+ if(response.contains(QByteArray("err code")))
+ {
+ QXmlStreamReader xml(response);
+ while (!xml.atEnd())
+ {
+ xml.readNext();
+ if (xml.tokenType() == QXmlStreamReader::StartElement)
+ if (xml.name() == "err")
+ errStr.append(xml.attributes().value("msg"));
+ }
+ }
+ else
+ uploaded = true;
+
+ if(errStr.size())
+ {
+ qDebug()<<"Response error found = "<<errStr;
+ error = SmfPluginErrInvalidRequest;
+ aRetType = SmfRequestError;
+ aResult->setValue(errStr);
+ }
+ else
+ {
+ qDebug()<<"photo uploaded ? "<<uploaded;
+ aResult->setValue(uploaded);
+ aRetType = SmfRequestComplete;
+ error = SmfPluginErrNone;
+ }
+#endif
+ }
+ else if (SmfPicturePostComment == aOperation)
+ {
+ qDebug()<<"Response for adding comment on a photo";
+
+ bool commentPosted = false;
+ QString errStr;
+ errStr.clear();
+
+ // Remove the "jsonFlickrApi(" from starting of the response and ")" from its end
+ response.remove(0, 14);
+ response.chop(1);
+
+ bool ok;
+ SmfPluginUtil util;
+ QVariantMap result = util.parse(response, &ok).toMap();
+ if (!ok)
+ {
+ qDebug()<<"An error occurred during json parsing";
+ aRetType = SmfRequestError;
+ return SmfPluginErrParsingFailed;
+ }
+
+ if(response.contains(QByteArray("fail")))
+ {
+ errStr.append(result["message"].toString());
+ }
+ else
+ {
+ qDebug()<<"Comment posted on the photo";
+ commentPosted = true;
+ }
+
+ if(errStr.size())
+ {
+ qDebug()<<"Response error found = "<<errStr;
+ error = SmfPluginErrInvalidRequest;
+ aRetType = SmfRequestError;
+ aResult->setValue(errStr);
+ }
+ else
+ {
+ qDebug()<<"comment posted ? "<<commentPosted;
+ aResult->setValue(commentPosted);
+ aRetType = SmfRequestComplete;
+ error = SmfPluginErrNone;
+ }
+ }
+ else
+ {
+ qDebug()<<"Service unsupported, currently only SmfContactRetrievePosts and SmfContactPostDirected!!!";
+ aRetType = SmfRequestError;
+ error = SmfPluginErrServiceNotSupported;
+ }
+ }
+
+ else if(SmfTransportOpOperationCanceledError == aTransportResult)
+ {
+ qDebug()<<"Operation Cancelled !!!";
+ error = SmfPluginErrCancelComplete;
+ aRetType = SmfRequestComplete;
+ }
+
+ else
+ {
+ qDebug()<<"Transport Error !!!";
+ error = SmfPluginErrNetworkError;
+ aRetType = SmfRequestError;
+ }
+
+ return error;
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+#if 0
+ qDebug()<<("FlickrGalleryPlugin::responseAvailable");
+ Q_UNUSED(aPageResult)
+ SmfPluginError error = SmfPluginErrNetworkError;
+
+ if( !aResponse || (0 == aResponse->size()) )
+ {
+ qDebug()<<("Response is NULL or empty");
+ aRetType = SmfRequestError;
+ return error;
+ }
+
+ QByteArray response(*aResponse);
+ delete aResponse;
+
+ //Write the response to a file
+ QFile file("c:\\data\\flickrresponse.txt");
+ qDebug()<<("response data written to c:\\data\\flickrresponse.txt");
+
+ if (!file.open(QIODevice::Append | QIODevice::Text));
+ file.write(response);
+ file.close();
+
+ qDebug()<<("Gallery response size = "+QString::number(response.size(), 10));
+
+ QList<SmfPicture> list;
+
+ if(SmfTransportOpNoError == aTransportResult)
+ {
+ qDebug()<<("No transport error");
+ QVariantMap map1;
+ bool resType=response.startsWith("<?xml");
+ if(resType) //XML REsponse
+ {
+ qDebug()<<("Before XML Parser--");
+
+ }
+ else //JSON RESPONSE
+ {
+ response.remove(0, 14);
+ response.chop(1);
+ bool ok;
+ qDebug()<<("Before JSON Parser--");
+
+ SmfPluginUtil util;
+ QVariant result= util.parse(response, &ok);
+ if (!ok)
+ {
+ qDebug()<<("An error occurred during json parsing");
+ aRetType = SmfRequestError;
+ return SmfPluginErrParsingFailed;
+ }
+
+ QVariantMap map1 = result.toMap();
+ }
+ if( SmfPictureGetAlbums == aOperation )
+ {}
+
+ }
+ else if(SmfPictureGetPictures == aOperation)
+ {}//end of if(SmfPictureGetPictures == aOperation)
+ else if(SmfPicturePostComment == aOperation)
+ {}
+ else if(SmfPictureDescription == aOperation)
+ {}
+ else if(SmfPictureUpload == aOperation)
+ {
+ bool result;
+ qDebug()<<("SmfPictureUpload");
+ QXmlStreamReader xml(response);
+ while (!xml.atEnd())
+ {
+ xml.readNext();
+ if (xml.tokenType() == QXmlStreamReader::StartElement)
+ {
+
+ qDebug()<<("inside tag");
+ //If the tag is contact
+ if (xml.name() == "photoid")
+ {
+ qDebug()<<("photoid tag found");
+ result=TRUE;
+ }
+ else
+ result=FALSE;
+ }
+ }
+
+ aResult->setValue(result);
+ aRetType = SmfRequestComplete;
+ error = SmfPluginErrNone;
+
+ }
+ else if (SmfPictureMultiUpload == aOperation)
+ {
+ bool result;
+ qDebug()<<("SmfPictureUpload");
+ QXmlStreamReader xml(response);
+ while (!xml.atEnd())
+ {
+ xml.readNext();
+ if (xml.tokenType() == QXmlStreamReader::StartElement)
+ {
+ qDebug()<<("inside tag");
+ //If the tag is contact
+ if (xml.name() == "photoid")
+ {
+ qDebug()<<("photoid tag found");
+ result=TRUE;
+ }
+ else
+ result=FALSE;
+ }//end If
+ }//endWhile;
+
+ aResult->setValue(result);
+ if (listIndex < count)
+ {
+
+ listIndex=listIndex+1;
+ error = SmfPluginErrNone;
+ aRetType = SmfSendRequestAgain;
+
+
+ }
+ else
+ {
+ //Final result sent
+ count=1; //clear counter
+ aRetType = SmfRequestComplete;
+ error = SmfPluginErrNone;
+ }
+
+ }
+ else
+ {
+ qDebug()<<("Service unsupported!!!");
+ aRetType = SmfRequestError;
+ error = SmfPluginErrServiceNotSupported;
+ }
+ }//end if of if(SmfTransportOpNoError == aTransportResult)
+
+ else if(SmfTransportOpOperationCanceledError == aTransportResult)
+ {
+ qDebug()<<("Operation Cancelled !!!");
+ error = SmfPluginErrCancelComplete;
+ aRetType = SmfRequestComplete;
+ }
+
+ else
+ {
+ qDebug()<<("Transport Error !!!");
+ error = SmfPluginErrNetworkError;
+ aRetType = SmfRequestError;
+ }
+ return error;
+#endif
+
+ }
+
+
+/**
+ * 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 list of interfaces that this provider support
+* @return List of supported Interafces
+*/
+QList<QString> FlickrProviderBase::supportedInterfaces( ) const
+ {
+ return m_supportedInterfaces;
+ }
+
+/**
+* Method to get the list of languages supported by this service provider
+* @return a QStringList of languages supported by this service
+* provider in 2 letter ISO 639-1 format.
+*/
+QStringList FlickrProviderBase::supportedLanguages( ) const
+ {
+ return m_supportedLangs;
+ }
+
+/**
+ * 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 gallery plugin description";
+ m_serviceUrl = QUrl(QString("http://api.flickr.com"));
+ m_pluginId = "flickrgalleryplugin.qtplugin";
+ m_authAppId = "0xE1D8C7D7";
+ m_supportedInterfaces.append("org.symbian.smf.plugin.gallery/v0.2");
+ QSettings iSettings;
+ m_smfRegToken = iSettings.value("CMFlickrRegToken").toString();
+ m_validity = iSettings.value("FlckrExpiryTime").toDateTime();
+ }
+
+
+/*
+ * Export Macro
+ * plugin name : flickrGalleryplugin
+ * plugin class : FlickrGalleryPlugin
+ */
+Q_EXPORT_PLUGIN2( flickrgalleryplugin, FlickrGalleryPlugin )
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/example/flickrgalleryplugin/flickrgalleryplugin.h Thu Aug 05 16:46:37 2010 +0530
@@ -0,0 +1,313 @@
+/**
+ * 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:
+ * Sangeetha Prasad, Nalina Hariharan
+ *
+ * Description:
+ * The Plugin that fetches gallery related items from the logged in user's flickr account
+ *
+ */
+
+#ifndef FLICKRGALLERYPLUGIN_H_
+#define FLICKRGALLERYPLUGIN_H_
+
+// Include files
+#include <QDateTime>
+#include <smfgalleryplugin.h>
+#include <smfcontact.h>
+
+// Forward declarations
+class FlickrProviderBase;
+class QVariant;
+
+
+/**
+ * The Plugin that fetches gallery related items from the logged
+ * in user's flickr account
+ */
+class FlickrGalleryPlugin : public QObject, public SmfGalleryPlugin
+{
+ Q_OBJECT
+ Q_INTERFACES( SmfGalleryPlugin SmfPluginBase )
+
+public:
+ /**
+ * Destructor
+ */
+ virtual ~FlickrGalleryPlugin();
+
+public: // From FlickrGalleryPlugin
+
+ /**
+ * Method to get a list of albums
+ * @param aRequest [out] The request data to be sent to network
+ * @param aNames The subject or any keywords to be used to filter albums with that name
+ * @param aUser The user whose albums are requested
+ * @param aPageNum The page to be extracted
+ * @param aItemsPerPage Number of items per page
+ * @return SmfPluginError Plugin error if any, else SmfPluginErrNone
+ */
+ SmfPluginError albums( SmfPluginRequestData &aRequest,
+ const QStringList &aNames,
+ const SmfContact *aUser,
+ const int aPageNum = SMF_FIRST_PAGE,
+ const int aItemsPerPage = SMF_ITEMS_PER_PAGE );
+
+ /**
+ * Method to get a list of pictures
+ * @param aRequest [out] The request data to be sent to network
+ * @param aAlbums The album(s) whose pictures are being requested
+ * @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 SmfPictureAlbumList &aAlbums,
+ 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
+ * @param aAlbum the optional destination album name
+ * @return SmfPluginError Plugin error if any, else SmfPluginErrNone
+ */
+ SmfPluginError upload( SmfPluginRequestData &aRequest,
+ const SmfPicture &aImage,
+ const SmfPictureAlbum* aAlbum = NULL );
+
+
+ /**
+ * 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
+ * @param aAlbum the optional destination album name
+ * @return SmfPluginError Plugin error if any, else SmfPluginErrNone
+ */
+ SmfPluginError upload( SmfPluginRequestData &aRequest,
+ const QList<SmfPicture> &aImages,
+ const SmfPictureAlbum* aAlbum = NULL );
+
+ /**
+ * 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 );
+
+
+ /**
+ * Customised method for SMFGalleryPlugin 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.
+ */
+ void initialize( );
+
+ /**
+ * Method to get the provider information
+ * @return Instance of SmfProviderBase
+ */
+ SmfProviderBase* getProviderInfo( );
+
+ /**
+ * Method to get the result for a network request.
+ * @param aOperation The type of operation to be requested
+ * @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 albums, aResult will be of
+ * type QList<SmfPictureAlbum>. If the 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 SmfRequestTypeID aOperation,
+ const SmfTransportResult &aTransportResult,
+ QByteArray *aResponse,
+ QVariant* aResult,
+ SmfPluginRetType &aRetType,
+ SmfResultPage &aPageResult );
+
+ /**
+ * Method to construct individual fields for photo upload
+ * @param aName The name argument
+ * @param aContent The content of this field
+ * @param aBoundary The boundary string (need to be unique in the payload data)
+ * @param aFilename The filename if for photo field
+ * @return The field data constructed by this method
+ */
+ QByteArray constructField( const QString &aName,
+ const QString &aContent,
+ const QByteArray &aBoundary,
+ const QString &aFilename = QString() );
+
+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 to interpret the key sets obtained from credential manager
+ * @param aApiKey [out] The api key
+ * @param aApiSecret [out] The api secret
+ * @param aAuthToken [out] The auth token provided by Flickr
+ */
+ void fetchKeys( QString &aApiKey,
+ QString &aApiSecret,
+ QString &aAuthToken );
+
+private:
+ FlickrProviderBase *m_provider;
+
+ };
+
+/**
+ * The Plugin class that implements SmfProviderBase for this flickr plugin
+ */
+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 list of interfaces that this provider support
+ * @return List of supported Interafces
+ */
+ QList<QString> supportedInterfaces( ) const;
+
+ /**
+ * Method to get the list of languages supported by this service provider
+ * @return a QStringList of languages supported by this service
+ * provider in 2 letter ISO 639-1 format.
+ */
+ QStringList supportedLanguages( ) 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 FlickrGalleryPlugin;
+ 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;
+ QList<QString> m_supportedInterfaces;
+ QStringList m_supportedLangs;
+ QDateTime m_validity;
+ };
+
+
+#endif /* FLICKRGALLERYPLUGIN_H_ */
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/example/flickrgalleryplugin/flickrgalleryplugin.pro Thu Aug 05 16:46:37 2010 +0530
@@ -0,0 +1,44 @@
+TEMPLATE = lib
+
+CONFIG += plugin \
+ mobility
+
+MOBILITY += contacts\
+ location
+
+QT += core \
+ xml \
+ network
+
+HEADERS = flickrgalleryplugin.h
+
+SOURCES = flickrgalleryplugin.cpp
+
+TARGET = $$qtLibraryTarget(flickrgalleryplugin)
+
+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 = flickrgalleryplugin.dll
+ pluginDep.path = $$QT_PLUGINS_BASE_DIR/smf/plugin/gallery
+ DEPLOYMENT += pluginDep
+
+ TARGET.CAPABILITY = NetworkServices \
+ ReadUserData \
+ WriteUserData \
+ LocalServices \
+ UserEnvironment \
+ ReadDeviceData \
+ WriteDeviceData
+
+ LIBS += -lsmfcommon
+}
+
+target.path += $$[QT_INSTALL_PLUGINS]/smf/plugin/gallery
+
+INSTALLS += target
\ No newline at end of file
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/example/flickrgalleryplugin/flickrgalleryplugin_installer.pkg Thu Aug 05 16:46:37 2010 +0530
@@ -0,0 +1,30 @@
+; flickrgalleryplugin_installer.pkg generated by qmake at 2010-07-30T14:11:44
+; This file is generated by qmake and should not be modified by the user
+;
+
+; Language
+&EN
+
+; SIS header: name, uid, version
+#{"flickrgalleryplugin installer"},(0xA000D7CE),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
+; Default dependency to QtMobility libraries
+
+
+"D:/smf/MissingCode/smfrepo/example/flickrgalleryplugin/flickrgalleryplugin.sis" - "c:\adm\flickrgalleryplugin.sis"
+@"D:/Qt/4.6.2/smartinstaller.sis",(0x2002CCCD)
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/example/flickrgalleryplugin/flickrgalleryplugin_template.pkg Thu Aug 05 16:46:37 2010 +0530
@@ -0,0 +1,34 @@
+; flickrgalleryplugin_template.pkg generated by qmake at 2010-07-30T14:11:44
+; This file is generated by qmake and should not be modified by the user
+;
+
+; Language
+&EN
+
+; SIS header: name, uid, version
+#{"flickrgalleryplugin"},(0xE758f47c),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, 2, {"Qt"}
+; Default dependency to QtMobility libraries
+(0x2002AC89), 1, 0, 0, {"QtMobility"}
+
+; DEPLOYMENT
+"d:/S60/devices/Nokia_Symbian3_SDK_v0.8/epoc32/release/$(PLATFORM)/$(TARGET)/flickrgalleryplugin.dll" - "!:\sys\bin\flickrgalleryplugin.dll"
+"d:/smf/MissingCode/smfrepo/example/flickrgalleryplugin/qmakepluginstubs/flickrgalleryplugin.qtplugin" - "!:\resource\qt\plugins\smf\plugin\gallery\flickrgalleryplugin.qtplugin"
+
+; Manual PKG post-rules from PRO files
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/example/flickrgalleryplugin/plugin_commonU.def Thu Aug 05 16:46:37 2010 +0530
@@ -0,0 +1,16 @@
+; ==============================================================================
+; Generated by qmake (2.01a) (Qt 4.6.2) on: 2010-07-30T14:11:44
+; This file is generated by qmake and should not be modified by the
+; user.
+; Name : plugin_commonU.def
+; Part of : flickrgalleryplugin
+; 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/flickrgalleryplugin/qmakepluginstubs/flickrgalleryplugin.qtplugin Thu Aug 05 16:46:37 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-07-30T14:11:44
--- a/example/smfclientapp/ABLD.BAT Thu Aug 05 16:35:33 2010 +0530
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,15 +0,0 @@
-@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
--- a/example/smfclientapp/Makefile Thu Aug 05 16:35:33 2010 +0530
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,275 +0,0 @@
-# ==============================================================================
-# Generated by qmake (2.01a) (Qt 4.6.3) on: Tue Jun 22 14:45:30 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 = f:\Qt\4.6.3\bin\qmake
-DEL_FILE = del
-DEL_DIR = rmdir
-MOVE = move
-CHK_DIR_EXISTS = if not exist
-MKDIR = mkdir
-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"F:/Qt/4.6.3/include/QtCore" -I"F:/Qt/4.6.3/include/QtCore/tmp" -I"F:/Qt/4.6.3/include/QtNetwork" -I"F:/Qt/4.6.3/include/QtNetwork/tmp" -I"F:/Qt/4.6.3/include/QtGui" -I"F:/Qt/4.6.3/include/QtGui/tmp" -I"F:/Qt/4.6.3/include/QtWebKit" -I"F:/Qt/4.6.3/include/QtWebKit/tmp" -I"F:/Qt/4.6.3/include" -I"F:/Qt/4.6.3/include/tmp" -I"F:/Qt/4.6.3/include/QtContacts" -I"F:/Qt/4.6.3/include/QtContacts/tmp" -I"F:/Qt/4.6.3/include/QtLocation" -I"F:/Qt/4.6.3/include/QtLocation/tmp" -I"F:/Qt/4.6.3/mkspecs/common/symbian" -I"F:/Qt/4.6.3/mkspecs/common/symbian/tmp" -I"F:/Nokia/devices/Nokia_Symbian3_SDK_v0.8/epoc32/include" -I"F:/Nokia/devices/Nokia_Symbian3_SDK_v0.8/epoc32/include/stdapis" -I"F:/Nokia/devices/Nokia_Symbian3_SDK_v0.8/epoc32/include/stdapis/sys" -I"F:/Nokia/devices/Nokia_Symbian3_SDK_v0.8/epoc32/include/mw" -I"F:/Nokia/devices/Nokia_Symbian3_SDK_v0.8/epoc32/include/platform/mw" -I"F:/Nokia/devices/Nokia_Symbian3_SDK_v0.8/epoc32/include/platform" -I"F:/Nokia/devices/Nokia_Symbian3_SDK_v0.8/epoc32/include/app" -I"F:/Nokia/devices/Nokia_Symbian3_SDK_v0.8/epoc32/include/platform/app" -I"F:/Nokia/devices/Nokia_Symbian3_SDK_v0.8/epoc32/include/platform/loc" -I"F:/Nokia/devices/Nokia_Symbian3_SDK_v0.8/epoc32/include/platform/mw/loc" -I"F:/Nokia/devices/Nokia_Symbian3_SDK_v0.8/epoc32/include/platform/app/loc" -I"F:/Nokia/devices/Nokia_Symbian3_SDK_v0.8/epoc32/include/platform/loc/sc" -I"F:/Nokia/devices/Nokia_Symbian3_SDK_v0.8/epoc32/include/platform/mw/loc/sc" -I"F:/Nokia/devices/Nokia_Symbian3_SDK_v0.8/epoc32/include/platform/app/loc/sc" -I"F:/Nokia/devices/Nokia_Symbian3_SDK_v0.8/epoc32/include/stdapis/stlportv5" -I"F:/Qt/4.6.3/include/QtXmlPatterns" -I"F:/Qt/4.6.3/include/QtXmlPatterns/tmp" -I"F:/Nokia/devices/Nokia_Symbian3_SDK_v0.8/SMFCode/smf_baseline_22june_latest/example/smfclientapp" -I"F:/Nokia/devices/Nokia_Symbian3_SDK_v0.8/SMFCode/smf_baseline_22june_latest/example/smfclientapp/tmp"
-first: default
-default: debug-winscw
-all: debug release
-
-qmake:
- $(QMAKE) -spec symbian-abld -o "bld.inf" "F:/Nokia/devices/Nokia_Symbian3_SDK_v0.8/SMFCode/smf_baseline_22june_latest/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
-
-check: first
-
-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_posttestui.cpp moc_displaywidget.cpp moc_testscreen.cpp moc_smfclientapp.cpp
-compiler_moc_header_clean:
- -$(DEL_FILE) moc_posttestui.cpp moc_displaywidget.cpp moc_testscreen.cpp moc_smfclientapp.cpp 2> NUL
-moc_posttestui.cpp: ui_posttestui.h \
- posttestui.h
- F:\Qt\4.6.3\bin\moc.exe $(DEFINES) $(INCPATH) -DSYMBIAN posttestui.h -o moc_posttestui.cpp
-
-moc_displaywidget.cpp: ui_displaywidget.h \
- displaywidget.h
- F:\Qt\4.6.3\bin\moc.exe $(DEFINES) $(INCPATH) -DSYMBIAN displaywidget.h -o moc_displaywidget.cpp
-
-moc_testscreen.cpp: ui_SmfClientApp.h \
- testscreen.h
- F:\Qt\4.6.3\bin\moc.exe $(DEFINES) $(INCPATH) -DSYMBIAN testscreen.h -o moc_testscreen.cpp
-
-moc_smfclientapp.cpp: ui_SmfClientApp.h \
- smfclientapp.h
- F:\Qt\4.6.3\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_posttestui.h ui_displaywidget.h ui_smfclientapp.h
-compiler_uic_clean:
- -$(DEL_FILE) ui_posttestui.h ui_displaywidget.h ui_smfclientapp.h 2> NUL
-ui_posttestui.h: posttestui.ui
- f:\Qt\4.6.3\bin\uic.exe posttestui.ui -o ui_posttestui.h
-
-ui_displaywidget.h: displaywidget.ui
- f:\Qt\4.6.3\bin\uic.exe displaywidget.ui -o ui_displaywidget.h
-
-ui_smfclientapp.h: smfclientapp.ui
- f:\Qt\4.6.3\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 "F:\Qt\4.6.3\include\QtCore\tmp" mkdir "F:\Qt\4.6.3\include\QtCore\tmp"
- -@ if NOT EXIST "F:\Qt\4.6.3\include\QtNetwork\tmp" mkdir "F:\Qt\4.6.3\include\QtNetwork\tmp"
- -@ if NOT EXIST "F:\Qt\4.6.3\include\QtGui\tmp" mkdir "F:\Qt\4.6.3\include\QtGui\tmp"
- -@ if NOT EXIST "F:\Qt\4.6.3\include\QtWebKit\tmp" mkdir "F:\Qt\4.6.3\include\QtWebKit\tmp"
- -@ if NOT EXIST "F:\Qt\4.6.3\include\tmp" mkdir "F:\Qt\4.6.3\include\tmp"
- -@ if NOT EXIST "F:\Qt\4.6.3\include\QtContacts\tmp" mkdir "F:\Qt\4.6.3\include\QtContacts\tmp"
- -@ if NOT EXIST "F:\Qt\4.6.3\include\QtLocation\tmp" mkdir "F:\Qt\4.6.3\include\QtLocation\tmp"
- -@ if NOT EXIST "F:\Qt\4.6.3\mkspecs\common\symbian\tmp" mkdir "F:\Qt\4.6.3\mkspecs\common\symbian\tmp"
- -@ if NOT EXIST "F:\Qt\4.6.3\include\QtXmlPatterns\tmp" mkdir "F:\Qt\4.6.3\include\QtXmlPatterns\tmp"
- -@ if NOT EXIST "F:\Nokia\devices\Nokia_Symbian3_SDK_v0.8\SMFCode\smf_baseline_22june_latest\example\smfclientapp\tmp" mkdir "F:\Nokia\devices\Nokia_Symbian3_SDK_v0.8\SMFCode\smf_baseline_22june_latest\example\smfclientapp\tmp"
-
-extension_clean: compiler_clean
- -@ if EXIST "F:\Qt\4.6.3\include\QtCore\tmp" rmdir /S /Q "F:\Qt\4.6.3\include\QtCore\tmp"
- -@ if EXIST "F:\Qt\4.6.3\include\QtNetwork\tmp" rmdir /S /Q "F:\Qt\4.6.3\include\QtNetwork\tmp"
- -@ if EXIST "F:\Qt\4.6.3\include\QtGui\tmp" rmdir /S /Q "F:\Qt\4.6.3\include\QtGui\tmp"
- -@ if EXIST "F:\Qt\4.6.3\include\QtWebKit\tmp" rmdir /S /Q "F:\Qt\4.6.3\include\QtWebKit\tmp"
- -@ if EXIST "F:\Qt\4.6.3\include\tmp" rmdir /S /Q "F:\Qt\4.6.3\include\tmp"
- -@ if EXIST "F:\Qt\4.6.3\include\QtContacts\tmp" rmdir /S /Q "F:\Qt\4.6.3\include\QtContacts\tmp"
- -@ if EXIST "F:\Qt\4.6.3\include\QtLocation\tmp" rmdir /S /Q "F:\Qt\4.6.3\include\QtLocation\tmp"
- -@ if EXIST "F:\Qt\4.6.3\mkspecs\common\symbian\tmp" rmdir /S /Q "F:\Qt\4.6.3\mkspecs\common\symbian\tmp"
- -@ if EXIST "F:\Qt\4.6.3\include\QtXmlPatterns\tmp" rmdir /S /Q "F:\Qt\4.6.3\include\QtXmlPatterns\tmp"
- -@ if EXIST "F:\Nokia\devices\Nokia_Symbian3_SDK_v0.8\SMFCode\smf_baseline_22june_latest\example\smfclientapp\tmp" rmdir /S /Q "F:\Nokia\devices\Nokia_Symbian3_SDK_v0.8\SMFCode\smf_baseline_22june_latest\example\smfclientapp\tmp"
-
-pre_targetdeps: \
- generated_sources \
- all_source_deps \
- ui_posttestui.h \
- ui_displaywidget.h \
- ui_smfclientapp.h
-
-generated_sources: \
- moc_posttestui.cpp \
- moc_displaywidget.cpp \
- moc_testscreen.cpp \
- moc_smfclientapp.cpp
-
-all_source_deps: \
- posttestui.h \
- ui_posttestui.h \
- displaywidget.h \
- ui_displaywidget.h \
- testscreen.h \
- ui_SmfClientApp.h \
- SmfClientApp.h
-
-finalize:
-
-winscw_deployment:
-
-winscw_deployment_clean:
-
-deployment:
-
-deployment_clean:
-
--include .make.cache
-
-sis:
- $(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)
-
-smfclientapp.sis:
- $(MAKE) -s -f $(MAKEFILE) sis
-
-stub_sis:
- $(if $(wildcard smfclientapp_template.pkg),$(if $(wildcard .make.cache),$(MAKE) -s -f $(MAKEFILE) ok_stub_sis,$(if $(QT_SIS_TARGET),$(MAKE) -s -f $(MAKEFILE) ok_stub_sis,$(MAKE) -s -f $(MAKEFILE) fail_sis_nocache)),$(MAKE) -s -f $(MAKEFILE) fail_sis_nopkg)
-
-ok_stub_sis:
- createpackage.bat -s $(QT_SIS_OPTIONS) smfclientapp_template.pkg $(QT_SIS_TARGET) $(QT_SIS_CERTIFICATE) $(QT_SIS_KEY) $(QT_SIS_PASSPHRASE)
-
-installer_sis: smfclientapp.sis
- $(if $(wildcard smfclientapp_installer.pkg),$(MAKE) -s -f $(MAKEFILE) ok_installer_sis,$(MAKE) -s -f $(MAKEFILE) fail_sis_nopkg)
-
-ok_installer_sis:
- createpackage.bat $(QT_SIS_OPTIONS) smfclientapp_installer.pkg - $(QT_SIS_CERTIFICATE) $(QT_SIS_KEY) $(QT_SIS_PASSPHRASE)
-
-fail_sis_nopkg:
- $(error PKG file does not exist, 'sis' and 'installer_sis' target are 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)
-
-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 "f:\Nokia\devices\Nokia_Symbian3_SDK_v0.8\SMFCode\smf_baseline_22june_latest\example\smfclientapp\smfclientapp_template.pkg" $(DEL_FILE) "f:\Nokia\devices\Nokia_Symbian3_SDK_v0.8\SMFCode\smf_baseline_22june_latest\example\smfclientapp\smfclientapp_template.pkg"
- -@ if EXIST "f:\Nokia\devices\Nokia_Symbian3_SDK_v0.8\SMFCode\smf_baseline_22june_latest\example\smfclientapp\smfclientapp_installer.pkg" $(DEL_FILE) "f:\Nokia\devices\Nokia_Symbian3_SDK_v0.8\SMFCode\smf_baseline_22june_latest\example\smfclientapp\smfclientapp_installer.pkg"
- -@ if EXIST "f:\Nokia\devices\Nokia_Symbian3_SDK_v0.8\SMFCode\smf_baseline_22june_latest\example\smfclientapp\Makefile" $(DEL_FILE) "f:\Nokia\devices\Nokia_Symbian3_SDK_v0.8\SMFCode\smf_baseline_22june_latest\example\smfclientapp\Makefile"
- -@ if EXIST "f:\Nokia\devices\Nokia_Symbian3_SDK_v0.8\SMFCode\smf_baseline_22june_latest\example\smfclientapp\Makefile_0xE08059D6.mk" $(DEL_FILE) "f:\Nokia\devices\Nokia_Symbian3_SDK_v0.8\SMFCode\smf_baseline_22june_latest\example\smfclientapp\Makefile_0xE08059D6.mk"
- -@ if EXIST "f:\Nokia\devices\Nokia_Symbian3_SDK_v0.8\SMFCode\smf_baseline_22june_latest\example\smfclientapp\smfclientapp_0xE08059D6.mmp" $(DEL_FILE) "f:\Nokia\devices\Nokia_Symbian3_SDK_v0.8\SMFCode\smf_baseline_22june_latest\example\smfclientapp\smfclientapp_0xE08059D6.mmp"
- -@ if EXIST "f:\Nokia\devices\Nokia_Symbian3_SDK_v0.8\SMFCode\smf_baseline_22june_latest\example\smfclientapp\smfclientapp_reg.rss" $(DEL_FILE) "f:\Nokia\devices\Nokia_Symbian3_SDK_v0.8\SMFCode\smf_baseline_22june_latest\example\smfclientapp\smfclientapp_reg.rss"
- -@ if EXIST "f:\Nokia\devices\Nokia_Symbian3_SDK_v0.8\SMFCode\smf_baseline_22june_latest\example\smfclientapp\smfclientapp.rss" $(DEL_FILE) "f:\Nokia\devices\Nokia_Symbian3_SDK_v0.8\SMFCode\smf_baseline_22june_latest\example\smfclientapp\smfclientapp.rss"
- -@ if EXIST "f:\Nokia\devices\Nokia_Symbian3_SDK_v0.8\SMFCode\smf_baseline_22june_latest\example\smfclientapp\smfclientapp.loc" $(DEL_FILE) "f:\Nokia\devices\Nokia_Symbian3_SDK_v0.8\SMFCode\smf_baseline_22june_latest\example\smfclientapp\smfclientapp.loc"
- -@ if EXIST "f:\Nokia\devices\Nokia_Symbian3_SDK_v0.8\SMFCode\smf_baseline_22june_latest\example\smfclientapp\.make.cache" $(DEL_FILE) "f:\Nokia\devices\Nokia_Symbian3_SDK_v0.8\SMFCode\smf_baseline_22june_latest\example\smfclientapp\.make.cache"
- -@ if EXIST "f:\Nokia\devices\Nokia_Symbian3_SDK_v0.8\SMFCode\smf_baseline_22june_latest\example\smfclientapp\bld.inf" $(DEL_FILE) "f:\Nokia\devices\Nokia_Symbian3_SDK_v0.8\SMFCode\smf_baseline_22june_latest\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 /Nokia/devices/Nokia_Symbian3_SDK_v0.8/epoc32/release/winscw/udeb/smfclientapp.exe $(QT_RUN_OPTIONS)
-runonphone: sis
- runonphone $(QT_RUN_ON_PHONE_OPTIONS) --sis smfclientapp.sis smfclientapp.exe $(QT_RUN_OPTIONS)
-
--- a/example/smfclientapp/bld.inf Thu Aug 05 16:35:33 2010 +0530
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,24 +0,0 @@
-// ============================================================================
-// * 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
-
--- a/example/smfclientapp/displaywidget.cpp Thu Aug 05 16:35:33 2010 +0530
+++ b/example/smfclientapp/displaywidget.cpp Thu Aug 05 16:46:37 2010 +0530
@@ -147,6 +147,7 @@
}
void DisplayWidget::showPosts(SmfPostList* postlist, SmfError error, SmfResultPage resultPage)
{
+ Q_UNUSED(resultPage)
writeLog("TestScreen::showPosts");
ui.listWidget->clear();
ui.listWidget->setVerticalScrollBar(ui.verticalScrollBar_list);
--- a/example/smfclientapp/smfclientapp.loc Thu Aug 05 16:35:33 2010 +0530
+++ b/example/smfclientapp/smfclientapp.loc Thu Aug 05 16:46:37 2010 +0530
@@ -1,5 +1,5 @@
// ============================================================================
-// * Generated by qmake (2.01a) (Qt 4.6.3) on: 2010-06-22T14:45:30
+// * Generated by qmake (2.01a) (Qt 4.6.2) on: 2010-07-30T14:11:44
// * This file is generated by qmake and should not be modified by the
// * user.
// ============================================================================
--- a/example/smfclientapp/smfclientapp.pkg Thu Aug 05 16:35:33 2010 +0530
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,36 +0,0 @@
-; 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
--- a/example/smfclientapp/smfclientapp.pro Thu Aug 05 16:35:33 2010 +0530
+++ b/example/smfclientapp/smfclientapp.pro Thu Aug 05 16:46:37 2010 +0530
@@ -1,7 +1,6 @@
TEMPLATE = app
TARGET = smfclientapp
-DEFINES += WRITE_LOG #\
- #OLDER_QT_MOBILITY
+DEFINES += WRITE_LOG
QT += core \
gui \
network \
@@ -24,7 +23,7 @@
smfclientapp.ui
RESOURCES +=
symbian:TARGET.UID3 = 0xE08059D6
-symbian:LIBS += -lsmfclient.dll
+symbian:LIBS += -lsmfclient -lsmfcommon
symbian:TARGET.CAPABILITY = ReadUserData \
WriteUserData \
LocalServices \
--- a/example/smfclientapp/smfclientapp.rss Thu Aug 05 16:35:33 2010 +0530
+++ b/example/smfclientapp/smfclientapp.rss Thu Aug 05 16:46:37 2010 +0530
@@ -1,5 +1,5 @@
// ============================================================================
-// * Generated by qmake (2.01a) (Qt 4.6.3) on: 2010-06-22T14:45:30
+// * Generated by qmake (2.01a) (Qt 4.6.2) on: 2010-07-30T14:11:44
// * This file is generated by qmake and should not be modified by the
// * user.
// ============================================================================
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/example/smfclientapp/smfclientapp_installer.pkg Thu Aug 05 16:46:37 2010 +0530
@@ -0,0 +1,31 @@
+; smfclientapp_installer.pkg generated by qmake at 2010-07-30T14:11:44
+; This file is generated by qmake and should not be modified by the user
+;
+
+; Language
+&EN
+
+; SIS header: name, uid, version
+#{"smfclientapp installer"},(0xA000D7CE),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
+; Dependency to Qt Webkit
+; Default dependency to QtMobility libraries
+
+
+"D:/smf/MissingCode/smfrepo/example/smfclientapp/smfclientapp.sis" - "c:\adm\smfclientapp.sis"
+@"D:/Qt/4.6.2/smartinstaller.sis",(0x2002CCCD)
--- a/example/smfclientapp/smfclientapp_reg.rss Thu Aug 05 16:35:33 2010 +0530
+++ b/example/smfclientapp/smfclientapp_reg.rss Thu Aug 05 16:46:37 2010 +0530
@@ -1,5 +1,5 @@
// ============================================================================
-// * Generated by qmake (2.01a) (Qt 4.6.3) on: 2010-06-22T14:45:30
+// * Generated by qmake (2.01a) (Qt 4.6.2) on: 2010-07-30T14:11:44
// * This file is generated by qmake and should not be modified by the
// * user.
// ============================================================================
--- a/example/smfclientapp/smfclientapp_template.pkg Thu Aug 05 16:35:33 2010 +0530
+++ b/example/smfclientapp/smfclientapp_template.pkg Thu Aug 05 16:46:37 2010 +0530
@@ -1,11 +1,10 @@
-; smfclientapp_template.pkg generated by qmake at 2010-06-22T14:45:30
+; smfclientapp_template.pkg generated by qmake at 2010-07-30T14:11:44
; This file is generated by qmake and should not be modified by the user
;
; Language
&EN
-
; SIS header: name, uid, version
#{"smfclientapp"},(0xE08059D6),1,0,0
@@ -17,22 +16,22 @@
; Manual PKG pre-rules from PRO files
-; Dependency to Qt Webkit
-(0x200267C2), 4, 6, 3, {"QtWebKit"}
-; Default dependency to Qt libraries
-(0x2001E61C), 4, 6, 3, {"Qt"}
; 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, 2, {"Qt"}
+; Dependency to Qt Webkit
+(0x200267C2), 4, 6, 2, {"QtWebKit"}
; Default dependency to QtMobility libraries
(0x2002AC89), 1, 0, 0, {"QtMobility"}
; Executable and default resource files
-"/Nokia/devices/Nokia_Symbian3_SDK_v0.8/epoc32/release/$(PLATFORM)/$(TARGET)/smfclientapp.exe" - "!:\sys\bin\smfclientapp.exe"
-"/Nokia/devices/Nokia_Symbian3_SDK_v0.8/epoc32/data/z/resource/apps/smfclientapp.rsc" - "!:\resource\apps\smfclientapp.rsc"
-"/Nokia/devices/Nokia_Symbian3_SDK_v0.8/epoc32/data/z/private/10003a3f/import/apps/smfclientapp_reg.rsc" - "!:\private\10003a3f\import\apps\smfclientapp_reg.rsc"
+"/S60/devices/Nokia_Symbian3_SDK_v0.8/epoc32/release/$(PLATFORM)/$(TARGET)/smfclientapp.exe" - "!:\sys\bin\smfclientapp.exe"
+"/S60/devices/Nokia_Symbian3_SDK_v0.8/epoc32/data/z/resource/apps/smfclientapp.rsc" - "!:\resource\apps\smfclientapp.rsc"
+"/S60/devices/Nokia_Symbian3_SDK_v0.8/epoc32/data/z/private/10003a3f/import/apps/smfclientapp_reg.rsc" - "!:\private\10003a3f\import\apps\smfclientapp_reg.rsc"
; Manual PKG post-rules from PRO files
--- a/example/smfclientapp/testscreen.cpp Thu Aug 05 16:35:33 2010 +0530
+++ b/example/smfclientapp/testscreen.cpp Thu Aug 05 16:46:37 2010 +0530
@@ -163,6 +163,7 @@
}
void TestScreen::showPosts(SmfPostList* postlist, SmfError error, SmfResultPage resultPage)
{
+ Q_UNUSED(resultPage)
writeLog("TestScreen::showPosts");
ui.listWidget->clear();
writeLog("TestScreen::showPosts count=");
--- a/example/smfclientapp/ui_displaywidget.h Thu Aug 05 16:35:33 2010 +0530
+++ b/example/smfclientapp/ui_displaywidget.h Thu Aug 05 16:46:37 2010 +0530
@@ -1,8 +1,8 @@
/********************************************************************************
** Form generated from reading UI file 'displaywidget.ui'
**
-** Created: Tue Jun 22 13:45:34 2010
-** by: Qt User Interface Compiler version 4.6.3
+** Created: Fri Jul 30 14:06:51 2010
+** by: Qt User Interface Compiler version 4.6.2
**
** WARNING! All changes made in this file will be lost when recompiling UI file!
********************************************************************************/
--- a/example/smfclientapp/ui_posttestui.h Thu Aug 05 16:35:33 2010 +0530
+++ b/example/smfclientapp/ui_posttestui.h Thu Aug 05 16:46:37 2010 +0530
@@ -1,8 +1,8 @@
/********************************************************************************
** Form generated from reading UI file 'posttestui.ui'
**
-** Created: Tue Jun 22 13:45:31 2010
-** by: Qt User Interface Compiler version 4.6.3
+** Created: Fri Jul 30 14:06:50 2010
+** by: Qt User Interface Compiler version 4.6.2
**
** WARNING! All changes made in this file will be lost when recompiling UI file!
********************************************************************************/
--- a/example/smfclientapp/ui_smfclientapp.h Thu Aug 05 16:35:33 2010 +0530
+++ b/example/smfclientapp/ui_smfclientapp.h Thu Aug 05 16:46:37 2010 +0530
@@ -1,8 +1,8 @@
/********************************************************************************
** Form generated from reading UI file 'smfclientapp.ui'
**
-** Created: Tue Jun 22 13:45:36 2010
-** by: Qt User Interface Compiler version 4.6.3
+** Created: Fri Jul 30 14:06:53 2010
+** by: Qt User Interface Compiler version 4.6.2
**
** WARNING! All changes made in this file will be lost when recompiling UI file!
********************************************************************************/