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