src/versit/qversitcontactexporter_p.h
changeset 0 876b1a06bc25
child 5 603d3f8b6302
equal deleted inserted replaced
-1:000000000000 0:876b1a06bc25
       
     1 /****************************************************************************
       
     2 **
       
     3 ** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
       
     4 ** All rights reserved.
       
     5 ** Contact: Nokia Corporation (qt-info@nokia.com)
       
     6 **
       
     7 ** This file is part of the Qt Mobility Components.
       
     8 **
       
     9 ** $QT_BEGIN_LICENSE:LGPL$
       
    10 ** No Commercial Usage
       
    11 ** This file contains pre-release code and may not be distributed.
       
    12 ** You may use this file in accordance with the terms and conditions
       
    13 ** contained in the Technology Preview License Agreement accompanying
       
    14 ** this package.
       
    15 **
       
    16 ** GNU Lesser General Public License Usage
       
    17 ** Alternatively, this file may be used under the terms of the GNU Lesser
       
    18 ** General Public License version 2.1 as published by the Free Software
       
    19 ** Foundation and appearing in the file LICENSE.LGPL included in the
       
    20 ** packaging of this file.  Please review the following information to
       
    21 ** ensure the GNU Lesser General Public License version 2.1 requirements
       
    22 ** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
       
    23 **
       
    24 ** In addition, as a special exception, Nokia gives you certain additional
       
    25 ** rights.  These rights are described in the Nokia Qt LGPL Exception
       
    26 ** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
       
    27 **
       
    28 ** If you have questions regarding the use of this file, please contact
       
    29 ** Nokia at qt-info@nokia.com.
       
    30 **
       
    31 **
       
    32 **
       
    33 **
       
    34 **
       
    35 **
       
    36 **
       
    37 **
       
    38 ** $QT_END_LICENSE$
       
    39 **
       
    40 ****************************************************************************/
       
    41 
       
    42 #ifndef QVERSITCONTACTEXPORTER_P_H
       
    43 #define QVERSITCONTACTEXPORTER_P_H
       
    44 
       
    45 //
       
    46 //  W A R N I N G
       
    47 //  -------------
       
    48 //
       
    49 // This file is not part of the Qt API.  It exists purely as an
       
    50 // implementation detail.  This header file may change from version to
       
    51 // version without notice, or even be removed.
       
    52 //
       
    53 // We mean it.
       
    54 //
       
    55 
       
    56 #include "qversitdocument.h"
       
    57 #include "qversitproperty.h"
       
    58 #include "qmobilityglobal.h"
       
    59 #include "qvcardbackuphandlers_p.h"
       
    60 
       
    61 #include <QHash>
       
    62 #include <QObject>
       
    63 
       
    64 QTM_BEGIN_NAMESPACE
       
    65 class QContact;
       
    66 class QContactDetail;
       
    67 
       
    68 class Q_AUTOTEST_EXPORT QVersitContactExporterPrivate
       
    69 {
       
    70 public:
       
    71     QVersitContactExporterPrivate();
       
    72     ~QVersitContactExporterPrivate();
       
    73 
       
    74     bool exportContact(const QContact& contact, QVersitDocument& versitDocument,
       
    75                        QVersitContactExporter::Error* error);
       
    76 
       
    77 protected:
       
    78     static bool documentContainsName(const QVersitDocument& document);
       
    79     void encodeName(
       
    80             const QContactDetail& detail,
       
    81             const QVersitDocument& document,
       
    82             QList<QVersitProperty>* removedProperties,
       
    83             QList<QVersitProperty>* generatedProperties,
       
    84             QSet<QString>* processedFields);
       
    85     void encodePhoneNumber(
       
    86             const QContactDetail& detail,
       
    87             QList<QVersitProperty>* generatedProperties,
       
    88             QSet<QString>* processedFields);
       
    89     void encodeEmail(
       
    90             const QContactDetail& detail,
       
    91             QList<QVersitProperty>* generatedProperties,
       
    92             QSet<QString>* processedFields);
       
    93     void encodeAddress(
       
    94             const QContactDetail& detail,
       
    95             QList<QVersitProperty>* generatedProperties,
       
    96             QSet<QString>* processedFields);
       
    97     void encodeUrl(
       
    98             const QContactDetail& detail,
       
    99             QList<QVersitProperty>* generatedProperties,
       
   100             QSet<QString>* processedFields);
       
   101     void encodeUid(
       
   102             const QContactDetail& detail,
       
   103             QList<QVersitProperty>* generatedProperties,
       
   104             QSet<QString>* processedFields);
       
   105     void encodeRev(
       
   106             const QContactDetail& detail,
       
   107             QList<QVersitProperty>* generatedProperties,
       
   108             QSet<QString>* processedFields);
       
   109     void encodeBirthDay(
       
   110             const QContactDetail& detail,
       
   111             QList<QVersitProperty>* generatedProperties,
       
   112             QSet<QString>* processedFields);
       
   113     void encodeNote(
       
   114             const QContactDetail& detail,
       
   115             QList<QVersitProperty>* generatedProperties,
       
   116             QSet<QString>* processedFields);
       
   117     void encodeGeoLocation(
       
   118             const QContactDetail& detail,
       
   119             QList<QVersitProperty>* generatedProperties,
       
   120             QSet<QString>* processedFields);
       
   121     void encodeOrganization(
       
   122             const QContactDetail& detail,
       
   123             QList<QVersitProperty>* generatedProperties,
       
   124             QSet<QString>* processedFields);
       
   125     void encodeRingtone(
       
   126             const QContactDetail &detail,
       
   127             QList<QVersitProperty>* generatedProperties,
       
   128             QSet<QString>* processedFields);
       
   129     void encodeThumbnail(
       
   130             const QContactDetail &detail,
       
   131             QList<QVersitProperty>* generatedProperties,
       
   132             QSet<QString>* processedFields);
       
   133     void encodeAvatar(
       
   134             const QContactDetail &detail,
       
   135             QList<QVersitProperty>* generatedProperties,
       
   136             QSet<QString>* processedFields);
       
   137     void encodeGender(
       
   138             const QContactDetail &detail,
       
   139             QList<QVersitProperty>* generatedProperties,
       
   140             QSet<QString>* processedFields);
       
   141     void encodeNickname(
       
   142             const QContactDetail &detail,
       
   143             const QVersitDocument& document,
       
   144             QList<QVersitProperty>* removedProperties,
       
   145             QList<QVersitProperty>* generatedProperties,
       
   146             QSet<QString>* processedFields);
       
   147     void encodeTag(
       
   148             const QContactDetail &detail,
       
   149             const QVersitDocument& document,
       
   150             QList<QVersitProperty>* removedProperties,
       
   151             QList<QVersitProperty>* generatedProperties,
       
   152             QSet<QString>* processedFields);
       
   153     void encodeAnniversary(
       
   154             const QContactDetail &detail,
       
   155             QList<QVersitProperty>* generatedProperties,
       
   156             QSet<QString>* processedFields);
       
   157     void encodeOnlineAccount(
       
   158             const QContactDetail &detail,
       
   159             QList<QVersitProperty>* generatedProperties,
       
   160             QSet<QString>* processedFields);
       
   161     void encodeFamily(
       
   162             const QContactDetail &detail,
       
   163             QList<QVersitProperty>* generatedProperties,
       
   164             QSet<QString>* processedFields);
       
   165     void encodeDisplayLabel(
       
   166             const QContactDetail &detail,
       
   167             const QVersitDocument& document,
       
   168             QList<QVersitProperty>* removedProperties,
       
   169             QList<QVersitProperty>* generatedProperties,
       
   170             QSet<QString>* processedFields);
       
   171     QVersitProperty takeProperty(const QVersitDocument& document, const QString& propertyName,
       
   172                                  QList<QVersitProperty>* toBeRemoved);
       
   173     bool isValidRemoteUrl(const QString& resourceIdentifier);
       
   174     void encodeParameters(QVersitProperty& property,
       
   175         const QStringList& contexts,
       
   176         const QStringList& subTypes=QStringList());
       
   177     bool encodeContentFromFile(const QString& resourcePath, QVersitProperty& property);
       
   178 
       
   179 public: // Data
       
   180     QList<QVersitDocument> mDocuments;
       
   181     QMap<int, QVersitContactExporter::Error> mErrors;
       
   182     QVersitContactExporterDetailHandler* mDetailHandler;
       
   183     QVersitContactExporterDetailHandlerV2* mDetailHandler2;
       
   184     int mDetailHandlerVersion;
       
   185     QVersitDefaultResourceHandler* mDefaultResourceHandler;
       
   186     QVersitResourceHandler* mResourceHandler;
       
   187     QHash<QString,QString> mPropertyMappings;
       
   188     QHash<QString,QString> mParameterMappings;
       
   189     QVersitDocument::VersitType mVersitType;
       
   190 };
       
   191 
       
   192 QTM_END_NAMESPACE
       
   193 
       
   194 #endif // QVERSITCONTACTEXPORTER_P_H