eventloopinteractor.h
00001 /* qeventloopinteractor.h 00002 Copyright (C) 2003 Klarälvdalens Datakonsult AB 00003 00004 This file is part of QGPGME. 00005 00006 QGPGME is free software; you can redistribute it and/or modify it 00007 under the terms of the GNU Library General Public License as published 00008 by the Free Software Foundation; either version 2 of the License, or 00009 (at your option) any later version. 00010 00011 QGPGME is distributed in the hope that it will be useful, but 00012 WITHOUT ANY WARRANTY; without even the implied warranty of 00013 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 00014 GNU 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 QGPGME; see the file COPYING.LIB. If not, write to the 00018 Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, 00019 Boston, MA 02110-1301, USA. */ 00020 00021 // -*- c++ -*- 00022 #ifndef __QGPGME_EVENTLOOPINTERACTOR_H__ 00023 #define __QGPGME_EVENTLOOPINTERACTOR_H__ 00024 00025 #include "qgpgme_export.h" 00026 #include <gpgme++/eventloopinteractor.h> 00027 00028 #include <QtCore/QObject> 00029 00030 namespace GpgME { 00031 class Context; 00032 class Error; 00033 class TrustItem; 00034 class Key; 00035 } // namespace GpgME 00036 00037 namespace QGpgME { 00038 00039 class QGPGME_EXPORT EventLoopInteractor : public QObject, public GpgME::EventLoopInteractor { 00040 Q_OBJECT 00041 protected: 00042 explicit EventLoopInteractor( QObject * parent=0 ); 00043 public: 00044 virtual ~EventLoopInteractor(); 00045 00046 static EventLoopInteractor * instance(); 00047 00048 Q_SIGNALS: 00049 void nextTrustItemEventSignal( GpgME::Context * context, const GpgME::TrustItem & item ); 00050 void nextKeyEventSignal( GpgME::Context * context, const GpgME::Key & key ); 00051 void operationDoneEventSignal( GpgME::Context * context, const GpgME::Error & e ); 00052 void operationStartEventSignal( GpgME::Context * context ); 00053 00054 void aboutToDestroy(); 00055 00056 protected Q_SLOTS: 00057 void slotWriteActivity( int socket ); 00058 void slotReadActivity( int socket ); 00059 00060 protected: 00061 // 00062 // IO Notification Interface 00063 // 00064 00066 void * registerWatcher( int fd, Direction dir, bool & ok ); 00068 void unregisterWatcher( void * tag ); 00069 00070 // 00071 // Event Handler Interface 00072 // 00073 00075 void nextTrustItemEvent( GpgME::Context * context, const GpgME::TrustItem & item ); 00077 void nextKeyEvent( GpgME::Context * context, const GpgME::Key & key ); 00079 void operationStartEvent( GpgME::Context * context ); 00081 void operationDoneEvent( GpgME::Context * context, const GpgME::Error & e ); 00082 00083 private: 00084 class Private; 00085 Private * d; 00086 static EventLoopInteractor * mSelf; 00087 }; 00088 00089 } // namespace QGpgME 00090 00091 #endif // __QGPGME_EVENTLOOPINTERACTOR_H__ 00092 00093