author | zautrix <zautrix> | 2004-09-22 23:36:37 (UTC) |
---|---|---|
committer | zautrix <zautrix> | 2004-09-22 23:36:37 (UTC) |
commit | e2bc785d2f98d2aeac6ab6a5e39ff4f6e679517b (patch) (unidiff) | |
tree | f45771acfd61a0ddda6b253082f243acac473d33 | |
parent | 772411a6c16f9b2299bd173116faeb4482325bcc (diff) | |
download | kdepimpi-e2bc785d2f98d2aeac6ab6a5e39ff4f6e679517b.zip kdepimpi-e2bc785d2f98d2aeac6ab6a5e39ff4f6e679517b.tar.gz kdepimpi-e2bc785d2f98d2aeac6ab6a5e39ff4f6e679517b.tar.bz2 |
bugfixes
-rw-r--r-- | korganizer/mainwindow.cpp | 28 | ||||
-rw-r--r-- | korganizer/mainwindow.h | 1 |
2 files changed, 17 insertions, 12 deletions
diff --git a/korganizer/mainwindow.cpp b/korganizer/mainwindow.cpp index ebe761a..2e6b5c8 100644 --- a/korganizer/mainwindow.cpp +++ b/korganizer/mainwindow.cpp | |||
@@ -73,6 +73,7 @@ MainWindow::MainWindow( QWidget *parent, const char *name, QString msg) : | |||
73 | setFont( QFont("Arial"), 14 ); | 73 | setFont( QFont("Arial"), 14 ); |
74 | #endif | 74 | #endif |
75 | mCommandSocket = 0; | 75 | mCommandSocket = 0; |
76 | mCommandSocketFinish = 0; | ||
76 | mSyncActionDialog = 0; | 77 | mSyncActionDialog = 0; |
77 | mServerSocket = 0; | 78 | mServerSocket = 0; |
78 | mClosed = false; | 79 | mClosed = false; |
@@ -1981,7 +1982,6 @@ void MainWindow::sendFile(QSocket* socket) | |||
1981 | void MainWindow::getFile(QSocket* socket) | 1982 | void MainWindow::getFile(QSocket* socket) |
1982 | { | 1983 | { |
1983 | setCaption( i18n("Receiving synced file...") ); | 1984 | setCaption( i18n("Receiving synced file...") ); |
1984 | qDebug("MainWindow::sendFile(QSocket* s) "); | ||
1985 | 1985 | ||
1986 | QString fileName = defaultFileName(); | 1986 | QString fileName = defaultFileName(); |
1987 | QFile file( fileName ); | 1987 | QFile file( fileName ); |
@@ -2068,10 +2068,12 @@ void MainWindow::performQuickQuick() | |||
2068 | setCaption( i18n("Sorry, no valid port.Syncing cancelled.") ); | 2068 | setCaption( i18n("Sorry, no valid port.Syncing cancelled.") ); |
2069 | return; | 2069 | return; |
2070 | } | 2070 | } |
2071 | if ( mCommandSocket ) | 2071 | if ( !mCommandSocket ) { |
2072 | delete mCommandSocket; | ||
2073 | mCommandSocket = new QSocket( this ); | 2072 | mCommandSocket = new QSocket( this ); |
2073 | // delete mCommandSocket; | ||
2074 | //mCommandSocket = new QSocket( this ); | ||
2074 | connect( mCommandSocket, SIGNAL(readyRead()), this, SLOT(readFileFromSocket()) ); | 2075 | connect( mCommandSocket, SIGNAL(readyRead()), this, SLOT(readFileFromSocket()) ); |
2076 | } | ||
2075 | QString host = KOPrefs::instance()->mActiveSyncIP; | 2077 | QString host = KOPrefs::instance()->mActiveSyncIP; |
2076 | mCommandSocket->connectToHost( host, port ); | 2078 | mCommandSocket->connectToHost( host, port ); |
2077 | QTextStream os( mCommandSocket ); | 2079 | QTextStream os( mCommandSocket ); |
@@ -2112,9 +2114,9 @@ QString fileName; | |||
2112 | } | 2114 | } |
2113 | file.close(); | 2115 | file.close(); |
2114 | mCommandSocket->close(); | 2116 | mCommandSocket->close(); |
2115 | delete mCommandSocket; | 2117 | //delete mCommandSocket; |
2116 | setCaption( i18n("Remote file saved to temp file.") ); | 2118 | setCaption( i18n("Remote file saved to temp file.") ); |
2117 | mCommandSocket = 0; | 2119 | //mCommandSocket = 0; |
2118 | mCurrentSyncProfile = 2 ; // last file | 2120 | mCurrentSyncProfile = 2 ; // last file |
2119 | mView->setSyncDevice(KOPrefs::instance()->mSyncProfileNames[mCurrentSyncProfile] ); | 2121 | mView->setSyncDevice(KOPrefs::instance()->mSyncProfileNames[mCurrentSyncProfile] ); |
2120 | mView->setSyncName( KOPrefs::instance()->mLocalMachineName ); | 2122 | mView->setSyncName( KOPrefs::instance()->mLocalMachineName ); |
@@ -2138,10 +2140,12 @@ QString fileName; | |||
2138 | return; | 2140 | return; |
2139 | } | 2141 | } |
2140 | 2142 | ||
2141 | mCommandSocket = new QSocket( this ); | 2143 | if ( !mCommandSocketFinish ) { |
2142 | QString host = KOPrefs::instance()->mActiveSyncIP; | 2144 | mCommandSocketFinish = new QSocket( this ); |
2143 | mCommandSocket->connectToHost( KOPrefs::instance()->mActiveSyncIP, KOPrefs::instance()->mActiveSyncPort.toUInt() ); | 2145 | } |
2146 | mCommandSocketFinish->connectToHost( KOPrefs::instance()->mActiveSyncIP, KOPrefs::instance()->mActiveSyncPort.toUInt() ); | ||
2144 | 2147 | ||
2148 | QString host = KOPrefs::instance()->mActiveSyncIP; | ||
2145 | QFile file2( fileName ); | 2149 | QFile file2( fileName ); |
2146 | if (!file2.open( IO_ReadOnly ) ) { | 2150 | if (!file2.open( IO_ReadOnly ) ) { |
2147 | setCaption( i18n("Error: Cannot open temp file for read.") ); | 2151 | setCaption( i18n("Error: Cannot open temp file for read.") ); |
@@ -2152,7 +2156,7 @@ QString fileName; | |||
2152 | setCaption( i18n("Sending back synced file...") ); | 2156 | setCaption( i18n("Sending back synced file...") ); |
2153 | QTextStream ts2( &file2 ); | 2157 | QTextStream ts2( &file2 ); |
2154 | ts2.setCodec( QTextCodec::codecForName("utf8") ); | 2158 | ts2.setCodec( QTextCodec::codecForName("utf8") ); |
2155 | QTextStream os2( mCommandSocket ); | 2159 | QTextStream os2( mCommandSocketFinish ); |
2156 | os2.setCodec( QTextCodec::codecForName("utf8") ); | 2160 | os2.setCodec( QTextCodec::codecForName("utf8") ); |
2157 | //os.setEncoding( QTextStream::UnicodeUTF8 ); | 2161 | //os.setEncoding( QTextStream::UnicodeUTF8 ); |
2158 | if ( KOPrefs::instance()->mWriteBackFile ) { | 2162 | if ( KOPrefs::instance()->mWriteBackFile ) { |
@@ -2163,10 +2167,10 @@ QString fileName; | |||
2163 | } else { | 2167 | } else { |
2164 | os2 << "STOP\r\n"; | 2168 | os2 << "STOP\r\n"; |
2165 | } | 2169 | } |
2166 | mCommandSocket->close(); | 2170 | mCommandSocketFinish->close(); |
2167 | file.close(); | 2171 | file.close(); |
2168 | delete mCommandSocket; | 2172 | //delete ( mCommandSocket); |
2169 | mCommandSocket = 0; | 2173 | //mCommandSocket = 0; |
2170 | qDebug("Syncing succesful! "); | 2174 | qDebug("Syncing succesful! "); |
2171 | setCaption( i18n("Easy-Pi-Sync succesful!") ); | 2175 | setCaption( i18n("Easy-Pi-Sync succesful!") ); |
2172 | 2176 | ||
diff --git a/korganizer/mainwindow.h b/korganizer/mainwindow.h index 9bb2302..5985d56 100644 --- a/korganizer/mainwindow.h +++ b/korganizer/mainwindow.h | |||
@@ -147,6 +147,7 @@ class MainWindow : public QMainWindow | |||
147 | void endConnect(); | 147 | void endConnect(); |
148 | private: | 148 | private: |
149 | QSocket* mCommandSocket; | 149 | QSocket* mCommandSocket; |
150 | QSocket* mCommandSocketFinish; | ||
150 | KServerSocket * mServerSocket; | 151 | KServerSocket * mServerSocket; |
151 | bool mClosed; | 152 | bool mClosed; |
152 | void saveOnClose(); | 153 | void saveOnClose(); |