| 1 | /* |
| 2 | * This file is part of buteo-syncfw package |
| 3 | * |
| 4 | * Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). |
| 5 | * |
| 6 | * Contact: Sateesh Kavuri <[email protected]> |
| 7 | * |
| 8 | * This library is free software; you can redistribute it and/or |
| 9 | * modify it under the terms of the GNU Lesser General Public License |
| 10 | * version 2.1 as published by the Free Software Foundation. |
| 11 | * |
| 12 | * This library is distributed in the hope that it will be useful, but |
| 13 | * WITHOUT ANY WARRANTY; without even the implied warranty of |
| 14 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
| 15 | * Lesser General Public License for more details. |
| 16 | * |
| 17 | * You should have received a copy of the GNU Lesser General Public |
| 18 | * License along with this library; if not, write to the Free Software |
| 19 | * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA |
| 20 | * 02110-1301 USA |
| 21 | * |
| 22 | */ |
| 23 | #ifndef SYNCRESULTS_H_2 |
| 24 | #define SYNCRESULTS_H_2cxx . . $ `libbuteosyncfw/profile/SyncResults.h:24:9`! |
| 25 | |
| 26 | #include <QDateTime> |
| 27 | #include <QList> |
| 28 | #include <QSharedPointer> |
| 29 | #include <QObject> |
| 30 | #include <QVariantList> |
| 31 | #include "TargetResults.h"cxx . . $ `<file>/libbuteosyncfw/profile/TargetResults.h`/ |
| 32 | |
| 33 | class QDomDocumentcxx . . $ QDomDocument#; |
| 34 | class QDomElementcxx . . $ QDomElement#; |
| 35 | |
| 36 | namespace Buteocxx . . $ Buteo/ { |
| 37 | |
| 38 | struct DatabaseResultscxx . . $ Buteo/DatabaseResults# |
| 39 | { |
| 40 | int iLocalItemsAddedcxx . . $ Buteo/DatabaseResults#iLocalItemsAdded.; /*!<The number of items added to the local database*/ |
| 41 | int iLocalItemsModifiedcxx . . $ Buteo/DatabaseResults#iLocalItemsModified.; /*!<The number of items updated in the local database*/ |
| 42 | int iLocalItemsDeletedcxx . . $ Buteo/DatabaseResults#iLocalItemsDeleted.; /*!<The number of items deleted from the local database*/ |
| 43 | |
| 44 | int iRemoteItemsAddedcxx . . $ Buteo/DatabaseResults#iRemoteItemsAdded.; /*!<The number of items added to the remote database*/ |
| 45 | int iRemoteItemsModifiedcxx . . $ Buteo/DatabaseResults#iRemoteItemsModified.; /*!<The number of items updated in the remote database*/ |
| 46 | int iRemoteItemsDeletedcxx . . $ Buteo/DatabaseResults#iRemoteItemsDeleted.; /*!<The number of items deleted from the remote database*/ |
| 47 | |
| 48 | DatabaseResultscxx . . $ Buteo/DatabaseResults#DatabaseResults(49f6e7a06ebc5aa8).() |
| 49 | : iLocalItemsAddedcxx . . $ Buteo/DatabaseResults#iLocalItemsAdded.(0) |
| 50 | , iLocalItemsModifiedcxx . . $ Buteo/DatabaseResults#iLocalItemsModified.(0) |
| 51 | , iLocalItemsDeletedcxx . . $ Buteo/DatabaseResults#iLocalItemsDeleted.(0) |
| 52 | , iRemoteItemsAddedcxx . . $ Buteo/DatabaseResults#iRemoteItemsAdded.(0) |
| 53 | , iRemoteItemsModifiedcxx . . $ Buteo/DatabaseResults#iRemoteItemsModified.(0) |
| 54 | , iRemoteItemsDeletedcxx . . $ Buteo/DatabaseResults#iRemoteItemsDeleted.(0) |
| 55 | {} |
| 56 | }; |
| 57 | |
| 58 | class SyncResultsPrivatecxx . . $ Buteo/SyncResultsPrivate#; |
| 59 | |
| 60 | /*! \brief Contains information about a completed synchronization session. |
| 61 | * |
| 62 | * SyncResults consists of the sync time/date, result code and one |
| 63 | * TargetResults object for each sync target/storage (calendar, bookmarks |
| 64 | * etc.). |
| 65 | */ |
| 66 | class SyncResultscxx . . $ Buteo/SyncResults# |
| 67 | { |
| 68 | Q_GADGETcxx . . $ Buteo/SyncResults#staticMetaObject. |
| 69 | Q_PROPERTYcxx . . $ `<external>/1208926524888476972/qobjectdefs.h:104:9`!(QDateTime syncTime READ syncTime CONSTANT) |
| 70 | Q_PROPERTYcxx . . $ `<external>/1208926524888476972/qobjectdefs.h:104:9`!(MajorCode majorCode READ majorCode CONSTANT) |
| 71 | Q_PROPERTYcxx . . $ `<external>/1208926524888476972/qobjectdefs.h:104:9`!(MinorCode minorCode READ minorCode CONSTANT) |
| 72 | Q_PROPERTYcxx . . $ `<external>/1208926524888476972/qobjectdefs.h:104:9`!(bool scheduled READ isScheduled CONSTANT) |
| 73 | Q_PROPERTYcxx . . $ `<external>/1208926524888476972/qobjectdefs.h:104:9`!(QString targetId READ getTargetId CONSTANT) |
| 74 | Q_PROPERTYcxx . . $ `<external>/1208926524888476972/qobjectdefs.h:104:9`!(QVariantList results READ variantTargetResults CONSTANT) |
| 75 | |
| 76 | public: |
| 77 | /*! \brief enum value |
| 78 | * |
| 79 | * Used to set the major code in *.log.xml file for profile |
| 80 | */ |
| 81 | enum MajorCodecxx . . $ Buteo/SyncResults#MajorCode# { |
| 82 | SYNC_RESULT_INVALIDcxx . . $ Buteo/SyncResults#SYNC_RESULT_INVALID. = -1, |
| 83 | SYNC_RESULT_SUCCESScxx . . $ Buteo/SyncResults#SYNC_RESULT_SUCCESS. = 0, |
| 84 | SYNC_RESULT_FAILEDcxx . . $ Buteo/SyncResults#SYNC_RESULT_FAILED., |
| 85 | SYNC_RESULT_CANCELLEDcxx . . $ Buteo/SyncResults#SYNC_RESULT_CANCELLED. |
| 86 | }; |
| 87 | Q_ENUMcxx . . $ Buteo/qt_getEnumName(bfaa297278f66509).(MajorCode) |
| 88 | |
| 89 | /*! \brief enum value |
| 90 | * |
| 91 | * Used to set the minor code in *.log.xml file for profile |
| 92 | */ |
| 93 | enum MinorCodecxx . . $ Buteo/SyncResults#MinorCode# { |
| 94 | // No error |
| 95 | NO_ERRORcxx . . $ Buteo/SyncResults#NO_ERROR. = 0, |
| 96 | |
| 97 | // Sync completed but some unblocking issues appeared 3xx |
| 98 | ITEM_FAILUREScxx . . $ Buteo/SyncResults#ITEM_FAILURES. = 301, |
| 99 | |
| 100 | // Client/Configuration errors 4xx |
| 101 | INTERNAL_ERRORcxx . . $ Buteo/SyncResults#INTERNAL_ERROR. = 401, |
| 102 | AUTHENTICATION_FAILUREcxx . . $ Buteo/SyncResults#AUTHENTICATION_FAILURE., |
| 103 | DATABASE_FAILUREcxx . . $ Buteo/SyncResults#DATABASE_FAILURE., |
| 104 | PLUGIN_ERRORcxx . . $ Buteo/SyncResults#PLUGIN_ERROR., |
| 105 | PLUGIN_TIMEOUTcxx . . $ Buteo/SyncResults#PLUGIN_TIMEOUT., |
| 106 | |
| 107 | // Server/Network errors 5xx |
| 108 | ABORTEDcxx . . $ Buteo/SyncResults#ABORTED. = 501, |
| 109 | CONNECTION_ERRORcxx . . $ Buteo/SyncResults#CONNECTION_ERROR., |
| 110 | UNSUPPORTED_SYNC_TYPEcxx . . $ Buteo/SyncResults#UNSUPPORTED_SYNC_TYPE., |
| 111 | UNSUPPORTED_STORAGE_TYPEcxx . . $ Buteo/SyncResults#UNSUPPORTED_STORAGE_TYPE., |
| 112 | |
| 113 | // Context Error Code |
| 114 | LOW_BATTERY_POWERcxx . . $ Buteo/SyncResults#LOW_BATTERY_POWER. = 601, |
| 115 | POWER_SAVING_MODEcxx . . $ Buteo/SyncResults#POWER_SAVING_MODE., |
| 116 | OFFLINE_MODEcxx . . $ Buteo/SyncResults#OFFLINE_MODE., |
| 117 | BACKUP_IN_PROGRESScxx . . $ Buteo/SyncResults#BACKUP_IN_PROGRESS., |
| 118 | LOW_MEMORYcxx . . $ Buteo/SyncResults#LOW_MEMORY. |
| 119 | }; |
| 120 | Q_ENUMcxx . . $ Buteo/qt_getEnumMetaObject(1a493a702b95f607).(MinorCode) |
| 121 | |
| 122 | /*! \brief Constructs an empty sync results object. |
| 123 | * |
| 124 | * Sync time is set to current time, result code should be set later by |
| 125 | * calling setMajorCode , setMinorCode. |
| 126 | */ |
| 127 | SyncResultscxx . . $ Buteo/SyncResults#SyncResults(49f6e7a06ebc5aa8).(); |
| 128 | |
| 129 | /*! \brief Copy constructor. |
| 130 | * |
| 131 | * \param aSource Copy source. |
| 132 | */ |
| 133 | SyncResultscxx . . $ Buteo/SyncResults#SyncResults(8646dad0f615697a).(const SyncResultscxx . . $ Buteo/SyncResults# &aSource); |
| 134 | |
| 135 | /*! \brief Constructs sync results, sets sync time and result code. |
| 136 | * |
| 137 | * \param aTime Sync time for the results. |
| 138 | * \param aMajorCode Sync result code. |
| 139 | * \param aMinorCode Sync Failed Reason. |
| 140 | */ |
| 141 | SyncResultscxx . . $ Buteo/SyncResults#SyncResults(73d5304a4441e091).(QDateTimecxx . . $ QDateTime# aTime, MajorCodecxx . . $ Buteo/SyncResults#MajorCode# aMajorCode, MinorCodecxx . . $ Buteo/SyncResults#MinorCode# aMinorCode); |
| 142 | |
| 143 | /*! \brief Constructs sync results from XML. |
| 144 | * |
| 145 | * \param aRoot Root element of the XML representation. |
| 146 | */ |
| 147 | explicit SyncResultscxx . . $ Buteo/SyncResults#SyncResults(d2dcf726a9946ae8).(const QDomElementcxx . . $ QDomElement# &aRoot); |
| 148 | |
| 149 | /*! \brief Destructor. |
| 150 | */ |
| 151 | ~cxx . . $ Buteo/SyncResults#`~SyncResults`(ced63f7c635d850d).SyncResultscxx . . $ Buteo/SyncResults#(); |
| 152 | |
| 153 | /*! \brief Assignment operator. |
| 154 | * |
| 155 | * \param aRhs Source. |
| 156 | */ |
| 157 | SyncResultscxx . . $ Buteo/SyncResults# &operatorcxx . . $ Buteo/SyncResults#`operator=`(f7b218073a71bc2e).=(const SyncResultscxx . . $ Buteo/SyncResults# &aRhs); |
| 158 | |
| 159 | /*! \brief Exports the sync results to XML. |
| 160 | * |
| 161 | * \param aDoc Parent document for the created XML elements. The created |
| 162 | * elements are not inserted to the document by this function, but the |
| 163 | * document is still required for creating the elements. |
| 164 | * \return Root element of the created XML. |
| 165 | */ |
| 166 | QDomElementcxx . . $ QDomElement# toXmlcxx . . $ Buteo/SyncResults#toXml(f12f6d4cd5f05c29).(QDomDocumentcxx . . $ QDomDocument# &aDoc) const; |
| 167 | |
| 168 | /*! \brief Exports the sync results to QString. |
| 169 | * |
| 170 | * \return return the Results as xml formatted string |
| 171 | */ |
| 172 | QStringcxx . . $ QString# toStringcxx . . $ Buteo/SyncResults#toString(6ef7b6c27b00b43d).() const; |
| 173 | |
| 174 | /*! \brief Gets the results of all targets. |
| 175 | * |
| 176 | * \return List of target results. |
| 177 | */ |
| 178 | QListcxx . . $ QList#<TargetResultscxx . . $ Buteo/TargetResults#> targetResultscxx . . $ Buteo/SyncResults#targetResults(5ee8a5527ab872ee).() const; |
| 179 | |
| 180 | /*! \brief Adds target results to this object. |
| 181 | * |
| 182 | * \param aResults The target results to add. |
| 183 | */ |
| 184 | void addTargetResultscxx . . $ Buteo/SyncResults#addTargetResults(ef87cfbb2733fe70).(const TargetResultscxx . . $ Buteo/TargetResults# &aResults); |
| 185 | |
| 186 | /*! \brief Gets the sync time. |
| 187 | * |
| 188 | * \return Sync time. |
| 189 | */ |
| 190 | QDateTimecxx . . $ QDateTime# syncTimecxx . . $ Buteo/SyncResults#syncTime(4e062b5c490497ac).() const; |
| 191 | |
| 192 | /*! \brief Gets the result code. |
| 193 | * |
| 194 | * \return major code. |
| 195 | */ |
| 196 | MajorCodecxx . . $ Buteo/SyncResults#MajorCode# majorCodecxx . . $ Buteo/SyncResults#majorCode(f052dcbe7c8cd3aa).() const; |
| 197 | |
| 198 | /*! \brief Sets the result code. |
| 199 | * |
| 200 | * \param aMajorCode The result code. |
| 201 | */ |
| 202 | void setMajorCodecxx . . $ Buteo/SyncResults#setMajorCode(577cc0423004df11).(MajorCodecxx . . $ Buteo/SyncResults#MajorCode# aMajorCode); |
| 203 | |
| 204 | /*! \brief Gets the failed reason. |
| 205 | * |
| 206 | * \return failed Reason. |
| 207 | */ |
| 208 | MinorCodecxx . . $ Buteo/SyncResults#MinorCode# minorCodecxx . . $ Buteo/SyncResults#minorCode(9f21cc5d73282ba7).() const; |
| 209 | |
| 210 | /*! \brief Sets the failed Reason. |
| 211 | * |
| 212 | * \param aMinorCode - minor code or the reason |
| 213 | */ |
| 214 | void setMinorCodecxx . . $ Buteo/SyncResults#setMinorCode(a1e0a569b12ccaa).(MinorCodecxx . . $ Buteo/SyncResults#MinorCode# aMinorCode); |
| 215 | |
| 216 | |
| 217 | /*! \brief Sets the remote target Id. |
| 218 | * |
| 219 | * \param aTargetId The remote device Id. |
| 220 | */ |
| 221 | void setTargetIdcxx . . $ Buteo/SyncResults#setTargetId(3520e46b33348bf6).(const QStringcxx . . $ QString# &aTargetId); |
| 222 | |
| 223 | /*! \brief Gets the remote target Id. |
| 224 | */ |
| 225 | QStringcxx . . $ QString# getTargetIdcxx . . $ Buteo/SyncResults#getTargetId(6ef7b6c27b00b43d).() const; |
| 226 | |
| 227 | /*! \brief Compares two results objects by sync time. |
| 228 | * |
| 229 | * The object with earlier sync time is smaller. |
| 230 | * \param aOther Point of comparison. |
| 231 | */ |
| 232 | bool operatorcxx . . $ Buteo/SyncResults#`operator<`(930767daa870e2).<(const SyncResultscxx . . $ Buteo/SyncResults# &aOther) const; |
| 233 | |
| 234 | /*! \brief Sets if the results are from a scheduled sync. |
| 235 | * |
| 236 | * \param aScheduled True if this is a scheduled sync. |
| 237 | */ |
| 238 | void setScheduledcxx . . $ Buteo/SyncResults#setScheduled(b45ddcbc8423892c).(bool aScheduled); |
| 239 | |
| 240 | /*! \brief Checks if the results are from a scheduled sync. |
| 241 | * |
| 242 | * \return True if scheduled. |
| 243 | */ |
| 244 | bool isScheduledcxx . . $ Buteo/SyncResults#isScheduled(50ce9a9e25b4a850).() const; |
| 245 | |
| 246 | private: |
| 247 | QVariantListcxx . . $ QVariantList# variantTargetResultscxx . . $ Buteo/SyncResults#variantTargetResults(a208304be85d9b76).() const; |
| 248 | QSharedPointercxx . . $ QSharedPointer#<SyncResultsPrivatecxx . . $ Buteo/SyncResultsPrivate#> d_ptrcxx . . $ Buteo/SyncResults#d_ptr.; |
| 249 | |
| 250 | #ifdef SYNCFW_UNIT_TESTScxx . . $ `<built-in>:480:9`! |
| 251 | friend class ClientThreadTestcxx . . $ Buteo/ClientThreadTest#; |
| 252 | #endif |
| 253 | }; |
| 254 | |
| 255 | } |
| 256 | |
| 257 | Q_DECLARE_METATYPEcxx . . $ `<external>/17491093664533580526/qmetatype.h:2056:9`!(Buteo::SyncResults) |
| 258 | |
| 259 | #endif // SYNCRESULTS_H_2 |