callbackhandler.h
1 /*
2  This file is part of libqopensync.
3 
4  Copyright (c) 2005 Tobias Koenig <tokoe@kde.org>
5 
6  This library is free software; you can redistribute it and/or
7  modify it under the terms of the GNU Library General Public
8  License as published by the Free Software Foundation; either
9  version 2 of the License, or (at your option) any later version.
10 
11  This library is distributed in the hope that it will be useful,
12  but WITHOUT ANY WARRANTY; without even the implied warranty of
13  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14  Library General Public License for more details.
15 
16  You should have received a copy of the GNU Library General Public License
17  along with this library; see the file COPYING.LIB. If not, write to
18  the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
19  Boston, MA 02110-1301, USA.
20 */
21 
22 #ifndef TQSYNC_CALLBACKHANDLER_H
23 #define TQSYNC_CALLBACKHANDLER_H
24 
25 #include <libqopensync/syncmapping.h>
26 #include <libqopensync/syncupdates.h>
27 
28 #include <tqobject.h>
29 
30 class OSyncEngine;
31 class OSyncMapping;
32 class OSyncChangeUpdate;
33 class OSyncMappingUpdate;
34 class OSyncEngineUpdate;
35 class OSyncMemberUpdate;
36 
37 class TQCustomEvent;
38 
39 namespace QSync {
40 
41 class Engine;
42 
43 class CallbackHandler : public TQObject
44 {
45  Q_OBJECT
46 
47 
48  public:
49  CallbackHandler();
50  ~CallbackHandler();
51 
52  void setEngine( Engine *engine );
53  Engine* engine() const;
54 
55  signals:
56  void conflict( QSync::SyncMapping mapping );
57  void change( const QSync::SyncChangeUpdate &update );
58  void mapping( const QSync::SyncMappingUpdate &update );
59  void engine( const QSync::SyncEngineUpdate &update );
60  void member( const QSync::SyncMemberUpdate &update );
61 
62  protected:
63  virtual void customEvent( TQCustomEvent *event );
64 
65  private:
66  enum EventType {
67  ConflictEventType = 4044,
68  ChangeEventType,
69  MappingEventType,
70  EngineEventType,
71  MemberEventType
72  };
73 
74  class ConflictEvent;
75  class ChangeEvent;
76  class MappingEvent;
77  class EngineEvent;
78  class MemberEvent;
79 
80  static void conflict_callback( OSyncEngine*, OSyncMapping*, void* );
81  static void change_callback( OSyncEngine*, OSyncChangeUpdate*, void* );
82  static void mapping_callback( OSyncMappingUpdate*, void* );
83  static void engine_callback( OSyncEngine*, OSyncEngineUpdate*, void* );
84  static void member_callback( OSyncMemberUpdate*, void* );
85 
86  Engine* mEngine;
87 };
88 
89 }
90 
91 #endif