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