author | zautrix <zautrix> | 2004-09-23 07:35:02 (UTC) |
---|---|---|
committer | zautrix <zautrix> | 2004-09-23 07:35:02 (UTC) |
commit | e395b9a15f5047582c17665de85d28dad64b8a8e (patch) (unidiff) | |
tree | 141b178531d66bfeb810cf9b6f2ba1cd54a7fce5 /korganizer | |
parent | e2bc785d2f98d2aeac6ab6a5e39ff4f6e679517b (diff) | |
download | kdepimpi-e395b9a15f5047582c17665de85d28dad64b8a8e.zip kdepimpi-e395b9a15f5047582c17665de85d28dad64b8a8e.tar.gz kdepimpi-e395b9a15f5047582c17665de85d28dad64b8a8e.tar.bz2 |
fixes in kopi
-rw-r--r-- | korganizer/mainwindow.cpp | 105 | ||||
-rw-r--r-- | korganizer/mainwindow.h | 38 |
2 files changed, 101 insertions, 42 deletions
diff --git a/korganizer/mainwindow.cpp b/korganizer/mainwindow.cpp index 2e6b5c8..460bbdc 100644 --- a/korganizer/mainwindow.cpp +++ b/korganizer/mainwindow.cpp | |||
@@ -6,2 +6,3 @@ | |||
6 | #include <qwhatsthis.h> | 6 | #include <qwhatsthis.h> |
7 | #include <qpushbutton.h> | ||
7 | #include <qmessagebox.h> | 8 | #include <qmessagebox.h> |
@@ -26,2 +27,3 @@ | |||
26 | #include <qtopia/qcopenvelope_qws.h> | 27 | #include <qtopia/qcopenvelope_qws.h> |
28 | #include <unistd.h> // for sleep | ||
27 | #else | 29 | #else |
@@ -1148,8 +1150,3 @@ void MainWindow::usertrans() | |||
1148 | } | 1150 | } |
1149 | #if 0 | 1151 | |
1150 | #include <libkcal/vcalformat.h> | ||
1151 | #include <libkcal/event.h> | ||
1152 | #include <libkcal/todo.h> | ||
1153 | #include <libkcal/incidence.h> | ||
1154 | #endif | ||
1155 | void MainWindow::synchowto() | 1152 | void MainWindow::synchowto() |
@@ -1430,3 +1427,2 @@ void MainWindow::slotModifiedChanged( bool changed ) | |||
1430 | } | 1427 | } |
1431 | #include <qfileinfo.h> | ||
1432 | void MainWindow::save() | 1428 | void MainWindow::save() |
@@ -1868,3 +1864,2 @@ void MainWindow::exportVCalendar() | |||
1868 | } | 1864 | } |
1869 | #include <qpushbutton.h> | ||
1870 | QString MainWindow::getPassword( ) | 1865 | QString MainWindow::getPassword( ) |
@@ -2003,5 +1998,38 @@ void MainWindow::getFile(QSocket* socket) | |||
2003 | while ( socket->canReadLine () ) { | 1998 | while ( socket->canReadLine () ) { |
1999 | qDebug("avail %d ", socket->bytesAvailable () ); | ||
2004 | ts << socket->readLine (); | 2000 | ts << socket->readLine (); |
2005 | } | 2001 | } |
2002 | QTime ti; | ||
2003 | ti.start(); | ||
2004 | while ( ti.elapsed () < 5000 && !socket->canReadLine () ) { | ||
2005 | qDebug("waiting1a %d %d ",ti.elapsed (), socket->bytesAvailable () ); | ||
2006 | //qApp->processEvents(); | ||
2007 | qDebug("waiting1b %d ",ti.elapsed () ); | ||
2008 | if ( !socket->canReadLine () ) { | ||
2009 | qDebug("waiting1c %d ",ti.elapsed () ); | ||
2010 | usleep( 100000); | ||
2011 | } | ||
2012 | //socket->waitForMore ( 100 ); | ||
2013 | } | ||
2014 | ts << socket->readLine (); | ||
2015 | #if 0 | ||
2016 | #ifdef DESKTOP_VERSION | ||
2006 | socket->waitForMore ( 5000 ); | 2017 | socket->waitForMore ( 5000 ); |
2018 | #else | ||
2019 | // socket->waitForMore ( 5000 ); | ||
2020 | // seems to be broken in qt2 | ||
2021 | bool stop = false; | ||
2022 | QTime ti; | ||
2023 | ti.start(); | ||
2024 | while ( ti.elapsed < 5000 && !stop ) { | ||
2025 | qApp->processEvents(); | ||
2026 | if ( socket->canReadLine () ) | ||
2027 | stop = true ; | ||
2028 | else { | ||
2029 | usleep( 100000 ); | ||
2030 | |||
2031 | } | ||
2032 | } | ||
2033 | #endif | ||
2034 | #endif | ||
2007 | } | 2035 | } |
@@ -2111,4 +2139,12 @@ QString fileName; | |||
2111 | ts << mCommandSocket->readLine (); | 2139 | ts << mCommandSocket->readLine (); |
2140 | } | ||
2141 | QTime ti; | ||
2142 | ti.start(); | ||
2143 | while ( ti.elapsed () < 5000 && !mCommandSocket->canReadLine () ) { | ||
2144 | qApp->processEvents(); | ||
2145 | qDebug("waiting2 %d ",ti.elapsed () ); | ||
2146 | if ( !mCommandSocket->canReadLine () ) | ||
2147 | mCommandSocket->waitForMore ( 100 ); | ||
2112 | } | 2148 | } |
2113 | mCommandSocket->waitForMore ( 5000 ); | 2149 | //mCommandSocket->waitForMore ( 5000 ); |
2114 | } | 2150 | } |
@@ -2454 +2490,52 @@ void MainWindow::printCal() | |||
2454 | } | 2490 | } |
2491 | |||
2492 | |||
2493 | |||
2494 | KServerSocket:: KServerSocket ( Q_UINT16 port, int backlog, QObject * parent, const char * name ) : QServerSocket( port, backlog, parent, name ){;}; | ||
2495 | |||
2496 | void KServerSocket::newConnection ( int socket ) | ||
2497 | { | ||
2498 | qDebug("KServerSocket:New connection %d ", socket); | ||
2499 | QSocket* s = new QSocket( this ); | ||
2500 | connect( s, SIGNAL(readyRead()), this, SLOT(readClient()) ); | ||
2501 | connect( s, SIGNAL(delayedCloseFinished()), this, SLOT(discardClient()) ); | ||
2502 | s->setSocket( socket ); | ||
2503 | } | ||
2504 | |||
2505 | void KServerSocket::discardClient() | ||
2506 | { | ||
2507 | qDebug(" KServerSocket::discardClient()"); | ||
2508 | QSocket* socket = (QSocket*)sender(); | ||
2509 | delete socket; | ||
2510 | //emit endConnect(); | ||
2511 | } | ||
2512 | void KServerSocket::readClient() | ||
2513 | { | ||
2514 | qDebug("KServerSocket readClient()"); | ||
2515 | QSocket* socket = (QSocket*)sender(); | ||
2516 | if ( socket->canReadLine() ) { | ||
2517 | QStringList tokens = QStringList::split( QRegExp("[ \r\n][ \r\n]*"), socket->readLine() ); | ||
2518 | qDebug("KServerSocket socket->canReadLine()"); | ||
2519 | if ( tokens[0] == "GET" ) { | ||
2520 | emit sendFile( socket ); | ||
2521 | } | ||
2522 | if ( tokens[0] == "PUT" ) { | ||
2523 | emit getFile( socket ); | ||
2524 | } | ||
2525 | if ( tokens[0] == "STOP" ) { | ||
2526 | emit endConnect(); | ||
2527 | } | ||
2528 | } | ||
2529 | } | ||
2530 | |||
2531 | |||
2532 | |||
2533 | |||
2534 | |||
2535 | |||
2536 | |||
2537 | |||
2538 | |||
2539 | |||
2540 | |||
2541 | |||
diff --git a/korganizer/mainwindow.h b/korganizer/mainwindow.h index 5985d56..7b4fd27 100644 --- a/korganizer/mainwindow.h +++ b/korganizer/mainwindow.h | |||
@@ -29,12 +29,5 @@ class KServerSocket : public QServerSocket | |||
29 | public: | 29 | public: |
30 | KServerSocket ( Q_UINT16 port, int backlog = 0, QObject * parent=0, const char * name=0 ) : | 30 | KServerSocket ( Q_UINT16 port, int backlog = 0, QObject * parent=0, const char * name=0 ); |
31 | QServerSocket( port, backlog, parent, name ){;}; | 31 | |
32 | void newConnection ( int socket ) | 32 | void newConnection ( int socket ) ; |
33 | { | ||
34 | qDebug("KServerSocket:New connection %d ", socket); | ||
35 | QSocket* s = new QSocket( this ); | ||
36 | connect( s, SIGNAL(readyRead()), this, SLOT(readClient()) ); | ||
37 | connect( s, SIGNAL(delayedCloseFinished()), this, SLOT(discardClient()) ); | ||
38 | s->setSocket( socket ); | ||
39 | } | ||
40 | 33 | ||
@@ -45,25 +38,4 @@ signals: | |||
45 | private slots: | 38 | private slots: |
46 | void discardClient() | 39 | void discardClient(); |
47 | { | 40 | void readClient(); |
48 | QSocket* socket = (QSocket*)sender(); | ||
49 | delete socket; | ||
50 | //emit endConnect(); | ||
51 | } | ||
52 | void readClient() | ||
53 | { | ||
54 | qDebug("readClient() "); | ||
55 | QSocket* socket = (QSocket*)sender(); | ||
56 | if ( socket->canReadLine() ) { | ||
57 | QStringList tokens = QStringList::split( QRegExp("[ \r\n][ \r\n]*"), socket->readLine() ); | ||
58 | if ( tokens[0] == "GET" ) { | ||
59 | emit sendFile( socket ); | ||
60 | } | ||
61 | if ( tokens[0] == "PUT" ) { | ||
62 | emit getFile( socket ); | ||
63 | } | ||
64 | if ( tokens[0] == "STOP" ) { | ||
65 | emit endConnect(); | ||
66 | } | ||
67 | } | ||
68 | } | ||
69 | }; | 41 | }; |