-rw-r--r-- | libkdepim/ksyncmanager.h | 7 |
1 files changed, 5 insertions, 2 deletions
diff --git a/libkdepim/ksyncmanager.h b/libkdepim/ksyncmanager.h index 810a515..bd3ecdc 100644 --- a/libkdepim/ksyncmanager.h +++ b/libkdepim/ksyncmanager.h | |||
@@ -1,174 +1,177 @@ | |||
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 | signals: | 51 | signals: |
52 | void file_received( bool ); | 52 | void file_received( bool ); |
53 | void request_file(); | 53 | void request_file(); |
54 | void saveFile(); | 54 | void saveFile(); |
55 | void endConnect(); | 55 | void endConnect(); |
56 | private slots: | 56 | private slots: |
57 | void discardClient(); | 57 | void discardClient(); |
58 | void deleteSocket(); | ||
58 | void readClient(); | 59 | void readClient(); |
60 | void displayErrorMessage(); | ||
59 | void readBackFileFromSocket(); | 61 | void readBackFileFromSocket(); |
60 | private : | 62 | private : |
63 | int mErrorMessage; | ||
61 | bool blockRC; | 64 | bool blockRC; |
62 | void send_file(); | 65 | void send_file(); |
63 | void get_file(); | 66 | void get_file(); |
64 | void end_connect(); | 67 | void end_connect(); |
65 | void error_connect(); | 68 | void error_connect( QString ); |
66 | QDialog* mSyncActionDialog; | 69 | QDialog* mSyncActionDialog; |
67 | QSocket* mSocket; | 70 | QSocket* mSocket; |
68 | QString mPassWord; | 71 | QString mPassWord; |
69 | QString mFileName; | 72 | QString mFileName; |
70 | QTime piTime; | 73 | QTime piTime; |
71 | QString piFileString; | 74 | QString piFileString; |
72 | }; | 75 | }; |
73 | 76 | ||
74 | class KCommandSocket : public QObject | 77 | class KCommandSocket : public QObject |
75 | { | 78 | { |
76 | Q_OBJECT | 79 | Q_OBJECT |
77 | public: | 80 | public: |
78 | enum state { successR, errorR, successW, errorW, errorTO, errorPW,quiet }; | 81 | enum state { successR, errorR, successW, errorW, errorTO, errorPW, errorCA, errorFI, errorUN,quiet }; |
79 | KCommandSocket ( QString password, Q_UINT16 port, QString host, QObject * parent=0, QWidget* cap = 0, const char * name=0 ); | 82 | KCommandSocket ( QString password, Q_UINT16 port, QString host, QObject * parent=0, QWidget* cap = 0, const char * name=0 ); |
80 | void readFile( QString ); | 83 | void readFile( QString ); |
81 | void writeFile( QString ); | 84 | void writeFile( QString ); |
82 | void sendStop(); | 85 | void sendStop(); |
83 | 86 | ||
84 | private slots : | 87 | private slots : |
85 | void sendFileRequest(); | 88 | void sendFileRequest(); |
86 | 89 | ||
87 | signals: | 90 | signals: |
88 | void commandFinished( KCommandSocket*, int ); | 91 | void commandFinished( KCommandSocket*, int ); |
89 | private slots: | 92 | private slots: |
90 | void startReadFileFromSocket(); | 93 | void startReadFileFromSocket(); |
91 | void readFileFromSocket(); | 94 | void readFileFromSocket(); |
92 | void deleteSocket(); | 95 | void deleteSocket(); |
93 | void writeFileToSocket(); | 96 | void writeFileToSocket(); |
94 | private : | 97 | private : |
95 | QWidget* tlw; | 98 | QWidget* tlw; |
96 | QSocket* mSocket; | 99 | QSocket* mSocket; |
97 | QString mPassWord; | 100 | QString mPassWord; |
98 | Q_UINT16 mPort; | 101 | Q_UINT16 mPort; |
99 | QString mHost; | 102 | QString mHost; |
100 | QString mFileName; | 103 | QString mFileName; |
101 | QTimer* mTimerSocket; | 104 | QTimer* mTimerSocket; |
102 | int mRetVal; | 105 | int mRetVal; |
103 | QTime mTime; | 106 | QTime mTime; |
104 | QString mFileString; | 107 | QString mFileString; |
105 | bool mFirst; | 108 | bool mFirst; |
106 | bool mFirstLine; | 109 | bool mFirstLine; |
107 | }; | 110 | }; |
108 | 111 | ||
109 | 112 | ||
110 | class KSyncManager : public QObject | 113 | class KSyncManager : public QObject |
111 | { | 114 | { |
112 | Q_OBJECT | 115 | Q_OBJECT |
113 | 116 | ||
114 | public: | 117 | public: |
115 | enum TargetApp { | 118 | enum TargetApp { |
116 | KOPI = 0, | 119 | KOPI = 0, |
117 | KAPI = 1, | 120 | KAPI = 1, |
118 | PWMPI = 2 }; | 121 | PWMPI = 2 }; |
119 | 122 | ||
120 | KSyncManager(QWidget* parent, KSyncInterface* implementation, TargetApp ta, KPimPrefs* prefs, QPopupMenu* syncmenu); | 123 | KSyncManager(QWidget* parent, KSyncInterface* implementation, TargetApp ta, KPimPrefs* prefs, QPopupMenu* syncmenu); |
121 | ~KSyncManager() ; | 124 | ~KSyncManager() ; |
122 | 125 | ||
123 | void multiSync( bool askforPrefs ); | 126 | void multiSync( bool askforPrefs ); |
124 | bool blockSave() { return mBlockSaveFlag; } | 127 | bool blockSave() { return mBlockSaveFlag; } |
125 | void setBlockSave(bool sa) { mBlockSaveFlag = sa; } | 128 | void setBlockSave(bool sa) { mBlockSaveFlag = sa; } |
126 | void setDefaultFileName( QString s) ; | 129 | void setDefaultFileName( QString s) ; |
127 | QString defaultFileName() { return mDefFileName ;} | 130 | QString defaultFileName() { return mDefFileName ;} |
128 | QString syncFileName(); | 131 | QString syncFileName(); |
129 | void enableQuick( bool ask = true); | 132 | void enableQuick( bool ask = true); |
130 | 133 | ||
131 | bool syncWithDesktop () { return mSyncWithDesktop;} | 134 | bool syncWithDesktop () { return mSyncWithDesktop;} |
132 | QString getCurrentSyncDevice() { return mCurrentSyncDevice; } | 135 | QString getCurrentSyncDevice() { return mCurrentSyncDevice; } |
133 | QString getCurrentSyncName() { return mCurrentSyncName; } | 136 | QString getCurrentSyncName() { return mCurrentSyncName; } |
134 | 137 | ||
135 | void showProgressBar(int percentage, QString caption = QString::null, int total=100); | 138 | void showProgressBar(int percentage, QString caption = QString::null, int total=100); |
136 | void hideProgressBar(); | 139 | void hideProgressBar(); |
137 | bool isProgressBarCanceled(); | 140 | bool isProgressBarCanceled(); |
138 | 141 | ||
139 | // sync stuff | 142 | // sync stuff |
140 | QString mLocalMachineName; | 143 | QString mLocalMachineName; |
141 | QStringList mExternSyncProfiles; | 144 | QStringList mExternSyncProfiles; |
142 | QStringList mSyncProfileNames; | 145 | QStringList mSyncProfileNames; |
143 | bool mAskForPreferences; | 146 | bool mAskForPreferences; |
144 | bool mShowSyncSummary; | 147 | bool mShowSyncSummary; |
145 | bool mIsKapiFile; | 148 | bool mIsKapiFile; |
146 | bool mWriteBackExistingOnly; | 149 | bool mWriteBackExistingOnly; |
147 | int mSyncAlgoPrefs; | 150 | int mSyncAlgoPrefs; |
148 | bool mWriteBackFile; | 151 | bool mWriteBackFile; |
149 | int mWriteBackInFuture; | 152 | int mWriteBackInFuture; |
150 | int mWriteBackInPast; | 153 | int mWriteBackInPast; |
151 | QString mPhoneDevice; | 154 | QString mPhoneDevice; |
152 | QString mPhoneConnection; | 155 | QString mPhoneConnection; |
153 | QString mPhoneModel; | 156 | QString mPhoneModel; |
154 | QString mPassWordPiSync; | 157 | QString mPassWordPiSync; |
155 | QString mActiveSyncPort; | 158 | QString mActiveSyncPort; |
156 | QString mActiveSyncIP ; | 159 | QString mActiveSyncIP ; |
157 | QString mFilterInCal; | 160 | QString mFilterInCal; |
158 | QString mFilterOutCal; | 161 | QString mFilterOutCal; |
159 | QString mFilterInAB; | 162 | QString mFilterInAB; |
160 | QString mFilterOutAB; | 163 | QString mFilterOutAB; |
161 | static QDateTime mRequestedSyncEvent; | 164 | static QDateTime mRequestedSyncEvent; |
162 | 165 | ||
163 | signals: | 166 | signals: |
164 | void save(); | 167 | void save(); |
165 | void request_file(); | 168 | void request_file(); |
166 | void getFile( bool ); | 169 | void getFile( bool ); |
167 | 170 | ||
168 | public slots: | 171 | public slots: |
169 | void slotSyncMenu( int ); | 172 | void slotSyncMenu( int ); |
170 | void slotClearMenu( int action ); | 173 | void slotClearMenu( int action ); |
171 | void deleteCommandSocket(KCommandSocket*s, int state); | 174 | void deleteCommandSocket(KCommandSocket*s, int state); |
172 | void readFileFromSocket(); | 175 | void readFileFromSocket(); |
173 | void fillSyncMenu(); | 176 | void fillSyncMenu(); |
174 | 177 | ||