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_contacts.h

    r3 r4  
    88#include <QDateTime> 
    99#include <QMap> 
     10#include <QUrl> 
     11#include <QList> 
    1012 
    1113class QtGdata_contact 
    1214{ 
    1315  public: 
    14     enum GDATA_CONTACT_EMAIL { 
    15       GDATA_CONTACT_EMAIL_OTHER, 
    16       GDATA_CONTACT_EMAIL_HOME, 
    17       GDATA_CONTACT_EMAIL_WORK, 
     16    enum ADDRESS { 
     17      ADDRESS_OTHER 
    1818    }; 
    1919 
    20     enum GDATA_CONTACT_PHONE { 
    21       GDATA_CONTACT_PHONE_OTHER, 
    22       GDATA_CONTACT_PHONE_HOME, 
    23       GDATA_CONTACT_PHONE_HOME_FAX, 
    24       GDATA_CONTACT_PHONE_WORK, 
    25       GDATA_CONTACT_PHONE_WORK_FAX, 
    26       GDATA_CONTACT_PHONE_MOBILE, 
    27       GDATA_CONTACT_PHONE_PAGER 
     20    enum EMAIL { 
     21      EMAIL_OTHER, 
     22      EMAIL_HOME, 
     23      EMAIL_WORK, 
    2824    }; 
     25 
     26    enum GENDER { 
     27      GENDER_MALE, 
     28      GENDER_FEMALE 
     29    }; 
     30 
     31    enum PHONE { 
     32      PHONE_OTHER, 
     33      PHONE_HOME, 
     34      PHONE_HOME_FAX, 
     35      PHONE_WORK, 
     36      PHONE_WORK_FAX, 
     37      PHONE_MOBILE, 
     38      PHONE_PAGER 
     39    }; 
     40 
     41    typedef struct address { 
     42      QString street; 
     43      QString postcode; 
     44      QString city; 
     45      QString region; 
     46      QString country; 
     47 
     48      QString formattedAddress; /* Overkill?*/ 
     49 
     50      QtGdata_contact::ADDRESS type; 
     51    } address; 
     52 
     53    typedef struct email { 
     54      QString email; 
     55      QtGdata_contact::EMAIL type; 
     56      bool primary; 
     57    } email; 
     58 
     59    typedef struct name { 
     60      QString title; 
     61      QString fullName; 
     62      QString givenName; 
     63      QString familyName; 
     64    } name; 
     65 
     66    typedef struct phone { 
     67      QString phonenumber; 
     68      QtGdata_contact::PHONE type; 
     69    } phone; 
    2970 
    3071    QtGdata_contact(); 
     
    3778    /* Adders */ 
    3879    void addEmail(const QString email, 
    39                   const QtGdata_contact::GDATA_CONTACT_EMAIL type = QtGdata_contact::GDATA_CONTACT_EMAIL_OTHER, 
     80                  const QtGdata_contact::EMAIL type = QtGdata_contact::EMAIL_OTHER, 
    4081                  const bool primary = false); 
    4182    void addPhone(const QString phonenumber, 
    42                   const QtGdata_contact::GDATA_CONTACT_PHONE type = QtGdata_contact::GDATA_CONTACT_PHONE_OTHER); 
     83                  const QtGdata_contact::PHONE type = QtGdata_contact::PHONE_OTHER); 
    4384 
    4485    /* Setters */ 
     86    void setAddress(const QString street, 
     87                    const QString postcode, 
     88                    const QString city, 
     89                    const QString region, 
     90                    const QString country, 
     91                    const QtGdata_contact::ADDRESS type = QtGdata_contact::ADDRESS_OTHER); 
    4592    void setGender(const QString gender); 
     93    void setLinkEdit(const QString link); 
     94    void setLinkSelf(const QString link); 
    4695    void setName(const QString name); 
    4796    void setUpdated(const QDateTime updated); 
    4897 
     98    /* Set names */ 
     99    void setTitle(const QString name); 
     100    void setFullName(const QString name); 
     101    void setGivenName(const QString name); 
     102    void setFamilyName(const QString name); 
     103 
    49104  private: 
    50105    //QDate birthday; 
    51     QMap<QString, QtGdata_contact::GDATA_CONTACT_EMAIL> email; 
    52     QString primary_email; 
     106    QList<address> addresses; 
     107    QList<email> emails; 
    53108    QString gender; 
    54     QString name; 
    55     QMap<QString, QtGdata_contact::GDATA_CONTACT_PHONE> phone; 
     109    name names; 
     110    QList<phone> phones; 
    56111    QDateTime updated; 
     112 
     113 
     114    QUrl linkEdit; 
     115    QUrl linkSelf; 
    57116}; 
    58117 
Note: See TracChangeset for help on using the changeset viewer.