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