-rw-r--r-- | libkdepim/ksyncmanager.h | 93 |
1 files changed, 37 insertions, 56 deletions
diff --git a/libkdepim/ksyncmanager.h b/libkdepim/ksyncmanager.h index 7027894..1f7c7e7 100644 --- a/libkdepim/ksyncmanager.h +++ b/libkdepim/ksyncmanager.h | |||
@@ -1,23 +1,23 @@ | |||
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 |
@@ -43,18 +43,17 @@ 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 | signals: | |
52 | signals: | ||
53 | void file_received( bool ); | 52 | void file_received( bool ); |
54 | void request_file(); | 53 | void request_file(); |
55 | void saveFile(); | 54 | void saveFile(); |
56 | void endConnect(); | 55 | void endConnect(); |
57 | private slots: | 56 | private slots: |
58 | void discardClient(); | 57 | void discardClient(); |
59 | void readClient(); | 58 | void readClient(); |
60 | void readBackFileFromSocket(); | 59 | void readBackFileFromSocket(); |
@@ -74,17 +73,16 @@ private slots: | |||
74 | class KCommandSocket : public QObject | 73 | class KCommandSocket : public QObject |
75 | { | 74 | { |
76 | Q_OBJECT | 75 | Q_OBJECT |
77 | public: | 76 | public: |
78 | enum state { successR, errorR, successW, errorW, errorTO, quiet }; | 77 | enum state { successR, errorR, successW, errorW, errorTO, quiet }; |
79 | KCommandSocket ( QString password, Q_UINT16 port, QString host, QObject * parent=0, const char * name=0 ); | 78 | KCommandSocket ( QString password, Q_UINT16 port, QString host, QObject * parent=0, const char * name=0 ); |
80 | void readFile( QString ); | 79 | void readFile( QString ); |
81 | void writeFile( QString ); | 80 | void writeFile( QString ); |
82 | void sendStop(); | 81 | void sendStop(); |
83 | 82 | ||
84 | 83 | signals: | |
85 | signals: | ||
86 | void commandFinished( KCommandSocket*, int ); | 84 | void commandFinished( KCommandSocket*, int ); |
87 | private slots: | 85 | private slots: |
88 | void startReadFileFromSocket(); | 86 | void startReadFileFromSocket(); |
89 | void readFileFromSocket(); | 87 | void readFileFromSocket(); |
90 | void deleteSocket(); | 88 | void deleteSocket(); |
@@ -105,14 +103,13 @@ private slots: | |||
105 | 103 | ||
106 | class KSyncManager : public QObject | 104 | class KSyncManager : public QObject |
107 | { | 105 | { |
108 | Q_OBJECT | 106 | Q_OBJECT |
109 | 107 | ||
110 | public: | 108 | public: |
111 | enum TargetApp { | 109 | enum TargetApp { |
112 | KOPI = 0, | 110 | KOPI = 0, |
113 | KAPI = 1, | 111 | KAPI = 1, |
114 | PWMPI = 2 }; | 112 | PWMPI = 2 }; |
115 | |||
116 | 113 | ||
117 | KSyncManager(QWidget* parent, KSyncInterface* implementation, TargetApp ta, KPimPrefs* prefs, QPopupMenu* syncmenu); | 114 | KSyncManager(QWidget* parent, KSyncInterface* implementation, TargetApp ta, KPimPrefs* prefs, QPopupMenu* syncmenu); |
118 | ~KSyncManager() ; | 115 | ~KSyncManager() ; |
@@ -123,7 +120,6 @@ class KSyncManager : public QObject | |||
123 | void setDefaultFileName( QString s) { mDefFileName = s ;} | 120 | void setDefaultFileName( QString s) { mDefFileName = s ;} |
124 | QString defaultFileName() { return mDefFileName ;} | 121 | QString defaultFileName() { return mDefFileName ;} |
125 | QString syncFileName(); | 122 | QString syncFileName(); |
126 | void fillSyncMenu(); | ||
127 | 123 | ||
128 | QString getCurrentSyncDevice() { return mCurrentSyncDevice; } | 124 | QString getCurrentSyncDevice() { return mCurrentSyncDevice; } |
129 | QString getCurrentSyncName() { return mCurrentSyncName; } | 125 | QString getCurrentSyncName() { return mCurrentSyncName; } |
@@ -132,17 +128,14 @@ class KSyncManager : public QObject | |||
132 | void hideProgressBar(); | 128 | void hideProgressBar(); |
133 | bool isProgressBarCanceled(); | 129 | bool isProgressBarCanceled(); |
134 | 130 | ||
135 | // sync stuff | 131 | // sync stuff |
136 | QString mLocalMachineName; | 132 | QString mLocalMachineName; |
137 | QStringList mExternSyncProfiles; | 133 | QStringList mExternSyncProfiles; |
138 | QStringList mSyncProfileNames; | 134 | QStringList mSyncProfileNames; |
139 | bool mAskForPreferences; | 135 | bool mAskForPreferences; |
140 | bool mShowSyncSummary; | 136 | bool mShowSyncSummary; |
141 | bool mShowSyncEvents; | ||
142 | bool mShowTodoInAgenda; | ||
143 | bool mWriteBackExistingOnly; | 137 | bool mWriteBackExistingOnly; |
144 | int mSyncAlgoPrefs; | 138 | int mSyncAlgoPrefs; |
145 | int mRingSyncAlgoPrefs; | ||
146 | bool mWriteBackFile; | 139 | bool mWriteBackFile; |
147 | int mWriteBackInFuture; | 140 | int mWriteBackInFuture; |
148 | QString mPhoneDevice; | 141 | QString mPhoneDevice; |
@@ -157,14 +150,13 @@ class KSyncManager : public QObject | |||
157 | void request_file(); | 150 | void request_file(); |
158 | void getFile( bool ); | 151 | void getFile( bool ); |
159 | 152 | ||
160 | public slots: | 153 | public slots: |
161 | void slotSyncMenu( int ); | 154 | void slotSyncMenu( int ); |
162 | void deleteCommandSocket(KCommandSocket*s, int state); | 155 | void deleteCommandSocket(KCommandSocket*s, int state); |
163 | void readFileFromSocket(); | 156 | void readFileFromSocket(); |
157 | void fillSyncMenu(); | ||
164 | 158 | ||
165 | private: | 159 | private: |
166 | // LR ******************************* | ||
167 | // sync stuff! | ||
168 | void syncPi(); | 160 | void syncPi(); |
169 | KServerSocket * mServerSocket; | 161 | KServerSocket * mServerSocket; |
170 | void enableQuick(); | 162 | void enableQuick(); |
@@ -173,7 +165,7 @@ class KSyncManager : public QObject | |||
173 | QString mCurrentSyncDevice; | 165 | QString mCurrentSyncDevice; |
174 | QString mCurrentSyncName; | 166 | QString mCurrentSyncName; |
175 | void quickSyncLocalFile(); | 167 | void quickSyncLocalFile(); |
176 | bool syncWithFile( QString fn , bool quick ); | 168 | bool syncWithFile( QString fn , bool quick ); |
177 | void syncLocalFile(); | 169 | void syncLocalFile(); |
178 | void syncPhone(); | 170 | void syncPhone(); |
179 | void syncSharp(); | 171 | void syncSharp(); |
@@ -184,40 +176,29 @@ class KSyncManager : public QObject | |||
184 | int ringSync(); | 176 | int ringSync(); |
185 | QString getPassword( ); | 177 | QString getPassword( ); |
186 | 178 | ||
187 | private slots: | 179 | private slots: |
188 | void confSync(); | 180 | void confSync(); |
189 | // ********************* | ||
190 | |||
191 | private: | 181 | private: |
192 | bool mBlockSaveFlag; | 182 | bool mBlockSaveFlag; |
193 | |||
194 | |||
195 | QWidget* mParent; | 183 | QWidget* mParent; |
196 | KSyncInterface* mImplementation; | 184 | KSyncInterface* mImplementation; |
197 | TargetApp mTargetApp; | 185 | TargetApp mTargetApp; |
198 | QPopupMenu* mSyncMenu; | 186 | QPopupMenu* mSyncMenu; |
199 | |||
200 | QProgressBar* bar; | 187 | QProgressBar* bar; |
201 | 188 | ||
202 | |||
203 | |||
204 | |||
205 | |||
206 | }; | 189 | }; |
207 | 190 | ||
208 | 191 | ||
209 | class KSyncInterface | 192 | class KSyncInterface |
210 | { | 193 | { |
211 | |||
212 | |||
213 | public : | 194 | public : |
214 | virtual bool sync(KSyncManager* manager, QString filename, int mode) = 0; | 195 | virtual bool sync(KSyncManager* manager, QString filename, int mode) = 0; |
215 | |||
216 | virtual bool syncExternal(KSyncManager* manager, QString resource) | 196 | virtual bool syncExternal(KSyncManager* manager, QString resource) |
217 | { | 197 | { |
218 | // empty implementation, because some syncable applications do not have an external(sharpdtm) syncmode, like pwmanager. | 198 | // empty implementation, because some syncable applications do not |
219 | return false; | 199 | // have an external(sharpdtm) syncmode, like pwmanager. |
220 | } | 200 | return false; |
201 | } | ||
221 | 202 | ||
222 | 203 | ||
223 | }; | 204 | }; |