kitchensync Library API Documentation

threadedkonnector.cpp

00001 /*
00002     This file is part of KitchenSync.
00003 
00004     Copyright (c) 2003 Mathias Froehlich <Mathias.Froehlich@web.de>
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., 59 Temple Place - Suite 330,
00019     Boston, MA 02111-1307, USA.
00020 */
00021 
00022 #include <kdebug.h>
00023 #include <kgenericfactory.h>
00024 #include <kconfig.h>
00025 #include <kapabilities.h>
00026 #include <konnectorinfo.h>
00027 
00028 #include "clientmanager.h"
00029 
00030 #include "threadedkonnector.h"
00031 #include "konnectorconfig.h"
00032 
00033 using namespace KSync;
00034 using namespace Threaded;
00035 
00036 extern "C"
00037 {
00038   void *init_libthreadedkonnector()
00039   {
00040     return new KRES::PluginFactory<ThreadedPlugin,ThreadedKonnectorConfig>();
00041   }
00042 }
00043 
00044 ThreadedPlugin::ThreadedPlugin( const KConfig *config )
00045   : Konnector( config ) {
00046   kdDebug() << __PRETTY_FUNCTION__ << " this = " << this << endl;
00047 
00048 //   connect( &mClientManager, SIGNAL(signalThreadTerminated()),
00049 //     SLOT(slotThreadTerminated()) );
00050   connect( &mClientManager, SIGNAL(signalProgress(const KSync::Progress&)),
00051        SLOT(slotProgress(const KSync::Progress&)) );
00052   connect( &mClientManager, SIGNAL(signalError(const KSync::Error&)),
00053        SLOT(slotError(const KSync::Error&)) );
00054   connect( &mClientManager, SIGNAL(signalFinished()),
00055        SLOT(slotFinished()) );
00056 }
00057 
00058 SynceeList ThreadedPlugin::syncees()
00059 {
00060   // TODO: Make this return something useful
00061   return SynceeList;
00062 }
00063 
00064 ThreadedPlugin::~ThreadedPlugin() {
00065   kdDebug() << __PRETTY_FUNCTION__ << " this = " << this << endl;
00066   mClientManager.terminate();
00067   mClientManager.wait();
00068 }
00069 
00070 Kapabilities ThreadedPlugin::capabilities() {
00071   kdDebug() << __PRETTY_FUNCTION__ << " this = " << this << endl;
00072   return Kapabilities();
00073 }
00074 
00075 void ThreadedPlugin::setCapabilities( const KSync::Kapabilities& ) {
00076   kdDebug() << __PRETTY_FUNCTION__ << " this = " << this << endl;
00077 }
00078 
00079 bool ThreadedPlugin::readSyncees() {
00080   kdDebug() << __PRETTY_FUNCTION__ << " this = " << this << endl;
00081   return mClientManager.readSyncees();
00082 }
00083 
00084 bool ThreadedPlugin::writeSyncees() {
00085   kdDebug() << __PRETTY_FUNCTION__ << " this = " << this << endl;
00086   return mClientManager.writeSyncees();
00087 }
00088 
00089 bool ThreadedPlugin::connectDevice() {
00090   kdDebug() << __PRETTY_FUNCTION__ << " this = " << this << endl;
00091   return mClientManager.connectDevice();
00092 }
00093 
00094 bool ThreadedPlugin::disconnectDevice() {
00095   kdDebug() << __PRETTY_FUNCTION__ << " this = " << this << endl;
00096   return mClientManager.disconnectDevice();
00097 }
00098 
00099 KSync::KonnectorInfo ThreadedPlugin::info() const {
00100   kdDebug() << __PRETTY_FUNCTION__ << " this = " << this << endl;
00101   return KSync::KonnectorInfo();
00102 }
00103 
00104 void ThreadedPlugin::download( const QString& ) {
00105   kdDebug() << __PRETTY_FUNCTION__ << " this = " << this << endl;
00106 }
00107 
00108 void ThreadedPlugin::slotFinished() {
00109   kdDebug() << __PRETTY_FUNCTION__ << " this = " << this << endl;
00110   progress( KSync::StdProgress::done() );
00111 }
00112 
00113 void ThreadedPlugin::slotError( const KSync::Error& e ) {
00114   kdDebug() << __PRETTY_FUNCTION__ << " this = " << this << endl;
00115   error( e );
00116 }
00117 
00118 void ThreadedPlugin::slotProgress( const KSync::Progress& p ) {
00119   kdDebug() << __PRETTY_FUNCTION__ << " this = " << this << endl;
00120   progress( p );
00121 }
00122 
00123 #include "threadedkonnector.moc"
KDE Logo
This file is part of the documentation for kitchensync Library Version 3.3.2.
Documentation copyright © 1996-2004 the KDE developers.
Generated on Thu Aug 2 09:54:01 2007 by doxygen 1.4.2 written by Dimitri van Heesch, © 1997-2003