author | zautrix <zautrix> | 2005-11-25 17:41:25 (UTC) |
---|---|---|
committer | zautrix <zautrix> | 2005-11-25 17:41:25 (UTC) |
commit | 279e183c0325cd9565605f60af0215bb9bfdc825 (patch) (unidiff) | |
tree | 43ab776cd108874819e7c6e73070a7d989a9078f /libkdepim/ksyncmanager.h | |
parent | 794a5204686ad9bfc16172b01db35f1f3b7683e5 (diff) | |
download | kdepimpi-279e183c0325cd9565605f60af0215bb9bfdc825.zip kdepimpi-279e183c0325cd9565605f60af0215bb9bfdc825.tar.gz kdepimpi-279e183c0325cd9565605f60af0215bb9bfdc825.tar.bz2 |
sync
-rw-r--r-- | libkdepim/ksyncmanager.h | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/libkdepim/ksyncmanager.h b/libkdepim/ksyncmanager.h index f4654ce..53c611d 100644 --- a/libkdepim/ksyncmanager.h +++ b/libkdepim/ksyncmanager.h | |||
@@ -1,241 +1,247 @@ | |||
1 | /* | 1 | /* |
2 | This file is part of KDE-Pim/Pi. | 2 | This file is part of KDE-Pim/Pi. |
3 | Copyright (c) 2004 Ulf Schenk | 3 | Copyright (c) 2004 Ulf Schenk |
4 | 4 | ||
5 | This library is free software; you can redistribute it and/or | 5 | This library is free software; you can redistribute it and/or |
6 | modify it under the terms of the GNU Library General Public | 6 | modify it under the terms of the GNU Library General Public |
7 | License as published by the Free Software Foundation; either | 7 | License as published by the Free Software Foundation; either |
8 | version 2 of the License, or (at your option) any later version. | 8 | version 2 of the License, or (at your option) any later version. |
9 | 9 | ||
10 | This library is distributed in the hope that it will be useful, | 10 | This library is distributed in the hope that it will be useful, |
11 | but WITHOUT ANY WARRANTY; without even the implied warranty of | 11 | but WITHOUT ANY WARRANTY; without even the implied warranty of |
12 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | 12 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
13 | Library General Public License for more details. | 13 | Library General Public License for more details. |
14 | 14 | ||
15 | You should have received a copy of the GNU Library General Public License | 15 | You should have received a copy of the GNU Library General Public License |
16 | along with this library; see the file COPYING.LIB. If not, write to | 16 | along with this library; see the file COPYING.LIB. If not, write to |
17 | the Free Software Foundation, Inc., 59 Temple Place - Suite 330, | 17 | the Free Software Foundation, Inc., 59 Temple Place - Suite 330, |
18 | Boston, MA 02111-1307, USA. | 18 | Boston, MA 02111-1307, USA. |
19 | 19 | ||
20 | $Id$ | 20 | $Id$ |
21 | */ | 21 | */ |
22 | #ifndef _KSYNCMANAGER_H | 22 | #ifndef _KSYNCMANAGER_H |
23 | #define _KSYNCMANAGER_H | 23 | #define _KSYNCMANAGER_H |
24 | 24 | ||
25 | #include <qobject.h> | 25 | #include <qobject.h> |
26 | #include <qstring.h> | 26 | #include <qstring.h> |
27 | #include <qsocket.h> | 27 | #include <qsocket.h> |
28 | #include <qdatetime.h> | 28 | #include <qdatetime.h> |
29 | #include <qserversocket.h> | 29 | #include <qserversocket.h> |
30 | #include <qtextstream.h> | 30 | #include <qtextstream.h> |
31 | #include <qregexp.h> | 31 | #include <qregexp.h> |
32 | #include <qprogressdialog.h> | 32 | #include <qprogressdialog.h> |
33 | #include <kdialog.h> | 33 | #include <kdialog.h> |
34 | 34 | ||
35 | class QPopupMenu; | 35 | class QPopupMenu; |
36 | class KSyncProfile; | 36 | class KSyncProfile; |
37 | class KPimPrefs; | 37 | class KPimPrefs; |
38 | class QWidget; | 38 | class QWidget; |
39 | class KSyncManager; | 39 | class KSyncManager; |
40 | class KSyncInterface; | 40 | class KSyncInterface; |
41 | class QProgressBar; | 41 | class QProgressBar; |
42 | 42 | ||
43 | 43 | ||
44 | class KServerSocket : public QServerSocket | 44 | class KServerSocket : public QServerSocket |
45 | { | 45 | { |
46 | Q_OBJECT | 46 | Q_OBJECT |
47 | 47 | ||
48 | public: | 48 | public: |
49 | KServerSocket ( QString password, Q_UINT16 port, int backlog = 0, QObject * parent=0, const char * name=0 ); | 49 | KServerSocket ( QString password, Q_UINT16 port, int backlog = 0, QObject * parent=0, const char * name=0 ); |
50 | 50 | ||
51 | void newConnection ( int socket ) ; | 51 | void newConnection ( int socket ) ; |
52 | void setFileName( QString fn ) {mFileName = fn;}; | 52 | void setFileName( QString fn ) {mFileName = fn;}; |
53 | signals: | 53 | signals: |
54 | void file_received( bool ); | 54 | void file_received( bool ); |
55 | void request_file(); | 55 | void request_file(); |
56 | void file_received( bool, const QString &); | ||
57 | void request_file(const QString &); | ||
56 | void saveFile(); | 58 | void saveFile(); |
57 | void endConnect(); | 59 | void endConnect(); |
58 | private slots: | 60 | private slots: |
59 | void discardClient(); | 61 | void discardClient(); |
60 | void deleteSocket(); | 62 | void deleteSocket(); |
61 | void readClient(); | 63 | void readClient(); |
62 | void displayErrorMessage(); | 64 | void displayErrorMessage(); |
63 | void readBackFileFromSocket(); | 65 | void readBackFileFromSocket(); |
64 | private : | 66 | private : |
67 | QString mResource; | ||
65 | int mErrorMessage; | 68 | int mErrorMessage; |
66 | bool blockRC; | 69 | bool blockRC; |
67 | void send_file(); | 70 | void send_file(); |
68 | void get_file(); | 71 | void get_file(); |
69 | void end_connect(); | 72 | void end_connect(); |
70 | void error_connect( QString ); | 73 | void error_connect( QString ); |
71 | QDialog* mSyncActionDialog; | 74 | QDialog* mSyncActionDialog; |
72 | QSocket* mSocket; | 75 | QSocket* mSocket; |
73 | QString mPassWord; | 76 | QString mPassWord; |
74 | QString mFileName; | 77 | QString mFileName; |
75 | QTime piTime; | 78 | QTime piTime; |
76 | QString piFileString; | 79 | QString piFileString; |
77 | }; | 80 | }; |
78 | 81 | ||
79 | class KCommandSocket : public QObject | 82 | class KCommandSocket : public QObject |
80 | { | 83 | { |
81 | Q_OBJECT | 84 | Q_OBJECT |
82 | public: | 85 | public: |
83 | enum state { successR, errorR, successW, errorW, errorTO, errorPW, errorCA, errorFI, errorUN, errorED,quiet }; | 86 | enum state { successR, errorR, successW, errorW, errorTO, errorPW, errorCA, errorFI, errorUN, errorED,quiet }; |
84 | KCommandSocket (QString remoteResource, QString password, Q_UINT16 port, QString host, QObject * parent=0, QWidget* cap = 0, const char * name=0 ); | 87 | KCommandSocket (QString remoteResource, QString password, Q_UINT16 port, QString host, QObject * parent=0, QWidget* cap = 0, const char * name=0 ); |
85 | void readFile( QString ); | 88 | void readFile( QString ); |
86 | void writeFile( QString ); | 89 | void writeFile( QString ); |
87 | void sendStop(); | 90 | void sendStop(); |
88 | 91 | ||
89 | private slots : | 92 | private slots : |
90 | void sendFileRequest(); | 93 | void sendFileRequest(); |
91 | void updateConnectDialog(); | 94 | void updateConnectDialog(); |
92 | 95 | ||
93 | signals: | 96 | signals: |
94 | void commandFinished( KCommandSocket*, int ); | 97 | void commandFinished( KCommandSocket*, int ); |
95 | private slots: | 98 | private slots: |
96 | void startReadFileFromSocket(); | 99 | void startReadFileFromSocket(); |
97 | void readFileFromSocket(); | 100 | void readFileFromSocket(); |
98 | void deleteSocket(); | 101 | void deleteSocket(); |
99 | void writeFileToSocket(); | 102 | void writeFileToSocket(); |
100 | private : | 103 | private : |
101 | QString mRemoteResource; | 104 | QString mRemoteResource; |
102 | int mConnectCount; | 105 | int mConnectCount; |
103 | int mConnectMax; | 106 | int mConnectMax; |
104 | KProgressDialog mConnectProgress; | 107 | KProgressDialog mConnectProgress; |
105 | QWidget* tlw; | 108 | QWidget* tlw; |
106 | QSocket* mSocket; | 109 | QSocket* mSocket; |
107 | QString mPassWord; | 110 | QString mPassWord; |
108 | Q_UINT16 mPort; | 111 | Q_UINT16 mPort; |
109 | QString mHost; | 112 | QString mHost; |
110 | QString mFileName; | 113 | QString mFileName; |
111 | QTimer* mTimerSocket; | 114 | QTimer* mTimerSocket; |
112 | int mRetVal; | 115 | int mRetVal; |
113 | QTime mTime; | 116 | QTime mTime; |
114 | QString mFileString; | 117 | QString mFileString; |
115 | bool mFirst; | 118 | bool mFirst; |
116 | bool mFirstLine; | 119 | bool mFirstLine; |
117 | }; | 120 | }; |
118 | 121 | ||
119 | 122 | ||
120 | class KSyncManager : public QObject | 123 | class KSyncManager : public QObject |
121 | { | 124 | { |
122 | Q_OBJECT | 125 | Q_OBJECT |
123 | 126 | ||
124 | public: | 127 | public: |
125 | enum TargetApp { | 128 | enum TargetApp { |
126 | KOPI = 0, | 129 | KOPI = 0, |
127 | KAPI = 1, | 130 | KAPI = 1, |
128 | PWMPI = 2 }; | 131 | PWMPI = 2 }; |
129 | 132 | ||
130 | KSyncManager(QWidget* parent, KSyncInterface* implementation, TargetApp ta, KPimPrefs* prefs, QPopupMenu* syncmenu); | 133 | KSyncManager(QWidget* parent, KSyncInterface* implementation, TargetApp ta, KPimPrefs* prefs, QPopupMenu* syncmenu); |
131 | ~KSyncManager() ; | 134 | ~KSyncManager() ; |
132 | 135 | ||
133 | void multiSync( bool askforPrefs ); | 136 | void multiSync( bool askforPrefs ); |
134 | bool blockSave() { return mBlockSaveFlag; } | 137 | bool blockSave() { return mBlockSaveFlag; } |
135 | void setBlockSave(bool sa) { mBlockSaveFlag = sa; } | 138 | void setBlockSave(bool sa) { mBlockSaveFlag = sa; } |
136 | void setDefaultFileName( QString s) ; | 139 | void setDefaultFileName( QString s) ; |
137 | QString defaultFileName() { return mDefFileName ;} | 140 | QString defaultFileName() { return mDefFileName ;} |
138 | QString syncFileName(); | 141 | QString syncFileName(); |
139 | void enableQuick( bool ask = true); | 142 | void enableQuick( bool ask = true); |
140 | 143 | ||
141 | bool syncWithDesktop () { return mSyncWithDesktop;} | 144 | bool syncWithDesktop () { return mSyncWithDesktop;} |
142 | QString getCurrentSyncDevice() { return mCurrentSyncDevice; } | 145 | QString getCurrentSyncDevice() { return mCurrentSyncDevice; } |
143 | QString getCurrentSyncName() { return mCurrentSyncName; } | 146 | QString getCurrentSyncName() { return mCurrentSyncName; } |
144 | 147 | ||
145 | void showProgressBar(int percentage, QString caption = QString::null, int total=100); | 148 | void showProgressBar(int percentage, QString caption = QString::null, int total=100); |
146 | void hideProgressBar(); | 149 | void hideProgressBar(); |
147 | bool isProgressBarCanceled(); | 150 | bool isProgressBarCanceled(); |
148 | 151 | ||
149 | // sync stuff | 152 | // sync stuff |
150 | QString mLocalMachineName; | 153 | QString mLocalMachineName; |
151 | QStringList mExternSyncProfiles; | 154 | QStringList mExternSyncProfiles; |
152 | QStringList mSyncProfileNames; | 155 | QStringList mSyncProfileNames; |
153 | bool mAskForPreferences; | 156 | bool mAskForPreferences; |
154 | bool mShowSyncSummary; | 157 | bool mShowSyncSummary; |
155 | bool mIsKapiFile; | 158 | bool mIsKapiFile; |
156 | bool mWriteBackExistingOnly; | 159 | bool mWriteBackExistingOnly; |
157 | int mSyncAlgoPrefs; | 160 | int mSyncAlgoPrefs; |
158 | bool mWriteBackFile; | 161 | bool mWriteBackFile; |
159 | int mWriteBackInFuture; | 162 | int mWriteBackInFuture; |
160 | int mWriteBackInPast; | 163 | int mWriteBackInPast; |
161 | QString mPhoneDevice; | 164 | QString mPhoneDevice; |
162 | QString mPhoneConnection; | 165 | QString mPhoneConnection; |
163 | QString mPhoneModel; | 166 | QString mPhoneModel; |
164 | QString mPassWordPiSync; | 167 | QString mPassWordPiSync; |
165 | QString mActiveSyncPort; | 168 | QString mActiveSyncPort; |
166 | QString mActiveSyncIP ; | 169 | QString mActiveSyncIP ; |
167 | QString mFilterInCal; | 170 | QString mFilterInCal; |
168 | QString mFilterOutCal; | 171 | QString mFilterOutCal; |
169 | QString mFilterInAB; | 172 | QString mFilterInAB; |
170 | QString mFilterOutAB; | 173 | QString mFilterOutAB; |
171 | static QDateTime mRequestedSyncEvent; | 174 | static QDateTime mRequestedSyncEvent; |
172 | 175 | ||
173 | signals: | 176 | signals: |
174 | void save(); | 177 | void save(); |
175 | void request_file(); | 178 | void request_file(); |
176 | void getFile( bool ); | 179 | void getFile( bool ); |
180 | void getFile( bool, const QString &); | ||
181 | void request_file(const QString &); | ||
182 | void multiResourceSyncStart( bool ); | ||
177 | 183 | ||
178 | public slots: | 184 | public slots: |
179 | void slotSyncMenu( int ); | 185 | void slotSyncMenu( int ); |
180 | void slotClearMenu( int action ); | 186 | void slotClearMenu( int action ); |
181 | void deleteCommandSocket(KCommandSocket*s, int state); | 187 | void deleteCommandSocket(KCommandSocket*s, int state); |
182 | void readFileFromSocket(); | 188 | void readFileFromSocket(); |
183 | void fillSyncMenu(); | 189 | void fillSyncMenu(); |
184 | 190 | ||
185 | private: | 191 | private: |
186 | void syncPi(); | 192 | void syncPi(); |
187 | KServerSocket * mServerSocket; | 193 | KServerSocket * mServerSocket; |
188 | KPimPrefs* mPrefs; | 194 | KPimPrefs* mPrefs; |
189 | QString mDefFileName; | 195 | QString mDefFileName; |
190 | QString mCurrentSyncDevice; | 196 | QString mCurrentSyncDevice; |
191 | QString mCurrentSyncName; | 197 | QString mCurrentSyncName; |
192 | void quickSyncLocalFile(); | 198 | void quickSyncLocalFile(); |
193 | bool syncWithFile( QString fn , bool quick ); | 199 | bool syncWithFile( QString fn , bool quick ); |
194 | void syncLocalFile(); | 200 | void syncLocalFile(); |
195 | void syncPhone(); | 201 | void syncPhone(); |
196 | void syncSharp(); | 202 | void syncSharp(); |
197 | void syncKDE(); | 203 | void syncKDE(); |
198 | bool syncExternalApplication(QString); | 204 | bool syncExternalApplication(QString); |
199 | int mCurrentSyncProfile ; | 205 | int mCurrentSyncProfile ; |
200 | void syncRemote( KSyncProfile* prof, bool ask = true); | 206 | void syncRemote( KSyncProfile* prof, bool ask = true); |
201 | bool edit_sync_options(); | 207 | bool edit_sync_options(); |
202 | bool edit_pisync_options(); | 208 | bool edit_pisync_options(); |
203 | int ringSync(); | 209 | int ringSync(); |
204 | QString getPassword( ); | 210 | QString getPassword( ); |
205 | bool mPisyncFinished; | 211 | bool mPisyncFinished; |
206 | QStringList mSpecificResources; | 212 | QStringList mSpecificResources; |
207 | QString mCurrentResourceLocal; | 213 | QString mCurrentResourceLocal; |
208 | QString mCurrentResourceRemote; | 214 | QString mCurrentResourceRemote; |
209 | bool mBlockSaveFlag; | 215 | bool mBlockSaveFlag; |
210 | QWidget* mParent; | 216 | QWidget* mParent; |
211 | KSyncInterface* mImplementation; | 217 | KSyncInterface* mImplementation; |
212 | TargetApp mTargetApp; | 218 | TargetApp mTargetApp; |
213 | QPopupMenu* mSyncMenu; | 219 | QPopupMenu* mSyncMenu; |
214 | QProgressBar* bar; | 220 | QProgressBar* bar; |
215 | bool mSyncWithDesktop; | 221 | bool mSyncWithDesktop; |
216 | 222 | ||
217 | private slots: | 223 | private slots: |
218 | void displayErrorPort(); | 224 | void displayErrorPort(); |
219 | void confSync(); | 225 | void confSync(); |
220 | 226 | ||
221 | 227 | ||
222 | }; | 228 | }; |
223 | 229 | ||
224 | 230 | ||
225 | class KSyncInterface | 231 | class KSyncInterface |
226 | { | 232 | { |
227 | public : | 233 | public : |
228 | virtual void removeSyncInfo( QString syncProfile) = 0; | 234 | virtual void removeSyncInfo( QString syncProfile) = 0; |
229 | virtual bool sync(KSyncManager* manager, QString filename, int mode, QString resource) = 0; | 235 | virtual bool sync(KSyncManager* manager, QString filename, int mode, QString resource) = 0; |
230 | virtual bool syncExternal(KSyncManager* manager, QString resource) | 236 | virtual bool syncExternal(KSyncManager* manager, QString resource) |
231 | { | 237 | { |
232 | // empty implementation, because some syncable applications do not | 238 | // empty implementation, because some syncable applications do not |
233 | // have an external(sharpdtm) syncmode, like pwmanager. | 239 | // have an external(sharpdtm) syncmode, like pwmanager. |
234 | return false; | 240 | return false; |
235 | } | 241 | } |
236 | 242 | ||
237 | 243 | ||
238 | }; | 244 | }; |
239 | 245 | ||
240 | 246 | ||
241 | #endif | 247 | #endif |