callbackhandler.h
00001 /* 00002 This file is part of libqopensync. 00003 00004 Copyright (c) 2005 Tobias Koenig <tokoe@kde.org> 00005 00006 This library is free software; you can redistribute it and/or 00007 modify it under the terms of the GNU Library General Public 00008 License as published by the Free Software Foundation; either 00009 version 2 of the License, or (at your option) any later version. 00010 00011 This library is distributed in the hope that it will be useful, 00012 but WITHOUT ANY WARRANTY; without even the implied warranty of 00013 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 00014 Library General Public License for more details. 00015 00016 You should have received a copy of the GNU Library General Public License 00017 along with this library; see the file COPYING.LIB. If not, write to 00018 the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, 00019 Boston, MA 02110-1301, USA. 00020 */ 00021 00022 #ifndef TQSYNC_CALLBACKHANDLER_H 00023 #define TQSYNC_CALLBACKHANDLER_H 00024 00025 #include <libqopensync/syncmapping.h> 00026 #include <libqopensync/syncupdates.h> 00027 00028 #include <tqobject.h> 00029 00030 class OSyncEngine; 00031 class OSyncMapping; 00032 class OSyncChangeUpdate; 00033 class OSyncMappingUpdate; 00034 class OSyncEngineUpdate; 00035 class OSyncMemberUpdate; 00036 00037 class TQCustomEvent; 00038 00039 namespace QSync { 00040 00041 class Engine; 00042 00043 class CallbackHandler : public TQObject 00044 { 00045 Q_OBJECT 00046 TQ_OBJECT 00047 00048 public: 00049 CallbackHandler(); 00050 ~CallbackHandler(); 00051 00052 void setEngine( Engine *engine ); 00053 Engine* engine() const; 00054 00055 signals: 00056 void conflict( QSync::SyncMapping mapping ); 00057 void change( const QSync::SyncChangeUpdate &update ); 00058 void mapping( const QSync::SyncMappingUpdate &update ); 00059 void engine( const QSync::SyncEngineUpdate &update ); 00060 void member( const QSync::SyncMemberUpdate &update ); 00061 00062 protected: 00063 virtual void customEvent( TQCustomEvent *event ); 00064 00065 private: 00066 enum EventType { 00067 ConflictEventType = 4044, 00068 ChangeEventType, 00069 MappingEventType, 00070 EngineEventType, 00071 MemberEventType 00072 }; 00073 00074 class ConflictEvent; 00075 class ChangeEvent; 00076 class MappingEvent; 00077 class EngineEvent; 00078 class MemberEvent; 00079 00080 static void conflict_callback( OSyncEngine*, OSyncMapping*, void* ); 00081 static void change_callback( OSyncEngine*, OSyncChangeUpdate*, void* ); 00082 static void mapping_callback( OSyncMappingUpdate*, void* ); 00083 static void engine_callback( OSyncEngine*, OSyncEngineUpdate*, void* ); 00084 static void member_callback( OSyncMemberUpdate*, void* ); 00085 00086 Engine* mEngine; 00087 }; 00088 00089 } 00090 00091 #endif