summaryrefslogtreecommitdiffabout
Unidiff
Diffstat (more/less context) (ignore whitespace changes)
-rw-r--r--libkdepim/ksyncmanager.cpp22
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
@@ -252,117 +252,131 @@ void KSyncManager::slotSyncMenu( int action )
252 mActiveSyncPort = temp->getRemotePort(); 252 mActiveSyncPort = temp->getRemotePort();
253 mActiveSyncIP = temp->getRemoteIP(); 253 mActiveSyncIP = temp->getRemoteIP();
254 } else { 254 } else {
255 mPassWordPiSync = temp->getRemotePwPWM(); 255 mPassWordPiSync = temp->getRemotePwPWM();
256 mActiveSyncPort = temp->getRemotePortPWM(); 256 mActiveSyncPort = temp->getRemotePortPWM();
257 mActiveSyncIP = temp->getRemoteIPPWM(); 257 mActiveSyncIP = temp->getRemoteIPPWM();
258 } 258 }
259 syncPi(); 259 syncPi();
260 while ( !mPisyncFinished ) { 260 while ( !mPisyncFinished ) {
261 //qDebug("waiting "); 261 //qDebug("waiting ");
262 qApp->processEvents(); 262 qApp->processEvents();
263 } 263 }
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
273void KSyncManager::enableQuick( bool ask ) 273void 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
288 QLineEdit lepw ( &dia ); 289 QLineEdit lepw ( &dia );
289 lepw.setText( mPrefs->mPassiveSyncPw ); 290 lepw.setText( mPrefs->mPassiveSyncPw );
290 QLabel label2 ( i18n("Password to enable\naccess from remote:"), &dia ); 291 QLabel label2 ( i18n("Password to enable\naccess from remote:"), &dia );
291 lay.addWidget( &label2); 292 lay.addWidget( &label2);
292 lay.addWidget( &lepw); 293 lay.addWidget( &lepw);
293 QCheckBox autostart(i18n("Automatically start\nat application startup"), &dia ); 294 QCheckBox autostart(i18n("Automatically start\nat application startup"), &dia );
294 lay.addWidget( &autostart); 295 lay.addWidget( &autostart);
295 autostart.setChecked( mPrefs->mPassiveSyncAutoStart ); 296 autostart.setChecked( mPrefs->mPassiveSyncAutoStart );
296#ifdef DESKTOP_VERSION 297#ifdef DESKTOP_VERSION
297#ifdef _WIN32_ 298#ifdef _WIN32_
298 QCheckBox syncdesktop( i18n("Automatically sync with Outlook\nwhen receiving sync request"),&dia ); 299 QCheckBox syncdesktop( i18n("Automatically sync with Outlook\nwhen receiving sync request"),&dia );
299#else 300#else
300 QCheckBox syncdesktop( i18n("Automatically sync with KDE-Desktop\nwhen receiving sync request"),&dia ); 301 QCheckBox syncdesktop( i18n("Automatically sync with KDE-Desktop\nwhen receiving sync request"),&dia );
301#endif 302#endif
302 lay.addWidget( &syncdesktop); 303 lay.addWidget( &syncdesktop);
303#else 304#else
304 QCheckBox syncdesktop( i18n("Automatically sync\nwith KDE-Desktop"),&dia ); 305 QCheckBox syncdesktop( i18n("Automatically sync\nwith KDE-Desktop"),&dia );
305 syncdesktop.hide(); 306 syncdesktop.hide();
306#endif 307#endif
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
349void KSyncManager::syncLocalFile() 363void 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 {
357 case (KAPI): 371 case (KAPI):
358 ext = "(*.vcf)"; 372 ext = "(*.vcf)";
359 break; 373 break;
360 case (KOPI): 374 case (KOPI):
361 ext = "(*.ics/*.vcs)"; 375 ext = "(*.ics/*.vcs)";
362 break; 376 break;
363 case (PWMPI): 377 case (PWMPI):
364 ext = "(*.pwm)"; 378 ext = "(*.pwm)";
365 break; 379 break;
366 default: 380 default:
367 qDebug("KSyncManager::syncLocalFile: invalid apptype selected"); 381 qDebug("KSyncManager::syncLocalFile: invalid apptype selected");
368 break; 382 break;