author | zautrix <zautrix> | 2005-07-08 23:55:16 (UTC) |
---|---|---|
committer | zautrix <zautrix> | 2005-07-08 23:55:16 (UTC) |
commit | 1e11d41ecb6a912c4c0a2747eb1fa26626fdcca2 (patch) (unidiff) | |
tree | 922c8080f9b9cc863e7d5637a5d9d775ee8c0355 /libkdepim/ksyncmanager.h | |
parent | 3e94cf2e8a14c7d40aea28a0fe5538abcd211746 (diff) | |
download | kdepimpi-1e11d41ecb6a912c4c0a2747eb1fa26626fdcca2.zip kdepimpi-1e11d41ecb6a912c4c0a2747eb1fa26626fdcca2.tar.gz kdepimpi-1e11d41ecb6a912c4c0a2747eb1fa26626fdcca2.tar.bz2 |
fixxx
-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 30ec1e6..e6738b6 100644 --- a/libkdepim/ksyncmanager.h +++ b/libkdepim/ksyncmanager.h | |||
@@ -1,145 +1,150 @@ | |||
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 | 33 | ||
33 | class QPopupMenu; | 34 | class QPopupMenu; |
34 | class KSyncProfile; | 35 | class KSyncProfile; |
35 | class KPimPrefs; | 36 | class KPimPrefs; |
36 | class QWidget; | 37 | class QWidget; |
37 | class KSyncManager; | 38 | class KSyncManager; |
38 | class KSyncInterface; | 39 | class KSyncInterface; |
39 | class QProgressBar; | 40 | class QProgressBar; |
40 | 41 | ||
41 | 42 | ||
42 | class KServerSocket : public QServerSocket | 43 | class KServerSocket : public QServerSocket |
43 | { | 44 | { |
44 | Q_OBJECT | 45 | Q_OBJECT |
45 | 46 | ||
46 | public: | 47 | public: |
47 | KServerSocket ( QString password, Q_UINT16 port, int backlog = 0, QObject * parent=0, const char * name=0 ); | 48 | KServerSocket ( QString password, Q_UINT16 port, int backlog = 0, QObject * parent=0, const char * name=0 ); |
48 | 49 | ||
49 | void newConnection ( int socket ) ; | 50 | void newConnection ( int socket ) ; |
50 | void setFileName( QString fn ) {mFileName = fn;}; | 51 | void setFileName( QString fn ) {mFileName = fn;}; |
51 | signals: | 52 | signals: |
52 | void file_received( bool ); | 53 | void file_received( bool ); |
53 | void request_file(); | 54 | void request_file(); |
54 | void saveFile(); | 55 | void saveFile(); |
55 | void endConnect(); | 56 | void endConnect(); |
56 | private slots: | 57 | private slots: |
57 | void discardClient(); | 58 | void discardClient(); |
58 | void deleteSocket(); | 59 | void deleteSocket(); |
59 | void readClient(); | 60 | void readClient(); |
60 | void displayErrorMessage(); | 61 | void displayErrorMessage(); |
61 | void readBackFileFromSocket(); | 62 | void readBackFileFromSocket(); |
62 | private : | 63 | private : |
63 | int mErrorMessage; | 64 | int mErrorMessage; |
64 | bool blockRC; | 65 | bool blockRC; |
65 | void send_file(); | 66 | void send_file(); |
66 | void get_file(); | 67 | void get_file(); |
67 | void end_connect(); | 68 | void end_connect(); |
68 | void error_connect( QString ); | 69 | void error_connect( QString ); |
69 | QDialog* mSyncActionDialog; | 70 | QDialog* mSyncActionDialog; |
70 | QSocket* mSocket; | 71 | QSocket* mSocket; |
71 | QString mPassWord; | 72 | QString mPassWord; |
72 | QString mFileName; | 73 | QString mFileName; |
73 | QTime piTime; | 74 | QTime piTime; |
74 | QString piFileString; | 75 | QString piFileString; |
75 | }; | 76 | }; |
76 | 77 | ||
77 | class KCommandSocket : public QObject | 78 | class KCommandSocket : public QObject |
78 | { | 79 | { |
79 | Q_OBJECT | 80 | Q_OBJECT |
80 | public: | 81 | public: |
81 | enum state { successR, errorR, successW, errorW, errorTO, errorPW, errorCA, errorFI, errorUN, errorED,quiet }; | 82 | enum state { successR, errorR, successW, errorW, errorTO, errorPW, errorCA, errorFI, errorUN, errorED,quiet }; |
82 | KCommandSocket ( QString password, Q_UINT16 port, QString host, QObject * parent=0, QWidget* cap = 0, const char * name=0 ); | 83 | KCommandSocket ( QString password, Q_UINT16 port, QString host, QObject * parent=0, QWidget* cap = 0, const char * name=0 ); |
83 | void readFile( QString ); | 84 | void readFile( QString ); |
84 | void writeFile( QString ); | 85 | void writeFile( QString ); |
85 | void sendStop(); | 86 | void sendStop(); |
86 | 87 | ||
87 | private slots : | 88 | private slots : |
88 | void sendFileRequest(); | 89 | void sendFileRequest(); |
90 | void updateConnectDialog(); | ||
89 | 91 | ||
90 | signals: | 92 | signals: |
91 | void commandFinished( KCommandSocket*, int ); | 93 | void commandFinished( KCommandSocket*, int ); |
92 | private slots: | 94 | private slots: |
93 | void startReadFileFromSocket(); | 95 | void startReadFileFromSocket(); |
94 | void readFileFromSocket(); | 96 | void readFileFromSocket(); |
95 | void deleteSocket(); | 97 | void deleteSocket(); |
96 | void writeFileToSocket(); | 98 | void writeFileToSocket(); |
97 | private : | 99 | private : |
100 | int mConnectCount; | ||
101 | int mConnectMax; | ||
102 | QProgressDialog mConnectProgress; | ||
98 | QWidget* tlw; | 103 | QWidget* tlw; |
99 | QSocket* mSocket; | 104 | QSocket* mSocket; |
100 | QString mPassWord; | 105 | QString mPassWord; |
101 | Q_UINT16 mPort; | 106 | Q_UINT16 mPort; |
102 | QString mHost; | 107 | QString mHost; |
103 | QString mFileName; | 108 | QString mFileName; |
104 | QTimer* mTimerSocket; | 109 | QTimer* mTimerSocket; |
105 | int mRetVal; | 110 | int mRetVal; |
106 | QTime mTime; | 111 | QTime mTime; |
107 | QString mFileString; | 112 | QString mFileString; |
108 | bool mFirst; | 113 | bool mFirst; |
109 | bool mFirstLine; | 114 | bool mFirstLine; |
110 | }; | 115 | }; |
111 | 116 | ||
112 | 117 | ||
113 | class KSyncManager : public QObject | 118 | class KSyncManager : public QObject |
114 | { | 119 | { |
115 | Q_OBJECT | 120 | Q_OBJECT |
116 | 121 | ||
117 | public: | 122 | public: |
118 | enum TargetApp { | 123 | enum TargetApp { |
119 | KOPI = 0, | 124 | KOPI = 0, |
120 | KAPI = 1, | 125 | KAPI = 1, |
121 | PWMPI = 2 }; | 126 | PWMPI = 2 }; |
122 | 127 | ||
123 | KSyncManager(QWidget* parent, KSyncInterface* implementation, TargetApp ta, KPimPrefs* prefs, QPopupMenu* syncmenu); | 128 | KSyncManager(QWidget* parent, KSyncInterface* implementation, TargetApp ta, KPimPrefs* prefs, QPopupMenu* syncmenu); |
124 | ~KSyncManager() ; | 129 | ~KSyncManager() ; |
125 | 130 | ||
126 | void multiSync( bool askforPrefs ); | 131 | void multiSync( bool askforPrefs ); |
127 | bool blockSave() { return mBlockSaveFlag; } | 132 | bool blockSave() { return mBlockSaveFlag; } |
128 | void setBlockSave(bool sa) { mBlockSaveFlag = sa; } | 133 | void setBlockSave(bool sa) { mBlockSaveFlag = sa; } |
129 | void setDefaultFileName( QString s) ; | 134 | void setDefaultFileName( QString s) ; |
130 | QString defaultFileName() { return mDefFileName ;} | 135 | QString defaultFileName() { return mDefFileName ;} |
131 | QString syncFileName(); | 136 | QString syncFileName(); |
132 | void enableQuick( bool ask = true); | 137 | void enableQuick( bool ask = true); |
133 | 138 | ||
134 | bool syncWithDesktop () { return mSyncWithDesktop;} | 139 | bool syncWithDesktop () { return mSyncWithDesktop;} |
135 | QString getCurrentSyncDevice() { return mCurrentSyncDevice; } | 140 | QString getCurrentSyncDevice() { return mCurrentSyncDevice; } |
136 | QString getCurrentSyncName() { return mCurrentSyncName; } | 141 | QString getCurrentSyncName() { return mCurrentSyncName; } |
137 | 142 | ||
138 | void showProgressBar(int percentage, QString caption = QString::null, int total=100); | 143 | void showProgressBar(int percentage, QString caption = QString::null, int total=100); |
139 | void hideProgressBar(); | 144 | void hideProgressBar(); |
140 | bool isProgressBarCanceled(); | 145 | bool isProgressBarCanceled(); |
141 | 146 | ||
142 | // sync stuff | 147 | // sync stuff |
143 | QString mLocalMachineName; | 148 | QString mLocalMachineName; |
144 | QStringList mExternSyncProfiles; | 149 | QStringList mExternSyncProfiles; |
145 | QStringList mSyncProfileNames; | 150 | QStringList mSyncProfileNames; |
@@ -160,71 +165,72 @@ class KSyncManager : public QObject | |||
160 | QString mFilterInCal; | 165 | QString mFilterInCal; |
161 | QString mFilterOutCal; | 166 | QString mFilterOutCal; |
162 | QString mFilterInAB; | 167 | QString mFilterInAB; |
163 | QString mFilterOutAB; | 168 | QString mFilterOutAB; |
164 | static QDateTime mRequestedSyncEvent; | 169 | static QDateTime mRequestedSyncEvent; |
165 | 170 | ||
166 | signals: | 171 | signals: |
167 | void save(); | 172 | void save(); |
168 | void request_file(); | 173 | void request_file(); |
169 | void getFile( bool ); | 174 | void getFile( bool ); |
170 | 175 | ||
171 | public slots: | 176 | public slots: |
172 | void slotSyncMenu( int ); | 177 | void slotSyncMenu( int ); |
173 | void slotClearMenu( int action ); | 178 | void slotClearMenu( int action ); |
174 | void deleteCommandSocket(KCommandSocket*s, int state); | 179 | void deleteCommandSocket(KCommandSocket*s, int state); |
175 | void readFileFromSocket(); | 180 | void readFileFromSocket(); |
176 | void fillSyncMenu(); | 181 | void fillSyncMenu(); |
177 | 182 | ||
178 | private: | 183 | private: |
179 | void syncPi(); | 184 | void syncPi(); |
180 | KServerSocket * mServerSocket; | 185 | KServerSocket * mServerSocket; |
181 | KPimPrefs* mPrefs; | 186 | KPimPrefs* mPrefs; |
182 | QString mDefFileName; | 187 | QString mDefFileName; |
183 | QString mCurrentSyncDevice; | 188 | QString mCurrentSyncDevice; |
184 | QString mCurrentSyncName; | 189 | QString mCurrentSyncName; |
185 | void quickSyncLocalFile(); | 190 | void quickSyncLocalFile(); |
186 | bool syncWithFile( QString fn , bool quick ); | 191 | bool syncWithFile( QString fn , bool quick ); |
187 | void syncLocalFile(); | 192 | void syncLocalFile(); |
188 | void syncPhone(); | 193 | void syncPhone(); |
189 | void syncSharp(); | 194 | void syncSharp(); |
190 | void syncKDE(); | 195 | void syncKDE(); |
191 | bool syncExternalApplication(QString); | 196 | bool syncExternalApplication(QString); |
192 | int mCurrentSyncProfile ; | 197 | int mCurrentSyncProfile ; |
193 | void syncRemote( KSyncProfile* prof, bool ask = true); | 198 | void syncRemote( KSyncProfile* prof, bool ask = true); |
194 | bool edit_sync_options(); | 199 | bool edit_sync_options(); |
195 | bool edit_pisync_options(); | 200 | bool edit_pisync_options(); |
196 | int ringSync(); | 201 | int ringSync(); |
197 | QString getPassword( ); | 202 | QString getPassword( ); |
198 | bool mPisyncFinished; | 203 | bool mPisyncFinished; |
199 | bool mBlockSaveFlag; | 204 | bool mBlockSaveFlag; |
200 | QWidget* mParent; | 205 | QWidget* mParent; |
201 | KSyncInterface* mImplementation; | 206 | KSyncInterface* mImplementation; |
202 | TargetApp mTargetApp; | 207 | TargetApp mTargetApp; |
203 | QPopupMenu* mSyncMenu; | 208 | QPopupMenu* mSyncMenu; |
204 | QProgressBar* bar; | 209 | QProgressBar* bar; |
205 | bool mSyncWithDesktop; | 210 | bool mSyncWithDesktop; |
206 | 211 | ||
207 | private slots: | 212 | private slots: |
213 | void displayErrorPort(); | ||
208 | void confSync(); | 214 | void confSync(); |
209 | 215 | ||
210 | 216 | ||
211 | }; | 217 | }; |
212 | 218 | ||
213 | 219 | ||
214 | class KSyncInterface | 220 | class KSyncInterface |
215 | { | 221 | { |
216 | public : | 222 | public : |
217 | virtual void removeSyncInfo( QString syncProfile) = 0; | 223 | virtual void removeSyncInfo( QString syncProfile) = 0; |
218 | virtual bool sync(KSyncManager* manager, QString filename, int mode) = 0; | 224 | virtual bool sync(KSyncManager* manager, QString filename, int mode) = 0; |
219 | virtual bool syncExternal(KSyncManager* manager, QString resource) | 225 | virtual bool syncExternal(KSyncManager* manager, QString resource) |
220 | { | 226 | { |
221 | // empty implementation, because some syncable applications do not | 227 | // empty implementation, because some syncable applications do not |
222 | // have an external(sharpdtm) syncmode, like pwmanager. | 228 | // have an external(sharpdtm) syncmode, like pwmanager. |
223 | return false; | 229 | return false; |
224 | } | 230 | } |
225 | 231 | ||
226 | 232 | ||
227 | }; | 233 | }; |
228 | 234 | ||
229 | 235 | ||
230 | #endif | 236 | #endif |