From ae6aaaf2ec81317d275ebaabba2de188279b58cd Mon Sep 17 00:00:00 2001 From: ulf69 Date: Fri, 01 Oct 2004 05:22:45 +0000 Subject: moved the global sync stuff from kabcore into a new class ksyncmanaager which can be used from all types of applications, like kapi, kopi and pwmpi --- (limited to 'libkdepim/ksyncmanager.h') diff --git a/libkdepim/ksyncmanager.h b/libkdepim/ksyncmanager.h index d7c2a02..389a005 100644 --- a/libkdepim/ksyncmanager.h +++ b/libkdepim/ksyncmanager.h @@ -22,47 +22,98 @@ $Id$ #ifndef _KSYNCMANAGER_H #define _KSYNCMANAGER_H +#include #include class QPopupMenu; class KSyncProfile; +class KPimPrefs; +class QWidget; +class KSyncManager; +class KSyncInterface; - - -class KSyncManager +class KSyncManager : public QObject { - - public: - KSyncManager(TargetApp ta, QPopupMenu* syncmenu); - ~KSyncManager() ; + Q_OBJECT + public: enum TargetApp { KOPI = 0, KAPI = 1, PWMPI = 2 }; - private: + + KSyncManager(QWidget* parent, KSyncInterface* implementation, TargetApp ta, KPimPrefs* prefs, QPopupMenu* syncmenu); + ~KSyncManager() ; + + bool blockSave() { return mBlockSaveFlag; } + void setBlockSave(bool sa) { mBlockSaveFlag = sa; } + void fillSyncMenu(); - void syncLocalFile(); - bool syncWithFile( QString fn , bool quick ); + + QString getCurrentSyncDevice() { return mCurrentSyncDevice; } + QString getCurrentSyncName() { return mCurrentSyncName; } + + public slots: + void slotSyncMenu( int ); + + private: + // LR ******************************* + // sync stuff! + QString mCurrentSyncDevice; + QString mCurrentSyncName; void quickSyncLocalFile(); + bool syncWithFile( QString fn , bool quick ); + void syncLocalFile(); + void syncPhone(); + void syncSharp(); + bool syncExternalApplication(QString); void multiSync( bool askforPrefs ); - int ringSync(); - void syncRemote( KSyncProfile* prof, bool ask); + int mCurrentSyncProfile ; + void syncRemote( KSyncProfile* prof, bool ask = true); void edit_sync_options(); - QString getPassword(); + int ringSync(); + QString getPassword( ); + + private slots: + void confSync(); + // ********************* private: - QPopupMenu* mSyncMenu; + bool mBlockSaveFlag; + + + QWidget* mParent; + KSyncInterface* mImplementation; TargetApp mTargetApp; + KPimPrefs* mPrefs; + QPopupMenu* mSyncMenu; + +}; + + +class KSyncInterface +{ + public: + virtual bool sync(KSyncManager* manager, QString filename, int mode) = 0; + virtual bool syncExternal(KSyncManager* manager, QString resource) = 0; + //called by the syncmanager to indicate that the work has to be marked as dirty. + virtual void sync_setModified() = 0; + + //called by the syncmanager to ask if the dirty flag is set. + virtual bool sync_isModified() = 0; + + //called by the syncmanager to indicate that the work has to be saved. + virtual void sync_save() = 0; }; + #endif -- cgit v0.9.0.2