kitchensync

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 QSYNC_CALLBACKHANDLER_H
00023 #define QSYNC_CALLBACKHANDLER_H
00024 
00025 #include <libqopensync/syncmapping.h>
00026 #include <libqopensync/syncupdates.h>
00027 
00028 #include <qobject.h>
00029 
00030 class OSyncEngine;
00031 class OSyncMapping;
00032 class OSyncChangeUpdate;
00033 class OSyncMappingUpdate;
00034 class OSyncEngineUpdate;
00035 class OSyncMemberUpdate;
00036 
00037 class QCustomEvent;
00038 
00039 namespace QSync {
00040 
00041 class Engine;
00042 
00043 class CallbackHandler : public QObject
00044 {
00045   Q_OBJECT
00046 
00047   public:
00048     CallbackHandler();
00049     ~CallbackHandler();
00050 
00051     void setEngine( Engine *engine );
00052     Engine* engine() const;
00053 
00054   signals:
00055     void conflict( QSync::SyncMapping mapping );
00056     void change( const QSync::SyncChangeUpdate &update );
00057     void mapping( const QSync::SyncMappingUpdate &update );
00058     void engine( const QSync::SyncEngineUpdate &update );
00059     void member( const QSync::SyncMemberUpdate &update );
00060 
00061   protected:
00062     virtual void customEvent( QCustomEvent *event );
00063 
00064   private:
00065     enum EventType {
00066       ConflictEventType = 4044,
00067       ChangeEventType,
00068       MappingEventType,
00069       EngineEventType,
00070       MemberEventType
00071     };
00072 
00073     class ConflictEvent;
00074     class ChangeEvent;
00075     class MappingEvent;
00076     class EngineEvent;
00077     class MemberEvent;
00078 
00079     static void conflict_callback( OSyncEngine*, OSyncMapping*, void* );
00080     static void change_callback( OSyncEngine*, OSyncChangeUpdate*, void* );
00081     static void mapping_callback( OSyncMappingUpdate*, void* );
00082     static void engine_callback( OSyncEngine*, OSyncEngineUpdate*, void* );
00083     static void member_callback( OSyncMemberUpdate*, void* );
00084 
00085     Engine* mEngine;
00086 };
00087 
00088 }
00089 
00090 #endif
KDE Home | KDE Accessibility Home | Description of Access Keys