summaryrefslogtreecommitdiffabout
path: root/libkdepim/ksyncprefsdialog.cpp
Unidiff
Diffstat (limited to 'libkdepim/ksyncprefsdialog.cpp') (more/less context) (ignore whitespace changes)
-rw-r--r--libkdepim/ksyncprefsdialog.cpp45
1 files changed, 42 insertions, 3 deletions
diff --git a/libkdepim/ksyncprefsdialog.cpp b/libkdepim/ksyncprefsdialog.cpp
index 8a3f4cf..6e42fd4 100644
--- a/libkdepim/ksyncprefsdialog.cpp
+++ b/libkdepim/ksyncprefsdialog.cpp
@@ -150,67 +150,86 @@ void KSyncPrefsDialog::setupSyncAlgTab()
150 mIncludeInRing = new QCheckBox( i18n("calendar "), iims ); 150 mIncludeInRing = new QCheckBox( i18n("calendar "), iims );
151 mIncludeInRingAB = new QCheckBox( i18n("addressbook "), iims ); 151 mIncludeInRingAB = new QCheckBox( i18n("addressbook "), iims );
152 mIncludeInRingPWM = new QCheckBox( i18n("pwmanager"), iims ); 152 mIncludeInRingPWM = new QCheckBox( i18n("pwmanager"), iims );
153 new QLabel( i18n(" sync"), iims ); 153 new QLabel( i18n(" sync"), iims );
154 topLayout->addMultiCellWidget(iims, iii,iii,0,1); 154 topLayout->addMultiCellWidget(iims, iii,iii,0,1);
155 ++iii; 155 ++iii;
156 QVGroupBox* gb0 = new QVGroupBox( i18n("Sync algo options"), topFrame); 156 QVGroupBox* gb0 = new QVGroupBox( i18n("Sync algo options"), topFrame);
157 topLayout->addMultiCellWidget(gb0, iii,iii,0,1); 157 topLayout->addMultiCellWidget(gb0, iii,iii,0,1);
158 ++iii; 158 ++iii;
159 QButtonGroup* gr; 159 QButtonGroup* gr;
160 { 160 {
161 QVGroupBox* topFrame = gb0; 161 QVGroupBox* topFrame = gb0;
162
163
164
162 mAskForPreferences = new QCheckBox( i18n("Ask for preferences before sync"), topFrame ); 165 mAskForPreferences = new QCheckBox( i18n("Ask for preferences before sync"), topFrame );
163 //topLayout->addMultiCellWidget(mAskForPreferences, iii,iii,0,1); 166 //topLayout->addMultiCellWidget(mAskForPreferences, iii,iii,0,1);
164 //++iii; 167 //++iii;
165 gr = new QButtonGroup ( 1, Qt::Horizontal, i18n("Sync preferences"), topFrame); 168 gr = new QButtonGroup ( 1, Qt::Horizontal, i18n("Sync preferences"), topFrame);
166 //topLayout->addMultiCellWidget(gr, iii,iii,0,1); 169 //topLayout->addMultiCellWidget(gr, iii,iii,0,1);
167 //++iii; 170 //++iii;
168 loc = new QRadioButton ( i18n("Take local entry on conflict"), gr ); 171 loc = new QRadioButton ( i18n("Take local entry on conflict"), gr );
169 rem = new QRadioButton ( i18n("Take remote entry on conflict"), gr ); 172 rem = new QRadioButton ( i18n("Take remote entry on conflict"), gr );
170 newest = new QRadioButton ( i18n("Take newest entry on conflict"), gr ); 173 newest = new QRadioButton ( i18n("Take newest entry on conflict"), gr );
171 ask = new QRadioButton ( i18n("Ask for every entry on conflict"), gr ); 174 ask = new QRadioButton ( i18n("Ask for every entry on conflict"), gr );
172 f_loc= new QRadioButton ( i18n("Force: Take local entry always"), gr ); 175 f_loc= new QRadioButton ( i18n("Force: Take local entry always"), gr );
173 f_rem = new QRadioButton ( i18n("Force: Take remote entry always"), gr ); 176 f_rem = new QRadioButton ( i18n("Force: Take remote entry always"), gr );
174 // both = new QRadioButton ( i18n("Take both on conflict"), gr ); 177 // both = new QRadioButton ( i18n("Take both on conflict"), gr );
175 178
176 mShowSummaryAfterSync = new QCheckBox( i18n("Show summary after sync"), topFrame ); 179 mShowSummaryAfterSync = new QCheckBox( i18n("Show summary after sync"), topFrame );
177 //topLayout->addMultiCellWidget(mShowSummaryAfterSync, iii,iii,0,1); 180 //topLayout->addMultiCellWidget(mShowSummaryAfterSync, iii,iii,0,1);
178 //++iii; 181 //++iii;
179 182
183 QHGroupBox* gb5 = new QHGroupBox( i18n("Apply filter when adding data to local:"), topFrame);
184 QVBox * fibo2 = new QVBox ( gb5 );
185 new QLabel ( i18n("Incoming calendar filter:"), fibo2 );
186 mFilterInCal = new QComboBox( fibo2 );
187 fibo2 = new QVBox ( gb5 );
188 new QLabel ( i18n("Incoming adressbook filter:"), fibo2 );
189 mFilterInAB = new QComboBox( fibo2 );
190
180 mWriteBackFile = new QCheckBox( i18n("Write back synced data"), topFrame ); 191 mWriteBackFile = new QCheckBox( i18n("Write back synced data"), topFrame );
181 // topLayout->addMultiCellWidget(mWriteBackFile, iii,iii,0,1); 192 // topLayout->addMultiCellWidget(mWriteBackFile, iii,iii,0,1);
182 // ++iii; 193 // ++iii;
183 194
184 QVGroupBox* gb2 = new QVGroupBox( i18n("Write back options"), topFrame); 195 QVGroupBox* gb2 = new QVGroupBox( i18n("Write back options"), topFrame);
185 //topLayout->addMultiCellWidget(gb2, iii,iii,0,1); 196 //topLayout->addMultiCellWidget(gb2, iii,iii,0,1);
186 //++iii; 197 //++iii;
187 { 198 {
188 QVGroupBox*topFrame = gb2; 199 QVGroupBox*topFrame = gb2;
189 mWriteBackExisting= new QCheckBox( i18n("Write back (on remote) existing entries only"), topFrame ); 200 mWriteBackExisting= new QCheckBox( i18n("Write back (on remote) existing entries only"), topFrame );
201 QHGroupBox* gb4 = new QHGroupBox( i18n("Apply filter when adding data to remote:"), topFrame);
202 QVBox * fibo = new QVBox ( gb4 );
203 new QLabel ( i18n("Outgoing calendar filter:"), fibo );
204 mFilterOutCal = new QComboBox( fibo );
205 fibo = new QVBox ( gb4 );
206 new QLabel ( i18n("Outgoing addressbook filter:"), fibo );
207 mFilterOutAB = new QComboBox( fibo );
190 //topLayout->addMultiCellWidget(mWriteBackExisting, iii,iii,0,1); 208 //topLayout->addMultiCellWidget(mWriteBackExisting, iii,iii,0,1);
191 //++iii; 209 //++iii;
192 mWriteBackFuture= new QCheckBox( i18n("Write back (calendar) entries for time period only"), topFrame ); 210 mWriteBackFuture= new QCheckBox( i18n("Write back (calendar) entries for time period only"), topFrame );
193 //topLayout->addMultiCellWidget(mWriteBackFuture, iii,iii,0,1); 211 //topLayout->addMultiCellWidget(mWriteBackFuture, iii,iii,0,1);
194 //++iii; 212 //++iii;
195 QHGroupBox* gb3 = new QHGroupBox( i18n("Time period"), topFrame); 213 QHGroupBox* gb3 = new QHGroupBox( i18n("Time period"), topFrame);
196 connect ( mWriteBackFuture, SIGNAL( toggled ( bool ) ), gb3, SLOT ( setEnabled ( bool ) ) ); 214 connect ( mWriteBackFuture, SIGNAL( toggled ( bool ) ), gb3, SLOT ( setEnabled ( bool ) ) );
197 new QLabel( i18n("From ") , gb3 ); 215 new QLabel( i18n("From ") , gb3 );
198 mWriteBackPastWeeks= new QSpinBox(1,104, 1, gb3); 216 mWriteBackPastWeeks= new QSpinBox(1,104, 1, gb3);
199 new QLabel( i18n(" weeks in the past to ") , gb3 ); 217 new QLabel( i18n(" weeks in the past to ") , gb3 );
200 mWriteBackFutureWeeks= new QSpinBox(1,104, 1, gb3); 218 mWriteBackFutureWeeks= new QSpinBox(1,104, 1, gb3);
201 new QLabel( i18n(" weeks in the future ") , gb3 ); 219 new QLabel( i18n(" weeks in the future ") , gb3 );
202 //topLayout->addMultiCellWidget(mWriteBackFutureWeeks, iii,iii,1,1); 220 //topLayout->addMultiCellWidget(mWriteBackFutureWeeks, iii,iii,1,1);
203 //++iii; 221 //++iii;
204 gb3->setEnabled( false ); 222 gb3->setEnabled( false );
223 connect ( mWriteBackExisting, SIGNAL( toggled ( bool ) ), gb4, SLOT ( setDisabled ( bool ) ) );
205 } 224 }
206 connect ( mWriteBackFile, SIGNAL( toggled ( bool ) ), gb2, SLOT ( setEnabled ( bool ) ) ); 225 connect ( mWriteBackFile, SIGNAL( toggled ( bool ) ), gb2, SLOT ( setEnabled ( bool ) ) );
207 226
208 } 227 }
209 proGr = new QButtonGroup ( 1, Qt::Horizontal, i18n("Profile kind"), topFrame); 228 proGr = new QButtonGroup ( 1, Qt::Horizontal, i18n("Profile kind"), topFrame);
210 gr = proGr; 229 gr = proGr;
211 topLayout->addMultiCellWidget(gr, iii,iii,0,1); 230 topLayout->addMultiCellWidget(gr, iii,iii,0,1);
212 ++iii; 231 ++iii;
213 mIsLocal = new QRadioButton ( i18n("Local file"), gr ); 232 mIsLocal = new QRadioButton ( i18n("Local file"), gr );
214 mIsPi = new QRadioButton ( i18n("Pi-Sync ( direct Kx/Pi to Kx/Pi sync )"), gr ); 233 mIsPi = new QRadioButton ( i18n("Pi-Sync ( direct Kx/Pi to Kx/Pi sync )"), gr );
215 connect (mIsPi, SIGNAL( toggled(bool)), this, SLOT (kindChanged(bool) ) ); 234 connect (mIsPi, SIGNAL( toggled(bool)), this, SLOT (kindChanged(bool) ) );
216 mIsNotLocal = new QRadioButton ( i18n("Remote file (w down/upload command)"), gr ); 235 mIsNotLocal = new QRadioButton ( i18n("Remote file (w down/upload command)"), gr );
@@ -345,25 +364,37 @@ void KSyncPrefsDialog::setupSyncAlgTab()
345 364
346 365
347void KSyncPrefsDialog::readFilter() 366void KSyncPrefsDialog::readFilter()
348{ 367{
349 mFilterKapi.clear(); 368 mFilterKapi.clear();
350 mFilterKopi.clear(); 369 mFilterKopi.clear();
351 mFilterKopi.append(i18n("No Filter") ); 370 mFilterKopi.append(i18n("No Filter") );
352 mFilterKapi.append(i18n("No Filter") ); 371 mFilterKapi.append(i18n("No Filter") );
353 KConfig cfgko(locateLocal("config","korganizerrc")); 372 KConfig cfgko(locateLocal("config","korganizerrc"));
354 KConfig cfgka(locateLocal("config","kaddressbookrc")); 373 KConfig cfgka(locateLocal("config","kaddressbookrc"));
355 cfgko.setGroup("General"); 374 cfgko.setGroup("General");
356 mFilterKopi = cfgko.readListEntry("CalendarFilters"); 375 mFilterKopi = cfgko.readListEntry("CalendarFilters");
357 mFilterKopi.prepend(i18n("No Filter") ); 376 mFilterKapi = mFilterKopi;
377 mFilterOutCal->clear();
378 mFilterInCal->clear();
379 mFilterOutAB->clear();
380 mFilterInAB->clear();
381 QStringList temp = mFilterKopi;
382 temp.prepend(i18n("No Filter") );
383 mFilterOutCal->insertStringList( temp );
384 mFilterInCal->insertStringList( temp );
385 temp = mFilterKapi;
386 temp.prepend(i18n("No Filter") );
387 mFilterOutAB->insertStringList( temp );
388 mFilterInAB->insertStringList( temp );
358} 389}
359 390
360 391
361void KSyncPrefsDialog::slotOK() 392void KSyncPrefsDialog::slotOK()
362{ 393{
363 if ( mMyMachineName->text() == "undefined" ) { 394 if ( mMyMachineName->text() == "undefined" ) {
364 KMessageBox::error(this,i18n("Local device name undefined!\nPlease define device name!"),i18n("KO/Pi config error")); 395 KMessageBox::error(this,i18n("Local device name undefined!\nPlease define device name!"),i18n("KO/Pi config error"));
365 return; 396 return;
366 } 397 }
367 int i; 398 int i;
368 for (i = 0; i < mSyncProfileNames.count(); ++ i) { 399 for (i = 0; i < mSyncProfileNames.count(); ++ i) {
369 if ( mSyncProfileNames.contains( mSyncProfileNames[i]) > 1 ) { 400 if ( mSyncProfileNames.contains( mSyncProfileNames[i]) > 1 ) {
@@ -421,24 +452,25 @@ void KSyncPrefsDialog::textChanged( const QString & s )
421 } 452 }
422 //qDebug("cur i %d ",mProfileBox-> currentItem () ); 453 //qDebug("cur i %d ",mProfileBox-> currentItem () );
423 mProfileBox->changeItem ( s, mProfileBox-> currentItem () ) ; 454 mProfileBox->changeItem ( s, mProfileBox-> currentItem () ) ;
424 KSyncProfile* prof = mSyncProfiles.at(mProfileBox-> currentItem ()) ; 455 KSyncProfile* prof = mSyncProfiles.at(mProfileBox-> currentItem ()) ;
425 prof->setName( s ); 456 prof->setName( s );
426 mSyncProfileNames[mProfileBox-> currentItem ()] = s; 457 mSyncProfileNames[mProfileBox-> currentItem ()] = s;
427} 458}
428void KSyncPrefsDialog::profileChanged( int item ) 459void KSyncPrefsDialog::profileChanged( int item )
429{ 460{
430 //qDebug("KSyncPrefsDialog::profileChanged before %d, count %d ", item, mProfileBox->count() ); 461 //qDebug("KSyncPrefsDialog::profileChanged before %d, count %d ", item, mProfileBox->count() );
431 KSyncProfile* prof; 462 KSyncProfile* prof;
432 saveProfile(); 463 saveProfile();
464 readFilter();
433 currentSelection = item; 465 currentSelection = item;
434 prof = mSyncProfiles.at(item) ; 466 prof = mSyncProfiles.at(item) ;
435 467
436 mRemotePw->setText(prof->getRemotePw()); 468 mRemotePw->setText(prof->getRemotePw());
437 mRemoteIP->setText(prof->getRemoteIP()); 469 mRemoteIP->setText(prof->getRemoteIP());
438 mRemotePort->setText(prof->getRemotePort()); 470 mRemotePort->setText(prof->getRemotePort());
439 471
440 mRemotePwAB->setText(prof->getRemotePwAB()); 472 mRemotePwAB->setText(prof->getRemotePwAB());
441 mRemoteIPAB->setText(prof->getRemoteIPAB()); 473 mRemoteIPAB->setText(prof->getRemoteIPAB());
442 mRemotePortAB->setText(prof->getRemotePortAB()); 474 mRemotePortAB->setText(prof->getRemotePortAB());
443 475
444 mRemotePwPWM->setText(prof->getRemotePwPWM()); 476 mRemotePwPWM->setText(prof->getRemotePwPWM());
@@ -467,24 +499,29 @@ void KSyncPrefsDialog::profileChanged( int item )
467 mPhoneModel->setText(prof->getPhoneModel()); 499 mPhoneModel->setText(prof->getPhoneModel());
468 500
469 mShowSummaryAfterSync->setChecked( prof->getShowSummaryAfterSync()); 501 mShowSummaryAfterSync->setChecked( prof->getShowSummaryAfterSync());
470 mAskForPreferences->setChecked( prof->getAskForPreferences()); 502 mAskForPreferences->setChecked( prof->getAskForPreferences());
471 mWriteBackExisting->setChecked( prof->getWriteBackExisting() ); 503 mWriteBackExisting->setChecked( prof->getWriteBackExisting() );
472 mWriteBackFile->setChecked( prof->getWriteBackFile()); 504 mWriteBackFile->setChecked( prof->getWriteBackFile());
473 mIncludeInRing->setChecked( prof->getIncludeInRingSync() ); 505 mIncludeInRing->setChecked( prof->getIncludeInRingSync() );
474 mIncludeInRingAB->setChecked( prof->getIncludeInRingSyncAB() ); 506 mIncludeInRingAB->setChecked( prof->getIncludeInRingSyncAB() );
475 mIncludeInRingPWM->setChecked( prof->getIncludeInRingSyncPWM() ); 507 mIncludeInRingPWM->setChecked( prof->getIncludeInRingSyncPWM() );
476 mWriteBackFuture->setChecked( prof->getWriteBackFuture()); 508 mWriteBackFuture->setChecked( prof->getWriteBackFuture());
477 mWriteBackFutureWeeks->setValue( prof->getWriteBackFutureWeeks() ); 509 mWriteBackFutureWeeks->setValue( prof->getWriteBackFutureWeeks() );
478 mWriteBackPastWeeks->setValue( prof->getWriteBackPastWeeks() ); 510 mWriteBackPastWeeks->setValue( prof->getWriteBackPastWeeks() );
511
512 mFilterInCal->setCurrentItem( mFilterKopi.findIndex(prof->getFilterInCal () ) + 1 );
513 mFilterOutCal->setCurrentItem( mFilterKopi.findIndex(prof->getFilterOutCal () ) + 1 );
514 mFilterInAB->setCurrentItem( mFilterKapi.findIndex(prof->getFilterInAB () ) + 1 );
515 mFilterOutAB->setCurrentItem( mFilterKapi.findIndex(prof->getFilterOutAB () ) + 1 );
479 516
480 switch ( prof->getSyncPrefs() ) { 517 switch ( prof->getSyncPrefs() ) {
481 case 0: 518 case 0:
482 loc->setChecked( true); 519 loc->setChecked( true);
483 break; 520 break;
484 case 1: 521 case 1:
485 rem->setChecked( true ); 522 rem->setChecked( true );
486 break; 523 break;
487 case 2: 524 case 2:
488 newest->setChecked( true); 525 newest->setChecked( true);
489 break; 526 break;
490 case 3: 527 case 3:
@@ -636,27 +673,29 @@ void KSyncPrefsDialog::saveProfile()
636 prof->setIsLocalFileSync( mIsLocal->isChecked() ); 673 prof->setIsLocalFileSync( mIsLocal->isChecked() );
637 prof->setIsPhoneSync( mIsPhone->isChecked() ); 674 prof->setIsPhoneSync( mIsPhone->isChecked() );
638 prof->setIsPiSync( mIsPi->isChecked() ); 675 prof->setIsPiSync( mIsPi->isChecked() );
639 prof->setIsKapiFile( mIsKapiFileL->isChecked() ); 676 prof->setIsKapiFile( mIsKapiFileL->isChecked() );
640 prof->setWriteBackFuture(mWriteBackFuture->isChecked()); 677 prof->setWriteBackFuture(mWriteBackFuture->isChecked());
641 prof->setWriteBackFutureWeeks(mWriteBackFutureWeeks->value()); 678 prof->setWriteBackFutureWeeks(mWriteBackFutureWeeks->value());
642 prof->setWriteBackPastWeeks(mWriteBackPastWeeks->value()); 679 prof->setWriteBackPastWeeks(mWriteBackPastWeeks->value());
643 if ( mWriteContactToSIM ) 680 if ( mWriteContactToSIM )
644 prof->setWriteContactToSIM(mWriteContactToSIM->isChecked()); 681 prof->setWriteContactToSIM(mWriteContactToSIM->isChecked());
645 prof->setPhoneDevice( mPhoneDevice->text() ); 682 prof->setPhoneDevice( mPhoneDevice->text() );
646 prof->setPhoneConnection( mPhoneConnection->text() ); 683 prof->setPhoneConnection( mPhoneConnection->text() );
647 prof->setPhoneModel( mPhoneModel->text() ); 684 prof->setPhoneModel( mPhoneModel->text() );
648 685 prof->setFilterInCal ( mFilterInCal->currentText ());
686 prof->setFilterOutCal ( mFilterOutCal ->currentText ());
687 prof->setFilterInAB ( mFilterInAB ->currentText ());
688 prof->setFilterOutAB ( mFilterOutAB ->currentText ());
649 } 689 }
650
651} 690}
652 691
653void KSyncPrefsDialog::insertProfiles() 692void KSyncPrefsDialog::insertProfiles()
654{ 693{
655 int curItem = mProfileBox->currentItem(); 694 int curItem = mProfileBox->currentItem();
656 mProfileBox->blockSignals( true ); 695 mProfileBox->blockSignals( true );
657 mProfileBox->clear(); 696 mProfileBox->clear();
658 mProfileBox->insertStringList (mSyncProfileNames ); 697 mProfileBox->insertStringList (mSyncProfileNames );
659 int item = mSyncProfileNames.count() -1; 698 int item = mSyncProfileNames.count() -1;
660 if ( curItem >= 0 && mSyncProfileNames.count() > 0 && curItem < mSyncProfileNames.count() ) 699 if ( curItem >= 0 && mSyncProfileNames.count() > 0 && curItem < mSyncProfileNames.count() )
661 mProfileBox->setCurrentItem( curItem ); 700 mProfileBox->setCurrentItem( curItem );
662 else if ( item >= 0 ) { 701 else if ( item >= 0 ) {