smf/smfservermodule/smfclient/client/smfpostprovider.cpp
changeset 7 be09cf1f39dd
equal deleted inserted replaced
6:c39a6cfd1fb9 7:be09cf1f39dd
       
     1 /**
       
     2  * Copyright (c) 2010 Sasken Communication Technologies Ltd.
       
     3  * All rights reserved.
       
     4  * This component and the accompanying materials are made available
       
     5  * under the terms of the "Eclipse Public License v1.0" 
       
     6  * which accompanies  this distribution, and is available
       
     7  * at the URL "http://www.eclipse.org/legal/epl-v10.html"
       
     8  *
       
     9  * Initial Contributors:
       
    10  * Chandradeep Gandhi, Sasken Communication Technologies Ltd - Initial contribution
       
    11  *
       
    12  * Contributors:
       
    13  * Manasij Roy, Nalina Hariharan
       
    14  * 
       
    15  * Description:
       
    16  * The SmfEvent class represents an event
       
    17  *
       
    18  */
       
    19 
       
    20 #include "smfpostprovider.h"
       
    21 #include <QVector>
       
    22 #include <QTextFormat>
       
    23 
       
    24 	/**
       
    25 	 * Constructs SmfPostProvider.
       
    26 	 * @param baseProvider The base provider info
       
    27 	 * Seeing as this is a plug-in implementation, these will realistically
       
    28 	 * be generated by SMF factory of some kind
       
    29 	 */
       
    30 	SmfPostProvider::SmfPostProvider(SmfProvider* baseProvider)
       
    31 		{
       
    32 		  m_baseProvider = baseProvider;
       
    33 		  //creating private impl wrapper
       
    34 		  m_private = new SmfPostProviderPrivate(this);
       
    35 		}
       
    36 	SmfPostProvider::~SmfPostProvider()
       
    37 		{
       
    38 		
       
    39 		}
       
    40 	/**
       
    41 	 * returns maximum no of chars (unicode) that service provider can post without truncation
       
    42 	 * negative value means no limit
       
    43 	 */
       
    44 	qint32 SmfPostProvider::maxCharsInPost() const
       
    45 	{ 
       
    46 	
       
    47 	}
       
    48 	/**
       
    49 	 * returns maximum no of items that can be returned in a single query to getPosts
       
    50 	 * negative value means feature not supported.
       
    51 	 */
       
    52 	qint32 SmfPostProvider::maxItems() const
       
    53 			{ 
       
    54 		
       
    55 			}
       
    56 
       
    57 	/**
       
    58 	 * returns all the formatting of posts that this service provider supports.
       
    59 	 * May return 0 items to mean only QString is supported.
       
    60 	 */
       
    61 	QVector<QTextFormat> SmfPostProvider::supportedFormats () const
       
    62 			{
       
    63 		
       
    64 			}
       
    65 	
       
    66 	/**
       
    67 	 * returns whether this SP supports Appearence @see SmfAppearenceInfo
       
    68 	 */
       
    69 	bool SmfPostProvider::supportsAppearence () const
       
    70 			{ 
       
    71 		
       
    72 			}
       
    73 
       
    74 	/**
       
    75 	 * Gets the posts asynchronously. The signal postsAvailable()with SmfPostList is emitted
       
    76 	 * once the post lists are available
       
    77 	 * @param user user's contact in this SP, omit for self contact
       
    78 	 * @param pageNum Page number to download, SMF_FIRST_PAGE denotes fresh query.
       
    79      * @param perPage Item per page, default is SMF_ITEMS_PER_PAGE 
       
    80 	 * @see postsAvailable()
       
    81 	 */
       
    82 	void SmfPostProvider::posts(SmfContact* user ,int pageNum,int perPage)
       
    83 		{ 
       
    84 		m_private->posts(user,pageNum,perPage);
       
    85 		}
       
    86 	
       
    87 	/**
       
    88 	 * Updates a post to own area, the success of the post can be checked with signal
       
    89 	 * updatePostFinished() signal
       
    90 	 * @param postData data to be posted
       
    91 	 * @param location location data
       
    92 	 */
       
    93 	void SmfPostProvider::post(SmfPost& postData,SmfLocation& location) 
       
    94 		{
       
    95 		m_private->post(postData,location);
       
    96 		} 
       
    97 	/**
       
    98 	 * Updates the last post to own area with new data, the success of the post can be checked with signal
       
    99 	 * updatePostFinished() signal
       
   100 	 * @param postData edited/new data to be posted
       
   101 	 * @param location location data
       
   102 	 */
       
   103 	void SmfPostProvider::updatePost(SmfPost& postData)
       
   104 		{ 
       
   105 		m_private->updatePost(postData);
       
   106 		} 
       
   107 	
       
   108 	/**
       
   109 	 * Updates a post to a particular Smf contact. the success of the post can be checked with signal
       
   110 	 * updatePostFinished() signal.
       
   111 	 * @param postData data to be posted
       
   112 	 * @param contact contact to which the post is to be directed
       
   113 	 * @param location location data
       
   114 	 */
       
   115 	void SmfPostProvider::postDirected(SmfPost& postData,SmfContact& contact,SmfLocation* location)
       
   116 		{ 
       
   117 		m_private->postDirected(postData,contact,location);
       
   118 		}
       
   119 	
       
   120 	/**
       
   121 	 * Posts appearance info of the user.e.g. appear offline, busy, do-not-disturb
       
   122 	 * @param appearence user appearance
       
   123 	 * @see SmfPresenceInfo
       
   124 	 * @return False on Failure/Not supported 
       
   125 	 */
       
   126 	bool SmfPostProvider::postAppearence(SmfAppearenceInfo appearence)
       
   127 		{ 
       
   128 		m_private->postAppearence(appearence);
       
   129 		} 
       
   130 	/**
       
   131 	 * Share /a contact's post to user's friends and followers (e.g. retweet in twitter, share on facebook)
       
   132 	 * emits updatePostFinished() signal when done.
       
   133 	 * @param postData data to be posted
       
   134 	 * @param contact contact to which the post belonged
       
   135 	 * @param bool whether user changed items within the post
       
   136 	 */
       
   137 	void SmfPostProvider::sharePost(SmfPost& postData,SmfContact& contact,bool edited)
       
   138 		{
       
   139 		m_private->sharePost(postData,contact,edited);
       
   140 		}
       
   141 	
       
   142 	//APIs to get/set base provider info (SmfProvider)
       
   143 	
       
   144 	/**
       
   145 	 * Gets the base provider info
       
   146 	 */
       
   147 	SmfProvider* SmfPostProvider::getProvider() const
       
   148 			{
       
   149 			return m_baseProvider;
       
   150 			}
       
   151