summaryrefslogtreecommitdiffabout
path: root/libkdepim/ksyncmanager.h
authorzautrix <zautrix>2004-10-07 07:28:54 (UTC)
committer zautrix <zautrix>2004-10-07 07:28:54 (UTC)
commit77280f6a176a15b60004f312e6cacdfbbd3909c1 (patch) (side-by-side diff)
treee074d4abedc2f4cc575e5655575e038b9d460106 /libkdepim/ksyncmanager.h
parentf1eb5b74c962909851607c4b4cb05ee18a347d37 (diff)
downloadkdepimpi-77280f6a176a15b60004f312e6cacdfbbd3909c1.zip
kdepimpi-77280f6a176a15b60004f312e6cacdfbbd3909c1.tar.gz
kdepimpi-77280f6a176a15b60004f312e6cacdfbbd3909c1.tar.bz2
sync changes
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
@@ -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();
@@ -122,9 +208,11 @@ 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)
@@ -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;
+
};