kitchensync

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., 51 Franklin Street, Fifth Floor,
00021     Boston, MA 02110-1301, 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 "profile.h"
00038 
00039 namespace KSync {
00040 
00041 class Core;
00042 class Konnector;
00043 
00044 enum SyncStatus { SYNC_START=0, SYNC_PROGRESS=1,  SYNC_DONE=2,  SYNC_FAIL };
00045 
00063 class KDE_EXPORT ActionPart : public KParts::Part
00064 {
00065     Q_OBJECT
00066   public:
00073     ActionPart( QObject *parent = 0, const char *name  = 0 );
00074     virtual ~ActionPart();
00075 
00079     virtual QString type() const = 0;
00080 
00084     virtual int syncProgress() const;
00085 
00089     virtual int syncStatus() const;
00090 
00094     virtual QString title() const = 0;
00095 
00099     virtual QString description() const = 0;
00100 
00104     virtual QPixmap *pixmap() = 0;
00105 
00109     virtual QString iconName() const = 0;
00110 
00114     virtual bool hasGui() const;
00115 
00119     virtual bool configIsVisible() const;
00120 
00124     virtual bool canSync() const;
00125 
00130     virtual QWidget *configWidget();
00131 
00139     virtual void sync( const SynceeList &in, SynceeList &out );
00140 
00141     virtual void executeAction() = 0;
00142 
00143     virtual void filterKonnectors( QPtrList<Konnector> & ) {}
00144 
00145     virtual bool needsKonnectorRead() const { return false; }
00146 
00147     virtual bool needsKonnectorWrite() const { return false; }
00148 
00149   public slots:
00150     virtual void slotSynceesRead( KSync::Konnector * ) {}
00151 
00152     virtual void slotSynceeReadError( KSync::Konnector * ) {}
00153 
00154     virtual void slotSynceesWritten( KSync::Konnector * ) {}
00155 
00156     virtual void slotSynceeWriteError( KSync::Konnector * ) {}
00157 
00158   protected:
00159 
00164     bool confirmBeforeWriting() const;
00165 
00169     Core *core();
00170     Core *core() const;
00171 
00175     void progress( int );
00176 
00177   protected slots:
00178     void done();
00179 
00180   protected:
00185     /* ActionPart* old,ActionPart* ne */
00186     void connectPartChange( const char* slot);
00187 
00188     void connectSyncProgress( const char *slot );
00189 
00190     /* const Profile& */
00191     void connectProfileChanged( const char* slot );
00192 
00193     /* Konnector *,Syncee::PtrList */
00194     void connectKonnectorDownloaded( const char* slot );
00195 
00196     /* connectStartSync */
00197     void connectStartSync(const char* slot);
00198 
00199     /* connectDoneSync */
00200     void connectDoneSync(const char* slot);
00201 
00202   public slots:
00203     virtual void slotConfigOk();
00204 
00205   private:
00206     Core *m_window;
00207     int m_prog;
00208     int m_stat;
00209 };
00210 
00211 }
00212 
00213 #endif
KDE Home | KDE Accessibility Home | Description of Access Keys