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
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 );
00034 caps.setSupportsPushSync(
true );
00035 caps.setNeedsConnection(
true );
00036 caps.setSupportsListDir(
true );
00037 caps.setNeedsIPs(
true );
00038 caps.setNeedsSrcIP(
false );
00039 caps.setNeedsDestIP(
true );
00040 caps.setAutoHandle(
false );
00041 caps.setNeedAuthentication(
false );
00042 caps.setNeedsModelName(
true );
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();
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"),
00067 m_socket->metaName(),
00068
"agenda",
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
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"