summaryrefslogtreecommitdiffstats
path: root/libkdenetwork/qgpgme
diff options
context:
space:
mode:
authorTimothy Pearson <kb9vqf@pearsoncomputing.net>2011-11-16 16:06:07 -0600
committerTimothy Pearson <kb9vqf@pearsoncomputing.net>2011-11-16 16:06:07 -0600
commitbe0ca741fd12897337408d1d7a7d8f5f18e1fac9 (patch)
treeb9fa3458193a17180d8773a0204ee05ae206cd99 /libkdenetwork/qgpgme
parentbbb7afdb6da2969535e7f05715e2cb95cfdc917c (diff)
downloadtdepim-be0ca741fd12897337408d1d7a7d8f5f18e1fac9.tar.gz
tdepim-be0ca741fd12897337408d1d7a7d8f5f18e1fac9.zip
Finish rename from prior commit
Diffstat (limited to 'libkdenetwork/qgpgme')
-rw-r--r--libkdenetwork/qgpgme/CMakeLists.txt41
-rw-r--r--libkdenetwork/qgpgme/Makefile.am18
-rw-r--r--libkdenetwork/qgpgme/dataprovider.cpp107
-rw-r--r--libkdenetwork/qgpgme/dataprovider.h62
-rw-r--r--libkdenetwork/qgpgme/eventloopinteractor.cpp99
-rw-r--r--libkdenetwork/qgpgme/eventloopinteractor.h90
-rw-r--r--libkdenetwork/qgpgme/tests/Makefile.am9
-rw-r--r--libkdenetwork/qgpgme/tests/dataprovidertest.cpp125
8 files changed, 0 insertions, 551 deletions
diff --git a/libkdenetwork/qgpgme/CMakeLists.txt b/libkdenetwork/qgpgme/CMakeLists.txt
deleted file mode 100644
index 1de99beb5..000000000
--- a/libkdenetwork/qgpgme/CMakeLists.txt
+++ /dev/null
@@ -1,41 +0,0 @@
-#################################################
-#
-# (C) 2010-2011 Serghei Amelian
-# serghei (DOT) amelian (AT) gmail.com
-#
-# Improvements and feedback are welcome
-#
-# This file is released under GPL >= 2
-#
-#################################################
-
-include_directories(
- ${CMAKE_CURRENT_BINARY_DIR}
- ${CMAKE_BINARY_DIR}
- ${CMAKE_SOURCE_DIR}/libtdenetwork
- ${CMAKE_SOURCE_DIR}/libtdepim
- ${TDE_INCLUDE_DIR}
- ${TQT_INCLUDE_DIRS}
-)
-
-link_directories(
- ${TQT_LIBRARY_DIRS}
-)
-
-
-##### headers ###################################
-
-install( FILES
- eventloopinteractor.h dataprovider.h
- DESTINATION ${INCLUDE_INSTALL_DIR}/kde/qgpgme )
-
-
-##### qgpgme (shared) ###########################
-
-tde_add_library( qgpgme SHARED AUTOMOC
- SOURCES
- eventloopinteractor.cpp dataprovider.cpp
- VERSION 0.0.0
- LINK gpgme++-shared ${TQT_LIBRARIES}
- DESTINATION ${LIB_INSTALL_DIR}
-)
diff --git a/libkdenetwork/qgpgme/Makefile.am b/libkdenetwork/qgpgme/Makefile.am
deleted file mode 100644
index 108760a05..000000000
--- a/libkdenetwork/qgpgme/Makefile.am
+++ /dev/null
@@ -1,18 +0,0 @@
-SUBDIRS = . tests
-
-INCLUDES = -I$(top_srcdir)/libtdenetwork $(all_includes)
-
-lib_LTLIBRARIES = libqgpgme.la
-
-qgpgmedir = $(includedir)/qgpgme
-qgpgme_HEADERS = eventloopinteractor.h dataprovider.h
-
-libqgpgme_la_SOURCES = eventloopinteractor.cpp dataprovider.cpp
-libqgpgme_la_LDFLAGS = $(all_libraries) $(KDE_RPATH) -no-undefined
-libqgpgme_la_LIBADD = $(LIB_QT) ../gpgmepp/libgpgme++.la
-
-METASOURCES = AUTO
-
-messages:
- $(XGETTEXT) *.cpp *.h -o $(podir)/libqgpgme.pot
-
diff --git a/libkdenetwork/qgpgme/dataprovider.cpp b/libkdenetwork/qgpgme/dataprovider.cpp
deleted file mode 100644
index 052b84c48..000000000
--- a/libkdenetwork/qgpgme/dataprovider.cpp
+++ /dev/null
@@ -1,107 +0,0 @@
-/* dataprovider.cpp
- Copyright (C) 2004 Klarälvdalens Datakonsult AB
-
- This file is part of TQGPGME.
-
- TQGPGME is free software; you can redistribute it and/or modify it
- under the terms of the GNU General Public License as published by
- the Free Software Foundation; either version 2 of the License, or
- (at your option) any later version.
-
- TQGPGME is distributed in the hope that it will be useful, but
- WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- General Public License for more details.
-
- You should have received a copy of the GNU General Public License
- along with TQGPGME; if not, write to the Free Software Foundation,
- Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. */
-
-// -*- c++ -*-
-
-#include <config.h>
-
-#include <qgpgme/dataprovider.h>
-
-#include <string.h>
-#include <errno.h>
-#include <assert.h>
-#include <unistd.h>
-
-static bool resizeAndInit( TQByteArray & ba, size_t newSize ) {
- const size_t oldSize = ba.size();
- bool ok = ba.tqresize( newSize );
- if ( ok )
- memset( ba.data() + oldSize, 0, newSize - oldSize );
- return ok;
-}
-
-QGpgME::TQByteArrayDataProvider::TQByteArrayDataProvider()
- : GpgME::DataProvider(), mOff( 0 ) {}
-
-QGpgME::TQByteArrayDataProvider::TQByteArrayDataProvider( const TQByteArray & initialData )
- : GpgME::DataProvider(), mArray( initialData ), mOff( 0 ) {}
-
-QGpgME::TQByteArrayDataProvider::~TQByteArrayDataProvider() {}
-
-ssize_t QGpgME::TQByteArrayDataProvider::read( void * buffer, size_t bufSize ) {
-#ifndef NDEBUG
- //qDebug( "QGpgME::TQByteArrayDataProvider::read( %p, %d )", buffer, bufSize );
-#endif
- if ( bufSize == 0 )
- return 0;
- if ( mOff >= mArray.size() )
- return 0; // EOF
- size_t amount = TQMIN( bufSize, mArray.size() - mOff );
- assert( amount > 0 );
- memcpy( buffer, mArray.data() + mOff, amount );
- mOff += amount;
- return amount;
-}
-
-ssize_t QGpgME::TQByteArrayDataProvider::write( const void * buffer, size_t bufSize ) {
-#ifndef NDEBUG
- qDebug( "QGpgME::TQByteArrayDataProvider::write( %p, %d )", buffer, bufSize );
-#endif
- if ( bufSize == 0 )
- return 0;
- if ( mOff >= mArray.size() )
- resizeAndInit( mArray, mOff + bufSize );
- if ( mOff >= mArray.size() ) {
- errno = EIO;
- return -1;
- }
- assert( bufSize <= mArray.size() - mOff );
- memcpy( mArray.data() + mOff, buffer, bufSize );
- mOff += bufSize;
- return bufSize;
-}
-
-off_t QGpgME::TQByteArrayDataProvider::seek( off_t offset, int whence ) {
-#ifndef NDEBUG
- qDebug( "QGpgME::TQByteArrayDataProvider::seek( %d, %d )", int(offset), whence );
-#endif
- int newOffset = mOff;
- switch ( whence ) {
- case SEEK_SET:
- newOffset = offset;
- break;
- case SEEK_CUR:
- newOffset += offset;
- break;
- case SEEK_END:
- newOffset = mArray.size() + offset;
- break;
- default:
- errno = EINVAL;
- return (off_t)-1;
- }
- return mOff = newOffset;
-}
-
-void QGpgME::TQByteArrayDataProvider::release() {
-#ifndef NDEBUG
- qDebug( "QGpgME::TQByteArrayDataProvider::release()" );
-#endif
- mArray = TQByteArray();
-}
diff --git a/libkdenetwork/qgpgme/dataprovider.h b/libkdenetwork/qgpgme/dataprovider.h
deleted file mode 100644
index 58c097d1e..000000000
--- a/libkdenetwork/qgpgme/dataprovider.h
+++ /dev/null
@@ -1,62 +0,0 @@
-/* dataprovider.h
- Copyright (C) 2004 Klarälvdalens Datakonsult AB
-
- This file is part of TQGPGME.
-
- TQGPGME is free software; you can redistribute it and/or modify it
- under the terms of the GNU General Public License as published by
- the Free Software Foundation; either version 2 of the License, or
- (at your option) any later version.
-
- TQGPGME is distributed in the hope that it will be useful, but
- WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- General Public License for more details.
-
- You should have received a copy of the GNU General Public License
- along with TQGPGME; if not, write to the Free Software Foundation,
- Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. */
-
-// -*- c++ -*-
-#ifndef __TQGPGME_DATAPROVIDER_H__
-#define __TQGPGME_DATAPROVIDER_H__
-
-#include <gpgmepp/interfaces/dataprovider.h>
-
-#include <tqcstring.h>
-#include <tdepimmacros.h>
-
-namespace QGpgME {
-
- class KDE_EXPORT TQByteArrayDataProvider : public GpgME::DataProvider {
- public:
- TQByteArrayDataProvider();
- TQByteArrayDataProvider( const TQByteArray & initialData );
- ~TQByteArrayDataProvider();
-
- const TQByteArray & data() const { return mArray; }
-
- private:
- // these shall only be accessed through the dataprovider
- // interface, where they're public:
- /*! \reimp */
- bool isSupported( Operation ) const { return true; }
- /*! \reimp */
- ssize_t read( void * buffer, size_t bufSize );
- /*! \reimp */
- ssize_t write( const void * buffer, size_t bufSize );
- /*! \reimp */
- off_t seek( off_t offset, int whence );
- /*! \reimp */
- void release();
-
- private:
- TQByteArray mArray;
- off_t mOff;
- };
-
-} // namespace QGpgME
-
-#endif // __TQGPGME_EVENTLOOPINTERACTOR_H__
-
-
diff --git a/libkdenetwork/qgpgme/eventloopinteractor.cpp b/libkdenetwork/qgpgme/eventloopinteractor.cpp
deleted file mode 100644
index fdf25af04..000000000
--- a/libkdenetwork/qgpgme/eventloopinteractor.cpp
+++ /dev/null
@@ -1,99 +0,0 @@
-/* qeventloopinteractor.cpp
- Copyright (C) 2003 Klarälvdalens Datakonsult AB
-
- This file is part of TQGPGME.
-
- TQGPGME is free software; you can redistribute it and/or modify it
- under the terms of the GNU General Public License as published by
- the Free Software Foundation; either version 2 of the License, or
- (at your option) any later version.
-
- TQGPGME is distributed in the hope that it will be useful, but
- WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- General Public License for more details.
-
- You should have received a copy of the GNU General Public License
- along with TQGPGME; if not, write to the Free Software Foundation,
- Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. */
-
-// -*- c++ -*-
-
-#ifdef HAVE_CONFIG_H
-#include <config.h>
-#endif
-
-#include <qgpgme/eventloopinteractor.h>
-
-#include <gpgmepp/context.h>
-
-#include <tqsocketnotifier.h>
-#include <tqapplication.h>
-
-using namespace GpgME;
-
-QGpgME::EventLoopInteractor::EventLoopInteractor( TQObject * parent, const char * name )
- : TQObject( parent, name ), GpgME::EventLoopInteractor()
-{
- if ( !parent )
- if ( tqApp ) {
- connect( tqApp, TQT_SIGNAL(aboutToQuit()), TQT_SLOT(deleteLater()) );
- connect( tqApp, TQT_SIGNAL(aboutToQuit()), TQT_SIGNAL(aboutToDestroy()) );
- }
- mSelf = this;
-}
-
-QGpgME::EventLoopInteractor::~EventLoopInteractor() {
- emit aboutToDestroy();
- mSelf = 0;
-}
-
-QGpgME::EventLoopInteractor * QGpgME::EventLoopInteractor::mSelf = 0;
-
-QGpgME::EventLoopInteractor * QGpgME::EventLoopInteractor::instance() {
- if ( !mSelf )
-#ifndef NDEBUG
- if ( !tqApp )
- qWarning( "QGpgME::EventLoopInteractor: Need a TQApplication object before calling instance()!" );
- else
-#endif
- (void)new EventLoopInteractor( 0, "QGpgME::EventLoopInteractor::instance()" );
- return mSelf;
-}
-
-void * QGpgME::EventLoopInteractor::registerWatcher( int fd, Direction dir, bool & ok ) {
- TQSocketNotifier * sn = new TQSocketNotifier( fd,
- dir == Read ? TQSocketNotifier::Read : TQSocketNotifier::Write );
- if ( dir == Read )
- connect( sn, TQT_SIGNAL(activated(int)), TQT_SLOT(slotReadActivity(int)) );
- else
- connect( sn, TQT_SIGNAL(activated(int)), TQT_SLOT(slotWriteActivity(int)) );
- ok = true; // Can above operations fails?
- return sn;
-}
-
-void QGpgME::EventLoopInteractor::unregisterWatcher( void * tag ) {
- delete static_cast<TQSocketNotifier*>( tag );
-}
-
-void QGpgME::EventLoopInteractor::slotWriteActivity( int socket ) {
- actOn( socket , Write );
-}
-
-void QGpgME::EventLoopInteractor::slotReadActivity( int socket ) {
- actOn( socket , Read );
-}
-
-void QGpgME::EventLoopInteractor::nextTrustItemEvent( GpgME::Context * context, const GpgME::TrustItem & item ) {
- emit nextTrustItemEventSignal( context, item );
-}
-
-void QGpgME::EventLoopInteractor::nextKeyEvent( GpgME::Context * context, const GpgME::Key & key ) {
- emit nextKeyEventSignal( context, key );
-}
-
-void QGpgME::EventLoopInteractor::operationDoneEvent( GpgME::Context * context, const GpgME::Error & e ) {
- emit operationDoneEventSignal( context, e );
-}
-
-#include "eventloopinteractor.moc"
diff --git a/libkdenetwork/qgpgme/eventloopinteractor.h b/libkdenetwork/qgpgme/eventloopinteractor.h
deleted file mode 100644
index c1e5859a4..000000000
--- a/libkdenetwork/qgpgme/eventloopinteractor.h
+++ /dev/null
@@ -1,90 +0,0 @@
-/* qeventloopinteractor.h
- Copyright (C) 2003 Klarälvdalens Datakonsult AB
-
- This file is part of TQGPGME.
-
- TQGPGME is free software; you can redistribute it and/or modify it
- under the terms of the GNU General Public License as published by
- the Free Software Foundation; either version 2 of the License, or
- (at your option) any later version.
-
- TQGPGME is distributed in the hope that it will be useful, but
- WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- General Public License for more details.
-
- You should have received a copy of the GNU General Public License
- along with TQGPGME; if not, write to the Free Software Foundation,
- Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. */
-
-// -*- c++ -*-
-#ifndef __TQGPGME_EVENTLOOPINTERACTOR_H__
-#define __TQGPGME_EVENTLOOPINTERACTOR_H__
-
-#include <gpgmepp/eventloopinteractor.h>
-
-#include <tqobject.h>
-#include <tdepimmacros.h>
-
-namespace GpgME {
- class Context;
- class Error;
- class TrustItem;
- class Key;
-} // namespace GpgME
-
-namespace QGpgME {
-
- class KDE_EXPORT EventLoopInteractor : public TQObject, public GpgME::EventLoopInteractor {
- Q_OBJECT
- TQ_OBJECT
- protected:
- EventLoopInteractor( TQObject * parent, const char * name=0 );
- public:
- virtual ~EventLoopInteractor();
-
- static EventLoopInteractor * instance();
-
- signals:
- void nextTrustItemEventSignal( GpgME::Context * context, const GpgME::TrustItem & item );
- void nextKeyEventSignal( GpgME::Context * context, const GpgME::Key & key );
- void operationDoneEventSignal( GpgME::Context * context, const GpgME::Error & e );
-
- void aboutToDestroy();
-
- protected slots:
- void slotWriteActivity( int socket );
- void slotReadActivity( int socket );
-
- protected:
- //
- // IO Notification Interface
- //
-
- /*! \reimp */
- void * registerWatcher( int fd, Direction dir, bool & ok );
- /*! \reimp */
- void unregisterWatcher( void * tag );
-
- //
- // Event Handler Interface
- //
-
- /*! \reimp */
- void nextTrustItemEvent( GpgME::Context * context, const GpgME::TrustItem & item );
- /*! \reimp */
- void nextKeyEvent( GpgME::Context * context, const GpgME::Key & key );
- /*! \reimp */
- void operationDoneEvent( GpgME::Context * context, const GpgME::Error & e );
-
- private:
- class Private;
- Private * d;
- static EventLoopInteractor * mSelf;
- };
-
-} // namespace QGpgME
-
-#endif // __TQGPGME_EVENTLOOPINTERACTOR_H__
-
-
diff --git a/libkdenetwork/qgpgme/tests/Makefile.am b/libkdenetwork/qgpgme/tests/Makefile.am
deleted file mode 100644
index 5c2436d04..000000000
--- a/libkdenetwork/qgpgme/tests/Makefile.am
+++ /dev/null
@@ -1,9 +0,0 @@
-INCLUDES = -I$(top_srcdir)/libtdenetwork $(GPGME_CFLAGS) $(all_includes)
-
-check_PROGRAMS = dataprovidertest
-
-TESTS = $(check_PROGRAMS)
-
-dataprovidertest_SOURCES = dataprovidertest.cpp
-
-LDADD = ../libqgpgme.la #?$(LIB_QT)
diff --git a/libkdenetwork/qgpgme/tests/dataprovidertest.cpp b/libkdenetwork/qgpgme/tests/dataprovidertest.cpp
deleted file mode 100644
index 675c85ea8..000000000
--- a/libkdenetwork/qgpgme/tests/dataprovidertest.cpp
+++ /dev/null
@@ -1,125 +0,0 @@
-/* tests/dataprovidertest.cpp
- Copyright (C) 2004 Klarälvdalens Datakonsult AB
-
- This file is part of TQGPGME's regression test suite.
-
- TQGPGME is free software; you can redistribute it and/or modify it
- under the terms of the GNU General Public License as published by
- the Free Software Foundation; either version 2 of the License, or
- (at your option) any later version.
-
- TQGPGME is distributed in the hope that it will be useful, but
- WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- General Public License for more details.
-
- You should have received a copy of the GNU General Public License
- along with TQGPGME; if not, write to the Free Software Foundation,
- Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. */
-
-// -*- c++ -*-
-
-#ifdef NDEBUG
-#undef NDEBUG
-#endif
-
-#ifdef HAVE_CONFIG_H
-#include <config.h>
-#endif
-
-#include <qgpgme/dataprovider.h>
-#include <gpgmepp/data.h>
-#include <gpgmepp/data_p.h>
-#include <gpgme.h>
-
-#include <iostream>
-
-#include <string.h>
-#include <unistd.h>
-#include <assert.h>
-#include <errno.h>
-#include <stdlib.h>
-
-using namespace GpgME;
-
-static const char input[] = "foo bar baz\0foo bar baz";
-static const size_t inputSize = sizeof (input) / sizeof (*input) - 1;
-static const char nulls[256] = { '\0' };
-
-#define assertEqual( expr, expected ) \
-do { \
- long long foo = (expr); \
- if ( foo != (long long)expected ) { \
- std::cerr << #expr << ": expected " << expected << "; got " << foo \
- << ";errno: " << errno << "(" << strerror( errno ) << ")" << std::endl; \
- exit( 1 ); \
- } \
-} while( 0 )
-
-int main( int, char** ) {
-
- {
- //
- // TQByteArrayDataProvider
- //
-
- // writing:
- QGpgME::TQByteArrayDataProvider qba_dp;
- Data data( &qba_dp );
-
- assertEqual( data.write( input, inputSize ), inputSize );
-
- const TQByteArray ba1 = qba_dp.data();
- assertEqual( ba1.size(), inputSize );
- assertEqual( memcmp( ba1.data(), input, inputSize ), 0 );
-
- // seeking and reading:
- assertEqual( data.seek( 0, SEEK_CUR ), inputSize );
- assertEqual( data.seek( 4, SEEK_SET ), 4 );
- char ch = '\0';
- assertEqual( data.read( &ch, 1 ), 1 );
- assertEqual( ch, input[4] );
- assertEqual( data.read( &ch, 1 ), 1 );
- assertEqual( ch, input[5] );
-
- char buf[ inputSize + 10 ] = { '\0' };
- assertEqual( data.seek( 0, SEEK_SET ), 0 );
- assertEqual( data.read( buf, sizeof buf ), inputSize );
- assertEqual( memcmp( buf, input, inputSize ), 0 );
-
- // writing single char at end:
- assertEqual( data.seek( 0, SEEK_END ), inputSize );
- assertEqual( data.write( &ch, 1 ) , 1 );
- const TQByteArray ba2 = qba_dp.data();
- assertEqual( ba2.size(), inputSize + 1 );
- assertEqual( memcmp( ba2.data(), input, inputSize ), 0 );
- assertEqual( ba2[inputSize], ch );
-
- // writing past end of buffer:
- assertEqual( data.seek( 10, SEEK_END ), inputSize + 11 );
- assertEqual( data.write( &ch, 1 ), 1 );
- const TQByteArray ba3 = qba_dp.data();
- assertEqual( ba3.size(), inputSize + 12 );
- assertEqual( memcmp( ba3.data(), input, inputSize ), 0 );
- assertEqual( ba3[inputSize], ch );
- assertEqual( ba3[inputSize+11], ch );
- assertEqual( memcmp( ba3.data() + inputSize + 1, nulls, 10 ), 0 );
- }
-
- {
- //
- // TQByteArrayDataProvider with initial data:
- //
- TQByteArray ba;
- ba.duplicate( input, inputSize );
- QGpgME::TQByteArrayDataProvider qba_dp( ba );
- Data data( &qba_dp );
-
- assertEqual( data.seek( 0, SEEK_END ), inputSize );
- assertEqual( data.seek( 0, SEEK_SET ), 0 );
- const TQByteArray ba1 = qba_dp.data();
- assertEqual( ba1.size(), inputSize );
- assertEqual( memcmp( ba1.data(), input, inputSize ), 0 );
- }
- return 0;
-}