-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 @@ -26,2 +26,7 @@ $Id$ #include <qstring.h> +#include <qsocket.h> +#include <qdatetime.h> +#include <qserversocket.h> +#include <qtextstream.h> +#include <qregexp.h> @@ -35,2 +40,69 @@ 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 @@ -51,3 +123,5 @@ class KSyncManager : public QObject void setBlockSave(bool sa) { mBlockSaveFlag = sa; } - + void setDefaultFileName( QString s) { mDefFileName = s ;} + QString defaultFileName() { return mDefFileName ;} + QString syncFileName(); void fillSyncMenu(); @@ -78,4 +152,9 @@ class KSyncManager : public QObject QString mLastSyncedLocalFile; // save! + QString mPassWordPiSync; + QString mActiveSyncPort; + QString mActiveSyncIP ; - + signals: + void save(); + void getFile( bool ); @@ -87,2 +166,9 @@ class KSyncManager : public QObject // sync stuff! + void syncPi(); + void deleteCommandSocket(KCommandSocket*s, int state); + void readFileFromSocket(); + KServerSocket * mServerSocket; + void enableQuick(); + KPimPrefs* mPrefs; + QString mDefFileName; QString mCurrentSyncDevice; @@ -126,2 +212,4 @@ class KSyncInterface { + + public: @@ -135,10 +223,3 @@ class KSyncInterface - //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; }; |