smf/smfservermodule/smfcommon/smfcontact.cpp
changeset 18 013a02bf2bb0
child 25 a180113055cb
equal deleted inserted replaced
17:106a4bfcb866 18:013a02bf2bb0
       
     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 contact class represents a social contact
       
    17  * Note: This class has dependencies on QtMobility project
       
    18  *
       
    19  */
       
    20 
       
    21 #include <QFile>
       
    22 #include <QTextStream>
       
    23 
       
    24 #include "smfcontact.h"
       
    25 
       
    26 /**
       
    27  * Constructor with default argument
       
    28  * @param aParent The parent object
       
    29  */
       
    30 SmfContact::SmfContact( QObject *aParent)
       
    31 	{
       
    32 	Q_UNUSED(aParent);
       
    33 	d = new SmfContactPrivate;
       
    34 	}
       
    35 
       
    36 /**
       
    37  * Copy Constructor
       
    38  * @param aOther The reference object
       
    39  */
       
    40 SmfContact::SmfContact( const SmfContact &aOther ): d (aOther.d)
       
    41 	{
       
    42 	}
       
    43 
       
    44 /**
       
    45  * Overloaded = operator
       
    46  * @param aOther The reference object
       
    47  * @return The target reference value
       
    48  */
       
    49 SmfContact& SmfContact::operator=( const SmfContact &aOther )
       
    50 	{
       
    51 	d->m_details = aOther.d->m_details;
       
    52 	return *this;
       
    53 	}
       
    54 
       
    55 /**
       
    56  * Destructor
       
    57  */
       
    58 SmfContact::~SmfContact( )
       
    59 	{
       
    60 	}
       
    61 
       
    62 /**
       
    63  * Method to get the available sub fields for contacts.
       
    64  * The following are the available sub types of a contact
       
    65  *   QtMobility::QContactAddress		Address;
       
    66  *   QtMobility::QContactAnniversary	Anniversary;
       
    67  *   QtMobility::QContactAvatar			Avatar;
       
    68  *   QtMobility::QContactBirthday		Birthday;
       
    69  *   QtMobility::QContactId				ContactId;
       
    70  *   QtMobility::QContactEmailAddress	EmailAddress;
       
    71  *   QtMobility::QContactGender			Gender;
       
    72  *   QtMobility::QContactGeoLocation	Geolocation;
       
    73  *   QtMobility::QContactGuid			Guid;
       
    74  *   QtMobility::QContactName			Name;
       
    75  *   QtMobility::QContactNickname		Nickname;
       
    76  *   QtMobility::QContactNote			Note;
       
    77  *   QtMobility::QContactOnlineAccount	OnlineAccount;
       
    78  *   QtMobility::QContactOrganization	Organization;
       
    79  *   QtMobility::QContactPhoneNumber	PhoneNumber;
       
    80  *   QtMobility::QContactPresence		Presence;
       
    81  *   QtMobility::QContactThumbnail		Thumbnail;
       
    82  *   QtMobility::QContactTimestamp		Timestamp;
       
    83  *   QtMobility::QContactType			Type;
       
    84  *   QtMobility::QContactUrl			Url;
       
    85  * @return The Available sub fields for this contact
       
    86  */
       
    87 QStringList SmfContact::subTypes( ) const
       
    88 	{
       
    89 	QStringList list = d->m_details.uniqueKeys();
       
    90 	return list;
       
    91 	}
       
    92 
       
    93 /**
       
    94  * Method to convert an SmfContact to a QContact
       
    95  * Changes made to the returned QContact will not be reflected 
       
    96  * in its parent SmfContact object
       
    97  * @param aContact QContact corresponding to SmfContact 
       
    98  */
       
    99 void SmfContact::convert( QContact &aContact ) const
       
   100 	{
       
   101 // TODO:-
       
   102 	Q_UNUSED(aContact);
       
   103 	}
       
   104 
       
   105 /**
       
   106  * Method to get the value of a sub field for this contact
       
   107  * @param aSubType The sub field type 
       
   108  * @return The value of the sub field subType
       
   109  * @see subTypes()
       
   110  */
       
   111 QVariant SmfContact::value( const QString& aSubType ) const
       
   112 	{
       
   113 	if(d->m_details.contains(aSubType))
       
   114 		return d->m_details.value(aSubType);
       
   115 	else
       
   116 		return QString();
       
   117 	}
       
   118 
       
   119 /**
       
   120  * Method to set value for a subtype
       
   121  * @param aSubType The subtype string
       
   122  * @param value Thhe value to be set for the subtype
       
   123  */
       
   124 void SmfContact::setValue(const QString& aSubType,QVariant& value)
       
   125 	{
       
   126 	d->m_details.insert(aSubType,value);
       
   127 	}
       
   128 
       
   129 /**
       
   130  * Method for Externalization. Writes the SmfContact object to 
       
   131  * the stream and returns a reference to the stream.
       
   132  * @param aDataStream Stream to be written
       
   133  * @param aContact The SmfContact object to be externalized
       
   134  * @return reference to the written stream
       
   135  */
       
   136 QDataStream &operator<<( QDataStream &aDataStream, 
       
   137 		const SmfContact& aContact )
       
   138 	{
       
   139 	QContactAddress address = aContact.value("Address").value<QContactAddress>();
       
   140 	aDataStream<<address;
       
   141 	
       
   142 	QContactAnniversary anniver = aContact.value("Anniversary").value<QContactAnniversary>();
       
   143 	aDataStream<<anniver;
       
   144 	
       
   145 	QContactAvatar avatar = aContact.value("Avatar").value<QContactAvatar>();
       
   146 	aDataStream<<avatar;
       
   147 	
       
   148 	QContactBirthday bday = aContact.value("Birthday").value<QContactBirthday>();
       
   149 	aDataStream<<bday;
       
   150 	
       
   151 	QContactId contactId = aContact.value("ContactId").value<QContactId>();
       
   152 	aDataStream<<contactId;
       
   153 	
       
   154 	QContactEmailAddress email = aContact.value("EmailAddress").value<QContactEmailAddress>();
       
   155 	aDataStream<<email;
       
   156 	
       
   157 	QContactGender gender = aContact.value("Gender").value<QContactGender>();
       
   158 	aDataStream<<gender;
       
   159 	
       
   160 	QContactGeoLocation geoloc = aContact.value("Geolocation").value<QContactGeoLocation>();
       
   161 	aDataStream<<geoloc;
       
   162 	
       
   163 	QContactGuid guid = aContact.value("Guid").value<QContactGuid>();
       
   164 	aDataStream<<guid;
       
   165 	
       
   166 	QContactName name = aContact.value("Name").value<QContactName>();
       
   167 	aDataStream<<name;
       
   168 	
       
   169 	QContactNickname nickname = aContact.value("Nickname").value<QContactNickname>();
       
   170 	aDataStream<<nickname;
       
   171 	
       
   172 	QContactNote note = aContact.value("Note").value<QContactNote>();
       
   173 	aDataStream<<note;
       
   174 	
       
   175 	QContactOnlineAccount account = aContact.value("OnlineAccount").value<QContactOnlineAccount>();
       
   176 	aDataStream<<account;
       
   177 	
       
   178 	QContactOrganization org = aContact.value("Organization").value<QContactOrganization>();
       
   179 	aDataStream<<org;
       
   180 	
       
   181 	QContactPhoneNumber number = aContact.value("PhoneNumber").value<QContactPhoneNumber>();
       
   182 	aDataStream<<number;
       
   183 	
       
   184 	QContactPresence presence = aContact.value("Presence").value<QContactPresence>();
       
   185 	aDataStream<<presence;
       
   186 	
       
   187 	QContactThumbnail thumbnail = aContact.value("Thumbnail").value<QContactThumbnail>();
       
   188 	aDataStream<<thumbnail;
       
   189 	
       
   190 	QContactTimestamp time = aContact.value("Timestamp").value<QContactTimestamp>();
       
   191 	aDataStream<<time;
       
   192 	
       
   193 	QContactType type = aContact.value("Type").value<QContactType>();
       
   194 	aDataStream<<type;
       
   195 	
       
   196 	QContactUrl url = aContact.value("Url").value<QContactUrl>();
       
   197 	aDataStream<<url;
       
   198 	
       
   199 	return aDataStream;
       
   200 	}
       
   201 
       
   202 /**
       
   203  * Method for Internalization. Reads a SmfContact object from 
       
   204  * the stream and returns a reference to the stream.
       
   205  * @param aDataStream Stream to be read
       
   206  * @param aContact The SmfContact object to be internalized
       
   207  * @return reference to the stream
       
   208  */
       
   209 QDataStream &operator>>( QDataStream &aDataStream, 
       
   210 		SmfContact& aContact )
       
   211 	{
       
   212 	QContactAddress address;
       
   213 	aDataStream>>address;
       
   214 	QVariant var1 = QVariant::fromValue(address);
       
   215 	aContact.setValue("Address",var1);
       
   216 	
       
   217 	QContactAnniversary anniver;
       
   218 	aDataStream>>anniver;
       
   219 	QVariant var2 = QVariant::fromValue(anniver);
       
   220 	aContact.setValue("Anniversary",var2);
       
   221 	
       
   222 	QContactAvatar avatar;
       
   223 	aDataStream>>avatar;
       
   224 	QVariant var3 = QVariant::fromValue(avatar);
       
   225 	aContact.setValue("Avatar",var3);
       
   226 	
       
   227 	QContactBirthday bday;
       
   228 	aDataStream>>bday;
       
   229 	QVariant var4 = QVariant::fromValue(bday);
       
   230 	aContact.setValue("Birthday",var4);
       
   231 	
       
   232 	QContactId id;
       
   233 	aDataStream>>id;
       
   234 	QVariant var5 = QVariant::fromValue(id);
       
   235 	aContact.setValue("ContactId",var5);
       
   236 	
       
   237 	QContactEmailAddress email;
       
   238 	aDataStream>>email;
       
   239 	QVariant var6 = QVariant::fromValue(email);
       
   240 	aContact.setValue("EmailAddress",var6);
       
   241 	
       
   242 	QContactGender gender;
       
   243 	aDataStream>>gender;
       
   244 	QVariant var7 = QVariant::fromValue(gender);
       
   245 	aContact.setValue("Gender",var7);
       
   246 	
       
   247 	QContactGeoLocation geo;
       
   248 	aDataStream>>geo;
       
   249 	QVariant var8 = QVariant::fromValue(geo);
       
   250 	aContact.setValue("Geolocation",var8);
       
   251 	
       
   252 	QContactGuid guid;
       
   253 	aDataStream>>guid;
       
   254 	QVariant var9 = QVariant::fromValue(guid);
       
   255 	aContact.setValue("Guid",var9);
       
   256 	
       
   257 	QContactName name1;
       
   258 	aDataStream>>name1;
       
   259 	QVariant var10 = QVariant::fromValue(name1);
       
   260 	aContact.setValue("Name",var10);
       
   261 	
       
   262 	QContactNickname nickname;
       
   263 	aDataStream>>nickname;
       
   264 	QVariant var11 = QVariant::fromValue(nickname);
       
   265 	aContact.setValue("Nickname",var11);
       
   266 	
       
   267 	QContactNote note;
       
   268 	aDataStream>>note;
       
   269 	QVariant var12 = QVariant::fromValue(note);
       
   270 	aContact.setValue("Note",var12);
       
   271 	
       
   272 	QContactOnlineAccount account;
       
   273 	aDataStream>>account;
       
   274 	QVariant var13 = QVariant::fromValue(account);
       
   275 	aContact.setValue("OnlineAccount",var13);
       
   276 	
       
   277 	QContactOrganization org;
       
   278 	aDataStream>>org;
       
   279 	QVariant var14 = QVariant::fromValue(org);
       
   280 	aContact.setValue("Organization",var14);
       
   281 	
       
   282 	QContactPhoneNumber number;
       
   283 	aDataStream>>number;
       
   284 	QVariant var15 = QVariant::fromValue(number);
       
   285 	aContact.setValue("PhoneNumber",var15);
       
   286 	
       
   287 	QContactPresence presence;
       
   288 	aDataStream>>presence;
       
   289 	QVariant var16 = QVariant::fromValue(presence);
       
   290 	aContact.setValue("Presence",var16);
       
   291 	
       
   292 	QContactThumbnail thumbnail;
       
   293 	aDataStream>>thumbnail;
       
   294 	QVariant var17 = QVariant::fromValue(thumbnail);
       
   295 	aContact.setValue("Thumbnail",var17);
       
   296 	
       
   297 	QContactTimestamp time;
       
   298 	aDataStream>>time;
       
   299 	QVariant var18 = QVariant::fromValue(time);
       
   300 	aContact.setValue("Timestamp",var18);
       
   301 	
       
   302 	QContactType type;
       
   303 	aDataStream>>type;
       
   304 	QVariant var19 = QVariant::fromValue(type);
       
   305 	aContact.setValue("Type",var19);
       
   306 	
       
   307 	QContactUrl url;
       
   308 	aDataStream>>url;
       
   309 	QVariant var20 = QVariant::fromValue(url);
       
   310 	aContact.setValue("Url",var20);
       
   311 	
       
   312 	return aDataStream;
       
   313 	}
       
   314 
       
   315 
       
   316 
       
   317 
       
   318 /**
       
   319  * Serialization support for QtMobility::QContactAddress
       
   320  */
       
   321 QDataStream& operator<<( QDataStream &aDataStream, 
       
   322 		const QContactAddress &aAddress )
       
   323 	{
       
   324 	aDataStream<<aAddress.country();
       
   325 	aDataStream<<aAddress.locality();
       
   326 	aDataStream<<aAddress.postOfficeBox();
       
   327 	aDataStream<<aAddress.postcode();
       
   328 	aDataStream<<aAddress.region();
       
   329 	aDataStream<<aAddress.street();
       
   330 	aDataStream<<aAddress.subTypes();
       
   331 
       
   332 	return aDataStream;
       
   333 	}
       
   334 
       
   335 /**
       
   336  * Deserialization support for QtMobility::QContactAddress
       
   337  */
       
   338 QDataStream &operator>>( QDataStream &aDataStream, 
       
   339 		QContactAddress &aAddress )
       
   340 	{
       
   341 	QString str;
       
   342 	
       
   343 	// First one to be deserialized is country
       
   344 	aDataStream>>str;
       
   345 	aAddress.setCountry(str);
       
   346 
       
   347 	// Next one to be deserialized is locality
       
   348 	str.clear();
       
   349 	aDataStream>>str;
       
   350 	aAddress.setLocality(str);
       
   351 
       
   352 	// Next one to be deserialized is postOfficeBox
       
   353 	str.clear();
       
   354 	aDataStream>>str;
       
   355 	aAddress.setPostOfficeBox(str);
       
   356 	
       
   357 	// Next one to be deserialized is postCode
       
   358 	str.clear();
       
   359 	aDataStream>>str;
       
   360 	aAddress.setPostcode(str);
       
   361 	
       
   362 	// Next one to be deserialized is region
       
   363 	str.clear();
       
   364 	aDataStream>>str;
       
   365 	aAddress.setRegion(str);
       
   366 	
       
   367 	// Next one to be deserialized is street
       
   368 	str.clear();
       
   369 	aDataStream>>str;
       
   370 	aAddress.setStreet(str);
       
   371 	
       
   372 	// Next one to be deserialized is subtypes
       
   373 	QStringList list;
       
   374 	list.clear();
       
   375 	aDataStream>>list;
       
   376 	aAddress.setSubTypes(list);
       
   377 	
       
   378 	return aDataStream;
       
   379 	}
       
   380 
       
   381 
       
   382 /**
       
   383  * Serialization support for QtMobility::QContactAnniversary
       
   384  */
       
   385 QDataStream &operator<<( QDataStream &aDataStream, 
       
   386 		const QContactAnniversary &aAnniversary )
       
   387 	{
       
   388 	aDataStream<<aAnniversary.calendarId();
       
   389 	aDataStream<<aAnniversary.event();
       
   390 	aDataStream<<aAnniversary.originalDate();
       
   391 	aDataStream<<aAnniversary.subType();
       
   392 
       
   393 	return aDataStream;
       
   394 	}
       
   395 
       
   396 /**
       
   397  * Deserialization support for QtMobility::QContactAnniversary
       
   398  */
       
   399 QDataStream &operator>>( QDataStream &aDataStream, 
       
   400 		QContactAnniversary &aAnniversary)
       
   401 	{
       
   402 	QString str;
       
   403 	QDate date;
       
   404 	
       
   405 	// First one to be deserialized is calendarId
       
   406 	aDataStream>>str;
       
   407 	aAnniversary.setCalendarId(str);
       
   408 
       
   409 	// Next one to be deserialized is event
       
   410 	str.clear();
       
   411 	aDataStream>>str;
       
   412 	aAnniversary.setEvent(str);
       
   413 
       
   414 	// Next one to be deserialized is originalDate
       
   415 	aDataStream>>date;
       
   416 	aAnniversary.setOriginalDate(date);
       
   417 	
       
   418 	// Next one to be deserialized is subType
       
   419 	str.clear();
       
   420 	aDataStream>>str;
       
   421 	aAnniversary.setSubType(str);
       
   422 		
       
   423 	return aDataStream;
       
   424 	}
       
   425 
       
   426 
       
   427 /**
       
   428  * Serialization support for QtMobility::QContactAvatar
       
   429  */
       
   430 QDataStream &operator<<( QDataStream &aDataStream, 
       
   431 	const QContactAvatar &aAvatar )
       
   432 	{
       
   433 	//TODO:- QContactAvatar derives from QContactDetail,so internalization/externalization
       
   434 	//for the same should be provided
       
   435 	
       
   436 	//Qt mobility introduces API compatibility break
       
   437 #ifdef OLDER_QT_MOBILITY
       
   438 	aDataStream<<aAvatar.avatar();
       
   439 
       
   440 #else
       
   441 	aDataStream<<aAvatar.imageUrl();
       
   442 	aDataStream<<aAvatar.videoUrl();
       
   443 #endif
       
   444 	
       
   445 	return aDataStream;
       
   446 	}
       
   447 
       
   448 /**
       
   449  * Deserialization support for QtMobility::QContactAvatar
       
   450  */
       
   451 QDataStream &operator>>( QDataStream &aDataStream, 
       
   452 	QContactAvatar &aAvatar)
       
   453 	{
       
   454 #ifdef OLDER_QT_MOBILITY
       
   455 	QString avatarPath;
       
   456 	aDataStream>>avatarPath;
       
   457 	aAvatar.setAvatar(avatarPath);
       
   458 #else
       
   459 	QUrl url;
       
   460 	aDataStream>>url;
       
   461 	aAvatar.setImageUrl(url);
       
   462 	
       
   463 	url.clear();
       
   464 	aDataStream>>url;
       
   465 	aAvatar.setVideoUrl(url);
       
   466 #endif
       
   467 	
       
   468 	return aDataStream;
       
   469 	}
       
   470 
       
   471 
       
   472 /**
       
   473  * Serialization support for QtMobility::QContactBirthday
       
   474  */
       
   475 QDataStream &operator<<( QDataStream &aDataStream, 
       
   476 	const QContactBirthday &aBirthday )
       
   477 	{
       
   478 	aDataStream<<aBirthday.date();
       
   479 	return aDataStream;
       
   480 	}
       
   481 
       
   482 /**
       
   483  * Deserialization support for QtMobility::QContactBirthday
       
   484  */
       
   485 QDataStream &operator>>( QDataStream &aDataStream, 
       
   486 		QContactBirthday &aBirthday)
       
   487 	{
       
   488 	QDate date;
       
   489 	aDataStream>>date;
       
   490 	aBirthday.setDate(date);
       
   491 
       
   492 	return aDataStream;
       
   493 	}
       
   494 
       
   495 
       
   496 /**
       
   497  * Serialization support for QtMobility::QContactId
       
   498  */
       
   499 QDataStream &operator<<( QDataStream &aDataStream, 
       
   500 	const QContactId &aContactId )
       
   501 	{
       
   502 	aDataStream<<aContactId.localId();
       
   503 	aDataStream<<aContactId.managerUri();
       
   504 
       
   505 	return aDataStream;
       
   506 	}
       
   507 
       
   508 /**
       
   509  * Deserialization support for QtMobility::QContactId
       
   510  */
       
   511 QDataStream &operator>>( QDataStream &aDataStream, 
       
   512 		QContactId &aContactId)
       
   513 	{
       
   514 	QContactLocalId localId;
       
   515 	QString str;
       
   516 	
       
   517 	// First one to be deserialized is localId
       
   518 	aDataStream>>localId;
       
   519 	aContactId.setLocalId(localId);
       
   520 
       
   521 	// Next one to be deserialized is managerUri
       
   522 	aDataStream>>str;
       
   523 	aContactId.setManagerUri(str);
       
   524 		
       
   525 	return aDataStream;
       
   526 	}
       
   527 
       
   528 
       
   529 /**
       
   530  * Serialization support for QtMobility::QContactEmailAddress
       
   531  */
       
   532 QDataStream &operator<<( QDataStream &aDataStream, 
       
   533 	const QContactEmailAddress &aEMail )
       
   534 	{
       
   535 	aDataStream<<aEMail.emailAddress();
       
   536 	return aDataStream;
       
   537 	}
       
   538 
       
   539 /**
       
   540  * Deserialization support for QtMobility::QContactEmailAddress
       
   541  */
       
   542 QDataStream &operator>>( QDataStream &aDataStream, 
       
   543 		QContactEmailAddress &aEMail)
       
   544 	{
       
   545 	QString str;
       
   546 	aDataStream>>str;
       
   547 	aEMail.setEmailAddress(str);
       
   548 		
       
   549 	return aDataStream;
       
   550 	}
       
   551 
       
   552 
       
   553 /**
       
   554  * Serialization support for QtMobility::QContactGender
       
   555  */
       
   556 QDataStream &operator<<( QDataStream &aDataStream, 
       
   557 	const QContactGender &aGender )
       
   558 	{
       
   559 	aDataStream<<aGender.gender();
       
   560 	return aDataStream;
       
   561 	}
       
   562 
       
   563 /**
       
   564  * Deserialization support for QtMobility::QContactGender
       
   565  */
       
   566 QDataStream &operator>>( QDataStream &aDataStream, 
       
   567 		QContactGender &aGender)
       
   568 	{
       
   569 	QString str;
       
   570 	aDataStream>>str;
       
   571 	aGender.setGender(str);
       
   572 		
       
   573 	return aDataStream;
       
   574 	}
       
   575 
       
   576 
       
   577 /**
       
   578  * Serialization support for QtMobility::QContactGeoLocation
       
   579  */
       
   580 QDataStream &operator<<( QDataStream &aDataStream, 
       
   581 	const QContactGeoLocation &aGeolocation )
       
   582 	{
       
   583 	aDataStream<<aGeolocation.accuracy();
       
   584 	aDataStream<<aGeolocation.altitude();
       
   585 	aDataStream<<aGeolocation.altitudeAccuracy();
       
   586 	aDataStream<<aGeolocation.heading();
       
   587 	aDataStream<<aGeolocation.label();
       
   588 	aDataStream<<aGeolocation.latitude();
       
   589 	aDataStream<<aGeolocation.longitude();
       
   590 	aDataStream<<aGeolocation.speed();
       
   591 	aDataStream<<aGeolocation.timestamp();
       
   592 	return aDataStream;
       
   593 	}
       
   594 
       
   595 /**
       
   596  * Deserialization support for QtMobility::QContactGeoLocation
       
   597  */
       
   598 QDataStream &operator>>( QDataStream &aDataStream, 
       
   599 		QContactGeoLocation &aGeolocation)
       
   600 	{
       
   601 	double val;
       
   602 	QString str;
       
   603 	QDateTime date;
       
   604 	
       
   605 	// First one to be deserialized is accuracy
       
   606 	val = 0;
       
   607 	aDataStream>>val;
       
   608 	aGeolocation.setAccuracy(val);
       
   609 
       
   610 	// Next one to be deserialized is altitude
       
   611 	val = 0;
       
   612 	aDataStream>>val;
       
   613 	aGeolocation.setAltitude(val);
       
   614 
       
   615 	// Next one to be deserialized is altitudeAccuracy
       
   616 	val = 0;
       
   617 	aDataStream>>val;
       
   618 	aGeolocation.setAltitudeAccuracy(val);
       
   619 	
       
   620 	// Next one to be deserialized is heading
       
   621 	val = 0;
       
   622 	aDataStream>>val;
       
   623 	aGeolocation.setHeading(val);
       
   624 	
       
   625 	// First one to be deserialized is label
       
   626 	aDataStream>>str;
       
   627 	aGeolocation.setLabel(str);
       
   628 
       
   629 	// Next one to be deserialized is latitude
       
   630 	val = 0;
       
   631 	aDataStream>>val;
       
   632 	aGeolocation.setLatitude(val);
       
   633 
       
   634 	// Next one to be deserialized is longitude
       
   635 	val = 0;
       
   636 	aDataStream>>val;
       
   637 	aGeolocation.setLongitude(val);
       
   638 	
       
   639 	// Next one to be deserialized is speed
       
   640 	val = 0;
       
   641 	aDataStream>>val;
       
   642 	aGeolocation.setSpeed(val);
       
   643 	
       
   644 	// Next one to be deserialized is timestamp
       
   645 	aDataStream>>date;
       
   646 	aGeolocation.setTimestamp(date);
       
   647 		
       
   648 	return aDataStream;
       
   649 	}
       
   650 
       
   651 /**
       
   652  * Serialization support for QtMobility::QContactGuid
       
   653  */
       
   654 QDataStream &operator<<( QDataStream &aDataStream, 
       
   655 	const QContactGuid &aGuid )
       
   656 	{
       
   657 	aDataStream<<aGuid.guid();
       
   658 	return aDataStream;
       
   659 	}
       
   660 
       
   661 /**
       
   662  * Deserialization support for QtMobility::QContactGuid
       
   663  */
       
   664 QDataStream &operator>>( QDataStream &aDataStream, 
       
   665 		QContactGuid &aGuid)
       
   666 	{
       
   667 	QString str;
       
   668 	aDataStream>>str;
       
   669 	aGuid.setGuid(str);
       
   670 	
       
   671 	return aDataStream;
       
   672 	}
       
   673 
       
   674 
       
   675 /**
       
   676  * Serialization support for QtMobility::QContactName
       
   677  */
       
   678 QDataStream &operator<<( QDataStream &aDataStream, 
       
   679 		const QContactName &aContact )
       
   680 	{
       
   681 	//Qt mobility introduces API compatibility break
       
   682 #ifdef OLDER_QT_MOBILITY
       
   683 	aDataStream<<aContact.first();
       
   684 	aDataStream<<aContact.last();
       
   685 #else
       
   686 	aDataStream<<aContact.customLabel();
       
   687 	aDataStream<<aContact.firstName();
       
   688 	aDataStream<<aContact.lastName();
       
   689 	aDataStream<<aContact.middleName();
       
   690 	aDataStream<<aContact.prefix();
       
   691 	aDataStream<<aContact.suffix();
       
   692 #endif
       
   693 	
       
   694 	return aDataStream;
       
   695 	}
       
   696 
       
   697 /**
       
   698  * Deserialization support for QtMobility::QContactName
       
   699  */
       
   700 QDataStream &operator>>( QDataStream &aDataStream, 
       
   701 		QContactName &aContact )
       
   702 	{
       
   703 	QString str;
       
   704 	
       
   705 	// First one to be deserialized is customlabel
       
   706 	str.clear();
       
   707 	aDataStream>>str;
       
   708 	aContact.setCustomLabel(str);
       
   709 	
       
   710 	// Next one to be deserialized is firstname
       
   711 	str.clear();
       
   712 	aDataStream>>str;
       
   713 #ifdef OLDER_QT_MOBILITY
       
   714 	aContact.setFirst(str);
       
   715 #else
       
   716 	aContact.setFirstName(str);
       
   717 #endif
       
   718 
       
   719 	// Next one to be deserialized is lastName
       
   720 	str.clear();
       
   721 	aDataStream>>str;
       
   722 #ifdef OLDER_QT_MOBILITY
       
   723 	aContact.setLast(str);
       
   724 #else
       
   725 	aContact.setLastName(str);
       
   726 #endif
       
   727 	
       
   728 
       
   729 	
       
   730 	// Next one to be deserialized is middlename
       
   731 	str.clear();
       
   732 	aDataStream>>str;
       
   733 	aContact.setMiddleName(str);
       
   734 	
       
   735 	// Next one to be deserialized is prefix
       
   736 	str.clear();
       
   737 	aDataStream>>str;
       
   738 	aContact.setPrefix(str);
       
   739 	
       
   740 	// Next one to be deserialized is suffix
       
   741 	str.clear();
       
   742 	aDataStream>>str;
       
   743 	aContact.setSuffix(str);
       
   744 	
       
   745 	return aDataStream;
       
   746 	}
       
   747 
       
   748 
       
   749 /**
       
   750  * Serialization support for QtMobility::QContactNickname
       
   751  */
       
   752 QDataStream &operator<<( QDataStream &aDataStream, 
       
   753 	const QContactNickname &aNickname )
       
   754 	{
       
   755 	aDataStream<<aNickname.nickname();
       
   756 	return aDataStream;
       
   757 	}
       
   758 
       
   759 /**
       
   760  * Deserialization support for QtMobility::QContactNickname
       
   761  */
       
   762 QDataStream &operator>>( QDataStream &aDataStream, 
       
   763 		QContactNickname &aNickname)
       
   764 	{
       
   765 	QString str;
       
   766 	aDataStream>>str;
       
   767 	aNickname.setNickname(str);
       
   768 		
       
   769 	return aDataStream;
       
   770 	}
       
   771 
       
   772 
       
   773 /**
       
   774  * Serialization support for QtMobility::QContactNote
       
   775  */
       
   776 QDataStream &operator<<( QDataStream &aDataStream, 
       
   777 	const QContactNote &aNote )
       
   778 	{
       
   779 	aDataStream<<aNote.note();
       
   780 	return aDataStream;
       
   781 	}
       
   782 
       
   783 /**
       
   784  * Deserialization support for QtMobility::QContactNote
       
   785  */
       
   786 QDataStream &operator>>( QDataStream &aDataStream, 
       
   787 		QContactNote &aNote)
       
   788 	{
       
   789 	QString str;
       
   790 	aDataStream>>str;
       
   791 	aNote.setNote(str);
       
   792 		
       
   793 	return aDataStream;
       
   794 	}
       
   795 
       
   796 
       
   797 /**
       
   798  * Serialization support for QtMobility::QContactOnlineAccount
       
   799  */
       
   800 QDataStream &operator<<( QDataStream &aDataStream, 
       
   801 	const QContactOnlineAccount &aOnlineAccount )
       
   802 	{
       
   803 	aDataStream<<aOnlineAccount.accountUri();
       
   804 	aDataStream<<aOnlineAccount.capabilities();
       
   805 	aDataStream<<aOnlineAccount.serviceProvider();
       
   806 	aDataStream<<aOnlineAccount.subTypes();
       
   807 
       
   808 	return aDataStream;
       
   809 	}
       
   810 
       
   811 /**
       
   812  * Deserialization support for QtMobility::QContactOnlineAccount
       
   813  */
       
   814 QDataStream &operator>>( QDataStream &aDataStream, 
       
   815 		QContactOnlineAccount &aOnlineAccount)
       
   816 	{
       
   817 	QString str;
       
   818 	QStringList list;
       
   819 	
       
   820 	// First one to be deserialized is accountUri
       
   821 	aDataStream>>str;
       
   822 	aOnlineAccount.setAccountUri(str);
       
   823 
       
   824 	// Next one to be deserialized is capabilities
       
   825 	aDataStream>>list;
       
   826 	aOnlineAccount.setCapabilities(list);
       
   827 
       
   828 	// Next one to be deserialized is serviceProvider
       
   829 	str.clear();
       
   830 	aDataStream>>str;
       
   831 	aOnlineAccount.setServiceProvider(str);
       
   832 	
       
   833 	// Next one to be deserialized is subTypes
       
   834 	list.clear();
       
   835 	aDataStream>>list;
       
   836 	aOnlineAccount.setSubTypes(list);
       
   837 		
       
   838 	return aDataStream;
       
   839 	}
       
   840 
       
   841 
       
   842 /**
       
   843  * Serialization support for QtMobility::QContactOrganization
       
   844  */
       
   845 QDataStream &operator<<( QDataStream &aDataStream, 
       
   846 	const QContactOrganization &aOrganization )
       
   847 	{
       
   848 	aDataStream<<aOrganization.assistantName();
       
   849 	aDataStream<<aOrganization.department();
       
   850 	aDataStream<<aOrganization.location();
       
   851 	aDataStream<<aOrganization.logoUrl();
       
   852 	aDataStream<<aOrganization.name();
       
   853 	aDataStream<<aOrganization.role();
       
   854 	aDataStream<<aOrganization.title();
       
   855 
       
   856 	return aDataStream;
       
   857 	}
       
   858 
       
   859 /**
       
   860  * Deserialization support for QtMobility::QContactOrganization
       
   861  */
       
   862 QDataStream &operator>>( QDataStream &aDataStream, 
       
   863 		QContactOrganization &aOrganization )
       
   864 	{
       
   865 	QString str;
       
   866 	QStringList list;
       
   867 	QUrl url;
       
   868 	
       
   869 	// First one to be deserialized is assistantName
       
   870 	aDataStream>>str;
       
   871 	aOrganization.setAssistantName(str);
       
   872 
       
   873 	// Next one to be deserialized is department
       
   874 	aDataStream>>list;
       
   875 	aOrganization.setDepartment(list);
       
   876 
       
   877 	// Next one to be deserialized is location
       
   878 	str.clear();
       
   879 	aDataStream>>str;
       
   880 	aOrganization.setLocation(str);
       
   881 	
       
   882 	// Next one to be deserialized is logoUrl
       
   883 	aDataStream>>url;
       
   884 	aOrganization.setLogoUrl(url);
       
   885 	
       
   886 	// Next one to be deserialized is name
       
   887 	str.clear();
       
   888 	aDataStream>>str;
       
   889 	aOrganization.setName(str);
       
   890 
       
   891 	// Next one to be deserialized is role
       
   892 	str.clear();
       
   893 	aDataStream>>str;
       
   894 	aOrganization.setRole(str);
       
   895 	
       
   896 	// Next one to be deserialized is title
       
   897 	str.clear();
       
   898 	aDataStream>>str;
       
   899 	aOrganization.setTitle(str);
       
   900 		
       
   901 	return aDataStream;
       
   902 	}
       
   903 
       
   904 
       
   905 /**
       
   906  * Serialization support for QtMobility::QContactPhoneNumber
       
   907  */
       
   908 QDataStream &operator<<( QDataStream &aDataStream, 
       
   909 	const QContactPhoneNumber &aPhoneNumber )
       
   910 	{
       
   911 	aDataStream<<aPhoneNumber.number();
       
   912 	aDataStream<<aPhoneNumber.subTypes();
       
   913 
       
   914 	return aDataStream;
       
   915 	}
       
   916 
       
   917 /**
       
   918  * Deserialization support for QtMobility::QContactPhoneNumber
       
   919  */
       
   920 QDataStream &operator>>( QDataStream &aDataStream, 
       
   921 		QContactPhoneNumber &aPhoneNumber )
       
   922 	{
       
   923 	QString str;
       
   924 	QStringList list;
       
   925 	
       
   926 	// First one to be deserialized is number
       
   927 	aDataStream>>str;
       
   928 	aPhoneNumber.setNumber(str);
       
   929 	
       
   930 	// Next one to be deserialized is subTypes
       
   931 	aDataStream>>list;
       
   932 	aPhoneNumber.setSubTypes(list);
       
   933 		
       
   934 	return aDataStream;
       
   935 	}
       
   936 
       
   937 
       
   938 /**
       
   939  * Serialization support for QtMobility::QContactPresence
       
   940  */
       
   941 QDataStream &operator<<( QDataStream &aDataStream, 
       
   942 	const QContactPresence &aPresence )
       
   943 	{
       
   944 	aDataStream<<aPresence.customMessage();
       
   945 	aDataStream<<aPresence.nickname();
       
   946 	aDataStream<<aPresence.presenceState();
       
   947 	aDataStream<<aPresence.presenceStateImageUrl();
       
   948 	aDataStream<<aPresence.presenceStateText();
       
   949 	aDataStream<<aPresence.timestamp();
       
   950 
       
   951 	return aDataStream;
       
   952 	}
       
   953 
       
   954 /**
       
   955  * Deserialization support for QtMobility::QContactPresence
       
   956  */
       
   957 QDataStream &operator>>( QDataStream &aDataStream, 
       
   958 		QContactPresence &aPresence )
       
   959 	{
       
   960 	QString str;
       
   961 	QUrl url;
       
   962 	QDateTime date;
       
   963 	
       
   964 	// First one to be deserialized is customMessage
       
   965 	aDataStream>>str;
       
   966 	aPresence.setCustomMessage(str);
       
   967 	
       
   968 	// Next one to be deserialized is nickname
       
   969 	str.clear();
       
   970 	aDataStream>>str;
       
   971 	aPresence.setNickname(str);
       
   972 	
       
   973 	// Next one to be deserialized is presenceState
       
   974 	int val;
       
   975 	aDataStream>>val;
       
   976 	QContactPresence::PresenceState state = (QContactPresence::PresenceState)val;
       
   977 	aPresence.setPresenceState(state);
       
   978 	
       
   979 	// Next one to be deserialized is presenceStateImageUrl
       
   980 	aDataStream>>url;
       
   981 	aPresence.setPresenceStateImageUrl(url);
       
   982 	
       
   983 	// Next one to be deserialized is presenceStateText
       
   984 	str.clear();
       
   985 	aDataStream>>str;
       
   986 	aPresence.setPresenceStateText(str);
       
   987 	
       
   988 	// Next one to be deserialized is timestamp
       
   989 	aDataStream>>date;
       
   990 	aPresence.setTimestamp(date);
       
   991 		
       
   992 	return aDataStream;
       
   993 	}
       
   994 
       
   995 
       
   996 /**
       
   997  * Serialization support for QtMobility::QContactThumbnail
       
   998  */
       
   999 QDataStream &operator<<( QDataStream &aDataStream, 
       
  1000 	const QContactThumbnail &aThumbnail )
       
  1001 	{
       
  1002 	aDataStream<<aThumbnail.thumbnail();
       
  1003 
       
  1004 	return aDataStream;
       
  1005 	}
       
  1006 
       
  1007 /**
       
  1008  * Deserialization support for QtMobility::QContactThumbnail
       
  1009  */
       
  1010 QDataStream &operator>>( QDataStream &aDataStream, 
       
  1011 		QContactThumbnail &aThumbnail )
       
  1012 	{
       
  1013 	QImage image;
       
  1014 	aDataStream>>image;
       
  1015 	aThumbnail.setThumbnail(image);
       
  1016 		
       
  1017 	return aDataStream;
       
  1018 	}
       
  1019 
       
  1020 
       
  1021 /**
       
  1022  * Serialization support for QtMobility::QContactTimestamp
       
  1023  */
       
  1024 QDataStream &operator<<( QDataStream &aDataStream, 
       
  1025 	const QContactTimestamp &aTimestamp )
       
  1026 	{
       
  1027 	aDataStream<<aTimestamp.created();
       
  1028 	aDataStream<<aTimestamp.lastModified();
       
  1029 
       
  1030 	return aDataStream;
       
  1031 	}
       
  1032 
       
  1033 /**
       
  1034  * Deserialization support for QtMobility::QContactTimestamp
       
  1035  */
       
  1036 QDataStream &operator>>( QDataStream &aDataStream, 
       
  1037 		QContactTimestamp &aTimestamp )
       
  1038 	{
       
  1039 	QDateTime date1, date2;
       
  1040 	
       
  1041 	// First one to be deserialized is created
       
  1042 	aDataStream>>date1;
       
  1043 	aTimestamp.setCreated(date1);
       
  1044 	
       
  1045 	// Next one to be deserialized is lastModified
       
  1046 	aDataStream>>date2;
       
  1047 	aTimestamp.setLastModified(date2);
       
  1048 		
       
  1049 	return aDataStream;
       
  1050 	}
       
  1051 
       
  1052 
       
  1053 /**
       
  1054  * Serialization support for QtMobility::QContactType
       
  1055  */
       
  1056 QDataStream &operator<<( QDataStream &aDataStream, 
       
  1057 	const QContactType &aType )
       
  1058 	{
       
  1059 	aDataStream<<aType.type();
       
  1060 	return aDataStream;
       
  1061 	}
       
  1062 
       
  1063 /**
       
  1064  * Deserialization support for QtMobility::QContactType
       
  1065  */
       
  1066 QDataStream &operator>>( QDataStream &aDataStream, 
       
  1067 		QContactType &aType )
       
  1068 	{
       
  1069 	QString str;
       
  1070 	aDataStream>>str;
       
  1071 	aType.setType(str);
       
  1072 	
       
  1073 	return aDataStream;
       
  1074 	}
       
  1075 
       
  1076 
       
  1077 /**
       
  1078  * Serialization support for QtMobility::QContactUrl
       
  1079  */
       
  1080 QDataStream &operator<<( QDataStream &aDataStream, 
       
  1081 	const QContactUrl &aUrl )
       
  1082 	{
       
  1083 	aDataStream<<aUrl.subType();
       
  1084 	aDataStream<<aUrl.url();
       
  1085 
       
  1086 	return aDataStream;
       
  1087 	}
       
  1088 
       
  1089 /**
       
  1090  * Deserialization support for QtMobility::QContactUrl
       
  1091  */
       
  1092 QDataStream &operator>>( QDataStream &aDataStream, 
       
  1093 		QContactUrl &aUrl)
       
  1094 	{
       
  1095 	QString str;
       
  1096 	
       
  1097 	// First one to be deserialized is subType
       
  1098 	aDataStream>>str;
       
  1099 	aUrl.setSubType(str);
       
  1100 	
       
  1101 	// Next one to be deserialized is url
       
  1102 	str.clear();
       
  1103 	aDataStream>>str;
       
  1104 	aUrl.setUrl(str);
       
  1105 		
       
  1106 	return aDataStream;
       
  1107 	}
       
  1108