summaryrefslogtreecommitdiffabout
path: root/korganizer
Unidiff
Diffstat (limited to 'korganizer') (more/less context) (ignore whitespace changes)
-rw-r--r--korganizer/mainwindow.cpp52
-rw-r--r--korganizer/mainwindow.h2
2 files changed, 37 insertions, 17 deletions
diff --git a/korganizer/mainwindow.cpp b/korganizer/mainwindow.cpp
index 460bbdc..f4ac0d6 100644
--- a/korganizer/mainwindow.cpp
+++ b/korganizer/mainwindow.cpp
@@ -2008,3 +2008,3 @@ void MainWindow::getFile(QSocket* socket)
2008 if ( !socket->canReadLine () ) { 2008 if ( !socket->canReadLine () ) {
2009 qDebug("waiting1c %d ",ti.elapsed () ); 2009 qDebug("waiting1c %d ",ti.elapsed () );
2010 usleep( 100000); 2010 usleep( 100000);
@@ -2036,4 +2036,4 @@ void MainWindow::getFile(QSocket* socket)
2036 setCaption( i18n("File received - reloading calendar...") ); 2036 setCaption( i18n("File received - reloading calendar...") );
2037 file.close();
2038 socket->close(); 2037 socket->close();
2038 file.close();
2039 mView->watchSavedFile(); 2039 mView->watchSavedFile();
@@ -2116,3 +2116,3 @@ void MainWindow::readFileFromSocket()
2116 qDebug("MainWindow::readFileFromSocket() "); 2116 qDebug("MainWindow::readFileFromSocket() ");
2117QString fileName; 2117 QString fileName;
2118#ifdef _WIN32_ 2118#ifdef _WIN32_
@@ -2125,3 +2125,3 @@ QString fileName;
2125 setCaption( i18n("Error: Cannot open temp file for write.") ); 2125 setCaption( i18n("Error: Cannot open temp file for write.") );
2126 qDebug("Error open calender file for writing: %s",fileName.latin1() ); 2126 qDebug("Error open temp calender file for writing: %s",fileName.latin1() );
2127 return ; 2127 return ;
@@ -2152,2 +2152,3 @@ QString fileName;
2152 mCommandSocket->close(); 2152 mCommandSocket->close();
2153 // pending: deleting after signal SIGNAL(delayedCloseFinished())
2153 //delete mCommandSocket; 2154 //delete mCommandSocket;
@@ -2183,2 +2184,3 @@ QString fileName;
2183 2184
2185 // pending connect signals connected () and error to new slots
2184 QString host = KOPrefs::instance()->mActiveSyncIP; 2186 QString host = KOPrefs::instance()->mActiveSyncIP;
@@ -2200,3 +2202,3 @@ QString fileName;
2200 while ( ! ts2.atEnd() ) { 2202 while ( ! ts2.atEnd() ) {
2201 os2 << ts2.readLine() << "\n"; 2203 os2 << ts2.readLine() << "\n";
2202 } 2204 }
@@ -2207,2 +2209,3 @@ QString fileName;
2207 file.close(); 2209 file.close();
2210 // pending: deleting after signal SIGNAL(delayedCloseFinished())
2208 //delete ( mCommandSocket); 2211 //delete ( mCommandSocket);
@@ -2493,3 +2496,7 @@ void MainWindow::printCal()
2493 2496
2494KServerSocket:: KServerSocket ( Q_UINT16 port, int backlog, QObject * parent, const char * name ) : QServerSocket( port, backlog, parent, name ){;}; 2497KServerSocket:: KServerSocket ( Q_UINT16 port, int backlog, QObject * parent, const char * name ) : QServerSocket( port, backlog, parent, name )
2498{
2499
2500 mSocket = 0;
2501};
2495 2502
@@ -2498,6 +2505,11 @@ void KServerSocket::newConnection ( int socket )
2498 qDebug("KServerSocket:New connection %d ", socket); 2505 qDebug("KServerSocket:New connection %d ", socket);
2499 QSocket* s = new QSocket( this ); 2506 if ( mSocket ) {
2500 connect( s, SIGNAL(readyRead()), this, SLOT(readClient()) ); 2507 qDebug("KServerSocket::newConnection Socket deleted! ");
2501 connect( s, SIGNAL(delayedCloseFinished()), this, SLOT(discardClient()) ); 2508 delete mSocket;
2502 s->setSocket( socket ); 2509 mSocket = 0;
2510 }
2511 mSocket = new QSocket( this );
2512 connect( mSocket , SIGNAL(readyRead()), this, SLOT(readClient()) );
2513 connect( mSocket , SIGNAL(delayedCloseFinished()), this, SLOT(discardClient()) );
2514 mSocket->setSocket( socket );
2503} 2515}
@@ -2507,4 +2519,7 @@ void KServerSocket::discardClient()
2507 qDebug(" KServerSocket::discardClient()"); 2519 qDebug(" KServerSocket::discardClient()");
2508 QSocket* socket = (QSocket*)sender(); 2520 if ( mSocket ) {
2509 delete socket; 2521 qDebug("delete ");
2522 delete mSocket;
2523 mSocket = 0;
2524 }
2510 //emit endConnect(); 2525 //emit endConnect();
@@ -2513,12 +2528,15 @@ void KServerSocket::readClient()
2513{ 2528{
2529 if ( mSocket == 0 ) {
2530 qDebug("ERROR::KServerSocket::readClient(): mSocket == 0 ");
2531 return;
2532 }
2514 qDebug("KServerSocket readClient()"); 2533 qDebug("KServerSocket readClient()");
2515 QSocket* socket = (QSocket*)sender(); 2534 if ( mSocket->canReadLine() ) {
2516 if ( socket->canReadLine() ) { 2535 QStringList tokens = QStringList::split( QRegExp("[ \r\n][ \r\n]*"), mSocket->readLine() );
2517 QStringList tokens = QStringList::split( QRegExp("[ \r\n][ \r\n]*"), socket->readLine() );
2518 qDebug("KServerSocket socket->canReadLine()"); 2536 qDebug("KServerSocket socket->canReadLine()");
2519 if ( tokens[0] == "GET" ) { 2537 if ( tokens[0] == "GET" ) {
2520 emit sendFile( socket ); 2538 emit sendFile( mSocket );
2521 } 2539 }
2522 if ( tokens[0] == "PUT" ) { 2540 if ( tokens[0] == "PUT" ) {
2523 emit getFile( socket ); 2541 emit getFile( mSocket );
2524 } 2542 }
diff --git a/korganizer/mainwindow.h b/korganizer/mainwindow.h
index 7b4fd27..cc656a3 100644
--- a/korganizer/mainwindow.h
+++ b/korganizer/mainwindow.h
@@ -40,2 +40,4 @@ private slots:
40 void readClient(); 40 void readClient();
41 private :
42 QSocket* mSocket;
41}; 43};