summaryrefslogtreecommitdiffabout
Unidiff
Diffstat (more/less context) (show whitespace changes)
-rw-r--r--libkdepim/ksyncmanager.h3
-rw-r--r--microkde/kdialog.cpp48
-rw-r--r--microkde/kdialog.h20
3 files changed, 69 insertions, 2 deletions
diff --git a/libkdepim/ksyncmanager.h b/libkdepim/ksyncmanager.h
index e6738b6..d3734da 100644
--- a/libkdepim/ksyncmanager.h
+++ b/libkdepim/ksyncmanager.h
@@ -1,150 +1,151 @@
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 34
34class QPopupMenu; 35class QPopupMenu;
35class KSyncProfile; 36class KSyncProfile;
36class KPimPrefs; 37class KPimPrefs;
37class QWidget; 38class QWidget;
38class KSyncManager; 39class KSyncManager;
39class KSyncInterface; 40class KSyncInterface;
40class QProgressBar; 41class QProgressBar;
41 42
42 43
43class KServerSocket : public QServerSocket 44class KServerSocket : public QServerSocket
44{ 45{
45 Q_OBJECT 46 Q_OBJECT
46 47
47 public: 48 public:
48 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 );
49 50
50 void newConnection ( int socket ) ; 51 void newConnection ( int socket ) ;
51 void setFileName( QString fn ) {mFileName = fn;}; 52 void setFileName( QString fn ) {mFileName = fn;};
52 signals: 53 signals:
53 void file_received( bool ); 54 void file_received( bool );
54 void request_file(); 55 void request_file();
55 void saveFile(); 56 void saveFile();
56 void endConnect(); 57 void endConnect();
57 private slots: 58 private slots:
58 void discardClient(); 59 void discardClient();
59 void deleteSocket(); 60 void deleteSocket();
60 void readClient(); 61 void readClient();
61 void displayErrorMessage(); 62 void displayErrorMessage();
62 void readBackFileFromSocket(); 63 void readBackFileFromSocket();
63 private : 64 private :
64 int mErrorMessage; 65 int mErrorMessage;
65 bool blockRC; 66 bool blockRC;
66 void send_file(); 67 void send_file();
67 void get_file(); 68 void get_file();
68 void end_connect(); 69 void end_connect();
69 void error_connect( QString ); 70 void error_connect( QString );
70 QDialog* mSyncActionDialog; 71 QDialog* mSyncActionDialog;
71 QSocket* mSocket; 72 QSocket* mSocket;
72 QString mPassWord; 73 QString mPassWord;
73 QString mFileName; 74 QString mFileName;
74 QTime piTime; 75 QTime piTime;
75 QString piFileString; 76 QString piFileString;
76}; 77};
77 78
78class KCommandSocket : public QObject 79class KCommandSocket : public QObject
79{ 80{
80 Q_OBJECT 81 Q_OBJECT
81 public: 82 public:
82 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 };
83 KCommandSocket ( QString password, Q_UINT16 port, QString host, QObject * parent=0, QWidget* cap = 0, const char * name=0 ); 84 KCommandSocket ( QString password, Q_UINT16 port, QString host, QObject * parent=0, QWidget* cap = 0, const char * name=0 );
84 void readFile( QString ); 85 void readFile( QString );
85 void writeFile( QString ); 86 void writeFile( QString );
86 void sendStop(); 87 void sendStop();
87 88
88 private slots : 89 private slots :
89 void sendFileRequest(); 90 void sendFileRequest();
90 void updateConnectDialog(); 91 void updateConnectDialog();
91 92
92 signals: 93 signals:
93 void commandFinished( KCommandSocket*, int ); 94 void commandFinished( KCommandSocket*, int );
94 private slots: 95 private slots:
95 void startReadFileFromSocket(); 96 void startReadFileFromSocket();
96 void readFileFromSocket(); 97 void readFileFromSocket();
97 void deleteSocket(); 98 void deleteSocket();
98 void writeFileToSocket(); 99 void writeFileToSocket();
99 private : 100 private :
100 int mConnectCount; 101 int mConnectCount;
101 int mConnectMax; 102 int mConnectMax;
102 QProgressDialog mConnectProgress; 103 KProgressDialog mConnectProgress;
103 QWidget* tlw; 104 QWidget* tlw;
104 QSocket* mSocket; 105 QSocket* mSocket;
105 QString mPassWord; 106 QString mPassWord;
106 Q_UINT16 mPort; 107 Q_UINT16 mPort;
107 QString mHost; 108 QString mHost;
108 QString mFileName; 109 QString mFileName;
109 QTimer* mTimerSocket; 110 QTimer* mTimerSocket;
110 int mRetVal; 111 int mRetVal;
111 QTime mTime; 112 QTime mTime;
112 QString mFileString; 113 QString mFileString;
113 bool mFirst; 114 bool mFirst;
114 bool mFirstLine; 115 bool mFirstLine;
115}; 116};
116 117
117 118
118class KSyncManager : public QObject 119class KSyncManager : public QObject
119{ 120{
120 Q_OBJECT 121 Q_OBJECT
121 122
122 public: 123 public:
123 enum TargetApp { 124 enum TargetApp {
124 KOPI = 0, 125 KOPI = 0,
125 KAPI = 1, 126 KAPI = 1,
126 PWMPI = 2 }; 127 PWMPI = 2 };
127 128
128 KSyncManager(QWidget* parent, KSyncInterface* implementation, TargetApp ta, KPimPrefs* prefs, QPopupMenu* syncmenu); 129 KSyncManager(QWidget* parent, KSyncInterface* implementation, TargetApp ta, KPimPrefs* prefs, QPopupMenu* syncmenu);
129 ~KSyncManager() ; 130 ~KSyncManager() ;
130 131
131 void multiSync( bool askforPrefs ); 132 void multiSync( bool askforPrefs );
132 bool blockSave() { return mBlockSaveFlag; } 133 bool blockSave() { return mBlockSaveFlag; }
133 void setBlockSave(bool sa) { mBlockSaveFlag = sa; } 134 void setBlockSave(bool sa) { mBlockSaveFlag = sa; }
134 void setDefaultFileName( QString s) ; 135 void setDefaultFileName( QString s) ;
135 QString defaultFileName() { return mDefFileName ;} 136 QString defaultFileName() { return mDefFileName ;}
136 QString syncFileName(); 137 QString syncFileName();
137 void enableQuick( bool ask = true); 138 void enableQuick( bool ask = true);
138 139
139 bool syncWithDesktop () { return mSyncWithDesktop;} 140 bool syncWithDesktop () { return mSyncWithDesktop;}
140 QString getCurrentSyncDevice() { return mCurrentSyncDevice; } 141 QString getCurrentSyncDevice() { return mCurrentSyncDevice; }
141 QString getCurrentSyncName() { return mCurrentSyncName; } 142 QString getCurrentSyncName() { return mCurrentSyncName; }
142 143
143 void showProgressBar(int percentage, QString caption = QString::null, int total=100); 144 void showProgressBar(int percentage, QString caption = QString::null, int total=100);
144 void hideProgressBar(); 145 void hideProgressBar();
145 bool isProgressBarCanceled(); 146 bool isProgressBarCanceled();
146 147
147 // sync stuff 148 // sync stuff
148 QString mLocalMachineName; 149 QString mLocalMachineName;
149 QStringList mExternSyncProfiles; 150 QStringList mExternSyncProfiles;
150 QStringList mSyncProfileNames; 151 QStringList mSyncProfileNames;
diff --git a/microkde/kdialog.cpp b/microkde/kdialog.cpp
index 961631e..f9e0126 100644
--- a/microkde/kdialog.cpp
+++ b/microkde/kdialog.cpp
@@ -1,25 +1,71 @@
1 1
2#include <kdialog.h> 2#include <kdialog.h>
3#include <qapp.h> 3#include <qapp.h>
4 4#include <qlabel.h>
5#include <qpushbutton.h>
6#include <qlayout.h>
7#include <qprogressbar.h>
8#include <klocale.h>
5 9
6KDialog::KDialog( QWidget *parent, const char *name, bool modal ) : 10KDialog::KDialog( QWidget *parent, const char *name, bool modal ) :
7 QDialog( parent, name, modal ) 11 QDialog( parent, name, modal )
8{ 12{
9 ; 13 ;
10 14
11} 15}
12#ifdef DESKTOP_VERSION 16#ifdef DESKTOP_VERSION
13int KDialog::spacingHint() { return 7; } 17int KDialog::spacingHint() { return 7; }
14int KDialog::marginHint() { return 7; } 18int KDialog::marginHint() { return 7; }
15 19
16int KDialog::spacingHintSmall() { return 4; } 20int KDialog::spacingHintSmall() { return 4; }
17int KDialog::marginHintSmall() { return 4; } 21int KDialog::marginHintSmall() { return 4; }
18 22
19#else 23#else
20int KDialog::spacingHint() { return 3; } 24int KDialog::spacingHint() { return 3; }
21int KDialog::marginHint() { return 3; } 25int KDialog::marginHint() { return 3; }
22 26
23int KDialog::spacingHintSmall() { return 1; } 27int KDialog::spacingHintSmall() { return 1; }
24int KDialog::marginHintSmall() { return 1; } 28int KDialog::marginHintSmall() { return 1; }
25#endif 29#endif
30KProgressDialog::KProgressDialog( QWidget *parent, const char *name, bool modal ) :
31 QDialog( parent, name, modal )
32{
33 QVBoxLayout* lay= new QVBoxLayout ( this );
34 mLabel = new QLabel ( "abc",this );
35 mBar = new QProgressBar ( this );
36 mButton = new QPushButton ( i18n("Cancel"),this );
37 lay->addWidget ( mLabel );
38 lay->addWidget ( mBar );
39 lay->addWidget ( mButton );
40 connect ( mButton , SIGNAL ( clicked () ), this, SIGNAL ( cancelled () ));
41 resize ( 220, sizeHint().height() +mLabel->sizeHint().height());
42
43}
44
45void KProgressDialog::setLabelText ( const QString & t)
46{
47 mLabel->setText( t );
48}
49
50void KProgressDialog::setTotalSteps ( int totalSteps )
51{
52 setActiveWindow();
53 setFocus();
54 mBar->setTotalSteps ( totalSteps );
55}
56void KProgressDialog::setProgress ( int progress )
57{
58 setActiveWindow();
59 setFocus();
60 mBar->setProgress ( progress );
61}
62void KProgressDialog::accept()
63{
64
65 // QDialog::accept();
66}
67void KProgressDialog::reject()
68{
69 emit cancelled ();
70 //QDialog::reject();
71}
diff --git a/microkde/kdialog.h b/microkde/kdialog.h
index 703d268..bc80689 100644
--- a/microkde/kdialog.h
+++ b/microkde/kdialog.h
@@ -1,18 +1,38 @@
1#ifndef MINIKDE_KDIALOG_H 1#ifndef MINIKDE_KDIALOG_H
2#define MINIKDE_KDIALOG_H 2#define MINIKDE_KDIALOG_H
3 3
4#include <qdialog.h> 4#include <qdialog.h>
5class QLabel;
6class QProgressBar;
7class QPushButton ;
5 8
6class KDialog : public QDialog 9class KDialog : public QDialog
7{ 10{
8 Q_OBJECT 11 Q_OBJECT
9 public: 12 public:
10 KDialog( QWidget *parent=0, const char *name=0, bool modal=true ); 13 KDialog( QWidget *parent=0, const char *name=0, bool modal=true );
11 14
12 static int spacingHint(); 15 static int spacingHint();
13 static int marginHint(); 16 static int marginHint();
14 static int spacingHintSmall(); 17 static int spacingHintSmall();
15 static int marginHintSmall(); 18 static int marginHintSmall();
16}; 19};
20class KProgressDialog : public QDialog
21{
22 Q_OBJECT
23 public:
24 KProgressDialog( QWidget *parent=0, const char *name=0, bool modal=false );
25 void setLabelText ( const QString & );
26 void setTotalSteps ( int totalSteps );
27 void setProgress ( int progress );
28 void accept();
29 void reject();
30 private:
31 QLabel * mLabel;
32 QProgressBar *mBar;
33 QPushButton *mButton;
34 signals:
35 void cancelled ();
36};
17 37
18#endif 38#endif