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