kitchensync Library API Documentation

konnector.cpp

00001 #include <kgenericfactory.h> 00002 00003 #include <konnectorinfo.h> 00004 00005 #include "configwidget.h" 00006 #include "socket.h" 00007 #include "konnector.h" 00008 00009 typedef KGenericFactory<KSync::AgendaPlugin, QObject> AgendaKonnectorPlugin; 00010 K_EXPORT_COMPONENT_FACTORY( libagendakonnector, AgendaKonnectorPlugin ) 00011 00012 using namespace KSync; 00013 00014 00015 AgendaPlugin::AgendaPlugin( QObject* obj, const char* name,const QStringList ) 00016 : Konnector( obj, name ) { 00017 m_socket = new AgendaSocket(this); 00018 00019 /* connect the bridge */ 00020 connect(m_socket, SIGNAL(sync(SynceeList) ), 00021 this, SLOT(slotSync(SynceeList) ) ); 00022 connect(m_socket, SIGNAL(error(const Error& ) ), 00023 this, SLOT(slotError(const Error& ) ) ); 00024 connect(m_socket, SIGNAL(prog(const Progress&) ), 00025 this, SLOT(slotProg(const Progress& ) ) ); 00026 } 00027 AgendaPlugin::~AgendaPlugin() { 00028 00029 } 00030 KSync::Kapabilities AgendaPlugin::capabilities() { 00031 KSync::Kapabilities caps; 00032 00033 caps.setSupportMetaSyncing( true ); // we can meta sync 00034 caps.setSupportsPushSync( true ); // we can initialize the sync from here 00035 caps.setNeedsConnection( true ); // we need to have pppd running 00036 caps.setSupportsListDir( true ); // we will support that once there is API for it... 00037 caps.setNeedsIPs( true ); // we need the IP 00038 caps.setNeedsSrcIP( false ); // we do not bind to any address... 00039 caps.setNeedsDestIP( true ); // we need to know where to connect 00040 caps.setAutoHandle( false ); // we currently do not support auto handling 00041 caps.setNeedAuthentication( false ); // HennevL says we do not need that 00042 caps.setNeedsModelName( true ); // we need a name for our meta path! 00043 00044 return caps; 00045 } 00046 void AgendaPlugin::setCapabilities( const KSync::Kapabilities& caps ) { 00047 m_socket->setIP( caps.destIP() ); 00048 m_socket->setMetaName( caps.modelName() ); 00049 m_socket->startUP(); // connect now 00050 } 00051 bool AgendaPlugin::readSyncees() { 00052 m_socket->startSync(); 00053 return true; 00054 } 00055 bool AgendaPlugin::connectDevice() { 00056 m_socket->startUP(); 00057 return true; 00058 } 00059 bool AgendaPlugin::disconnectDevice() { 00060 m_socket->hangUP(); 00061 return true; 00062 } 00063 KSync::KonnectorInfo AgendaPlugin::info()const { 00064 return KonnectorInfo( i18n("Agenda Vr3"), 00065 QIconSet(), 00066 QString::fromLatin1("AgendaVr3"), // same as the .desktop file 00067 m_socket->metaName(), 00068 "agenda", // icon name 00069 m_socket->isConnected() ); 00070 } 00071 void AgendaPlugin::download( const QString& ) { 00072 error( StdError::downloadNotSupported() ); 00073 } 00074 KSync::ConfigWidget* AgendaPlugin::configWidget( const KSync::Kapabilities& cap, QWidget* parent, 00075 const char* name ) { 00076 return new Vr3::ConfigWidget( cap, parent, name ); 00077 } 00078 KSync::ConfigWidget* AgendaPlugin::configWidget( QWidget* parent, const char* name ) { 00079 return new Vr3::ConfigWidget( parent, name ); 00080 } 00081 00082 // bridging!! below 00083 bool AgendaPlugin::writeSyncees() { 00084 m_socket->write( SynceeList() ); 00085 return true; 00086 } 00087 void AgendaPlugin::slotSync( SynceeList lst) { 00088 emit synceesRead( this, lst ); 00089 } 00090 void AgendaPlugin::slotError( const Error& err ) { 00091 error( err ); 00092 } 00093 void AgendaPlugin::slotProg( const Progress& prog ) { 00094 progress( prog ); 00095 } 00096 00097 00098 #include "konnector.moc"
KDE Logo
This file is part of the documentation for kitchensync Library Version 3.3.0.
Documentation copyright © 1996-2004 the KDE developers.
Generated on Fri Oct 1 15:18:59 2004 by doxygen 1.3.7 written by Dimitri van Heesch, © 1997-2003