summaryrefslogtreecommitdiffabout
path: root/libkdepim/ksyncmanager.h
Side-by-side diff
Diffstat (limited to 'libkdepim/ksyncmanager.h') (more/less context) (ignore whitespace changes)
-rw-r--r--libkdepim/ksyncmanager.h107
1 files changed, 94 insertions, 13 deletions
diff --git a/libkdepim/ksyncmanager.h b/libkdepim/ksyncmanager.h
index 6b10016..52e2772 100644
--- a/libkdepim/ksyncmanager.h
+++ b/libkdepim/ksyncmanager.h
@@ -23,8 +23,13 @@ $Id$
#define _KSYNCMANAGER_H
#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;
class KPimPrefs;
@@ -32,8 +37,75 @@ class QWidget;
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
@@ -48,9 +120,11 @@ class KSyncManager : public QObject
~KSyncManager() ;
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; }
QString getCurrentSyncName() { return mCurrentSyncName; }
@@ -75,17 +149,29 @@ class KSyncManager : public QObject
QString mPhoneDevice;
QString mPhoneConnection;
QString mPhoneModel;
QString mLastSyncedLocalFile; // save!
+ QString mPassWordPiSync;
+ QString mActiveSyncPort;
+ QString mActiveSyncIP ;
-
+ signals:
+ void save();
+ void getFile( bool );
public slots:
void slotSyncMenu( int );
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();
bool syncWithFile( QString fn , bool quick );
@@ -121,27 +207,22 @@ class KSyncManager : public QObject
};
-class KSyncInterface
-{
- public:
+class KSyncInterface
+{
+
+
+ public :
virtual bool sync(KSyncManager* manager, QString filename, int mode) = 0;
virtual bool syncExternal(KSyncManager* manager, QString resource)
{
// empty implementation, because some syncable applications do not have an external(sharpdtm) syncmode, like pwmanager.
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;
+
};
#endif