ButeoSynchronizationFramework
SyncResults.h
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 <sateesh.kavuri@nokia.com>
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_2
25 
26 #include <QDateTime>
27 #include <QList>
28 #include "TargetResults.h"
29 
30 class QDomDocument;
31 class QDomElement;
32 
33 namespace Buteo {
34 
36 
47 
48 };
49 
50 class SyncResultsPrivate;
51 
59 {
60 public:
61 
66  enum MajorCode {
67  SYNC_RESULT_INVALID = -1,
68  SYNC_RESULT_SUCCESS = 0,
69  SYNC_RESULT_FAILED,
70  SYNC_RESULT_CANCELLED
71  };
72 
77  enum MinorCode {
78 
79  //NO-Error
80  NO_ERROR = 0,
81 
82  //These error codes are mapped to syncAgentConsts.h
83  // Successful 3xx
84  SYNC_FINISHED = 301,
85 
86  // Client/Configuration errors 4xx
87  INTERNAL_ERROR = 401,
88  AUTHENTICATION_FAILURE,
89  DATABASE_FAILURE,
90  PLUGIN_ERROR,
91  PLUGIN_TIMEOUT,
92 
93  // Server/Network errors 5xx
94  SUSPENDED = 501,
95  ABORTED,
96  CONNECTION_ERROR,
97  INVALID_SYNCML_MESSAGE,
98  UNSUPPORTED_SYNC_TYPE,
99  UNSUPPORTED_STORAGE_TYPE,
100  //Upto here
101 
102  //Context Error Code
103  LOW_BATTERY_POWER = 601,
104  POWER_SAVING_MODE,
105  OFFLINE_MODE,
106  BACKUP_IN_PROGRESS,
107  LOW_MEMORY
108  };
109 
115  SyncResults();
116 
121  SyncResults(const SyncResults &aSource);
122 
129  SyncResults(QDateTime aTime, int aMajorCode, int aMinorCode);
130 
135  explicit SyncResults(const QDomElement &aRoot);
136 
139  ~SyncResults();
140 
145  SyncResults& operator=(const SyncResults &aRhs);
146 
154  QDomElement toXml(QDomDocument &aDoc) const;
155 
160  QString toString() const;
161 
167 
172  void addTargetResults(const TargetResults &aResults);
173 
178  QDateTime syncTime() const;
179 
184  int majorCode() const;
185 
190  void setMajorCode(int aMajorCode);
191 
196  int minorCode() const;
197 
202  void setMinorCode(int aMinorCode);
203 
204 
209  void setTargetId(const QString& aTargetId) ;
210 
213  QString getTargetId() const;
214 
220  bool operator<(const SyncResults &aOther) const;
221 
226  void setScheduled(bool aScheduled);
227 
232  bool isScheduled() const;
233 
234 private:
235 
236  SyncResultsPrivate *d_ptr;
237 
238 #ifdef SYNCFW_UNIT_TESTS
239  friend class ClientThreadTest;
240 #endif
241 
242 };
243 
244 }
245 #endif // SYNCRESULTS_H_2
Buteo::DatabaseResults::iLocalItemsAdded
int iLocalItemsAdded
Definition: SyncResults.h:37
Buteo::DatabaseResults
Definition: SyncResults.h:35
Buteo::SyncResults::setMajorCode
void setMajorCode(int aMajorCode)
Sets the result code.
Definition: SyncResults.cpp:187
Buteo::SyncResults::majorCode
int majorCode() const
Gets the result code.
Definition: SyncResults.cpp:182
Buteo::DatabaseResults::iLocalItemsModified
int iLocalItemsModified
Definition: SyncResults.h:38
Buteo::DatabaseResults::iRemoteItemsDeleted
int iRemoteItemsDeleted
Definition: SyncResults.h:43
Buteo::DatabaseResults::iRemoteItemsModified
int iRemoteItemsModified
Definition: SyncResults.h:42
QList
Definition: SyncBackupAdaptor.h:40
Buteo::SyncResults::addTargetResults
void addTargetResults(const TargetResults &aResults)
Adds target results to this object.
Definition: SyncResults.cpp:172
Buteo::SyncResults::~SyncResults
~SyncResults()
Destructor.
Definition: SyncResults.cpp:119
Buteo::SyncResults::isScheduled
bool isScheduled() const
Checks if the results are from a scheduled sync.
Definition: SyncResults.cpp:224
Buteo::SyncResults::minorCode
int minorCode() const
Gets the failed reason.
Definition: SyncResults.cpp:193
Buteo::SyncResults::MajorCode
MajorCode
enum value
Definition: SyncResults.h:66
Buteo::SyncResults::toXml
QDomElement toXml(QDomDocument &aDoc) const
Exports the sync results to XML.
Definition: SyncResults.cpp:136
Buteo::SyncResults::operator=
SyncResults & operator=(const SyncResults &aRhs)
Assignment operator.
Definition: SyncResults.cpp:125
Buteo::SyncResults::setScheduled
void setScheduled(bool aScheduled)
Sets if the results are from a scheduled sync.
Definition: SyncResults.cpp:219
Buteo::SyncResults::SyncResults
SyncResults()
Constructs an empty sync results object.
Definition: SyncResults.cpp:85
Buteo::SyncResults::setMinorCode
void setMinorCode(int aMinorCode)
Sets the failed Reason.
Definition: SyncResults.cpp:198
Buteo::TargetResults
Sync results for one target.
Definition: TargetResults.h:59
Buteo::SyncResults::MinorCode
MinorCode
enum value
Definition: SyncResults.h:77
Buteo::SyncResults::getTargetId
QString getTargetId() const
Gets the remote target Id.
Definition: SyncResults.cpp:209
Buteo::SyncResults::toString
QString toString() const
Exports the sync results to QString.
Definition: SyncResults.cpp:153
Buteo::DatabaseResults::iRemoteItemsAdded
int iRemoteItemsAdded
Definition: SyncResults.h:41
Buteo::SyncResults::targetResults
QList< TargetResults > targetResults() const
Gets the results of all targets.
Definition: SyncResults.cpp:167
Buteo::SyncResults
Contains information about a completed synchronization session.
Definition: SyncResults.h:58
Buteo::DatabaseResults::iLocalItemsDeleted
int iLocalItemsDeleted
Definition: SyncResults.h:39
Buteo::SyncResults::setTargetId
void setTargetId(const QString &aTargetId)
Sets the remote target Id.
Definition: SyncResults.cpp:204
Buteo::SyncResults::operator<
bool operator<(const SyncResults &aOther) const
Compares two results objects by sync time.
Definition: SyncResults.cpp:214
Buteo::SyncResults::syncTime
QDateTime syncTime() const
Gets the sync time.
Definition: SyncResults.cpp:177