summaryrefslogtreecommitdiffabout
path: root/korganizer
authorzautrix <zautrix>2004-09-23 08:26:01 (UTC)
committer zautrix <zautrix>2004-09-23 08:26:01 (UTC)
commita9e235027e0c92fb53462e968dee2b43228d7984 (patch) (side-by-side diff)
tree91565646ef5eeccd0f51a679add40499586abf8e /korganizer
parente395b9a15f5047582c17665de85d28dad64b8a8e (diff)
downloadkdepimpi-a9e235027e0c92fb53462e968dee2b43228d7984.zip
kdepimpi-a9e235027e0c92fb53462e968dee2b43228d7984.tar.gz
kdepimpi-a9e235027e0c92fb53462e968dee2b43228d7984.tar.bz2
sync fixes
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)
if ( !socket->canReadLine () ) {
- qDebug("waiting1c %d ",ti.elapsed () );
+ qDebug("waiting1c %d ",ti.elapsed () );
usleep( 100000);
@@ -2036,4 +2036,4 @@ void MainWindow::getFile(QSocket* socket)
setCaption( i18n("File received - reloading calendar...") );
- file.close();
socket->close();
+ file.close();
mView->watchSavedFile();
@@ -2116,3 +2116,3 @@ void MainWindow::readFileFromSocket()
qDebug("MainWindow::readFileFromSocket() ");
-QString fileName;
+ QString fileName;
#ifdef _WIN32_
@@ -2125,3 +2125,3 @@ QString fileName;
setCaption( i18n("Error: Cannot open temp file for write.") );
- qDebug("Error open calender file for writing: %s",fileName.latin1() );
+ qDebug("Error open temp calender file for writing: %s",fileName.latin1() );
return ;
@@ -2152,2 +2152,3 @@ QString fileName;
mCommandSocket->close();
+ // pending: deleting after signal SIGNAL(delayedCloseFinished())
//delete mCommandSocket;
@@ -2183,2 +2184,3 @@ QString fileName;
+ // pending connect signals connected () and error to new slots
QString host = KOPrefs::instance()->mActiveSyncIP;
@@ -2200,3 +2202,3 @@ QString fileName;
while ( ! ts2.atEnd() ) {
- os2 << ts2.readLine() << "\n";
+ os2 << ts2.readLine() << "\n";
}
@@ -2207,2 +2209,3 @@ QString fileName;
file.close();
+ // pending: deleting after signal SIGNAL(delayedCloseFinished())
//delete ( mCommandSocket);
@@ -2493,3 +2496,7 @@ void MainWindow::printCal()
-KServerSocket:: KServerSocket ( Q_UINT16 port, int backlog, QObject * parent, const char * name ) : QServerSocket( port, backlog, parent, name ){;};
+KServerSocket:: KServerSocket ( Q_UINT16 port, int backlog, QObject * parent, const char * name ) : QServerSocket( port, backlog, parent, name )
+{
+
+ mSocket = 0;
+};
@@ -2498,6 +2505,11 @@ 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 );
+ if ( mSocket ) {
+ qDebug("KServerSocket::newConnection Socket deleted! ");
+ delete mSocket;
+ mSocket = 0;
+ }
+ mSocket = new QSocket( this );
+ connect( mSocket , SIGNAL(readyRead()), this, SLOT(readClient()) );
+ connect( mSocket , SIGNAL(delayedCloseFinished()), this, SLOT(discardClient()) );
+ mSocket->setSocket( socket );
}
@@ -2507,4 +2519,7 @@ void KServerSocket::discardClient()
qDebug(" KServerSocket::discardClient()");
- QSocket* socket = (QSocket*)sender();
- delete socket;
+ if ( mSocket ) {
+ qDebug("delete ");
+ delete mSocket;
+ mSocket = 0;
+ }
//emit endConnect();
@@ -2513,12 +2528,15 @@ void KServerSocket::readClient()
{
+ if ( mSocket == 0 ) {
+ qDebug("ERROR::KServerSocket::readClient(): mSocket == 0 ");
+ return;
+ }
qDebug("KServerSocket readClient()");
- QSocket* socket = (QSocket*)sender();
- if ( socket->canReadLine() ) {
- QStringList tokens = QStringList::split( QRegExp("[ \r\n][ \r\n]*"), socket->readLine() );
+ if ( mSocket->canReadLine() ) {
+ QStringList tokens = QStringList::split( QRegExp("[ \r\n][ \r\n]*"), mSocket->readLine() );
qDebug("KServerSocket socket->canReadLine()");
if ( tokens[0] == "GET" ) {
- emit sendFile( socket );
+ emit sendFile( mSocket );
}
if ( tokens[0] == "PUT" ) {
- emit getFile( socket );
+ emit getFile( mSocket );
}
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:
void readClient();
+ private :
+ QSocket* mSocket;
};