qgpgme
eventloopinteractor_unix.cpp
00001 /* qeventloopinteractor.cpp 00002 Copyright (C) 2003, 2007 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 00023 #include <qgpgme/eventloopinteractor.h> 00024 00025 #include <QSocketNotifier> 00026 00027 void * QGpgME::EventLoopInteractor::registerWatcher( int fd, Direction dir, bool & ok ) { 00028 QSocketNotifier * const sn = new QSocketNotifier( fd, dir == Read ? QSocketNotifier::Read : QSocketNotifier::Write ); 00029 if( dir == Read ) 00030 connect( sn, SIGNAL(activated(int)), this, SLOT(slotReadActivity(int)) ); 00031 else 00032 connect( sn, SIGNAL(activated(int)), this, SLOT(slotWriteActivity(int)) ); 00033 ok = true; // Can above operations fails? 00034 return sn; 00035 } 00036 00037 void QGpgME::EventLoopInteractor::unregisterWatcher( void * tag ) { 00038 static_cast<QSocketNotifier*>( tag )->deleteLater(); 00039 }
This file is part of the KDE documentation.
Documentation copyright © 1996-2012 The KDE developers.
Generated on Mon Aug 27 2012 22:08:58 by doxygen 1.7.5 written by Dimitri van Heesch, © 1997-2006
Documentation copyright © 1996-2012 The KDE developers.
Generated on Mon Aug 27 2012 22:08:58 by doxygen 1.7.5 written by Dimitri van Heesch, © 1997-2006
KDE's Doxygen guidelines are available online.