summaryrefslogtreecommitdiffabout
Side-by-side diff
Diffstat (more/less context) (ignore whitespace changes)
-rw-r--r--korganizer/mainwindow.cpp23
-rw-r--r--korganizer/mainwindow.h1
2 files changed, 15 insertions, 9 deletions
diff --git a/korganizer/mainwindow.cpp b/korganizer/mainwindow.cpp
index fe7e6d3..b7176a1 100644
--- a/korganizer/mainwindow.cpp
+++ b/korganizer/mainwindow.cpp
@@ -2527,16 +2527,22 @@ void KCommandSocket::readFile( QString fn )
void KCommandSocket::writeFile( QString fileName )
{
- QFile file2( fileName );
- if (!file2.open( IO_ReadOnly ) ) {
- mRetVal= false;
- deleteSocket();
- return ;
-
- }
if ( !mSocket ) {
mSocket = new QSocket( this );
connect( mSocket, SIGNAL(delayedCloseFinished ()), this, SLOT(deleteSocket()) );
+ connect( mSocket, SIGNAL(connected ()), this, SLOT(writeFileToSocket()) );
}
+ mFileName = fileName ;
mSocket->connectToHost( mHost, mPort );
+}
+void KCommandSocket::writeFileToSocket()
+{
+ QFile file2( mFileName );
+ if (!file2.open( IO_ReadOnly ) ) {
+ mRetVal= false;
+ mSocket->close();
+ if ( mSocket->state() == QSocket::Idle )
+ QTimer::singleShot( 10, this , SLOT ( deleteSocket()));
+ return ;
+ }
QTextStream ts2( &file2 );
ts2.setCodec( QTextCodec::codecForName("utf8") );
@@ -2548,10 +2554,9 @@ void KCommandSocket::writeFile( QString fileName )
}
mRetVal= true;
+ file2.close();
mSocket->close();
if ( mSocket->state() == QSocket::Idle )
QTimer::singleShot( 10, this , SLOT ( deleteSocket()));
- file2.close();
}
-
void KCommandSocket::sendStop()
{
diff --git a/korganizer/mainwindow.h b/korganizer/mainwindow.h
index f8b2334..90b3a88 100644
--- a/korganizer/mainwindow.h
+++ b/korganizer/mainwindow.h
@@ -76,4 +76,5 @@ private slots:
void readFileFromSocket();
void deleteSocket();
+ void writeFileToSocket();
private :
QSocket* mSocket;