kitchensync
threadedkonnector.cpp00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022 #include <kdebug.h>
00023 #include <kgenericfactory.h>
00024 #include <kconfig.h>
00025 #include <konnectorinfo.h>
00026
00027 #include "clientmanager.h"
00028
00029 #include "threadedkonnector.h"
00030 #include "konnectorconfig.h"
00031
00032 using namespace KSync;
00033 using namespace Threaded;
00034
00035 extern "C"
00036 {
00037 void *init_libthreadedkonnector()
00038 {
00039 KGlobal::locale()->insertCatalogue( "konnector_threaded" );
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
00049
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
00061 return SynceeList;
00062 }
00063
00064 ThreadedPlugin::~ThreadedPlugin() {
00065 kdDebug() << __PRETTY_FUNCTION__ << " this = " << this << endl;
00066 mClientManager.terminate();
00067 mClientManager.wait();
00068 }
00069
00070 bool ThreadedPlugin::readSyncees() {
00071 kdDebug() << __PRETTY_FUNCTION__ << " this = " << this << endl;
00072 return mClientManager.readSyncees();
00073 }
00074
00075 bool ThreadedPlugin::writeSyncees() {
00076 kdDebug() << __PRETTY_FUNCTION__ << " this = " << this << endl;
00077 return mClientManager.writeSyncees();
00078 }
00079
00080 bool ThreadedPlugin::connectDevice() {
00081 kdDebug() << __PRETTY_FUNCTION__ << " this = " << this << endl;
00082 return mClientManager.connectDevice();
00083 }
00084
00085 bool ThreadedPlugin::disconnectDevice() {
00086 kdDebug() << __PRETTY_FUNCTION__ << " this = " << this << endl;
00087 return mClientManager.disconnectDevice();
00088 }
00089
00090 KSync::KonnectorInfo ThreadedPlugin::info() const {
00091 kdDebug() << __PRETTY_FUNCTION__ << " this = " << this << endl;
00092 return KSync::KonnectorInfo();
00093 }
00094
00095 void ThreadedPlugin::download( const QString& ) {
00096 kdDebug() << __PRETTY_FUNCTION__ << " this = " << this << endl;
00097 }
00098
00099 void ThreadedPlugin::slotFinished() {
00100 kdDebug() << __PRETTY_FUNCTION__ << " this = " << this << endl;
00101 progress( KSync::StdProgress::done() );
00102 }
00103
00104 void ThreadedPlugin::slotError( const KSync::Error& e ) {
00105 kdDebug() << __PRETTY_FUNCTION__ << " this = " << this << endl;
00106 error( e );
00107 }
00108
00109 void ThreadedPlugin::slotProgress( const KSync::Progress& p ) {
00110 kdDebug() << __PRETTY_FUNCTION__ << " this = " << this << endl;
00111 progress( p );
00112 }
00113
00114 #include "threadedkonnector.moc"
|