summaryrefslogtreecommitdiffabout
authorzautrix <zautrix>2004-08-01 13:59:52 (UTC)
committer zautrix <zautrix>2004-08-01 13:59:52 (UTC)
commit43d6cf3619675856333d82ae2fcad6ce81d824b8 (patch) (unidiff)
tree40629720fce9e0840fc4ab50ab1ef746a7c07375
parent47a3a79ddde4ab63d34ddb0ffaa92d65f04de8ad (diff)
downloadkdepimpi-43d6cf3619675856333d82ae2fcad6ce81d824b8.zip
kdepimpi-43d6cf3619675856333d82ae2fcad6ce81d824b8.tar.gz
kdepimpi-43d6cf3619675856333d82ae2fcad6ce81d824b8.tar.bz2
fixed sync config
Diffstat (more/less context) (ignore whitespace changes)
-rw-r--r--korganizer/calendarview.cpp1
-rw-r--r--korganizer/mainwindow.cpp4
-rw-r--r--libkdepim/ksyncprefsdialog.cpp5
3 files changed, 7 insertions, 3 deletions
diff --git a/korganizer/calendarview.cpp b/korganizer/calendarview.cpp
index 387b751..cfc6b10 100644
--- a/korganizer/calendarview.cpp
+++ b/korganizer/calendarview.cpp
@@ -180,1025 +180,1024 @@ class KOCatPrefs : public QDialog
180 lay->addWidget( lab ); 180 lay->addWidget( lab );
181 QButtonGroup* format = new QButtonGroup( 1, Horizontal, i18n("New categories not in list:"), this ); 181 QButtonGroup* format = new QButtonGroup( 1, Horizontal, i18n("New categories not in list:"), this );
182 lay->addWidget( format ); 182 lay->addWidget( format );
183 format->setExclusive ( true ) ; 183 format->setExclusive ( true ) ;
184 addCatBut = new QRadioButton(i18n("Add to category list"), format ); 184 addCatBut = new QRadioButton(i18n("Add to category list"), format );
185 new QRadioButton(i18n("Remove from Events/Todos"), format ); 185 new QRadioButton(i18n("Remove from Events/Todos"), format );
186 addCatBut->setChecked( true ); 186 addCatBut->setChecked( true );
187 QPushButton * ok = new QPushButton( i18n("OK"), this ); 187 QPushButton * ok = new QPushButton( i18n("OK"), this );
188 lay->addWidget( ok ); 188 lay->addWidget( ok );
189 QPushButton * cancel = new QPushButton( i18n("Cancel"), this ); 189 QPushButton * cancel = new QPushButton( i18n("Cancel"), this );
190 lay->addWidget( cancel ); 190 lay->addWidget( cancel );
191 connect ( ok,SIGNAL(clicked() ),this , SLOT ( accept() ) ); 191 connect ( ok,SIGNAL(clicked() ),this , SLOT ( accept() ) );
192 connect (cancel, SIGNAL(clicked() ), this, SLOT ( reject()) ); 192 connect (cancel, SIGNAL(clicked() ), this, SLOT ( reject()) );
193 resize( 200, 200 ); 193 resize( 200, 200 );
194 } 194 }
195 195
196 bool addCat() { return addCatBut->isChecked(); } 196 bool addCat() { return addCatBut->isChecked(); }
197private: 197private:
198 QRadioButton* addCatBut; 198 QRadioButton* addCatBut;
199}; 199};
200 200
201 201
202 202
203CalendarView::CalendarView( CalendarResources *calendar, 203CalendarView::CalendarView( CalendarResources *calendar,
204 QWidget *parent, const char *name ) 204 QWidget *parent, const char *name )
205 : CalendarViewBase( parent, name ), 205 : CalendarViewBase( parent, name ),
206 mCalendar( calendar ), 206 mCalendar( calendar ),
207 mResourceManager( calendar->resourceManager() ) 207 mResourceManager( calendar->resourceManager() )
208{ 208{
209 209
210 mEventEditor = 0; 210 mEventEditor = 0;
211 mTodoEditor = 0; 211 mTodoEditor = 0;
212 212
213 init(); 213 init();
214} 214}
215 215
216CalendarView::CalendarView( Calendar *calendar, 216CalendarView::CalendarView( Calendar *calendar,
217 QWidget *parent, const char *name ) 217 QWidget *parent, const char *name )
218 : CalendarViewBase( parent, name ), 218 : CalendarViewBase( parent, name ),
219 mCalendar( calendar ), 219 mCalendar( calendar ),
220 mResourceManager( 0 ) 220 mResourceManager( 0 )
221{ 221{
222 222
223 mEventEditor = 0; 223 mEventEditor = 0;
224 mTodoEditor = 0; 224 mTodoEditor = 0;
225 init();} 225 init();}
226 226
227void CalendarView::init() 227void CalendarView::init()
228{ 228{
229 beamDialog = new KOBeamPrefs(); 229 beamDialog = new KOBeamPrefs();
230 mDatePickerMode = 0; 230 mDatePickerMode = 0;
231 mCurrentSyncDevice = ""; 231 mCurrentSyncDevice = "";
232 writeLocale(); 232 writeLocale();
233 mViewManager = new KOViewManager( this ); 233 mViewManager = new KOViewManager( this );
234 mDialogManager = new KODialogManager( this ); 234 mDialogManager = new KODialogManager( this );
235 mEventViewerDialog = 0; 235 mEventViewerDialog = 0;
236 mModified = false; 236 mModified = false;
237 mReadOnly = false; 237 mReadOnly = false;
238 mSelectedIncidence = 0; 238 mSelectedIncidence = 0;
239 mCalPrinter = 0; 239 mCalPrinter = 0;
240 mFilters.setAutoDelete(true); 240 mFilters.setAutoDelete(true);
241 241
242 mCalendar->registerObserver( this ); 242 mCalendar->registerObserver( this );
243 // TODO: Make sure that view is updated, when calendar is changed. 243 // TODO: Make sure that view is updated, when calendar is changed.
244 244
245 mStorage = new FileStorage( mCalendar ); 245 mStorage = new FileStorage( mCalendar );
246 mNavigator = new DateNavigator( this, "datevav", mViewManager ); 246 mNavigator = new DateNavigator( this, "datevav", mViewManager );
247 247
248 QBoxLayout *topLayout = (QBoxLayout*)layout(); 248 QBoxLayout *topLayout = (QBoxLayout*)layout();
249#ifndef KORG_NOSPLITTER 249#ifndef KORG_NOSPLITTER
250 // create the main layout frames. 250 // create the main layout frames.
251 mPanner = new QSplitter(QSplitter::Horizontal,this,"CalendarView::Panner"); 251 mPanner = new QSplitter(QSplitter::Horizontal,this,"CalendarView::Panner");
252 topLayout->addWidget(mPanner); 252 topLayout->addWidget(mPanner);
253 253
254 mLeftSplitter = new QSplitter(QSplitter::Vertical,mPanner, 254 mLeftSplitter = new QSplitter(QSplitter::Vertical,mPanner,
255 "CalendarView::LeftFrame"); 255 "CalendarView::LeftFrame");
256 mPanner->setResizeMode(mLeftSplitter,QSplitter::KeepSize); 256 mPanner->setResizeMode(mLeftSplitter,QSplitter::KeepSize);
257 257
258 mDateNavigator = new KDateNavigator(mLeftSplitter, mCalendar, TRUE, 258 mDateNavigator = new KDateNavigator(mLeftSplitter, mCalendar, TRUE,
259 "CalendarView::DateNavigator", QDate::currentDate() ); 259 "CalendarView::DateNavigator", QDate::currentDate() );
260 mLeftSplitter->setResizeMode(mDateNavigator,QSplitter::KeepSize); 260 mLeftSplitter->setResizeMode(mDateNavigator,QSplitter::KeepSize);
261 mTodoList = new KOTodoView(mCalendar, mLeftSplitter, "todolist_small2"); 261 mTodoList = new KOTodoView(mCalendar, mLeftSplitter, "todolist_small2");
262 mFilterView = new KOFilterView(&mFilters,mLeftSplitter,"CalendarView::FilterView"); 262 mFilterView = new KOFilterView(&mFilters,mLeftSplitter,"CalendarView::FilterView");
263 263
264#ifdef KORG_NORESOURCEVIEW 264#ifdef KORG_NORESOURCEVIEW
265 mResourceView = 0; 265 mResourceView = 0;
266#else 266#else
267 if ( mResourceManager ) { 267 if ( mResourceManager ) {
268 mResourceView = new ResourceView( mResourceManager, mLeftSplitter ); 268 mResourceView = new ResourceView( mResourceManager, mLeftSplitter );
269 mResourceView->updateView(); 269 mResourceView->updateView();
270 connect( mResourceView, SIGNAL( resourcesChanged() ), 270 connect( mResourceView, SIGNAL( resourcesChanged() ),
271 SLOT( updateView() ) ); 271 SLOT( updateView() ) );
272 } else { 272 } else {
273 mResourceView = 0; 273 mResourceView = 0;
274 } 274 }
275#endif 275#endif
276 QWidget *rightBox = new QWidget( mPanner ); 276 QWidget *rightBox = new QWidget( mPanner );
277 QBoxLayout *rightLayout = new QVBoxLayout( rightBox ); 277 QBoxLayout *rightLayout = new QVBoxLayout( rightBox );
278 278
279 mNavigatorBar = new NavigatorBar( QDate::currentDate(), rightBox, "useBigPixmaps" ); 279 mNavigatorBar = new NavigatorBar( QDate::currentDate(), rightBox, "useBigPixmaps" );
280 rightLayout->addWidget( mNavigatorBar ); 280 rightLayout->addWidget( mNavigatorBar );
281 281
282 mRightFrame = new QWidgetStack( rightBox ); 282 mRightFrame = new QWidgetStack( rightBox );
283 rightLayout->addWidget( mRightFrame, 1 ); 283 rightLayout->addWidget( mRightFrame, 1 );
284 284
285 mLeftFrame = mLeftSplitter; 285 mLeftFrame = mLeftSplitter;
286#else 286#else
287 QWidget *mainBox = new QWidget( this ); 287 QWidget *mainBox = new QWidget( this );
288 QWidget *leftFrame = new QWidget( mainBox ); 288 QWidget *leftFrame = new QWidget( mainBox );
289 289
290 QBoxLayout * mainBoxLayout; 290 QBoxLayout * mainBoxLayout;
291 QBoxLayout * leftFrameLayout; 291 QBoxLayout * leftFrameLayout;
292 if ( KOPrefs::instance()->mVerticalScreen ) { 292 if ( KOPrefs::instance()->mVerticalScreen ) {
293 mainBoxLayout = new QVBoxLayout(mainBox); 293 mainBoxLayout = new QVBoxLayout(mainBox);
294 leftFrameLayout = new QHBoxLayout(leftFrame ); 294 leftFrameLayout = new QHBoxLayout(leftFrame );
295 } else { 295 } else {
296 mainBoxLayout = new QHBoxLayout(mainBox); 296 mainBoxLayout = new QHBoxLayout(mainBox);
297 leftFrameLayout = new QVBoxLayout(leftFrame ); 297 leftFrameLayout = new QVBoxLayout(leftFrame );
298 } 298 }
299 topLayout->addWidget( mainBox ); 299 topLayout->addWidget( mainBox );
300 mainBoxLayout->addWidget (leftFrame); 300 mainBoxLayout->addWidget (leftFrame);
301 mDateNavigator = new KDateNavigator(leftFrame, mCalendar, TRUE, 301 mDateNavigator = new KDateNavigator(leftFrame, mCalendar, TRUE,
302 "CalendarView::DateNavigator", QDate::currentDate()); 302 "CalendarView::DateNavigator", QDate::currentDate());
303 // mDateNavigator->blockSignals( true ); 303 // mDateNavigator->blockSignals( true );
304 leftFrameLayout->addWidget( mDateNavigator ); 304 leftFrameLayout->addWidget( mDateNavigator );
305 mFilterView = new KOFilterView(&mFilters,leftFrame,"CalendarView::FilterView"); 305 mFilterView = new KOFilterView(&mFilters,leftFrame,"CalendarView::FilterView");
306 mTodoList = new KOTodoView(mCalendar, leftFrame, "todolist"); 306 mTodoList = new KOTodoView(mCalendar, leftFrame, "todolist");
307 307
308 if ( QApplication::desktop()->width() < 480 ) { 308 if ( QApplication::desktop()->width() < 480 ) {
309 leftFrameLayout->addWidget(mFilterView); 309 leftFrameLayout->addWidget(mFilterView);
310 leftFrameLayout->addWidget(mTodoList, 2 ); 310 leftFrameLayout->addWidget(mTodoList, 2 );
311 311
312 } else { 312 } else {
313 leftFrameLayout->addWidget(mTodoList,2 ); 313 leftFrameLayout->addWidget(mTodoList,2 );
314 leftFrameLayout->addWidget(mFilterView ); 314 leftFrameLayout->addWidget(mFilterView );
315 } 315 }
316 mFilterView->hide(); 316 mFilterView->hide();
317 QWidget *rightBox = new QWidget( mainBox ); 317 QWidget *rightBox = new QWidget( mainBox );
318 mainBoxLayout->addWidget ( rightBox, 10 ); 318 mainBoxLayout->addWidget ( rightBox, 10 );
319 QBoxLayout *rightLayout = new QVBoxLayout( rightBox ); 319 QBoxLayout *rightLayout = new QVBoxLayout( rightBox );
320 mNavigatorBar = new NavigatorBar( QDate::currentDate(), rightBox, "useBigPixmaps" ); 320 mNavigatorBar = new NavigatorBar( QDate::currentDate(), rightBox, "useBigPixmaps" );
321 mRightFrame = new QWidgetStack( rightBox ); 321 mRightFrame = new QWidgetStack( rightBox );
322 rightLayout->addWidget( mNavigatorBar ); 322 rightLayout->addWidget( mNavigatorBar );
323 rightLayout->addWidget( mRightFrame, 10 ); 323 rightLayout->addWidget( mRightFrame, 10 );
324 324
325 mLeftFrame = leftFrame; 325 mLeftFrame = leftFrame;
326 if ( KOPrefs::instance()->mVerticalScreen ) { 326 if ( KOPrefs::instance()->mVerticalScreen ) {
327 mTodoList->setFixedHeight( mDateNavigator->sizeHint().height() ); 327 mTodoList->setFixedHeight( mDateNavigator->sizeHint().height() );
328 leftFrame->setFixedHeight( mDateNavigator->sizeHint().height() ); 328 leftFrame->setFixedHeight( mDateNavigator->sizeHint().height() );
329 } else { 329 } else {
330 mTodoList->setFixedWidth( mDateNavigator->sizeHint().width() ); 330 mTodoList->setFixedWidth( mDateNavigator->sizeHint().width() );
331 leftFrame->setFixedWidth( mDateNavigator->sizeHint().width() ); 331 leftFrame->setFixedWidth( mDateNavigator->sizeHint().width() );
332 } 332 }
333 333
334 //qDebug("Calendarview Size %d %d ", width(), height()); 334 //qDebug("Calendarview Size %d %d ", width(), height());
335#endif 335#endif
336 336
337 connect( mNavigator, SIGNAL( datesSelected( const KCal::DateList & ) ), 337 connect( mNavigator, SIGNAL( datesSelected( const KCal::DateList & ) ),
338 SLOT( showDates( const KCal::DateList & ) ) ); 338 SLOT( showDates( const KCal::DateList & ) ) );
339 connect( mNavigator, SIGNAL( datesSelected( const KCal::DateList & ) ), 339 connect( mNavigator, SIGNAL( datesSelected( const KCal::DateList & ) ),
340 mDateNavigator, SLOT( selectDates( const KCal::DateList & ) ) ); 340 mDateNavigator, SLOT( selectDates( const KCal::DateList & ) ) );
341 341
342 connect( mNavigatorBar, SIGNAL( goPrevYear() ), 342 connect( mNavigatorBar, SIGNAL( goPrevYear() ),
343 mNavigator, SLOT( selectPreviousYear() ) ); 343 mNavigator, SLOT( selectPreviousYear() ) );
344 connect( mNavigatorBar, SIGNAL( goNextYear() ), 344 connect( mNavigatorBar, SIGNAL( goNextYear() ),
345 mNavigator, SLOT( selectNextYear() ) ); 345 mNavigator, SLOT( selectNextYear() ) );
346 connect( mNavigatorBar, SIGNAL( goPrevMonth() ), 346 connect( mNavigatorBar, SIGNAL( goPrevMonth() ),
347 mNavigator, SLOT( selectPreviousMonth() ) ); 347 mNavigator, SLOT( selectPreviousMonth() ) );
348 connect( mNavigatorBar, SIGNAL( goNextMonth() ), 348 connect( mNavigatorBar, SIGNAL( goNextMonth() ),
349 mNavigator, SLOT( selectNextMonth() ) ); 349 mNavigator, SLOT( selectNextMonth() ) );
350 350
351 connect( mNavigator, SIGNAL( datesSelected( const KCal::DateList & ) ), 351 connect( mNavigator, SIGNAL( datesSelected( const KCal::DateList & ) ),
352 mNavigatorBar, SLOT( selectDates( const KCal::DateList & ) ) ); 352 mNavigatorBar, SLOT( selectDates( const KCal::DateList & ) ) );
353 353
354 connect( mDateNavigator, SIGNAL( weekClicked( const QDate & ) ), 354 connect( mDateNavigator, SIGNAL( weekClicked( const QDate & ) ),
355 mNavigator, SLOT( selectWeek( const QDate & ) ) ); 355 mNavigator, SLOT( selectWeek( const QDate & ) ) );
356 356
357 connect( mDateNavigator, SIGNAL( goPrevYear() ), 357 connect( mDateNavigator, SIGNAL( goPrevYear() ),
358 mNavigator, SLOT( selectPreviousYear() ) ); 358 mNavigator, SLOT( selectPreviousYear() ) );
359 connect( mDateNavigator, SIGNAL( goNextYear() ), 359 connect( mDateNavigator, SIGNAL( goNextYear() ),
360 mNavigator, SLOT( selectNextYear() ) ); 360 mNavigator, SLOT( selectNextYear() ) );
361 connect( mDateNavigator, SIGNAL( goPrevMonth() ), 361 connect( mDateNavigator, SIGNAL( goPrevMonth() ),
362 mNavigator, SLOT( selectPreviousMonth() ) ); 362 mNavigator, SLOT( selectPreviousMonth() ) );
363 connect( mDateNavigator, SIGNAL( goNextMonth() ), 363 connect( mDateNavigator, SIGNAL( goNextMonth() ),
364 mNavigator, SLOT( selectNextMonth() ) ); 364 mNavigator, SLOT( selectNextMonth() ) );
365 365
366 connect( mDateNavigator, SIGNAL( goPrevious() ), 366 connect( mDateNavigator, SIGNAL( goPrevious() ),
367 mNavigator, SLOT( selectPrevious() ) ); 367 mNavigator, SLOT( selectPrevious() ) );
368 connect( mDateNavigator, SIGNAL( goNext() ), 368 connect( mDateNavigator, SIGNAL( goNext() ),
369 mNavigator, SLOT( selectNext() ) ); 369 mNavigator, SLOT( selectNext() ) );
370 connect( mDateNavigator, SIGNAL( monthSelected ( int ) ), 370 connect( mDateNavigator, SIGNAL( monthSelected ( int ) ),
371 mNavigator, SLOT( slotMonthSelect( int ) ) ); 371 mNavigator, SLOT( slotMonthSelect( int ) ) );
372 connect( mNavigatorBar, SIGNAL( monthSelected ( int ) ), 372 connect( mNavigatorBar, SIGNAL( monthSelected ( int ) ),
373 mNavigator, SLOT( slotMonthSelect( int ) ) ); 373 mNavigator, SLOT( slotMonthSelect( int ) ) );
374 374
375 connect( mDateNavigator, SIGNAL( datesSelected( const KCal::DateList & ) ), 375 connect( mDateNavigator, SIGNAL( datesSelected( const KCal::DateList & ) ),
376 mNavigator, SLOT( selectDates( const KCal::DateList & ) ) ); 376 mNavigator, SLOT( selectDates( const KCal::DateList & ) ) );
377 377
378 connect( mDateNavigator, SIGNAL( eventDropped( Event * ) ), 378 connect( mDateNavigator, SIGNAL( eventDropped( Event * ) ),
379 SLOT( eventAdded( Event *) ) ); 379 SLOT( eventAdded( Event *) ) );
380 380
381 connect(mDateNavigator,SIGNAL(dayPassed(QDate)),SLOT(updateView())); 381 connect(mDateNavigator,SIGNAL(dayPassed(QDate)),SLOT(updateView()));
382 382
383 connect( this, SIGNAL( configChanged() ), 383 connect( this, SIGNAL( configChanged() ),
384 mDateNavigator, SLOT( updateConfig() ) ); 384 mDateNavigator, SLOT( updateConfig() ) );
385 385
386 connect( mTodoList, SIGNAL( newTodoSignal() ), 386 connect( mTodoList, SIGNAL( newTodoSignal() ),
387 SLOT( newTodo() ) ); 387 SLOT( newTodo() ) );
388 connect( mTodoList, SIGNAL( newSubTodoSignal( Todo *) ), 388 connect( mTodoList, SIGNAL( newSubTodoSignal( Todo *) ),
389 SLOT( newSubTodo( Todo * ) ) ); 389 SLOT( newSubTodo( Todo * ) ) );
390 connect( mTodoList, SIGNAL( editTodoSignal( Todo * ) ), 390 connect( mTodoList, SIGNAL( editTodoSignal( Todo * ) ),
391 SLOT( editTodo( Todo * ) ) ); 391 SLOT( editTodo( Todo * ) ) );
392 connect( mTodoList, SIGNAL( showTodoSignal( Todo * ) ), 392 connect( mTodoList, SIGNAL( showTodoSignal( Todo * ) ),
393 SLOT( showTodo( Todo *) ) ); 393 SLOT( showTodo( Todo *) ) );
394 connect( mTodoList, SIGNAL( deleteTodoSignal( Todo *) ), 394 connect( mTodoList, SIGNAL( deleteTodoSignal( Todo *) ),
395 SLOT( deleteTodo( Todo *) ) ); 395 SLOT( deleteTodo( Todo *) ) );
396 connect( this, SIGNAL( configChanged()), mTodoList, SLOT( updateConfig() ) ); 396 connect( this, SIGNAL( configChanged()), mTodoList, SLOT( updateConfig() ) );
397 connect( mTodoList, SIGNAL( purgeCompletedSignal() ), 397 connect( mTodoList, SIGNAL( purgeCompletedSignal() ),
398 SLOT( purgeCompleted() ) ); 398 SLOT( purgeCompleted() ) );
399 connect( mTodoList, SIGNAL( todoModifiedSignal( Todo *, int ) ), 399 connect( mTodoList, SIGNAL( todoModifiedSignal( Todo *, int ) ),
400 SIGNAL( todoModified( Todo *, int ) ) ); 400 SIGNAL( todoModified( Todo *, int ) ) );
401 401
402 connect( mTodoList, SIGNAL( cloneTodoSignal( Incidence * ) ), 402 connect( mTodoList, SIGNAL( cloneTodoSignal( Incidence * ) ),
403 this, SLOT ( cloneIncidence( Incidence * ) ) ); 403 this, SLOT ( cloneIncidence( Incidence * ) ) );
404 connect( mTodoList, SIGNAL( cancelTodoSignal( Incidence * ) ), 404 connect( mTodoList, SIGNAL( cancelTodoSignal( Incidence * ) ),
405 this, SLOT (cancelIncidence( Incidence * ) ) ); 405 this, SLOT (cancelIncidence( Incidence * ) ) );
406 406
407 connect( mTodoList, SIGNAL( moveTodoSignal( Incidence * ) ), 407 connect( mTodoList, SIGNAL( moveTodoSignal( Incidence * ) ),
408 this, SLOT ( moveIncidence( Incidence * ) ) ); 408 this, SLOT ( moveIncidence( Incidence * ) ) );
409 connect( mTodoList, SIGNAL( beamTodoSignal( Incidence * ) ), 409 connect( mTodoList, SIGNAL( beamTodoSignal( Incidence * ) ),
410 this, SLOT ( beamIncidence( Incidence * ) ) ); 410 this, SLOT ( beamIncidence( Incidence * ) ) );
411 411
412 connect( mTodoList, SIGNAL( unparentTodoSignal( Todo * ) ), 412 connect( mTodoList, SIGNAL( unparentTodoSignal( Todo * ) ),
413 this, SLOT ( todo_unsub( Todo * ) ) ); 413 this, SLOT ( todo_unsub( Todo * ) ) );
414 414
415 connect( this, SIGNAL( todoModified( Todo *, int )), mTodoList, 415 connect( this, SIGNAL( todoModified( Todo *, int )), mTodoList,
416 SLOT( updateTodo( Todo *, int ) ) ); 416 SLOT( updateTodo( Todo *, int ) ) );
417 connect( this, SIGNAL( todoModified( Todo *, int )), this, 417 connect( this, SIGNAL( todoModified( Todo *, int )), this,
418 SLOT( changeTodoDisplay( Todo *, int ) ) ); 418 SLOT( changeTodoDisplay( Todo *, int ) ) );
419 419
420 420
421 connect( mFilterView, SIGNAL( filterChanged() ), SLOT( updateFilter() ) ); 421 connect( mFilterView, SIGNAL( filterChanged() ), SLOT( updateFilter() ) );
422 connect( mFilterView, SIGNAL( editFilters() ), SLOT( editFilters() ) ); 422 connect( mFilterView, SIGNAL( editFilters() ), SLOT( editFilters() ) );
423 connect( mCalendar, SIGNAL( addAlarm(const QDateTime &, const QString & ) ), SLOT( addAlarm(const QDateTime &, const QString & ) ) ); 423 connect( mCalendar, SIGNAL( addAlarm(const QDateTime &, const QString & ) ), SLOT( addAlarm(const QDateTime &, const QString & ) ) );
424 connect( mCalendar, SIGNAL( removeAlarm(const QDateTime &, const QString & ) ), SLOT( removeAlarm(const QDateTime &, const QString & ) ) ); 424 connect( mCalendar, SIGNAL( removeAlarm(const QDateTime &, const QString & ) ), SLOT( removeAlarm(const QDateTime &, const QString & ) ) );
425 425
426 426
427 427
428 428
429 429
430 connect(QApplication::clipboard(),SIGNAL(dataChanged()), 430 connect(QApplication::clipboard(),SIGNAL(dataChanged()),
431 SLOT(checkClipboard())); 431 SLOT(checkClipboard()));
432 connect( mTodoList,SIGNAL( incidenceSelected( Incidence * ) ), 432 connect( mTodoList,SIGNAL( incidenceSelected( Incidence * ) ),
433 SLOT( processTodoListSelection( Incidence * ) ) ); 433 SLOT( processTodoListSelection( Incidence * ) ) );
434 connect(mTodoList,SIGNAL(isModified(bool)),SLOT(setModified(bool))); 434 connect(mTodoList,SIGNAL(isModified(bool)),SLOT(setModified(bool)));
435 435
436 // kdDebug() << "CalendarView::CalendarView() done" << endl; 436 // kdDebug() << "CalendarView::CalendarView() done" << endl;
437 437
438 mDateFrame = new QVBox(0,0,WType_Popup); 438 mDateFrame = new QVBox(0,0,WType_Popup);
439 //mDateFrame->setFrameStyle(QFrame::PopupPanel | QFrame::Raised); 439 //mDateFrame->setFrameStyle(QFrame::PopupPanel | QFrame::Raised);
440 mDateFrame->setFrameStyle( QFrame::WinPanel |QFrame::Raised ); 440 mDateFrame->setFrameStyle( QFrame::WinPanel |QFrame::Raised );
441 mDateFrame->setLineWidth(3); 441 mDateFrame->setLineWidth(3);
442 mDateFrame->hide(); 442 mDateFrame->hide();
443 mDateFrame->setCaption( i18n( "Pick a date to display")); 443 mDateFrame->setCaption( i18n( "Pick a date to display"));
444 mDatePicker = new KDatePicker ( mDateFrame , QDate::currentDate() ); 444 mDatePicker = new KDatePicker ( mDateFrame , QDate::currentDate() );
445 445
446 connect(mDatePicker,SIGNAL(dateSelected(QDate)),SLOT(slotSelectPickerDate(QDate))); 446 connect(mDatePicker,SIGNAL(dateSelected(QDate)),SLOT(slotSelectPickerDate(QDate)));
447 447
448 mEventEditor = mDialogManager->getEventEditor(); 448 mEventEditor = mDialogManager->getEventEditor();
449 mTodoEditor = mDialogManager->getTodoEditor(); 449 mTodoEditor = mDialogManager->getTodoEditor();
450 450
451 mFlagEditDescription = false; 451 mFlagEditDescription = false;
452 452
453 mSuspendTimer = new QTimer( this ); 453 mSuspendTimer = new QTimer( this );
454 mAlarmTimer = new QTimer( this ); 454 mAlarmTimer = new QTimer( this );
455 mRecheckAlarmTimer = new QTimer( this ); 455 mRecheckAlarmTimer = new QTimer( this );
456 connect( mRecheckAlarmTimer, SIGNAL( timeout () ), SLOT( recheckTimerAlarm() ) ); 456 connect( mRecheckAlarmTimer, SIGNAL( timeout () ), SLOT( recheckTimerAlarm() ) );
457 connect( mSuspendTimer, SIGNAL( timeout () ), SLOT( suspendAlarm() ) ); 457 connect( mSuspendTimer, SIGNAL( timeout () ), SLOT( suspendAlarm() ) );
458 connect( mAlarmTimer, SIGNAL( timeout () ), SLOT( timerAlarm() ) ); 458 connect( mAlarmTimer, SIGNAL( timeout () ), SLOT( timerAlarm() ) );
459 mAlarmDialog = new AlarmDialog( this ); 459 mAlarmDialog = new AlarmDialog( this );
460 connect( mAlarmDialog, SIGNAL( addAlarm(const QDateTime &, const QString & ) ), SLOT( addSuspendAlarm(const QDateTime &, const QString & ) ) ); 460 connect( mAlarmDialog, SIGNAL( addAlarm(const QDateTime &, const QString & ) ), SLOT( addSuspendAlarm(const QDateTime &, const QString & ) ) );
461 mAlarmDialog->setServerNotification( false ); 461 mAlarmDialog->setServerNotification( false );
462 mAlarmDialog->setSuspendTime( KOPrefs::instance()->mAlarmSuspendTime ); 462 mAlarmDialog->setSuspendTime( KOPrefs::instance()->mAlarmSuspendTime );
463} 463}
464 464
465 465
466CalendarView::~CalendarView() 466CalendarView::~CalendarView()
467{ 467{
468 // kdDebug() << "~CalendarView()" << endl; 468 // kdDebug() << "~CalendarView()" << endl;
469 //qDebug("CalendarView::~CalendarView() "); 469 //qDebug("CalendarView::~CalendarView() ");
470 delete mDialogManager; 470 delete mDialogManager;
471 delete mViewManager; 471 delete mViewManager;
472 delete mStorage; 472 delete mStorage;
473 delete mDateFrame ; 473 delete mDateFrame ;
474 delete beamDialog; 474 delete beamDialog;
475 //kdDebug() << "~CalendarView() done" << endl; 475 //kdDebug() << "~CalendarView() done" << endl;
476} 476}
477void CalendarView::timerAlarm() 477void CalendarView::timerAlarm()
478{ 478{
479 //qDebug("CalendarView::timerAlarm() "); 479 //qDebug("CalendarView::timerAlarm() ");
480 computeAlarm(mAlarmNotification ); 480 computeAlarm(mAlarmNotification );
481} 481}
482 482
483void CalendarView::suspendAlarm() 483void CalendarView::suspendAlarm()
484{ 484{
485 //qDebug(" CalendarView::suspendAlarm() "); 485 //qDebug(" CalendarView::suspendAlarm() ");
486 computeAlarm(mSuspendAlarmNotification ); 486 computeAlarm(mSuspendAlarmNotification );
487 487
488} 488}
489 489
490void CalendarView::startAlarm( QString mess , QString filename) 490void CalendarView::startAlarm( QString mess , QString filename)
491{ 491{
492 mAlarmDialog->eventNotification( mess, KOPrefs::instance()->mAlarmPlayBeeps, filename, true,KOPrefs::instance()->mAlarmBeepInterval ,KOPrefs::instance()->mAlarmSuspendCount ); 492 mAlarmDialog->eventNotification( mess, KOPrefs::instance()->mAlarmPlayBeeps, filename, true,KOPrefs::instance()->mAlarmBeepInterval ,KOPrefs::instance()->mAlarmSuspendCount );
493 QTimer::singleShot( 3000, this, SLOT( checkNextTimerAlarm() ) ); 493 QTimer::singleShot( 3000, this, SLOT( checkNextTimerAlarm() ) );
494 494
495} 495}
496 496
497void CalendarView::checkNextTimerAlarm() 497void CalendarView::checkNextTimerAlarm()
498{ 498{
499 mCalendar->checkAlarmForIncidence( 0, true ); 499 mCalendar->checkAlarmForIncidence( 0, true );
500} 500}
501 501
502void CalendarView::computeAlarm( QString msg ) 502void CalendarView::computeAlarm( QString msg )
503{ 503{
504 504
505 QString mess = msg; 505 QString mess = msg;
506 QString mAlarmMessage = mess.mid( 9 ); 506 QString mAlarmMessage = mess.mid( 9 );
507 QString filename = MainWindow::resourcePath(); 507 QString filename = MainWindow::resourcePath();
508 filename += "koalarm.wav"; 508 filename += "koalarm.wav";
509 QString tempfilename; 509 QString tempfilename;
510 if ( mess.left( 13 ) == "suspend_alarm") { 510 if ( mess.left( 13 ) == "suspend_alarm") {
511 bool error = false; 511 bool error = false;
512 int len = mess.mid( 13 ).find("+++"); 512 int len = mess.mid( 13 ).find("+++");
513 if ( len < 2 ) 513 if ( len < 2 )
514 error = true; 514 error = true;
515 else { 515 else {
516 tempfilename = mess.mid( 13, len ); 516 tempfilename = mess.mid( 13, len );
517 if ( !QFile::exists( tempfilename ) ) 517 if ( !QFile::exists( tempfilename ) )
518 error = true; 518 error = true;
519 } 519 }
520 if ( ! error ) { 520 if ( ! error ) {
521 filename = tempfilename; 521 filename = tempfilename;
522 } 522 }
523 mAlarmMessage = mess.mid( 13+len+3 ); 523 mAlarmMessage = mess.mid( 13+len+3 );
524 //qDebug("suspend file %s ",tempfilename.latin1() ); 524 //qDebug("suspend file %s ",tempfilename.latin1() );
525 startAlarm( mAlarmMessage, filename); 525 startAlarm( mAlarmMessage, filename);
526 return; 526 return;
527 } 527 }
528 if ( mess.left( 11 ) == "timer_alarm") { 528 if ( mess.left( 11 ) == "timer_alarm") {
529 //mTimerTime = 0; 529 //mTimerTime = 0;
530 startAlarm( mess.mid( 11 ), filename ); 530 startAlarm( mess.mid( 11 ), filename );
531 return; 531 return;
532 } 532 }
533 if ( mess.left( 10 ) == "proc_alarm") { 533 if ( mess.left( 10 ) == "proc_alarm") {
534 bool error = false; 534 bool error = false;
535 int len = mess.mid( 10 ).find("+++"); 535 int len = mess.mid( 10 ).find("+++");
536 if ( len < 2 ) 536 if ( len < 2 )
537 error = true; 537 error = true;
538 else { 538 else {
539 tempfilename = mess.mid( 10, len ); 539 tempfilename = mess.mid( 10, len );
540 if ( !QFile::exists( tempfilename ) ) 540 if ( !QFile::exists( tempfilename ) )
541 error = true; 541 error = true;
542 } 542 }
543 if ( error ) { 543 if ( error ) {
544 mAlarmMessage = "Procedure Alarm\nError - File not found\n"; 544 mAlarmMessage = "Procedure Alarm\nError - File not found\n";
545 mAlarmMessage += mess.mid( 10+len+3+9 ); 545 mAlarmMessage += mess.mid( 10+len+3+9 );
546 } else { 546 } else {
547 //QCopEnvelope e("QPE/Application/kopi", "-writeFileSilent"); 547 //QCopEnvelope e("QPE/Application/kopi", "-writeFileSilent");
548 //qDebug("-----system command %s ",tempfilename.latin1() ); 548 //qDebug("-----system command %s ",tempfilename.latin1() );
549#ifndef _WIN32_ 549#ifndef _WIN32_
550 if ( vfork () == 0 ) { 550 if ( vfork () == 0 ) {
551 execl ( tempfilename.latin1(), 0 ); 551 execl ( tempfilename.latin1(), 0 );
552 return; 552 return;
553 } 553 }
554#else 554#else
555 QProcess* p = new QProcess(); 555 QProcess* p = new QProcess();
556 p->addArgument( tempfilename.latin1() ); 556 p->addArgument( tempfilename.latin1() );
557 p->start(); 557 p->start();
558 return; 558 return;
559#endif 559#endif
560 560
561 return; 561 return;
562 } 562 }
563 563
564 //qDebug("+++++++system command %s ",tempfilename.latin1() ); 564 //qDebug("+++++++system command %s ",tempfilename.latin1() );
565 } 565 }
566 if ( mess.left( 11 ) == "audio_alarm") { 566 if ( mess.left( 11 ) == "audio_alarm") {
567 bool error = false; 567 bool error = false;
568 int len = mess.mid( 11 ).find("+++"); 568 int len = mess.mid( 11 ).find("+++");
569 if ( len < 2 ) 569 if ( len < 2 )
570 error = true; 570 error = true;
571 else { 571 else {
572 tempfilename = mess.mid( 11, len ); 572 tempfilename = mess.mid( 11, len );
573 if ( !QFile::exists( tempfilename ) ) 573 if ( !QFile::exists( tempfilename ) )
574 error = true; 574 error = true;
575 } 575 }
576 if ( ! error ) { 576 if ( ! error ) {
577 filename = tempfilename; 577 filename = tempfilename;
578 } 578 }
579 mAlarmMessage = mess.mid( 11+len+3+9 ); 579 mAlarmMessage = mess.mid( 11+len+3+9 );
580 //qDebug("audio file command %s ",tempfilename.latin1() ); 580 //qDebug("audio file command %s ",tempfilename.latin1() );
581 } 581 }
582 if ( mess.left( 9 ) == "cal_alarm") { 582 if ( mess.left( 9 ) == "cal_alarm") {
583 mAlarmMessage = mess.mid( 9 ) ; 583 mAlarmMessage = mess.mid( 9 ) ;
584 } 584 }
585 585
586 startAlarm( mAlarmMessage, filename ); 586 startAlarm( mAlarmMessage, filename );
587 587
588 588
589} 589}
590 590
591void CalendarView::addSuspendAlarm(const QDateTime &qdt, const QString &noti ) 591void CalendarView::addSuspendAlarm(const QDateTime &qdt, const QString &noti )
592{ 592{
593 //qDebug("+++++addSUSPENDAlarm %s %s ", qdt.toString().latin1() , noti.latin1() ); 593 //qDebug("+++++addSUSPENDAlarm %s %s ", qdt.toString().latin1() , noti.latin1() );
594 594
595 mSuspendAlarmNotification = noti; 595 mSuspendAlarmNotification = noti;
596 int ms = QDateTime::currentDateTime().secsTo( qdt )*1000; 596 int ms = QDateTime::currentDateTime().secsTo( qdt )*1000;
597 //qDebug("Suspend Alarm timer started with secs: %d ", ms/1000); 597 //qDebug("Suspend Alarm timer started with secs: %d ", ms/1000);
598 mSuspendTimer->start( ms , true ); 598 mSuspendTimer->start( ms , true );
599 599
600} 600}
601 601
602void CalendarView::addAlarm(const QDateTime &qdt, const QString &noti ) 602void CalendarView::addAlarm(const QDateTime &qdt, const QString &noti )
603{ 603{
604 //qDebug("+++++addAlarm %s %s ", qdt.toString().latin1() , noti.latin1() ); 604 //qDebug("+++++addAlarm %s %s ", qdt.toString().latin1() , noti.latin1() );
605 if ( ! KOPrefs::instance()->mUseInternalAlarmNotification ) { 605 if ( ! KOPrefs::instance()->mUseInternalAlarmNotification ) {
606#ifndef DESKTOP_VERSION 606#ifndef DESKTOP_VERSION
607 AlarmServer::addAlarm ( qdt,"koalarm", noti.latin1() ); 607 AlarmServer::addAlarm ( qdt,"koalarm", noti.latin1() );
608#endif 608#endif
609 return; 609 return;
610 } 610 }
611 int maxSec; 611 int maxSec;
612 //maxSec = 5; //testing only 612 //maxSec = 5; //testing only
613 maxSec = 86400+3600; // one day+1hour 613 maxSec = 86400+3600; // one day+1hour
614 mAlarmNotification = noti; 614 mAlarmNotification = noti;
615 int sec = QDateTime::currentDateTime().secsTo( qdt ); 615 int sec = QDateTime::currentDateTime().secsTo( qdt );
616 if ( sec > maxSec ) { 616 if ( sec > maxSec ) {
617 mRecheckAlarmTimer->start( maxSec * 1000 ); 617 mRecheckAlarmTimer->start( maxSec * 1000 );
618 // qDebug("recheck Alarm timer started with secs: %d next alarm in sec:%d", maxSec,sec ); 618 // qDebug("recheck Alarm timer started with secs: %d next alarm in sec:%d", maxSec,sec );
619 return; 619 return;
620 } else { 620 } else {
621 mRecheckAlarmTimer->stop(); 621 mRecheckAlarmTimer->stop();
622 } 622 }
623 //qDebug("Alarm timer started with secs: %d ", sec); 623 //qDebug("Alarm timer started with secs: %d ", sec);
624 mAlarmTimer->start( sec *1000 , true ); 624 mAlarmTimer->start( sec *1000 , true );
625 625
626} 626}
627// called by mRecheckAlarmTimer to get next alarm 627// called by mRecheckAlarmTimer to get next alarm
628// we need this, because a QTimer has only a max range of 25 days 628// we need this, because a QTimer has only a max range of 25 days
629void CalendarView::recheckTimerAlarm() 629void CalendarView::recheckTimerAlarm()
630{ 630{
631 mAlarmTimer->stop(); 631 mAlarmTimer->stop();
632 mRecheckAlarmTimer->stop(); 632 mRecheckAlarmTimer->stop();
633 mCalendar->checkAlarmForIncidence( 0, true ); 633 mCalendar->checkAlarmForIncidence( 0, true );
634} 634}
635void CalendarView::removeAlarm(const QDateTime &qdt, const QString &noti ) 635void CalendarView::removeAlarm(const QDateTime &qdt, const QString &noti )
636{ 636{
637 //qDebug("-----removeAlarm %s %s ", qdt.toString().latin1() , noti.latin1() ); 637 //qDebug("-----removeAlarm %s %s ", qdt.toString().latin1() , noti.latin1() );
638 if ( ! KOPrefs::instance()->mUseInternalAlarmNotification ) { 638 if ( ! KOPrefs::instance()->mUseInternalAlarmNotification ) {
639#ifndef DESKTOP_VERSION 639#ifndef DESKTOP_VERSION
640 AlarmServer::deleteAlarm (qdt ,"koalarm" ,noti.latin1() ); 640 AlarmServer::deleteAlarm (qdt ,"koalarm" ,noti.latin1() );
641#endif 641#endif
642 return; 642 return;
643 } 643 }
644 mAlarmTimer->stop(); 644 mAlarmTimer->stop();
645} 645}
646void CalendarView::selectWeekNum ( int num ) 646void CalendarView::selectWeekNum ( int num )
647{ 647{
648 dateNavigator()->selectWeek( num ); 648 dateNavigator()->selectWeek( num );
649 mViewManager->showWeekView(); 649 mViewManager->showWeekView();
650} 650}
651KOViewManager *CalendarView::viewManager() 651KOViewManager *CalendarView::viewManager()
652{ 652{
653 return mViewManager; 653 return mViewManager;
654} 654}
655 655
656KODialogManager *CalendarView::dialogManager() 656KODialogManager *CalendarView::dialogManager()
657{ 657{
658 return mDialogManager; 658 return mDialogManager;
659} 659}
660 660
661QDate CalendarView::startDate() 661QDate CalendarView::startDate()
662{ 662{
663 DateList dates = mNavigator->selectedDates(); 663 DateList dates = mNavigator->selectedDates();
664 664
665 return dates.first(); 665 return dates.first();
666} 666}
667 667
668QDate CalendarView::endDate() 668QDate CalendarView::endDate()
669{ 669{
670 DateList dates = mNavigator->selectedDates(); 670 DateList dates = mNavigator->selectedDates();
671 671
672 return dates.last(); 672 return dates.last();
673} 673}
674 674
675 675
676void CalendarView::createPrinter() 676void CalendarView::createPrinter()
677{ 677{
678#ifndef KORG_NOPRINTER 678#ifndef KORG_NOPRINTER
679 if (!mCalPrinter) { 679 if (!mCalPrinter) {
680 mCalPrinter = new CalPrinter(this, mCalendar); 680 mCalPrinter = new CalPrinter(this, mCalendar);
681 connect(this, SIGNAL(configChanged()), mCalPrinter, SLOT(updateConfig())); 681 connect(this, SIGNAL(configChanged()), mCalPrinter, SLOT(updateConfig()));
682 } 682 }
683#endif 683#endif
684} 684}
685 685
686void CalendarView::confSync() 686void CalendarView::confSync()
687{ 687{
688 static KSyncPrefsDialog* sp = 0; 688 static KSyncPrefsDialog* sp = 0;
689 if ( ! sp ) { 689 if ( ! sp ) {
690 sp = new KSyncPrefsDialog( this, "syncprefs", true ); 690 sp = new KSyncPrefsDialog( this, "syncprefs", true );
691 } 691 }
692 sp->setLocalMachineName ( KOPrefs::instance()->mLocalMachineName );
693 sp->usrReadConfig(); 692 sp->usrReadConfig();
694#ifndef DESKTOP_VERSION 693#ifndef DESKTOP_VERSION
695 sp->showMaximized(); 694 sp->showMaximized();
696#else 695#else
697 sp->show(); 696 sp->show();
698#endif 697#endif
699 sp->exec(); 698 sp->exec();
700 KOPrefs::instance()->mSyncProfileNames = sp->getSyncProfileNames(); 699 KOPrefs::instance()->mSyncProfileNames = sp->getSyncProfileNames();
701 KOPrefs::instance()->mLocalMachineName = sp->getLocalMachineName (); 700 KOPrefs::instance()->mLocalMachineName = sp->getLocalMachineName ();
702} 701}
703 702
704 703
705//KOPrefs::instance()->mWriteBackFile 704//KOPrefs::instance()->mWriteBackFile
706//KOPrefs::instance()->mWriteBackExistingOnly 705//KOPrefs::instance()->mWriteBackExistingOnly
707 706
708// 0 syncPrefsGroup->addRadio(i18n("Take local entry on conflict")); 707// 0 syncPrefsGroup->addRadio(i18n("Take local entry on conflict"));
709// 1 syncPrefsGroup->addRadio(i18n("Take remote entry on conflict")); 708// 1 syncPrefsGroup->addRadio(i18n("Take remote entry on conflict"));
710// 2 syncPrefsGroup->addRadio(i18n("Take newest entry on conflict")); 709// 2 syncPrefsGroup->addRadio(i18n("Take newest entry on conflict"));
711// 3 syncPrefsGroup->addRadio(i18n("Ask for every entry on conflict")); 710// 3 syncPrefsGroup->addRadio(i18n("Ask for every entry on conflict"));
712// 4 syncPrefsGroup->addRadio(i18n("Force take local entry always")); 711// 4 syncPrefsGroup->addRadio(i18n("Force take local entry always"));
713// 5 syncPrefsGroup->addRadio(i18n("Force take remote entry always")); 712// 5 syncPrefsGroup->addRadio(i18n("Force take remote entry always"));
714 713
715int CalendarView::takeEvent( Incidence* local, Incidence* remote, int mode , bool full ) 714int CalendarView::takeEvent( Incidence* local, Incidence* remote, int mode , bool full )
716{ 715{
717 716
718 //void setZaurusId(int id); 717 //void setZaurusId(int id);
719 // int zaurusId() const; 718 // int zaurusId() const;
720 // void setZaurusUid(int id); 719 // void setZaurusUid(int id);
721 // int zaurusUid() const; 720 // int zaurusUid() const;
722 // void setZaurusStat(int id); 721 // void setZaurusStat(int id);
723 // int zaurusStat() const; 722 // int zaurusStat() const;
724 // 0 equal 723 // 0 equal
725 // 1 take local 724 // 1 take local
726 // 2 take remote 725 // 2 take remote
727 // 3 cancel 726 // 3 cancel
728 QDateTime lastSync = mLastCalendarSync; 727 QDateTime lastSync = mLastCalendarSync;
729 if ( mGlobalSyncMode == SYNC_MODE_EXTERNAL ) { 728 if ( mGlobalSyncMode == SYNC_MODE_EXTERNAL ) {
730 bool remCh, locCh; 729 bool remCh, locCh;
731 remCh = ( remote->zaurusUid() != local->zaurusUid() ); 730 remCh = ( remote->zaurusUid() != local->zaurusUid() );
732 locCh = ( local->lastModified() > mLastCalendarSync ); 731 locCh = ( local->lastModified() > mLastCalendarSync );
733 //qDebug("locCh %d remCh %d locuid %d remuid %d", locCh, remCh,local->zaurusUid(), remote->zaurusUid() ); 732 //qDebug("locCh %d remCh %d locuid %d remuid %d", locCh, remCh,local->zaurusUid(), remote->zaurusUid() );
734 if ( !remCh && ! locCh ) { 733 if ( !remCh && ! locCh ) {
735 //qDebug("both not changed "); 734 //qDebug("both not changed ");
736 lastSync = local->lastModified().addDays(1); 735 lastSync = local->lastModified().addDays(1);
737 } else { 736 } else {
738 if ( locCh ) { 737 if ( locCh ) {
739 //qDebug("loc changed %d %d", local->zaurusStat(), local->revision() ); 738 //qDebug("loc changed %d %d", local->zaurusStat(), local->revision() );
740 lastSync = local->lastModified().addDays( -1 ); 739 lastSync = local->lastModified().addDays( -1 );
741 if ( !remCh ) 740 if ( !remCh )
742 remote->setLastModified( lastSync.addDays( -1 ) ); 741 remote->setLastModified( lastSync.addDays( -1 ) );
743 } else { 742 } else {
744 //qDebug(" not loc changed "); 743 //qDebug(" not loc changed ");
745 lastSync = local->lastModified().addDays( 1 ); 744 lastSync = local->lastModified().addDays( 1 );
746 if ( remCh ) 745 if ( remCh )
747 remote->setLastModified( lastSync.addDays( 1 ) ); 746 remote->setLastModified( lastSync.addDays( 1 ) );
748 747
749 } 748 }
750 } 749 }
751 full = true; 750 full = true;
752 if ( mode < SYNC_PREF_ASK ) 751 if ( mode < SYNC_PREF_ASK )
753 mode = SYNC_PREF_ASK; 752 mode = SYNC_PREF_ASK;
754 } else { 753 } else {
755 if ( local->lastModified() == remote->lastModified() ) 754 if ( local->lastModified() == remote->lastModified() )
756 if ( local->revision() == remote->revision() ) 755 if ( local->revision() == remote->revision() )
757 return 0; 756 return 0;
758 757
759 } 758 }
760 // qDebug(" %d %d conflict on %s %s ", mode, full, local->summary().latin1(), remote->summary().latin1() ); 759 // qDebug(" %d %d conflict on %s %s ", mode, full, local->summary().latin1(), remote->summary().latin1() );
761 760
762 //qDebug("%s %d %s %d", local->lastModified().toString().latin1() , local->revision(), remote->lastModified().toString().latin1(), remote->revision()); 761 //qDebug("%s %d %s %d", local->lastModified().toString().latin1() , local->revision(), remote->lastModified().toString().latin1(), remote->revision());
763 //qDebug("%d %d %d %d ", local->lastModified().time().second(), local->lastModified().time().msec(), remote->lastModified().time().second(), remote->lastModified().time().msec() ); 762 //qDebug("%d %d %d %d ", local->lastModified().time().second(), local->lastModified().time().msec(), remote->lastModified().time().second(), remote->lastModified().time().msec() );
764 //full = true; //debug only 763 //full = true; //debug only
765 if ( full ) { 764 if ( full ) {
766 bool equ = false; 765 bool equ = false;
767 if ( local->type() == "Event" ) { 766 if ( local->type() == "Event" ) {
768 equ = (*((Event*) local) == *((Event*) remote)); 767 equ = (*((Event*) local) == *((Event*) remote));
769 } 768 }
770 else if ( local->type() =="Todo" ) 769 else if ( local->type() =="Todo" )
771 equ = (*((Todo*) local) == (*(Todo*) remote)); 770 equ = (*((Todo*) local) == (*(Todo*) remote));
772 else if ( local->type() =="Journal" ) 771 else if ( local->type() =="Journal" )
773 equ = (*((Journal*) local) == *((Journal*) remote)); 772 equ = (*((Journal*) local) == *((Journal*) remote));
774 if ( equ ) { 773 if ( equ ) {
775 //qDebug("equal "); 774 //qDebug("equal ");
776 if ( mGlobalSyncMode == SYNC_MODE_EXTERNAL ) { 775 if ( mGlobalSyncMode == SYNC_MODE_EXTERNAL ) {
777 local->setZaurusUid( remote->zaurusUid() ); 776 local->setZaurusUid( remote->zaurusUid() );
778 } 777 }
779 if ( mode < SYNC_PREF_FORCE_LOCAL ) 778 if ( mode < SYNC_PREF_FORCE_LOCAL )
780 return 0; 779 return 0;
781 780
782 }//else //debug only 781 }//else //debug only
783 //qDebug("not equal %s %s ", local->summary().latin1(), remote->summary().latin1()); 782 //qDebug("not equal %s %s ", local->summary().latin1(), remote->summary().latin1());
784 } 783 }
785 int result; 784 int result;
786 bool localIsNew; 785 bool localIsNew;
787 if ( full && mode < SYNC_PREF_NEWEST ) 786 if ( full && mode < SYNC_PREF_NEWEST )
788 mode = SYNC_PREF_ASK; 787 mode = SYNC_PREF_ASK;
789 788
790 switch( mode ) { 789 switch( mode ) {
791 case SYNC_PREF_LOCAL: 790 case SYNC_PREF_LOCAL:
792 if ( lastSync > remote->lastModified() ) 791 if ( lastSync > remote->lastModified() )
793 return 1; 792 return 1;
794 if ( lastSync > local->lastModified() ) 793 if ( lastSync > local->lastModified() )
795 return 2; 794 return 2;
796 return 1; 795 return 1;
797 break; 796 break;
798 case SYNC_PREF_REMOTE: 797 case SYNC_PREF_REMOTE:
799 if ( lastSync > remote->lastModified() ) 798 if ( lastSync > remote->lastModified() )
800 return 1; 799 return 1;
801 if ( lastSync > local->lastModified() ) 800 if ( lastSync > local->lastModified() )
802 return 2; 801 return 2;
803 return 2; 802 return 2;
804 break; 803 break;
805 case SYNC_PREF_NEWEST: 804 case SYNC_PREF_NEWEST:
806 if ( local->lastModified() > remote->lastModified() ) 805 if ( local->lastModified() > remote->lastModified() )
807 return 1; 806 return 1;
808 else 807 else
809 return 2; 808 return 2;
810 break; 809 break;
811 case SYNC_PREF_ASK: 810 case SYNC_PREF_ASK:
812 //qDebug("lsy %s --- lo %s --- re %s ", lastSync.toString().latin1(), local->lastModified().toString().latin1(), remote->lastModified().toString().latin1() ); 811 //qDebug("lsy %s --- lo %s --- re %s ", lastSync.toString().latin1(), local->lastModified().toString().latin1(), remote->lastModified().toString().latin1() );
813 if ( lastSync > remote->lastModified() ) 812 if ( lastSync > remote->lastModified() )
814 return 1; 813 return 1;
815 if ( lastSync > local->lastModified() ) 814 if ( lastSync > local->lastModified() )
816 return 2; 815 return 2;
817 //qDebug("lsy %s --- lo %s --- re %s ", lastSync.toString().latin1(), local->lastModified().toString().latin1(), remote->lastModified().toString().latin1() ); 816 //qDebug("lsy %s --- lo %s --- re %s ", lastSync.toString().latin1(), local->lastModified().toString().latin1(), remote->lastModified().toString().latin1() );
818 localIsNew = local->lastModified() > remote->lastModified(); 817 localIsNew = local->lastModified() > remote->lastModified();
819 if ( localIsNew ) 818 if ( localIsNew )
820 getEventViewerDialog()->setColorMode( 1 ); 819 getEventViewerDialog()->setColorMode( 1 );
821 else 820 else
822 getEventViewerDialog()->setColorMode( 2 ); 821 getEventViewerDialog()->setColorMode( 2 );
823 getEventViewerDialog()->setIncidence(local); 822 getEventViewerDialog()->setIncidence(local);
824 if ( localIsNew ) 823 if ( localIsNew )
825 getEventViewerDialog()->setColorMode( 2 ); 824 getEventViewerDialog()->setColorMode( 2 );
826 else 825 else
827 getEventViewerDialog()->setColorMode( 1 ); 826 getEventViewerDialog()->setColorMode( 1 );
828 getEventViewerDialog()->addIncidence(remote); 827 getEventViewerDialog()->addIncidence(remote);
829 getEventViewerDialog()->setColorMode( 0 ); 828 getEventViewerDialog()->setColorMode( 0 );
830 //qDebug("local %d remote %d ",local->relatedTo(),remote->relatedTo() ); 829 //qDebug("local %d remote %d ",local->relatedTo(),remote->relatedTo() );
831 getEventViewerDialog()->setCaption( mCurrentSyncDevice +i18n(" : Conflict! Please choose entry!")); 830 getEventViewerDialog()->setCaption( mCurrentSyncDevice +i18n(" : Conflict! Please choose entry!"));
832 getEventViewerDialog()->showMe(); 831 getEventViewerDialog()->showMe();
833 result = getEventViewerDialog()->executeS( localIsNew ); 832 result = getEventViewerDialog()->executeS( localIsNew );
834 return result; 833 return result;
835 834
836 break; 835 break;
837 case SYNC_PREF_FORCE_LOCAL: 836 case SYNC_PREF_FORCE_LOCAL:
838 return 1; 837 return 1;
839 break; 838 break;
840 case SYNC_PREF_FORCE_REMOTE: 839 case SYNC_PREF_FORCE_REMOTE:
841 return 2; 840 return 2;
842 break; 841 break;
843 842
844 default: 843 default:
845 // SYNC_PREF_TAKE_BOTH not implemented 844 // SYNC_PREF_TAKE_BOTH not implemented
846 break; 845 break;
847 } 846 }
848 return 0; 847 return 0;
849} 848}
850Event* CalendarView::getLastSyncEvent() 849Event* CalendarView::getLastSyncEvent()
851{ 850{
852 Event* lse; 851 Event* lse;
853 //qDebug("CurrentSyncDevice %s ",mCurrentSyncDevice .latin1() ); 852 //qDebug("CurrentSyncDevice %s ",mCurrentSyncDevice .latin1() );
854 lse = mCalendar->event( "last-syncEvent-device-"+mCurrentSyncDevice ); 853 lse = mCalendar->event( "last-syncEvent-device-"+mCurrentSyncDevice );
855 if (!lse) { 854 if (!lse) {
856 lse = new Event(); 855 lse = new Event();
857 lse->setUid( "last-syncEvent-device-"+mCurrentSyncDevice ); 856 lse->setUid( "last-syncEvent-device-"+mCurrentSyncDevice );
858 lse->setSummary(mCurrentSyncDevice + i18n(" - sync event")); 857 lse->setSummary(mCurrentSyncDevice + i18n(" - sync event"));
859 lse->setDtStart( mLastCalendarSync ); 858 lse->setDtStart( mLastCalendarSync );
860 lse->setDtEnd( mLastCalendarSync.addSecs( 7200 ) ); 859 lse->setDtEnd( mLastCalendarSync.addSecs( 7200 ) );
861 lse->setCategories( i18n("SyncEvent") ); 860 lse->setCategories( i18n("SyncEvent") );
862 lse->setReadOnly( true ); 861 lse->setReadOnly( true );
863 mCalendar->addEvent( lse ); 862 mCalendar->addEvent( lse );
864 } 863 }
865 864
866 return lse; 865 return lse;
867 866
868} 867}
869void CalendarView::checkSharpEvent( Event* lastSync, Incidence* toDelete ) 868void CalendarView::checkSharpEvent( Event* lastSync, Incidence* toDelete )
870{ 869{
871 if ( ! lastSync ) 870 if ( ! lastSync )
872 return; 871 return;
873 if ( toDelete->zaurusId() < 0 ) 872 if ( toDelete->zaurusId() < 0 )
874 return; 873 return;
875 if ( toDelete->type() == "Journal" ) 874 if ( toDelete->type() == "Journal" )
876 return; 875 return;
877 QString des = lastSync->description(); 876 QString des = lastSync->description();
878 QString pref = "e"; 877 QString pref = "e";
879 if ( toDelete->type() == "Todo" ) 878 if ( toDelete->type() == "Todo" )
880 pref = "t"; 879 pref = "t";
881 des += pref+ QString::number ( toDelete->zaurusId() ) + ","; 880 des += pref+ QString::number ( toDelete->zaurusId() ) + ",";
882 lastSync->setReadOnly( false ); 881 lastSync->setReadOnly( false );
883 lastSync->setDescription( des ); 882 lastSync->setDescription( des );
884 lastSync->setReadOnly( true ); 883 lastSync->setReadOnly( true );
885 884
886} 885}
887bool CalendarView::synchronizeCalendar( Calendar* local, Calendar* remote, int mode ) 886bool CalendarView::synchronizeCalendar( Calendar* local, Calendar* remote, int mode )
888{ 887{
889 bool syncOK = true; 888 bool syncOK = true;
890 int addedEvent = 0; 889 int addedEvent = 0;
891 int addedEventR = 0; 890 int addedEventR = 0;
892 int deletedEventR = 0; 891 int deletedEventR = 0;
893 int deletedEventL = 0; 892 int deletedEventL = 0;
894 int changedLocal = 0; 893 int changedLocal = 0;
895 int changedRemote = 0; 894 int changedRemote = 0;
896 //QPtrList<Event> el = local->rawEvents(); 895 //QPtrList<Event> el = local->rawEvents();
897 Event* eventR; 896 Event* eventR;
898 QString uid; 897 QString uid;
899 int take; 898 int take;
900 Event* eventL; 899 Event* eventL;
901 Event* eventRSync; 900 Event* eventRSync;
902 Event* eventLSync; 901 Event* eventLSync;
903 Event* eventRSyncSharp = remote->event( "last-syncEvent-device-Sharp-DTM"); 902 Event* eventRSyncSharp = remote->event( "last-syncEvent-device-Sharp-DTM");
904 Event* eventLSyncSharp = local->event( "last-syncEvent-device-Sharp-DTM"); 903 Event* eventLSyncSharp = local->event( "last-syncEvent-device-Sharp-DTM");
905 bool fullDateRange = false; 904 bool fullDateRange = false;
906 mLastCalendarSync = QDateTime::currentDateTime(); 905 mLastCalendarSync = QDateTime::currentDateTime();
907 QDateTime modifiedCalendar = mLastCalendarSync;; 906 QDateTime modifiedCalendar = mLastCalendarSync;;
908 eventR = remote->event("last-syncEvent-device-"+mCurrentSyncName ); 907 eventR = remote->event("last-syncEvent-device-"+mCurrentSyncName );
909 if ( eventR ) { 908 if ( eventR ) {
910 eventRSync = (Event*) eventR->clone(); 909 eventRSync = (Event*) eventR->clone();
911 remote->deleteEvent(eventR ); 910 remote->deleteEvent(eventR );
912 911
913 } else { 912 } else {
914 fullDateRange = true; 913 fullDateRange = true;
915 eventRSync = new Event(); 914 eventRSync = new Event();
916 eventRSync->setSummary(mCurrentSyncName + i18n(" - sync event")); 915 eventRSync->setSummary(mCurrentSyncName + i18n(" - sync event"));
917 eventRSync->setUid("last-syncEvent-device-"+mCurrentSyncName ); 916 eventRSync->setUid("last-syncEvent-device-"+mCurrentSyncName );
918 eventRSync->setDtStart( mLastCalendarSync ); 917 eventRSync->setDtStart( mLastCalendarSync );
919 eventRSync->setDtEnd( mLastCalendarSync.addSecs( 7200 ) ); 918 eventRSync->setDtEnd( mLastCalendarSync.addSecs( 7200 ) );
920 eventRSync->setCategories( i18n("SyncEvent") ); 919 eventRSync->setCategories( i18n("SyncEvent") );
921 } 920 }
922 eventLSync = getLastSyncEvent(); 921 eventLSync = getLastSyncEvent();
923 if ( eventLSync->dtStart() == mLastCalendarSync ) 922 if ( eventLSync->dtStart() == mLastCalendarSync )
924 fullDateRange = true; 923 fullDateRange = true;
925 924
926 if ( ! fullDateRange ) { 925 if ( ! fullDateRange ) {
927 if ( eventLSync->dtStart() != eventRSync->dtStart() ) { 926 if ( eventLSync->dtStart() != eventRSync->dtStart() ) {
928 927
929 // qDebug("set fulldate to true %s %s" ,eventLSync->dtStart().toString().latin1(), eventRSync->dtStart().toString().latin1() ); 928 // qDebug("set fulldate to true %s %s" ,eventLSync->dtStart().toString().latin1(), eventRSync->dtStart().toString().latin1() );
930 //qDebug("%d %d %d %d ", eventLSync->dtStart().time().second(), eventLSync->dtStart().time().msec() , eventRSync->dtStart().time().second(), eventRSync->dtStart().time().msec()); 929 //qDebug("%d %d %d %d ", eventLSync->dtStart().time().second(), eventLSync->dtStart().time().msec() , eventRSync->dtStart().time().second(), eventRSync->dtStart().time().msec());
931 fullDateRange = true; 930 fullDateRange = true;
932 } 931 }
933 } 932 }
934 if ( fullDateRange ) 933 if ( fullDateRange )
935 mLastCalendarSync = QDateTime::currentDateTime().addDays( -100*365); 934 mLastCalendarSync = QDateTime::currentDateTime().addDays( -100*365);
936 else 935 else
937 mLastCalendarSync = eventLSync->dtStart(); 936 mLastCalendarSync = eventLSync->dtStart();
938 // for resyncing if own file has changed 937 // for resyncing if own file has changed
939 if ( mCurrentSyncDevice == "deleteaftersync" ) { 938 if ( mCurrentSyncDevice == "deleteaftersync" ) {
940 mLastCalendarSync = loadedFileVersion; 939 mLastCalendarSync = loadedFileVersion;
941 qDebug("setting mLastCalendarSync "); 940 qDebug("setting mLastCalendarSync ");
942 } 941 }
943 //qDebug("*************************** "); 942 //qDebug("*************************** ");
944 qDebug("mLastCalendarSync %s ",mLastCalendarSync.toString().latin1() ); 943 qDebug("mLastCalendarSync %s ",mLastCalendarSync.toString().latin1() );
945 QPtrList<Incidence> er = remote->rawIncidences(); 944 QPtrList<Incidence> er = remote->rawIncidences();
946 Incidence* inR = er.first(); 945 Incidence* inR = er.first();
947 Incidence* inL; 946 Incidence* inL;
948 QProgressBar bar( er.count(),0 ); 947 QProgressBar bar( er.count(),0 );
949 bar.setCaption (i18n("Syncing - close to abort!") ); 948 bar.setCaption (i18n("Syncing - close to abort!") );
950 949
951 int w = 300; 950 int w = 300;
952 if ( QApplication::desktop()->width() < 320 ) 951 if ( QApplication::desktop()->width() < 320 )
953 w = 220; 952 w = 220;
954 int h = bar.sizeHint().height() ; 953 int h = bar.sizeHint().height() ;
955 int dw = QApplication::desktop()->width(); 954 int dw = QApplication::desktop()->width();
956 int dh = QApplication::desktop()->height(); 955 int dh = QApplication::desktop()->height();
957 bar.setGeometry( (dw-w)/2, (dh - h )/2 ,w,h ); 956 bar.setGeometry( (dw-w)/2, (dh - h )/2 ,w,h );
958 bar.show(); 957 bar.show();
959 int modulo = (er.count()/10)+1; 958 int modulo = (er.count()/10)+1;
960 int incCounter = 0; 959 int incCounter = 0;
961 while ( inR ) { 960 while ( inR ) {
962 if ( ! bar.isVisible() ) 961 if ( ! bar.isVisible() )
963 return false; 962 return false;
964 if ( incCounter % modulo == 0 ) 963 if ( incCounter % modulo == 0 )
965 bar.setProgress( incCounter ); 964 bar.setProgress( incCounter );
966 ++incCounter; 965 ++incCounter;
967 uid = inR->uid(); 966 uid = inR->uid();
968 bool skipIncidence = false; 967 bool skipIncidence = false;
969 if ( uid.left(21) == QString("last-syncEvent-device") ) 968 if ( uid.left(21) == QString("last-syncEvent-device") )
970 skipIncidence = true; 969 skipIncidence = true;
971 970
972 qApp->processEvents(); 971 qApp->processEvents();
973 if ( !skipIncidence ) { 972 if ( !skipIncidence ) {
974 inL = local->incidence( uid ); 973 inL = local->incidence( uid );
975 if ( inL ) { // maybe conflict - same uid in both calendars 974 if ( inL ) { // maybe conflict - same uid in both calendars
976 int maxrev = inL->revision(); 975 int maxrev = inL->revision();
977 if ( maxrev < inR->revision() ) 976 if ( maxrev < inR->revision() )
978 maxrev = inR->revision(); 977 maxrev = inR->revision();
979 if ( (take = takeEvent( inL, inR, mode, fullDateRange )) > 0 ) { 978 if ( (take = takeEvent( inL, inR, mode, fullDateRange )) > 0 ) {
980 //qDebug("take %d %s ", take, inL->summary().latin1()); 979 //qDebug("take %d %s ", take, inL->summary().latin1());
981 if ( take == 3 ) 980 if ( take == 3 )
982 return false; 981 return false;
983 if ( take == 1 ) {// take local 982 if ( take == 1 ) {// take local
984 inL->setZaurusUid( inR->zaurusUid() ); 983 inL->setZaurusUid( inR->zaurusUid() );
985 remote->deleteIncidence( inR ); 984 remote->deleteIncidence( inR );
986 if ( inL->revision() < maxrev ) 985 if ( inL->revision() < maxrev )
987 inL->setRevision( maxrev ); 986 inL->setRevision( maxrev );
988 remote->addIncidence( inL->clone() ); 987 remote->addIncidence( inL->clone() );
989 ++changedRemote; 988 ++changedRemote;
990 } else { 989 } else {
991 if ( inR->revision() < maxrev ) 990 if ( inR->revision() < maxrev )
992 inR->setRevision( maxrev ); 991 inR->setRevision( maxrev );
993 local->deleteIncidence( inL ); 992 local->deleteIncidence( inL );
994 local->addIncidence( inR->clone() ); 993 local->addIncidence( inR->clone() );
995 ++changedLocal; 994 ++changedLocal;
996 } 995 }
997 } 996 }
998 } else { // no conflict 997 } else { // no conflict
999 if ( mGlobalSyncMode == SYNC_MODE_EXTERNAL ) { 998 if ( mGlobalSyncMode == SYNC_MODE_EXTERNAL ) {
1000 QString des = eventLSync->description(); 999 QString des = eventLSync->description();
1001 QString pref = "e"; 1000 QString pref = "e";
1002 if ( inR->type() == "Todo" ) 1001 if ( inR->type() == "Todo" )
1003 pref = "t"; 1002 pref = "t";
1004 if ( des.find(pref+QString::number( inR->zaurusId() ) +"," ) >= 0 && mode != 5) { // delete it 1003 if ( des.find(pref+QString::number( inR->zaurusId() ) +"," ) >= 0 && mode != 5) { // delete it
1005 inR->setTempSyncStat( SYNC_TEMPSTATE_DELETE ); 1004 inR->setTempSyncStat( SYNC_TEMPSTATE_DELETE );
1006 //remote->deleteIncidence( inR ); 1005 //remote->deleteIncidence( inR );
1007 ++deletedEventR; 1006 ++deletedEventR;
1008 } else { 1007 } else {
1009 inR->setLastModified( modifiedCalendar ); 1008 inR->setLastModified( modifiedCalendar );
1010 local->addIncidence( inR->clone() ); 1009 local->addIncidence( inR->clone() );
1011 ++addedEvent; 1010 ++addedEvent;
1012 } 1011 }
1013 } else { 1012 } else {
1014 if ( inR->lastModified() > mLastCalendarSync || mode == 5 ) { 1013 if ( inR->lastModified() > mLastCalendarSync || mode == 5 ) {
1015 inR->setLastModified( modifiedCalendar ); 1014 inR->setLastModified( modifiedCalendar );
1016 local->addIncidence( inR->clone() ); 1015 local->addIncidence( inR->clone() );
1017 ++addedEvent; 1016 ++addedEvent;
1018 } else { 1017 } else {
1019 checkSharpEvent(eventRSyncSharp, inR); 1018 checkSharpEvent(eventRSyncSharp, inR);
1020 remote->deleteIncidence( inR ); 1019 remote->deleteIncidence( inR );
1021 ++deletedEventR; 1020 ++deletedEventR;
1022 } 1021 }
1023 } 1022 }
1024 } 1023 }
1025 } 1024 }
1026 inR = er.next(); 1025 inR = er.next();
1027 } 1026 }
1028 QPtrList<Incidence> el = local->rawIncidences(); 1027 QPtrList<Incidence> el = local->rawIncidences();
1029 inL = el.first(); 1028 inL = el.first();
1030 modulo = (el.count()/10)+1; 1029 modulo = (el.count()/10)+1;
1031 bar.setCaption (i18n("Add / remove events") ); 1030 bar.setCaption (i18n("Add / remove events") );
1032 bar.setTotalSteps ( el.count() ) ; 1031 bar.setTotalSteps ( el.count() ) ;
1033 bar.show(); 1032 bar.show();
1034 incCounter = 0; 1033 incCounter = 0;
1035 1034
1036 while ( inL ) { 1035 while ( inL ) {
1037 1036
1038 qApp->processEvents(); 1037 qApp->processEvents();
1039 if ( ! bar.isVisible() ) 1038 if ( ! bar.isVisible() )
1040 return false; 1039 return false;
1041 if ( incCounter % modulo == 0 ) 1040 if ( incCounter % modulo == 0 )
1042 bar.setProgress( incCounter ); 1041 bar.setProgress( incCounter );
1043 ++incCounter; 1042 ++incCounter;
1044 uid = inL->uid(); 1043 uid = inL->uid();
1045 bool skipIncidence = false; 1044 bool skipIncidence = false;
1046 if ( uid.left(21) == QString("last-syncEvent-device") ) 1045 if ( uid.left(21) == QString("last-syncEvent-device") )
1047 skipIncidence = true; 1046 skipIncidence = true;
1048 if ( mGlobalSyncMode == SYNC_MODE_EXTERNAL && inL->type() == "Journal" ) 1047 if ( mGlobalSyncMode == SYNC_MODE_EXTERNAL && inL->type() == "Journal" )
1049 skipIncidence = true; 1048 skipIncidence = true;
1050 if ( !skipIncidence ) { 1049 if ( !skipIncidence ) {
1051 inR = remote->incidence( uid ); 1050 inR = remote->incidence( uid );
1052 if ( ! inR ) { 1051 if ( ! inR ) {
1053 if ( mGlobalSyncMode == SYNC_MODE_EXTERNAL ) { 1052 if ( mGlobalSyncMode == SYNC_MODE_EXTERNAL ) {
1054 if ( inL->zaurusId() >= 0 && mode != 4 ) { 1053 if ( inL->zaurusId() >= 0 && mode != 4 ) {
1055 local->deleteIncidence( inL ); 1054 local->deleteIncidence( inL );
1056 ++deletedEventL; 1055 ++deletedEventL;
1057 } else { 1056 } else {
1058 if ( ! KOPrefs::instance()->mWriteBackExistingOnly ) { 1057 if ( ! KOPrefs::instance()->mWriteBackExistingOnly ) {
1059 inL->setZaurusId( -1 ); 1058 inL->setZaurusId( -1 );
1060 ++addedEventR; 1059 ++addedEventR;
1061 inL->setLastModified( modifiedCalendar ); 1060 inL->setLastModified( modifiedCalendar );
1062 remote->addIncidence( inL->clone() ); 1061 remote->addIncidence( inL->clone() );
1063 } 1062 }
1064 } 1063 }
1065 } else { 1064 } else {
1066 if ( inL->lastModified() < mLastCalendarSync && mode != 4 ) { 1065 if ( inL->lastModified() < mLastCalendarSync && mode != 4 ) {
1067 checkSharpEvent(eventLSyncSharp, inL); 1066 checkSharpEvent(eventLSyncSharp, inL);
1068 local->deleteIncidence( inL ); 1067 local->deleteIncidence( inL );
1069 ++deletedEventL; 1068 ++deletedEventL;
1070 } else { 1069 } else {
1071 if ( ! KOPrefs::instance()->mWriteBackExistingOnly ) { 1070 if ( ! KOPrefs::instance()->mWriteBackExistingOnly ) {
1072 ++addedEventR; 1071 ++addedEventR;
1073 inL->setLastModified( modifiedCalendar ); 1072 inL->setLastModified( modifiedCalendar );
1074 remote->addIncidence( inL->clone() ); 1073 remote->addIncidence( inL->clone() );
1075 } 1074 }
1076 } 1075 }
1077 } 1076 }
1078 } 1077 }
1079 } 1078 }
1080 inL = el.next(); 1079 inL = el.next();
1081 } 1080 }
1082 1081
1083 bar.hide(); 1082 bar.hide();
1084 mLastCalendarSync = QDateTime::currentDateTime().addSecs( 1 ); 1083 mLastCalendarSync = QDateTime::currentDateTime().addSecs( 1 );
1085 eventLSync->setReadOnly( false ); 1084 eventLSync->setReadOnly( false );
1086 eventLSync->setDtStart( mLastCalendarSync ); 1085 eventLSync->setDtStart( mLastCalendarSync );
1087 eventRSync->setDtStart( mLastCalendarSync ); 1086 eventRSync->setDtStart( mLastCalendarSync );
1088 eventLSync->setDtEnd( mLastCalendarSync.addSecs( 3600 ) ); 1087 eventLSync->setDtEnd( mLastCalendarSync.addSecs( 3600 ) );
1089 eventRSync->setDtEnd( mLastCalendarSync.addSecs( 3600 ) ); 1088 eventRSync->setDtEnd( mLastCalendarSync.addSecs( 3600 ) );
1090 eventRSync->setLocation( i18n("Remote from: ")+mCurrentSyncName ) ; 1089 eventRSync->setLocation( i18n("Remote from: ")+mCurrentSyncName ) ;
1091 eventLSync->setLocation(i18n("Local from: ") + mCurrentSyncName ); 1090 eventLSync->setLocation(i18n("Local from: ") + mCurrentSyncName );
1092 eventLSync->setReadOnly( true ); 1091 eventLSync->setReadOnly( true );
1093 if ( mGlobalSyncMode == SYNC_MODE_NORMAL) 1092 if ( mGlobalSyncMode == SYNC_MODE_NORMAL)
1094 remote->addEvent( eventRSync ); 1093 remote->addEvent( eventRSync );
1095 QString mes; 1094 QString mes;
1096 mes .sprintf( i18n("Synchronization summary:\n\n %d items added to local\n %d items added to remote\n %d items updated on local\n %d items updated on remote\n %d items deleted on local\n %d items deleted on remote\n"),addedEvent, addedEventR, changedLocal, changedRemote, deletedEventL, deletedEventR ); 1095 mes .sprintf( i18n("Synchronization summary:\n\n %d items added to local\n %d items added to remote\n %d items updated on local\n %d items updated on remote\n %d items deleted on local\n %d items deleted on remote\n"),addedEvent, addedEventR, changedLocal, changedRemote, deletedEventL, deletedEventR );
1097 if ( KOPrefs::instance()->mShowSyncSummary ) { 1096 if ( KOPrefs::instance()->mShowSyncSummary ) {
1098 KMessageBox::information(this, mes, i18n("KO/Pi Synchronization") ); 1097 KMessageBox::information(this, mes, i18n("KO/Pi Synchronization") );
1099 } 1098 }
1100 qDebug( mes ); 1099 qDebug( mes );
1101 mCalendar->checkAlarmForIncidence( 0, true ); 1100 mCalendar->checkAlarmForIncidence( 0, true );
1102 return syncOK; 1101 return syncOK;
1103} 1102}
1104 1103
1105void CalendarView::setSyncDevice( QString s ) 1104void CalendarView::setSyncDevice( QString s )
1106{ 1105{
1107 mCurrentSyncDevice= s; 1106 mCurrentSyncDevice= s;
1108} 1107}
1109void CalendarView::setSyncName( QString s ) 1108void CalendarView::setSyncName( QString s )
1110{ 1109{
1111 mCurrentSyncName= s; 1110 mCurrentSyncName= s;
1112} 1111}
1113bool CalendarView::syncCalendar(QString filename, int mode) 1112bool CalendarView::syncCalendar(QString filename, int mode)
1114{ 1113{
1115 mGlobalSyncMode = SYNC_MODE_NORMAL; 1114 mGlobalSyncMode = SYNC_MODE_NORMAL;
1116 CalendarLocal* calendar = new CalendarLocal(); 1115 CalendarLocal* calendar = new CalendarLocal();
1117 calendar->setTimeZoneId(KOPrefs::instance()->mTimeZoneId); 1116 calendar->setTimeZoneId(KOPrefs::instance()->mTimeZoneId);
1118 FileStorage* storage = new FileStorage( calendar ); 1117 FileStorage* storage = new FileStorage( calendar );
1119 bool syncOK = false; 1118 bool syncOK = false;
1120 storage->setFileName( filename ); 1119 storage->setFileName( filename );
1121 // qDebug("loading ... "); 1120 // qDebug("loading ... ");
1122 if ( storage->load(KOPrefs::instance()->mUseQuicksave) ) { 1121 if ( storage->load(KOPrefs::instance()->mUseQuicksave) ) {
1123 getEventViewerDialog()->setSyncMode( true ); 1122 getEventViewerDialog()->setSyncMode( true );
1124 syncOK = synchronizeCalendar( mCalendar, calendar, mode ); 1123 syncOK = synchronizeCalendar( mCalendar, calendar, mode );
1125 getEventViewerDialog()->setSyncMode( false ); 1124 getEventViewerDialog()->setSyncMode( false );
1126 if ( syncOK ) { 1125 if ( syncOK ) {
1127 if ( KOPrefs::instance()->mWriteBackFile ) 1126 if ( KOPrefs::instance()->mWriteBackFile )
1128 { 1127 {
1129 storage->setSaveFormat( new ICalFormat( KOPrefs::instance()->mUseQuicksave) ); 1128 storage->setSaveFormat( new ICalFormat( KOPrefs::instance()->mUseQuicksave) );
1130 storage->save(); 1129 storage->save();
1131 } 1130 }
1132 } 1131 }
1133 setModified( true ); 1132 setModified( true );
1134 } 1133 }
1135 delete storage; 1134 delete storage;
1136 delete calendar; 1135 delete calendar;
1137 if ( syncOK ) 1136 if ( syncOK )
1138 updateView(); 1137 updateView();
1139 return syncOK; 1138 return syncOK;
1140} 1139}
1141void CalendarView::syncSharp() 1140void CalendarView::syncSharp()
1142{ 1141{
1143#ifndef DESKTOP_VERSION 1142#ifndef DESKTOP_VERSION
1144 mGlobalSyncMode = SYNC_MODE_EXTERNAL; 1143 mGlobalSyncMode = SYNC_MODE_EXTERNAL;
1145 //mCurrentSyncDevice = "sharp-DTM"; 1144 //mCurrentSyncDevice = "sharp-DTM";
1146 if ( KOPrefs::instance()->mAskForPreferences ) 1145 if ( KOPrefs::instance()->mAskForPreferences )
1147 edit_sync_options(); 1146 edit_sync_options();
1148 qApp->processEvents(); 1147 qApp->processEvents();
1149 CalendarLocal* calendar = new CalendarLocal(); 1148 CalendarLocal* calendar = new CalendarLocal();
1150 calendar->setTimeZoneId(KOPrefs::instance()->mTimeZoneId); 1149 calendar->setTimeZoneId(KOPrefs::instance()->mTimeZoneId);
1151 bool syncOK = false; 1150 bool syncOK = false;
1152 SharpFormat sharpFormat; 1151 SharpFormat sharpFormat;
1153 if ( sharpFormat.load( calendar, mCalendar ) ) { 1152 if ( sharpFormat.load( calendar, mCalendar ) ) {
1154 getEventViewerDialog()->setSyncMode( true ); 1153 getEventViewerDialog()->setSyncMode( true );
1155 syncOK = synchronizeCalendar( mCalendar, calendar, KOPrefs::instance()->mSyncAlgoPrefs ); 1154 syncOK = synchronizeCalendar( mCalendar, calendar, KOPrefs::instance()->mSyncAlgoPrefs );
1156 getEventViewerDialog()->setSyncMode( false ); 1155 getEventViewerDialog()->setSyncMode( false );
1157 qApp->processEvents(); 1156 qApp->processEvents();
1158 if ( syncOK ) { 1157 if ( syncOK ) {
1159 if ( KOPrefs::instance()->mWriteBackFile ) 1158 if ( KOPrefs::instance()->mWriteBackFile )
1160 { 1159 {
1161 QPtrList<Incidence> iL = mCalendar->rawIncidences(); 1160 QPtrList<Incidence> iL = mCalendar->rawIncidences();
1162 Incidence* inc = iL.first(); 1161 Incidence* inc = iL.first();
1163 /* obsolete 1162 /* obsolete
1164 while ( inc ) { 1163 while ( inc ) {
1165 inc->setZaurusStat( inc->revision () ); 1164 inc->setZaurusStat( inc->revision () );
1166 inc = iL.next(); 1165 inc = iL.next();
1167 } 1166 }
1168 */ 1167 */
1169 // pending: clean last sync event description 1168 // pending: clean last sync event description
1170 sharpFormat.save(calendar); 1169 sharpFormat.save(calendar);
1171 iL = calendar->rawIncidences(); 1170 iL = calendar->rawIncidences();
1172 inc = iL.first(); 1171 inc = iL.first();
1173 Incidence* loc; 1172 Incidence* loc;
1174 while ( inc ) { 1173 while ( inc ) {
1175 if ( inc->tempSyncStat() == SYNC_TEMPSTATE_NEW_ID ) { 1174 if ( inc->tempSyncStat() == SYNC_TEMPSTATE_NEW_ID ) {
1176 loc = mCalendar->incidence(inc->uid() ); 1175 loc = mCalendar->incidence(inc->uid() );
1177 if ( loc ) { 1176 if ( loc ) {
1178 loc->setZaurusId( inc->zaurusId() ); 1177 loc->setZaurusId( inc->zaurusId() );
1179 loc->setZaurusUid( inc->zaurusUid() ); 1178 loc->setZaurusUid( inc->zaurusUid() );
1180 } 1179 }
1181 } 1180 }
1182 inc = iL.next(); 1181 inc = iL.next();
1183 } 1182 }
1184 Incidence* lse = getLastSyncEvent(); 1183 Incidence* lse = getLastSyncEvent();
1185 if ( lse ) { 1184 if ( lse ) {
1186 lse->setReadOnly( false ); 1185 lse->setReadOnly( false );
1187 lse->setDescription( "" ); 1186 lse->setDescription( "" );
1188 lse->setReadOnly( true ); 1187 lse->setReadOnly( true );
1189 } 1188 }
1190 } 1189 }
1191 } 1190 }
1192 setModified( true ); 1191 setModified( true );
1193 } else { 1192 } else {
1194 QString question = i18n("Sorry, the database access\ncommand failed!\n\nNothing synced!\n") ; 1193 QString question = i18n("Sorry, the database access\ncommand failed!\n\nNothing synced!\n") ;
1195 QMessageBox::information( 0, i18n("KO/Pi Import - ERROR"), 1194 QMessageBox::information( 0, i18n("KO/Pi Import - ERROR"),
1196 question, i18n("Ok")) ; 1195 question, i18n("Ok")) ;
1197 1196
1198 } 1197 }
1199 delete calendar; 1198 delete calendar;
1200 updateView(); 1199 updateView();
1201 return ;//syncOK; 1200 return ;//syncOK;
1202#endif 1201#endif
1203} 1202}
1204 1203
diff --git a/korganizer/mainwindow.cpp b/korganizer/mainwindow.cpp
index 589ab2d..d0d1f3b 100644
--- a/korganizer/mainwindow.cpp
+++ b/korganizer/mainwindow.cpp
@@ -312,1037 +312,1039 @@ void MainWindow::recieve( const QCString& cmsg, const QByteArray& data )
312 mView->viewManager()->showTodoView(); 312 mView->viewManager()->showTodoView();
313 } 313 }
314 else if ( msg == "-showJournal" ) { 314 else if ( msg == "-showJournal" ) {
315 mView->dateNavigator()->selectDates( 1 ); 315 mView->dateNavigator()->selectDates( 1 );
316 mView->dateNavigator()->selectToday(); 316 mView->dateNavigator()->selectToday();
317 mView->viewManager()->showJournalView(); 317 mView->viewManager()->showJournalView();
318 } 318 }
319 else if ( msg == "-showKO" ) { 319 else if ( msg == "-showKO" ) {
320 mView->viewManager()->showNextXView(); 320 mView->viewManager()->showNextXView();
321 } 321 }
322 else if ( msg == "-showWNext" || msg == "nextView()" ) { 322 else if ( msg == "-showWNext" || msg == "nextView()" ) {
323 mView->viewManager()->showWhatsNextView(); 323 mView->viewManager()->showWhatsNextView();
324 } 324 }
325 else if ( msg == "-showNextXView" ) { 325 else if ( msg == "-showNextXView" ) {
326 mView->viewManager()->showNextXView(); 326 mView->viewManager()->showNextXView();
327 } 327 }
328 328
329 329
330 } 330 }
331 331
332 showMaximized(); 332 showMaximized();
333 raise(); 333 raise();
334} 334}
335 335
336QPixmap MainWindow::loadPixmap( QString name ) 336QPixmap MainWindow::loadPixmap( QString name )
337{ 337{
338 return SmallIcon( name ); 338 return SmallIcon( name );
339 339
340} 340}
341void MainWindow::initActions() 341void MainWindow::initActions()
342{ 342{
343 //KOPrefs::instance()->mShowFullMenu 343 //KOPrefs::instance()->mShowFullMenu
344 iconToolBar->clear(); 344 iconToolBar->clear();
345 KOPrefs *p = KOPrefs::instance(); 345 KOPrefs *p = KOPrefs::instance();
346 //QPEMenuBar *menuBar1;// = new QPEMenuBar( iconToolBar ); 346 //QPEMenuBar *menuBar1;// = new QPEMenuBar( iconToolBar );
347 347
348 QPopupMenu *viewMenu = new QPopupMenu( this ); 348 QPopupMenu *viewMenu = new QPopupMenu( this );
349 QPopupMenu *actionMenu = new QPopupMenu( this ); 349 QPopupMenu *actionMenu = new QPopupMenu( this );
350 QPopupMenu *importMenu = new QPopupMenu( this ); 350 QPopupMenu *importMenu = new QPopupMenu( this );
351 351
352 syncMenu = new QPopupMenu( this ); 352 syncMenu = new QPopupMenu( this );
353 configureAgendaMenu = new QPopupMenu( this ); 353 configureAgendaMenu = new QPopupMenu( this );
354 configureToolBarMenu = new QPopupMenu( this ); 354 configureToolBarMenu = new QPopupMenu( this );
355 QPopupMenu *helpMenu = new QPopupMenu( this ); 355 QPopupMenu *helpMenu = new QPopupMenu( this );
356 if ( KOPrefs::instance()->mShowFullMenu ) { 356 if ( KOPrefs::instance()->mShowFullMenu ) {
357 QMenuBar *menuBar1; 357 QMenuBar *menuBar1;
358 menuBar1 = menuBar(); 358 menuBar1 = menuBar();
359 menuBar1->insertItem( i18n("File"), importMenu ); 359 menuBar1->insertItem( i18n("File"), importMenu );
360 menuBar1->insertItem( i18n("View"), viewMenu ); 360 menuBar1->insertItem( i18n("View"), viewMenu );
361 menuBar1->insertItem( i18n("Actions"), actionMenu ); 361 menuBar1->insertItem( i18n("Actions"), actionMenu );
362 menuBar1->insertItem( i18n("Synchronize"), syncMenu ); 362 menuBar1->insertItem( i18n("Synchronize"), syncMenu );
363 menuBar1->insertItem( i18n("AgendaSize"),configureAgendaMenu ); 363 menuBar1->insertItem( i18n("AgendaSize"),configureAgendaMenu );
364 //menuBar1->insertItem( i18n("Toolbar"),configureToolBarMenu ); 364 //menuBar1->insertItem( i18n("Toolbar"),configureToolBarMenu );
365 menuBar1->insertItem( i18n("Help"), helpMenu ); 365 menuBar1->insertItem( i18n("Help"), helpMenu );
366 } else { 366 } else {
367 QPEMenuBar *menuBar1; 367 QPEMenuBar *menuBar1;
368 menuBar1 = new QPEMenuBar( iconToolBar ); 368 menuBar1 = new QPEMenuBar( iconToolBar );
369 QPopupMenu *menuBar = new QPopupMenu( this ); 369 QPopupMenu *menuBar = new QPopupMenu( this );
370 menuBar1->insertItem( i18n("ME"), menuBar); 370 menuBar1->insertItem( i18n("ME"), menuBar);
371 menuBar->insertItem( i18n("File"), importMenu ); 371 menuBar->insertItem( i18n("File"), importMenu );
372 menuBar->insertItem( i18n("View"), viewMenu ); 372 menuBar->insertItem( i18n("View"), viewMenu );
373 menuBar->insertItem( i18n("Actions"), actionMenu ); 373 menuBar->insertItem( i18n("Actions"), actionMenu );
374 menuBar->insertItem( i18n("Synchronize"), syncMenu ); 374 menuBar->insertItem( i18n("Synchronize"), syncMenu );
375 menuBar->insertItem( i18n("AgendaSize"),configureAgendaMenu ); 375 menuBar->insertItem( i18n("AgendaSize"),configureAgendaMenu );
376 menuBar->insertItem( i18n("Toolbar"),configureToolBarMenu ); 376 menuBar->insertItem( i18n("Toolbar"),configureToolBarMenu );
377 menuBar->insertItem( i18n("Help"), helpMenu ); 377 menuBar->insertItem( i18n("Help"), helpMenu );
378 //menuBar1->setMaximumWidth( menuBar1->sizeHint().width() ); 378 //menuBar1->setMaximumWidth( menuBar1->sizeHint().width() );
379 menuBar1->setMaximumSize( menuBar1->sizeHint( )); 379 menuBar1->setMaximumSize( menuBar1->sizeHint( ));
380 } 380 }
381 connect ( syncMenu, SIGNAL( activated ( int ) ), this, SLOT (slotSyncMenu( int ) ) ); 381 connect ( syncMenu, SIGNAL( activated ( int ) ), this, SLOT (slotSyncMenu( int ) ) );
382 // ****************** 382 // ******************
383 QAction *action; 383 QAction *action;
384 QIconSet icon; 384 QIconSet icon;
385 // QPopupMenu *configureMenu= new QPopupMenu( menuBar ); 385 // QPopupMenu *configureMenu= new QPopupMenu( menuBar );
386 configureToolBarMenu->setCheckable( true ); 386 configureToolBarMenu->setCheckable( true );
387 387
388 QString pathString = ""; 388 QString pathString = "";
389 if ( !p->mToolBarMiniIcons ) { 389 if ( !p->mToolBarMiniIcons ) {
390 if ( QApplication::desktop()->width() < 480 ) 390 if ( QApplication::desktop()->width() < 480 )
391 pathString += "icons16/"; 391 pathString += "icons16/";
392 } else 392 } else
393 pathString += "iconsmini/"; 393 pathString += "iconsmini/";
394 configureAgendaMenu->setCheckable( true ); 394 configureAgendaMenu->setCheckable( true );
395 configureAgendaMenu->insertItem(i18n("Toggle Allday"), 1 ); 395 configureAgendaMenu->insertItem(i18n("Toggle Allday"), 1 );
396 configureAgendaMenu->insertSeparator(); 396 configureAgendaMenu->insertSeparator();
397 configureAgendaMenu->insertItem(i18n("Tiny"), 4 ); 397 configureAgendaMenu->insertItem(i18n("Tiny"), 4 );
398 configureAgendaMenu->insertItem(i18n("Small"), 6 ); 398 configureAgendaMenu->insertItem(i18n("Small"), 6 );
399 configureAgendaMenu->insertItem(i18n("Medium"), 8 ); 399 configureAgendaMenu->insertItem(i18n("Medium"), 8 );
400 configureAgendaMenu->insertItem(i18n("Normal"), 10 ); 400 configureAgendaMenu->insertItem(i18n("Normal"), 10 );
401 configureAgendaMenu->insertItem(i18n("Large"), 12 ); 401 configureAgendaMenu->insertItem(i18n("Large"), 12 );
402 configureAgendaMenu->insertItem(i18n("Big"), 14 ); 402 configureAgendaMenu->insertItem(i18n("Big"), 14 );
403 configureAgendaMenu->insertItem(i18n("Bigger"), 16 ); 403 configureAgendaMenu->insertItem(i18n("Bigger"), 16 );
404 configureAgendaMenu->insertItem(i18n("Biggest"), 18 ); 404 configureAgendaMenu->insertItem(i18n("Biggest"), 18 );
405 //configureMenu->insertItem( "AgendaSize",configureAgendaMenu ); 405 //configureMenu->insertItem( "AgendaSize",configureAgendaMenu );
406 406
407 icon = loadPixmap( pathString + "configure" ); 407 icon = loadPixmap( pathString + "configure" );
408 action = new QAction( i18n("Configure"),icon, i18n("Configure..."), 0, this ); 408 action = new QAction( i18n("Configure"),icon, i18n("Configure..."), 0, this );
409 action->addTo( actionMenu ); 409 action->addTo( actionMenu );
410 connect( action, SIGNAL( activated() ), 410 connect( action, SIGNAL( activated() ),
411 mView, SLOT( edit_options() ) ); 411 mView, SLOT( edit_options() ) );
412 actionMenu->insertSeparator(); 412 actionMenu->insertSeparator();
413 icon = loadPixmap( pathString + "newevent" ); 413 icon = loadPixmap( pathString + "newevent" );
414 configureToolBarMenu->insertItem(i18n("Stretched TB"), 5 ); 414 configureToolBarMenu->insertItem(i18n("Stretched TB"), 5 );
415 configureToolBarMenu->insertSeparator(); 415 configureToolBarMenu->insertSeparator();
416 configureToolBarMenu->insertItem(icon, i18n("New Event..."), 10 ); 416 configureToolBarMenu->insertItem(icon, i18n("New Event..."), 10 );
417 QAction* ne_action = new QAction( i18n("New Event..."), icon, i18n("New Event..."), 0, this ); 417 QAction* ne_action = new QAction( i18n("New Event..."), icon, i18n("New Event..."), 0, this );
418 ne_action->addTo( actionMenu ); 418 ne_action->addTo( actionMenu );
419 connect( ne_action, SIGNAL( activated() ), 419 connect( ne_action, SIGNAL( activated() ),
420 mView, SLOT( newEvent() ) ); 420 mView, SLOT( newEvent() ) );
421 icon = loadPixmap( pathString + "newtodo" ); 421 icon = loadPixmap( pathString + "newtodo" );
422 configureToolBarMenu->insertItem(icon, i18n("New Todo..."), 20 ); 422 configureToolBarMenu->insertItem(icon, i18n("New Todo..."), 20 );
423 QAction* nt_action = new QAction( i18n("New Todo..."), icon, i18n("New Todo..."), 0, this ); 423 QAction* nt_action = new QAction( i18n("New Todo..."), icon, i18n("New Todo..."), 0, this );
424 nt_action->addTo( actionMenu ); 424 nt_action->addTo( actionMenu );
425 connect( nt_action, SIGNAL( activated() ), 425 connect( nt_action, SIGNAL( activated() ),
426 mView, SLOT( newTodo() ) ); 426 mView, SLOT( newTodo() ) );
427 icon = loadPixmap( pathString + "navi" ); 427 icon = loadPixmap( pathString + "navi" );
428 action = new QAction( i18n("Toggle DateNavigator"), icon, i18n("Toggle DateNavigator"), 0, this ); 428 action = new QAction( i18n("Toggle DateNavigator"), icon, i18n("Toggle DateNavigator"), 0, this );
429 action->addTo( viewMenu ); 429 action->addTo( viewMenu );
430 connect( action, SIGNAL( activated() ), 430 connect( action, SIGNAL( activated() ),
431 mView, SLOT( toggleDateNavigatorWidget() ) ); 431 mView, SLOT( toggleDateNavigatorWidget() ) );
432 icon = loadPixmap( pathString + "filter" ); 432 icon = loadPixmap( pathString + "filter" );
433 action = new QAction( i18n("Toggle FilterView"), icon, i18n("Toggle FilterView"), 0, this ); 433 action = new QAction( i18n("Toggle FilterView"), icon, i18n("Toggle FilterView"), 0, this );
434 action->addTo( viewMenu ); 434 action->addTo( viewMenu );
435 connect( action, SIGNAL( activated() ), 435 connect( action, SIGNAL( activated() ),
436 mView, SLOT( toggleFilter() ) ); 436 mView, SLOT( toggleFilter() ) );
437 437
438 438
439 viewMenu->insertSeparator(); 439 viewMenu->insertSeparator();
440 icon = loadPixmap( pathString + "picker" ); 440 icon = loadPixmap( pathString + "picker" );
441 action = new QAction( i18n("Date Picker"), icon, i18n("Date Picker"), 0, this ); 441 action = new QAction( i18n("Date Picker"), icon, i18n("Date Picker"), 0, this );
442 action->addTo( viewMenu ); 442 action->addTo( viewMenu );
443 connect( action, SIGNAL( activated() ), 443 connect( action, SIGNAL( activated() ),
444 mView, SLOT( showDatePicker() ) ); 444 mView, SLOT( showDatePicker() ) );
445 action->addTo( iconToolBar ); 445 action->addTo( iconToolBar );
446 viewMenu->insertSeparator(); 446 viewMenu->insertSeparator();
447 icon = loadPixmap( pathString + "list" ); 447 icon = loadPixmap( pathString + "list" );
448 configureToolBarMenu->insertItem(icon, i18n("List View"), 30 ); 448 configureToolBarMenu->insertItem(icon, i18n("List View"), 30 );
449 QAction* showlist_action = new QAction( i18n("List View"), icon, i18n("List View"), 0, this ); 449 QAction* showlist_action = new QAction( i18n("List View"), icon, i18n("List View"), 0, this );
450 showlist_action->addTo( viewMenu ); 450 showlist_action->addTo( viewMenu );
451 connect( showlist_action, SIGNAL( activated() ), 451 connect( showlist_action, SIGNAL( activated() ),
452 mView->viewManager(), SLOT( showListView() ) ); 452 mView->viewManager(), SLOT( showListView() ) );
453 453
454 454
455 icon = loadPixmap( pathString + "day" ); 455 icon = loadPixmap( pathString + "day" );
456 configureToolBarMenu->insertItem(icon, i18n("Day View"), 40 ); 456 configureToolBarMenu->insertItem(icon, i18n("Day View"), 40 );
457 QAction* day1_action = new QAction( i18n("Day View"), icon, i18n("Day View"), 0, this ); 457 QAction* day1_action = new QAction( i18n("Day View"), icon, i18n("Day View"), 0, this );
458 day1_action->addTo( viewMenu ); 458 day1_action->addTo( viewMenu );
459 // action->addTo( toolBar ); 459 // action->addTo( toolBar );
460 connect( day1_action, SIGNAL( activated() ), 460 connect( day1_action, SIGNAL( activated() ),
461 mView->viewManager(), SLOT( showDayView() ) ); 461 mView->viewManager(), SLOT( showDayView() ) );
462 462
463 icon = loadPixmap( pathString + "workweek" ); 463 icon = loadPixmap( pathString + "workweek" );
464 configureToolBarMenu->insertItem(icon, i18n("Work Week"), 50 ); 464 configureToolBarMenu->insertItem(icon, i18n("Work Week"), 50 );
465 QAction* day5_action = new QAction( i18n("Work Week"), icon, i18n("Work Week"), 0, this ); 465 QAction* day5_action = new QAction( i18n("Work Week"), icon, i18n("Work Week"), 0, this );
466 day5_action->addTo( viewMenu ); 466 day5_action->addTo( viewMenu );
467 connect( day5_action, SIGNAL( activated() ), 467 connect( day5_action, SIGNAL( activated() ),
468 mView->viewManager(), SLOT( showWorkWeekView() ) ); 468 mView->viewManager(), SLOT( showWorkWeekView() ) );
469 469
470 icon = loadPixmap( pathString + "week" ); 470 icon = loadPixmap( pathString + "week" );
471 configureToolBarMenu->insertItem(icon, i18n("Week"), 60 ); 471 configureToolBarMenu->insertItem(icon, i18n("Week"), 60 );
472 QAction* day7_action = new QAction( i18n("Week"), icon, i18n("Week"), 0, this ); 472 QAction* day7_action = new QAction( i18n("Week"), icon, i18n("Week"), 0, this );
473 day7_action->addTo( viewMenu ); 473 day7_action->addTo( viewMenu );
474 connect( day7_action, SIGNAL( activated() ), 474 connect( day7_action, SIGNAL( activated() ),
475 mView->viewManager(), SLOT( showWeekView() ) ); 475 mView->viewManager(), SLOT( showWeekView() ) );
476 476
477 icon = loadPixmap( pathString + "month" ); 477 icon = loadPixmap( pathString + "month" );
478 configureToolBarMenu->insertItem(icon, i18n("Month"), 70 ); 478 configureToolBarMenu->insertItem(icon, i18n("Month"), 70 );
479 QAction* month_action = new QAction( i18n("Month"), icon, i18n("Month"), 0, this ); 479 QAction* month_action = new QAction( i18n("Month"), icon, i18n("Month"), 0, this );
480 month_action->addTo( viewMenu ); 480 month_action->addTo( viewMenu );
481 connect( month_action, SIGNAL( activated() ), 481 connect( month_action, SIGNAL( activated() ),
482 mView->viewManager(), SLOT( showMonthView() ) ); 482 mView->viewManager(), SLOT( showMonthView() ) );
483 483
484 icon = loadPixmap( pathString + "todo" ); 484 icon = loadPixmap( pathString + "todo" );
485 configureToolBarMenu->insertItem(icon, i18n("Todo View"), 80 ); 485 configureToolBarMenu->insertItem(icon, i18n("Todo View"), 80 );
486 QAction* todoview_action = new QAction( i18n("Todo View"), icon, i18n("Todo View"), 0, this ); 486 QAction* todoview_action = new QAction( i18n("Todo View"), icon, i18n("Todo View"), 0, this );
487 todoview_action->addTo( viewMenu ); 487 todoview_action->addTo( viewMenu );
488 connect( todoview_action, SIGNAL( activated() ), 488 connect( todoview_action, SIGNAL( activated() ),
489 mView->viewManager(), SLOT( showTodoView() ) ); 489 mView->viewManager(), SLOT( showTodoView() ) );
490 490
491 icon = loadPixmap( pathString + "journal" ); 491 icon = loadPixmap( pathString + "journal" );
492 configureToolBarMenu->insertItem(icon, i18n("Journal"), 90 ); 492 configureToolBarMenu->insertItem(icon, i18n("Journal"), 90 );
493 QAction* viewjournal_action = new QAction( i18n("Journal"), icon, i18n("Journal"), 0, this ); 493 QAction* viewjournal_action = new QAction( i18n("Journal"), icon, i18n("Journal"), 0, this );
494 viewjournal_action->addTo( viewMenu ); 494 viewjournal_action->addTo( viewMenu );
495 connect( viewjournal_action, SIGNAL( activated() ), 495 connect( viewjournal_action, SIGNAL( activated() ),
496 mView->viewManager(), SLOT( showJournalView() ) ); 496 mView->viewManager(), SLOT( showJournalView() ) );
497 497
498 icon = loadPixmap( pathString + "xdays" ); 498 icon = loadPixmap( pathString + "xdays" );
499 configureToolBarMenu->insertItem(icon, i18n("Next days"), 100,4 ); 499 configureToolBarMenu->insertItem(icon, i18n("Next days"), 100,4 );
500 QAction* xdays_action = new QAction( i18n("Next days"), icon, i18n("Next days"), 0, this ); 500 QAction* xdays_action = new QAction( i18n("Next days"), icon, i18n("Next days"), 0, this );
501 xdays_action->addTo( viewMenu ); 501 xdays_action->addTo( viewMenu );
502 connect( xdays_action, SIGNAL( activated() ), 502 connect( xdays_action, SIGNAL( activated() ),
503 mView->viewManager(), SLOT( showNextXView() ) ); 503 mView->viewManager(), SLOT( showNextXView() ) );
504 504
505 icon = loadPixmap( pathString + "whatsnext" ); 505 icon = loadPixmap( pathString + "whatsnext" );
506 configureToolBarMenu->insertItem(icon, i18n("What's Next"), 110, 4 ); 506 configureToolBarMenu->insertItem(icon, i18n("What's Next"), 110, 4 );
507 QAction* whatsnext_action = new QAction( i18n("What's Next"), icon, i18n("What's Next"), 0, this ); 507 QAction* whatsnext_action = new QAction( i18n("What's Next"), icon, i18n("What's Next"), 0, this );
508 whatsnext_action->addTo( viewMenu ); 508 whatsnext_action->addTo( viewMenu );
509 connect( whatsnext_action, SIGNAL( activated() ), 509 connect( whatsnext_action, SIGNAL( activated() ),
510 mView->viewManager(), SLOT( showWhatsNextView() ) ); 510 mView->viewManager(), SLOT( showWhatsNextView() ) );
511 511
512#if 0 512#if 0
513 action = new QAction( "view_timespan", "Time Span", 0, this ); 513 action = new QAction( "view_timespan", "Time Span", 0, this );
514 action->addTo( viewMenu ); 514 action->addTo( viewMenu );
515 connect( action, SIGNAL( activated() ), 515 connect( action, SIGNAL( activated() ),
516 mView->viewManager(), SLOT( showTimeSpanView() ) ); 516 mView->viewManager(), SLOT( showTimeSpanView() ) );
517#endif 517#endif
518 518
519 mNewSubTodoAction = new QAction( "new_subtodo", i18n("New Sub-Todo..."), 0, 519 mNewSubTodoAction = new QAction( "new_subtodo", i18n("New Sub-Todo..."), 0,
520 this ); 520 this );
521 mNewSubTodoAction->addTo( actionMenu ); 521 mNewSubTodoAction->addTo( actionMenu );
522 connect( mNewSubTodoAction, SIGNAL( activated() ), 522 connect( mNewSubTodoAction, SIGNAL( activated() ),
523 mView, SLOT( newSubTodo() ) ); 523 mView, SLOT( newSubTodo() ) );
524 524
525 actionMenu->insertSeparator(); 525 actionMenu->insertSeparator();
526 526
527 mShowAction = new QAction( "show_incidence", i18n("Show..."), 0, this ); 527 mShowAction = new QAction( "show_incidence", i18n("Show..."), 0, this );
528 mShowAction->addTo( actionMenu ); 528 mShowAction->addTo( actionMenu );
529 connect( mShowAction, SIGNAL( activated() ), 529 connect( mShowAction, SIGNAL( activated() ),
530 mView, SLOT( showIncidence() ) ); 530 mView, SLOT( showIncidence() ) );
531 531
532 mEditAction = new QAction( "edit_incidence", i18n("Edit..."), 0, this ); 532 mEditAction = new QAction( "edit_incidence", i18n("Edit..."), 0, this );
533 mEditAction->addTo( actionMenu ); 533 mEditAction->addTo( actionMenu );
534 connect( mEditAction, SIGNAL( activated() ), 534 connect( mEditAction, SIGNAL( activated() ),
535 mView, SLOT( editIncidence() ) ); 535 mView, SLOT( editIncidence() ) );
536 536
537 mDeleteAction = new QAction( "delete_incidence", i18n("Delete..."), 0, this ); 537 mDeleteAction = new QAction( "delete_incidence", i18n("Delete..."), 0, this );
538 mDeleteAction->addTo( actionMenu ); 538 mDeleteAction->addTo( actionMenu );
539 connect( mDeleteAction, SIGNAL( activated() ), 539 connect( mDeleteAction, SIGNAL( activated() ),
540 mView, SLOT( deleteIncidence() ) ); 540 mView, SLOT( deleteIncidence() ) );
541 541
542 actionMenu->insertSeparator(); 542 actionMenu->insertSeparator();
543 543
544 action = new QAction( "purge_completed", i18n("Purge Completed"), 0, 544 action = new QAction( "purge_completed", i18n("Purge Completed"), 0,
545 this ); 545 this );
546 action->addTo( actionMenu ); 546 action->addTo( actionMenu );
547 connect( action, SIGNAL( activated() ), mView, SLOT( purgeCompleted() ) ); 547 connect( action, SIGNAL( activated() ), mView, SLOT( purgeCompleted() ) );
548 548
549 icon = loadPixmap( pathString + "search" ); 549 icon = loadPixmap( pathString + "search" );
550 QAction* search_action = new QAction( i18n("Search"), icon, i18n("Search..."), 0, this ); 550 QAction* search_action = new QAction( i18n("Search"), icon, i18n("Search..."), 0, this );
551 configureToolBarMenu->insertItem(icon, i18n("Search"), 120 , 4); 551 configureToolBarMenu->insertItem(icon, i18n("Search"), 120 , 4);
552 search_action->addTo( actionMenu ); 552 search_action->addTo( actionMenu );
553 connect( search_action, SIGNAL( activated() ), 553 connect( search_action, SIGNAL( activated() ),
554 mView->dialogManager(), SLOT( showSearchDialog() ) ); 554 mView->dialogManager(), SLOT( showSearchDialog() ) );
555 555
556 icon = loadPixmap( pathString + "today" ); 556 icon = loadPixmap( pathString + "today" );
557 configureToolBarMenu->insertItem(icon, i18n("Go to Today"), 130); 557 configureToolBarMenu->insertItem(icon, i18n("Go to Today"), 130);
558 QAction* today_action = new QAction( i18n("Go to Today"), icon, i18n("Go to Today"), 0, this ); 558 QAction* today_action = new QAction( i18n("Go to Today"), icon, i18n("Go to Today"), 0, this );
559 today_action->addTo( actionMenu ); 559 today_action->addTo( actionMenu );
560 connect( today_action, SIGNAL( activated() ), 560 connect( today_action, SIGNAL( activated() ),
561 mView, SLOT( goToday() ) ); 561 mView, SLOT( goToday() ) );
562 562
563 if ( KOPrefs::instance()->mShowFullMenu ) { 563 if ( KOPrefs::instance()->mShowFullMenu ) {
564 actionMenu->insertSeparator(); 564 actionMenu->insertSeparator();
565 actionMenu->insertItem( i18n("Configure Toolbar"),configureToolBarMenu ); 565 actionMenu->insertItem( i18n("Configure Toolbar"),configureToolBarMenu );
566 566
567 } 567 }
568 // actionMenu->insertSeparator(); 568 // actionMenu->insertSeparator();
569 action = new QAction( "import_qtopia", i18n("Import (*.ics/*.vcs) file"), 0, 569 action = new QAction( "import_qtopia", i18n("Import (*.ics/*.vcs) file"), 0,
570 this ); 570 this );
571 action->addTo( importMenu ); 571 action->addTo( importMenu );
572 connect( action, SIGNAL( activated() ), SLOT( importIcal() ) ); 572 connect( action, SIGNAL( activated() ), SLOT( importIcal() ) );
573 action = new QAction( "import_quick", i18n("Import last file"), 0, 573 action = new QAction( "import_quick", i18n("Import last file"), 0,
574 this ); 574 this );
575 action->addTo( importMenu ); 575 action->addTo( importMenu );
576 connect( action, SIGNAL( activated() ), SLOT( quickImportIcal() ) ); 576 connect( action, SIGNAL( activated() ), SLOT( quickImportIcal() ) );
577 importMenu->insertSeparator(); 577 importMenu->insertSeparator();
578 action = new QAction( "import_bday", i18n("Import Birthdays (KA/Pi)"), 0, 578 action = new QAction( "import_bday", i18n("Import Birthdays (KA/Pi)"), 0,
579 this ); 579 this );
580 action->addTo( importMenu ); 580 action->addTo( importMenu );
581 connect( action, SIGNAL( activated() ), SLOT( importBday() ) ); 581 connect( action, SIGNAL( activated() ), SLOT( importBday() ) );
582#ifndef DESKTOP_VERSION 582#ifndef DESKTOP_VERSION
583 importMenu->insertSeparator(); 583 importMenu->insertSeparator();
584 action = new QAction( "import_qtopia", i18n("Import Opie/Qtopia Cal."), 0, 584 action = new QAction( "import_qtopia", i18n("Import Opie/Qtopia Cal."), 0,
585 this ); 585 this );
586 action->addTo( importMenu ); 586 action->addTo( importMenu );
587 connect( action, SIGNAL( activated() ), SLOT( importQtopia() ) ); 587 connect( action, SIGNAL( activated() ), SLOT( importQtopia() ) );
588#else 588#else
589#ifdef _WIN32_ 589#ifdef _WIN32_
590 importMenu->insertSeparator(); 590 importMenu->insertSeparator();
591 action = new QAction( "import_ol", i18n("Import from OL"), 0, 591 action = new QAction( "import_ol", i18n("Import from OL"), 0,
592 this ); 592 this );
593 action->addTo( importMenu ); 593 action->addTo( importMenu );
594 connect( action, SIGNAL( activated() ), SLOT( importOL() ) ); 594 connect( action, SIGNAL( activated() ), SLOT( importOL() ) );
595#endif 595#endif
596#endif 596#endif
597 597
598 importMenu->insertSeparator(); 598 importMenu->insertSeparator();
599 action = new QAction( "load_cal", i18n("Load Calendar Backup"), 0, 599 action = new QAction( "load_cal", i18n("Load Calendar Backup"), 0,
600 this ); 600 this );
601 action->addTo( importMenu ); 601 action->addTo( importMenu );
602 connect( action, SIGNAL( activated() ), SLOT( loadCalendar() ) ); 602 connect( action, SIGNAL( activated() ), SLOT( loadCalendar() ) );
603 603
604 action = new QAction( "save_cal", i18n("Save Calendar Backup"), 0, 604 action = new QAction( "save_cal", i18n("Save Calendar Backup"), 0,
605 this ); 605 this );
606 action->addTo( importMenu ); 606 action->addTo( importMenu );
607 connect( action, SIGNAL( activated() ), SLOT( saveCalendar() ) ); 607 connect( action, SIGNAL( activated() ), SLOT( saveCalendar() ) );
608 608
609 importMenu->insertSeparator(); 609 importMenu->insertSeparator();
610 action = new QAction( "import_qtopia", i18n("Export VCalendar"), 0, 610 action = new QAction( "import_qtopia", i18n("Export VCalendar"), 0,
611 this ); 611 this );
612 action->addTo( importMenu ); connect( action, SIGNAL( activated() ), SLOT( exportVCalendar() ) ); 612 action->addTo( importMenu ); connect( action, SIGNAL( activated() ), SLOT( exportVCalendar() ) );
613 importMenu->insertSeparator(); 613 importMenu->insertSeparator();
614 action = new QAction( "manage cat", i18n("Manage new categories..."), 0, 614 action = new QAction( "manage cat", i18n("Manage new categories..."), 0,
615 this ); 615 this );
616 action->addTo( importMenu ); 616 action->addTo( importMenu );
617 connect( action, SIGNAL( activated() ), mView, SLOT( manageCategories() ) ); 617 connect( action, SIGNAL( activated() ), mView, SLOT( manageCategories() ) );
618#ifndef DESKTOP_VERSION 618#ifndef DESKTOP_VERSION
619 importMenu->insertSeparator(); 619 importMenu->insertSeparator();
620 action = new QAction( "beam all", i18n("Beam complete calendar..."), 0, 620 action = new QAction( "beam all", i18n("Beam complete calendar..."), 0,
621 this ); 621 this );
622 action->addTo( importMenu ); 622 action->addTo( importMenu );
623 connect( action, SIGNAL( activated() ), mView, SLOT( beamCalendar() ) ); 623 connect( action, SIGNAL( activated() ), mView, SLOT( beamCalendar() ) );
624 624
625 action = new QAction( "beam all", i18n("Beam filtered calendar..."), 0, 625 action = new QAction( "beam all", i18n("Beam filtered calendar..."), 0,
626 this ); 626 this );
627 action->addTo( importMenu ); 627 action->addTo( importMenu );
628 connect( action, SIGNAL( activated() ), mView, SLOT( beamFilteredCalendar()) ); 628 connect( action, SIGNAL( activated() ), mView, SLOT( beamFilteredCalendar()) );
629#else 629#else
630 importMenu->insertSeparator(); 630 importMenu->insertSeparator();
631 icon = loadPixmap( pathString + "print" ); 631 icon = loadPixmap( pathString + "print" );
632 action = new QAction( i18n("Print calendar..."),icon,i18n("Print calendar..."), 0, this ); 632 action = new QAction( i18n("Print calendar..."),icon,i18n("Print calendar..."), 0, this );
633 action->addTo( importMenu ); 633 action->addTo( importMenu );
634 connect( action, SIGNAL( activated() ), 634 connect( action, SIGNAL( activated() ),
635 this, SLOT( printCal() ) ); 635 this, SLOT( printCal() ) );
636 636
637 icon = loadPixmap( pathString + "print" ); 637 icon = loadPixmap( pathString + "print" );
638 action = new QAction( i18n("Print agenda selection..."),icon,i18n("Print agenda selection..."), 0, this ); 638 action = new QAction( i18n("Print agenda selection..."),icon,i18n("Print agenda selection..."), 0, this );
639 action->addTo( importMenu ); 639 action->addTo( importMenu );
640 connect( action, SIGNAL( activated() ), 640 connect( action, SIGNAL( activated() ),
641 this, SLOT( printSel() ) ); 641 this, SLOT( printSel() ) );
642#endif 642#endif
643 importMenu->insertSeparator(); 643 importMenu->insertSeparator();
644 action = new QAction( "beam all", i18n("Save"), 0, 644 action = new QAction( "beam all", i18n("Save"), 0,
645 this ); 645 this );
646 action->addTo( importMenu ); 646 action->addTo( importMenu );
647 connect( action, SIGNAL( activated() ), this, SLOT( save() ) ); 647 connect( action, SIGNAL( activated() ), this, SLOT( save() ) );
648 action = new QAction( "beam all", i18n("Exit (+save)"), 0, 648 action = new QAction( "beam all", i18n("Exit (+save)"), 0,
649 this ); 649 this );
650 action->addTo( importMenu ); 650 action->addTo( importMenu );
651 connect( action, SIGNAL( activated() ), this, SLOT( close() ) ); 651 connect( action, SIGNAL( activated() ), this, SLOT( close() ) );
652 652
653 //menuBar->insertItem( "Configure",configureMenu ); 653 //menuBar->insertItem( "Configure",configureMenu );
654 //configureMenu->insertItem( "Toolbar",configureToolBarMenu ); 654 //configureMenu->insertItem( "Toolbar",configureToolBarMenu );
655 icon = loadPixmap( "korganizer/korganizer" ); 655 icon = loadPixmap( "korganizer/korganizer" );
656 action = new QAction( "Keys + Colors", i18n("Keys + Colors..."), 0, this ); 656 action = new QAction( "Keys + Colors", i18n("Keys + Colors..."), 0, this );
657 action->addTo( helpMenu ); 657 action->addTo( helpMenu );
658 connect( action, SIGNAL( activated() ), 658 connect( action, SIGNAL( activated() ),
659 SLOT( keyBindings() ) ); 659 SLOT( keyBindings() ) );
660 action = new QAction( "featureHowto", i18n("Features + hints..."), 0,this ); 660 action = new QAction( "featureHowto", i18n("Features + hints..."), 0,this );
661 action->addTo( helpMenu ); 661 action->addTo( helpMenu );
662 connect( action, SIGNAL( activated() ), 662 connect( action, SIGNAL( activated() ),
663 SLOT( features() ) ); 663 SLOT( features() ) );
664 action = new QAction( "Auto saving", i18n("Auto saving..."), 0, this ); 664 action = new QAction( "Auto saving", i18n("Auto saving..."), 0, this );
665 action->addTo( helpMenu ); 665 action->addTo( helpMenu );
666 connect( action, SIGNAL( activated() ), 666 connect( action, SIGNAL( activated() ),
667 SLOT( aboutAutoSaving() ) ); 667 SLOT( aboutAutoSaving() ) );
668 action = new QAction( "Problemd", i18n("Known Problems..."), 0,this ); 668 action = new QAction( "Problemd", i18n("Known Problems..."), 0,this );
669 action->addTo( helpMenu ); 669 action->addTo( helpMenu );
670 connect( action, SIGNAL( activated() ), 670 connect( action, SIGNAL( activated() ),
671 SLOT( aboutKnownBugs() ) ); 671 SLOT( aboutKnownBugs() ) );
672 action = new QAction( "Translate Howto", i18n("User translation..."), 0,this ); 672 action = new QAction( "Translate Howto", i18n("User translation..."), 0,this );
673 action->addTo( helpMenu ); 673 action->addTo( helpMenu );
674 connect( action, SIGNAL( activated() ), 674 connect( action, SIGNAL( activated() ),
675 SLOT( usertrans() ) ); 675 SLOT( usertrans() ) );
676 action = new QAction( "Sync Howto", i18n("Sync HowTo..."), 0,this ); 676 action = new QAction( "Sync Howto", i18n("Sync HowTo..."), 0,this );
677 action->addTo( helpMenu ); 677 action->addTo( helpMenu );
678 connect( action, SIGNAL( activated() ), 678 connect( action, SIGNAL( activated() ),
679 SLOT( synchowto() ) ); 679 SLOT( synchowto() ) );
680 action = new QAction( "Whats New", i18n("What's new?"), 0,this ); 680 action = new QAction( "Whats New", i18n("What's new?"), 0,this );
681 action->addTo( helpMenu ); 681 action->addTo( helpMenu );
682 connect( action, SIGNAL( activated() ), 682 connect( action, SIGNAL( activated() ),
683 SLOT( whatsNew() ) ); 683 SLOT( whatsNew() ) );
684 action = new QAction( "Frequently asked questions", i18n("FAQ..."), 0,this ); 684 action = new QAction( "Frequently asked questions", i18n("FAQ..."), 0,this );
685 action->addTo( helpMenu ); 685 action->addTo( helpMenu );
686 connect( action, SIGNAL( activated() ), 686 connect( action, SIGNAL( activated() ),
687 SLOT( faq() ) ); 687 SLOT( faq() ) );
688 688
689 689
690 action = new QAction( "about", i18n("About..."), 0, this ); 690 action = new QAction( "about", i18n("About..."), 0, this );
691 action->addTo( helpMenu ); 691 action->addTo( helpMenu );
692 connect( action, SIGNAL( activated() ), 692 connect( action, SIGNAL( activated() ),
693 SLOT( about() ) ); 693 SLOT( about() ) );
694 //menuBar->insertSeparator(); 694 //menuBar->insertSeparator();
695 695
696 // ****************************************************** 696 // ******************************************************
697 // menubar icons 697 // menubar icons
698 698
699 699
700 iconToolBar->setHorizontalStretchable (true ); 700 iconToolBar->setHorizontalStretchable (true );
701 //menuBar->insertItem( iconToolBar ); 701 //menuBar->insertItem( iconToolBar );
702 //xdays_action 702 //xdays_action
703 if (p-> mShowIconNewEvent) 703 if (p-> mShowIconNewEvent)
704 ne_action->addTo( iconToolBar ); 704 ne_action->addTo( iconToolBar );
705 if (p->mShowIconNewTodo ) 705 if (p->mShowIconNewTodo )
706 nt_action->addTo( iconToolBar ); 706 nt_action->addTo( iconToolBar );
707 if (p-> mShowIconSearch) 707 if (p-> mShowIconSearch)
708 search_action->addTo( iconToolBar ); 708 search_action->addTo( iconToolBar );
709 if (p-> mShowIconNext) 709 if (p-> mShowIconNext)
710 whatsnext_action->addTo( iconToolBar ); 710 whatsnext_action->addTo( iconToolBar );
711 if (p-> mShowIconNextDays) 711 if (p-> mShowIconNextDays)
712 xdays_action->addTo( iconToolBar ); 712 xdays_action->addTo( iconToolBar );
713 if (p-> mShowIconList) 713 if (p-> mShowIconList)
714 showlist_action->addTo( iconToolBar ); 714 showlist_action->addTo( iconToolBar );
715 if (p-> mShowIconDay1) 715 if (p-> mShowIconDay1)
716 day1_action->addTo( iconToolBar ); 716 day1_action->addTo( iconToolBar );
717 if (p-> mShowIconDay5) 717 if (p-> mShowIconDay5)
718 day5_action->addTo( iconToolBar ); 718 day5_action->addTo( iconToolBar );
719 if (p-> mShowIconDay7) 719 if (p-> mShowIconDay7)
720 day7_action->addTo( iconToolBar ); 720 day7_action->addTo( iconToolBar );
721 if (p-> mShowIconMonth) 721 if (p-> mShowIconMonth)
722 month_action->addTo( iconToolBar ); 722 month_action->addTo( iconToolBar );
723 if (p-> mShowIconTodoview) 723 if (p-> mShowIconTodoview)
724 todoview_action->addTo( iconToolBar ); 724 todoview_action->addTo( iconToolBar );
725 if (p-> mShowIconJournal) 725 if (p-> mShowIconJournal)
726 viewjournal_action->addTo( iconToolBar ); 726 viewjournal_action->addTo( iconToolBar );
727 icon = loadPixmap( pathString + "2leftarrowB" ); 727 icon = loadPixmap( pathString + "2leftarrowB" );
728 configureToolBarMenu->insertItem(icon, i18n("Prev. month"), 200, 14); 728 configureToolBarMenu->insertItem(icon, i18n("Prev. month"), 200, 14);
729 if (p-> mShowIconBackFast) { 729 if (p-> mShowIconBackFast) {
730 action = new QAction( i18n("Prev. month"), icon, i18n("Prev. month"),0 , this ); 730 action = new QAction( i18n("Prev. month"), icon, i18n("Prev. month"),0 , this );
731 connect( action, SIGNAL( activated() ), 731 connect( action, SIGNAL( activated() ),
732 mView, SLOT( goPreviousMonth() ) ); 732 mView, SLOT( goPreviousMonth() ) );
733 action->addTo( iconToolBar ); 733 action->addTo( iconToolBar );
734 } 734 }
735 icon = loadPixmap( pathString + "1leftarrowB" ); 735 icon = loadPixmap( pathString + "1leftarrowB" );
736 configureToolBarMenu->insertItem(icon, i18n("Go backward"), 210,15); 736 configureToolBarMenu->insertItem(icon, i18n("Go backward"), 210,15);
737 if (p-> mShowIconBack) { 737 if (p-> mShowIconBack) {
738 action = new QAction( i18n("Go backward"), icon, i18n("Go backward"),0 , this ); 738 action = new QAction( i18n("Go backward"), icon, i18n("Go backward"),0 , this );
739 connect( action, SIGNAL( activated() ), 739 connect( action, SIGNAL( activated() ),
740 mView, SLOT( goPrevious() ) ); 740 mView, SLOT( goPrevious() ) );
741 action->addTo( iconToolBar ); 741 action->addTo( iconToolBar );
742 } 742 }
743 if (p-> mShowIconToday) 743 if (p-> mShowIconToday)
744 today_action->addTo( iconToolBar ); 744 today_action->addTo( iconToolBar );
745 icon = loadPixmap( pathString + "1rightarrowB" ); 745 icon = loadPixmap( pathString + "1rightarrowB" );
746 configureToolBarMenu->insertItem(icon, i18n("Go forward"), 220); 746 configureToolBarMenu->insertItem(icon, i18n("Go forward"), 220);
747 if (p-> mShowIconForward) { 747 if (p-> mShowIconForward) {
748 action = new QAction( i18n("Go forward"), icon, i18n("Go forward"),0 , this ); 748 action = new QAction( i18n("Go forward"), icon, i18n("Go forward"),0 , this );
749 connect( action, SIGNAL( activated() ), 749 connect( action, SIGNAL( activated() ),
750 mView, SLOT( goNext() ) ); 750 mView, SLOT( goNext() ) );
751 action->addTo( iconToolBar ); 751 action->addTo( iconToolBar );
752 } 752 }
753 icon = loadPixmap( pathString + "2rightarrowB" ); 753 icon = loadPixmap( pathString + "2rightarrowB" );
754 configureToolBarMenu->insertItem(icon, i18n("Next month"), 230); 754 configureToolBarMenu->insertItem(icon, i18n("Next month"), 230);
755 if (p-> mShowIconForwardFast) { 755 if (p-> mShowIconForwardFast) {
756 action = new QAction( i18n("Next month"), icon, i18n("Next month"),0 , this ); 756 action = new QAction( i18n("Next month"), icon, i18n("Next month"),0 , this );
757 connect( action, SIGNAL( activated() ), 757 connect( action, SIGNAL( activated() ),
758 mView, SLOT( goNextMonth() ) ); 758 mView, SLOT( goNextMonth() ) );
759 action->addTo( iconToolBar ); 759 action->addTo( iconToolBar );
760 } 760 }
761 761
762 762
763 configureToolBarMenu->insertItem(i18n("What's This?"), 300); 763 configureToolBarMenu->insertItem(i18n("What's This?"), 300);
764 764
765 if (p-> mShowIconNewEvent) 765 if (p-> mShowIconNewEvent)
766 configureToolBarMenu->setItemChecked( 10, true ); 766 configureToolBarMenu->setItemChecked( 10, true );
767 if (p->mShowIconNewTodo ) 767 if (p->mShowIconNewTodo )
768 configureToolBarMenu->setItemChecked( 20, true ); 768 configureToolBarMenu->setItemChecked( 20, true );
769 if (p-> mShowIconSearch) 769 if (p-> mShowIconSearch)
770 configureToolBarMenu->setItemChecked( 120, true ); 770 configureToolBarMenu->setItemChecked( 120, true );
771 if (p-> mShowIconList) 771 if (p-> mShowIconList)
772 configureToolBarMenu->setItemChecked( 30, true ); 772 configureToolBarMenu->setItemChecked( 30, true );
773 if (p-> mShowIconDay1) 773 if (p-> mShowIconDay1)
774 configureToolBarMenu->setItemChecked( 40, true ); 774 configureToolBarMenu->setItemChecked( 40, true );
775 if (p-> mShowIconDay5) 775 if (p-> mShowIconDay5)
776 configureToolBarMenu->setItemChecked( 50, true ); 776 configureToolBarMenu->setItemChecked( 50, true );
777 if (p-> mShowIconDay7) 777 if (p-> mShowIconDay7)
778 configureToolBarMenu->setItemChecked( 60, true ); 778 configureToolBarMenu->setItemChecked( 60, true );
779 if (p-> mShowIconMonth) 779 if (p-> mShowIconMonth)
780 configureToolBarMenu->setItemChecked( 70, true ); 780 configureToolBarMenu->setItemChecked( 70, true );
781 if (p-> mShowIconTodoview) 781 if (p-> mShowIconTodoview)
782 configureToolBarMenu->setItemChecked( 80, true ); 782 configureToolBarMenu->setItemChecked( 80, true );
783 if (p-> mShowIconBackFast) 783 if (p-> mShowIconBackFast)
784 configureToolBarMenu->setItemChecked( 200, true ); 784 configureToolBarMenu->setItemChecked( 200, true );
785 if (p-> mShowIconBack) 785 if (p-> mShowIconBack)
786 configureToolBarMenu->setItemChecked( 210, true ); 786 configureToolBarMenu->setItemChecked( 210, true );
787 if (p-> mShowIconToday) 787 if (p-> mShowIconToday)
788 configureToolBarMenu->setItemChecked( 130, true ); 788 configureToolBarMenu->setItemChecked( 130, true );
789 if (p-> mShowIconForward) 789 if (p-> mShowIconForward)
790 configureToolBarMenu->setItemChecked( 220, true ); 790 configureToolBarMenu->setItemChecked( 220, true );
791 if (p-> mShowIconForwardFast) 791 if (p-> mShowIconForwardFast)
792 configureToolBarMenu->setItemChecked( 230, true ); 792 configureToolBarMenu->setItemChecked( 230, true );
793 if (p-> mShowIconNextDays) 793 if (p-> mShowIconNextDays)
794 configureToolBarMenu->setItemChecked( 100, true ); 794 configureToolBarMenu->setItemChecked( 100, true );
795 if (p-> mShowIconNext) 795 if (p-> mShowIconNext)
796 configureToolBarMenu->setItemChecked( 110, true ); 796 configureToolBarMenu->setItemChecked( 110, true );
797 if (p-> mShowIconJournal) 797 if (p-> mShowIconJournal)
798 configureToolBarMenu->setItemChecked( 90, true ); 798 configureToolBarMenu->setItemChecked( 90, true );
799 if (p-> mShowIconWhatsThis) 799 if (p-> mShowIconWhatsThis)
800 configureToolBarMenu->setItemChecked( 300, true ); 800 configureToolBarMenu->setItemChecked( 300, true );
801 801
802 QLabel* dummy = new QLabel( iconToolBar ); 802 QLabel* dummy = new QLabel( iconToolBar );
803 dummy->setBackgroundColor( iconToolBar->backgroundColor() ); 803 dummy->setBackgroundColor( iconToolBar->backgroundColor() );
804 if (!p-> mShowIconStretch) 804 if (!p-> mShowIconStretch)
805 iconToolBar->setStretchableWidget ( dummy ) ; 805 iconToolBar->setStretchableWidget ( dummy ) ;
806 else 806 else
807 configureToolBarMenu->setItemChecked( 5, true ); 807 configureToolBarMenu->setItemChecked( 5, true );
808 if (p-> mShowIconWhatsThis) 808 if (p-> mShowIconWhatsThis)
809 QWhatsThis::whatsThisButton ( iconToolBar ); 809 QWhatsThis::whatsThisButton ( iconToolBar );
810 connect( configureToolBarMenu, SIGNAL( activated( int ) ),this, SLOT(configureToolBar( int ) ) ); 810 connect( configureToolBarMenu, SIGNAL( activated( int ) ),this, SLOT(configureToolBar( int ) ) );
811 configureAgenda( p->mHourSize ); 811 configureAgenda( p->mHourSize );
812 connect( configureAgendaMenu, SIGNAL( activated( int ) ),this, SLOT(configureAgenda( int ) ) ); 812 connect( configureAgendaMenu, SIGNAL( activated( int ) ),this, SLOT(configureAgenda( int ) ) );
813} 813}
814void MainWindow::fillSyncMenu() 814void MainWindow::fillSyncMenu()
815{ 815{
816 syncMenu->clear(); 816 syncMenu->clear();
817 syncMenu->insertItem( i18n("Configure..."), 0 ); 817 syncMenu->insertItem( i18n("Configure..."), 0 );
818 syncMenu->insertSeparator(); 818 syncMenu->insertSeparator();
819 syncMenu->insertItem( i18n("Multiple sync"), 1 ); 819 syncMenu->insertItem( i18n("Multiple sync"), 1 );
820 syncMenu->insertSeparator(); 820 syncMenu->insertSeparator();
821 KConfig config ( locateLocal( "config","syncprofilesrc" ) ); 821 KConfig config ( locateLocal( "config","syncprofilesrc" ) );
822 config.setGroup("SyncProfiles"); 822 config.setGroup("SyncProfiles");
823 QStringList prof = config.readListEntry("SyncProfileNames"); 823 QStringList prof = config.readListEntry("SyncProfileNames");
824 824 KOPrefs::instance()->mLocalMachineName = config.readEntry("LocalMachineName","undefined");
825 if ( prof.count() < 3 ) { 825 if ( prof.count() < 3 ) {
826 prof.clear(); 826 prof.clear();
827 prof << i18n("Sharp-DTM"); 827 prof << i18n("Sharp-DTM");
828 prof << i18n("Local file"); 828 prof << i18n("Local file");
829 prof << i18n("Last file"); 829 prof << i18n("Last file");
830 KSyncProfile* temp = new KSyncProfile (); 830 KSyncProfile* temp = new KSyncProfile ();
831 temp->setName( prof[0] ); 831 temp->setName( prof[0] );
832 temp->writeConfig(&config); 832 temp->writeConfig(&config);
833 temp->setName( prof[1] ); 833 temp->setName( prof[1] );
834 temp->writeConfig(&config); 834 temp->writeConfig(&config);
835 temp->setName( prof[2] ); 835 temp->setName( prof[2] );
836 temp->writeConfig(&config); 836 temp->writeConfig(&config);
837 config.setGroup("SyncProfiles");
838 config.writeEntry("SyncProfileNames",prof);
837 config.sync(); 839 config.sync();
838 delete temp; 840 delete temp;
839 } 841 }
840 KOPrefs::instance()->mSyncProfileNames = prof; 842 KOPrefs::instance()->mSyncProfileNames = prof;
841 int i; 843 int i;
842 for ( i = 0; i < prof.count(); ++i ) { 844 for ( i = 0; i < prof.count(); ++i ) {
843 845
844 syncMenu->insertItem( prof[i], 1000+i ); 846 syncMenu->insertItem( prof[i], 1000+i );
845 if ( i == 2 ) 847 if ( i == 2 )
846 syncMenu->insertSeparator(); 848 syncMenu->insertSeparator();
847 } 849 }
848 QDir app_dir; 850 QDir app_dir;
849 if ( !app_dir.exists(QDir::homeDirPath()+"/Applications/dtm" ) ) { 851 if ( !app_dir.exists(QDir::homeDirPath()+"/Applications/dtm" ) ) {
850 syncMenu->setItemEnabled( false , 1000 ); 852 syncMenu->setItemEnabled( false , 1000 );
851 } 853 }
852} 854}
853 855
854int MainWindow::ringSync() 856int MainWindow::ringSync()
855{ 857{
856 int syncedProfiles = 0; 858 int syncedProfiles = 0;
857 int i; 859 int i;
858 QTime timer; 860 QTime timer;
859 KConfig *config = KOGlobals::config(); 861 KConfig *config = KOGlobals::config();
860 QStringList syncProfileNames = KOPrefs::instance()->mSyncProfileNames; 862 QStringList syncProfileNames = KOPrefs::instance()->mSyncProfileNames;
861 KSyncProfile* temp = new KSyncProfile (); 863 KSyncProfile* temp = new KSyncProfile ();
862 KOPrefs::instance()->mAskForPreferences = false; 864 KOPrefs::instance()->mAskForPreferences = false;
863 for ( i = 0; i < syncProfileNames.count(); ++i ) { 865 for ( i = 0; i < syncProfileNames.count(); ++i ) {
864 mCurrentSyncProfile = i; 866 mCurrentSyncProfile = i;
865 temp->setName(syncProfileNames[mCurrentSyncProfile]); 867 temp->setName(syncProfileNames[mCurrentSyncProfile]);
866 temp->readConfig(config); 868 temp->readConfig(config);
867 if ( temp->getIncludeInRingSync() && ( i < 1 || i > 2 )) { 869 if ( temp->getIncludeInRingSync() && ( i < 1 || i > 2 )) {
868 setCaption(i18n("Profile ")+syncProfileNames[mCurrentSyncProfile]+ i18n(" is synced ... ")); 870 setCaption(i18n("Profile ")+syncProfileNames[mCurrentSyncProfile]+ i18n(" is synced ... "));
869 ++syncedProfiles; 871 ++syncedProfiles;
870 // KOPrefs::instance()->mAskForPreferences = temp->getAskForPreferences(); 872 // KOPrefs::instance()->mAskForPreferences = temp->getAskForPreferences();
871 KOPrefs::instance()->mWriteBackFile = temp->getWriteBackFile(); 873 KOPrefs::instance()->mWriteBackFile = temp->getWriteBackFile();
872 KOPrefs::instance()->mWriteBackExistingOnly = temp->getWriteBackExisting(); 874 KOPrefs::instance()->mWriteBackExistingOnly = temp->getWriteBackExisting();
873 KOPrefs::instance()->mShowSyncSummary = false; 875 KOPrefs::instance()->mShowSyncSummary = false;
874 mView->setSyncDevice(syncProfileNames[i] ); 876 mView->setSyncDevice(syncProfileNames[i] );
875 mView->setSyncName( KOPrefs::instance()->mLocalMachineName ); 877 mView->setSyncName( KOPrefs::instance()->mLocalMachineName );
876 if ( i == 0 ) { 878 if ( i == 0 ) {
877 syncSharp(); 879 syncSharp();
878 } else { 880 } else {
879 if ( temp->getIsLocalFileSync() ) { 881 if ( temp->getIsLocalFileSync() ) {
880 if ( syncWithFile( temp->getRemoteFileName( ), true ) ) 882 if ( syncWithFile( temp->getRemoteFileName( ), true ) )
881 KOPrefs::instance()->mLastSyncedLocalFile = temp->getRemoteFileName(); 883 KOPrefs::instance()->mLastSyncedLocalFile = temp->getRemoteFileName();
882 } else { 884 } else {
883 syncRemote( temp, false ); 885 syncRemote( temp, false );
884 886
885 } 887 }
886 } 888 }
887 timer.start(); 889 timer.start();
888 setCaption(i18n("Multiple sync in progress ... please wait!") ); 890 setCaption(i18n("Multiple sync in progress ... please wait!") );
889 while ( timer.elapsed () < 2000 ) { 891 while ( timer.elapsed () < 2000 ) {
890 qApp->processEvents(); 892 qApp->processEvents();
891#ifndef _WIN32_ 893#ifndef _WIN32_
892 sleep (1); 894 sleep (1);
893#endif 895#endif
894 } 896 }
895 897
896 } 898 }
897 899
898 } 900 }
899 delete temp; 901 delete temp;
900 return syncedProfiles; 902 return syncedProfiles;
901} 903}
902 904
903void MainWindow::multiSync( bool askforPrefs ) 905void MainWindow::multiSync( bool askforPrefs )
904{ 906{
905 if (mBlockSaveFlag) 907 if (mBlockSaveFlag)
906 return; 908 return;
907 mBlockSaveFlag = true; 909 mBlockSaveFlag = true;
908 QString question = i18n("Do you really want\nto multiple sync\nwith all checked profiles?\nSyncing takes some\ntime - all profiles\nare synced twice!"); 910 QString question = i18n("Do you really want\nto multiple sync\nwith all checked profiles?\nSyncing takes some\ntime - all profiles\nare synced twice!");
909 if ( QMessageBox::information( this, i18n("KO/Pi Sync"), 911 if ( QMessageBox::information( this, i18n("KO/Pi Sync"),
910 question, 912 question,
911 i18n("Yes"), i18n("No"), 913 i18n("Yes"), i18n("No"),
912 0, 0 ) != 0 ) { 914 0, 0 ) != 0 ) {
913 mBlockSaveFlag = false; 915 mBlockSaveFlag = false;
914 setCaption(i18n("Aborted! Nothing synced!")); 916 setCaption(i18n("Aborted! Nothing synced!"));
915 return; 917 return;
916 } 918 }
917 mView->setSyncDevice(i18n("Multiple profiles") ); 919 mView->setSyncDevice(i18n("Multiple profiles") );
918 KOPrefs::instance()->mSyncAlgoPrefs = KOPrefs::instance()->mRingSyncAlgoPrefs; 920 KOPrefs::instance()->mSyncAlgoPrefs = KOPrefs::instance()->mRingSyncAlgoPrefs;
919 if ( askforPrefs ) { 921 if ( askforPrefs ) {
920 mView->edit_sync_options(); 922 mView->edit_sync_options();
921 KOPrefs::instance()->mRingSyncAlgoPrefs = KOPrefs::instance()->mSyncAlgoPrefs; 923 KOPrefs::instance()->mRingSyncAlgoPrefs = KOPrefs::instance()->mSyncAlgoPrefs;
922 } 924 }
923 setCaption(i18n("Multiple sync started.") ); 925 setCaption(i18n("Multiple sync started.") );
924 qApp->processEvents(); 926 qApp->processEvents();
925 int num = ringSync() ; 927 int num = ringSync() ;
926 if ( num > 1 ) 928 if ( num > 1 )
927 ringSync(); 929 ringSync();
928 mBlockSaveFlag = false; 930 mBlockSaveFlag = false;
929 if ( num ) 931 if ( num )
930 save(); 932 save();
931 if ( num ) 933 if ( num )
932 setCaption(i18n("%1 profiles synced. Multiple sync completed!").arg(num) ); 934 setCaption(i18n("%1 profiles synced. Multiple sync completed!").arg(num) );
933 else 935 else
934 setCaption(i18n("Nothing synced! No profiles defined for multisync!")); 936 setCaption(i18n("Nothing synced! No profiles defined for multisync!"));
935 return; 937 return;
936} 938}
937void MainWindow::slotSyncMenu( int action ) 939void MainWindow::slotSyncMenu( int action )
938{ 940{
939 //qDebug("syncaction %d ", action); 941 //qDebug("syncaction %d ", action);
940 if ( action == 0 ) { 942 if ( action == 0 ) {
941 943
942 confSync(); 944 confSync();
943 945
944 return; 946 return;
945 } 947 }
946 if ( action == 1 ) { 948 if ( action == 1 ) {
947 multiSync( true ); 949 multiSync( true );
948 return; 950 return;
949 } 951 }
950 952
951 if (mBlockSaveFlag) 953 if (mBlockSaveFlag)
952 return; 954 return;
953 mBlockSaveFlag = true; 955 mBlockSaveFlag = true;
954 mCurrentSyncProfile = action - 1000 ; 956 mCurrentSyncProfile = action - 1000 ;
955 mView->setSyncDevice(KOPrefs::instance()->mSyncProfileNames[mCurrentSyncProfile] ); 957 mView->setSyncDevice(KOPrefs::instance()->mSyncProfileNames[mCurrentSyncProfile] );
956 mView->setSyncName( KOPrefs::instance()->mLocalMachineName ); 958 mView->setSyncName( KOPrefs::instance()->mLocalMachineName );
957 KConfig *config = KOGlobals::config(); 959 KConfig *config = KOGlobals::config();
958 KSyncProfile* temp = new KSyncProfile (); 960 KSyncProfile* temp = new KSyncProfile ();
959 temp->setName(KOPrefs::instance()->mSyncProfileNames[mCurrentSyncProfile]); 961 temp->setName(KOPrefs::instance()->mSyncProfileNames[mCurrentSyncProfile]);
960 temp->readConfig(config); 962 temp->readConfig(config);
961 KOPrefs::instance()->mAskForPreferences = temp->getAskForPreferences(); 963 KOPrefs::instance()->mAskForPreferences = temp->getAskForPreferences();
962 KOPrefs::instance()->mSyncAlgoPrefs = temp->getSyncPrefs(); 964 KOPrefs::instance()->mSyncAlgoPrefs = temp->getSyncPrefs();
963 KOPrefs::instance()->mWriteBackFile = temp->getWriteBackFile(); 965 KOPrefs::instance()->mWriteBackFile = temp->getWriteBackFile();
964 KOPrefs::instance()->mWriteBackExistingOnly = temp->getWriteBackExisting(); 966 KOPrefs::instance()->mWriteBackExistingOnly = temp->getWriteBackExisting();
965 KOPrefs::instance()->mShowSyncSummary = temp->getShowSummaryAfterSync(); 967 KOPrefs::instance()->mShowSyncSummary = temp->getShowSummaryAfterSync();
966 if ( action == 1000 ) { 968 if ( action == 1000 ) {
967 syncSharp(); 969 syncSharp();
968 970
969 } else if ( action == 1001 ) { 971 } else if ( action == 1001 ) {
970 syncLocalFile(); 972 syncLocalFile();
971 973
972 } else if ( action == 1002 ) { 974 } else if ( action == 1002 ) {
973 quickSyncLocalFile(); 975 quickSyncLocalFile();
974 976
975 } else if ( action >= 1003 ) { 977 } else if ( action >= 1003 ) {
976 if ( temp->getIsLocalFileSync() ) { 978 if ( temp->getIsLocalFileSync() ) {
977 if ( syncWithFile( temp->getRemoteFileName( ), false ) ) 979 if ( syncWithFile( temp->getRemoteFileName( ), false ) )
978 KOPrefs::instance()->mLastSyncedLocalFile = temp->getRemoteFileName(); 980 KOPrefs::instance()->mLastSyncedLocalFile = temp->getRemoteFileName();
979 } else { 981 } else {
980 syncRemote( temp ); 982 syncRemote( temp );
981 983
982 } 984 }
983 } 985 }
984 delete temp; 986 delete temp;
985 mBlockSaveFlag = false; 987 mBlockSaveFlag = false;
986} 988}
987void MainWindow::setDefaultPreferences() 989void MainWindow::setDefaultPreferences()
988{ 990{
989 KOPrefs *p = KOPrefs::instance(); 991 KOPrefs *p = KOPrefs::instance();
990 992
991 p->mCompactDialogs = true; 993 p->mCompactDialogs = true;
992 p->mConfirm = true; 994 p->mConfirm = true;
993 // p->mEnableQuickTodo = false; 995 // p->mEnableQuickTodo = false;
994} 996}
995 997
996QString MainWindow::resourcePath() 998QString MainWindow::resourcePath()
997{ 999{
998 return KGlobal::iconLoader()->iconPath(); 1000 return KGlobal::iconLoader()->iconPath();
999} 1001}
1000 1002
1001void MainWindow::displayText( QString text ,QString cap ) 1003void MainWindow::displayText( QString text ,QString cap )
1002{ 1004{
1003 QDialog dia( this, "name", true ); ; 1005 QDialog dia( this, "name", true ); ;
1004 dia.setCaption( cap ); 1006 dia.setCaption( cap );
1005 QVBoxLayout* lay = new QVBoxLayout( &dia ); 1007 QVBoxLayout* lay = new QVBoxLayout( &dia );
1006 lay->setSpacing( 3 ); 1008 lay->setSpacing( 3 );
1007 lay->setMargin( 3 ); 1009 lay->setMargin( 3 );
1008 QTextBrowser tb ( &dia ); 1010 QTextBrowser tb ( &dia );
1009 lay->addWidget( &tb ); 1011 lay->addWidget( &tb );
1010 tb.setText( text ); 1012 tb.setText( text );
1011#ifdef DESKTOP_VERSION 1013#ifdef DESKTOP_VERSION
1012 dia.resize( 640, 480); 1014 dia.resize( 640, 480);
1013#else 1015#else
1014 dia.showMaximized(); 1016 dia.showMaximized();
1015#endif 1017#endif
1016 dia.exec(); 1018 dia.exec();
1017} 1019}
1018void MainWindow::displayFile( QString fn, QString cap ) 1020void MainWindow::displayFile( QString fn, QString cap )
1019{ 1021{
1020 QString fileName = resourcePath() + fn; 1022 QString fileName = resourcePath() + fn;
1021 QString text; 1023 QString text;
1022 QFile file( fileName ); 1024 QFile file( fileName );
1023 if (!file.open( IO_ReadOnly ) ) { 1025 if (!file.open( IO_ReadOnly ) ) {
1024 return ; 1026 return ;
1025 1027
1026 } 1028 }
1027 QTextStream ts( &file ); 1029 QTextStream ts( &file );
1028 text = ts.read(); 1030 text = ts.read();
1029 file.close(); 1031 file.close();
1030 displayText( text, cap); 1032 displayText( text, cap);
1031} 1033}
1032void MainWindow::features() 1034void MainWindow::features()
1033{ 1035{
1034 1036
1035 displayFile( "featuresKOPI.txt",i18n("KO/Pi Features and hints") ); 1037 displayFile( "featuresKOPI.txt",i18n("KO/Pi Features and hints") );
1036} 1038}
1037 1039
1038void MainWindow::usertrans() 1040void MainWindow::usertrans()
1039{ 1041{
1040 1042
1041 displayFile( "usertranslationHOWTO.txt",i18n("KO/Pi User translation HowTo") ); 1043 displayFile( "usertranslationHOWTO.txt",i18n("KO/Pi User translation HowTo") );
1042} 1044}
1043void MainWindow::synchowto() 1045void MainWindow::synchowto()
1044{ 1046{
1045 1047
1046 displayFile( "howtoSYNC.txt",i18n("KO/Pi Synchronization HowTo") ); 1048 displayFile( "howtoSYNC.txt",i18n("KO/Pi Synchronization HowTo") );
1047} 1049}
1048void MainWindow::faq() 1050void MainWindow::faq()
1049{ 1051{
1050 displayFile( "kopiFAQ.txt",i18n("KO/Pi FAQ") ); 1052 displayFile( "kopiFAQ.txt",i18n("KO/Pi FAQ") );
1051 1053
1052} 1054}
1053void MainWindow::whatsNew() 1055void MainWindow::whatsNew()
1054{ 1056{
1055 displayFile( "kopiWhatsNew.txt",i18n("KO/Pi Version Info") ); 1057 displayFile( "kopiWhatsNew.txt",i18n("KO/Pi Version Info") );
1056 1058
1057} 1059}
1058void MainWindow::about() 1060void MainWindow::about()
1059{ 1061{
1060 QString version; 1062 QString version;
1061#include <../version> 1063#include <../version>
1062 QMessageBox::about( this, i18n("About KOrganizer/Pi"), 1064 QMessageBox::about( this, i18n("About KOrganizer/Pi"),
1063 i18n("KOrganizer/Platform-independent\n") + 1065 i18n("KOrganizer/Platform-independent\n") +
1064 "(KO/Pi) " + version + " - " + 1066 "(KO/Pi) " + version + " - " +
1065 1067
1066#ifdef DESKTOP_VERSION 1068#ifdef DESKTOP_VERSION
1067 i18n("Desktop Edition\n") + 1069 i18n("Desktop Edition\n") +
1068#else 1070#else
1069 i18n("PDA-Edition\nfor: Zaurus 5x00 / 7x0 / 8x0\n") + 1071 i18n("PDA-Edition\nfor: Zaurus 5x00 / 7x0 / 8x0\n") +
1070#endif 1072#endif
1071 i18n("(c) 2004 Lutz Rogowski\nEmail:lutz@pi-sync.net\nKO/Pi is based on KOrganizer\n(c) 2002,2003 Cornelius Schumacher\nEmail: schumacher@kde.org\nKOrganizer/Pi is licensed\nunder the GPL.\nKO/Pi can be compiled for\nLinux, Zaurus-PDA and Windows\nwww.korganizer.org\nwww.pi-sync.net\n") ); 1073 i18n("(c) 2004 Lutz Rogowski\nEmail:lutz@pi-sync.net\nKO/Pi is based on KOrganizer\n(c) 2002,2003 Cornelius Schumacher\nEmail: schumacher@kde.org\nKOrganizer/Pi is licensed\nunder the GPL.\nKO/Pi can be compiled for\nLinux, Zaurus-PDA and Windows\nwww.korganizer.org\nwww.pi-sync.net\n") );
1072} 1074}
1073void MainWindow::keyBindings() 1075void MainWindow::keyBindings()
1074{ 1076{
1075 QString cap = i18n("Key bindings KOrganizer/Pi"); 1077 QString cap = i18n("Key bindings KOrganizer/Pi");
1076 QString text = i18n("<p><h2>KO/Pi key shortcuts:</h2></p>\n") + 1078 QString text = i18n("<p><h2>KO/Pi key shortcuts:</h2></p>\n") +
1077 i18n("<p><b>H</b>: This help dialog | <b>S</b>: Search dialog</p>\n")+ 1079 i18n("<p><b>H</b>: This help dialog | <b>S</b>: Search dialog</p>\n")+
1078 i18n("<p><b>I</b>: Show info for selected event/todo</p>\n") + 1080 i18n("<p><b>I</b>: Show info for selected event/todo</p>\n") +
1079 i18n("<p><b>Space</b>: Toggle fullscreen | <b>P</b>: Date picker</p>\n")+ 1081 i18n("<p><b>Space</b>: Toggle fullscreen | <b>P</b>: Date picker</p>\n")+
1080 i18n("<p><b>F</b>: Toggle filterview |<b>F+ctrl</b>: Edit filter </p>\n")+ 1082 i18n("<p><b>F</b>: Toggle filterview |<b>F+ctrl</b>: Edit filter </p>\n")+
1081 i18n("<p><b>O</b>: Filter On/Off | <b>J</b>: Journal view</p>\n")+ 1083 i18n("<p><b>O</b>: Filter On/Off | <b>J</b>: Journal view</p>\n")+
1082 i18n("<p><b>1-0</b> (+<b>ctrl</b>): Select filter 1-10 (11-20)</p>\n")+ 1084 i18n("<p><b>1-0</b> (+<b>ctrl</b>): Select filter 1-10 (11-20)</p>\n")+
1083 i18n("<p><b>N</b>: Next days view| <b>W</b>: What's next view\n ")+ 1085 i18n("<p><b>N</b>: Next days view| <b>W</b>: What's next view\n ")+
1084 i18n("<p><b>V</b>: Todo view | <b>L</b>: Event list view</p>\n")+ 1086 i18n("<p><b>V</b>: Todo view | <b>L</b>: Event list view</p>\n")+
1085 i18n("<p><b>Z,Y</b>: Work week view | <b>U</b>: Week view</p>\n")+ 1087 i18n("<p><b>Z,Y</b>: Work week view | <b>U</b>: Week view</p>\n")+
1086 i18n("<p><b>D</b>: One day view | <b>M</b>: Month view</p>\n")+ 1088 i18n("<p><b>D</b>: One day view | <b>M</b>: Month view</p>\n")+
1087 i18n("<p><b>E</b>: Edit selected item |<b> E+ctrl</b>: New Event</p>\n")+ 1089 i18n("<p><b>E</b>: Edit selected item |<b> E+ctrl</b>: New Event</p>\n")+
1088 i18n("<p><b>T</b>: Goto today | <b>T+ctrl</b>: New Todo</p>\n")+ 1090 i18n("<p><b>T</b>: Goto today | <b>T+ctrl</b>: New Todo</p>\n")+
1089 i18n("<p><b>S+ctrl</b>: Add sub-todo | <b>X</b>: Toggle datenavigator</p>\n")+ 1091 i18n("<p><b>S+ctrl</b>: Add sub-todo | <b>X</b>: Toggle datenavigator</p>\n")+
1090 i18n("<p><b>+,-</b> : Zoom in/out agenda | <b>A</b>: Toggle allday agenda height</p>\n")+ 1092 i18n("<p><b>+,-</b> : Zoom in/out agenda | <b>A</b>: Toggle allday agenda height</p>\n")+
1091 i18n("<p><b>C</b>: Show current time in agenda view</p>\n")+ 1093 i18n("<p><b>C</b>: Show current time in agenda view</p>\n")+
1092 i18n("<p><b>B</b>: Edit description (details) of selected item</p>\n")+ 1094 i18n("<p><b>B</b>: Edit description (details) of selected item</p>\n")+
1093 i18n("<p><b>right</b>: Next week | <b>right+ctrl</b>: Next month</p>\n")+ 1095 i18n("<p><b>right</b>: Next week | <b>right+ctrl</b>: Next month</p>\n")+
1094 i18n("<p><b>left</b>: Prev. week | <b>left+ctrl</b>: Prev. month</p>\n")+ 1096 i18n("<p><b>left</b>: Prev. week | <b>left+ctrl</b>: Prev. month</p>\n")+
1095 i18n("<p><b>del,backspace</b>: Delete selected item</p>\n")+ 1097 i18n("<p><b>del,backspace</b>: Delete selected item</p>\n")+
1096 i18n("<p><h3>In agenda view:</h3></p>\n") + 1098 i18n("<p><h3>In agenda view:</h3></p>\n") +
1097 i18n("<p><b>up/down</b>: Scroll agenda view</p>\n")+ 1099 i18n("<p><b>up/down</b>: Scroll agenda view</p>\n")+
1098 i18n("<p><b>ctrl+up/down</b>: Scroll small todo view</p>\n")+ 1100 i18n("<p><b>ctrl+up/down</b>: Scroll small todo view</p>\n")+
1099 i18n("<p><h3>In todo view:</h3></p>\n") + 1101 i18n("<p><h3>In todo view:</h3></p>\n") +
1100 i18n("<p><b>Q</b>: Toggle quick todo line edit.</p>\n")+ 1102 i18n("<p><b>Q</b>: Toggle quick todo line edit.</p>\n")+
1101 i18n("<p><b>I</b>: Show info of current item+one step down.</p>\n")+ 1103 i18n("<p><b>I</b>: Show info of current item+one step down.</p>\n")+
1102 i18n("<p><b>return</b>: Mark item as completed+one step down.</p>\n")+ 1104 i18n("<p><b>return</b>: Mark item as completed+one step down.</p>\n")+
1103 i18n("<p><b>return+shift</b>: Mark item as not completed+one step down</p>\n")+ 1105 i18n("<p><b>return+shift</b>: Mark item as not completed+one step down</p>\n")+
1104 i18n("<p><h3>In list view:</h3></p>\n") + 1106 i18n("<p><h3>In list view:</h3></p>\n") +
1105 i18n("<p><b>I</b>: Show info of current item+one step down.</p>\n")+ 1107 i18n("<p><b>I</b>: Show info of current item+one step down.</p>\n")+
1106 i18n("<p><b>return</b>: Select item+one step down</p>\n")+ 1108 i18n("<p><b>return</b>: Select item+one step down</p>\n")+
1107 i18n("<p><b>return+shift</b>: Deselect item+one step down</p>\n")+ 1109 i18n("<p><b>return+shift</b>: Deselect item+one step down</p>\n")+
1108 i18n("<p><b>up/down</b>: Next/prev item</p>\n")+ 1110 i18n("<p><b>up/down</b>: Next/prev item</p>\n")+
1109 i18n("<p><b>ctrl+up/down</b>: Goto up/down by 20% of items</p>\n")+ 1111 i18n("<p><b>ctrl+up/down</b>: Goto up/down by 20% of items</p>\n")+
1110 i18n("<p><b>shift+up/down</b>: Goto first/last item</p>\n")+ 1112 i18n("<p><b>shift+up/down</b>: Goto first/last item</p>\n")+
1111 i18n("<p><h3>In event/todo viewer:</h3></p>\n") + 1113 i18n("<p><h3>In event/todo viewer:</h3></p>\n") +
1112 i18n("<p><b>I,C</b>: Close dialog.</p>\n")+ 1114 i18n("<p><b>I,C</b>: Close dialog.</p>\n")+
1113 i18n("<p><b>A</b>: Show agenda view.</p>\n")+ 1115 i18n("<p><b>A</b>: Show agenda view.</p>\n")+
1114 i18n("<p><b>E</b>: Edit item</p>\n") + 1116 i18n("<p><b>E</b>: Edit item</p>\n") +
1115 i18n("<p><h2>KO/Pi icon colors:</h2></p>\n") + 1117 i18n("<p><h2>KO/Pi icon colors:</h2></p>\n") +
1116 i18n("<p><b>(for square icons in agenda and month view)</b></p>\n") + 1118 i18n("<p><b>(for square icons in agenda and month view)</b></p>\n") +
1117 i18n("<p><b>Cross</b>: Item cancelled.([c] in Whats'Next view)</p>\n")+ 1119 i18n("<p><b>Cross</b>: Item cancelled.([c] in Whats'Next view)</p>\n")+
1118 i18n("<p><b>Red</b>: Alarm set.([a] in Whats'Next view)</p>\n")+ 1120 i18n("<p><b>Red</b>: Alarm set.([a] in Whats'Next view)</p>\n")+
1119 i18n("<p><b>Blue</b>: Recurrent event.([r] in Whats'Next view)</p>\n")+ 1121 i18n("<p><b>Blue</b>: Recurrent event.([r] in Whats'Next view)</p>\n")+
1120 i18n("<p><b>Dark green</b>: Information(description) available.([i] in WN view)</p>\n")+ 1122 i18n("<p><b>Dark green</b>: Information(description) available.([i] in WN view)</p>\n")+
1121 i18n("<p><b>Black</b>: Event/todo with attendees. You are the organizer!</p>\n")+ 1123 i18n("<p><b>Black</b>: Event/todo with attendees. You are the organizer!</p>\n")+
1122 i18n("<p><b>Dark yellow</b>: Event/todo with attendees.</p>\n") + 1124 i18n("<p><b>Dark yellow</b>: Event/todo with attendees.</p>\n") +
1123 i18n("<p><b>White</b>: Item readonly</p>\n"); 1125 i18n("<p><b>White</b>: Item readonly</p>\n");
1124 displayText( text, cap); 1126 displayText( text, cap);
1125 1127
1126} 1128}
1127void MainWindow::aboutAutoSaving() 1129void MainWindow::aboutAutoSaving()
1128{ 1130{
1129 QMessageBox* msg; 1131 QMessageBox* msg;
1130 msg = new QMessageBox( i18n("Auto Saving in KOrganizer/Pi"), 1132 msg = new QMessageBox( i18n("Auto Saving in KOrganizer/Pi"),
1131 i18n("After changing something, the data is\nautomatically saved to the file\n~/kdepim/apps/korganizer/mycalendar.ics\nafter (configureable) three minutes.\nFor safety reasons there is one autosaving\nafter 10 minutes (of idle time) again. The \ndata is saved automatically when closing KO/Pi\nYou can create a backup file \nwith: File - Save Calendar Backup\n"), QMessageBox::NoIcon, 1133 i18n("After changing something, the data is\nautomatically saved to the file\n~/kdepim/apps/korganizer/mycalendar.ics\nafter (configureable) three minutes.\nFor safety reasons there is one autosaving\nafter 10 minutes (of idle time) again. The \ndata is saved automatically when closing KO/Pi\nYou can create a backup file \nwith: File - Save Calendar Backup\n"), QMessageBox::NoIcon,
1132 QMessageBox::Ok, 1134 QMessageBox::Ok,
1133 QMessageBox::NoButton, 1135 QMessageBox::NoButton,
1134 QMessageBox::NoButton); 1136 QMessageBox::NoButton);
1135 msg->exec(); 1137 msg->exec();
1136 delete msg; 1138 delete msg;
1137 1139
1138 1140
1139} 1141}
1140void MainWindow::aboutKnownBugs() 1142void MainWindow::aboutKnownBugs()
1141{ 1143{
1142 QMessageBox* msg; 1144 QMessageBox* msg;
1143 msg = new QMessageBox( i18n("Known Problems in KOrganizer/Pi"), 1145 msg = new QMessageBox( i18n("Known Problems in KOrganizer/Pi"),
1144 i18n("1) Importing *.vcs or *.ics files from\nother applications may not work properly,\nif there are events with properties\nKO/Pi does not support.\n")+ 1146 i18n("1) Importing *.vcs or *.ics files from\nother applications may not work properly,\nif there are events with properties\nKO/Pi does not support.\n")+
1145 i18n("2) Audio alarm daemon\nfor Zaurus is available!\nas an additional small application\n")+ 1147 i18n("2) Audio alarm daemon\nfor Zaurus is available!\nas an additional small application\n")+
1146 i18n("\nPlease report unexpected behaviour to\nlutz@pi-sync.net\n") + 1148 i18n("\nPlease report unexpected behaviour to\nlutz@pi-sync.net\n") +
1147 i18n("\nor report them in the bugtracker on\n") + 1149 i18n("\nor report them in the bugtracker on\n") +
1148 i18n("\nhttp://sourceforge.net/projects/kdepimpi\n"), 1150 i18n("\nhttp://sourceforge.net/projects/kdepimpi\n"),
1149 QMessageBox::NoIcon, 1151 QMessageBox::NoIcon,
1150 QMessageBox::Ok, 1152 QMessageBox::Ok,
1151 QMessageBox::NoButton, 1153 QMessageBox::NoButton,
1152 QMessageBox::NoButton); 1154 QMessageBox::NoButton);
1153 msg->exec(); 1155 msg->exec();
1154 delete msg; 1156 delete msg;
1155 1157
1156} 1158}
1157 1159
1158QString MainWindow::defaultFileName() 1160QString MainWindow::defaultFileName()
1159{ 1161{
1160 return locateLocal( "data", "korganizer/mycalendar.ics" ); 1162 return locateLocal( "data", "korganizer/mycalendar.ics" );
1161} 1163}
1162 1164
1163void MainWindow::processIncidenceSelection( Incidence *incidence ) 1165void MainWindow::processIncidenceSelection( Incidence *incidence )
1164{ 1166{
1165 if ( !incidence ) { 1167 if ( !incidence ) {
1166 enableIncidenceActions( false ); 1168 enableIncidenceActions( false );
1167 1169
1168 mNewSubTodoAction->setEnabled( false ); 1170 mNewSubTodoAction->setEnabled( false );
1169 setCaptionToDates(); 1171 setCaptionToDates();
1170 return; 1172 return;
1171 1173
1172 } 1174 }
1173 1175
1174 //KGlobal::locale()->formatDateTime(nextA, true); 1176 //KGlobal::locale()->formatDateTime(nextA, true);
1175 QString startString = ""; 1177 QString startString = "";
1176 if ( incidence->type() != "Todo" ) { 1178 if ( incidence->type() != "Todo" ) {
1177 if ( incidence->dtStart().date() < incidence->dtEnd().date() ) { 1179 if ( incidence->dtStart().date() < incidence->dtEnd().date() ) {
1178 if ( incidence->doesFloat() ) { 1180 if ( incidence->doesFloat() ) {
1179 startString += ": "+incidence->dtStartDateStr( true ); 1181 startString += ": "+incidence->dtStartDateStr( true );
1180 startString += " --- "+((Event*)incidence)->dtEndDateStr( true ); 1182 startString += " --- "+((Event*)incidence)->dtEndDateStr( true );
1181 1183
1182 } else { 1184 } else {
1183 startString = ": "+incidence->dtStartStr(true); 1185 startString = ": "+incidence->dtStartStr(true);
1184 startString += " --- "+((Event*)incidence)->dtEndStr(true); 1186 startString += " --- "+((Event*)incidence)->dtEndStr(true);
1185 1187
1186 } 1188 }
1187 1189
1188 } else { 1190 } else {
1189 if ( incidence->dtStart().time() != incidence->dtEnd().time() ) 1191 if ( incidence->dtStart().time() != incidence->dtEnd().time() )
1190 startString = ": "+KGlobal::locale()->formatTime(incidence->dtStart().time())+ 1192 startString = ": "+KGlobal::locale()->formatTime(incidence->dtStart().time())+
1191 "-"+KGlobal::locale()->formatTime(incidence->dtEnd().time()); 1193 "-"+KGlobal::locale()->formatTime(incidence->dtEnd().time());
1192 startString +=" "+KGlobal::locale()->formatDate( incidence->dtStart().date(), true); 1194 startString +=" "+KGlobal::locale()->formatDate( incidence->dtStart().date(), true);
1193 } 1195 }
1194 1196
1195 } 1197 }
1196 else 1198 else
1197 startString = i18n(": (Prio ") +QString::number( (( KCal::Todo*)incidence)->priority() ) +") "+QString::number( (( KCal::Todo*)incidence)->percentComplete() ) +i18n("\% completed"); 1199 startString = i18n(": (Prio ") +QString::number( (( KCal::Todo*)incidence)->priority() ) +") "+QString::number( (( KCal::Todo*)incidence)->percentComplete() ) +i18n("\% completed");
1198 if ( !incidence->location().isEmpty() ) 1200 if ( !incidence->location().isEmpty() )
1199 startString += " (" +incidence->location()+")"; 1201 startString += " (" +incidence->location()+")";
1200 setCaption( incidence->summary()+startString); 1202 setCaption( incidence->summary()+startString);
1201 1203
1202 enableIncidenceActions( true ); 1204 enableIncidenceActions( true );
1203 1205
1204 if ( incidence->type() == "Event" ) { 1206 if ( incidence->type() == "Event" ) {
1205 mShowAction->setText( i18n("Show Event...") ); 1207 mShowAction->setText( i18n("Show Event...") );
1206 mEditAction->setText( i18n("Edit Event...") ); 1208 mEditAction->setText( i18n("Edit Event...") );
1207 mDeleteAction->setText( i18n("Delete Event...") ); 1209 mDeleteAction->setText( i18n("Delete Event...") );
1208 1210
1209 mNewSubTodoAction->setEnabled( false ); 1211 mNewSubTodoAction->setEnabled( false );
1210 } else if ( incidence->type() == "Todo" ) { 1212 } else if ( incidence->type() == "Todo" ) {
1211 mShowAction->setText( i18n("Show Todo...") ); 1213 mShowAction->setText( i18n("Show Todo...") );
1212 mEditAction->setText( i18n("Edit Todo...") ); 1214 mEditAction->setText( i18n("Edit Todo...") );
1213 mDeleteAction->setText( i18n("Delete Todo...") ); 1215 mDeleteAction->setText( i18n("Delete Todo...") );
1214 1216
1215 mNewSubTodoAction->setEnabled( true ); 1217 mNewSubTodoAction->setEnabled( true );
1216 } else { 1218 } else {
1217 mShowAction->setText( i18n("Show...") ); 1219 mShowAction->setText( i18n("Show...") );
1218 mShowAction->setText( i18n("Edit...") ); 1220 mShowAction->setText( i18n("Edit...") );
1219 mShowAction->setText( i18n("Delete...") ); 1221 mShowAction->setText( i18n("Delete...") );
1220 1222
1221 mNewSubTodoAction->setEnabled( false ); 1223 mNewSubTodoAction->setEnabled( false );
1222 } 1224 }
1223} 1225}
1224 1226
1225void MainWindow::enableIncidenceActions( bool enabled ) 1227void MainWindow::enableIncidenceActions( bool enabled )
1226{ 1228{
1227 mShowAction->setEnabled( enabled ); 1229 mShowAction->setEnabled( enabled );
1228 mEditAction->setEnabled( enabled ); 1230 mEditAction->setEnabled( enabled );
1229 mDeleteAction->setEnabled( enabled ); 1231 mDeleteAction->setEnabled( enabled );
1230} 1232}
1231 1233
1232void MainWindow::importOL() 1234void MainWindow::importOL()
1233{ 1235{
1234#ifdef _WIN32_ 1236#ifdef _WIN32_
1235 KOImportOLdialog *id = new KOImportOLdialog("Import from OL - select folder!" , mView->calendar(),this ); 1237 KOImportOLdialog *id = new KOImportOLdialog("Import from OL - select folder!" , mView->calendar(),this );
1236 id->exec(); 1238 id->exec();
1237 delete id; 1239 delete id;
1238 mView->updateView(); 1240 mView->updateView();
1239#endif 1241#endif
1240} 1242}
1241void MainWindow::importBday() 1243void MainWindow::importBday()
1242{ 1244{
1243 int result = QMessageBox::warning( this, i18n("KO/Pi: Warning!"), 1245 int result = QMessageBox::warning( this, i18n("KO/Pi: Warning!"),
1244 i18n("When importing birthdays twice\nduplicated events will be ignored,\nif the event has not been\nchanged in KO/Pi!\n"), 1246 i18n("When importing birthdays twice\nduplicated events will be ignored,\nif the event has not been\nchanged in KO/Pi!\n"),
1245 i18n("Import!"), i18n("Cancel"), 0, 1247 i18n("Import!"), i18n("Cancel"), 0,
1246 0, 1 ); 1248 0, 1 );
1247 if ( result == 0 ) { 1249 if ( result == 0 ) {
1248 mView->importBday(); 1250 mView->importBday();
1249 1251
1250 } 1252 }
1251 1253
1252 1254
1253} 1255}
1254void MainWindow::importQtopia() 1256void MainWindow::importQtopia()
1255{ 1257{
1256#ifndef DESKTOP_VERSION 1258#ifndef DESKTOP_VERSION
1257 int result = QMessageBox::warning( this, i18n("KO/Pi: Warning!"), 1259 int result = QMessageBox::warning( this, i18n("KO/Pi: Warning!"),
1258 i18n("When importing a calendar twice\nduplicated events will be ignored!\nYou can create a backup file with\nFile - Save Calendar Backup\nto revert importing"), 1260 i18n("When importing a calendar twice\nduplicated events will be ignored!\nYou can create a backup file with\nFile - Save Calendar Backup\nto revert importing"),
1259 i18n("Import!"), i18n("Cancel"), 0, 1261 i18n("Import!"), i18n("Cancel"), 0,
1260 0, 1 ); 1262 0, 1 );
1261 if ( result == 0 ) { 1263 if ( result == 0 ) {
1262 QString datebook = Global::applicationFileName( "datebook", "datebook.xml"); 1264 QString datebook = Global::applicationFileName( "datebook", "datebook.xml");
1263 QString todolist = Global::applicationFileName( "todolist", "todolist.xml"); 1265 QString todolist = Global::applicationFileName( "todolist", "todolist.xml");
1264 QString categories = QString( getenv( "HOME" ) ) + "/Settings/Categories.xml"; 1266 QString categories = QString( getenv( "HOME" ) ) + "/Settings/Categories.xml";
1265 mView->importQtopia( categories, datebook, todolist ); 1267 mView->importQtopia( categories, datebook, todolist );
1266 } 1268 }
1267#else 1269#else
1268 int result = QMessageBox::warning( this, i18n("KO/Pi: Warning!"), 1270 int result = QMessageBox::warning( this, i18n("KO/Pi: Warning!"),
1269 i18n("Not supported \non desktop!\n"), 1271 i18n("Not supported \non desktop!\n"),
1270 i18n("Ok"), i18n("Cancel"), 0, 1272 i18n("Ok"), i18n("Cancel"), 0,
1271 0, 1 ); 1273 0, 1 );
1272 1274
1273#endif 1275#endif
1274} 1276}
1275 1277
1276void MainWindow::saveOnClose() 1278void MainWindow::saveOnClose()
1277{ 1279{
1278 KOPrefs *p = KOPrefs::instance(); 1280 KOPrefs *p = KOPrefs::instance();
1279 p->mToolBarHor = ( iconToolBar->orientation () == Qt:: Horizontal ); 1281 p->mToolBarHor = ( iconToolBar->orientation () == Qt:: Horizontal );
1280 p->mToolBarUp = iconToolBar->x() > width()/2 || 1282 p->mToolBarUp = iconToolBar->x() > width()/2 ||
1281 iconToolBar->y() > height()/2; 1283 iconToolBar->y() > height()/2;
1282 mView->writeSettings(); 1284 mView->writeSettings();
1283 if ( mCalendarModifiedFlag || mView->checkFileChanged( defaultFileName())) 1285 if ( mCalendarModifiedFlag || mView->checkFileChanged( defaultFileName()))
1284 save(); 1286 save();
1285} 1287}
1286void MainWindow::slotModifiedChanged( bool changed ) 1288void MainWindow::slotModifiedChanged( bool changed )
1287{ 1289{
1288 if ( mBlockAtStartup ) 1290 if ( mBlockAtStartup )
1289 return; 1291 return;
1290 int msec; 1292 int msec;
1291 // we store the changes after 1 minute, 1293 // we store the changes after 1 minute,
1292 // and for safety reasons after 10 minutes again 1294 // and for safety reasons after 10 minutes again
1293 if ( !mBlockSaveFlag ) 1295 if ( !mBlockSaveFlag )
1294 msec = (1000 * 60*KOPrefs::instance()->mAutoSaveInterval) +1000; 1296 msec = (1000 * 60*KOPrefs::instance()->mAutoSaveInterval) +1000;
1295 else 1297 else
1296 msec = 1000 * 600; 1298 msec = 1000 * 600;
1297 mSaveTimer.start( msec, true ); // 1 minute 1299 mSaveTimer.start( msec, true ); // 1 minute
1298 qDebug("KO: Saving File in %d secs!", msec/1000); 1300 qDebug("KO: Saving File in %d secs!", msec/1000);
1299 mCalendarModifiedFlag = true; 1301 mCalendarModifiedFlag = true;
1300} 1302}
1301#include <qfileinfo.h> 1303#include <qfileinfo.h>
1302void MainWindow::save() 1304void MainWindow::save()
1303{ 1305{
1304 if ( mBlockSaveFlag ) 1306 if ( mBlockSaveFlag )
1305 return; 1307 return;
1306 bool store = mBlockSaveFlag; 1308 bool store = mBlockSaveFlag;
1307 mBlockSaveFlag = true; 1309 mBlockSaveFlag = true;
1308 if ( mView->checkFileVersion( defaultFileName()) ) { 1310 if ( mView->checkFileVersion( defaultFileName()) ) {
1309 1311
1310 QTime neededSaveTime = QDateTime::currentDateTime().time(); 1312 QTime neededSaveTime = QDateTime::currentDateTime().time();
1311 setCaption(i18n("KO/Pi:Saving Data to File ..." )); 1313 setCaption(i18n("KO/Pi:Saving Data to File ..." ));
1312 qDebug("KO: Start saving data to file!"); 1314 qDebug("KO: Start saving data to file!");
1313 mView->saveCalendar( defaultFileName() ); 1315 mView->saveCalendar( defaultFileName() );
1314 1316
1315 int msNeeded = neededSaveTime.msecsTo( QDateTime::currentDateTime().time() ); 1317 int msNeeded = neededSaveTime.msecsTo( QDateTime::currentDateTime().time() );
1316 mView->setLoadedFileVersion(QDateTime::currentDateTime()); 1318 mView->setLoadedFileVersion(QDateTime::currentDateTime());
1317 qDebug("KO: Needed %d ms for saving.",msNeeded ); 1319 qDebug("KO: Needed %d ms for saving.",msNeeded );
1318 QString savemes; 1320 QString savemes;
1319 savemes.sprintf(i18n("KO/Pi:File Saved. Needed %d sec, %d ms"),(msNeeded/1000)%100,msNeeded%1000 ); 1321 savemes.sprintf(i18n("KO/Pi:File Saved. Needed %d sec, %d ms"),(msNeeded/1000)%100,msNeeded%1000 );
1320 setCaption(savemes); 1322 setCaption(savemes);
1321 } else 1323 } else
1322 setCaption(i18n("Saving cancelled!")); 1324 setCaption(i18n("Saving cancelled!"));
1323 mCalendarModifiedFlag = false; 1325 mCalendarModifiedFlag = false;
1324 mBlockSaveFlag = store; 1326 mBlockSaveFlag = store;
1325} 1327}
1326 1328
1327void MainWindow::keyReleaseEvent ( QKeyEvent * e) 1329void MainWindow::keyReleaseEvent ( QKeyEvent * e)
1328{ 1330{
1329 if ( !e->isAutoRepeat() ) { 1331 if ( !e->isAutoRepeat() ) {
1330 mFlagKeyPressed = false; 1332 mFlagKeyPressed = false;
1331 } 1333 }
1332} 1334}
1333void MainWindow::keyPressEvent ( QKeyEvent * e ) 1335void MainWindow::keyPressEvent ( QKeyEvent * e )
1334{ 1336{
1335 qApp->processEvents(); 1337 qApp->processEvents();
1336 if ( e->isAutoRepeat() && !mFlagKeyPressed ) { 1338 if ( e->isAutoRepeat() && !mFlagKeyPressed ) {
1337 e->ignore(); 1339 e->ignore();
1338 // qDebug(" ignore %d",e->isAutoRepeat() ); 1340 // qDebug(" ignore %d",e->isAutoRepeat() );
1339 return; 1341 return;
1340 } 1342 }
1341 if (! e->isAutoRepeat() ) 1343 if (! e->isAutoRepeat() )
1342 mFlagKeyPressed = true; 1344 mFlagKeyPressed = true;
1343 KOPrefs *p = KOPrefs::instance(); 1345 KOPrefs *p = KOPrefs::instance();
1344 bool showSelectedDates = false; 1346 bool showSelectedDates = false;
1345 int size; 1347 int size;
1346 int pro = 0; 1348 int pro = 0;
1347 //qDebug("MainWindow::keyPressEvent "); 1349 //qDebug("MainWindow::keyPressEvent ");
1348 switch ( e->key() ) { 1350 switch ( e->key() ) {
diff --git a/libkdepim/ksyncprefsdialog.cpp b/libkdepim/ksyncprefsdialog.cpp
index 8d610d8..3df2a3b 100644
--- a/libkdepim/ksyncprefsdialog.cpp
+++ b/libkdepim/ksyncprefsdialog.cpp
@@ -1,468 +1,471 @@
1/* 1/*
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 program is free software; you can redistribute it and/or modify 5 This program is free software; you can redistribute it and/or modify
6 it under the terms of the GNU General Public License as published by 6 it under the terms of the GNU General Public License as published by
7 the Free Software Foundation; either version 2 of the License, or 7 the Free Software Foundation; either version 2 of the License, or
8 (at your option) any later version. 8 (at your option) any later version.
9 9
10 This program is distributed in the hope that it will be useful, 10 This program 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 12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 GNU General Public License for more details. 13 GNU General Public License for more details.
14 14
15 You should have received a copy of the GNU General Public License 15 You should have received a copy of the GNU General Public License
16 along with this program; if not, write to the Free Software 16 along with this program; if not, write to the Free Software
17 Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. 17 Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
18 18
19 As a special exception, permission is given to link this program 19 As a special exception, permission is given to link this program
20 with any edition of Qt, and distribute the resulting executable, 20 with any edition of Qt, and distribute the resulting executable,
21 without including the source code for Qt in the source distribution. 21 without including the source code for Qt in the source distribution.
22*/ 22*/
23 23
24#include <qlayout.h> 24#include <qlayout.h>
25#include <qlabel.h> 25#include <qlabel.h>
26#include <qgroupbox.h> 26#include <qgroupbox.h>
27#include <qbuttongroup.h> 27#include <qbuttongroup.h>
28#include <qlineedit.h> 28#include <qlineedit.h>
29#include <qfont.h> 29#include <qfont.h>
30#include <qslider.h> 30#include <qslider.h>
31#include <qfile.h> 31#include <qfile.h>
32#include <qdir.h> 32#include <qdir.h>
33#include <qtextstream.h> 33#include <qtextstream.h>
34#include <qcombobox.h> 34#include <qcombobox.h>
35#include <qvbox.h> 35#include <qvbox.h>
36#include <qhbox.h> 36#include <qhbox.h>
37#include <qspinbox.h> 37#include <qspinbox.h>
38#include <qdatetime.h> 38#include <qdatetime.h>
39#include <qcheckbox.h> 39#include <qcheckbox.h>
40#include <qradiobutton.h> 40#include <qradiobutton.h>
41#include <qpushbutton.h> 41#include <qpushbutton.h>
42#include <qstrlist.h> 42#include <qstrlist.h>
43#include <qapplication.h> 43#include <qapplication.h>
44#include <qlayout.h> 44#include <qlayout.h>
45#include <qscrollview.h> 45#include <qscrollview.h>
46 46
47#include <kcolorbutton.h> 47#include <kcolorbutton.h>
48#include <kdebug.h> 48#include <kdebug.h>
49#include <klocale.h> 49#include <klocale.h>
50#include <kglobal.h> 50#include <kglobal.h>
51#include <kfontdialog.h> 51#include <kfontdialog.h>
52#include <kmessagebox.h> 52#include <kmessagebox.h>
53#include <kcolordialog.h> 53#include <kcolordialog.h>
54#include <kiconloader.h> 54#include <kiconloader.h>
55#include <kemailsettings.h> 55#include <kemailsettings.h>
56#include <kstandarddirs.h> 56#include <kstandarddirs.h>
57#include <kfiledialog.h> 57#include <kfiledialog.h>
58#include <kmessagebox.h> 58#include <kmessagebox.h>
59 59
60//#include <kurlrequester.h> 60//#include <kurlrequester.h>
61#include <klineedit.h> 61#include <klineedit.h>
62#include "ksyncprofile.h" 62#include "ksyncprofile.h"
63 63
64 64
65//#include "koprefs.h" 65//#include "koprefs.h"
66 66
67#include "ksyncprefsdialog.h" 67#include "ksyncprefsdialog.h"
68//#include "koglobals.h" 68//#include "koglobals.h"
69 69
70 70
71KSyncPrefsDialog::KSyncPrefsDialog(QWidget *parent, char *name, bool modal) : 71KSyncPrefsDialog::KSyncPrefsDialog(QWidget *parent, char *name, bool modal) :
72 KDialog(parent,name,true) 72 KDialog(parent,name,true)
73{ 73{
74 74
75 setCaption( i18n("Synchronization Preferences")); 75 setCaption( i18n("Synchronization Preferences"));
76 76
77 mSyncProfiles.setAutoDelete( true ); 77 mSyncProfiles.setAutoDelete( true );
78 setupSyncAlgTab(); 78 setupSyncAlgTab();
79} 79}
80 80
81 81
82KSyncPrefsDialog::~KSyncPrefsDialog() 82KSyncPrefsDialog::~KSyncPrefsDialog()
83{ 83{
84} 84}
85 85
86void KSyncPrefsDialog::setupSyncAlgTab() 86void KSyncPrefsDialog::setupSyncAlgTab()
87{ 87{
88 QLabel * lab; 88 QLabel * lab;
89 //QFrame *page = addPage(i18n("Sync Prefs"),0,0); 89 //QFrame *page = addPage(i18n("Sync Prefs"),0,0);
90 QVBox * mainbox = new QVBox( this ); 90 QVBox * mainbox = new QVBox( this );
91 QScrollView* sv = new QScrollView( mainbox ); 91 QScrollView* sv = new QScrollView( mainbox );
92 QHBoxLayout * lay = new QHBoxLayout( this ); 92 QHBoxLayout * lay = new QHBoxLayout( this );
93 lay->addWidget( mainbox ); 93 lay->addWidget( mainbox );
94 QHBox * b_box = new QHBox( mainbox ); 94 QHBox * b_box = new QHBox( mainbox );
95 95
96 QPushButton* button = new QPushButton( i18n("Ok"), b_box ); 96 QPushButton* button = new QPushButton( i18n("Ok"), b_box );
97 connect ( button, SIGNAL( clicked()), this, SLOT (slotOK() ) ); 97 connect ( button, SIGNAL( clicked()), this, SLOT (slotOK() ) );
98 button = new QPushButton( i18n("Cancel"), b_box ); 98 button = new QPushButton( i18n("Cancel"), b_box );
99 connect ( button, SIGNAL( clicked()), this, SLOT (reject() ) ); 99 connect ( button, SIGNAL( clicked()), this, SLOT (reject() ) );
100 //QBoxLayout * sl = new QVBoxLayout(this ); 100 //QBoxLayout * sl = new QVBoxLayout(this );
101 //sl->addWidget ( sv ); 101 //sl->addWidget ( sv );
102 sv->setResizePolicy ( QScrollView::AutoOneFit ); 102 sv->setResizePolicy ( QScrollView::AutoOneFit );
103 QFrame *topFrame = new QFrame ( sv ); 103 QFrame *topFrame = new QFrame ( sv );
104 sv->addChild( topFrame ); 104 sv->addChild( topFrame );
105 mSetupSyncAlgTab = topFrame; 105 mSetupSyncAlgTab = topFrame;
106 QGridLayout *topLayout = new QGridLayout(topFrame,6,2); 106 QGridLayout *topLayout = new QGridLayout(topFrame,6,2);
107 topLayout->setSpacing(spacingHint()); 107 topLayout->setSpacing(spacingHint());
108 topLayout->setMargin(marginHint()); 108 topLayout->setMargin(marginHint());
109 109
110 //lab = new QLabel(i18n("Sync settings not yet implemented. DO NOT USE!"), topFrame); 110 //lab = new QLabel(i18n("Sync settings not yet implemented. DO NOT USE!"), topFrame);
111 int iii = 0; 111 int iii = 0;
112 //topLayout->addMultiCellWidget(lab , iii,iii,0,1); 112 //topLayout->addMultiCellWidget(lab , iii,iii,0,1);
113 //++iii; 113 //++iii;
114 114
115 mMyMachineName = new QLineEdit(topFrame); 115 mMyMachineName = new QLineEdit(topFrame);
116 lab = new QLabel(mMyMachineName, i18n("Local device name:"), topFrame); 116 lab = new QLabel(mMyMachineName, i18n("Local device name:"), topFrame);
117 topLayout->addWidget(lab ,iii,0); 117 topLayout->addWidget(lab ,iii,0);
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 sync"), topFrame ); 143 mIncludeInRing = new QCheckBox( i18n("Include in multiple sync"), topFrame );
144 topLayout->addMultiCellWidget(mIncludeInRing, iii,iii,0,1); 144 topLayout->addMultiCellWidget(mIncludeInRing, iii,iii,0,1);
145 ++iii; 145 ++iii;
146 146
147 mAskForPreferences = new QCheckBox( i18n("Ask for preferences before sync"), topFrame ); 147 mAskForPreferences = new QCheckBox( i18n("Ask for preferences before sync"), topFrame );
148 topLayout->addMultiCellWidget(mAskForPreferences, iii,iii,0,1); 148 topLayout->addMultiCellWidget(mAskForPreferences, iii,iii,0,1);
149 ++iii; 149 ++iii;
150 QButtonGroup* gr = new QButtonGroup ( 1, Qt::Horizontal, i18n("Sync preferences"), topFrame); 150 QButtonGroup* gr = new QButtonGroup ( 1, Qt::Horizontal, i18n("Sync preferences"), topFrame);
151 topLayout->addMultiCellWidget(gr, iii,iii,0,1); 151 topLayout->addMultiCellWidget(gr, iii,iii,0,1);
152 ++iii; 152 ++iii;
153 loc = new QRadioButton ( i18n("Take local entry on conflict"), gr ); 153 loc = new QRadioButton ( i18n("Take local entry on conflict"), gr );
154 rem = new QRadioButton ( i18n("Take remote entry on conflict"), gr ); 154 rem = new QRadioButton ( i18n("Take remote entry on conflict"), gr );
155 newest = new QRadioButton ( i18n("Take newest entry on conflict"), gr ); 155 newest = new QRadioButton ( i18n("Take newest entry on conflict"), gr );
156 ask = new QRadioButton ( i18n("Ask for every entry on conflict"), gr ); 156 ask = new QRadioButton ( i18n("Ask for every entry on conflict"), gr );
157 f_loc= new QRadioButton ( i18n("Force: Take local entry always"), gr ); 157 f_loc= new QRadioButton ( i18n("Force: Take local entry always"), gr );
158 f_rem = new QRadioButton ( i18n("Force: Take remote entry always"), gr ); 158 f_rem = new QRadioButton ( i18n("Force: Take remote entry always"), gr );
159 // both = new QRadioButton ( i18n("Take both on conflict"), gr ); 159 // both = new QRadioButton ( i18n("Take both on conflict"), gr );
160 160
161 mShowSummaryAfterSync = new QCheckBox( i18n("Show summary after sync"), topFrame ); 161 mShowSummaryAfterSync = new QCheckBox( i18n("Show summary after sync"), topFrame );
162 topLayout->addMultiCellWidget(mShowSummaryAfterSync, iii,iii,0,1); 162 topLayout->addMultiCellWidget(mShowSummaryAfterSync, iii,iii,0,1);
163 ++iii; 163 ++iii;
164 164
165 mWriteBackExisting= new QCheckBox( i18n("Write back existing entries only"), topFrame ); 165 mWriteBackExisting= new QCheckBox( i18n("Write back existing entries only"), topFrame );
166 topLayout->addMultiCellWidget(mWriteBackExisting, iii,iii,0,1); 166 topLayout->addMultiCellWidget(mWriteBackExisting, iii,iii,0,1);
167 ++iii; 167 ++iii;
168 168
169 mWriteBackFile = new QCheckBox( i18n("Write back file"), topFrame ); 169 mWriteBackFile = new QCheckBox( i18n("Write back file"), topFrame );
170 topLayout->addMultiCellWidget(mWriteBackFile, iii,iii,0,1); 170 topLayout->addMultiCellWidget(mWriteBackFile, iii,iii,0,1);
171 ++iii; 171 ++iii;
172 172
173 proGr = new QButtonGroup ( 1, Qt::Horizontal, i18n("Profile kind"), topFrame); 173 proGr = new QButtonGroup ( 1, Qt::Horizontal, i18n("Profile kind"), topFrame);
174 gr = proGr; 174 gr = proGr;
175 topLayout->addMultiCellWidget(gr, iii,iii,0,1); 175 topLayout->addMultiCellWidget(gr, iii,iii,0,1);
176 ++iii; 176 ++iii;
177 mIsLocal = new QRadioButton ( i18n("Local file"), gr ); 177 mIsLocal = new QRadioButton ( i18n("Local file"), gr );
178 mIsNotLocal = new QRadioButton ( i18n("Remote file (w down/upload command)"), gr ); 178 mIsNotLocal = new QRadioButton ( i18n("Remote file (w down/upload command)"), gr );
179 connect (mIsLocal, SIGNAL( toggled(bool)), this, SLOT (kindChanged(bool) ) ); 179 connect (mIsLocal, SIGNAL( toggled(bool)), this, SLOT (kindChanged(bool) ) );
180 180
181 localFileWidget = new QVBox( topFrame); 181 localFileWidget = new QVBox( topFrame);
182 topLayout->addMultiCellWidget(localFileWidget, iii,iii,0,1); 182 topLayout->addMultiCellWidget(localFileWidget, iii,iii,0,1);
183 ++iii; 183 ++iii;
184 QHBox* temphb = new QHBox( localFileWidget ); 184 QHBox* temphb = new QHBox( localFileWidget );
185 lab = new QLabel( i18n("Local file:"), temphb); 185 lab = new QLabel( i18n("Local file:"), temphb);
186 mRemoteFile = new QLineEdit(localFileWidget); 186 mRemoteFile = new QLineEdit(localFileWidget);
187 187
188 button = new QPushButton( i18n("Choose..."), temphb ); 188 button = new QPushButton( i18n("Choose..."), temphb );
189 connect ( button, SIGNAL( clicked()), this, SLOT ( chooseFile() ) ); 189 connect ( button, SIGNAL( clicked()), this, SLOT ( chooseFile() ) );
190 190
191 191
192 remoteFileWidget = new QVBox( topFrame); 192 remoteFileWidget = new QVBox( topFrame);
193 topLayout->addMultiCellWidget(remoteFileWidget, iii,iii,0,1); 193 topLayout->addMultiCellWidget(remoteFileWidget, iii,iii,0,1);
194 ++iii; 194 ++iii;
195 lab = new QLabel( i18n("Pre sync (download) command:"), remoteFileWidget); 195 lab = new QLabel( i18n("Pre sync (download) command:"), remoteFileWidget);
196 mRemotePrecommand = new QLineEdit(remoteFileWidget); 196 mRemotePrecommand = new QLineEdit(remoteFileWidget);
197 197
198 lab = new QLabel( i18n("Local temp file:"), remoteFileWidget); 198 lab = new QLabel( i18n("Local temp file:"), remoteFileWidget);
199 mLocalTempFile = new QLineEdit(remoteFileWidget); 199 mLocalTempFile = new QLineEdit(remoteFileWidget);
200 200
201 201
202 lab = new QLabel( i18n("Post sync (upload) command:"), remoteFileWidget); 202 lab = new QLabel( i18n("Post sync (upload) command:"), remoteFileWidget);
203 mRemotePostcommand = new QLineEdit(remoteFileWidget); 203 mRemotePostcommand = new QLineEdit(remoteFileWidget);
204 204
205 lab = new QLabel( i18n("Fill in default values for:"), remoteFileWidget); 205 lab = new QLabel( i18n("Fill in default values for:"), remoteFileWidget);
206 temphb = new QHBox( remoteFileWidget ); 206 temphb = new QHBox( remoteFileWidget );
207 button = new QPushButton( i18n("ssh/scp"), temphb ); 207 button = new QPushButton( i18n("ssh/scp"), temphb );
208 connect ( button, SIGNAL( clicked()), this, SLOT (fillSSH() ) ); 208 connect ( button, SIGNAL( clicked()), this, SLOT (fillSSH() ) );
209 button = new QPushButton( i18n("ftp"), temphb ); 209 button = new QPushButton( i18n("ftp"), temphb );
210 connect ( button, SIGNAL( clicked()), this, SLOT (fillFTP() ) ); 210 connect ( button, SIGNAL( clicked()), this, SLOT (fillFTP() ) );
211 lab = new QLabel( i18n("Hint: Use $PWD$ for placeholder of password!"), remoteFileWidget); 211 lab = new QLabel( i18n("Hint: Use $PWD$ for placeholder of password!"), remoteFileWidget);
212 212
213 213
214} 214}
215void KSyncPrefsDialog::slotOK() 215void KSyncPrefsDialog::slotOK()
216{ 216{
217 if ( mMyMachineName->text() == "undefined" ) { 217 if ( mMyMachineName->text() == "undefined" ) {
218 KMessageBox::error(this,i18n("Local device name undefined!\nPlease define device name!"),i18n("KO/Pi config error")); 218 KMessageBox::error(this,i18n("Local device name undefined!\nPlease define device name!"),i18n("KO/Pi config error"));
219 return; 219 return;
220 } 220 }
221 int i; 221 int i;
222 for (i = 0; i < mSyncProfileNames.count(); ++ i) { 222 for (i = 0; i < mSyncProfileNames.count(); ++ i) {
223 if ( mSyncProfileNames.contains( mSyncProfileNames[i]) > 1 ) { 223 if ( mSyncProfileNames.contains( mSyncProfileNames[i]) > 1 ) {
224 KMessageBox::error(this,i18n("Multiple profiles with same name!\nPlease use unique profile names!"),i18n("KO/Pi config error")); 224 KMessageBox::error(this,i18n("Multiple profiles with same name!\nPlease use unique profile names!"),i18n("KO/Pi config error"));
225 return; 225 return;
226 } 226 }
227 } 227 }
228 usrWriteConfig(); 228 usrWriteConfig();
229 QDialog::accept(); 229 QDialog::accept();
230} 230}
231void KSyncPrefsDialog::accept() 231void KSyncPrefsDialog::accept()
232{ 232{
233 slotOK(); 233 slotOK();
234} 234}
235void KSyncPrefsDialog::chooseFile() 235void KSyncPrefsDialog::chooseFile()
236{ 236{
237 QString fn = QDir::homeDirPath(); 237 QString fn = QDir::homeDirPath();
238 238
239 fn =KFileDialog:: getOpenFileName( fn, i18n("Sync filename(*.ics/*.vcs)"), this ); 239 fn =KFileDialog:: getOpenFileName( fn, i18n("Sync filename(*.ics/*.vcs)"), this );
240 if ( fn == "" ) 240 if ( fn == "" )
241 return; 241 return;
242 mRemoteFile->setText( fn ); 242 mRemoteFile->setText( fn );
243} 243}
244 244
245void KSyncPrefsDialog::textChanged( const QString & s ) 245void KSyncPrefsDialog::textChanged( const QString & s )
246{ 246{
247 if ( mProfileBox->count() == 0 ) 247 if ( mProfileBox->count() == 0 )
248 return; 248 return;
249 if ( currentSelection < 3 ) { 249 if ( currentSelection < 3 ) {
250 //KMessageBox::error(this,i18n("This profil name\ncannot be edited!\n"),i18n("KO/Pi config error")); 250 //KMessageBox::error(this,i18n("This profil name\ncannot be edited!\n"),i18n("KO/Pi config error"));
251 mProfileBox->blockSignals( true ); 251 mProfileBox->blockSignals( true );
252 mProfileBox->setCurrentItem(mProfileBox-> currentItem ()); 252 mProfileBox->setCurrentItem(mProfileBox-> currentItem ());
253 mProfileBox->blockSignals( false ); 253 mProfileBox->blockSignals( false );
254 return; 254 return;
255 } 255 }
256 //qDebug("cur i %d ",mProfileBox-> currentItem () ); 256 //qDebug("cur i %d ",mProfileBox-> currentItem () );
257 mProfileBox->changeItem ( s, mProfileBox-> currentItem () ) ; 257 mProfileBox->changeItem ( s, mProfileBox-> currentItem () ) ;
258 KSyncProfile* prof = mSyncProfiles.at(mProfileBox-> currentItem ()) ; 258 KSyncProfile* prof = mSyncProfiles.at(mProfileBox-> currentItem ()) ;
259 prof->setName( s ); 259 prof->setName( s );
260 mSyncProfileNames[mProfileBox-> currentItem ()] = s; 260 mSyncProfileNames[mProfileBox-> currentItem ()] = s;
261} 261}
262void KSyncPrefsDialog::profileChanged( int item ) 262void KSyncPrefsDialog::profileChanged( int item )
263{ 263{
264 //qDebug("KSyncPrefsDialog::profileChanged %d ", item ); 264 //qDebug("KSyncPrefsDialog::profileChanged %d ", item );
265 KSyncProfile* prof; 265 KSyncProfile* prof;
266 saveProfile(); 266 saveProfile();
267 currentSelection = item; 267 currentSelection = item;
268 prof = mSyncProfiles.at(item) ; 268 prof = mSyncProfiles.at(item) ;
269 mRemotePrecommand->setText(prof->getPreSyncCommand()); 269 mRemotePrecommand->setText(prof->getPreSyncCommand());
270 mRemotePostcommand->setText(prof->getPostSyncCommand()); 270 mRemotePostcommand->setText(prof->getPostSyncCommand());
271 mLocalTempFile->setText(prof->getLocalTempFile()); 271 mLocalTempFile->setText(prof->getLocalTempFile());
272 mRemoteFile->setText(prof->getRemoteFileName()) ; 272 mRemoteFile->setText(prof->getRemoteFileName()) ;
273 mShowSummaryAfterSync->setChecked( prof->getShowSummaryAfterSync()); 273 mShowSummaryAfterSync->setChecked( prof->getShowSummaryAfterSync());
274 mAskForPreferences->setChecked( prof->getAskForPreferences()); 274 mAskForPreferences->setChecked( prof->getAskForPreferences());
275 mWriteBackExisting->setChecked( prof->getWriteBackExisting() ); 275 mWriteBackExisting->setChecked( prof->getWriteBackExisting() );
276 mWriteBackFile->setChecked( prof->getWriteBackFile()); 276 mWriteBackFile->setChecked( prof->getWriteBackFile());
277 mIncludeInRing->setChecked( prof->getIncludeInRingSync() ); 277 mIncludeInRing->setChecked( prof->getIncludeInRingSync() );
278 278
279 switch ( prof->getSyncPrefs() ) { 279 switch ( prof->getSyncPrefs() ) {
280 case 0: 280 case 0:
281 loc->setChecked( true); 281 loc->setChecked( true);
282 break; 282 break;
283 case 1: 283 case 1:
284 rem->setChecked( true ); 284 rem->setChecked( true );
285 break; 285 break;
286 case 2: 286 case 2:
287 newest->setChecked( true); 287 newest->setChecked( true);
288 break; 288 break;
289 case 3: 289 case 3:
290 ask->setChecked( true); 290 ask->setChecked( true);
291 break; 291 break;
292 case 4: 292 case 4:
293 f_loc->setChecked( true); 293 f_loc->setChecked( true);
294 break; 294 break;
295 case 5: 295 case 5:
296 f_rem->setChecked( true); 296 f_rem->setChecked( true);
297 break; 297 break;
298 case 6: 298 case 6:
299 //both->setChecked( true); 299 //both->setChecked( true);
300 break; 300 break;
301 default: 301 default:
302 break; 302 break;
303 } 303 }
304 mIsLocal->setChecked(prof->getIsLocalFileSync()) ; 304 mIsLocal->setChecked(prof->getIsLocalFileSync()) ;
305 mIsNotLocal->setChecked(!prof->getIsLocalFileSync()); 305 mIsNotLocal->setChecked(!prof->getIsLocalFileSync());
306 proGr->setEnabled( item > 2 ); 306 proGr->setEnabled( item > 2 );
307 if ( item < 3 ) { 307 if ( item < 3 ) {
308 localFileWidget->setEnabled(false); 308 localFileWidget->setEnabled(false);
309 remoteFileWidget->setEnabled(false); 309 remoteFileWidget->setEnabled(false);
310 310
311 } else 311 } else
312 kindChanged( prof->getIsLocalFileSync() ); 312 kindChanged( prof->getIsLocalFileSync() );
313} 313}
314 314
315void KSyncPrefsDialog::fillSSH() 315void KSyncPrefsDialog::fillSSH()
316{ 316{
317 mRemotePrecommand->setText("scp zaurus@192.168.0.65:/home/zaurus/kdepim/apps/korganizer/mycalendar.ics /tmp/mycalendar.ics" ); 317 mRemotePrecommand->setText("scp zaurus@192.168.0.65:/home/zaurus/kdepim/apps/korganizer/mycalendar.ics /tmp/mycalendar.ics" );
318 mLocalTempFile->setText("/tmp/mycalendar.ics" ); 318 mLocalTempFile->setText("/tmp/mycalendar.ics" );
319 mRemotePostcommand->setText("scp /tmp/mycalendar.ics zaurus@192.168.0.65:/home/zaurus/kdepim/apps/korganizer/mycalendar.ics" ); 319 mRemotePostcommand->setText("scp /tmp/mycalendar.ics zaurus@192.168.0.65:/home/zaurus/kdepim/apps/korganizer/mycalendar.ics" );
320} 320}
321void KSyncPrefsDialog::fillFTP() 321void KSyncPrefsDialog::fillFTP()
322{ 322{
323 mRemotePrecommand->setText("cd /tmp;ftp ftp://zaurus:a@192.168.0.65/kdepim/apps/korganizer/mycalendar.ics" ); 323 mRemotePrecommand->setText("cd /tmp;ftp ftp://zaurus:a@192.168.0.65/kdepim/apps/korganizer/mycalendar.ics" );
324 mLocalTempFile->setText("/tmp/mycalendar.ics" ); 324 mLocalTempFile->setText("/tmp/mycalendar.ics" );
325 mRemotePostcommand->setText("ftp -u ftp://zaurus:a@192.168.0.65/kdepim/apps/korganizer/mycalendar.ics /tmp/mycalendar.ics" ); 325 mRemotePostcommand->setText("ftp -u ftp://zaurus:a@192.168.0.65/kdepim/apps/korganizer/mycalendar.ics /tmp/mycalendar.ics" );
326 326
327} 327}
328void KSyncPrefsDialog::kindChanged( bool b ) 328void KSyncPrefsDialog::kindChanged( bool b )
329{ 329{
330 330
331 localFileWidget->setEnabled(b); 331 localFileWidget->setEnabled(b);
332 remoteFileWidget->setEnabled(!b); 332 remoteFileWidget->setEnabled(!b);
333 333
334} 334}
335void KSyncPrefsDialog::deleteProfile() 335void KSyncPrefsDialog::deleteProfile()
336{ 336{
337 //qDebug("KSyncPrefsDialog::deleteProfile() "); 337 //qDebug("KSyncPrefsDialog::deleteProfile() ");
338 if ( currentSelection >= 0 ) { 338 if ( currentSelection >= 0 ) {
339 if ( currentSelection < 3 ) { 339 if ( currentSelection < 3 ) {
340 KMessageBox::error(this,i18n("This profil cannot be deleted!\n"),i18n("KO/Pi config error")); 340 KMessageBox::error(this,i18n("This profil cannot be deleted!\n"),i18n("KO/Pi config error"));
341 return; 341 return;
342 } 342 }
343 KSyncProfile* temp = mSyncProfiles.at(currentSelection); 343 KSyncProfile* temp = mSyncProfiles.at(currentSelection);
344 mSyncProfiles.remove( temp ); 344 mSyncProfiles.remove( temp );
345 mSyncProfileNames.remove( mSyncProfileNames.at( currentSelection )); 345 mSyncProfileNames.remove( mSyncProfileNames.at( currentSelection ));
346 insertProfiles(); 346 insertProfiles();
347 } 347 }
348} 348}
349 349
350void KSyncPrefsDialog::saveProfile() 350void KSyncPrefsDialog::saveProfile()
351{ 351{
352 KSyncProfile* prof; 352 KSyncProfile* prof;
353 if ( currentSelection >= 0 ) { 353 if ( currentSelection >= 0 ) {
354 prof = mSyncProfiles.at(currentSelection) ; 354 prof = mSyncProfiles.at(currentSelection) ;
355 prof->setPreSyncCommand( mRemotePrecommand->text()); 355 prof->setPreSyncCommand( mRemotePrecommand->text());
356 prof->setPostSyncCommand( mRemotePostcommand->text() ); 356 prof->setPostSyncCommand( mRemotePostcommand->text() );
357 prof->setLocalTempFile( mLocalTempFile->text()); 357 prof->setLocalTempFile( mLocalTempFile->text());
358 prof->setRemoteFileName( mRemoteFile->text() ); 358 prof->setRemoteFileName( mRemoteFile->text() );
359 prof->setShowSummaryAfterSync( mShowSummaryAfterSync->isChecked() ); 359 prof->setShowSummaryAfterSync( mShowSummaryAfterSync->isChecked() );
360 prof->setAskForPreferences( mAskForPreferences->isChecked()); 360 prof->setAskForPreferences( mAskForPreferences->isChecked());
361 prof->setWriteBackExisting(mWriteBackExisting->isChecked() ); 361 prof->setWriteBackExisting(mWriteBackExisting->isChecked() );
362 prof->setWriteBackFile( mWriteBackFile->isChecked()); 362 prof->setWriteBackFile( mWriteBackFile->isChecked());
363 prof->setIncludeInRingSync( mIncludeInRing->isChecked() ); 363 prof->setIncludeInRingSync( mIncludeInRing->isChecked() );
364 int syncprefs = rem->isChecked()*1+newest->isChecked()*2+ ask->isChecked()*3+ f_loc->isChecked()*4+ f_rem->isChecked()*5 ;//+ both->isChecked()*6 ; 364 int syncprefs = rem->isChecked()*1+newest->isChecked()*2+ ask->isChecked()*3+ f_loc->isChecked()*4+ f_rem->isChecked()*5 ;//+ both->isChecked()*6 ;
365 prof->setSyncPrefs( syncprefs); 365 prof->setSyncPrefs( syncprefs);
366 prof->setIsLocalFileSync( mIsLocal->isChecked() ); 366 prof->setIsLocalFileSync( mIsLocal->isChecked() );
367 } 367 }
368 368
369} 369}
370 370
371void KSyncPrefsDialog::insertProfiles() 371void KSyncPrefsDialog::insertProfiles()
372{ 372{
373 int curItem = mProfileBox->currentItem(); 373 int curItem = mProfileBox->currentItem();
374 mProfileBox->blockSignals( true ); 374 mProfileBox->blockSignals( true );
375 mProfileBox->clear(); 375 mProfileBox->clear();
376 mProfileBox->insertStringList (mSyncProfileNames ); 376 mProfileBox->insertStringList (mSyncProfileNames );
377 int item = mSyncProfileNames.count() -1; 377 int item = mSyncProfileNames.count() -1;
378 if ( curItem >= 0 && mSyncProfileNames.count() > 0 && curItem < mSyncProfileNames.count() ) 378 if ( curItem >= 0 && mSyncProfileNames.count() > 0 && curItem < mSyncProfileNames.count() )
379 mProfileBox->setCurrentItem( curItem ); 379 mProfileBox->setCurrentItem( curItem );
380 else if ( item >= 0 ) { 380 else if ( item >= 0 ) {
381 mProfileBox->setCurrentItem( item ); 381 mProfileBox->setCurrentItem( item );
382 } 382 }
383 currentSelection = -1; 383 currentSelection = -1;
384 if ( mSyncProfileNames.count() > 0 ) { 384 if ( mSyncProfileNames.count() > 0 ) {
385 //qDebug(" profileChanged( mProfileBox->currentItem() "); 385 //qDebug(" profileChanged( mProfileBox->currentItem() ");
386 profileChanged( mProfileBox->currentItem() ); 386 profileChanged( mProfileBox->currentItem() );
387 currentSelection = mProfileBox->currentItem(); 387 currentSelection = mProfileBox->currentItem();
388 } 388 }
389 mProfileBox->blockSignals( false ); 389 mProfileBox->blockSignals( false );
390} 390}
391 391
392void KSyncPrefsDialog::addProfile ( KSyncProfile* temp ) 392void KSyncPrefsDialog::addProfile ( KSyncProfile* temp )
393{ 393{
394 saveProfile(); 394 saveProfile();
395 mSyncProfiles.append( temp ); 395 mSyncProfiles.append( temp );
396 mSyncProfileNames << temp->getName(); 396 mSyncProfileNames << temp->getName();
397 insertProfiles(); 397 insertProfiles();
398 int last = mProfileBox->count() -1; 398 int last = mProfileBox->count() -1;
399 mProfileBox->blockSignals( true ); 399 mProfileBox->blockSignals( true );
400 mProfileBox->setCurrentItem( last ); 400 mProfileBox->setCurrentItem( last );
401 mProfileBox->blockSignals( false ); 401 mProfileBox->blockSignals( false );
402 profileChanged(last); 402 profileChanged(last);
403} 403}
404void KSyncPrefsDialog::newProfile() 404void KSyncPrefsDialog::newProfile()
405{ 405{
406 addProfile ( new KSyncProfile () ); 406 addProfile ( new KSyncProfile () );
407} 407}
408 408
409void KSyncPrefsDialog::cloneProfile() 409void KSyncPrefsDialog::cloneProfile()
410{ 410{
411 if ( currentSelection >= 0 ) 411 if ( currentSelection >= 0 )
412 addProfile (mSyncProfiles.at(currentSelection)->clone()) ; 412 addProfile (mSyncProfiles.at(currentSelection)->clone()) ;
413 else 413 else
414 newProfile(); 414 newProfile();
415} 415}
416 416
417void KSyncPrefsDialog::setLocalMachineName ( const QString& name ) 417void KSyncPrefsDialog::setLocalMachineName ( const QString& name )
418{ 418{
419 mMyMachineName->setText( name ); 419 mMyMachineName->setText( name );
420 420
421} 421}
422QString KSyncPrefsDialog::getLocalMachineName ( ) 422QString KSyncPrefsDialog::getLocalMachineName ( )
423{ 423{
424 return mMyMachineName->text(); 424 return mMyMachineName->text();
425} 425}
426 426
427QStringList KSyncPrefsDialog::getSyncProfileNames() 427QStringList KSyncPrefsDialog::getSyncProfileNames()
428{ 428{
429 return mSyncProfileNames; 429 return mSyncProfileNames;
430} 430}
431void KSyncPrefsDialog::usrReadConfig() 431void KSyncPrefsDialog::usrReadConfig()
432{ 432{
433 //KConfig *config = KOGlobals::config(); 433 //KConfig *config = KOGlobals::config();
434 KConfig config ( locateLocal( "config","syncprofilesrc" ) ); 434 KConfig config ( locateLocal( "config","syncprofilesrc" ) );
435 config.setGroup("SyncProfiles"); 435 config.setGroup("SyncProfiles");
436 mSyncProfileNames =config.readListEntry("SyncProfileNames"); 436 mSyncProfileNames =config.readListEntry("SyncProfileNames");
437 mMyMachineName->setText(config.readEntry("LocalMachineName","undefined"));
437 int i; 438 int i;
438 KSyncProfile* temp ; 439 KSyncProfile* temp ;
439 mSyncProfiles.clear(); 440 mSyncProfiles.clear();
440 for ( i = 0; i < mSyncProfileNames.count();++i ) { 441 for ( i = 0; i < mSyncProfileNames.count();++i ) {
441 temp = new KSyncProfile (); 442 temp = new KSyncProfile ();
442 temp->setName( mSyncProfileNames[i] ); 443 temp->setName( mSyncProfileNames[i] );
443 temp->readConfig( &config ); 444 temp->readConfig( &config );
444 mSyncProfiles.append( temp ); 445 mSyncProfiles.append( temp );
445 } 446 }
446 insertProfiles(); 447 insertProfiles();
447 //mMyMachineName->setText(KOPrefs::instance()->mLocalMachineName ); 448 //mMyMachineName->setText(KOPrefs::instance()->mLocalMachineName );
448} 449}
449 450
450 451
451void KSyncPrefsDialog::usrWriteConfig() 452void KSyncPrefsDialog::usrWriteConfig()
452{ 453{
453 saveProfile(); 454 saveProfile();
454 if ( currentSelection >= 0 ) 455 if ( currentSelection >= 0 )
455 profileChanged(currentSelection); 456 profileChanged(currentSelection);
456 //KConfig *config = KOGlobals::config(); 457 //KConfig *config = KOGlobals::config();
457 KConfig config ( locateLocal( "config","syncprofilesrc" ) ); 458 KConfig config ( locateLocal( "config","syncprofilesrc" ) );
458 config.setGroup("SyncProfiles"); 459 config.setGroup("SyncProfiles");
459 KSyncProfile* prof = mSyncProfiles.first(); 460 KSyncProfile* prof = mSyncProfiles.first();
460 while ( prof ) { 461 while ( prof ) {
461 prof->writeConfig(&config); 462 prof->writeConfig(&config);
462 prof = mSyncProfiles.next(); 463 prof = mSyncProfiles.next();
463 } 464 }
464 //KOPrefs::instance()->mSyncProfileNames = mSyncProfileNames; 465 //KOPrefs::instance()->mSyncProfileNames = mSyncProfileNames;
465 //KOPrefs::instance()->mLocalMachineName = mMyMachineName->text(); 466 //KOPrefs::instance()->mLocalMachineName = mMyMachineName->text();
466 config.writeEntry("SyncProfileNames",&mSyncProfileNames); 467 config.writeEntry("SyncProfileNames",mSyncProfileNames);
468 QString name = mMyMachineName->text();
469 config.writeEntry("LocalMachineName",name);
467} 470}
468 471