summaryrefslogtreecommitdiffabout
path: root/libkdepim/ksyncprefsdialog.cpp
Unidiff
Diffstat (limited to 'libkdepim/ksyncprefsdialog.cpp') (more/less context) (ignore whitespace changes)
-rw-r--r--libkdepim/ksyncprefsdialog.cpp6
1 files changed, 5 insertions, 1 deletions
diff --git a/libkdepim/ksyncprefsdialog.cpp b/libkdepim/ksyncprefsdialog.cpp
index 857ceac..a1eebec 100644
--- a/libkdepim/ksyncprefsdialog.cpp
+++ b/libkdepim/ksyncprefsdialog.cpp
@@ -165,65 +165,66 @@ void KSyncPrefsDialog::setupSyncAlgTab()
165 topLayout->addMultiCellWidget(mShowSummaryAfterSync, iii,iii,0,1); 165 topLayout->addMultiCellWidget(mShowSummaryAfterSync, iii,iii,0,1);
166 ++iii; 166 ++iii;
167 167
168 mWriteBackFile = new QCheckBox( i18n("Write back synced data"), topFrame ); 168 mWriteBackFile = new QCheckBox( i18n("Write back synced data"), topFrame );
169 topLayout->addMultiCellWidget(mWriteBackFile, iii,iii,0,1); 169 topLayout->addMultiCellWidget(mWriteBackFile, iii,iii,0,1);
170 ++iii; 170 ++iii;
171 171
172 mWriteBackExisting= new QCheckBox( i18n("-- Write back (on remote) existing entries only"), topFrame ); 172 mWriteBackExisting= new QCheckBox( i18n("-- Write back (on remote) existing entries only"), topFrame );
173 topLayout->addMultiCellWidget(mWriteBackExisting, iii,iii,0,1); 173 topLayout->addMultiCellWidget(mWriteBackExisting, iii,iii,0,1);
174 ++iii; 174 ++iii;
175 175
176 mWriteBackFuture= new QCheckBox( i18n("-- Write back (calendar) entries in future only"), topFrame ); 176 mWriteBackFuture= new QCheckBox( i18n("-- Write back (calendar) entries in future only"), topFrame );
177 topLayout->addMultiCellWidget(mWriteBackFuture, iii,iii,0,1); 177 topLayout->addMultiCellWidget(mWriteBackFuture, iii,iii,0,1);
178 ++iii; 178 ++iii;
179 topLayout->addMultiCellWidget(new QLabel( i18n("---- Max. weeks in future: ") , topFrame ), iii,iii,0,0); 179 topLayout->addMultiCellWidget(new QLabel( i18n("---- Max. weeks in future: ") , topFrame ), iii,iii,0,0);
180 mWriteBackFutureWeeks= new QSpinBox(1,104, 1, topFrame); 180 mWriteBackFutureWeeks= new QSpinBox(1,104, 1, topFrame);
181 topLayout->addMultiCellWidget(mWriteBackFutureWeeks, iii,iii,1,1); 181 topLayout->addMultiCellWidget(mWriteBackFutureWeeks, iii,iii,1,1);
182 ++iii; 182 ++iii;
183 183
184 proGr = new QButtonGroup ( 1, Qt::Horizontal, i18n("Profile kind"), topFrame); 184 proGr = new QButtonGroup ( 1, Qt::Horizontal, i18n("Profile kind"), topFrame);
185 gr = proGr; 185 gr = proGr;
186 topLayout->addMultiCellWidget(gr, iii,iii,0,1); 186 topLayout->addMultiCellWidget(gr, iii,iii,0,1);
187 ++iii; 187 ++iii;
188 mIsLocal = new QRadioButton ( i18n("Local file"), gr ); 188 mIsLocal = new QRadioButton ( i18n("Local file"), gr );
189 mIsNotLocal = new QRadioButton ( i18n("Remote file (w down/upload command)"), gr ); 189 mIsNotLocal = new QRadioButton ( i18n("Remote file (w down/upload command)"), gr );
190 connect (mIsLocal, SIGNAL( toggled(bool)), this, SLOT (kindChanged(bool) ) ); 190 connect (mIsLocal, SIGNAL( toggled(bool)), this, SLOT (kindChanged(bool) ) );
191 mIsPhone = new QRadioButton ( i18n("Mobile device (cell phone)"), gr ); 191 mIsPhone = new QRadioButton ( i18n("Mobile device (cell phone)"), gr );
192 connect (mIsPhone, SIGNAL( toggled(bool)), this, SLOT (kindChanged(bool) ) ); 192 connect (mIsPhone, SIGNAL( toggled(bool)), this, SLOT (kindChanged(bool) ) );
193 193
194 194
195 phoneWidget = new QVBox( topFrame); 195 phoneWidget = new QVBox( topFrame);
196 topLayout->addMultiCellWidget(phoneWidget, iii,iii,0,1); 196 topLayout->addMultiCellWidget(phoneWidget, iii,iii,0,1);
197 ++iii; 197 ++iii;
198 mWriteContactToSIM= new QCheckBox( i18n("Sync contacts with phone SIM card (If not, sync with phone memory)"), phoneWidget );
198 QHBox* temphb = new QHBox( phoneWidget ); 199 QHBox* temphb = new QHBox( phoneWidget );
199 new QLabel( i18n("I/O device: "), temphb ); 200 new QLabel( i18n("I/O device: "), temphb );
200 mPhoneDevice = new QLineEdit( temphb); 201 mPhoneDevice = new QLineEdit( temphb);
201 button = new QPushButton( i18n("Help..."), temphb ); 202 button = new QPushButton( i18n("Help..."), temphb );
202 connect ( button, SIGNAL( clicked()), this, SLOT ( helpDevice() ) ); 203 connect ( button, SIGNAL( clicked()), this, SLOT ( helpDevice() ) );
203 204
204 205
205 temphb = new QHBox( phoneWidget ); 206 temphb = new QHBox( phoneWidget );
206 new QLabel( i18n("Connection: "), temphb ); 207 new QLabel( i18n("Connection: "), temphb );
207 mPhoneConnection = new QLineEdit( temphb); 208 mPhoneConnection = new QLineEdit( temphb);
208 button = new QPushButton( i18n("Help..."), temphb ); 209 button = new QPushButton( i18n("Help..."), temphb );
209 connect ( button, SIGNAL( clicked()), this, SLOT ( helpConnection() ) ); 210 connect ( button, SIGNAL( clicked()), this, SLOT ( helpConnection() ) );
210 211
211 212
212 temphb = new QHBox( phoneWidget ); 213 temphb = new QHBox( phoneWidget );
213 new QLabel( i18n("Model(opt.): "), temphb ); 214 new QLabel( i18n("Model(opt.): "), temphb );
214 mPhoneModel = new QLineEdit( temphb); 215 mPhoneModel = new QLineEdit( temphb);
215 button = new QPushButton( i18n("Help..."), temphb ); 216 button = new QPushButton( i18n("Help..."), temphb );
216 connect ( button, SIGNAL( clicked()), this, SLOT ( helpModel() ) ); 217 connect ( button, SIGNAL( clicked()), this, SLOT ( helpModel() ) );
217 218
218 // *** local 219 // *** local
219 localFileWidget = new QVBox( topFrame); 220 localFileWidget = new QVBox( topFrame);
220 topLayout->addMultiCellWidget(localFileWidget, iii,iii,0,1); 221 topLayout->addMultiCellWidget(localFileWidget, iii,iii,0,1);
221 ++iii; 222 ++iii;
222 temphb = new QHBox( localFileWidget ); 223 temphb = new QHBox( localFileWidget );
223 224
224 lab = new QLabel( i18n("Local file Cal:"), temphb ); 225 lab = new QLabel( i18n("Local file Cal:"), temphb );
225 lab = new QLabel( i18n("Local file ABook:"), temphb ); 226 lab = new QLabel( i18n("Local file ABook:"), temphb );
226 temphb = new QHBox( localFileWidget ); 227 temphb = new QHBox( localFileWidget );
227 button = new QPushButton( i18n("Choose..."), temphb ); 228 button = new QPushButton( i18n("Choose..."), temphb );
228 connect ( button, SIGNAL( clicked()), this, SLOT ( chooseFile() ) ); 229 connect ( button, SIGNAL( clicked()), this, SLOT ( chooseFile() ) );
229 button = new QPushButton( i18n("Choose..."), temphb ); 230 button = new QPushButton( i18n("Choose..."), temphb );
@@ -311,64 +312,65 @@ void KSyncPrefsDialog::textChanged( const QString & s )
311 if ( mProfileBox->count() == 0 ) 312 if ( mProfileBox->count() == 0 )
312 return; 313 return;
313 if ( currentSelection < 3 ) { 314 if ( currentSelection < 3 ) {
314 //KMessageBox::error(this,i18n("This profil name\ncannot be edited!\n"),i18n("KO/Pi config error")); 315 //KMessageBox::error(this,i18n("This profil name\ncannot be edited!\n"),i18n("KO/Pi config error"));
315 mProfileBox->blockSignals( true ); 316 mProfileBox->blockSignals( true );
316 mProfileBox->setCurrentItem(mProfileBox-> currentItem ()); 317 mProfileBox->setCurrentItem(mProfileBox-> currentItem ());
317 mProfileBox->blockSignals( false ); 318 mProfileBox->blockSignals( false );
318 return; 319 return;
319 } 320 }
320 //qDebug("cur i %d ",mProfileBox-> currentItem () ); 321 //qDebug("cur i %d ",mProfileBox-> currentItem () );
321 mProfileBox->changeItem ( s, mProfileBox-> currentItem () ) ; 322 mProfileBox->changeItem ( s, mProfileBox-> currentItem () ) ;
322 KSyncProfile* prof = mSyncProfiles.at(mProfileBox-> currentItem ()) ; 323 KSyncProfile* prof = mSyncProfiles.at(mProfileBox-> currentItem ()) ;
323 prof->setName( s ); 324 prof->setName( s );
324 mSyncProfileNames[mProfileBox-> currentItem ()] = s; 325 mSyncProfileNames[mProfileBox-> currentItem ()] = s;
325} 326}
326void KSyncPrefsDialog::profileChanged( int item ) 327void KSyncPrefsDialog::profileChanged( int item )
327{ 328{
328 //qDebug("KSyncPrefsDialog::profileChanged %d ", item ); 329 //qDebug("KSyncPrefsDialog::profileChanged %d ", item );
329 KSyncProfile* prof; 330 KSyncProfile* prof;
330 saveProfile(); 331 saveProfile();
331 currentSelection = item; 332 currentSelection = item;
332 prof = mSyncProfiles.at(item) ; 333 prof = mSyncProfiles.at(item) ;
333 mRemotePrecommand->setText(prof->getPreSyncCommand()); 334 mRemotePrecommand->setText(prof->getPreSyncCommand());
334 mRemotePostcommand->setText(prof->getPostSyncCommand()); 335 mRemotePostcommand->setText(prof->getPostSyncCommand());
335 mLocalTempFile->setText(prof->getLocalTempFile()); 336 mLocalTempFile->setText(prof->getLocalTempFile());
336 mRemoteFile->setText(prof->getRemoteFileName()) ; 337 mRemoteFile->setText(prof->getRemoteFileName()) ;
337 338
338 mRemotePrecommandAB->setText(prof->getPreSyncCommandAB()); 339 mRemotePrecommandAB->setText(prof->getPreSyncCommandAB());
339 mRemotePostcommandAB->setText(prof->getPostSyncCommandAB()); 340 mRemotePostcommandAB->setText(prof->getPostSyncCommandAB());
340 mLocalTempFileAB->setText(prof->getLocalTempFileAB()); 341 mLocalTempFileAB->setText(prof->getLocalTempFileAB());
341 mRemoteFileAB->setText(prof->getRemoteFileNameAB()) ; 342 mRemoteFileAB->setText(prof->getRemoteFileNameAB()) ;
342 343
344 mWriteContactToSIM->setChecked( prof->getWriteContactToSIM());
343 mPhoneDevice->setText(prof->getPhoneDevice()); 345 mPhoneDevice->setText(prof->getPhoneDevice());
344 mPhoneConnection->setText(prof->getPhoneConnection()); 346 mPhoneConnection->setText(prof->getPhoneConnection());
345 mPhoneModel->setText(prof->getPhoneModel()); 347 mPhoneModel->setText(prof->getPhoneModel());
346 348
347 mShowSummaryAfterSync->setChecked( prof->getShowSummaryAfterSync()); 349 mShowSummaryAfterSync->setChecked( prof->getShowSummaryAfterSync());
348 mAskForPreferences->setChecked( prof->getAskForPreferences()); 350 mAskForPreferences->setChecked( prof->getAskForPreferences());
349 mWriteBackExisting->setChecked( prof->getWriteBackExisting() ); 351 mWriteBackExisting->setChecked( prof->getWriteBackExisting() );
350 mWriteBackFile->setChecked( prof->getWriteBackFile()); 352 mWriteBackFile->setChecked( prof->getWriteBackFile());
351 mIncludeInRing->setChecked( prof->getIncludeInRingSync() ); 353 mIncludeInRing->setChecked( prof->getIncludeInRingSync() );
352 mIncludeInRingAB->setChecked( prof->getIncludeInRingSyncAB() ); 354 mIncludeInRingAB->setChecked( prof->getIncludeInRingSyncAB() );
353 mWriteBackFuture->setChecked( prof->getWriteBackFuture()); 355 mWriteBackFuture->setChecked( prof->getWriteBackFuture());
354 mWriteBackFutureWeeks->setValue( prof->getWriteBackFutureWeeks() ); 356 mWriteBackFutureWeeks->setValue( prof->getWriteBackFutureWeeks() );
355 357
356 switch ( prof->getSyncPrefs() ) { 358 switch ( prof->getSyncPrefs() ) {
357 case 0: 359 case 0:
358 loc->setChecked( true); 360 loc->setChecked( true);
359 break; 361 break;
360 case 1: 362 case 1:
361 rem->setChecked( true ); 363 rem->setChecked( true );
362 break; 364 break;
363 case 2: 365 case 2:
364 newest->setChecked( true); 366 newest->setChecked( true);
365 break; 367 break;
366 case 3: 368 case 3:
367 ask->setChecked( true); 369 ask->setChecked( true);
368 break; 370 break;
369 case 4: 371 case 4:
370 f_loc->setChecked( true); 372 f_loc->setChecked( true);
371 break; 373 break;
372 case 5: 374 case 5:
373 f_rem->setChecked( true); 375 f_rem->setChecked( true);
374 break; 376 break;
@@ -442,64 +444,66 @@ void KSyncPrefsDialog::deleteProfile()
442 KSyncProfile* temp = mSyncProfiles.at(currentSelection); 444 KSyncProfile* temp = mSyncProfiles.at(currentSelection);
443 mSyncProfiles.remove( temp ); 445 mSyncProfiles.remove( temp );
444 mSyncProfileNames.remove( mSyncProfileNames.at( currentSelection )); 446 mSyncProfileNames.remove( mSyncProfileNames.at( currentSelection ));
445 insertProfiles(); 447 insertProfiles();
446 } 448 }
447} 449}
448 450
449void KSyncPrefsDialog::saveProfile() 451void KSyncPrefsDialog::saveProfile()
450{ 452{
451 KSyncProfile* prof; 453 KSyncProfile* prof;
452 if ( currentSelection >= 0 ) { 454 if ( currentSelection >= 0 ) {
453 prof = mSyncProfiles.at(currentSelection) ; 455 prof = mSyncProfiles.at(currentSelection) ;
454 prof->setPreSyncCommand( mRemotePrecommand->text()); 456 prof->setPreSyncCommand( mRemotePrecommand->text());
455 prof->setPostSyncCommand( mRemotePostcommand->text() ); 457 prof->setPostSyncCommand( mRemotePostcommand->text() );
456 prof->setLocalTempFile( mLocalTempFile->text()); 458 prof->setLocalTempFile( mLocalTempFile->text());
457 prof->setRemoteFileName( mRemoteFile->text() ); 459 prof->setRemoteFileName( mRemoteFile->text() );
458 prof->setPreSyncCommandAB( mRemotePrecommandAB->text()); 460 prof->setPreSyncCommandAB( mRemotePrecommandAB->text());
459 prof->setPostSyncCommandAB( mRemotePostcommandAB->text() ); 461 prof->setPostSyncCommandAB( mRemotePostcommandAB->text() );
460 prof->setLocalTempFileAB( mLocalTempFileAB->text()); 462 prof->setLocalTempFileAB( mLocalTempFileAB->text());
461 prof->setRemoteFileNameAB( mRemoteFileAB->text() ); 463 prof->setRemoteFileNameAB( mRemoteFileAB->text() );
462 prof->setShowSummaryAfterSync( mShowSummaryAfterSync->isChecked() ); 464 prof->setShowSummaryAfterSync( mShowSummaryAfterSync->isChecked() );
463 prof->setAskForPreferences( mAskForPreferences->isChecked()); 465 prof->setAskForPreferences( mAskForPreferences->isChecked());
464 prof->setWriteBackExisting(mWriteBackExisting->isChecked() ); 466 prof->setWriteBackExisting(mWriteBackExisting->isChecked() );
465 prof->setWriteBackFile( mWriteBackFile->isChecked()); 467 prof->setWriteBackFile( mWriteBackFile->isChecked());
466 prof->setIncludeInRingSync( mIncludeInRing->isChecked() ); 468 prof->setIncludeInRingSync( mIncludeInRing->isChecked() );
467 prof->setIncludeInRingSyncAB( mIncludeInRingAB->isChecked() ); 469 prof->setIncludeInRingSyncAB( mIncludeInRingAB->isChecked() );
468 int syncprefs = rem->isChecked()*1+newest->isChecked()*2+ ask->isChecked()*3+ f_loc->isChecked()*4+ f_rem->isChecked()*5 ;//+ both->isChecked()*6 ; 470 int syncprefs = rem->isChecked()*1+newest->isChecked()*2+ ask->isChecked()*3+ f_loc->isChecked()*4+ f_rem->isChecked()*5 ;//+ both->isChecked()*6 ;
469 prof->setSyncPrefs( syncprefs); 471 prof->setSyncPrefs( syncprefs);
470 prof->setIsLocalFileSync( mIsLocal->isChecked() ); 472 prof->setIsLocalFileSync( mIsLocal->isChecked() );
471 prof->setIsPhoneSync( mIsPhone->isChecked() ); 473 prof->setIsPhoneSync( mIsPhone->isChecked() );
472 prof->setWriteBackFuture(mWriteBackFuture->isChecked()); 474 prof->setWriteBackFuture(mWriteBackFuture->isChecked());
473 prof->setWriteBackFutureWeeks(mWriteBackFutureWeeks->value()); 475 prof->setWriteBackFutureWeeks(mWriteBackFutureWeeks->value());
476
477 prof->setWriteContactToSIM(mWriteContactToSIM->isChecked());
474 prof->setPhoneDevice( mPhoneDevice->text() ); 478 prof->setPhoneDevice( mPhoneDevice->text() );
475 prof->setPhoneConnection( mPhoneConnection->text() ); 479 prof->setPhoneConnection( mPhoneConnection->text() );
476 prof->setPhoneModel( mPhoneModel->text() ); 480 prof->setPhoneModel( mPhoneModel->text() );
477 481
478 } 482 }
479 483
480} 484}
481 485
482void KSyncPrefsDialog::insertProfiles() 486void KSyncPrefsDialog::insertProfiles()
483{ 487{
484 int curItem = mProfileBox->currentItem(); 488 int curItem = mProfileBox->currentItem();
485 mProfileBox->blockSignals( true ); 489 mProfileBox->blockSignals( true );
486 mProfileBox->clear(); 490 mProfileBox->clear();
487 mProfileBox->insertStringList (mSyncProfileNames ); 491 mProfileBox->insertStringList (mSyncProfileNames );
488 int item = mSyncProfileNames.count() -1; 492 int item = mSyncProfileNames.count() -1;
489 if ( curItem >= 0 && mSyncProfileNames.count() > 0 && curItem < mSyncProfileNames.count() ) 493 if ( curItem >= 0 && mSyncProfileNames.count() > 0 && curItem < mSyncProfileNames.count() )
490 mProfileBox->setCurrentItem( curItem ); 494 mProfileBox->setCurrentItem( curItem );
491 else if ( item >= 0 ) { 495 else if ( item >= 0 ) {
492 mProfileBox->setCurrentItem( item ); 496 mProfileBox->setCurrentItem( item );
493 } 497 }
494 currentSelection = -1; 498 currentSelection = -1;
495 if ( mSyncProfileNames.count() > 0 ) { 499 if ( mSyncProfileNames.count() > 0 ) {
496 //qDebug(" profileChanged( mProfileBox->currentItem() "); 500 //qDebug(" profileChanged( mProfileBox->currentItem() ");
497 profileChanged( mProfileBox->currentItem() ); 501 profileChanged( mProfileBox->currentItem() );
498 currentSelection = mProfileBox->currentItem(); 502 currentSelection = mProfileBox->currentItem();
499 } 503 }
500 mProfileBox->blockSignals( false ); 504 mProfileBox->blockSignals( false );
501} 505}
502 506
503void KSyncPrefsDialog::addProfile ( KSyncProfile* temp ) 507void KSyncPrefsDialog::addProfile ( KSyncProfile* temp )
504{ 508{
505 saveProfile(); 509 saveProfile();