Ignore:
Timestamp:
02/05/10 00:24:31 (2 years ago)
Author:
roeland
Message:

Parsing some more contact data.
Added doxygen comments. A lot of cleaning up or design choises are
needed. But lets first get a working prototype.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • libQtGdata/trunk/qtgdata_contact.cpp

    r3 r4  
    11#include "qtgdata_contacts.h" 
     2 
     3#include <QUrl> 
    24 
    35QtGdata_contact::QtGdata_contact() 
     
    68} 
    79 
    8 void QtGdata_contact::setName(const QString name) 
     10void QtGdata_contact::setTitle(const QString name) 
    911{ 
    10   this->name = name; 
     12  names.title = name; 
     13} 
     14 
     15void QtGdata_contact::setFullName(const QString name) 
     16{ 
     17  names.fullName = name; 
     18} 
     19 
     20void QtGdata_contact::setGivenName(const QString name) 
     21{ 
     22  names.givenName = name; 
     23} 
     24 
     25void QtGdata_contact::setFamilyName(const QString name) 
     26{ 
     27  names.familyName = name; 
    1128} 
    1229 
     
    2037 * @param type What kind of email (home/work/other) 
    2138 * @param primary Boolean indicating if this is the primary email 
     39 * 
     40 * @todo make sure there is exactly 1 primary email address 
     41 * @todo find out what to do with duplicated emails 
    2242 */ 
    2343void QtGdata_contact::addEmail(const QString email, 
    24                                const QtGdata_contact::GDATA_CONTACT_EMAIL type, 
     44                               const QtGdata_contact::EMAIL type, 
    2545                               const bool primary) 
    2646{ 
    27   this->email.insert(email, type); 
     47  QtGdata_contact::email e; 
     48  e.email = email; 
     49  e.type = type; 
     50  e.primary = primary; 
    2851 
    29   if (primary) { 
    30     primary_email = email; 
    31   } 
     52  emails.append(e); 
    3253} 
    3354 
     55/** 
     56 * @param phonenumber The phone number to add 
     57 * @param type The type of phone number (home/work/pager/fax...) 
     58 * 
     59 * @todo Find out if duplicated numbers can occure (currently not posible) 
     60 */ 
    3461void QtGdata_contact::addPhone(const QString phonenumber, 
    35                                const QtGdata_contact::GDATA_CONTACT_PHONE type) 
     62                               const QtGdata_contact::PHONE type) 
    3663{ 
    37   phone.insert(phonenumber, type); 
     64  QtGdata_contact::phone p; 
     65  p.phonenumber = phonenumber; 
     66  p.type = type; 
     67 
     68  phones.append(p); 
    3869} 
    3970 
    40  
     71/** 
     72 * @param gender The gender of the contact 
     73 * 
     74 * @todo Make sure this is valid (better of with enum) 
     75 */ 
    4176void QtGdata_contact::setGender(const QString gender) 
    4277{ 
     
    4479} 
    4580 
     81/** 
     82 * @param link The link to the contact 
     83 * 
     84 * @todo Check if this is a valid url 
     85 */ 
     86void QtGdata_contact::setLinkEdit(const QString link) 
     87{ 
     88  linkEdit = QUrl(link); 
     89} 
     90 
     91/** 
     92 * @param link The link to edit the contact 
     93 * 
     94 * @todo Check if this is a valid url 
     95 */ 
     96void QtGdata_contact::setLinkSelf(const QString link) 
     97{ 
     98  linkSelf = QUrl(link); 
     99} 
     100 
     101/** 
     102 * Fill an address struct and add it to the list 
     103 */ 
     104void QtGdata_contact::setAddress(const QString street, 
     105                                 const QString postcode, 
     106                                 const QString city, 
     107                                 const QString region, 
     108                                 const QString country, 
     109                                 const QtGdata_contact::ADDRESS type) 
     110{ 
     111  QtGdata_contact::address a; 
     112  a.street = street; 
     113  a.postcode = postcode; 
     114  a.city = city; 
     115  a.region = region; 
     116  a.country = country; 
     117 
     118  addresses.append(a); 
     119} 
     120 
    46121QString QtGdata_contact::getName() 
    47122{ 
    48   return name; 
     123  return QString(); 
    49124} 
    50125 
Note: See TracChangeset for help on using the changeset viewer.