kitchensync Library API Documentation

actionpart.h

00001 /*
00002     This file is part of KitchenSync.
00003 
00004     Copyright (c) 2002 Holger Freyther <zecke@handhelds.org>
00005     Copyright (c) 2002 Maximilian Reiß <harlekin@handhelds.org>
00006     Copyright (c) 2004 Cornelius Schumacher <schumacher@kde.org>
00007 
00008     This library is free software; you can redistribute it and/or
00009     modify it under the terms of the GNU Library General Public
00010     License as published by the Free Software Foundation; either
00011     version 2 of the License, or (at your option) any later version.
00012 
00013     This library is distributed in the hope that it will be useful,
00014     but WITHOUT ANY WARRANTY; without even the implied warranty of
00015     MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
00016     Library General Public License for more details.
00017 
00018     You should have received a copy of the GNU Library General Public License
00019     along with this library; see the file COPYING.LIB.  If not, write to
00020     the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
00021     Boston, MA 02111-1307, USA.
00022 */
00023 #ifndef KSYNC_ACTIONPART_H
00024 #define KSYNC_ACTIONPART_H
00025 
00026 #include <qpixmap.h>
00027 #include <qstring.h>
00028 #include <kparts/part.h>
00029 #include <qptrlist.h>
00030 #include <qstringlist.h>
00031 
00032 #include <kdebug.h>
00033 
00034 #include <syncee.h>
00035 #include <synceelist.h>
00036 
00037 #include <error.h>
00038 #include <progress.h>
00039 
00040 #include "profile.h"
00041 
00042 namespace KSync {
00043 
00044 class Core;
00045 class Konnector;
00046 
00047 enum SyncStatus { SYNC_START=0, SYNC_PROGRESS=1,  SYNC_DONE=2,  SYNC_FAIL };
00048 
00066 class ActionPart : public KParts::Part
00067 {
00068     Q_OBJECT
00069   public:
00076     ActionPart( QObject *parent = 0, const char *name  = 0 );
00077     virtual ~ActionPart();
00078 
00082     virtual QString type() const = 0;
00083 
00087     virtual int syncProgress() const;
00088 
00092     virtual int syncStatus() const;
00093 
00097     virtual QString title() const = 0;
00098 
00102     virtual QString description() const = 0;
00103 
00107     virtual QPixmap *pixmap() = 0;
00108 
00112     virtual QString iconName() const = 0;
00113 
00117     virtual bool hasGui() const;
00118 
00122     virtual bool configIsVisible() const;
00123 
00127     virtual bool canSync() const;
00128 
00133     virtual QWidget *configWidget();
00134 
00142     virtual void sync( const SynceeList &in, SynceeList &out );
00143 
00144     virtual void executeAction() = 0;
00145 
00146     virtual void filterKonnectors( QPtrList<Konnector> & ) {}
00147 
00148     virtual bool needsKonnectorRead() const { return false; }
00149     
00150     virtual bool needsKonnectorWrite() const { return false; }
00151 
00152   public slots:
00153     virtual void slotSynceesRead( Konnector * ) {}
00154 
00155     virtual void slotSynceeReadError( Konnector * ) {}
00156 
00157     virtual void slotSynceesWritten( Konnector * ) {}
00158 
00159     virtual void slotSynceeWriteError( Konnector * ) {}
00160 
00161   protected:
00162 
00167     bool confirmBeforeWriting() const;
00168 
00172     Core *core();
00173     Core *core() const;
00174 
00178     void progress( int );
00179 
00180   protected slots:
00181     void progress( const Progress& );
00182     void error( const Error& );
00183     void done();
00184 
00185   signals:
00186     // 0 - 100
00187     void sig_progress( ActionPart *, int );
00188     void sig_progress( ActionPart *, const Progress & );
00189     void sig_error( ActionPart *, const Error & );
00190     // SYNC_START SYNC_SYNC SYNC_STOP
00191     void sig_syncStatus( ActionPart *, int );
00192 
00193   protected:
00198     /* ActionPart* old,ActionPart* ne */
00199     void connectPartChange( const char* slot);
00200 
00201     /* ActionPart* part,const Progress& */
00202     void connectPartProgress( const char* slot );
00203 
00204     /* ActionPart* part, const Error& */
00205     void connectPartError( const char* slot );
00206 
00207     /* Konnector *,const Progress& */
00208     void connectKonnectorProgress(const char* slot );
00209 
00210     /* Konnector *, const Error& */
00211     void connectKonnectorError( const char* slot );
00212 
00213     /* ActionPart*,int status,int prog */
00214     void connectSyncProgress( const char* slot );
00215 
00216     /* const Profile& */
00217     void connectProfileChanged( const char* slot );
00218 
00219     /* Konnector *,Syncee::PtrList */
00220     void connectKonnectorDownloaded( const char* slot );
00221 
00222     /* connectStartSync */
00223     void connectStartSync(const char* slot);
00224 
00225     /* connectDoneSync */
00226     void connectDoneSync(const char* slot);
00227 
00228   public slots:
00229     virtual void slotConfigOk();
00230 
00231   private:
00232     Core *m_window;
00233     int m_prog;
00234     int m_stat;
00235 };
00236 
00237 }
00238 
00239 #endif
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