summaryrefslogtreecommitdiffabout
path: root/libkdepim/ksyncmanager.h
Unidiff
Diffstat (limited to 'libkdepim/ksyncmanager.h') (more/less context) (ignore whitespace changes)
-rw-r--r--libkdepim/ksyncmanager.h2
1 files changed, 2 insertions, 0 deletions
diff --git a/libkdepim/ksyncmanager.h b/libkdepim/ksyncmanager.h
index 53c611d..604adb8 100644
--- a/libkdepim/ksyncmanager.h
+++ b/libkdepim/ksyncmanager.h
@@ -1,162 +1,164 @@
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 discardClient(); 62 void discardClient();
62 void deleteSocket(); 63 void deleteSocket();
63 void readClient(); 64 void readClient();
64 void displayErrorMessage(); 65 void displayErrorMessage();
65 void readBackFileFromSocket(); 66 void readBackFileFromSocket();
66 private : 67 private :
68 int mPendingConnect;
67 QString mResource; 69 QString mResource;
68 int mErrorMessage; 70 int mErrorMessage;
69 bool blockRC; 71 bool blockRC;
70 void send_file(); 72 void send_file();
71 void get_file(); 73 void get_file();
72 void end_connect(); 74 void end_connect();
73 void error_connect( QString ); 75 void error_connect( QString );
74 QDialog* mSyncActionDialog; 76 QDialog* mSyncActionDialog;
75 QSocket* mSocket; 77 QSocket* mSocket;
76 QString mPassWord; 78 QString mPassWord;
77 QString mFileName; 79 QString mFileName;
78 QTime piTime; 80 QTime piTime;
79 QString piFileString; 81 QString piFileString;
80}; 82};
81 83
82class KCommandSocket : public QObject 84class KCommandSocket : public QObject
83{ 85{
84 Q_OBJECT 86 Q_OBJECT
85 public: 87 public:
86 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 };
87 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 );
88 void readFile( QString ); 90 void readFile( QString );
89 void writeFile( QString ); 91 void writeFile( QString );
90 void sendStop(); 92 void sendStop();
91 93
92 private slots : 94 private slots :
93 void sendFileRequest(); 95 void sendFileRequest();
94 void updateConnectDialog(); 96 void updateConnectDialog();
95 97
96 signals: 98 signals:
97 void commandFinished( KCommandSocket*, int ); 99 void commandFinished( KCommandSocket*, int );
98 private slots: 100 private slots:
99 void startReadFileFromSocket(); 101 void startReadFileFromSocket();
100 void readFileFromSocket(); 102 void readFileFromSocket();
101 void deleteSocket(); 103 void deleteSocket();
102 void writeFileToSocket(); 104 void writeFileToSocket();
103 private : 105 private :
104 QString mRemoteResource; 106 QString mRemoteResource;
105 int mConnectCount; 107 int mConnectCount;
106 int mConnectMax; 108 int mConnectMax;
107 KProgressDialog mConnectProgress; 109 KProgressDialog mConnectProgress;
108 QWidget* tlw; 110 QWidget* tlw;
109 QSocket* mSocket; 111 QSocket* mSocket;
110 QString mPassWord; 112 QString mPassWord;
111 Q_UINT16 mPort; 113 Q_UINT16 mPort;
112 QString mHost; 114 QString mHost;
113 QString mFileName; 115 QString mFileName;
114 QTimer* mTimerSocket; 116 QTimer* mTimerSocket;
115 int mRetVal; 117 int mRetVal;
116 QTime mTime; 118 QTime mTime;
117 QString mFileString; 119 QString mFileString;
118 bool mFirst; 120 bool mFirst;
119 bool mFirstLine; 121 bool mFirstLine;
120}; 122};
121 123
122 124
123class KSyncManager : public QObject 125class KSyncManager : public QObject
124{ 126{
125 Q_OBJECT 127 Q_OBJECT
126 128
127 public: 129 public:
128 enum TargetApp { 130 enum TargetApp {
129 KOPI = 0, 131 KOPI = 0,
130 KAPI = 1, 132 KAPI = 1,
131 PWMPI = 2 }; 133 PWMPI = 2 };
132 134
133 KSyncManager(QWidget* parent, KSyncInterface* implementation, TargetApp ta, KPimPrefs* prefs, QPopupMenu* syncmenu); 135 KSyncManager(QWidget* parent, KSyncInterface* implementation, TargetApp ta, KPimPrefs* prefs, QPopupMenu* syncmenu);
134 ~KSyncManager() ; 136 ~KSyncManager() ;
135 137
136 void multiSync( bool askforPrefs ); 138 void multiSync( bool askforPrefs );
137 bool blockSave() { return mBlockSaveFlag; } 139 bool blockSave() { return mBlockSaveFlag; }
138 void setBlockSave(bool sa) { mBlockSaveFlag = sa; } 140 void setBlockSave(bool sa) { mBlockSaveFlag = sa; }
139 void setDefaultFileName( QString s) ; 141 void setDefaultFileName( QString s) ;
140 QString defaultFileName() { return mDefFileName ;} 142 QString defaultFileName() { return mDefFileName ;}
141 QString syncFileName(); 143 QString syncFileName();
142 void enableQuick( bool ask = true); 144 void enableQuick( bool ask = true);
143 145
144 bool syncWithDesktop () { return mSyncWithDesktop;} 146 bool syncWithDesktop () { return mSyncWithDesktop;}
145 QString getCurrentSyncDevice() { return mCurrentSyncDevice; } 147 QString getCurrentSyncDevice() { return mCurrentSyncDevice; }
146 QString getCurrentSyncName() { return mCurrentSyncName; } 148 QString getCurrentSyncName() { return mCurrentSyncName; }
147 149
148 void showProgressBar(int percentage, QString caption = QString::null, int total=100); 150 void showProgressBar(int percentage, QString caption = QString::null, int total=100);
149 void hideProgressBar(); 151 void hideProgressBar();
150 bool isProgressBarCanceled(); 152 bool isProgressBarCanceled();
151 153
152 // sync stuff 154 // sync stuff
153 QString mLocalMachineName; 155 QString mLocalMachineName;
154 QStringList mExternSyncProfiles; 156 QStringList mExternSyncProfiles;
155 QStringList mSyncProfileNames; 157 QStringList mSyncProfileNames;
156 bool mAskForPreferences; 158 bool mAskForPreferences;
157 bool mShowSyncSummary; 159 bool mShowSyncSummary;
158 bool mIsKapiFile; 160 bool mIsKapiFile;
159 bool mWriteBackExistingOnly; 161 bool mWriteBackExistingOnly;
160 int mSyncAlgoPrefs; 162 int mSyncAlgoPrefs;
161 bool mWriteBackFile; 163 bool mWriteBackFile;
162 int mWriteBackInFuture; 164 int mWriteBackInFuture;