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