summaryrefslogtreecommitdiffabout
Side-by-side diff
Diffstat (more/less context) (show whitespace changes)
-rw-r--r--korganizer/mainwindow.cpp105
-rw-r--r--korganizer/mainwindow.h38
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 @@
#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
}
@@ -2112,3 +2140,11 @@ QString fileName;
}
- 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 );
}
@@ -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();
+ }
+ }
+}
+
+
+
+
+
+
+
+
+
+
+
+
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
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 ) ;
@@ -45,25 +38,4 @@ signals:
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();
};