summaryrefslogtreecommitdiffabout
Unidiff
Diffstat (more/less context) (ignore whitespace changes)
-rw-r--r--libkdepim/ksyncprefsdialog.cpp77
-rw-r--r--libkdepim/ksyncprefsdialog.h19
-rw-r--r--libkdepim/ksyncprofile.cpp37
-rw-r--r--libkdepim/ksyncprofile.h21
4 files changed, 131 insertions, 23 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();
diff --git a/libkdepim/ksyncprefsdialog.h b/libkdepim/ksyncprefsdialog.h
index c663d22..8c2c59c 100644
--- a/libkdepim/ksyncprefsdialog.h
+++ b/libkdepim/ksyncprefsdialog.h
@@ -24,88 +24,97 @@
24#define _KSYNCPREFSDIALOG_H 24#define _KSYNCPREFSDIALOG_H
25 25
26 26
27#include <kdialogbase.h> 27#include <kdialogbase.h>
28#include <qptrlist.h> 28#include <qptrlist.h>
29 29
30//#include <libkdepim/kprefsdialog.h> 30//#include <libkdepim/kprefsdialog.h>
31 31
32class KColorButton; 32class KColorButton;
33class QSpinBox;; 33class QSpinBox;;
34class QRadioButton; 34class QRadioButton;
35class QCheckBox; 35class QCheckBox;
36class QSlider; 36class QSlider;
37class KURLRequester; 37class KURLRequester;
38class QComboBox; 38class QComboBox;
39class QButtonGroup; 39class QButtonGroup;
40class QLineEdit; 40class QLineEdit;
41class QVBox; 41class QVBox;
42class QStringList; 42class QStringList;
43class KSyncProfile; 43class KSyncProfile;
44 44
45/** Dialog to change the korganizer configuration. 45/** Dialog to change the korganizer configuration.
46 */ 46 */
47class KSyncPrefsDialog : public KDialog 47class KSyncPrefsDialog : public KDialog
48{ 48{
49 Q_OBJECT 49 Q_OBJECT
50 public: 50 public:
51 /** Initialize dialog and pages */ 51 /** Initialize dialog and pages */
52 KSyncPrefsDialog(QWidget *parent=0,char *name=0,bool modal=false); 52 KSyncPrefsDialog(QWidget *parent=0,char *name=0,bool modal=false);
53 ~KSyncPrefsDialog(); 53 ~KSyncPrefsDialog();
54 void usrReadConfig(); 54 void usrReadConfig();
55 void setLocalMachineName ( const QString& name ); 55 void setLocalMachineName ( const QString& name );
56 QString getLocalMachineName ( ); 56 QString getLocalMachineName ( );
57 57
58 QStringList getSyncProfileNames(); 58 QStringList getSyncProfileNames();
59 59
60 public slots: 60 public slots:
61 protected slots: 61 protected slots:
62 void accept(); 62 void accept();
63 void deleteProfile(); 63 void deleteProfile();
64 void newProfile(); 64 void newProfile();
65 void cloneProfile(); 65 void cloneProfile();
66 void kindChanged(bool); 66 void kindChanged(bool);
67 void fillSSH(); 67 void fillSSH();
68 void fillFTP(); 68 void fillFTP();
69 void textChanged( const QString & ); 69 void textChanged( const QString & );
70 void profileChanged( int ); 70 void profileChanged( int );
71 void chooseFile(); 71 void chooseFile();
72 void chooseFileAB();
72 void slotOK(); 73 void slotOK();
73 74
74 protected: 75 protected:
75 void usrWriteConfig(); 76 void usrWriteConfig();
76 77
77 void setupSyncAlgTab(); 78 void setupSyncAlgTab();
78 79
79 private: 80 private:
80 int currentSelection; 81 int currentSelection;
81 QPtrList<KSyncProfile> mSyncProfiles; 82 QPtrList<KSyncProfile> mSyncProfiles;
82 QStringList mSyncProfileNames; 83 QStringList mSyncProfileNames;
83 QLineEdit * mMyMachineName; 84 QLineEdit * mMyMachineName;
84 QComboBox * mProfileBox; 85 QComboBox * mProfileBox;
85 QRadioButton* mIsLocal; 86 QRadioButton* mIsLocal;
86 QRadioButton* mIsNotLocal; 87 QRadioButton* mIsNotLocal;
87 QCheckBox* mIncludeInRing; 88 QCheckBox* mIncludeInRing;
88 QCheckBox* mIncludeInRingAB; 89 QCheckBox* mIncludeInRingAB;
89 void addProfile ( KSyncProfile* ); 90 void addProfile ( KSyncProfile* );
90 void insertProfiles(); 91 void insertProfiles();
91 void saveProfile(); 92 void saveProfile();
92 QButtonGroup* proGr; 93 QButtonGroup* proGr;
93 94
94 QRadioButton* loc, *rem, *newest, *ask, *f_loc,* f_rem, *both; 95 QRadioButton* loc, *rem, *newest, *ask, *f_loc,* f_rem, *both;
95 96
96 97
97 QLineEdit * mRemotePostcommand; 98 QLineEdit * mRemotePostcommand;
98 QLineEdit * mRemotePrecommand; 99 QLineEdit * mRemotePrecommand;
99 QLineEdit * mRemoteFile; 100 QLineEdit * mRemoteFile;
100 QLineEdit * mLocalTempFile; 101 QLineEdit * mLocalTempFile;
101 QWidget* mSetupSyncAlgTab;
102 102
103 QLineEdit * mRemotePostcommandAB;
104 QLineEdit * mRemotePrecommandAB;
105 QLineEdit * mRemoteFileAB;
106 QLineEdit * mLocalTempFileAB;
107
108
109 QWidget* mSetupSyncAlgTab;
103 QVBox* localFileWidget; 110 QVBox* localFileWidget;
104 QVBox* remoteFileWidget; 111 QVBox* remoteFileWidget;
105 QCheckBox* mWriteBackFile; 112 QCheckBox* mWriteBackFile;
106 QCheckBox* mWriteBackExisting; 113 QCheckBox* mWriteBackFuture;
107 QCheckBox* mAskForPreferences; 114 QSpinBox* mWriteBackFutureWeeks;
108 QCheckBox* mShowSummaryAfterSync; 115 QCheckBox* mWriteBackExisting;
116 QCheckBox* mAskForPreferences;
117 QCheckBox* mShowSummaryAfterSync;
109}; 118};
110 119
111#endif 120#endif
diff --git a/libkdepim/ksyncprofile.cpp b/libkdepim/ksyncprofile.cpp
index ea41a85..f34c309 100644
--- a/libkdepim/ksyncprofile.cpp
+++ b/libkdepim/ksyncprofile.cpp
@@ -2,128 +2,155 @@
2 This file is part of KOrganizer. 2 This file is part of KOrganizer.
3 Copyright (c) 2004 Lutz Rogowski <rogowski@kde.org> 3 Copyright (c) 2004 Lutz Rogowski <rogowski@kde.org>
4 4
5 This library is free software; you can redistribute it and/or 5 This library is free software; you can redistribute it and/or
6 modify it under the terms of the GNU Library General Public 6 modify it under the terms of the GNU Library General Public
7 License as published by the Free Software Foundation; either 7 License as published by the Free Software Foundation; either
8 version 2 of the License, or (at your option) any later version. 8 version 2 of the License, or (at your option) any later version.
9 9
10 This library is distributed in the hope that it will be useful, 10 This library is distributed in the hope that it will be useful,
11 but WITHOUT ANY WARRANTY; without even the implied warranty of 11 but WITHOUT ANY WARRANTY; without even the implied warranty of
12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13 Library General Public License for more details. 13 Library General Public License for more details.
14 14
15 You should have received a copy of the GNU Library General Public License 15 You should have received a copy of the GNU Library General Public License
16 along with this library; see the file COPYING.LIB. If not, write to 16 along with this library; see the file COPYING.LIB. If not, write to
17 the Free Software Foundation, Inc., 59 Temple Place - Suite 330, 17 the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
18 Boston, MA 02111-1307, USA. 18 Boston, MA 02111-1307, USA.
19*/ 19*/
20 20
21// $Id$ 21// $Id$
22 22
23#include <qcolor.h> 23#include <qcolor.h>
24 24
25#include <kconfig.h> 25#include <kconfig.h>
26#include <kstandarddirs.h> 26#include <kstandarddirs.h>
27#include <kglobal.h> 27#include <kglobal.h>
28#include <kdebug.h> 28#include <kdebug.h>
29 29
30#include "ksyncprofile.h" 30#include "ksyncprofile.h"
31 31
32 32
33KSyncProfile::KSyncProfile( const char * name): QObject (0, name ) 33KSyncProfile::KSyncProfile( const char * name): QObject (0, name )
34{ 34{
35 setDefault(); 35 setDefault();
36} 36}
37KSyncProfile::~KSyncProfile() 37KSyncProfile::~KSyncProfile()
38{ 38{
39 39
40} 40}
41 41
42 42
43KSyncProfile* KSyncProfile::clone() 43KSyncProfile* KSyncProfile::clone()
44{ 44{
45 KSyncProfile* myClone = new KSyncProfile(); 45 KSyncProfile* myClone = new KSyncProfile();
46 myClone->setPreSyncCommand( mPreSyncCommand ); 46 myClone->setPreSyncCommand( mPreSyncCommand );
47 myClone->setPostSyncCommand( mPostSyncCommand ); 47 myClone->setPostSyncCommand( mPostSyncCommand );
48 myClone->setLocalTempFile( mLocalTempFile); 48 myClone->setLocalTempFile( mLocalTempFile);
49 myClone->setRemoteFileName( mRemoteFileName ); 49 myClone->setRemoteFileName( mRemoteFileName );
50 myClone->setPreSyncCommandAB( mPreSyncCommandAB );
51 myClone->setPostSyncCommandAB( mPostSyncCommandAB );
52 myClone->setLocalTempFileAB( mLocalTempFileAB);
53 myClone->setRemoteFileNameAB( mRemoteFileNameAB );
50 myClone->setShowSummaryAfterSync( mShowSummaryAfterSync ); 54 myClone->setShowSummaryAfterSync( mShowSummaryAfterSync );
51 myClone->setAskForPreferences( mAskForPreferences); 55 myClone->setAskForPreferences( mAskForPreferences);
52 myClone->setWriteBackExisting(mWriteBackExisting ); 56 myClone->setWriteBackExisting(mWriteBackExisting );
53 myClone->setWriteBackFile( mWriteBackFile); 57 myClone->setWriteBackFile( mWriteBackFile);
58 myClone->setWriteBackFuture( mWriteBackFuture );
59 myClone->setWriteBackFutureWeeks( mWriteBackFutureWeeks );
54 myClone->setIncludeInRingSync( mIncludeInRingSync ); 60 myClone->setIncludeInRingSync( mIncludeInRingSync );
55 myClone->setIncludeInRingSyncAB( mIncludeInRingSyncAB ); 61 myClone->setIncludeInRingSyncAB( mIncludeInRingSyncAB );
56 myClone->setSyncPrefs( mSyncPrefs); 62 myClone->setSyncPrefs( mSyncPrefs);
57 myClone->setIsLocalFileSync( mIsLocalFileSync ); 63 myClone->setIsLocalFileSync( mIsLocalFileSync );
58 myClone->setName( "noName" ); 64 myClone->setName( "noName" );
59 return myClone; 65 return myClone;
60} 66}
61 67
62 68
63void KSyncProfile::setDefault() 69void KSyncProfile::setDefault()
64{ 70{
65 mName = "noName"; 71 mName = "noName";
66 mPreSyncCommand = i18n("command for downloading remote file to local device"); 72 mPreSyncCommand = i18n("command for downloading remote file to local device");
67 mPostSyncCommand = i18n("command for uploading local temp file to remote device"); 73 mPostSyncCommand = i18n("command for uploading local temp file to remote device");
68 mLocalTempFile = "/tmp/mycalendar.ics"; 74 mLocalTempFile = "/tmp/mycalendar.ics";
69 mRemoteFileName = "/home/polo/kdepim/apps/korganizer/localfile.ics"; 75 mRemoteFileName = "/home/polo/kdepim/apps/korganizer/localfile.ics";
76 mPreSyncCommandAB = i18n("command for downloading remote file to local device");
77 mPostSyncCommandAB = i18n("command for uploading local temp file to remote device");
78 mLocalTempFileAB = "/tmp/std.vcf";
79 mRemoteFileNameAB = "/home/polo/kdepim/apps/kabc/localfile.vcf";
70 mShowSummaryAfterSync = true; 80 mShowSummaryAfterSync = true;
71 mAskForPreferences = true; 81 mAskForPreferences = true;
72 mWriteBackExisting = false; 82 mWriteBackExisting = false;
83 mWriteBackFuture = false;
84 mWriteBackFutureWeeks = 12;
73 mWriteBackFile = true; 85 mWriteBackFile = true;
74 mIncludeInRingSync = false; 86 mIncludeInRingSync = false;
75 mIncludeInRingSyncAB = false; 87 mIncludeInRingSyncAB = false;
76 mSyncPrefs = SYNC_PREF_ASK; 88 mSyncPrefs = SYNC_PREF_ASK;
77 mIsLocalFileSync = true; 89 mIsLocalFileSync = true;
78 90
79} 91}
80void KSyncProfile::readConfig(KConfig *config ) 92void KSyncProfile::readConfig(KConfig *config )
81{ 93{
82 config->setGroup("SyncProfiles"); 94 config->setGroup("SyncProfiles");
83 QString prefix = "Profile_"+mName+"_"; 95 QString prefix = "Profile_"+mName+"_";
84 //mName = config->readEntry( prefix+ "Name", mName ); 96 //mName = config->readEntry( prefix+ "Name", mName );
85 mPreSyncCommand = config->readEntry( prefix+ "PreSyncCommand",mPreSyncCommand ); 97 mPreSyncCommand = config->readEntry( prefix+ "PreSyncCommand",mPreSyncCommand );
86 mPostSyncCommand = config->readEntry( prefix+ "PostSyncCommand", mPostSyncCommand ); 98 mPostSyncCommand = config->readEntry( prefix+ "PostSyncCommand", mPostSyncCommand );;
87 mIncludeInRingSync = config->readBoolEntry( prefix+ "IncludeInRingSync",mIncludeInRingSync );
88 mIncludeInRingSyncAB = config->readBoolEntry( prefix+ "IncludeInRingSyncAB",mIncludeInRingSyncAB );
89 mLocalTempFile = config->readEntry( prefix+ "LocalTempFile", mLocalTempFile ); 99 mLocalTempFile = config->readEntry( prefix+ "LocalTempFile", mLocalTempFile );
90 mRemoteFileName = config->readEntry( prefix+ "RemoteFileName", mRemoteFileName ); 100 mRemoteFileName = config->readEntry( prefix+ "RemoteFileName", mRemoteFileName );
101
102 mPreSyncCommandAB = config->readEntry( prefix+ "PreSyncCommandAB",mPreSyncCommandAB );
103 mPostSyncCommandAB = config->readEntry( prefix+ "PostSyncCommandAB", mPostSyncCommandAB );
104 mLocalTempFileAB = config->readEntry( prefix+ "LocalTempFileAB", mLocalTempFileAB );
105 mRemoteFileNameAB = config->readEntry( prefix+ "RemoteFileNameAB", mRemoteFileNameAB );
106
107 mIncludeInRingSync = config->readBoolEntry( prefix+ "IncludeInRingSync",mIncludeInRingSync );
108 mIncludeInRingSyncAB = config->readBoolEntry( prefix+ "IncludeInRingSyncAB",mIncludeInRingSyncAB );
91 mShowSummaryAfterSync = config->readBoolEntry( prefix+ "ShowSummaryAfterSync", mShowSummaryAfterSync ); 109 mShowSummaryAfterSync = config->readBoolEntry( prefix+ "ShowSummaryAfterSync", mShowSummaryAfterSync );
92 mAskForPreferences = config->readBoolEntry( prefix+ "AskForPreferences",mAskForPreferences ); 110 mAskForPreferences = config->readBoolEntry( prefix+ "AskForPreferences",mAskForPreferences );
93 mWriteBackExisting = config->readBoolEntry( prefix+ "WriteBackExisting",mWriteBackExisting ); 111 mWriteBackExisting = config->readBoolEntry( prefix+ "WriteBackExisting",mWriteBackExisting );
112 mWriteBackFuture = config->readBoolEntry( prefix+ "WriteBackFuture",mWriteBackFuture );
94 mSyncPrefs = config->readNumEntry( prefix+ "SyncPrefs", mSyncPrefs ); 113 mSyncPrefs = config->readNumEntry( prefix+ "SyncPrefs", mSyncPrefs );
114 mWriteBackFutureWeeks = config->readNumEntry( prefix+ "WriteBackFutureWeeks", mWriteBackFutureWeeks );
95 mIsLocalFileSync= config->readBoolEntry( prefix+ "IsLocalFileSync", mIsLocalFileSync ); 115 mIsLocalFileSync= config->readBoolEntry( prefix+ "IsLocalFileSync", mIsLocalFileSync );
96} 116}
97void KSyncProfile::writeConfig( KConfig * config ) 117void KSyncProfile::writeConfig( KConfig * config )
98{ 118{
99 config->setGroup("SyncProfiles"); 119 config->setGroup("SyncProfiles");
100 QString prefix = "Profile_"+mName+"_"; 120 QString prefix = "Profile_"+mName+"_";
101 // config->writeEntry( prefix+ "Name", mName ); 121 // config->writeEntry( prefix+ "Name", mName );
102 config->writeEntry( prefix+ "PreSyncCommand",mPreSyncCommand ); 122 config->writeEntry( prefix+ "PreSyncCommand",mPreSyncCommand );
103 config->writeEntry( prefix+ "PostSyncCommand", mPostSyncCommand ); 123 config->writeEntry( prefix+ "PostSyncCommand", mPostSyncCommand );
104 config->writeEntry( prefix+ "IncludeInRingSync",mIncludeInRingSync );
105 config->writeEntry( prefix+ "IncludeInRingSyncAB",mIncludeInRingSyncAB );
106 config->writeEntry( prefix+ "LocalTempFile", mLocalTempFile ); 124 config->writeEntry( prefix+ "LocalTempFile", mLocalTempFile );
107 config->writeEntry( prefix+ "RemoteFileName", mRemoteFileName ); 125 config->writeEntry( prefix+ "RemoteFileName", mRemoteFileName );
126
127 config->writeEntry( prefix+ "PreSyncCommandAB",mPreSyncCommandAB );
128 config->writeEntry( prefix+ "PostSyncCommandAB", mPostSyncCommandAB );
129 config->writeEntry( prefix+ "LocalTempFileAB", mLocalTempFileAB );
130 config->writeEntry( prefix+ "RemoteFileNameAB", mRemoteFileNameAB );
131 config->writeEntry( prefix+ "IncludeInRingSync",mIncludeInRingSync );
132 config->writeEntry( prefix+ "IncludeInRingSyncAB",mIncludeInRingSyncAB );
108 config->writeEntry( prefix+ "ShowSummaryAfterSync", mShowSummaryAfterSync ); 133 config->writeEntry( prefix+ "ShowSummaryAfterSync", mShowSummaryAfterSync );
109 config->writeEntry( prefix+ "AskForPreferences",mAskForPreferences ); 134 config->writeEntry( prefix+ "AskForPreferences",mAskForPreferences );
110 config->writeEntry( prefix+ "WriteBackExisting",mWriteBackExisting ); 135 config->writeEntry( prefix+ "WriteBackExisting",mWriteBackExisting );
136 config->writeEntry( prefix+ "WriteBackFuture",mWriteBackFuture );
111 config->writeEntry( prefix+ "SyncPrefs", mSyncPrefs ); 137 config->writeEntry( prefix+ "SyncPrefs", mSyncPrefs );
138 config->writeEntry( prefix+ "WriteBackFutureWeeks", mWriteBackFutureWeeks);
112 config->writeEntry( prefix+ "IsLocalFileSync", mIsLocalFileSync ); 139 config->writeEntry( prefix+ "IsLocalFileSync", mIsLocalFileSync );
113} 140}
114 141
115/* 142/*
116class KPrefsItemInt : public KPrefsItem { 143class KPrefsItemInt : public KPrefsItem {
117 public: 144 public:
118 KPrefsItemInt(const QString &group,const QString &name,int *,int defaultValue=0); 145 KPrefsItemInt(const QString &group,const QString &name,int *,int defaultValue=0);
119 virtual ~KPrefsItemInt() {} 146 virtual ~KPrefsItemInt() {}
120 147
121 void setDefault(); 148 void setDefault();
122 void readConfig(KConfig *); 149 void readConfig(KConfig *);
123 void writeConfig(KConfig *); 150 void writeConfig(KConfig *);
124 151
125 private: 152 private:
126 int *mReference; 153 int *mReference;
127 int mDefault; 154 int mDefault;
128}; 155};
129*/ 156*/
diff --git a/libkdepim/ksyncprofile.h b/libkdepim/ksyncprofile.h
index df1b49e..80094b1 100644
--- a/libkdepim/ksyncprofile.h
+++ b/libkdepim/ksyncprofile.h
@@ -14,92 +14,111 @@
14 14
15 You should have received a copy of the GNU Library General Public License 15 You should have received a copy of the GNU Library General Public License
16 along with this library; see the file COPYING.LIB. If not, write to 16 along with this library; see the file COPYING.LIB. If not, write to
17 the Free Software Foundation, Inc., 59 Temple Place - Suite 330, 17 the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
18 Boston, MA 02111-1307, USA. 18 Boston, MA 02111-1307, USA.
19*/ 19*/
20#ifndef _KSYNCPROFILE_H 20#ifndef _KSYNCPROFILE_H
21#define _KSYNCPROFILE_H 21#define _KSYNCPROFILE_H
22 22
23#include <qptrlist.h> 23#include <qptrlist.h>
24#include <qcolor.h> 24#include <qcolor.h>
25#include <qfont.h> 25#include <qfont.h>
26#include <qstringlist.h> 26#include <qstringlist.h>
27#include <qobject.h> 27#include <qobject.h>
28#include <qstring.h> 28#include <qstring.h>
29 29
30#include <libkcal/syncdefines.h> 30#include <libkcal/syncdefines.h>
31 31
32 32
33 33
34class KConfig; 34class KConfig;
35 35
36/** 36/**
37 @short Class for storing a preferences setting 37 @short Class for storing a preferences setting
38 @author Cornelius Schumacher 38 @author Cornelius Schumacher
39 @see KPref 39 @see KPref
40 40
41 This class represents one preferences setting as used by @ref KPrefs. 41 This class represents one preferences setting as used by @ref KPrefs.
42 Subclasses of KPrefsItem implement storage functions for a certain type of 42 Subclasses of KPrefsItem implement storage functions for a certain type of
43 setting. Normally you don't have to use this class directly. Use the special 43 setting. Normally you don't have to use this class directly. Use the special
44 addItem() functions of KPrefs instead. If you subclass this class you will 44 addItem() functions of KPrefs instead. If you subclass this class you will
45 have to register instances with the function KPrefs::addItem(). 45 have to register instances with the function KPrefs::addItem().
46*/ 46*/
47class KSyncProfile : public QObject { 47class KSyncProfile : public QObject {
48 public: 48 public:
49 KSyncProfile( const char * name = 0); 49 KSyncProfile( const char * name = 0);
50 ~KSyncProfile() ; 50 ~KSyncProfile() ;
51 51
52 KSyncProfile* clone(); 52 KSyncProfile* clone();
53 void setDefault(); 53 void setDefault();
54 void readConfig(KConfig *); 54 void readConfig(KConfig *);
55 void writeConfig(KConfig *); 55 void writeConfig(KConfig *);
56 void setName( const QString& n ) {mName = n;} 56 void setName( const QString& n ) {mName = n;}
57 QString getName( ) { return mName;} 57 QString getName( ) { return mName;}
58 void setPreSyncCommand( const QString& n ) {mPreSyncCommand = n;} 58 void setPreSyncCommand( const QString& n ) {mPreSyncCommand = n;}
59 QString getPreSyncCommand( ) { return mPreSyncCommand; } 59 QString getPreSyncCommand( ) { return mPreSyncCommand; }
60 void setPostSyncCommand( const QString& n ) {mPostSyncCommand = n;} 60 void setPostSyncCommand( const QString& n ) {mPostSyncCommand = n;}
61 QString getPostSyncCommand( ) { return mPostSyncCommand;} 61 QString getPostSyncCommand( ) { return mPostSyncCommand;}
62
63 void setLocalTempFile( const QString& n ) { mLocalTempFile= n;} 62 void setLocalTempFile( const QString& n ) { mLocalTempFile= n;}
64 QString getLocalTempFile( ) { return mLocalTempFile;} 63 QString getLocalTempFile( ) { return mLocalTempFile;}
65 void setRemoteFileName( const QString& n ) { mRemoteFileName = n;} 64 void setRemoteFileName( const QString& n ) { mRemoteFileName = n;}
66 QString getRemoteFileName( ) { return mRemoteFileName;} 65 QString getRemoteFileName( ) { return mRemoteFileName;}
66
67 void setPreSyncCommandAB( const QString& n ) {mPreSyncCommandAB = n;}
68 QString getPreSyncCommandAB( ) { return mPreSyncCommandAB; }
69 void setPostSyncCommandAB( const QString& n ) {mPostSyncCommandAB = n;}
70 QString getPostSyncCommandAB( ) { return mPostSyncCommandAB;}
71 void setLocalTempFileAB( const QString& n ) { mLocalTempFileAB= n;}
72 QString getLocalTempFileAB( ) { return mLocalTempFileAB;}
73 void setRemoteFileNameAB( const QString& n ) { mRemoteFileNameAB = n;}
74 QString getRemoteFileNameAB( ) { return mRemoteFileNameAB;}
75
67 /* 76 /*
68 void set( const QString& n ) { = n;} 77 void set( const QString& n ) { = n;}
69 QString get( ) { return ;} 78 QString get( ) { return ;}
70 */ 79 */
71 80
72 void setShowSummaryAfterSync( bool b ) { mShowSummaryAfterSync = b;} 81 void setShowSummaryAfterSync( bool b ) { mShowSummaryAfterSync = b;}
73 bool getShowSummaryAfterSync( ) { return mShowSummaryAfterSync ;} 82 bool getShowSummaryAfterSync( ) { return mShowSummaryAfterSync ;}
74 void setAskForPreferences( bool b ) { mAskForPreferences= b;} 83 void setAskForPreferences( bool b ) { mAskForPreferences= b;}
75 bool getAskForPreferences( ) { return mAskForPreferences;} 84 bool getAskForPreferences( ) { return mAskForPreferences;}
76 void setWriteBackExisting( bool b ) { mWriteBackExisting = b;} 85 void setWriteBackExisting( bool b ) { mWriteBackExisting = b;}
77 bool getWriteBackExisting( ) { return mWriteBackExisting;} 86 bool getWriteBackExisting( ) { return mWriteBackExisting;}
87 void setWriteBackFuture( bool b ) { mWriteBackFuture = b;}
88 bool getWriteBackFuture( ) { return mWriteBackFuture;}
78 void setWriteBackFile( bool b ) { mWriteBackFile= b;} 89 void setWriteBackFile( bool b ) { mWriteBackFile= b;}
79 bool getWriteBackFile( ) { return mWriteBackFile;} 90 bool getWriteBackFile( ) { return mWriteBackFile;}
80 void setIncludeInRingSync( bool b ) {mIncludeInRingSync = b;} 91 void setIncludeInRingSync( bool b ) {mIncludeInRingSync = b;}
81 bool getIncludeInRingSync( ) { return mIncludeInRingSync;} 92 bool getIncludeInRingSync( ) { return mIncludeInRingSync;}
82 void setIncludeInRingSyncAB( bool b ) {mIncludeInRingSyncAB = b;} 93 void setIncludeInRingSyncAB( bool b ) {mIncludeInRingSyncAB = b;}
83 bool getIncludeInRingSyncAB( ) { return mIncludeInRingSyncAB;} 94 bool getIncludeInRingSyncAB( ) { return mIncludeInRingSyncAB;}
84 void setSyncPrefs( int n ) { mSyncPrefs= n;} 95 void setSyncPrefs( int n ) { mSyncPrefs= n;}
85 int getSyncPrefs( ) { return mSyncPrefs;} 96 int getSyncPrefs( ) { return mSyncPrefs;}
97 void setWriteBackFutureWeeks( int n ) { mWriteBackFutureWeeks= n;}
98 int getWriteBackFutureWeeks( ) { return mWriteBackFutureWeeks;}
86 void setIsLocalFileSync( bool b ) { mIsLocalFileSync= b;} 99 void setIsLocalFileSync( bool b ) { mIsLocalFileSync= b;}
87 bool getIsLocalFileSync( ) { return mIsLocalFileSync;} 100 bool getIsLocalFileSync( ) { return mIsLocalFileSync;}
88 101
89 private: 102 private:
90 QString mName; 103 QString mName;
91 QString mPreSyncCommand; 104 QString mPreSyncCommand;
92 QString mPostSyncCommand; 105 QString mPostSyncCommand;
93 QString mLocalTempFile; 106 QString mLocalTempFile;
94 QString mRemoteFileName; 107 QString mRemoteFileName;
108 QString mPreSyncCommandAB;
109 QString mPostSyncCommandAB;
110 QString mLocalTempFileAB;
111 QString mRemoteFileNameAB;
95 bool mIncludeInRingSync; 112 bool mIncludeInRingSync;
96 bool mIncludeInRingSyncAB; 113 bool mIncludeInRingSyncAB;
97 int mSyncPrefs; 114 int mSyncPrefs;
98 bool mWriteBackFile; 115 bool mWriteBackFile;
99 bool mWriteBackExisting; 116 bool mWriteBackExisting;
117 bool mWriteBackFuture;
118 int mWriteBackFutureWeeks;
100 bool mAskForPreferences; 119 bool mAskForPreferences;
101 bool mShowSummaryAfterSync; 120 bool mShowSummaryAfterSync;
102 bool mIsLocalFileSync; 121 bool mIsLocalFileSync;
103}; 122};
104 123
105#endif 124#endif