author | zautrix <zautrix> | 2004-09-23 07:35:02 (UTC) |
---|---|---|
committer | zautrix <zautrix> | 2004-09-23 07:35:02 (UTC) |
commit | e395b9a15f5047582c17665de85d28dad64b8a8e (patch) (side-by-side diff) | |
tree | 141b178531d66bfeb810cf9b6f2ba1cd54a7fce5 /korganizer/mainwindow.cpp | |
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 |
1 files changed, 96 insertions, 9 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 @@ #include <qwhatsthis.h> +#include <qpushbutton.h> #include <qmessagebox.h> @@ -26,2 +27,3 @@ #include <qtopia/qcopenvelope_qws.h> +#include <unistd.h> // for sleep #else @@ -1148,8 +1150,3 @@ void MainWindow::usertrans() } -#if 0 -#include <libkcal/vcalformat.h> -#include <libkcal/event.h> -#include <libkcal/todo.h> -#include <libkcal/incidence.h> -#endif + void MainWindow::synchowto() @@ -1430,3 +1427,2 @@ void MainWindow::slotModifiedChanged( bool changed ) } -#include <qfileinfo.h> void MainWindow::save() @@ -1868,3 +1864,2 @@ void MainWindow::exportVCalendar() } -#include <qpushbutton.h> QString MainWindow::getPassword( ) @@ -2003,5 +1998,38 @@ void MainWindow::getFile(QSocket* socket) while ( socket->canReadLine () ) { + qDebug("avail %d ", socket->bytesAvailable () ); ts << socket->readLine (); } + QTime ti; + ti.start(); + while ( ti.elapsed () < 5000 && !socket->canReadLine () ) { + qDebug("waiting1a %d %d ",ti.elapsed (), socket->bytesAvailable () ); + //qApp->processEvents(); + qDebug("waiting1b %d ",ti.elapsed () ); + if ( !socket->canReadLine () ) { + qDebug("waiting1c %d ",ti.elapsed () ); + usleep( 100000); + } + //socket->waitForMore ( 100 ); + } + ts << socket->readLine (); +#if 0 +#ifdef DESKTOP_VERSION socket->waitForMore ( 5000 ); +#else + // socket->waitForMore ( 5000 ); + // seems to be broken in qt2 + bool stop = false; + QTime ti; + ti.start(); + while ( ti.elapsed < 5000 && !stop ) { + qApp->processEvents(); + if ( socket->canReadLine () ) + stop = true ; + else { + usleep( 100000 ); + + } + } +#endif +#endif } @@ -2111,4 +2139,12 @@ QString fileName; ts << mCommandSocket->readLine (); + } + QTime ti; + ti.start(); + while ( ti.elapsed () < 5000 && !mCommandSocket->canReadLine () ) { + qApp->processEvents(); + qDebug("waiting2 %d ",ti.elapsed () ); + if ( !mCommandSocket->canReadLine () ) + mCommandSocket->waitForMore ( 100 ); } - mCommandSocket->waitForMore ( 5000 ); + //mCommandSocket->waitForMore ( 5000 ); } @@ -2454 +2490,52 @@ void MainWindow::printCal() } + + + +KServerSocket:: KServerSocket ( Q_UINT16 port, int backlog, QObject * parent, const char * name ) : QServerSocket( port, backlog, parent, name ){;}; + +void KServerSocket::newConnection ( int socket ) +{ + qDebug("KServerSocket:New connection %d ", socket); + QSocket* s = new QSocket( this ); + connect( s, SIGNAL(readyRead()), this, SLOT(readClient()) ); + connect( s, SIGNAL(delayedCloseFinished()), this, SLOT(discardClient()) ); + s->setSocket( socket ); +} + +void KServerSocket::discardClient() +{ + qDebug(" KServerSocket::discardClient()"); + QSocket* socket = (QSocket*)sender(); + delete socket; + //emit endConnect(); +} +void KServerSocket::readClient() +{ + qDebug("KServerSocket readClient()"); + QSocket* socket = (QSocket*)sender(); + if ( socket->canReadLine() ) { + QStringList tokens = QStringList::split( QRegExp("[ \r\n][ \r\n]*"), socket->readLine() ); + qDebug("KServerSocket socket->canReadLine()"); + if ( tokens[0] == "GET" ) { + emit sendFile( socket ); + } + if ( tokens[0] == "PUT" ) { + emit getFile( socket ); + } + if ( tokens[0] == "STOP" ) { + emit endConnect(); + } + } +} + + + + + + + + + + + + |