author | zautrix <zautrix> | 2004-10-20 08:47:06 (UTC) |
---|---|---|
committer | zautrix <zautrix> | 2004-10-20 08:47:06 (UTC) |
commit | 40eaafc9e008dc004b6ebc65fae8d89c8883ee8b (patch) (unidiff) | |
tree | b2d60584f52ef66aa5347f2534d323a4609280c5 /libkdepim | |
parent | 268e69a533c5db110600758366644c9827957364 (diff) | |
download | kdepimpi-40eaafc9e008dc004b6ebc65fae8d89c8883ee8b.zip kdepimpi-40eaafc9e008dc004b6ebc65fae8d89c8883ee8b.tar.gz kdepimpi-40eaafc9e008dc004b6ebc65fae8d89c8883ee8b.tar.bz2 |
config save bugfix
-rw-r--r-- | libkdepim/ksyncmanager.cpp | 22 |
1 files changed, 18 insertions, 4 deletions
diff --git a/libkdepim/ksyncmanager.cpp b/libkdepim/ksyncmanager.cpp index 75c0b2b..7ca3ee0 100644 --- a/libkdepim/ksyncmanager.cpp +++ b/libkdepim/ksyncmanager.cpp | |||
@@ -264,24 +264,25 @@ void KSyncManager::slotSyncMenu( int action ) | |||
264 | } else | 264 | } else |
265 | syncRemote( temp ); | 265 | syncRemote( temp ); |
266 | 266 | ||
267 | } | 267 | } |
268 | } | 268 | } |
269 | delete temp; | 269 | delete temp; |
270 | setBlockSave(false); | 270 | setBlockSave(false); |
271 | } | 271 | } |
272 | 272 | ||
273 | void KSyncManager::enableQuick( bool ask ) | 273 | void KSyncManager::enableQuick( bool ask ) |
274 | { | 274 | { |
275 | bool autoStart; | 275 | bool autoStart; |
276 | bool changed = false; | ||
276 | if ( ask ) { | 277 | if ( ask ) { |
277 | QDialog dia ( 0, "input-dialog", true ); | 278 | QDialog dia ( 0, "input-dialog", true ); |
278 | QLineEdit lab ( &dia ); | 279 | QLineEdit lab ( &dia ); |
279 | QVBoxLayout lay( &dia ); | 280 | QVBoxLayout lay( &dia ); |
280 | lab.setText( mPrefs->mPassiveSyncPort ); | 281 | lab.setText( mPrefs->mPassiveSyncPort ); |
281 | lay.setMargin(7); | 282 | lay.setMargin(7); |
282 | lay.setSpacing(7); | 283 | lay.setSpacing(7); |
283 | int po = 9197+mTargetApp; | 284 | int po = 9197+mTargetApp; |
284 | QLabel label ( i18n("Port number (Default: %1)").arg(po), &dia ); | 285 | QLabel label ( i18n("Port number (Default: %1)").arg(po), &dia ); |
285 | lay.addWidget( &label); | 286 | lay.addWidget( &label); |
286 | lay.addWidget( &lab); | 287 | lay.addWidget( &lab); |
287 | 288 | ||
@@ -307,50 +308,63 @@ void KSyncManager::enableQuick( bool ask ) | |||
307 | syncdesktop.setChecked( mPrefs->mPassiveSyncWithDesktop ); | 308 | syncdesktop.setChecked( mPrefs->mPassiveSyncWithDesktop ); |
308 | 309 | ||
309 | dia.setFixedSize( 230,120 ); | 310 | dia.setFixedSize( 230,120 ); |
310 | dia.setCaption( i18n("Enter port for Pi-Sync") ); | 311 | dia.setCaption( i18n("Enter port for Pi-Sync") ); |
311 | QPushButton pb ( "OK", &dia); | 312 | QPushButton pb ( "OK", &dia); |
312 | lay.addWidget( &pb ); | 313 | lay.addWidget( &pb ); |
313 | connect(&pb, SIGNAL( clicked() ), &dia, SLOT ( accept() ) ); | 314 | connect(&pb, SIGNAL( clicked() ), &dia, SLOT ( accept() ) ); |
314 | dia.show(); | 315 | dia.show(); |
315 | if ( ! dia.exec() ) | 316 | if ( ! dia.exec() ) |
316 | return; | 317 | return; |
317 | dia.hide(); | 318 | dia.hide(); |
318 | qApp->processEvents(); | 319 | qApp->processEvents(); |
319 | mPrefs->mPassiveSyncPw = lepw.text(); | 320 | if ( mPrefs->mPassiveSyncPw != lepw.text() ) { |
320 | mPrefs->mPassiveSyncPort = lab.text(); | 321 | changed = true; |
322 | mPrefs->mPassiveSyncPw = lepw.text(); | ||
323 | } | ||
324 | if ( mPrefs->mPassiveSyncPort != lab.text() ) { | ||
325 | mPrefs->mPassiveSyncPort = lab.text(); | ||
326 | changed = true; | ||
327 | } | ||
321 | autoStart = autostart.isChecked(); | 328 | autoStart = autostart.isChecked(); |
322 | mPrefs->mPassiveSyncWithDesktop = syncdesktop.isChecked(); | 329 | if (mPrefs->mPassiveSyncWithDesktop != syncdesktop.isChecked() ) { |
330 | changed = true; | ||
331 | mPrefs->mPassiveSyncWithDesktop = syncdesktop.isChecked(); | ||
332 | } | ||
323 | } | 333 | } |
324 | else | 334 | else |
325 | autoStart = mPrefs->mPassiveSyncAutoStart; | 335 | autoStart = mPrefs->mPassiveSyncAutoStart; |
336 | if ( autoStart != mPrefs->mPassiveSyncAutoStart ) | ||
337 | changed = true; | ||
326 | bool ok; | 338 | bool ok; |
327 | mPrefs->mPassiveSyncAutoStart = false; | 339 | mPrefs->mPassiveSyncAutoStart = false; |
328 | Q_UINT16 port = mPrefs->mPassiveSyncPort.toUInt(&ok); | 340 | Q_UINT16 port = mPrefs->mPassiveSyncPort.toUInt(&ok); |
329 | if ( ! ok ) { | 341 | if ( ! ok ) { |
330 | KMessageBox::information( 0, i18n("No valid port")); | 342 | KMessageBox::information( 0, i18n("No valid port")); |
331 | return; | 343 | return; |
332 | } | 344 | } |
333 | //qDebug("port %d ", port); | 345 | //qDebug("port %d ", port); |
334 | mServerSocket = new KServerSocket ( mPrefs->mPassiveSyncPw, port ,1 ); | 346 | mServerSocket = new KServerSocket ( mPrefs->mPassiveSyncPw, port ,1 ); |
335 | mServerSocket->setFileName( defaultFileName() ); | 347 | mServerSocket->setFileName( defaultFileName() ); |
336 | //qDebug("connected "); | 348 | //qDebug("connected "); |
337 | if ( !mServerSocket->ok() ) { | 349 | if ( !mServerSocket->ok() ) { |
338 | KMessageBox::information( 0, i18n("Failed to bind or\nlisten to the port!")); | 350 | KMessageBox::information( 0, i18n("Failed to bind or\nlisten to the port!")); |
339 | delete mServerSocket; | 351 | delete mServerSocket; |
340 | mServerSocket = 0; | 352 | mServerSocket = 0; |
341 | return; | 353 | return; |
342 | } | 354 | } |
343 | |||
344 | mPrefs->mPassiveSyncAutoStart = autoStart; | 355 | mPrefs->mPassiveSyncAutoStart = autoStart; |
356 | if ( changed ) { | ||
357 | mPrefs->writeConfig(); | ||
358 | } | ||
345 | connect( mServerSocket, SIGNAL ( request_file() ),this, SIGNAL ( request_file() ) ); | 359 | connect( mServerSocket, SIGNAL ( request_file() ),this, SIGNAL ( request_file() ) ); |
346 | connect( mServerSocket, SIGNAL ( file_received( bool ) ), this, SIGNAL ( getFile( bool ) ) ); | 360 | connect( mServerSocket, SIGNAL ( file_received( bool ) ), this, SIGNAL ( getFile( bool ) ) ); |
347 | } | 361 | } |
348 | 362 | ||
349 | void KSyncManager::syncLocalFile() | 363 | void KSyncManager::syncLocalFile() |
350 | { | 364 | { |
351 | 365 | ||
352 | QString fn =mPrefs->mLastSyncedLocalFile; | 366 | QString fn =mPrefs->mLastSyncedLocalFile; |
353 | QString ext; | 367 | QString ext; |
354 | 368 | ||
355 | switch(mTargetApp) | 369 | switch(mTargetApp) |
356 | { | 370 | { |