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
@@ -118,302 +118,355 @@ void KSyncPrefsDialog::setupSyncAlgTab()
118 topLayout->addWidget(mMyMachineName,iii,1); 118 topLayout->addWidget(mMyMachineName,iii,1);
119 ++iii; 119 ++iii;
120 120
121 QHBox* buttonbox = new QHBox( topFrame); 121 QHBox* buttonbox = new QHBox( topFrame);
122 topLayout->addMultiCellWidget(buttonbox, iii,iii,0,1); 122 topLayout->addMultiCellWidget(buttonbox, iii,iii,0,1);
123 ++iii; 123 ++iii;
124 button = new QPushButton( i18n("New profile"), buttonbox ); 124 button = new QPushButton( i18n("New profile"), buttonbox );
125 connect ( button, SIGNAL( clicked()), this, SLOT (newProfile() ) ); 125 connect ( button, SIGNAL( clicked()), this, SLOT (newProfile() ) );
126 126
127 button = new QPushButton( i18n("Clone profile"), buttonbox ); 127 button = new QPushButton( i18n("Clone profile"), buttonbox );
128 connect ( button, SIGNAL( clicked()), this, SLOT ( cloneProfile() ) ); 128 connect ( button, SIGNAL( clicked()), this, SLOT ( cloneProfile() ) );
129 129
130 button = new QPushButton( i18n("Delete profile"), buttonbox ); 130 button = new QPushButton( i18n("Delete profile"), buttonbox );
131 connect ( button, SIGNAL( clicked()), this, SLOT (deleteProfile() ) ); 131 connect ( button, SIGNAL( clicked()), this, SLOT (deleteProfile() ) );
132 132
133 mProfileBox = new QComboBox(topFrame); 133 mProfileBox = new QComboBox(topFrame);
134 mProfileBox->setEditable ( true ); 134 mProfileBox->setEditable ( true );
135 connect ( mProfileBox, SIGNAL(activated ( int ) ), this, SLOT (profileChanged( int ) ) ); 135 connect ( mProfileBox, SIGNAL(activated ( int ) ), this, SLOT (profileChanged( int ) ) );
136 connect ( mProfileBox, SIGNAL( textChanged ( const QString & ) ), this, SLOT (textChanged( const QString & ) ) ); 136 connect ( mProfileBox, SIGNAL( textChanged ( const QString & ) ), this, SLOT (textChanged( const QString & ) ) );
137 137
138 lab = new QLabel(mProfileBox, i18n("Profile:"), topFrame); 138 lab = new QLabel(mProfileBox, i18n("Profile:"), topFrame);
139 topLayout->addWidget(lab ,iii,0); 139 topLayout->addWidget(lab ,iii,0);
140 topLayout->addWidget(mProfileBox, iii,1); 140 topLayout->addWidget(mProfileBox, iii,1);
141 ++iii; 141 ++iii;
142 142
143 mIncludeInRing = new QCheckBox( i18n("Include in multiple calendar sync"), topFrame ); 143 mIncludeInRing = new QCheckBox( i18n("Include in multiple calendar sync"), topFrame );
144 topLayout->addMultiCellWidget(mIncludeInRing, iii,iii,0,1); 144 topLayout->addMultiCellWidget(mIncludeInRing, iii,iii,0,1);
145 ++iii; 145 ++iii;
146 mIncludeInRingAB = new QCheckBox( i18n("Include in multiple addressbook sync"), topFrame ); 146 mIncludeInRingAB = new QCheckBox( i18n("Include in multiple addressbook sync"), topFrame );
147 topLayout->addMultiCellWidget(mIncludeInRingAB, iii,iii,0,1); 147 topLayout->addMultiCellWidget(mIncludeInRingAB, iii,iii,0,1);
148 ++iii; 148 ++iii;
149 149
150 mAskForPreferences = new QCheckBox( i18n("Ask for preferences before sync"), topFrame ); 150 mAskForPreferences = new QCheckBox( i18n("Ask for preferences before sync"), topFrame );
151 topLayout->addMultiCellWidget(mAskForPreferences, iii,iii,0,1); 151 topLayout->addMultiCellWidget(mAskForPreferences, iii,iii,0,1);
152 ++iii; 152 ++iii;
153 QButtonGroup* gr = new QButtonGroup ( 1, Qt::Horizontal, i18n("Sync preferences"), topFrame); 153 QButtonGroup* gr = new QButtonGroup ( 1, Qt::Horizontal, i18n("Sync preferences"), topFrame);
154 topLayout->addMultiCellWidget(gr, iii,iii,0,1); 154 topLayout->addMultiCellWidget(gr, iii,iii,0,1);
155 ++iii; 155 ++iii;
156 loc = new QRadioButton ( i18n("Take local entry on conflict"), gr ); 156 loc = new QRadioButton ( i18n("Take local entry on conflict"), gr );
157 rem = new QRadioButton ( i18n("Take remote entry on conflict"), gr ); 157 rem = new QRadioButton ( i18n("Take remote entry on conflict"), gr );
158 newest = new QRadioButton ( i18n("Take newest entry on conflict"), gr ); 158 newest = new QRadioButton ( i18n("Take newest entry on conflict"), gr );
159 ask = new QRadioButton ( i18n("Ask for every entry on conflict"), gr ); 159 ask = new QRadioButton ( i18n("Ask for every entry on conflict"), gr );
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 );
213 connect ( button, SIGNAL( clicked()), this, SLOT (fillFTP() ) ); 237 connect ( button, SIGNAL( clicked()), this, SLOT (fillFTP() ) );
214 lab = new QLabel( i18n("Hint: Use $PWD$ for placeholder of password!"), remoteFileWidget); 238 lab = new QLabel( i18n("Hint: Use $PWD$ for placeholder of password!"), remoteFileWidget);
215 239
216 240
217} 241}
218void KSyncPrefsDialog::slotOK() 242void KSyncPrefsDialog::slotOK()
219{ 243{
220 if ( mMyMachineName->text() == "undefined" ) { 244 if ( mMyMachineName->text() == "undefined" ) {
221 KMessageBox::error(this,i18n("Local device name undefined!\nPlease define device name!"),i18n("KO/Pi config error")); 245 KMessageBox::error(this,i18n("Local device name undefined!\nPlease define device name!"),i18n("KO/Pi config error"));
222 return; 246 return;
223 } 247 }
224 int i; 248 int i;
225 for (i = 0; i < mSyncProfileNames.count(); ++ i) { 249 for (i = 0; i < mSyncProfileNames.count(); ++ i) {
226 if ( mSyncProfileNames.contains( mSyncProfileNames[i]) > 1 ) { 250 if ( mSyncProfileNames.contains( mSyncProfileNames[i]) > 1 ) {
227 KMessageBox::error(this,i18n("Multiple profiles with same name!\nPlease use unique profile names!"),i18n("KO/Pi config error")); 251 KMessageBox::error(this,i18n("Multiple profiles with same name!\nPlease use unique profile names!"),i18n("KO/Pi config error"));
228 return; 252 return;
229 } 253 }
230 } 254 }
231 usrWriteConfig(); 255 usrWriteConfig();
232 QDialog::accept(); 256 QDialog::accept();
233} 257}
234void KSyncPrefsDialog::accept() 258void KSyncPrefsDialog::accept()
235{ 259{
236 slotOK(); 260 slotOK();
237} 261}
238void KSyncPrefsDialog::chooseFile() 262void KSyncPrefsDialog::chooseFile()
239{ 263{
240 QString fn = QDir::homeDirPath(); 264 QString fn = QDir::homeDirPath();
241 265
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"));
254 mProfileBox->blockSignals( true ); 288 mProfileBox->blockSignals( true );
255 mProfileBox->setCurrentItem(mProfileBox-> currentItem ()); 289 mProfileBox->setCurrentItem(mProfileBox-> currentItem ());
256 mProfileBox->blockSignals( false ); 290 mProfileBox->blockSignals( false );
257 return; 291 return;
258 } 292 }
259 //qDebug("cur i %d ",mProfileBox-> currentItem () ); 293 //qDebug("cur i %d ",mProfileBox-> currentItem () );
260 mProfileBox->changeItem ( s, mProfileBox-> currentItem () ) ; 294 mProfileBox->changeItem ( s, mProfileBox-> currentItem () ) ;
261 KSyncProfile* prof = mSyncProfiles.at(mProfileBox-> currentItem ()) ; 295 KSyncProfile* prof = mSyncProfiles.at(mProfileBox-> currentItem ()) ;
262 prof->setName( s ); 296 prof->setName( s );
263 mSyncProfileNames[mProfileBox-> currentItem ()] = s; 297 mSyncProfileNames[mProfileBox-> currentItem ()] = s;
264} 298}
265void KSyncPrefsDialog::profileChanged( int item ) 299void KSyncPrefsDialog::profileChanged( int item )
266{ 300{
267 //qDebug("KSyncPrefsDialog::profileChanged %d ", item ); 301 //qDebug("KSyncPrefsDialog::profileChanged %d ", item );
268 KSyncProfile* prof; 302 KSyncProfile* prof;
269 saveProfile(); 303 saveProfile();
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:
288 rem->setChecked( true ); 329 rem->setChecked( true );
289 break; 330 break;
290 case 2: 331 case 2:
291 newest->setChecked( true); 332 newest->setChecked( true);
292 break; 333 break;
293 case 3: 334 case 3:
294 ask->setChecked( true); 335 ask->setChecked( true);
295 break; 336 break;
296 case 4: 337 case 4:
297 f_loc->setChecked( true); 338 f_loc->setChecked( true);
298 break; 339 break;
299 case 5: 340 case 5:
300 f_rem->setChecked( true); 341 f_rem->setChecked( true);
301 break; 342 break;
302 case 6: 343 case 6:
303 //both->setChecked( true); 344 //both->setChecked( true);
304 break; 345 break;
305 default: 346 default:
306 break; 347 break;
307 } 348 }
308 mIsLocal->setChecked(prof->getIsLocalFileSync()) ; 349 mIsLocal->setChecked(prof->getIsLocalFileSync()) ;
309 mIsNotLocal->setChecked(!prof->getIsLocalFileSync()); 350 mIsNotLocal->setChecked(!prof->getIsLocalFileSync());
310 proGr->setEnabled( item > 2 ); 351 proGr->setEnabled( item > 2 );
311 if ( item < 3 ) { 352 if ( item < 3 ) {
312 localFileWidget->setEnabled(false); 353 localFileWidget->setEnabled(false);
313 remoteFileWidget->setEnabled(false); 354 remoteFileWidget->setEnabled(false);
314 355
315 } else 356 } else
316 kindChanged( prof->getIsLocalFileSync() ); 357 kindChanged( prof->getIsLocalFileSync() );
317} 358}
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);
336 remoteFileWidget->setEnabled(!b); 383 remoteFileWidget->setEnabled(!b);
337 384
338} 385}
339void KSyncPrefsDialog::deleteProfile() 386void KSyncPrefsDialog::deleteProfile()
340{ 387{
341 //qDebug("KSyncPrefsDialog::deleteProfile() "); 388 //qDebug("KSyncPrefsDialog::deleteProfile() ");
342 if ( currentSelection >= 0 ) { 389 if ( currentSelection >= 0 ) {
343 if ( currentSelection < 3 ) { 390 if ( currentSelection < 3 ) {
344 KMessageBox::error(this,i18n("This profil cannot be deleted!\n"),i18n("KO/Pi config error")); 391 KMessageBox::error(this,i18n("This profil cannot be deleted!\n"),i18n("KO/Pi config error"));
345 return; 392 return;
346 } 393 }
347 KSyncProfile* temp = mSyncProfiles.at(currentSelection); 394 KSyncProfile* temp = mSyncProfiles.at(currentSelection);
348 mSyncProfiles.remove( temp ); 395 mSyncProfiles.remove( temp );
349 mSyncProfileNames.remove( mSyncProfileNames.at( currentSelection )); 396 mSyncProfileNames.remove( mSyncProfileNames.at( currentSelection ));
350 insertProfiles(); 397 insertProfiles();
351 } 398 }
352} 399}
353 400
354void KSyncPrefsDialog::saveProfile() 401void KSyncPrefsDialog::saveProfile()
355{ 402{
356 KSyncProfile* prof; 403 KSyncProfile* prof;
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{
378 int curItem = mProfileBox->currentItem(); 431 int curItem = mProfileBox->currentItem();
379 mProfileBox->blockSignals( true ); 432 mProfileBox->blockSignals( true );
380 mProfileBox->clear(); 433 mProfileBox->clear();
381 mProfileBox->insertStringList (mSyncProfileNames ); 434 mProfileBox->insertStringList (mSyncProfileNames );
382 int item = mSyncProfileNames.count() -1; 435 int item = mSyncProfileNames.count() -1;
383 if ( curItem >= 0 && mSyncProfileNames.count() > 0 && curItem < mSyncProfileNames.count() ) 436 if ( curItem >= 0 && mSyncProfileNames.count() > 0 && curItem < mSyncProfileNames.count() )
384 mProfileBox->setCurrentItem( curItem ); 437 mProfileBox->setCurrentItem( curItem );
385 else if ( item >= 0 ) { 438 else if ( item >= 0 ) {
386 mProfileBox->setCurrentItem( item ); 439 mProfileBox->setCurrentItem( item );
387 } 440 }
388 currentSelection = -1; 441 currentSelection = -1;
389 if ( mSyncProfileNames.count() > 0 ) { 442 if ( mSyncProfileNames.count() > 0 ) {
390 //qDebug(" profileChanged( mProfileBox->currentItem() "); 443 //qDebug(" profileChanged( mProfileBox->currentItem() ");
391 profileChanged( mProfileBox->currentItem() ); 444 profileChanged( mProfileBox->currentItem() );
392 currentSelection = mProfileBox->currentItem(); 445 currentSelection = mProfileBox->currentItem();
393 } 446 }
394 mProfileBox->blockSignals( false ); 447 mProfileBox->blockSignals( false );
395} 448}
396 449
397void KSyncPrefsDialog::addProfile ( KSyncProfile* temp ) 450void KSyncPrefsDialog::addProfile ( KSyncProfile* temp )
398{ 451{
399 saveProfile(); 452 saveProfile();
400 mSyncProfiles.append( temp ); 453 mSyncProfiles.append( temp );
401 mSyncProfileNames << temp->getName(); 454 mSyncProfileNames << temp->getName();
402 insertProfiles(); 455 insertProfiles();
403 int last = mProfileBox->count() -1; 456 int last = mProfileBox->count() -1;
404 mProfileBox->blockSignals( true ); 457 mProfileBox->blockSignals( true );
405 mProfileBox->setCurrentItem( last ); 458 mProfileBox->setCurrentItem( last );
406 mProfileBox->blockSignals( false ); 459 mProfileBox->blockSignals( false );
407 profileChanged(last); 460 profileChanged(last);
408} 461}
409void KSyncPrefsDialog::newProfile() 462void KSyncPrefsDialog::newProfile()
410{ 463{
411 addProfile ( new KSyncProfile () ); 464 addProfile ( new KSyncProfile () );
412} 465}
413 466
414void KSyncPrefsDialog::cloneProfile() 467void KSyncPrefsDialog::cloneProfile()
415{ 468{
416 if ( currentSelection >= 0 ) 469 if ( currentSelection >= 0 )
417 addProfile (mSyncProfiles.at(currentSelection)->clone()) ; 470 addProfile (mSyncProfiles.at(currentSelection)->clone()) ;
418 else 471 else
419 newProfile(); 472 newProfile();