kitchensync Library API Documentation

dummykonnector.cpp

00001 /*
00002     This file is part of KitchenSync.
00003 
00004     Copyright (c) 2003 Cornelius Schumacher <schumacher@kde.org>
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 <kgenericfactory.h>
00023 #include <kdebug.h>
00024 
00025 #include <konnectorinfo.h>
00026 #include <kapabilities.h>
00027 
00028 #include <calendarsyncee.h>
00029 
00030 #include "dummykonnector.h"
00031 
00032 using namespace KSync;
00033 using namespace KCal;
00034 
00035 class DummyKonnectorFactory : public KRES::PluginFactoryBase
00036 {
00037   public:
00038     KRES::Resource *resource( const KConfig *config )
00039     {
00040       return new DummyKonnector( config );
00041     }
00042 
00043     KRES::ConfigWidget *configWidget( QWidget * )
00044     {
00045       return 0;
00046     }
00047 };
00048 
00049 extern "C"
00050 {
00051   void *init_libdummykonnector()
00052   {
00053     return new DummyKonnectorFactory();
00054   }
00055 }
00056 
00057 
00058 DummyKonnector::DummyKonnector( const KConfig *config )
00059     : Konnector( config )
00060 {
00061   Event *event = new Event;
00062   event->setSummary( "An Event" );
00063   mCalendar.addEvent( event );
00064 
00065   event = new Event;
00066   event->setSummary( "Another Event" );
00067   mCalendar.addEvent( event );
00068 
00069   CalendarSyncee *calendarSyncee = new CalendarSyncee( &mCalendar );
00070   mSyncees.append( calendarSyncee );  
00071 }
00072 
00073 DummyKonnector::~DummyKonnector()
00074 {
00075 }
00076 
00077 KSync::Kapabilities DummyKonnector::capabilities()
00078 {
00079   KSync::Kapabilities caps;
00080 
00081   caps.setSupportMetaSyncing( false ); // we can meta sync
00082   caps.setSupportsPushSync( false ); // we can initialize the sync from here
00083   caps.setNeedsConnection( false ); // we need to have pppd running
00084   caps.setSupportsListDir( false ); // we will support that once there is API for it...
00085   caps.setNeedsIPs( false ); // we need the IP
00086   caps.setNeedsSrcIP( false ); // we do not bind to any address...
00087   caps.setNeedsDestIP( false ); // we need to know where to connect
00088   caps.setAutoHandle( false ); // we currently do not support auto handling
00089   caps.setNeedAuthentication( false ); // HennevL says we do not need that
00090   caps.setNeedsModelName( false ); // we need a name for our meta path!
00091 
00092   return caps;
00093 }
00094 
00095 void DummyKonnector::setCapabilities( const KSync::Kapabilities & )
00096 {
00097 }
00098 
00099 SynceeList DummyKonnector::syncees()
00100 {
00101   return mSyncees;
00102 }
00103 
00104 bool DummyKonnector::readSyncees()
00105 {
00106   kdDebug() << "DummyKonnector::readSyncees()" << endl;
00107 
00108   emit synceesRead( this );
00109 
00110   return true;
00111 }
00112 
00113 bool DummyKonnector::connectDevice()
00114 {
00115   return true;
00116 }
00117 
00118 bool DummyKonnector::disconnectDevice()
00119 {
00120   return true;
00121 }
00122 
00123 KSync::KonnectorInfo DummyKonnector::info() const
00124 {
00125   return KonnectorInfo( i18n("Dummy Konnector"),
00126                         QIconSet(),
00127                         QString::fromLatin1("dummykonnector"),  // same as the .desktop file
00128                         "Dummy Konnector",
00129                         "agenda", // icon name
00130                         false );
00131 }
00132 
00133 void DummyKonnector::download( const QString& )
00134 {
00135   error( StdError::downloadNotSupported() );
00136 }
00137 
00138 KSync::ConfigWidget *DummyKonnector::configWidget( const KSync::Kapabilities&, QWidget*,
00139                                                    const char* )
00140 {
00141   return 0;
00142 }
00143 
00144 KSync::ConfigWidget *DummyKonnector::configWidget( QWidget*, const char* )
00145 {
00146   return 0;
00147 }
00148 
00149 bool DummyKonnector::writeSyncees()
00150 {
00151   emit synceesWritten( this );
00152   return true;
00153 }
00154 
00155 
00156 #include "dummykonnector.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 Mon Apr 4 04:47:07 2005 by doxygen 1.3.9.1 written by Dimitri van Heesch, © 1997-2003