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