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 
45  DatabaseResults() : iLocalItemsAdded( 0 ), iLocalItemsModified( 0 ), iLocalItemsDeleted( 0 ),
46  iRemoteItemsAdded( 0 ), iRemoteItemsModified( 0 ), iRemoteItemsDeleted( 0 ) { }
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 
91  // Server/Network errors 5xx
92  SUSPENDED = 501,
93  ABORTED,
94  CONNECTION_ERROR,
95  INVALID_SYNCML_MESSAGE,
96  UNSUPPORTED_SYNC_TYPE,
97  UNSUPPORTED_STORAGE_TYPE,
98  //Upto here
99 
100  //Context Error Code
101  LOW_BATTERY_POWER = 601,
102  POWER_SAVING_MODE,
103  OFFLINE_MODE,
104  BACKUP_IN_PROGRESS,
105  LOW_MEMORY
106  };
107 
113  SyncResults();
114 
119  SyncResults(const SyncResults &aSource);
120 
127  SyncResults(QDateTime aTime, int aMajorCode, int aMinorCode);
128 
133  explicit SyncResults(const QDomElement &aRoot);
134 
137  ~SyncResults();
138 
143  SyncResults& operator=(const SyncResults &aRhs);
144 
152  QDomElement toXml(QDomDocument &aDoc) const;
153 
158  QString toString() const;
159 
164  QList<TargetResults> targetResults() const;
165 
170  void addTargetResults(const TargetResults &aResults);
171 
176  QDateTime syncTime() const;
177 
182  int majorCode() const;
183 
188  void setMajorCode(int aMajorCode);
189 
194  int minorCode() const;
195 
200  void setMinorCode(int aMinorCode);
201 
202 
207  void setTargetId(const QString& aTargetId) ;
208 
211  QString getTargetId() const;
212 
218  bool operator<(const SyncResults &aOther) const;
219 
224  void setScheduled(bool aScheduled);
225 
230  bool isScheduled() const;
231 
232 private:
233 
234  SyncResultsPrivate *d_ptr;
235 
236 #ifdef SYNCFW_UNIT_TESTS
237  friend class ClientThreadTest;
238 #endif
239 
240 };
241 
242 }
243 #endif // SYNCRESULTS_H_2
int iRemoteItemsDeleted
Definition: SyncResults.h:43
int iLocalItemsDeleted
Definition: SyncResults.h:39
Contains information about a completed synchronization session.
Definition: SyncResults.h:58
int iLocalItemsModified
Definition: SyncResults.h:38
MinorCode
enum value
Definition: SyncResults.h:77
int iRemoteItemsModified
Definition: SyncResults.h:42
Definition: AccountsHelper.h:31
Sync results for one target.
Definition: TargetResults.h:59
Definition: SyncResults.h:35
MajorCode
enum value
Definition: SyncResults.h:66
int iRemoteItemsAdded
Definition: SyncResults.h:41
int iLocalItemsAdded
Definition: SyncResults.h:37
Definition: SyncBackupAdaptor.h:40