Buteo Synchronization Framework
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, MajorCode aMajorCode, MinorCode 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  MajorCode majorCode() const;
185 
190  void setMajorCode(MajorCode aMajorCode);
191 
196  MinorCode minorCode() const;
197 
202  void setMinorCode(MinorCode 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
Contains information about a completed synchronization session.
Definition: SyncResults.h:59
void setScheduled(bool aScheduled)
Sets if the results are from a scheduled sync.
Definition: SyncResults.cpp:213
QString getTargetId() const
Gets the remote target Id.
Definition: SyncResults.cpp:203
void setMajorCode(MajorCode aMajorCode)
Sets the result code.
Definition: SyncResults.cpp:181
MinorCode minorCode() const
Gets the failed reason.
Definition: SyncResults.cpp:187
MajorCode
enum value
Definition: SyncResults.h:66
void setTargetId(const QString &aTargetId)
Sets the remote target Id.
Definition: SyncResults.cpp:198
MajorCode majorCode() const
Gets the result code.
Definition: SyncResults.cpp:176
void setMinorCode(MinorCode aMinorCode)
Sets the failed Reason.
Definition: SyncResults.cpp:192
bool operator<(const SyncResults &aOther) const
Compares two results objects by sync time.
Definition: SyncResults.cpp:208
bool isScheduled() const
Checks if the results are from a scheduled sync.
Definition: SyncResults.cpp:218
QString toString() const
Exports the sync results to QString.
Definition: SyncResults.cpp:147
void addTargetResults(const TargetResults &aResults)
Adds target results to this object.
Definition: SyncResults.cpp:166
SyncResults()
Constructs an empty sync results object.
Definition: SyncResults.cpp:82
SyncResults & operator=(const SyncResults &aRhs)
Assignment operator.
Definition: SyncResults.cpp:121
QDateTime syncTime() const
Gets the sync time.
Definition: SyncResults.cpp:171
MinorCode
enum value
Definition: SyncResults.h:77
QDomElement toXml(QDomDocument &aDoc) const
Exports the sync results to XML.
Definition: SyncResults.cpp:131
~SyncResults()
Destructor.
Definition: SyncResults.cpp:115
QList< TargetResults > targetResults() const
Gets the results of all targets.
Definition: SyncResults.cpp:161
Sync results for one target.
Definition: TargetResults.h:61
Definition: SyncBackupAdaptor.h:40
Definition: SyncResults.h:35
int iLocalItemsModified
Definition: SyncResults.h:38
int iRemoteItemsAdded
Definition: SyncResults.h:41
int iRemoteItemsDeleted
Definition: SyncResults.h:43
int iLocalItemsAdded
Definition: SyncResults.h:37
int iLocalItemsDeleted
Definition: SyncResults.h:39
int iRemoteItemsModified
Definition: SyncResults.h:42