-rw-r--r-- | korganizer/koprefs.cpp | 1 | ||||
-rw-r--r-- | korganizer/koprefs.h | 1 | ||||
-rw-r--r-- | korganizer/mainwindow.cpp | 36 | ||||
-rw-r--r-- | korganizer/mainwindow.h | 1 |
4 files changed, 23 insertions, 16 deletions
diff --git a/korganizer/koprefs.cpp b/korganizer/koprefs.cpp index e0623d5..c28da9a 100644 --- a/korganizer/koprefs.cpp +++ b/korganizer/koprefs.cpp | |||
@@ -178,32 +178,33 @@ KOPrefs::KOPrefs() : | |||
178 | addItemFont("JournalView Font",&mJornalViewFont); | 178 | addItemFont("JournalView Font",&mJornalViewFont); |
179 | addItemFont("WhatsNextView Font",&mWhatsNextFont); | 179 | addItemFont("WhatsNextView Font",&mWhatsNextFont); |
180 | addItemFont("EventView Font",&mEventViewFont); | 180 | addItemFont("EventView Font",&mEventViewFont); |
181 | 181 | ||
182 | // KPrefs::setCurrentGroup("SyncProfiles"); | 182 | // KPrefs::setCurrentGroup("SyncProfiles"); |
183 | // addItemString("LocalMachineName",&mLocalMachineName, "undefined"); | 183 | // addItemString("LocalMachineName",&mLocalMachineName, "undefined"); |
184 | // addItemStringList("SyncProfileNames",&mSyncProfileNames); | 184 | // addItemStringList("SyncProfileNames",&mSyncProfileNames); |
185 | // addItemStringList("ExternSyncProfiles",&mExternSyncProfileNames); | 185 | // addItemStringList("ExternSyncProfiles",&mExternSyncProfileNames); |
186 | 186 | ||
187 | KPrefs::setCurrentGroup("RemoteSyncing"); | 187 | KPrefs::setCurrentGroup("RemoteSyncing"); |
188 | // addItemBool("UsePasswd",&mUsePassWd,false); | 188 | // addItemBool("UsePasswd",&mUsePassWd,false); |
189 | // addItemBool("WriteBackFile",&mWriteBackFile,true); | 189 | // addItemBool("WriteBackFile",&mWriteBackFile,true); |
190 | // addItemBool("WriteBackExistingOnly",&mWriteBackExistingOnly,false); | 190 | // addItemBool("WriteBackExistingOnly",&mWriteBackExistingOnly,false); |
191 | // addItemBool("AskForPreferences",&mAskForPreferences,true); | 191 | // addItemBool("AskForPreferences",&mAskForPreferences,true); |
192 | // addItemBool("ShowSyncSummary",&mShowSyncSummary,true); | 192 | // addItemBool("ShowSyncSummary",&mShowSyncSummary,true); |
193 | addItemString("PassiveSyncPort",&mPassiveSyncPort,"9197" ); | 193 | addItemString("PassiveSyncPort",&mPassiveSyncPort,"9197" ); |
194 | addItemString("PassiveSyncPw",&mPassiveSyncPw,"abc" ); | ||
194 | addItemString("ActiveSyncPort",&mActiveSyncPort,"9197" ); | 195 | addItemString("ActiveSyncPort",&mActiveSyncPort,"9197" ); |
195 | addItemString("ActiveSyncIP",&mActiveSyncIP,"192.168.0.40" ); | 196 | addItemString("ActiveSyncIP",&mActiveSyncIP,"192.168.0.40" ); |
196 | addItemBool("ShowSyncEvents",&mShowSyncEvents,false); | 197 | addItemBool("ShowSyncEvents",&mShowSyncEvents,false); |
197 | addItemInt("LastSyncTime",&mLastSyncTime,0); | 198 | addItemInt("LastSyncTime",&mLastSyncTime,0); |
198 | addItemInt("SyncAlgoPrefs",&mSyncAlgoPrefs,3); | 199 | addItemInt("SyncAlgoPrefs",&mSyncAlgoPrefs,3); |
199 | addItemInt("RingSyncAlgoPrefs",&mRingSyncAlgoPrefs,3); | 200 | addItemInt("RingSyncAlgoPrefs",&mRingSyncAlgoPrefs,3); |
200 | 201 | ||
201 | #ifdef _WIN32_ | 202 | #ifdef _WIN32_ |
202 | QString hdp= locateLocal("data","korganizer")+"\\\\"; | 203 | QString hdp= locateLocal("data","korganizer")+"\\\\"; |
203 | #else | 204 | #else |
204 | QString hdp= locateLocal("data","korganizer")+"/"; | 205 | QString hdp= locateLocal("data","korganizer")+"/"; |
205 | #endif | 206 | #endif |
206 | // addItemString("RemoteIP",&mRemoteIP, "192.168.0.65"); | 207 | // addItemString("RemoteIP",&mRemoteIP, "192.168.0.65"); |
207 | // addItemString("RemoteUser",&mRemoteUser, "zaurus"); | 208 | // addItemString("RemoteUser",&mRemoteUser, "zaurus"); |
208 | // addItemString("RemotePassWd",&mRemotePassWd, ""); | 209 | // addItemString("RemotePassWd",&mRemotePassWd, ""); |
209 | // addItemString("RemoteFile", &mRemoteFile, hdp+"mycalendar.ics"); | 210 | // addItemString("RemoteFile", &mRemoteFile, hdp+"mycalendar.ics"); |
diff --git a/korganizer/koprefs.h b/korganizer/koprefs.h index 7abd741..d9ac851 100644 --- a/korganizer/koprefs.h +++ b/korganizer/koprefs.h | |||
@@ -266,32 +266,33 @@ class KOPrefs : public KPimPrefs | |||
266 | bool mMonthViewUsesForegroundColor; | 266 | bool mMonthViewUsesForegroundColor; |
267 | 267 | ||
268 | bool mHightlightDateTimeEdit; | 268 | bool mHightlightDateTimeEdit; |
269 | bool mShortDateInViewer; | 269 | bool mShortDateInViewer; |
270 | 270 | ||
271 | QStringList mLocationDefaults; | 271 | QStringList mLocationDefaults; |
272 | QStringList mEventSummaryUser; | 272 | QStringList mEventSummaryUser; |
273 | QStringList mTodoSummaryUser; | 273 | QStringList mTodoSummaryUser; |
274 | 274 | ||
275 | bool mUseInternalAlarmNotification; | 275 | bool mUseInternalAlarmNotification; |
276 | int mAlarmPlayBeeps; | 276 | int mAlarmPlayBeeps; |
277 | int mAlarmSuspendTime; | 277 | int mAlarmSuspendTime; |
278 | int mAlarmSuspendCount; | 278 | int mAlarmSuspendCount; |
279 | int mAlarmBeepInterval; | 279 | int mAlarmBeepInterval; |
280 | 280 | ||
281 | QString mPassiveSyncPort; | 281 | QString mPassiveSyncPort; |
282 | QString mPassiveSyncPw; | ||
282 | QString mActiveSyncPort; | 283 | QString mActiveSyncPort; |
283 | QString mActiveSyncIP; | 284 | QString mActiveSyncIP; |
284 | 285 | ||
285 | 286 | ||
286 | //US I copied the following settings into KPimGlobalPrefs | 287 | //US I copied the following settings into KPimGlobalPrefs |
287 | // that allows us later to easily remove the settings from here. | 288 | // that allows us later to easily remove the settings from here. |
288 | int mPreferredDate; | 289 | int mPreferredDate; |
289 | QString mUserDateFormatLong; | 290 | QString mUserDateFormatLong; |
290 | QString mUserDateFormatShort; | 291 | QString mUserDateFormatShort; |
291 | int mPreferredLanguage; | 292 | int mPreferredLanguage; |
292 | int mPreferredTime; | 293 | int mPreferredTime; |
293 | bool mWeekStartsOnSunday; | 294 | bool mWeekStartsOnSunday; |
294 | QString mTimeZoneId; | 295 | QString mTimeZoneId; |
295 | bool mUseDaylightsaving; | 296 | bool mUseDaylightsaving; |
296 | int mDaylightsavingStart; | 297 | int mDaylightsavingStart; |
297 | int mDaylightsavingEnd; | 298 | int mDaylightsavingEnd; |
diff --git a/korganizer/mainwindow.cpp b/korganizer/mainwindow.cpp index 7b666d1..de94b8c 100644 --- a/korganizer/mainwindow.cpp +++ b/korganizer/mainwindow.cpp | |||
@@ -1879,76 +1879,71 @@ QString MainWindow::getPassword( ) | |||
1879 | dia.setCaption( i18n("Enter password") ); | 1879 | dia.setCaption( i18n("Enter password") ); |
1880 | QPushButton pb ( "OK", &dia); | 1880 | QPushButton pb ( "OK", &dia); |
1881 | lay.addWidget( &pb ); | 1881 | lay.addWidget( &pb ); |
1882 | connect(&pb, SIGNAL( clicked() ), &dia, SLOT ( accept() ) ); | 1882 | connect(&pb, SIGNAL( clicked() ), &dia, SLOT ( accept() ) ); |
1883 | dia.show(); | 1883 | dia.show(); |
1884 | int res = dia.exec(); | 1884 | int res = dia.exec(); |
1885 | if ( res ) | 1885 | if ( res ) |
1886 | retfile = lab.text(); | 1886 | retfile = lab.text(); |
1887 | dia.hide(); | 1887 | dia.hide(); |
1888 | qApp->processEvents(); | 1888 | qApp->processEvents(); |
1889 | return retfile; | 1889 | return retfile; |
1890 | 1890 | ||
1891 | } | 1891 | } |
1892 | 1892 | ||
1893 | void MainWindow::enableQuick() | 1893 | void MainWindow::enableQuick() |
1894 | { | 1894 | { |
1895 | QString passWordPiSync = "bhdrvmk"; | ||
1896 | QString retfile = ""; | ||
1897 | QDialog dia ( this, "input-dialog", true ); | 1895 | QDialog dia ( this, "input-dialog", true ); |
1898 | QLineEdit lab ( &dia ); | 1896 | QLineEdit lab ( &dia ); |
1899 | QVBoxLayout lay( &dia ); | 1897 | QVBoxLayout lay( &dia ); |
1900 | lab.setText( KOPrefs::instance()->mPassiveSyncPort ); | 1898 | lab.setText( KOPrefs::instance()->mPassiveSyncPort ); |
1901 | lay.setMargin(7); | 1899 | lay.setMargin(7); |
1902 | lay.setSpacing(7); | 1900 | lay.setSpacing(7); |
1903 | QLabel label ( i18n("Port number (Default: 9197)"), &dia ); | 1901 | QLabel label ( i18n("Port number (Default: 9197)"), &dia ); |
1904 | lay.addWidget( &label); | 1902 | lay.addWidget( &label); |
1905 | lay.addWidget( &lab); | 1903 | lay.addWidget( &lab); |
1906 | 1904 | ||
1907 | QLineEdit lepw ( &dia ); | 1905 | QLineEdit lepw ( &dia ); |
1908 | lepw.setText( "abc" ); | 1906 | lepw.setText( KOPrefs::instance()->mPassiveSyncPw ); |
1909 | QLabel label2 ( i18n("Password to enable\naccess from remote:"), &dia ); | 1907 | QLabel label2 ( i18n("Password to enable\naccess from remote:"), &dia ); |
1910 | lay.addWidget( &label2); | 1908 | lay.addWidget( &label2); |
1911 | lay.addWidget( &lepw); | 1909 | lay.addWidget( &lepw); |
1912 | dia.setFixedSize( 230,80 ); | 1910 | dia.setFixedSize( 230,80 ); |
1913 | dia.setCaption( i18n("Enter port for Pi-Sync") ); | 1911 | dia.setCaption( i18n("Enter port for Pi-Sync") ); |
1914 | QPushButton pb ( "OK", &dia); | 1912 | QPushButton pb ( "OK", &dia); |
1915 | lay.addWidget( &pb ); | 1913 | lay.addWidget( &pb ); |
1916 | connect(&pb, SIGNAL( clicked() ), &dia, SLOT ( accept() ) ); | 1914 | connect(&pb, SIGNAL( clicked() ), &dia, SLOT ( accept() ) ); |
1917 | dia.show(); | 1915 | dia.show(); |
1918 | int res = dia.exec(); | 1916 | if ( ! dia.exec() ) |
1919 | if ( res ) | ||
1920 | retfile = lab.text(); | ||
1921 | else | ||
1922 | return; | 1917 | return; |
1923 | dia.hide(); | 1918 | dia.hide(); |
1924 | passWordPiSync = lepw.text(); | ||
1925 | qApp->processEvents(); | 1919 | qApp->processEvents(); |
1926 | KOPrefs::instance()->mPassiveSyncPort = retfile; | 1920 | KOPrefs::instance()->mPassiveSyncPw = lepw.text(); |
1921 | KOPrefs::instance()->mPassiveSyncPort = lab.text(); | ||
1927 | bool ok; | 1922 | bool ok; |
1928 | Q_UINT16 port = retfile.toUInt(&ok); | 1923 | Q_UINT16 port = KOPrefs::instance()->mPassiveSyncPort.toUInt(&ok); |
1929 | if ( ! ok ) { | 1924 | if ( ! ok ) { |
1930 | KMessageBox::information( this, i18n("No valid port")); | 1925 | KMessageBox::information( this, i18n("No valid port")); |
1931 | return; | 1926 | return; |
1932 | } | 1927 | } |
1933 | //qDebug("port %d ", port); | 1928 | //qDebug("port %d ", port); |
1934 | mServerSocket = new KServerSocket ( passWordPiSync, port ,1 ); | 1929 | mServerSocket = new KServerSocket ( KOPrefs::instance()->mPassiveSyncPw, port ,1 ); |
1935 | mServerSocket->setFileName( defaultFileName() ); | 1930 | mServerSocket->setFileName( defaultFileName() ); |
1936 | //qDebug("connected "); | 1931 | //qDebug("connected "); |
1937 | if ( !mServerSocket->ok() ) { | 1932 | if ( !mServerSocket->ok() ) { |
1938 | qWarning("Failed to bind to port %d", port); | 1933 | KMessageBox::information( this, i18n("Failed to bind or\nlisten to the port!")); |
1939 | delete mServerSocket; | 1934 | delete mServerSocket; |
1940 | mServerSocket = 0; | 1935 | mServerSocket = 0; |
1941 | return; | 1936 | return; |
1942 | } | 1937 | } |
1943 | connect( mServerSocket, SIGNAL ( saveFile() ), this, SLOT ( save() ) ); | 1938 | connect( mServerSocket, SIGNAL ( saveFile() ), this, SLOT ( save() ) ); |
1944 | connect( mServerSocket, SIGNAL ( file_received( bool ) ), this, SLOT ( getFile( bool ) ) ); | 1939 | connect( mServerSocket, SIGNAL ( file_received( bool ) ), this, SLOT ( getFile( bool ) ) ); |
1945 | } | 1940 | } |
1946 | 1941 | ||
1947 | void MainWindow::getFile( bool success ) | 1942 | void MainWindow::getFile( bool success ) |
1948 | { | 1943 | { |
1949 | if ( ! success ) { | 1944 | if ( ! success ) { |
1950 | setCaption( i18n("Error receiving file. Nothing changed!") ); | 1945 | setCaption( i18n("Error receiving file. Nothing changed!") ); |
1951 | return; | 1946 | return; |
1952 | } | 1947 | } |
1953 | mView->watchSavedFile(); | 1948 | mView->watchSavedFile(); |
1954 | mView->openCalendar( defaultFileName() ); | 1949 | mView->openCalendar( defaultFileName() ); |
@@ -2181,103 +2176,110 @@ void MainWindow::printSel( ) | |||
2181 | { | 2176 | { |
2182 | mView->viewManager()->agendaView()->agenda()->printSelection(); | 2177 | mView->viewManager()->agendaView()->agenda()->printSelection(); |
2183 | } | 2178 | } |
2184 | 2179 | ||
2185 | void MainWindow::printCal() | 2180 | void MainWindow::printCal() |
2186 | { | 2181 | { |
2187 | mView->print();//mCp->showDialog(); | 2182 | mView->print();//mCp->showDialog(); |
2188 | } | 2183 | } |
2189 | 2184 | ||
2190 | 2185 | ||
2191 | 2186 | ||
2192 | KServerSocket:: KServerSocket ( QString pw, Q_UINT16 port, int backlog, QObject * parent, const char * name ) : QServerSocket( port, backlog, parent, name ) | 2187 | KServerSocket:: KServerSocket ( QString pw, Q_UINT16 port, int backlog, QObject * parent, const char * name ) : QServerSocket( port, backlog, parent, name ) |
2193 | { | 2188 | { |
2194 | mPassWord = pw; | 2189 | mPassWord = pw; |
2195 | mSocket = 0; | 2190 | mSocket = 0; |
2196 | mSyncActionDialog = 0; | 2191 | mSyncActionDialog = 0; |
2192 | blockRC = false; | ||
2197 | }; | 2193 | }; |
2198 | 2194 | ||
2199 | void KServerSocket::newConnection ( int socket ) | 2195 | void KServerSocket::newConnection ( int socket ) |
2200 | { | 2196 | { |
2201 | // qDebug("KServerSocket:New connection %d ", socket); | 2197 | // qDebug("KServerSocket:New connection %d ", socket); |
2202 | if ( mSocket ) { | 2198 | if ( mSocket ) { |
2203 | qDebug("KServerSocket::newConnection Socket deleted! "); | 2199 | qDebug("KServerSocket::newConnection Socket deleted! "); |
2204 | delete mSocket; | 2200 | delete mSocket; |
2205 | mSocket = 0; | 2201 | mSocket = 0; |
2206 | } | 2202 | } |
2207 | mSocket = new QSocket( this ); | 2203 | mSocket = new QSocket( this ); |
2208 | connect( mSocket , SIGNAL(readyRead()), this, SLOT(readClient()) ); | 2204 | connect( mSocket , SIGNAL(readyRead()), this, SLOT(readClient()) ); |
2209 | connect( mSocket , SIGNAL(delayedCloseFinished()), this, SLOT(discardClient()) ); | 2205 | connect( mSocket , SIGNAL(delayedCloseFinished()), this, SLOT(discardClient()) ); |
2210 | mSocket->setSocket( socket ); | 2206 | mSocket->setSocket( socket ); |
2211 | } | 2207 | } |
2212 | 2208 | ||
2213 | void KServerSocket::discardClient() | 2209 | void KServerSocket::discardClient() |
2214 | { | 2210 | { |
2215 | //qDebug(" KServerSocket::discardClient()"); | 2211 | //qDebug(" KServerSocket::discardClient()"); |
2216 | if ( mSocket ) { | 2212 | if ( mSocket ) { |
2217 | delete mSocket; | 2213 | delete mSocket; |
2218 | mSocket = 0; | 2214 | mSocket = 0; |
2219 | } | 2215 | } |
2220 | //emit endConnect(); | 2216 | //emit endConnect(); |
2221 | } | 2217 | } |
2222 | void KServerSocket::readClient() | 2218 | void KServerSocket::readClient() |
2223 | { | 2219 | { |
2220 | if ( blockRC ) | ||
2221 | return; | ||
2224 | if ( mSocket == 0 ) { | 2222 | if ( mSocket == 0 ) { |
2225 | qDebug("ERROR::KServerSocket::readClient(): mSocket == 0 "); | 2223 | qDebug("ERROR::KServerSocket::readClient(): mSocket == 0 "); |
2226 | return; | 2224 | return; |
2227 | } | 2225 | } |
2228 | //qDebug("KServerSocket readClient()"); | 2226 | qDebug("KServerSocket readClient()"); |
2229 | if ( mSocket->canReadLine() ) { | 2227 | if ( mSocket->canReadLine() ) { |
2230 | QStringList tokens = QStringList::split( QRegExp("[ \r\n][ \r\n]*"), mSocket->readLine() ); | 2228 | QString line = mSocket->readLine(); |
2229 | qDebug("KServerSocket readline: %s ", line.latin1()); | ||
2230 | QStringList tokens = QStringList::split( QRegExp("[ \r\n][ \r\n]*"), line ); | ||
2231 | if ( tokens[0] == "GET" ) { | 2231 | if ( tokens[0] == "GET" ) { |
2232 | if ( tokens[1] == mPassWord ) | 2232 | if ( tokens[1] == mPassWord ) |
2233 | //emit sendFile( mSocket ); | 2233 | //emit sendFile( mSocket ); |
2234 | send_file(); | 2234 | send_file(); |
2235 | else { | 2235 | else { |
2236 | KMessageBox::information( 0, i18n("ERROR:\nGot send file request\nwith invalid password")); | 2236 | KMessageBox::information( 0, i18n("ERROR:\nGot send file request\nwith invalid password")); |
2237 | qDebug("password %s, invalid password %s ",mPassWord.latin1(), tokens[1].latin1() ); | 2237 | qDebug("password %s, invalid password %s ",mPassWord.latin1(), tokens[1].latin1() ); |
2238 | } | 2238 | } |
2239 | } | 2239 | } |
2240 | if ( tokens[0] == "PUT" ) { | 2240 | if ( tokens[0] == "PUT" ) { |
2241 | if ( tokens[1] == mPassWord ) | 2241 | if ( tokens[1] == mPassWord ) { |
2242 | //emit getFile( mSocket ); | 2242 | //emit getFile( mSocket ); |
2243 | blockRC = true; | ||
2243 | get_file(); | 2244 | get_file(); |
2245 | } | ||
2244 | else { | 2246 | else { |
2245 | KMessageBox::information( 0, i18n("ERROR:\nGot receive file request\nwith invalid password")); | 2247 | KMessageBox::information( 0, i18n("ERROR:\nGot receive file request\nwith invalid password")); |
2246 | qDebug("password %s, invalid password %s ",mPassWord.latin1(), tokens[1].latin1() ); | 2248 | qDebug("password %s, invalid password %s ",mPassWord.latin1(), tokens[1].latin1() ); |
2247 | } | 2249 | } |
2248 | } | 2250 | } |
2249 | if ( tokens[0] == "STOP" ) { | 2251 | if ( tokens[0] == "STOP" ) { |
2250 | //emit endConnect(); | 2252 | //emit endConnect(); |
2251 | end_connect(); | 2253 | end_connect(); |
2252 | } | 2254 | } |
2253 | } | 2255 | } |
2254 | } | 2256 | } |
2255 | void KServerSocket::end_connect() | 2257 | void KServerSocket::end_connect() |
2256 | { | 2258 | { |
2257 | delete mSyncActionDialog; | 2259 | delete mSyncActionDialog; |
2258 | mSyncActionDialog = 0; | 2260 | mSyncActionDialog = 0; |
2259 | } | 2261 | } |
2260 | void KServerSocket::send_file() | 2262 | void KServerSocket::send_file() |
2261 | { | 2263 | { |
2262 | //qDebug("MainWindow::sendFile(QSocket* s) "); | 2264 | //qDebug("MainWindow::sendFile(QSocket* s) "); |
2263 | if ( mSyncActionDialog ) | 2265 | if ( mSyncActionDialog ) |
2264 | delete mSyncActionDialog; | 2266 | delete mSyncActionDialog; |
2265 | mSyncActionDialog = new QDialog ( 0, "input-dialog", true ); | 2267 | mSyncActionDialog = new QDialog ( 0, "input-dialog", true ); |
2266 | mSyncActionDialog->setCaption(i18n("Received sync request")); | 2268 | mSyncActionDialog->setCaption(i18n("Received sync request")); |
2267 | QLabel* label = new QLabel( i18n("Synchronizing...\nDo not use this application!\n\nIf syncing fails you can close this dialog."), mSyncActionDialog ); | 2269 | QLabel* label = new QLabel( i18n("Synchronizing from remote ...\n\nDo not use this application!\n\nIf syncing fails\nyou can close this dialog."), mSyncActionDialog ); |
2268 | QVBoxLayout* lay = new QVBoxLayout( mSyncActionDialog ); | 2270 | QVBoxLayout* lay = new QVBoxLayout( mSyncActionDialog ); |
2269 | lay->addWidget( label); | 2271 | lay->addWidget( label); |
2270 | lay->setMargin(7); | 2272 | lay->setMargin(7); |
2271 | lay->setSpacing(7); | 2273 | lay->setSpacing(7); |
2272 | mSyncActionDialog->setFixedSize( 230, 120); | 2274 | mSyncActionDialog->setFixedSize( 230, 120); |
2273 | mSyncActionDialog->show(); | 2275 | mSyncActionDialog->show(); |
2274 | qDebug("KSS::saving ... "); | 2276 | qDebug("KSS::saving ... "); |
2275 | emit saveFile(); | 2277 | emit saveFile(); |
2276 | qApp->processEvents(); | 2278 | qApp->processEvents(); |
2277 | QString fileName = mFileName; | 2279 | QString fileName = mFileName; |
2278 | QFile file( fileName ); | 2280 | QFile file( fileName ); |
2279 | if (!file.open( IO_ReadOnly ) ) { | 2281 | if (!file.open( IO_ReadOnly ) ) { |
2280 | delete mSyncActionDialog; | 2282 | delete mSyncActionDialog; |
2281 | mSyncActionDialog = 0; | 2283 | mSyncActionDialog = 0; |
2282 | qDebug("KSS::error open file "); | 2284 | qDebug("KSS::error open file "); |
2283 | mSocket->close(); | 2285 | mSocket->close(); |
@@ -2324,48 +2326,50 @@ void KServerSocket::readBackFileFromSocket() | |||
2324 | 2326 | ||
2325 | } | 2327 | } |
2326 | if ( piTime.elapsed () < 3000 ) { | 2328 | if ( piTime.elapsed () < 3000 ) { |
2327 | // wait for more | 2329 | // wait for more |
2328 | //qDebug("waitformore "); | 2330 | //qDebug("waitformore "); |
2329 | QTimer::singleShot( 100, this , SLOT (readBackFileFromSocket( ) )); | 2331 | QTimer::singleShot( 100, this , SLOT (readBackFileFromSocket( ) )); |
2330 | return; | 2332 | return; |
2331 | } | 2333 | } |
2332 | QString fileName = mFileName; | 2334 | QString fileName = mFileName; |
2333 | QFile file ( fileName ); | 2335 | QFile file ( fileName ); |
2334 | if (!file.open( IO_WriteOnly ) ) { | 2336 | if (!file.open( IO_WriteOnly ) ) { |
2335 | delete mSyncActionDialog; | 2337 | delete mSyncActionDialog; |
2336 | mSyncActionDialog = 0; | 2338 | mSyncActionDialog = 0; |
2337 | qDebug("error open cal file "); | 2339 | qDebug("error open cal file "); |
2338 | piFileString = ""; | 2340 | piFileString = ""; |
2339 | emit file_received( false ); | 2341 | emit file_received( false ); |
2342 | blockRC = false; | ||
2340 | return ; | 2343 | return ; |
2341 | 2344 | ||
2342 | } | 2345 | } |
2343 | 2346 | ||
2344 | // mView->setLoadedFileVersion(QDateTime::currentDateTime().addSecs( -1)); | 2347 | // mView->setLoadedFileVersion(QDateTime::currentDateTime().addSecs( -1)); |
2345 | QTextStream ts ( &file ); | 2348 | QTextStream ts ( &file ); |
2346 | ts.setCodec( QTextCodec::codecForName("utf8") ); | 2349 | ts.setCodec( QTextCodec::codecForName("utf8") ); |
2347 | mSyncActionDialog->setCaption( i18n("Writing file to disk...") ); | 2350 | mSyncActionDialog->setCaption( i18n("Writing file to disk...") ); |
2348 | ts << piFileString; | 2351 | ts << piFileString; |
2349 | mSocket->close(); | 2352 | mSocket->close(); |
2350 | if ( mSocket->state() == QSocket::Idle ) | 2353 | if ( mSocket->state() == QSocket::Idle ) |
2351 | QTimer::singleShot( 10, this , SLOT ( discardClient())); | 2354 | QTimer::singleShot( 10, this , SLOT ( discardClient())); |
2352 | file.close(); | 2355 | file.close(); |
2353 | delete mSyncActionDialog; | 2356 | delete mSyncActionDialog; |
2354 | mSyncActionDialog = 0; | 2357 | mSyncActionDialog = 0; |
2355 | piFileString = ""; | 2358 | piFileString = ""; |
2359 | blockRC = false; | ||
2356 | emit file_received( true ); | 2360 | emit file_received( true ); |
2357 | 2361 | ||
2358 | } | 2362 | } |
2359 | 2363 | ||
2360 | KCommandSocket::KCommandSocket ( QString password, Q_UINT16 port, QString host, QObject * parent, const char * name ): QObject( parent, name ) | 2364 | KCommandSocket::KCommandSocket ( QString password, Q_UINT16 port, QString host, QObject * parent, const char * name ): QObject( parent, name ) |
2361 | { | 2365 | { |
2362 | mPassWord = password; | 2366 | mPassWord = password; |
2363 | mSocket = 0; | 2367 | mSocket = 0; |
2364 | mPort = port; | 2368 | mPort = port; |
2365 | mHost = host; | 2369 | mHost = host; |
2366 | 2370 | ||
2367 | mRetVal = quiet; | 2371 | mRetVal = quiet; |
2368 | mTimerSocket = new QTimer ( this ); | 2372 | mTimerSocket = new QTimer ( this ); |
2369 | connect( mTimerSocket, SIGNAL ( timeout () ), this, SLOT ( deleteSocket() ) ); | 2373 | connect( mTimerSocket, SIGNAL ( timeout () ), this, SLOT ( deleteSocket() ) ); |
2370 | } | 2374 | } |
2371 | void KCommandSocket::readFile( QString fn ) | 2375 | void KCommandSocket::readFile( QString fn ) |
diff --git a/korganizer/mainwindow.h b/korganizer/mainwindow.h index ba627b9..7b24b88 100644 --- a/korganizer/mainwindow.h +++ b/korganizer/mainwindow.h | |||
@@ -34,32 +34,33 @@ public: | |||
34 | 34 | ||
35 | void newConnection ( int socket ) ; | 35 | void newConnection ( int socket ) ; |
36 | void setFileName( QString fn ) {mFileName = fn;}; | 36 | void setFileName( QString fn ) {mFileName = fn;}; |
37 | 37 | ||
38 | signals: | 38 | signals: |
39 | //void sendFile(QSocket*); | 39 | //void sendFile(QSocket*); |
40 | //void getFile(QSocket*); | 40 | //void getFile(QSocket*); |
41 | void file_received( bool ); | 41 | void file_received( bool ); |
42 | //void file_sent(); | 42 | //void file_sent(); |
43 | void saveFile(); | 43 | void saveFile(); |
44 | void endConnect(); | 44 | void endConnect(); |
45 | private slots: | 45 | private slots: |
46 | void discardClient(); | 46 | void discardClient(); |
47 | void readClient(); | 47 | void readClient(); |
48 | void readBackFileFromSocket(); | 48 | void readBackFileFromSocket(); |
49 | private : | 49 | private : |
50 | bool blockRC; | ||
50 | void send_file(); | 51 | void send_file(); |
51 | void get_file(); | 52 | void get_file(); |
52 | void end_connect(); | 53 | void end_connect(); |
53 | QDialog* mSyncActionDialog; | 54 | QDialog* mSyncActionDialog; |
54 | QSocket* mSocket; | 55 | QSocket* mSocket; |
55 | QString mPassWord; | 56 | QString mPassWord; |
56 | QString mFileName; | 57 | QString mFileName; |
57 | QTime piTime; | 58 | QTime piTime; |
58 | QString piFileString; | 59 | QString piFileString; |
59 | }; | 60 | }; |
60 | 61 | ||
61 | class KCommandSocket : public QObject | 62 | class KCommandSocket : public QObject |
62 | { | 63 | { |
63 | Q_OBJECT | 64 | Q_OBJECT |
64 | public: | 65 | public: |
65 | enum state { successR, errorR, successW, errorW, quiet }; | 66 | enum state { successR, errorR, successW, errorW, quiet }; |