-rw-r--r-- | libkdepim/ksyncmanager.h | 107 |
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 | |||
@@ -25,4 +25,9 @@ $Id$ | |||
25 | #include <qobject.h> | 25 | #include <qobject.h> |
26 | #include <qstring.h> | 26 | #include <qstring.h> |
27 | #include <qsocket.h> | ||
28 | #include <qdatetime.h> | ||
29 | #include <qserversocket.h> | ||
30 | #include <qtextstream.h> | ||
31 | #include <qregexp.h> | ||
27 | 32 | ||
28 | class QPopupMenu; | 33 | class QPopupMenu; |
@@ -34,4 +39,71 @@ class KSyncInterface; | |||
34 | class QProgressBar; | 39 | class QProgressBar; |
35 | 40 | ||
41 | |||
42 | class KServerSocket : public QServerSocket | ||
43 | { | ||
44 | Q_OBJECT | ||
45 | |||
46 | public: | ||
47 | KServerSocket ( QString password, Q_UINT16 port, int backlog = 0, QObject * parent=0, const char * name=0 ); | ||
48 | |||
49 | void newConnection ( int socket ) ; | ||
50 | void setFileName( QString fn ) {mFileName = fn;}; | ||
51 | |||
52 | signals: | ||
53 | //void sendFile(QSocket*); | ||
54 | //void getFile(QSocket*); | ||
55 | void file_received( bool ); | ||
56 | //void file_sent(); | ||
57 | void saveFile(); | ||
58 | void endConnect(); | ||
59 | private slots: | ||
60 | void discardClient(); | ||
61 | void readClient(); | ||
62 | void readBackFileFromSocket(); | ||
63 | private : | ||
64 | bool blockRC; | ||
65 | void send_file(); | ||
66 | void get_file(); | ||
67 | void end_connect(); | ||
68 | QDialog* mSyncActionDialog; | ||
69 | QSocket* mSocket; | ||
70 | QString mPassWord; | ||
71 | QString mFileName; | ||
72 | QTime piTime; | ||
73 | QString piFileString; | ||
74 | }; | ||
75 | |||
76 | class KCommandSocket : public QObject | ||
77 | { | ||
78 | Q_OBJECT | ||
79 | public: | ||
80 | enum state { successR, errorR, successW, errorW, quiet }; | ||
81 | KCommandSocket ( QString password, Q_UINT16 port, QString host, QObject * parent=0, const char * name=0 ); | ||
82 | void readFile( QString ); | ||
83 | void writeFile( QString ); | ||
84 | void sendStop(); | ||
85 | |||
86 | |||
87 | signals: | ||
88 | void commandFinished( KCommandSocket*, int ); | ||
89 | private slots: | ||
90 | void startReadFileFromSocket(); | ||
91 | void readFileFromSocket(); | ||
92 | void deleteSocket(); | ||
93 | void writeFileToSocket(); | ||
94 | private : | ||
95 | QSocket* mSocket; | ||
96 | QString mPassWord; | ||
97 | Q_UINT16 mPort; | ||
98 | QString mHost; | ||
99 | QString mFileName; | ||
100 | QTimer* mTimerSocket; | ||
101 | int mRetVal; | ||
102 | QTime mTime; | ||
103 | QString mFileString; | ||
104 | bool mFirst; | ||
105 | }; | ||
106 | |||
107 | |||
36 | class KSyncManager : public QObject | 108 | class KSyncManager : public QObject |
37 | { | 109 | { |
@@ -50,5 +122,7 @@ class KSyncManager : public QObject | |||
50 | bool blockSave() { return mBlockSaveFlag; } | 122 | bool blockSave() { return mBlockSaveFlag; } |
51 | void setBlockSave(bool sa) { mBlockSaveFlag = sa; } | 123 | void setBlockSave(bool sa) { mBlockSaveFlag = sa; } |
52 | 124 | void setDefaultFileName( QString s) { mDefFileName = s ;} | |
125 | QString defaultFileName() { return mDefFileName ;} | ||
126 | QString syncFileName(); | ||
53 | void fillSyncMenu(); | 127 | void fillSyncMenu(); |
54 | 128 | ||
@@ -77,6 +151,11 @@ class KSyncManager : public QObject | |||
77 | QString mPhoneModel; | 151 | QString mPhoneModel; |
78 | QString mLastSyncedLocalFile; // save! | 152 | QString mLastSyncedLocalFile; // save! |
153 | QString mPassWordPiSync; | ||
154 | QString mActiveSyncPort; | ||
155 | QString mActiveSyncIP ; | ||
79 | 156 | ||
80 | 157 | signals: | |
158 | void save(); | ||
159 | void getFile( bool ); | ||
81 | 160 | ||
82 | public slots: | 161 | public slots: |
@@ -86,4 +165,11 @@ class KSyncManager : public QObject | |||
86 | // LR ******************************* | 165 | // LR ******************************* |
87 | // sync stuff! | 166 | // sync stuff! |
167 | void syncPi(); | ||
168 | void deleteCommandSocket(KCommandSocket*s, int state); | ||
169 | void readFileFromSocket(); | ||
170 | KServerSocket * mServerSocket; | ||
171 | void enableQuick(); | ||
172 | KPimPrefs* mPrefs; | ||
173 | QString mDefFileName; | ||
88 | QString mCurrentSyncDevice; | 174 | QString mCurrentSyncDevice; |
89 | QString mCurrentSyncName; | 175 | QString mCurrentSyncName; |
@@ -123,7 +209,9 @@ class KSyncManager : public QObject | |||
123 | 209 | ||
124 | 210 | ||
125 | class KSyncInterface | 211 | class KSyncInterface |
126 | { | 212 | { |
127 | public: | 213 | |
214 | |||
215 | public : | ||
128 | virtual bool sync(KSyncManager* manager, QString filename, int mode) = 0; | 216 | virtual bool sync(KSyncManager* manager, QString filename, int mode) = 0; |
129 | 217 | ||
@@ -134,12 +222,5 @@ class KSyncInterface | |||
134 | } | 222 | } |
135 | 223 | ||
136 | //called by the syncmanager to indicate that the work has to be marked as dirty. | 224 | |
137 | virtual void sync_setModified() = 0; | ||
138 | |||
139 | //called by the syncmanager to ask if the dirty flag is set. | ||
140 | virtual bool sync_isModified() = 0; | ||
141 | |||
142 | //called by the syncmanager to indicate that the work has to be saved. | ||
143 | virtual void sync_save() = 0; | ||
144 | }; | 225 | }; |
145 | 226 | ||