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