1/* qeventloopinteractor.h
2 Copyright (C) 2003 Klarälvdalens Datakonsult AB
3
4 This file is part of QGPGME.
5
6 QGPGME is free software; you can redistribute it and/or modify it
7 under the terms of the GNU Library General Public License as published
8 by the Free Software Foundation; either version 2 of the License, or
9 (at your option) any later version.
10
11 QGPGME is distributed in the hope that it will be useful, but
12 WITHOUT ANY WARRANTY; without even the implied warranty of
13 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 GNU 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 QGPGME; see the file COPYING.LIB. If not, write to the
18 Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
19 Boston, MA 02110-1301, USA. */
20
21// -*- c++ -*-
22#ifndef __QGPGME_EVENTLOOPINTERACTOR_H__
23#define __QGPGME_EVENTLOOPINTERACTOR_H__
24
25#include "qgpgme_export.h"
26#include <gpgme++/eventloopinteractor.h>
27
28#include <QtCore/QObject>
29
30namespace GpgME {
31 class Context;
32 class Error;
33 class TrustItem;
34 class Key;
35} // namespace GpgME
36
37namespace QGpgME {
38
39 class QGPGME_EXPORT EventLoopInteractor : public QObject, public GpgME::EventLoopInteractor {
40 Q_OBJECT
41 protected:
42 explicit EventLoopInteractor( QObject * parent=0 );
43 public:
44 virtual ~EventLoopInteractor();
45
46 static EventLoopInteractor * instance();
47
48 Q_SIGNALS:
49 void nextTrustItemEventSignal( GpgME::Context * context, const GpgME::TrustItem & item );
50 void nextKeyEventSignal( GpgME::Context * context, const GpgME::Key & key );
51 void operationDoneEventSignal( GpgME::Context * context, const GpgME::Error & e );
52 void operationStartEventSignal( GpgME::Context * context );
53
54 void aboutToDestroy();
55
56 protected Q_SLOTS:
57 void slotWriteActivity( int socket );
58 void slotReadActivity( int socket );
59
60 protected:
61 //
62 // IO Notification Interface
63 //
64
65 /*! \reimp */
66 void * registerWatcher( int fd, Direction dir, bool & ok );
67 /*! \reimp */
68 void unregisterWatcher( void * tag );
69
70 //
71 // Event Handler Interface
72 //
73
74 /*! \reimp */
75 void nextTrustItemEvent( GpgME::Context * context, const GpgME::TrustItem & item );
76 /*! \reimp */
77 void nextKeyEvent( GpgME::Context * context, const GpgME::Key & key );
78 /*! \reimp */
79 void operationStartEvent( GpgME::Context * context );
80 /*! \reimp */
81 void operationDoneEvent( GpgME::Context * context, const GpgME::Error & e );
82
83 private:
84 class Private;
85 Private * d;
86 static EventLoopInteractor * mSelf;
87 };
88
89} // namespace QGpgME
90
91#endif // __QGPGME_EVENTLOOPINTERACTOR_H__
92
93
94