smf/smfservermodule/smfclient/smfpostprovider.cpp
author cgandhi
Thu, 23 Sep 2010 17:43:31 +0530
changeset 25 a180113055cb
parent 18 013a02bf2bb0
permissions -rw-r--r--
Music Events are now normal Fetcher APIs added All APIs now return SmfError Canceling Request now supported Music Search now based on category Providerinfo added in DSM Added secondary ID, count, location to SMFAlbum Tags for Artist added Get tracks for album and artist added Added URL to subtitle DSM Bug fixes Detailed debugging logs filtered in server, pluginmgr, transportmgr playlistsOf() method changed in smfclient and plugin interfaces. RVCT B686 compilation issues resolved.

/**
 * Copyright (c) 2010 Sasken Communication Technologies Ltd.
 * All rights reserved.
 * This component and the accompanying materials are made available
 * under the terms of the "Eclipse Public License v1.0" 
 * which accompanies  this distribution, and is available
 * at the URL "http://www.eclipse.org/legal/epl-v10.html"
 *
 * Initial Contributors:
 * Chandradeep Gandhi, Sasken Communication Technologies Ltd - Initial contribution
 *
 * Contributors:
 * Manasij Roy, Nalina Hariharan
 * 
 * Description:
 * SmfPostProvider
 *
 */

#include <QVector>
#include <QTextFormat>

#include "smfpostprovider.h"
#include "smfpostprovider_p.h"

/**
 * Constructs SmfPostProvider.
 * @param baseProvider The base provider info
 * Seeing as this is a plug-in implementation, these will realistically
 * be generated by SMF factory of some kind
 */
SmfPostProvider::SmfPostProvider(SmfProvider* baseProvider)
	{
	  m_baseProvider = baseProvider;
	  //creating private impl wrapper
	  m_private = new SmfPostProviderPrivate(this);
	}

SmfPostProvider::~SmfPostProvider()
	{
	
	}

/**
 * returns maximum no of chars (unicode) that service provider can post without truncation
 * negative value means no limit
 */
qint32 SmfPostProvider::maxCharsInPost() const
	{ 
	return m_private->maxCharsInPost();
	}

/**
 * returns maximum no of items that can be returned in a single query to getPosts
 * negative value means feature not supported.
 */
qint32 SmfPostProvider::maxItems() const
	{ 
	return m_private->maxItems();
	}

/**
 * returns all the formatting of posts that this service provider supports.
 * May return 0 items to mean only QString is supported.
 */
QVector<QTextFormat> SmfPostProvider::supportedFormats () const
	{
	return m_private->supportedFormats();
	}

/**
 * returns whether this SP supports Appearence @see SmfAppearenceInfo
 */
bool SmfPostProvider::supportsAppearence () const
	{ 
	return m_private->supportsAppearence();
	}

/**
 * Gets the posts asynchronously. The signal postsAvailable()with SmfPostList is emitted
 * once the post lists are available
 * @param user user's contact in this SP, omit for self contact
 * @param pageNum Page number to download, SMF_FIRST_PAGE denotes fresh query.
 * @param perPage Item per page, default is SMF_ITEMS_PER_PAGE
 * @return SmfError. SmfNoError if success, else appropriate error code 
 * @see postsAvailable()
 */
SmfError SmfPostProvider::posts(SmfContact* user ,int pageNum,int perPage)
	{ 
	return m_private->posts(user,pageNum,perPage);
	}

/**
 * Updates a post to own area, the success of the post can be checked with signal
 * updatePostFinished() signal
 * @param postData data to be posted
 * @param location location data
 * @return SmfError. SmfNoError if success, else appropriate error code
 */
SmfError SmfPostProvider::post(SmfPost& postData,SmfLocation& location) 
	{
	return m_private->post(postData,location);
	} 

/**
 * Updates the last post to own area with new data, the success of the post can be checked with signal
 * updatePostFinished() signal
 * @param postData edited/new data to be posted
 * @param location location data
 * @return SmfError. SmfNoError if success, else appropriate error code
 */
SmfError SmfPostProvider::updatePost(SmfPost& postData)
	{ 
	return m_private->updatePost(postData);
	} 

/**
 * Updates a post to a particular Smf contact. the success of the post can be checked with signal
 * updatePostFinished() signal.
 * @param postData data to be posted
 * @param contact contact to which the post is to be directed
 * @param location location data
 * @return SmfError. SmfNoError if success, else appropriate error code
 */
SmfError SmfPostProvider::postDirected(SmfPost& postData,SmfContact& contact,SmfLocation* location)
	{ 
	return m_private->postDirected(postData,contact,location);
	}

/**
 * Method to post a comment on a post.
 * @param aTarget Post on which comment has to be posted
 * @param aComment comment to be posted
 * @param aLocation location data
 * @return SmfError. SmfNoError if success, else appropriate error code
 */
SmfError SmfPostProvider::commentOnAPost( SmfPost &aTarget, SmfPost &aComment, 
		SmfLocation *aLocation)
	{
	return m_private->commentOnAPost(aTarget,aComment,aLocation);
	}

/**
 * Posts appearance info of the user.e.g. appear offline, busy, do-not-disturb
 * @param appearence user appearance
 * @see SmfPresenceInfo
 * @return SmfError. SmfNoError if success, else appropriate error code
 */
SmfError SmfPostProvider::postAppearence(SmfAppearenceInfo appearence, const QString &status)
	{ 
	return m_private->postAppearence(appearence, status);
	} 

/**
 * Share /a contact's post to user's friends and followers (e.g. retweet in twitter, share on facebook)
 * emits updatePostFinished() signal when done.
 * @param postData data to be posted
 * @param contact contact to which the post belonged
 * @param bool whether user changed items within the post
 * @return SmfError. SmfNoError if success, else appropriate error code
 */
SmfError SmfPostProvider::sharePost(SmfPost& postData,SmfContact& contact,bool edited)
	{
	return m_private->sharePost(postData,contact,edited);
	}

SmfError SmfPostProvider::customRequest(const int& operationId,QByteArray* customData)
	{
	return m_private->customRequest(operationId, customData);
	}

/**
 * Gets the base provider info
 */
SmfProvider* SmfPostProvider::getProvider() const
	{
	return m_baseProvider;
	}

SmfError SmfPostProvider::cancelRequest()
	{
	return m_private->cancelRequest();	
	}