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