00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021 #ifndef AKONADI_CONFLICTHANDLER_P_H
00022 #define AKONADI_CONFLICTHANDLER_P_H
00023
00024 #include <QtCore/QObject>
00025
00026 #include <akonadi/item.h>
00027
00028 class KJob;
00029
00030 namespace Akonadi {
00031
00032 class Session;
00033
00039 class ConflictHandler : public QObject
00040 {
00041 Q_OBJECT
00042
00043 public:
00048 enum ConflictType
00049 {
00050 LocalLocalConflict,
00051 LocalRemoteConflict,
00052 BackendConflict
00053 };
00054
00058 enum ResolveStrategy
00059 {
00060 UseLocalItem,
00061 UseOtherItem,
00062 UseBothItems
00063 };
00064
00071 explicit ConflictHandler( ConflictType type, QObject *parent = 0 );
00072
00080 void setConflictingItems( const Akonadi::Item &changedItem, const Akonadi::Item &conflictingItem );
00081
00082 public Q_SLOTS:
00086 void start();
00087
00088 Q_SIGNALS:
00093 void conflictResolved();
00094
00101 void error( const QString &message );
00102
00103 private Q_SLOTS:
00104 void slotOtherItemFetched( KJob* );
00105 void slotUseLocalItemFinished( KJob* );
00106 void slotUseBothItemsFinished( KJob* );
00107 void resolve();
00108
00109 private:
00110 void useLocalItem();
00111 void useOtherItem();
00112 void useBothItems();
00113
00114 ConflictType mConflictType;
00115 Akonadi::Item mChangedItem;
00116 Akonadi::Item mConflictingItem;
00117
00118 Session *mSession;
00119 };
00120
00121 }
00122
00123 #endif