-rw-r--r-- | libkdepim/ksyncmanager.h | 99 |
1 files changed, 90 insertions, 9 deletions
diff --git a/libkdepim/ksyncmanager.h b/libkdepim/ksyncmanager.h index 6b10016..52e2772 100644 --- a/libkdepim/ksyncmanager.h +++ b/libkdepim/ksyncmanager.h @@ -24,6 +24,11 @@ $Id$ #include <qobject.h> #include <qstring.h> +#include <qsocket.h> +#include <qdatetime.h> +#include <qserversocket.h> +#include <qtextstream.h> +#include <qregexp.h> class QPopupMenu; class KSyncProfile; @@ -33,6 +38,73 @@ class KSyncManager; class KSyncInterface; class QProgressBar; + +class KServerSocket : public QServerSocket +{ + Q_OBJECT + +public: + KServerSocket ( QString password, Q_UINT16 port, int backlog = 0, QObject * parent=0, const char * name=0 ); + + void newConnection ( int socket ) ; + void setFileName( QString fn ) {mFileName = fn;}; + +signals: + //void sendFile(QSocket*); + //void getFile(QSocket*); + void file_received( bool ); + //void file_sent(); + void saveFile(); + void endConnect(); +private slots: + void discardClient(); + void readClient(); + void readBackFileFromSocket(); + private : + bool blockRC; + void send_file(); + void get_file(); + void end_connect(); + QDialog* mSyncActionDialog; + QSocket* mSocket; + QString mPassWord; + QString mFileName; + QTime piTime; + QString piFileString; +}; + +class KCommandSocket : public QObject +{ + Q_OBJECT +public: + enum state { successR, errorR, successW, errorW, quiet }; + KCommandSocket ( QString password, Q_UINT16 port, QString host, QObject * parent=0, const char * name=0 ); + void readFile( QString ); + void writeFile( QString ); + void sendStop(); + + +signals: + void commandFinished( KCommandSocket*, int ); +private slots: + void startReadFileFromSocket(); + void readFileFromSocket(); + void deleteSocket(); + void writeFileToSocket(); + private : + QSocket* mSocket; + QString mPassWord; + Q_UINT16 mPort; + QString mHost; + QString mFileName; + QTimer* mTimerSocket; + int mRetVal; + QTime mTime; + QString mFileString; + bool mFirst; +}; + + class KSyncManager : public QObject { Q_OBJECT @@ -49,7 +121,9 @@ class KSyncManager : public QObject bool blockSave() { return mBlockSaveFlag; } void setBlockSave(bool sa) { mBlockSaveFlag = sa; } - + void setDefaultFileName( QString s) { mDefFileName = s ;} + QString defaultFileName() { return mDefFileName ;} + QString syncFileName(); void fillSyncMenu(); QString getCurrentSyncDevice() { return mCurrentSyncDevice; } @@ -76,8 +150,13 @@ class KSyncManager : public QObject QString mPhoneConnection; QString mPhoneModel; QString mLastSyncedLocalFile; // save! + QString mPassWordPiSync; + QString mActiveSyncPort; + QString mActiveSyncIP ; - + signals: + void save(); + void getFile( bool ); public slots: void slotSyncMenu( int ); @@ -85,6 +164,13 @@ class KSyncManager : public QObject private: // LR ******************************* // sync stuff! + void syncPi(); + void deleteCommandSocket(KCommandSocket*s, int state); + void readFileFromSocket(); + KServerSocket * mServerSocket; + void enableQuick(); + KPimPrefs* mPrefs; + QString mDefFileName; QString mCurrentSyncDevice; QString mCurrentSyncName; void quickSyncLocalFile(); @@ -124,6 +210,8 @@ class KSyncManager : public QObject class KSyncInterface { + + public: virtual bool sync(KSyncManager* manager, QString filename, int mode) = 0; @@ -133,14 +221,7 @@ class KSyncInterface return false; } - //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; }; |