summaryrefslogtreecommitdiffabout
path: root/libkdepim/ksyncprefsdialog.cpp
Unidiff
Diffstat (limited to 'libkdepim/ksyncprefsdialog.cpp') (more/less context) (ignore whitespace changes)
-rw-r--r--libkdepim/ksyncprefsdialog.cpp72
1 files changed, 67 insertions, 5 deletions
diff --git a/libkdepim/ksyncprefsdialog.cpp b/libkdepim/ksyncprefsdialog.cpp
index 8873ed1..292cde1 100644
--- a/libkdepim/ksyncprefsdialog.cpp
+++ b/libkdepim/ksyncprefsdialog.cpp
@@ -212,66 +212,68 @@ void KSyncPrefsDialog::setupSyncAlgTab()
212 QHGroupBox* gb4 = new QHGroupBox( i18n("Apply filter when adding data to remote:"), topFrame); 212 QHGroupBox* gb4 = new QHGroupBox( i18n("Apply filter when adding data to remote:"), topFrame);
213 QVBox * fibo = new QVBox ( gb4 ); 213 QVBox * fibo = new QVBox ( gb4 );
214 new QLabel ( i18n("Outgoing calendar filter:"), fibo ); 214 new QLabel ( i18n("Outgoing calendar filter:"), fibo );
215 mFilterOutCal = new QComboBox( fibo ); 215 mFilterOutCal = new QComboBox( fibo );
216 fibo = new QVBox ( gb4 ); 216 fibo = new QVBox ( gb4 );
217 new QLabel ( i18n("Outgoing addressbook filter:"), fibo ); 217 new QLabel ( i18n("Outgoing addressbook filter:"), fibo );
218 mFilterOutAB = new QComboBox( fibo ); 218 mFilterOutAB = new QComboBox( fibo );
219 //topLayout->addMultiCellWidget(mWriteBackExisting, iii,iii,0,1); 219 //topLayout->addMultiCellWidget(mWriteBackExisting, iii,iii,0,1);
220 //++iii; 220 //++iii;
221 mWriteBackFuture= new QCheckBox( i18n("Write back (calendar) entries for time period only"), topFrame ); 221 mWriteBackFuture= new QCheckBox( i18n("Write back (calendar) entries for time period only"), topFrame );
222 //topLayout->addMultiCellWidget(mWriteBackFuture, iii,iii,0,1); 222 //topLayout->addMultiCellWidget(mWriteBackFuture, iii,iii,0,1);
223 //++iii; 223 //++iii;
224 QHGroupBox* gb3 = new QHGroupBox( i18n("Time period"), topFrame); 224 QHGroupBox* gb3 = new QHGroupBox( i18n("Time period"), topFrame);
225 connect ( mWriteBackFuture, SIGNAL( toggled ( bool ) ), gb3, SLOT ( setEnabled ( bool ) ) ); 225 connect ( mWriteBackFuture, SIGNAL( toggled ( bool ) ), gb3, SLOT ( setEnabled ( bool ) ) );
226 new QLabel( i18n("From ") , gb3 ); 226 new QLabel( i18n("From ") , gb3 );
227 mWriteBackPastWeeks= new QSpinBox(1,104, 1, gb3); 227 mWriteBackPastWeeks= new QSpinBox(1,104, 1, gb3);
228 new QLabel( i18n(" weeks in the past to ") , gb3 ); 228 new QLabel( i18n(" weeks in the past to ") , gb3 );
229 mWriteBackFutureWeeks= new QSpinBox(1,104, 1, gb3); 229 mWriteBackFutureWeeks= new QSpinBox(1,104, 1, gb3);
230 new QLabel( i18n(" weeks in the future ") , gb3 ); 230 new QLabel( i18n(" weeks in the future ") , gb3 );
231 //topLayout->addMultiCellWidget(mWriteBackFutureWeeks, iii,iii,1,1); 231 //topLayout->addMultiCellWidget(mWriteBackFutureWeeks, iii,iii,1,1);
232 //++iii; 232 //++iii;
233 gb3->setEnabled( false ); 233 gb3->setEnabled( false );
234 connect ( mWriteBackExisting, SIGNAL( toggled ( bool ) ), gb4, SLOT ( setDisabled ( bool ) ) ); 234 connect ( mWriteBackExisting, SIGNAL( toggled ( bool ) ), gb4, SLOT ( setDisabled ( bool ) ) );
235 } 235 }
236 connect ( mWriteBackFile, SIGNAL( toggled ( bool ) ), gb2, SLOT ( setEnabled ( bool ) ) ); 236 connect ( mWriteBackFile, SIGNAL( toggled ( bool ) ), gb2, SLOT ( setEnabled ( bool ) ) );
237 237
238 } 238 }
239 proGr = new QButtonGroup ( 1, Qt::Horizontal, i18n("Profile kind"), topFrame); 239 proGr = new QButtonGroup ( 1, Qt::Horizontal, i18n("Profile kind"), topFrame);
240 gr = proGr; 240 gr = proGr;
241 topLayout->addMultiCellWidget(gr, iii,iii,0,1); 241 topLayout->addMultiCellWidget(gr, iii,iii,0,1);
242 ++iii; 242 ++iii;
243 mIsLocal = new QRadioButton ( i18n("Local file"), gr ); 243 mIsLocal = new QRadioButton ( i18n("Local file"), gr );
244 mIsPi = new QRadioButton ( i18n("Pi-Sync ( direct Kx/Pi to Kx/Pi sync )"), gr ); 244 mIsPi = new QRadioButton ( i18n("Pi-Sync - all resources ( direct Kx/Pi to Kx/Pi sync )"), gr );
245 connect (mIsPi, SIGNAL( toggled(bool)), this, SLOT (kindChanged(bool) ) ); 245 connect (mIsPi, SIGNAL( toggled(bool)), this, SLOT (kindChanged(bool) ) );
246 mIsPiSpecific = new QRadioButton ( i18n("Pi-Sync - selected resources ( direct Kx/Pi to Kx/Pi sync )"), gr );
247 connect (mIsPiSpecific, SIGNAL( toggled(bool)), this, SLOT (kindChanged(bool) ) );
246 mIsNotLocal = new QRadioButton ( i18n("Remote file (w down/upload command)"), gr ); 248 mIsNotLocal = new QRadioButton ( i18n("Remote file (w down/upload command)"), gr );
247 connect (mIsLocal, SIGNAL( toggled(bool)), this, SLOT (kindChanged(bool) ) ); 249 connect (mIsLocal, SIGNAL( toggled(bool)), this, SLOT (kindChanged(bool) ) );
248 mIsPhone = new QRadioButton ( i18n("Mobile device (cell phone)"), gr ); 250 mIsPhone = new QRadioButton ( i18n("Mobile device (cell phone)"), gr );
249 connect (mIsPhone, SIGNAL( toggled(bool)), this, SLOT (kindChanged(bool) ) ); 251 connect (mIsPhone, SIGNAL( toggled(bool)), this, SLOT (kindChanged(bool) ) );
250 252
251 QVGroupBox* gb1 = new QVGroupBox( i18n("Profile kind specific settings"), topFrame); 253 QVGroupBox* gb1 = new QVGroupBox( i18n("Profile kind specific settings"), topFrame);
252 topLayout->addMultiCellWidget(gb1, iii,iii,0,1); 254 topLayout->addMultiCellWidget(gb1, iii,iii,0,1);
253 ++iii; 255 ++iii;
254 256
255 // ****************************************** 257 // ******************************************
256 // Profile kind specific settings 258 // Profile kind specific settings
257 { 259 {
258 // *** phone ******************************* 260 // *** phone *******************************
259 QVGroupBox* topFrame = gb1; 261 QVGroupBox* topFrame = gb1;
260 phoneWidget = new QVBox( topFrame); 262 phoneWidget = new QVBox( topFrame);
261 //topLayout->addMultiCellWidget(phoneWidget, iii,iii,0,1); 263 //topLayout->addMultiCellWidget(phoneWidget, iii,iii,0,1);
262 //++iii; 264 //++iii;
263 mWriteContactToSIM = 0;//new QCheckBox( i18n("Sync contacts with phone SIM card (If not, sync with phone memory)"), phoneWidget ); 265 mWriteContactToSIM = 0;//new QCheckBox( i18n("Sync contacts with phone SIM card (If not, sync with phone memory)"), phoneWidget );
264 QHBox* temphb = new QHBox( phoneWidget ); 266 QHBox* temphb = new QHBox( phoneWidget );
265 new QLabel( i18n("I/O device: "), temphb ); 267 new QLabel( i18n("I/O device: "), temphb );
266 mPhoneDevice = new QLineEdit( temphb); 268 mPhoneDevice = new QLineEdit( temphb);
267 button = new QPushButton( i18n("Help..."), temphb ); 269 button = new QPushButton( i18n("Help..."), temphb );
268 connect ( button, SIGNAL( clicked()), this, SLOT ( helpDevice() ) ); 270 connect ( button, SIGNAL( clicked()), this, SLOT ( helpDevice() ) );
269 271
270 272
271 temphb = new QHBox( phoneWidget ); 273 temphb = new QHBox( phoneWidget );
272 new QLabel( i18n("Connection: "), temphb ); 274 new QLabel( i18n("Connection: "), temphb );
273 mPhoneConnection = new QLineEdit( temphb); 275 mPhoneConnection = new QLineEdit( temphb);
274 button = new QPushButton( i18n("Help..."), temphb ); 276 button = new QPushButton( i18n("Help..."), temphb );
275 connect ( button, SIGNAL( clicked()), this, SLOT ( helpConnection() ) ); 277 connect ( button, SIGNAL( clicked()), this, SLOT ( helpConnection() ) );
276 278
277 279
@@ -337,70 +339,100 @@ void KSyncPrefsDialog::setupSyncAlgTab()
337 button = new QPushButton( i18n("ssh/scp"), temphb ); 339 button = new QPushButton( i18n("ssh/scp"), temphb );
338 connect ( button, SIGNAL( clicked()), this, SLOT (fillSSH() ) ); 340 connect ( button, SIGNAL( clicked()), this, SLOT (fillSSH() ) );
339 button = new QPushButton( i18n("ftp"), temphb ); 341 button = new QPushButton( i18n("ftp"), temphb );
340 connect ( button, SIGNAL( clicked()), this, SLOT (fillFTP() ) ); 342 connect ( button, SIGNAL( clicked()), this, SLOT (fillFTP() ) );
341 lab = new QLabel( i18n("Hint: Use $PWD$ for placeholder of password!"), remoteFileWidget); 343 lab = new QLabel( i18n("Hint: Use $PWD$ for placeholder of password!"), remoteFileWidget);
342 344
343 // *** pi-sync******************************* 345 // *** pi-sync*******************************
344 piWidget = new QVBox( topFrame); 346 piWidget = new QVBox( topFrame);
345 //topLayout->addMultiCellWidget(piWidget, iii,iii,0,1); 347 //topLayout->addMultiCellWidget(piWidget, iii,iii,0,1);
346 //++iii; 348 //++iii;
347 temphb = new QHBox( piWidget ); 349 temphb = new QHBox( piWidget );
348 new QLabel( i18n("Calendar:"), temphb); 350 new QLabel( i18n("Calendar:"), temphb);
349 new QLabel( i18n("AddressBook:"), temphb); 351 new QLabel( i18n("AddressBook:"), temphb);
350 new QLabel( i18n("PWManager:"), temphb); 352 new QLabel( i18n("PWManager:"), temphb);
351 353
352 lab = new QLabel( i18n("Password for remote access: (could be the same for each)"), piWidget); 354 lab = new QLabel( i18n("Password for remote access: (could be the same for each)"), piWidget);
353 temphb = new QHBox( piWidget ); 355 temphb = new QHBox( piWidget );
354 mRemotePw = new QLineEdit(temphb); 356 mRemotePw = new QLineEdit(temphb);
355 mRemotePwAB = new QLineEdit(temphb); 357 mRemotePwAB = new QLineEdit(temphb);
356 mRemotePwPWM = new QLineEdit(temphb); 358 mRemotePwPWM = new QLineEdit(temphb);
357 359
358 lab = new QLabel( i18n("Remote IP address: (could be the same for each)"), piWidget); 360 lab = new QLabel( i18n("Remote IP address: (could be the same for each)"), piWidget);
359 temphb = new QHBox( piWidget ); 361 temphb = new QHBox( piWidget );
360 mRemoteIP = new QLineEdit(temphb); 362 mRemoteIP = new QLineEdit(temphb);
361 mRemoteIPAB = new QLineEdit(temphb); 363 mRemoteIPAB = new QLineEdit(temphb);
362 mRemoteIPPWM = new QLineEdit(temphb); 364 mRemoteIPPWM = new QLineEdit(temphb);
363 365
364 lab = new QLabel( i18n("Remote port number: (should be different for each)"), piWidget); 366 lab = new QLabel( i18n("Remote port number: (should be different for each)"), piWidget);
365 temphb = new QHBox( piWidget ); 367 temphb = new QHBox( piWidget );
366 mRemotePort = new QLineEdit(temphb); 368 mRemotePort = new QLineEdit(temphb);
367 mRemotePortAB = new QLineEdit(temphb); 369 mRemotePortAB = new QLineEdit(temphb);
368 mRemotePortPWM = new QLineEdit(temphb); 370 mRemotePortPWM = new QLineEdit(temphb);
371
372 lab = new QLabel( i18n("Local/remote Resource sync partners"), piWidget);
373 mTableBox = new QHBox( piWidget );
374 mResTableKopi = new QTable( 1, 1, mTableBox );
375 mResTableKapi = new QTable( 1, 1, mTableBox );
376 mResTablePwmpi = new QTable( 1, 1, mTableBox );
377 mResTableKopi->horizontalHeader()->setLabel( 0, i18n("Remote") );
378 mResTableKapi->horizontalHeader()->setLabel( 0, i18n("Remote") );
379 mResTablePwmpi->horizontalHeader()->setLabel( 0, i18n("Remote") );
380 mResTableKopi->setLeftMargin( 80 );
369 } 381 }
370 // ****************************************** 382 // ******************************************
371 // Profile kind specific settings END 383 // Profile kind specific settings END
372 384
373} 385}
374 386
387void KSyncPrefsDialog::readResources()
388{
389 mResourcesKopi.clear();
390 mResourcesKapi.clear();
391 KConfig fc(locateLocal("config","kopicalendarrc"));
392 fc.setGroup("CC");
393 int numCals = fc.readNumEntry("NumberCalendars",0 );
394 int curCal = 1;
395 while ( curCal <= numCals ) {
396 QString prefix = "Cal_" +QString::number( curCal );
397 QString name = fc.readEntry( prefix+"_Name", "Calendar");
398 mResourcesKopi.append( name );
399 ++curCal;
400 }
401 mResTableKopi->setNumRows( mResourcesKopi.count() );
402 int i;
403 for ( i = 0;i < mResourcesKopi.count(); ++i ) {
404 mResTableKopi->verticalHeader ()->setLabel( i, mResourcesKopi[i] );
405 }
406}
375void KSyncPrefsDialog::readFilter() 407void KSyncPrefsDialog::readFilter()
376{ 408{
377 mFilterKapi.clear(); 409 mFilterKapi.clear();
378 mFilterKopi.clear(); 410 mFilterKopi.clear();
379 KConfig cfgko(locateLocal("config","korganizerrc")); 411 KConfig cfgko(locateLocal("config","korganizerrc"));
380 KConfig cfgka(locateLocal("config","kaddressbookrc")); 412 KConfig cfgka(locateLocal("config","kaddressbookrc"));
381 cfgko.setGroup("General"); 413 cfgko.setGroup("General");
382 mFilterKopi = cfgko.readListEntry("CalendarFilters"); 414 mFilterKopi = cfgko.readListEntry("CalendarFilters");
383 cfgka.setGroup("Filter"); 415 cfgka.setGroup("Filter");
384 int count = cfgka.readNumEntry( "Count", 0 ); 416 int count = cfgka.readNumEntry( "Count", 0 );
385 for ( int i = 0; i < count; i++ ) { 417 for ( int i = 0; i < count; i++ ) {
386 cfgka.setGroup("Filter_"+QString::number( i ) ); 418 cfgka.setGroup("Filter_"+QString::number( i ) );
387 mFilterKapi.append( cfgka.readEntry("Name", "internal error") ); 419 mFilterKapi.append( cfgka.readEntry("Name", "internal error") );
388 } 420 }
389 mFilterOutCal->clear(); 421 mFilterOutCal->clear();
390 mFilterInCal->clear(); 422 mFilterInCal->clear();
391 mFilterOutAB->clear(); 423 mFilterOutAB->clear();
392 mFilterInAB->clear(); 424 mFilterInAB->clear();
393 QStringList temp = mFilterKopi; 425 QStringList temp = mFilterKopi;
394 temp.prepend(i18n("No Filter") ); 426 temp.prepend(i18n("No Filter") );
395 mFilterOutCal->insertStringList( temp ); 427 mFilterOutCal->insertStringList( temp );
396 mFilterInCal->insertStringList( temp ); 428 mFilterInCal->insertStringList( temp );
397 temp = mFilterKapi; 429 temp = mFilterKapi;
398 temp.prepend(i18n("No Filter") ); 430 temp.prepend(i18n("No Filter") );
399 mFilterOutAB->insertStringList( temp ); 431 mFilterOutAB->insertStringList( temp );
400 mFilterInAB->insertStringList( temp ); 432 mFilterInAB->insertStringList( temp );
401} 433}
402 434
403void KSyncPrefsDialog::slotOK() 435void KSyncPrefsDialog::slotOK()
404{ 436{
405 if ( mMyMachineName->text() == "undefined" ) { 437 if ( mMyMachineName->text() == "undefined" ) {
406 KMessageBox::error(this,i18n("Local device name undefined!\nPlease define device name!"),i18n("KO/Pi config error")); 438 KMessageBox::error(this,i18n("Local device name undefined!\nPlease define device name!"),i18n("KO/Pi config error"));
@@ -444,64 +476,65 @@ void KSyncPrefsDialog::chooseFilePWM()
444{ 476{
445 QString fn = QDir::homeDirPath(); 477 QString fn = QDir::homeDirPath();
446 478
447 fn =KFileDialog:: getOpenFileName( fn, i18n("Sync filename(*.pwm)"), this ); 479 fn =KFileDialog:: getOpenFileName( fn, i18n("Sync filename(*.pwm)"), this );
448 if ( fn == "" ) 480 if ( fn == "" )
449 return; 481 return;
450 mRemoteFilePWM->setText( fn ); 482 mRemoteFilePWM->setText( fn );
451} 483}
452 484
453void KSyncPrefsDialog::textChanged( const QString & s ) 485void KSyncPrefsDialog::textChanged( const QString & s )
454{ 486{
455 if ( mProfileBox->count() == 0 ) 487 if ( mProfileBox->count() == 0 )
456 return; 488 return;
457 if ( currentSelection < 3 ) { 489 if ( currentSelection < 3 ) {
458 //KMessageBox::error(this,i18n("This profil name\ncannot be edited!\n"),i18n("KO/Pi config error")); 490 //KMessageBox::error(this,i18n("This profil name\ncannot be edited!\n"),i18n("KO/Pi config error"));
459 mProfileBox->blockSignals( true ); 491 mProfileBox->blockSignals( true );
460 mProfileBox->setCurrentItem(mProfileBox-> currentItem ()); 492 mProfileBox->setCurrentItem(mProfileBox-> currentItem ());
461 mProfileBox->blockSignals( false ); 493 mProfileBox->blockSignals( false );
462 return; 494 return;
463 } 495 }
464 //qDebug("cur i %d ",mProfileBox-> currentItem () ); 496 //qDebug("cur i %d ",mProfileBox-> currentItem () );
465 mProfileBox->changeItem ( s, mProfileBox-> currentItem () ) ; 497 mProfileBox->changeItem ( s, mProfileBox-> currentItem () ) ;
466 KSyncProfile* prof = mSyncProfiles.at(mProfileBox-> currentItem ()) ; 498 KSyncProfile* prof = mSyncProfiles.at(mProfileBox-> currentItem ()) ;
467 prof->setName( s ); 499 prof->setName( s );
468 mSyncProfileNames[mProfileBox-> currentItem ()] = s; 500 mSyncProfileNames[mProfileBox-> currentItem ()] = s;
469} 501}
470void KSyncPrefsDialog::profileChanged( int item ) 502void KSyncPrefsDialog::profileChanged( int item )
471{ 503{
472 //qDebug("KSyncPrefsDialog::profileChanged before %d, count %d ", item, mProfileBox->count() ); 504 //qDebug("KSyncPrefsDialog::profileChanged before %d, count %d ", item, mProfileBox->count() );
473 KSyncProfile* prof; 505 KSyncProfile* prof;
474 saveProfile(); 506 saveProfile();
475 readFilter(); 507 readFilter();
508 readResources();
476 currentSelection = item; 509 currentSelection = item;
477 prof = mSyncProfiles.at(item) ; 510 prof = mSyncProfiles.at(item) ;
478 511
479 mRemotePw->setText(prof->getRemotePw()); 512 mRemotePw->setText(prof->getRemotePw());
480 mRemoteIP->setText(prof->getRemoteIP()); 513 mRemoteIP->setText(prof->getRemoteIP());
481 mRemotePort->setText(prof->getRemotePort()); 514 mRemotePort->setText(prof->getRemotePort());
482 515
483 mRemotePwAB->setText(prof->getRemotePwAB()); 516 mRemotePwAB->setText(prof->getRemotePwAB());
484 mRemoteIPAB->setText(prof->getRemoteIPAB()); 517 mRemoteIPAB->setText(prof->getRemoteIPAB());
485 mRemotePortAB->setText(prof->getRemotePortAB()); 518 mRemotePortAB->setText(prof->getRemotePortAB());
486 519
487 mRemotePwPWM->setText(prof->getRemotePwPWM()); 520 mRemotePwPWM->setText(prof->getRemotePwPWM());
488 mRemoteIPPWM->setText(prof->getRemoteIPPWM()); 521 mRemoteIPPWM->setText(prof->getRemoteIPPWM());
489 mRemotePortPWM->setText(prof->getRemotePortPWM()); 522 mRemotePortPWM->setText(prof->getRemotePortPWM());
490 523
491 mRemotePrecommand->setText(prof->getPreSyncCommand()); 524 mRemotePrecommand->setText(prof->getPreSyncCommand());
492 mRemotePostcommand->setText(prof->getPostSyncCommand()); 525 mRemotePostcommand->setText(prof->getPostSyncCommand());
493 mLocalTempFile->setText(prof->getLocalTempFile()); 526 mLocalTempFile->setText(prof->getLocalTempFile());
494 mRemoteFile->setText(prof->getRemoteFileName()) ; 527 mRemoteFile->setText(prof->getRemoteFileName()) ;
495 528
496 mRemotePrecommandAB->setText(prof->getPreSyncCommandAB()); 529 mRemotePrecommandAB->setText(prof->getPreSyncCommandAB());
497 mRemotePostcommandAB->setText(prof->getPostSyncCommandAB()); 530 mRemotePostcommandAB->setText(prof->getPostSyncCommandAB());
498 mLocalTempFileAB->setText(prof->getLocalTempFileAB()); 531 mLocalTempFileAB->setText(prof->getLocalTempFileAB());
499 mRemoteFileAB->setText(prof->getRemoteFileNameAB()) ; 532 mRemoteFileAB->setText(prof->getRemoteFileNameAB()) ;
500 533
501 mRemotePrecommandPWM->setText(prof->getPreSyncCommandPWM()); 534 mRemotePrecommandPWM->setText(prof->getPreSyncCommandPWM());
502 mRemotePostcommandPWM->setText(prof->getPostSyncCommandPWM()); 535 mRemotePostcommandPWM->setText(prof->getPostSyncCommandPWM());
503 mLocalTempFilePWM->setText(prof->getLocalTempFilePWM()); 536 mLocalTempFilePWM->setText(prof->getLocalTempFilePWM());
504 mRemoteFilePWM->setText(prof->getRemoteFileNamePWM()) ; 537 mRemoteFilePWM->setText(prof->getRemoteFileNamePWM()) ;
505 538
506 if ( mWriteContactToSIM ) 539 if ( mWriteContactToSIM )
507 mWriteContactToSIM->setChecked( prof->getWriteContactToSIM()); 540 mWriteContactToSIM->setChecked( prof->getWriteContactToSIM());
@@ -524,208 +557,237 @@ void KSyncPrefsDialog::profileChanged( int item )
524 mFilterOutCal->setCurrentItem( mFilterKopi.findIndex(prof->getFilterOutCal () ) + 1 ); 557 mFilterOutCal->setCurrentItem( mFilterKopi.findIndex(prof->getFilterOutCal () ) + 1 );
525 mFilterInAB->setCurrentItem( mFilterKapi.findIndex(prof->getFilterInAB () ) + 1 ); 558 mFilterInAB->setCurrentItem( mFilterKapi.findIndex(prof->getFilterInAB () ) + 1 );
526 mFilterOutAB->setCurrentItem( mFilterKapi.findIndex(prof->getFilterOutAB () ) + 1 ); 559 mFilterOutAB->setCurrentItem( mFilterKapi.findIndex(prof->getFilterOutAB () ) + 1 );
527 560
528 switch ( prof->getSyncPrefs() ) { 561 switch ( prof->getSyncPrefs() ) {
529 case 0: 562 case 0:
530 loc->setChecked( true); 563 loc->setChecked( true);
531 break; 564 break;
532 case 1: 565 case 1:
533 rem->setChecked( true ); 566 rem->setChecked( true );
534 break; 567 break;
535 case 2: 568 case 2:
536 newest->setChecked( true); 569 newest->setChecked( true);
537 break; 570 break;
538 case 3: 571 case 3:
539 ask->setChecked( true); 572 ask->setChecked( true);
540 break; 573 break;
541 case 4: 574 case 4:
542 f_loc->setChecked( true); 575 f_loc->setChecked( true);
543 break; 576 break;
544 case 5: 577 case 5:
545 f_rem->setChecked( true); 578 f_rem->setChecked( true);
546 break; 579 break;
547 case 6: 580 case 6:
548 //both->setChecked( true); 581 //both->setChecked( true);
549 break; 582 break;
550 default: 583 default:
551 break; 584 break;
552 } 585 }
553 mIsLocal->setChecked(prof->getIsLocalFileSync()) ; 586 mIsLocal->setChecked(prof->getIsLocalFileSync()) ;
554 mIsPhone->setChecked(prof->getIsPhoneSync()) ; 587 mIsPhone->setChecked(prof->getIsPhoneSync()) ;
555 mIsPi->setChecked(prof->getIsPiSync()) ; 588 mIsPi->setChecked(prof->getIsPiSync()) ;
589 mIsPiSpecific->setChecked(prof->getIsPiSyncSpec()) ;
556 mIsKapiFileL->setChecked(prof->getIsKapiFile()) ; 590 mIsKapiFileL->setChecked(prof->getIsKapiFile()) ;
557 mIsKapiFileR->setChecked(prof->getIsKapiFile()) ; 591 mIsKapiFileR->setChecked(prof->getIsKapiFile()) ;
558 592
559 mIsNotLocal->setChecked(!prof->getIsLocalFileSync() && !prof->getIsPhoneSync() &&!prof->getIsPiSync() ); 593
594 QStringList res = QStringList::split( ":",prof->getResSpecKopi());
595 int i;
596 for ( i = 0;i < res.count(); ++i ) {
597 mResTableKopi->setText( i, 0, res[i] );
598 }
599 res = QStringList::split( ":",prof->getResSpecKapi());
600 for ( i = 0;i < res.count(); ++i ) {
601 mResTableKapi->setText( i, 0, res[i] );
602 }
603 mIsNotLocal->setChecked(!prof->getIsLocalFileSync() && !prof->getIsPhoneSync() &&!prof->getIsPiSync() &&!prof->getIsPiSyncSpec());
560 proGr->setEnabled( item > 2 ); 604 proGr->setEnabled( item > 2 );
561 if ( item < 3 ) { 605 if ( item < 3 ) {
562 localFileWidget->hide(); 606 localFileWidget->hide();
563 remoteFileWidget->hide(); 607 remoteFileWidget->hide();
564 phoneWidget->hide(); 608 phoneWidget->hide();
565 piWidget->hide(); 609 piWidget->hide();
566 610
567 } else 611 } else
568 kindChanged( prof->getIsLocalFileSync() ); 612 kindChanged( prof->getIsLocalFileSync() );
569} 613}
570 614
571void KSyncPrefsDialog::fillSSH() 615void KSyncPrefsDialog::fillSSH()
572{ 616{
573 mRemotePrecommand->setText("scp zaurus@192.168.0.65:/home/zaurus/kdepim/apps/korganizer/mycalendar.ics /tmp/mycalendar.ics" ); 617 mRemotePrecommand->setText("scp zaurus@192.168.0.65:/home/zaurus/kdepim/apps/korganizer/mycalendar.ics /tmp/mycalendar.ics" );
574 mLocalTempFile->setText("/tmp/mycalendar.ics" ); 618 mLocalTempFile->setText("/tmp/mycalendar.ics" );
575 mRemotePostcommand->setText("scp /tmp/mycalendar.ics zaurus@192.168.0.65:/home/zaurus/kdepim/apps/korganizer/mycalendar.ics" ); 619 mRemotePostcommand->setText("scp /tmp/mycalendar.ics zaurus@192.168.0.65:/home/zaurus/kdepim/apps/korganizer/mycalendar.ics" );
576 mRemotePrecommandAB->setText("scp zaurus@192.168.0.65:/home/zaurus/kdepim/apps/kabc/std.vcf /tmp/std.vcf" ); 620 mRemotePrecommandAB->setText("scp zaurus@192.168.0.65:/home/zaurus/kdepim/apps/kabc/std.vcf /tmp/std.vcf" );
577 mLocalTempFileAB->setText("/tmp/std.vcf" ); 621 mLocalTempFileAB->setText("/tmp/std.vcf" );
578 mRemotePostcommandAB->setText("scp /tmp/std.vcf zaurus@192.168.0.65:/home/zaurus/kdepim/apps/kabc/std.vcf" ); 622 mRemotePostcommandAB->setText("scp /tmp/std.vcf zaurus@192.168.0.65:/home/zaurus/kdepim/apps/kabc/std.vcf" );
579 mRemotePrecommandPWM->setText("scp zaurus@192.168.0.65:/home/zaurus/kdepim/apps/pwmanager/passwords.pwm /tmp/passwords.pwm" ); 623 mRemotePrecommandPWM->setText("scp zaurus@192.168.0.65:/home/zaurus/kdepim/apps/pwmanager/passwords.pwm /tmp/passwords.pwm" );
580 mLocalTempFilePWM->setText("/tmp/passwords.pwm" ); 624 mLocalTempFilePWM->setText("/tmp/passwords.pwm" );
581 mRemotePostcommandPWM->setText("scp /tmp/passwords.pwm zaurus@192.168.0.65:/home/zaurus/kdepim/apps/pwmanager/pwmanager.pwm" ); 625 mRemotePostcommandPWM->setText("scp /tmp/passwords.pwm zaurus@192.168.0.65:/home/zaurus/kdepim/apps/pwmanager/pwmanager.pwm" );
582} 626}
583void KSyncPrefsDialog::fillFTP() 627void KSyncPrefsDialog::fillFTP()
584{ 628{
585 mRemotePrecommand->setText("cd /tmp;ftp ftp://zaurus:a@192.168.0.65/kdepim/apps/korganizer/mycalendar.ics" ); 629 mRemotePrecommand->setText("cd /tmp;ftp ftp://zaurus:a@192.168.0.65/kdepim/apps/korganizer/mycalendar.ics" );
586 mLocalTempFile->setText("/tmp/mycalendar.ics" ); 630 mLocalTempFile->setText("/tmp/mycalendar.ics" );
587 mRemotePostcommand->setText("ftp -u ftp://zaurus:a@192.168.0.65/kdepim/apps/korganizer/mycalendar.ics /tmp/mycalendar.ics" ); 631 mRemotePostcommand->setText("ftp -u ftp://zaurus:a@192.168.0.65/kdepim/apps/korganizer/mycalendar.ics /tmp/mycalendar.ics" );
588 mRemotePrecommandAB->setText("cd /tmp;ftp ftp://zaurus:a@192.168.0.65/kdepim/apps/kabc/std.vcf" ); 632 mRemotePrecommandAB->setText("cd /tmp;ftp ftp://zaurus:a@192.168.0.65/kdepim/apps/kabc/std.vcf" );
589 mLocalTempFileAB->setText("/tmp/std.vcf" ); 633 mLocalTempFileAB->setText("/tmp/std.vcf" );
590 mRemotePostcommandAB->setText("ftp -u ftp://zaurus:a@192.168.0.65/kdepim/apps/kabc/std.vcf /tmp/std.vcf" ); 634 mRemotePostcommandAB->setText("ftp -u ftp://zaurus:a@192.168.0.65/kdepim/apps/kabc/std.vcf /tmp/std.vcf" );
591 635
592 mRemotePrecommandPWM->setText("cd /tmp;ftp ftp://zaurus:a@192.168.0.65/kdepim/apps/pwmanager/passwords.pwm" ); 636 mRemotePrecommandPWM->setText("cd /tmp;ftp ftp://zaurus:a@192.168.0.65/kdepim/apps/pwmanager/passwords.pwm" );
593 mLocalTempFilePWM->setText("/tmp/passwords.pwm" ); 637 mLocalTempFilePWM->setText("/tmp/passwords.pwm" );
594 mRemotePostcommandPWM->setText("ftp -u ftp://zaurus:a@192.168.0.65/kdepim/apps/pwmanager/passwords.pwm /tmp/passwords.pwm" ); 638 mRemotePostcommandPWM->setText("ftp -u ftp://zaurus:a@192.168.0.65/kdepim/apps/pwmanager/passwords.pwm /tmp/passwords.pwm" );
595 639
596} 640}
597void KSyncPrefsDialog::kindChanged( bool b ) 641void KSyncPrefsDialog::kindChanged( bool b )
598{ 642{
599 643
600 if ( mIsLocal->isChecked () ) { 644 if ( mIsLocal->isChecked () ) {
601 mIsKapiFileL->setChecked( mIsKapiFileR->isChecked() ); 645 mIsKapiFileL->setChecked( mIsKapiFileR->isChecked() );
602 } else { 646 } else {
603 mIsKapiFileR->setChecked( mIsKapiFileL->isChecked() ); 647 mIsKapiFileR->setChecked( mIsKapiFileL->isChecked() );
604 } 648 }
605 649
606 if ( mIsLocal->isChecked () ) 650 if ( mIsLocal->isChecked () )
607 localFileWidget->show(); 651 localFileWidget->show();
608 else 652 else
609 localFileWidget->hide(); 653 localFileWidget->hide();
610 654
611 if ( mIsNotLocal->isChecked () ) 655 if ( mIsNotLocal->isChecked () )
612 remoteFileWidget->show(); 656 remoteFileWidget->show();
613 else 657 else
614 remoteFileWidget->hide(); 658 remoteFileWidget->hide();
615 659
616 if ( mIsPhone->isChecked () ) { 660 if ( mIsPhone->isChecked () ) {
617 phoneWidget->show(); 661 phoneWidget->show();
618 } 662 }
619 else { 663 else {
620 phoneWidget->hide(); 664 phoneWidget->hide();
621 } 665 }
622 if ( mIsPi->isChecked () ) { 666
667 if ( mIsPi->isChecked () || mIsPiSpecific->isChecked () ) {
623 piWidget->show(); 668 piWidget->show();
669 if (mIsPiSpecific->isChecked () ) {
670 mTableBox->show();
671 }
672 else {
673 mTableBox->hide();
674 }
624 } 675 }
625 else { 676 else {
626 piWidget->hide(); 677 piWidget->hide();
627 } 678 }
679
628 680
629} 681}
630void KSyncPrefsDialog::deleteProfile() 682void KSyncPrefsDialog::deleteProfile()
631{ 683{
632 //qDebug("KSyncPrefsDialog::deleteProfile() "); 684 //qDebug("KSyncPrefsDialog::deleteProfile() ");
633 if ( currentSelection >= 0 ) { 685 if ( currentSelection >= 0 ) {
634 if ( currentSelection < 3 ) { 686 if ( currentSelection < 3 ) {
635 KMessageBox::error(this,i18n("This profil cannot be deleted!\n"),i18n("KO/Pi config error")); 687 KMessageBox::error(this,i18n("This profil cannot be deleted!\n"),i18n("KO/Pi config error"));
636 return; 688 return;
637 } 689 }
638 KSyncProfile* temp = mSyncProfiles.at(currentSelection); 690 KSyncProfile* temp = mSyncProfiles.at(currentSelection);
639 mSyncProfiles.remove( temp ); 691 mSyncProfiles.remove( temp );
640 mSyncProfileNames.remove( mSyncProfileNames.at( currentSelection )); 692 mSyncProfileNames.remove( mSyncProfileNames.at( currentSelection ));
641 insertProfiles(); 693 insertProfiles();
642 } 694 }
643} 695}
644 696
645void KSyncPrefsDialog::saveProfile() 697void KSyncPrefsDialog::saveProfile()
646{ 698{
647 KSyncProfile* prof; 699 KSyncProfile* prof;
648 if ( currentSelection >= 0 ) { 700 if ( currentSelection >= 0 ) {
649 prof = mSyncProfiles.at(currentSelection) ; 701 prof = mSyncProfiles.at(currentSelection) ;
650 702
651 prof->setRemotePw( mRemotePw->text()); 703 prof->setRemotePw( mRemotePw->text());
652 prof->setRemoteIP( mRemoteIP->text()); 704 prof->setRemoteIP( mRemoteIP->text());
653 prof->setRemotePort( mRemotePort->text()); 705 prof->setRemotePort( mRemotePort->text());
654 706
655 prof->setRemotePwAB( mRemotePwAB->text()); 707 prof->setRemotePwAB( mRemotePwAB->text());
656 prof->setRemoteIPAB( mRemoteIPAB->text()); 708 prof->setRemoteIPAB( mRemoteIPAB->text());
657 prof->setRemotePortAB( mRemotePortAB->text()); 709 prof->setRemotePortAB( mRemotePortAB->text());
658 710
659 prof->setRemotePwPWM( mRemotePwPWM->text()); 711 prof->setRemotePwPWM( mRemotePwPWM->text());
660 prof->setRemoteIPPWM( mRemoteIPPWM->text()); 712 prof->setRemoteIPPWM( mRemoteIPPWM->text());
661 prof->setRemotePortPWM( mRemotePortPWM->text()); 713 prof->setRemotePortPWM( mRemotePortPWM->text());
662 714
663 prof->setPreSyncCommand( mRemotePrecommand->text()); 715 prof->setPreSyncCommand( mRemotePrecommand->text());
664 prof->setPostSyncCommand( mRemotePostcommand->text() ); 716 prof->setPostSyncCommand( mRemotePostcommand->text() );
665 prof->setLocalTempFile( mLocalTempFile->text()); 717 prof->setLocalTempFile( mLocalTempFile->text());
666 prof->setRemoteFileName( mRemoteFile->text() ); 718 prof->setRemoteFileName( mRemoteFile->text() );
667 prof->setPreSyncCommandAB( mRemotePrecommandAB->text()); 719 prof->setPreSyncCommandAB( mRemotePrecommandAB->text());
668 prof->setPostSyncCommandAB( mRemotePostcommandAB->text() ); 720 prof->setPostSyncCommandAB( mRemotePostcommandAB->text() );
669 prof->setLocalTempFileAB( mLocalTempFileAB->text()); 721 prof->setLocalTempFileAB( mLocalTempFileAB->text());
670 prof->setRemoteFileNameAB( mRemoteFileAB->text() ); 722 prof->setRemoteFileNameAB( mRemoteFileAB->text() );
671 prof->setPreSyncCommandPWM( mRemotePrecommandPWM->text()); 723 prof->setPreSyncCommandPWM( mRemotePrecommandPWM->text());
672 prof->setPostSyncCommandPWM( mRemotePostcommandPWM->text() ); 724 prof->setPostSyncCommandPWM( mRemotePostcommandPWM->text() );
673 prof->setLocalTempFilePWM( mLocalTempFilePWM->text()); 725 prof->setLocalTempFilePWM( mLocalTempFilePWM->text());
674 prof->setRemoteFileNamePWM( mRemoteFilePWM->text() ); 726 prof->setRemoteFileNamePWM( mRemoteFilePWM->text() );
675 prof->setShowSummaryAfterSync( mShowSummaryAfterSync->isChecked() ); 727 prof->setShowSummaryAfterSync( mShowSummaryAfterSync->isChecked() );
676 prof->setAskForPreferences( mAskForPreferences->isChecked()); 728 prof->setAskForPreferences( mAskForPreferences->isChecked());
677 prof->setWriteBackExisting(mWriteBackExisting->isChecked() ); 729 prof->setWriteBackExisting(mWriteBackExisting->isChecked() );
678 prof->setWriteBackFile( mWriteBackFile->isChecked()); 730 prof->setWriteBackFile( mWriteBackFile->isChecked());
679 prof->setIncludeInRingSync( mIncludeInRing->isChecked() ); 731 prof->setIncludeInRingSync( mIncludeInRing->isChecked() );
680 prof->setIncludeInRingSyncAB( mIncludeInRingAB->isChecked() ); 732 prof->setIncludeInRingSyncAB( mIncludeInRingAB->isChecked() );
681 prof->setIncludeInRingSyncPWM( mIncludeInRingPWM->isChecked() ); 733 prof->setIncludeInRingSyncPWM( mIncludeInRingPWM->isChecked() );
682 int syncprefs = rem->isChecked()*1+newest->isChecked()*2+ ask->isChecked()*3+ f_loc->isChecked()*4+ f_rem->isChecked()*5 ;//+ both->isChecked()*6 ; 734 int syncprefs = rem->isChecked()*1+newest->isChecked()*2+ ask->isChecked()*3+ f_loc->isChecked()*4+ f_rem->isChecked()*5 ;//+ both->isChecked()*6 ;
683 prof->setSyncPrefs( syncprefs); 735 prof->setSyncPrefs( syncprefs);
684 prof->setIsLocalFileSync( mIsLocal->isChecked() ); 736 prof->setIsLocalFileSync( mIsLocal->isChecked() );
685 prof->setIsPhoneSync( mIsPhone->isChecked() ); 737 prof->setIsPhoneSync( mIsPhone->isChecked() );
686 prof->setIsPiSync( mIsPi->isChecked() ); 738 prof->setIsPiSync( mIsPi->isChecked() );
739 prof->setIsPiSyncSpec( mIsPiSpecific->isChecked() );
687 prof->setIsKapiFile( mIsKapiFileL->isChecked() ); 740 prof->setIsKapiFile( mIsKapiFileL->isChecked() );
688 prof->setWriteBackFuture(mWriteBackFuture->isChecked()); 741 prof->setWriteBackFuture(mWriteBackFuture->isChecked());
689 prof->setWriteBackFutureWeeks(mWriteBackFutureWeeks->value()); 742 prof->setWriteBackFutureWeeks(mWriteBackFutureWeeks->value());
690 prof->setWriteBackPastWeeks(mWriteBackPastWeeks->value()); 743 prof->setWriteBackPastWeeks(mWriteBackPastWeeks->value());
691 if ( mWriteContactToSIM ) 744 if ( mWriteContactToSIM )
692 prof->setWriteContactToSIM(mWriteContactToSIM->isChecked()); 745 prof->setWriteContactToSIM(mWriteContactToSIM->isChecked());
693 prof->setPhoneDevice( mPhoneDevice->text() ); 746 prof->setPhoneDevice( mPhoneDevice->text() );
694 prof->setPhoneConnection( mPhoneConnection->text() ); 747 prof->setPhoneConnection( mPhoneConnection->text() );
695 prof->setPhoneModel( mPhoneModel->text() ); 748 prof->setPhoneModel( mPhoneModel->text() );
696 prof->setFilterInCal ( mFilterInCal->currentText ()); 749 prof->setFilterInCal ( mFilterInCal->currentText ());
697 prof->setFilterOutCal ( mFilterOutCal ->currentText ()); 750 prof->setFilterOutCal ( mFilterOutCal ->currentText ());
698 prof->setFilterInAB ( mFilterInAB ->currentText ()); 751 prof->setFilterInAB ( mFilterInAB ->currentText ());
699 prof->setFilterOutAB ( mFilterOutAB ->currentText ()); 752 prof->setFilterOutAB ( mFilterOutAB ->currentText ());
753 if ( mIsPiSpecific->isChecked() ) {
754
755 QStringList res;
756 int i;
757 for ( i = 0;i < mResourcesKopi.count(); ++i ) {
758 res.append( mResTableKopi->text( i, 0 ));
759 }
760 prof->setResSpecKopi( res.join(":"));
761 }
700 } 762 }
701} 763}
702 764
703void KSyncPrefsDialog::insertProfiles() 765void KSyncPrefsDialog::insertProfiles()
704{ 766{
705 int curItem = mProfileBox->currentItem(); 767 int curItem = mProfileBox->currentItem();
706 mProfileBox->blockSignals( true ); 768 mProfileBox->blockSignals( true );
707 mProfileBox->clear(); 769 mProfileBox->clear();
708 mProfileBox->insertStringList (mSyncProfileNames ); 770 mProfileBox->insertStringList (mSyncProfileNames );
709 int item = mSyncProfileNames.count() -1; 771 int item = mSyncProfileNames.count() -1;
710 if ( curItem >= 0 && mSyncProfileNames.count() > 0 && curItem < mSyncProfileNames.count() ) 772 if ( curItem >= 0 && mSyncProfileNames.count() > 0 && curItem < mSyncProfileNames.count() )
711 mProfileBox->setCurrentItem( curItem ); 773 mProfileBox->setCurrentItem( curItem );
712 else if ( item >= 0 ) { 774 else if ( item >= 0 ) {
713 mProfileBox->setCurrentItem( item ); 775 mProfileBox->setCurrentItem( item );
714 } 776 }
715 currentSelection = -1; 777 currentSelection = -1;
716 if ( mSyncProfileNames.count() > 0 ) { 778 if ( mSyncProfileNames.count() > 0 ) {
717 //qDebug(" profileChanged( mProfileBox->currentItem() "); 779 //qDebug(" profileChanged( mProfileBox->currentItem() ");
718 profileChanged( mProfileBox->currentItem() ); 780 profileChanged( mProfileBox->currentItem() );
719 currentSelection = mProfileBox->currentItem(); 781 currentSelection = mProfileBox->currentItem();
720 } 782 }
721 mProfileBox->blockSignals( false ); 783 mProfileBox->blockSignals( false );
722} 784}
723 785
724void KSyncPrefsDialog::addProfile ( KSyncProfile* temp ) 786void KSyncPrefsDialog::addProfile ( KSyncProfile* temp )
725{ 787{
726 saveProfile(); 788 saveProfile();
727 mSyncProfiles.append( temp ); 789 mSyncProfiles.append( temp );
728 mSyncProfileNames << temp->getName(); 790 mSyncProfileNames << temp->getName();
729 insertProfiles(); 791 insertProfiles();
730 int last = mProfileBox->count() -1; 792 int last = mProfileBox->count() -1;
731 mProfileBox->blockSignals( true ); 793 mProfileBox->blockSignals( true );