summaryrefslogtreecommitdiffabout
path: root/libkdepim/ksyncprefsdialog.cpp
Unidiff
Diffstat (limited to 'libkdepim/ksyncprefsdialog.cpp') (more/less context) (ignore whitespace changes)
-rw-r--r--libkdepim/ksyncprefsdialog.cpp77
1 files changed, 65 insertions, 12 deletions
diff --git a/libkdepim/ksyncprefsdialog.cpp b/libkdepim/ksyncprefsdialog.cpp
index 7c04f48..355c05d 100644
--- a/libkdepim/ksyncprefsdialog.cpp
+++ b/libkdepim/ksyncprefsdialog.cpp
@@ -160,53 +160,77 @@ void KSyncPrefsDialog::setupSyncAlgTab()
160 f_loc= new QRadioButton ( i18n("Force: Take local entry always"), gr ); 160 f_loc= new QRadioButton ( i18n("Force: Take local entry always"), gr );
161 f_rem = new QRadioButton ( i18n("Force: Take remote entry always"), gr ); 161 f_rem = new QRadioButton ( i18n("Force: Take remote entry always"), gr );
162 // both = new QRadioButton ( i18n("Take both on conflict"), gr ); 162 // both = new QRadioButton ( i18n("Take both on conflict"), gr );
163 163
164 mShowSummaryAfterSync = new QCheckBox( i18n("Show summary after sync"), topFrame ); 164 mShowSummaryAfterSync = new QCheckBox( i18n("Show summary after sync"), topFrame );
165 topLayout->addMultiCellWidget(mShowSummaryAfterSync, iii,iii,0,1); 165 topLayout->addMultiCellWidget(mShowSummaryAfterSync, iii,iii,0,1);
166 ++iii;
167
168 mWriteBackFile = new QCheckBox( i18n("Write back synced data"), topFrame );
169 topLayout->addMultiCellWidget(mWriteBackFile, iii,iii,0,1);
166 ++iii; 170 ++iii;
167 171
168 mWriteBackExisting= new QCheckBox( i18n("Write back existing entries only"), topFrame ); 172 mWriteBackExisting= new QCheckBox( i18n("-- Write back (on remote) existing entries only"), topFrame );
169 topLayout->addMultiCellWidget(mWriteBackExisting, iii,iii,0,1); 173 topLayout->addMultiCellWidget(mWriteBackExisting, iii,iii,0,1);
170 ++iii; 174 ++iii;
171 175
172 mWriteBackFile = new QCheckBox( i18n("Write back file"), topFrame ); 176 mWriteBackFuture= new QCheckBox( i18n("-- Write back (calendar) entries in future only"), topFrame );
173 topLayout->addMultiCellWidget(mWriteBackFile, iii,iii,0,1); 177 topLayout->addMultiCellWidget(mWriteBackFuture, iii,iii,0,1);
174 ++iii; 178 ++iii;
175 179 topLayout->addMultiCellWidget(new QLabel( i18n("---- Max. weeks in future: ") , topFrame ), iii,iii,0,0);
180 mWriteBackFutureWeeks= new QSpinBox(1,104, 1, topFrame);
181 topLayout->addMultiCellWidget(mWriteBackFutureWeeks, iii,iii,1,1);
182 ++iii;
183
176 proGr = new QButtonGroup ( 1, Qt::Horizontal, i18n("Profile kind"), topFrame); 184 proGr = new QButtonGroup ( 1, Qt::Horizontal, i18n("Profile kind"), topFrame);
177 gr = proGr; 185 gr = proGr;
178 topLayout->addMultiCellWidget(gr, iii,iii,0,1); 186 topLayout->addMultiCellWidget(gr, iii,iii,0,1);
179 ++iii; 187 ++iii;
180 mIsLocal = new QRadioButton ( i18n("Local file"), gr ); 188 mIsLocal = new QRadioButton ( i18n("Local file"), gr );
181 mIsNotLocal = new QRadioButton ( i18n("Remote file (w down/upload command)"), gr ); 189 mIsNotLocal = new QRadioButton ( i18n("Remote file (w down/upload command)"), gr );
182 connect (mIsLocal, SIGNAL( toggled(bool)), this, SLOT (kindChanged(bool) ) ); 190 connect (mIsLocal, SIGNAL( toggled(bool)), this, SLOT (kindChanged(bool) ) );
183 191 // *** local
184 localFileWidget = new QVBox( topFrame); 192 localFileWidget = new QVBox( topFrame);
185 topLayout->addMultiCellWidget(localFileWidget, iii,iii,0,1); 193 topLayout->addMultiCellWidget(localFileWidget, iii,iii,0,1);
186 ++iii; 194 ++iii;
187 QHBox* temphb = new QHBox( localFileWidget ); 195 QHBox* temphb = new QHBox( localFileWidget );
188 lab = new QLabel( i18n("Local file:"), temphb);
189 mRemoteFile = new QLineEdit(localFileWidget);
190 196
197 lab = new QLabel( i18n("Local file Cal:"), temphb );
198 lab = new QLabel( i18n("Local file ABook:"), temphb );
199 temphb = new QHBox( localFileWidget );
191 button = new QPushButton( i18n("Choose..."), temphb ); 200 button = new QPushButton( i18n("Choose..."), temphb );
192 connect ( button, SIGNAL( clicked()), this, SLOT ( chooseFile() ) ); 201 connect ( button, SIGNAL( clicked()), this, SLOT ( chooseFile() ) );
202 button = new QPushButton( i18n("Choose..."), temphb );
203 connect ( button, SIGNAL( clicked()), this, SLOT ( chooseFileAB() ) );
204 temphb = new QHBox( localFileWidget );
193 205
206 mRemoteFile = new QLineEdit( temphb);
207 mRemoteFileAB = new QLineEdit( temphb);
194 208
209 // *** remote
195 remoteFileWidget = new QVBox( topFrame); 210 remoteFileWidget = new QVBox( topFrame);
196 topLayout->addMultiCellWidget(remoteFileWidget, iii,iii,0,1); 211 topLayout->addMultiCellWidget(remoteFileWidget, iii,iii,0,1);
197 ++iii; 212 ++iii;
213 temphb = new QHBox( remoteFileWidget );
214 new QLabel( i18n("Calendar:"), temphb);
215 new QLabel( i18n("AddressBook:"), temphb);
216
198 lab = new QLabel( i18n("Pre sync (download) command:"), remoteFileWidget); 217 lab = new QLabel( i18n("Pre sync (download) command:"), remoteFileWidget);
199 mRemotePrecommand = new QLineEdit(remoteFileWidget); 218 temphb = new QHBox( remoteFileWidget );
219 mRemotePrecommand = new QLineEdit(temphb);
220 mRemotePrecommandAB = new QLineEdit(temphb);
200 221
201 lab = new QLabel( i18n("Local temp file:"), remoteFileWidget); 222 lab = new QLabel( i18n("Local temp file:"), remoteFileWidget);
202 mLocalTempFile = new QLineEdit(remoteFileWidget); 223 temphb = new QHBox( remoteFileWidget );
224 mLocalTempFile = new QLineEdit(temphb);
225 mLocalTempFileAB = new QLineEdit(temphb);
203 226
204
205 lab = new QLabel( i18n("Post sync (upload) command:"), remoteFileWidget); 227 lab = new QLabel( i18n("Post sync (upload) command:"), remoteFileWidget);
206 mRemotePostcommand = new QLineEdit(remoteFileWidget); 228 temphb = new QHBox( remoteFileWidget );
229 mRemotePostcommand = new QLineEdit(temphb );
230 mRemotePostcommandAB = new QLineEdit(temphb );
207 231
208 lab = new QLabel( i18n("Fill in default values for:"), remoteFileWidget); 232 lab = new QLabel( i18n("Fill in default values for:"), remoteFileWidget);
209 temphb = new QHBox( remoteFileWidget ); 233 temphb = new QHBox( remoteFileWidget );
210 button = new QPushButton( i18n("ssh/scp"), temphb ); 234 button = new QPushButton( i18n("ssh/scp"), temphb );
211 connect ( button, SIGNAL( clicked()), this, SLOT (fillSSH() ) ); 235 connect ( button, SIGNAL( clicked()), this, SLOT (fillSSH() ) );
212 button = new QPushButton( i18n("ftp"), temphb ); 236 button = new QPushButton( i18n("ftp"), temphb );
@@ -242,12 +266,22 @@ void KSyncPrefsDialog::chooseFile()
242 fn =KFileDialog:: getOpenFileName( fn, i18n("Sync filename(*.ics/*.vcs)"), this ); 266 fn =KFileDialog:: getOpenFileName( fn, i18n("Sync filename(*.ics/*.vcs)"), this );
243 if ( fn == "" ) 267 if ( fn == "" )
244 return; 268 return;
245 mRemoteFile->setText( fn ); 269 mRemoteFile->setText( fn );
246} 270}
247 271
272void KSyncPrefsDialog::chooseFileAB()
273{
274 QString fn = QDir::homeDirPath();
275
276 fn =KFileDialog:: getOpenFileName( fn, i18n("Sync filename(*.ics/*.vcs)"), this );
277 if ( fn == "" )
278 return;
279 mRemoteFileAB->setText( fn );
280}
281
248void KSyncPrefsDialog::textChanged( const QString & s ) 282void KSyncPrefsDialog::textChanged( const QString & s )
249{ 283{
250 if ( mProfileBox->count() == 0 ) 284 if ( mProfileBox->count() == 0 )
251 return; 285 return;
252 if ( currentSelection < 3 ) { 286 if ( currentSelection < 3 ) {
253 //KMessageBox::error(this,i18n("This profil name\ncannot be edited!\n"),i18n("KO/Pi config error")); 287 //KMessageBox::error(this,i18n("This profil name\ncannot be edited!\n"),i18n("KO/Pi config error"));
@@ -270,18 +304,25 @@ void KSyncPrefsDialog::profileChanged( int item )
270 currentSelection = item; 304 currentSelection = item;
271 prof = mSyncProfiles.at(item) ; 305 prof = mSyncProfiles.at(item) ;
272 mRemotePrecommand->setText(prof->getPreSyncCommand()); 306 mRemotePrecommand->setText(prof->getPreSyncCommand());
273 mRemotePostcommand->setText(prof->getPostSyncCommand()); 307 mRemotePostcommand->setText(prof->getPostSyncCommand());
274 mLocalTempFile->setText(prof->getLocalTempFile()); 308 mLocalTempFile->setText(prof->getLocalTempFile());
275 mRemoteFile->setText(prof->getRemoteFileName()) ; 309 mRemoteFile->setText(prof->getRemoteFileName()) ;
310
311 mRemotePrecommandAB->setText(prof->getPreSyncCommandAB());
312 mRemotePostcommandAB->setText(prof->getPostSyncCommandAB());
313 mLocalTempFileAB->setText(prof->getLocalTempFileAB());
314 mRemoteFileAB->setText(prof->getRemoteFileNameAB()) ;
276 mShowSummaryAfterSync->setChecked( prof->getShowSummaryAfterSync()); 315 mShowSummaryAfterSync->setChecked( prof->getShowSummaryAfterSync());
277 mAskForPreferences->setChecked( prof->getAskForPreferences()); 316 mAskForPreferences->setChecked( prof->getAskForPreferences());
278 mWriteBackExisting->setChecked( prof->getWriteBackExisting() ); 317 mWriteBackExisting->setChecked( prof->getWriteBackExisting() );
279 mWriteBackFile->setChecked( prof->getWriteBackFile()); 318 mWriteBackFile->setChecked( prof->getWriteBackFile());
280 mIncludeInRing->setChecked( prof->getIncludeInRingSync() ); 319 mIncludeInRing->setChecked( prof->getIncludeInRingSync() );
281 mIncludeInRingAB->setChecked( prof->getIncludeInRingSyncAB() ); 320 mIncludeInRingAB->setChecked( prof->getIncludeInRingSyncAB() );
321 mWriteBackFuture->setChecked( prof->getWriteBackFuture());
322 mWriteBackFutureWeeks->setValue( prof->getWriteBackFutureWeeks() );
282 323
283 switch ( prof->getSyncPrefs() ) { 324 switch ( prof->getSyncPrefs() ) {
284 case 0: 325 case 0:
285 loc->setChecked( true); 326 loc->setChecked( true);
286 break; 327 break;
287 case 1: 328 case 1:
@@ -318,18 +359,24 @@ void KSyncPrefsDialog::profileChanged( int item )
318 359
319void KSyncPrefsDialog::fillSSH() 360void KSyncPrefsDialog::fillSSH()
320{ 361{
321 mRemotePrecommand->setText("scp zaurus@192.168.0.65:/home/zaurus/kdepim/apps/korganizer/mycalendar.ics /tmp/mycalendar.ics" ); 362 mRemotePrecommand->setText("scp zaurus@192.168.0.65:/home/zaurus/kdepim/apps/korganizer/mycalendar.ics /tmp/mycalendar.ics" );
322 mLocalTempFile->setText("/tmp/mycalendar.ics" ); 363 mLocalTempFile->setText("/tmp/mycalendar.ics" );
323 mRemotePostcommand->setText("scp /tmp/mycalendar.ics zaurus@192.168.0.65:/home/zaurus/kdepim/apps/korganizer/mycalendar.ics" ); 364 mRemotePostcommand->setText("scp /tmp/mycalendar.ics zaurus@192.168.0.65:/home/zaurus/kdepim/apps/korganizer/mycalendar.ics" );
365 mRemotePrecommandAB->setText("scp zaurus@192.168.0.65:/home/zaurus/kdepim/apps/kabc/std.vcf /tmp/std.vcf" );
366 mLocalTempFileAB->setText("/tmp/std.vcf" );
367 mRemotePostcommandAB->setText("scp /tmp/std.vcf zaurus@192.168.0.65:/home/zaurus/kdepim/apps/kabc/std.vcf" );
324} 368}
325void KSyncPrefsDialog::fillFTP() 369void KSyncPrefsDialog::fillFTP()
326{ 370{
327 mRemotePrecommand->setText("cd /tmp;ftp ftp://zaurus:a@192.168.0.65/kdepim/apps/korganizer/mycalendar.ics" ); 371 mRemotePrecommand->setText("cd /tmp;ftp ftp://zaurus:a@192.168.0.65/kdepim/apps/korganizer/mycalendar.ics" );
328 mLocalTempFile->setText("/tmp/mycalendar.ics" ); 372 mLocalTempFile->setText("/tmp/mycalendar.ics" );
329 mRemotePostcommand->setText("ftp -u ftp://zaurus:a@192.168.0.65/kdepim/apps/korganizer/mycalendar.ics /tmp/mycalendar.ics" ); 373 mRemotePostcommand->setText("ftp -u ftp://zaurus:a@192.168.0.65/kdepim/apps/korganizer/mycalendar.ics /tmp/mycalendar.ics" );
374 mRemotePrecommandAB->setText("cd /tmp;ftp ftp://zaurus:a@192.168.0.65/kdepim/apps/kabc/std.vcf" );
375 mLocalTempFileAB->setText("/tmp/std.vcf" );
376 mRemotePostcommandAB->setText("ftp -u ftp://zaurus:a@192.168.0.65/kdepim/apps/kabc/std.vcf /tmp/std.vcf" );
330 377
331} 378}
332void KSyncPrefsDialog::kindChanged( bool b ) 379void KSyncPrefsDialog::kindChanged( bool b )
333{ 380{
334 381
335 localFileWidget->setEnabled(b); 382 localFileWidget->setEnabled(b);
@@ -357,21 +404,27 @@ void KSyncPrefsDialog::saveProfile()
357 if ( currentSelection >= 0 ) { 404 if ( currentSelection >= 0 ) {
358 prof = mSyncProfiles.at(currentSelection) ; 405 prof = mSyncProfiles.at(currentSelection) ;
359 prof->setPreSyncCommand( mRemotePrecommand->text()); 406 prof->setPreSyncCommand( mRemotePrecommand->text());
360 prof->setPostSyncCommand( mRemotePostcommand->text() ); 407 prof->setPostSyncCommand( mRemotePostcommand->text() );
361 prof->setLocalTempFile( mLocalTempFile->text()); 408 prof->setLocalTempFile( mLocalTempFile->text());
362 prof->setRemoteFileName( mRemoteFile->text() ); 409 prof->setRemoteFileName( mRemoteFile->text() );
410 prof->setPreSyncCommandAB( mRemotePrecommandAB->text());
411 prof->setPostSyncCommandAB( mRemotePostcommandAB->text() );
412 prof->setLocalTempFileAB( mLocalTempFileAB->text());
413 prof->setRemoteFileNameAB( mRemoteFileAB->text() );
363 prof->setShowSummaryAfterSync( mShowSummaryAfterSync->isChecked() ); 414 prof->setShowSummaryAfterSync( mShowSummaryAfterSync->isChecked() );
364 prof->setAskForPreferences( mAskForPreferences->isChecked()); 415 prof->setAskForPreferences( mAskForPreferences->isChecked());
365 prof->setWriteBackExisting(mWriteBackExisting->isChecked() ); 416 prof->setWriteBackExisting(mWriteBackExisting->isChecked() );
366 prof->setWriteBackFile( mWriteBackFile->isChecked()); 417 prof->setWriteBackFile( mWriteBackFile->isChecked());
367 prof->setIncludeInRingSync( mIncludeInRing->isChecked() ); 418 prof->setIncludeInRingSync( mIncludeInRing->isChecked() );
368 prof->setIncludeInRingSyncAB( mIncludeInRingAB->isChecked() ); 419 prof->setIncludeInRingSyncAB( mIncludeInRingAB->isChecked() );
369 int syncprefs = rem->isChecked()*1+newest->isChecked()*2+ ask->isChecked()*3+ f_loc->isChecked()*4+ f_rem->isChecked()*5 ;//+ both->isChecked()*6 ; 420 int syncprefs = rem->isChecked()*1+newest->isChecked()*2+ ask->isChecked()*3+ f_loc->isChecked()*4+ f_rem->isChecked()*5 ;//+ both->isChecked()*6 ;
370 prof->setSyncPrefs( syncprefs); 421 prof->setSyncPrefs( syncprefs);
371 prof->setIsLocalFileSync( mIsLocal->isChecked() ); 422 prof->setIsLocalFileSync( mIsLocal->isChecked() );
423 prof->setWriteBackFuture(mWriteBackFuture->isChecked());
424 prof->setWriteBackFutureWeeks(mWriteBackFutureWeeks->value());
372 } 425 }
373 426
374} 427}
375 428
376void KSyncPrefsDialog::insertProfiles() 429void KSyncPrefsDialog::insertProfiles()
377{ 430{