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 | |
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 @@ -5,4 +5,5 @@ #include <qpainter.h> #include <qwhatsthis.h> +#include <qpushbutton.h> #include <qmessagebox.h> #include <qlineedit.h> @@ -25,4 +26,5 @@ #include <qtopia/alarmserver.h> #include <qtopia/qcopenvelope_qws.h> +#include <unistd.h> // for sleep #else #include <qmenubar.h> @@ -1147,10 +1149,5 @@ void MainWindow::usertrans() displayFile( "usertranslationHOWTO.txt",i18n("KO/Pi User translation HowTo") ); } -#if 0 -#include <libkcal/vcalformat.h> -#include <libkcal/event.h> -#include <libkcal/todo.h> -#include <libkcal/incidence.h> -#endif + void MainWindow::synchowto() { @@ -1429,5 +1426,4 @@ void MainWindow::slotModifiedChanged( bool changed ) mCalendarModifiedFlag = true; } -#include <qfileinfo.h> void MainWindow::save() { @@ -1867,5 +1863,4 @@ void MainWindow::exportVCalendar() } -#include <qpushbutton.h> QString MainWindow::getPassword( ) { @@ -2002,7 +1997,40 @@ void MainWindow::getFile(QSocket* socket) first = false; 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 } setCaption( i18n("File received - reloading calendar...") ); @@ -2111,5 +2139,13 @@ QString fileName; ts << mCommandSocket->readLine (); } - mCommandSocket->waitForMore ( 5000 ); + 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 ); } file.close(); @@ -2453,2 +2489,53 @@ void MainWindow::printCal() mView->print();//mCp->showDialog(); } + + + +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(); + } + } +} + + + + + + + + + + + + diff --git a/korganizer/mainwindow.h b/korganizer/mainwindow.h index 5985d56..7b4fd27 100644 --- a/korganizer/mainwindow.h +++ b/korganizer/mainwindow.h @@ -28,14 +28,7 @@ class KServerSocket : public QServerSocket public: - KServerSocket ( Q_UINT16 port, int backlog = 0, QObject * parent=0, const char * name=0 ) : - QServerSocket( port, backlog, parent, name ){;}; - void 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 ); - } + KServerSocket ( Q_UINT16 port, int backlog = 0, QObject * parent=0, const char * name=0 ); + + void newConnection ( int socket ) ; signals: @@ -44,27 +37,6 @@ signals: void endConnect(); private slots: - void discardClient() - { - QSocket* socket = (QSocket*)sender(); - delete socket; - //emit endConnect(); - } - void readClient() - { - qDebug("readClient() "); - QSocket* socket = (QSocket*)sender(); - if ( socket->canReadLine() ) { - QStringList tokens = QStringList::split( QRegExp("[ \r\n][ \r\n]*"), socket->readLine() ); - if ( tokens[0] == "GET" ) { - emit sendFile( socket ); - } - if ( tokens[0] == "PUT" ) { - emit getFile( socket ); - } - if ( tokens[0] == "STOP" ) { - emit endConnect(); - } - } - } + void discardClient(); + void readClient(); }; |