summaryrefslogtreecommitdiffabout
path: root/korganizer/calendarview.cpp
Unidiff
Diffstat (limited to 'korganizer/calendarview.cpp') (more/less context) (ignore whitespace changes)
-rw-r--r--korganizer/calendarview.cpp6
1 files changed, 3 insertions, 3 deletions
diff --git a/korganizer/calendarview.cpp b/korganizer/calendarview.cpp
index 7044e90..f9685e9 100644
--- a/korganizer/calendarview.cpp
+++ b/korganizer/calendarview.cpp
@@ -274,193 +274,193 @@ class KOBeamPrefs : public QDialog
274{ 274{
275 public: 275 public:
276 KOBeamPrefs( QWidget *parent=0, const char *name=0 ) : 276 KOBeamPrefs( QWidget *parent=0, const char *name=0 ) :
277 QDialog( parent, name, true ) 277 QDialog( parent, name, true )
278 { 278 {
279 setCaption( i18n("Beam Options") ); 279 setCaption( i18n("Beam Options") );
280 QVBoxLayout* lay = new QVBoxLayout( this ); 280 QVBoxLayout* lay = new QVBoxLayout( this );
281 lay->setSpacing( 3 ); 281 lay->setSpacing( 3 );
282 lay->setMargin( 3 ); 282 lay->setMargin( 3 );
283 QButtonGroup* format = new QButtonGroup( 1, Horizontal, i18n("File format"), this ); 283 QButtonGroup* format = new QButtonGroup( 1, Horizontal, i18n("File format"), this );
284 lay->addWidget( format ); 284 lay->addWidget( format );
285 format->setExclusive ( true ) ; 285 format->setExclusive ( true ) ;
286 QButtonGroup* time = new QButtonGroup(1, Horizontal, i18n("Time format"), this ); 286 QButtonGroup* time = new QButtonGroup(1, Horizontal, i18n("Time format"), this );
287 lay->addWidget( time ); time->setExclusive ( true ) ; 287 lay->addWidget( time ); time->setExclusive ( true ) ;
288 vcal = new QRadioButton(" vCalendar ", format ); 288 vcal = new QRadioButton(" vCalendar ", format );
289 ical = new QRadioButton(" iCalendar ", format ); 289 ical = new QRadioButton(" iCalendar ", format );
290 vcal->setChecked( true ); 290 vcal->setChecked( true );
291 tz = new QRadioButton(i18n(" With timezone "), time ); 291 tz = new QRadioButton(i18n(" With timezone "), time );
292 local = new QRadioButton(i18n(" Local time "), time ); 292 local = new QRadioButton(i18n(" Local time "), time );
293 tz->setChecked( true ); 293 tz->setChecked( true );
294 QPushButton * ok = new QPushButton( i18n("Beam via IR!"), this ); 294 QPushButton * ok = new QPushButton( i18n("Beam via IR!"), this );
295 lay->addWidget( ok ); 295 lay->addWidget( ok );
296 QPushButton * cancel = new QPushButton( i18n("Cancel"), this ); 296 QPushButton * cancel = new QPushButton( i18n("Cancel"), this );
297 lay->addWidget( cancel ); 297 lay->addWidget( cancel );
298 connect ( ok,SIGNAL(clicked() ),this , SLOT ( accept() ) ); 298 connect ( ok,SIGNAL(clicked() ),this , SLOT ( accept() ) );
299 connect (cancel, SIGNAL(clicked() ), this, SLOT ( reject()) ); 299 connect (cancel, SIGNAL(clicked() ), this, SLOT ( reject()) );
300 resize( 200, 200 ); 300 resize( 200, 200 );
301 } 301 }
302 302
303 bool beamVcal() { return vcal->isChecked(); } 303 bool beamVcal() { return vcal->isChecked(); }
304 bool beamLocal() { return local->isChecked(); } 304 bool beamLocal() { return local->isChecked(); }
305private: 305private:
306 QRadioButton* vcal, *ical, *local, *tz; 306 QRadioButton* vcal, *ical, *local, *tz;
307}; 307};
308class KOCatPrefs : public QDialog 308class KOCatPrefs : public QDialog
309{ 309{
310 public: 310 public:
311 KOCatPrefs( QWidget *parent=0, const char *name=0 ) : 311 KOCatPrefs( QWidget *parent=0, const char *name=0 ) :
312 QDialog( parent, name, true ) 312 QDialog( parent, name, true )
313 { 313 {
314 setCaption( i18n("Manage new Categories") ); 314 setCaption( i18n("Manage new Categories") );
315 QVBoxLayout* lay = new QVBoxLayout( this ); 315 QVBoxLayout* lay = new QVBoxLayout( this );
316 lay->setSpacing( 3 ); 316 lay->setSpacing( 3 );
317 lay->setMargin( 3 ); 317 lay->setMargin( 3 );
318 QLabel * lab = new QLabel( i18n("After importing/loading/syncing there may be new categories in events or todos which are not added automatically to the category list. Please choose what to do <b>now</b>:"), this ); 318 QLabel * lab = new QLabel( i18n("After importing/loading/syncing there may be new categories in events or todos which are not added automatically to the category list. Please choose what to do <b>now</b>:"), this );
319 lay->addWidget( lab ); 319 lay->addWidget( lab );
320 QButtonGroup* format = new QButtonGroup( 1, Horizontal, i18n("New categories not in list:"), this ); 320 QButtonGroup* format = new QButtonGroup( 1, Horizontal, i18n("New categories not in list:"), this );
321 lay->addWidget( format ); 321 lay->addWidget( format );
322 format->setExclusive ( true ) ; 322 format->setExclusive ( true ) ;
323 addCatBut = new QRadioButton(i18n("Add to category list"), format ); 323 addCatBut = new QRadioButton(i18n("Add to category list"), format );
324 new QRadioButton(i18n("Remove from Events/Todos"), format ); 324 new QRadioButton(i18n("Remove from Events/Todos"), format );
325 addCatBut->setChecked( true ); 325 addCatBut->setChecked( true );
326 QPushButton * ok = new QPushButton( i18n("Change category list now!"), this ); 326 QPushButton * ok = new QPushButton( i18n("Change category list now!"), this );
327 lay->addWidget( ok ); 327 lay->addWidget( ok );
328 QPushButton * cancel = new QPushButton( i18n("Cancel"), this ); 328 QPushButton * cancel = new QPushButton( i18n("Cancel"), this );
329 lay->addWidget( cancel ); 329 lay->addWidget( cancel );
330 connect ( ok,SIGNAL(clicked() ),this , SLOT ( accept() ) ); 330 connect ( ok,SIGNAL(clicked() ),this , SLOT ( accept() ) );
331 connect (cancel, SIGNAL(clicked() ), this, SLOT ( reject()) ); 331 connect (cancel, SIGNAL(clicked() ), this, SLOT ( reject()) );
332 resize( 200, 200 ); 332 resize( 200, 200 );
333 } 333 }
334 334
335 bool addCat() { return addCatBut->isChecked(); } 335 bool addCat() { return addCatBut->isChecked(); }
336private: 336private:
337 QRadioButton* addCatBut; 337 QRadioButton* addCatBut;
338}; 338};
339 339
340 340
341 341
342CalendarView::CalendarView( CalendarResources *calendar, 342CalendarView::CalendarView( CalendarResources *calendar,
343 QWidget *parent, const char *name ) 343 QWidget *parent, const char *name )
344 : CalendarViewBase( parent, name ), 344 : CalendarViewBase( parent, name ),
345 mCalendar( calendar ), 345 mCalendar( calendar ),
346 mResourceManager( calendar->resourceManager() ) 346 mResourceManager( calendar->resourceManager() )
347{ 347{
348 348
349 mEventEditor = 0; 349 mEventEditor = 0;
350 mTodoEditor = 0; 350 mTodoEditor = 0;
351 351
352 init(); 352 init();
353} 353}
354 354
355CalendarView::CalendarView( Calendar *calendar, 355CalendarView::CalendarView( Calendar *calendar,
356 QWidget *parent, const char *name ) 356 QWidget *parent, const char *name )
357 : CalendarViewBase( parent, name ), 357 : CalendarViewBase( parent, name ),
358 mCalendar( calendar ), 358 mCalendar( calendar ),
359 mResourceManager( 0 ) 359 mResourceManager( 0 )
360{ 360{
361 361
362 mEventEditor = 0; 362 mEventEditor = 0;
363 mTodoEditor = 0; 363 mTodoEditor = 0;
364 init(); 364 init();
365} 365}
366 366
367void CalendarView::init() 367void CalendarView::init()
368{ 368{
369 mNextAlarmDateTime = QDateTime::currentDateTime(); 369 mNextAlarmDateTime = QDateTime::currentDateTime();
370 setFocusPolicy ( NoFocus ); 370 //setFocusPolicy ( NoFocus );
371 mViewerCallerIsSearchDialog = false; 371 mViewerCallerIsSearchDialog = false;
372 mBlockShowDates = false; 372 mBlockShowDates = false;
373 373
374 mDatePickerMode = 0; 374 mDatePickerMode = 0;
375 mCurrentSyncDevice = ""; 375 mCurrentSyncDevice = "";
376 mViewManager = new KOViewManager( this ); 376 mViewManager = new KOViewManager( this );
377 mDialogManager = new KODialogManager( this ); 377 mDialogManager = new KODialogManager( this );
378 mEventViewerDialog = 0; 378 mEventViewerDialog = 0;
379 mModified = false; 379 mModified = false;
380 mReadOnly = false; 380 mReadOnly = false;
381 mSelectedIncidence = 0; 381 mSelectedIncidence = 0;
382 mCalPrinter = 0; 382 mCalPrinter = 0;
383 mFilters.setAutoDelete(true); 383 mFilters.setAutoDelete(true);
384 384
385 mCalendar->registerObserver( this ); 385 mCalendar->registerObserver( this );
386 // TODO: Make sure that view is updated, when calendar is changed. 386 // TODO: Make sure that view is updated, when calendar is changed.
387 387
388 mStorage = new FileStorage( mCalendar ); 388 mStorage = new FileStorage( mCalendar );
389 mNavigator = new DateNavigator( this, "datevav", mViewManager ); 389 mNavigator = new DateNavigator( this, "datevav", mViewManager );
390 390
391 QBoxLayout *topLayout = (QBoxLayout*)layout(); 391 QBoxLayout *topLayout = (QBoxLayout*)layout();
392#ifndef KORG_NOSPLITTER 392#ifndef KORG_NOSPLITTER
393 // create the main layout frames. 393 // create the main layout frames.
394 mPanner = new QSplitter(QSplitter::Horizontal,this,"CalendarView::Panner"); 394 mPanner = new QSplitter(QSplitter::Horizontal,this,"CalendarView::Panner");
395 topLayout->addWidget(mPanner); 395 topLayout->addWidget(mPanner);
396 396
397 mLeftSplitter = new QSplitter(QSplitter::Vertical,mPanner, 397 mLeftSplitter = new QSplitter(QSplitter::Vertical,mPanner,
398 "CalendarView::LeftFrame"); 398 "CalendarView::LeftFrame");
399 mPanner->setResizeMode(mLeftSplitter,QSplitter::KeepSize); 399 mPanner->setResizeMode(mLeftSplitter,QSplitter::KeepSize);
400 400
401 mDateNavigator = new DateNavigatorContainer( mLeftSplitter, 401 mDateNavigator = new DateNavigatorContainer( mLeftSplitter,
402 "CalendarView::DateNavigator" ); 402 "CalendarView::DateNavigator" );
403 403
404 mLeftSplitter->setResizeMode(mDateNavigator,QSplitter::KeepSize); 404 mLeftSplitter->setResizeMode(mDateNavigator,QSplitter::KeepSize);
405 mTodoList = new KOTodoView(mCalendar, mLeftSplitter, "todolist_small2"); 405 mTodoList = new KOTodoView(mCalendar, mLeftSplitter, "todolist_small2");
406 mTodoList->setNavigator( mNavigator ); 406 mTodoList->setNavigator( mNavigator );
407 mFilterView = new KOFilterView(&mFilters,mLeftSplitter,"CalendarView::FilterView"); 407 mFilterView = new KOFilterView(&mFilters,mLeftSplitter,"CalendarView::FilterView");
408 408
409#ifdef KORG_NORESOURCEVIEW 409#ifdef KORG_NORESOURCEVIEW
410 mResourceView = 0; 410 mResourceView = 0;
411#else 411#else
412 if ( mResourceManager ) { 412 if ( mResourceManager ) {
413 mResourceView = new ResourceView( mResourceManager, mLeftSplitter ); 413 mResourceView = new ResourceView( mResourceManager, mLeftSplitter );
414 mResourceView->updateView(); 414 mResourceView->updateView();
415 connect( mResourceView, SIGNAL( resourcesChanged() ), 415 connect( mResourceView, SIGNAL( resourcesChanged() ),
416 SLOT( updateView() ) ); 416 SLOT( updateView() ) );
417 } else { 417 } else {
418 mResourceView = 0; 418 mResourceView = 0;
419 } 419 }
420#endif 420#endif
421 QWidget *rightBox = new QWidget( mPanner ); 421 QWidget *rightBox = new QWidget( mPanner );
422 QBoxLayout *rightLayout = new QVBoxLayout( rightBox ); 422 QBoxLayout *rightLayout = new QVBoxLayout( rightBox );
423 423
424 mRightFrame = new QWidgetStack( rightBox ); 424 mRightFrame = new QWidgetStack( rightBox );
425 rightLayout->addWidget( mRightFrame, 1 ); 425 rightLayout->addWidget( mRightFrame, 1 );
426 426
427 mLeftFrame = mLeftSplitter; 427 mLeftFrame = mLeftSplitter;
428#else 428#else
429 //QWidget *mainBox = new QWidget( this ); 429 //QWidget *mainBox = new QWidget( this );
430 //QWidget *leftFrame = new QWidget( mainBox ); 430 //QWidget *leftFrame = new QWidget( mainBox );
431 //QBoxLayout * mainBoxLayout; 431 //QBoxLayout * mainBoxLayout;
432 if ( KOPrefs::instance()->mVerticalScreen ) { 432 if ( KOPrefs::instance()->mVerticalScreen ) {
433 //mainBoxLayout = new QVBoxLayout(mainBox); 433 //mainBoxLayout = new QVBoxLayout(mainBox);
434 //leftFrameLayout = new QHBoxLayout(leftFrame ); 434 //leftFrameLayout = new QHBoxLayout(leftFrame );
435 mMainFrame = new KDGanttMinimizeSplitter( Qt::Vertical, this ); 435 mMainFrame = new KDGanttMinimizeSplitter( Qt::Vertical, this );
436 mMainFrame->setMinimizeDirection ( KDGanttMinimizeSplitter::Up ); 436 mMainFrame->setMinimizeDirection ( KDGanttMinimizeSplitter::Up );
437 mLeftFrame = new KDGanttMinimizeSplitter( Qt::Horizontal, mMainFrame);; 437 mLeftFrame = new KDGanttMinimizeSplitter( Qt::Horizontal, mMainFrame);;
438 mLeftFrame->setMinimizeDirection ( KDGanttMinimizeSplitter::Right ); 438 mLeftFrame->setMinimizeDirection ( KDGanttMinimizeSplitter::Right );
439 } else { 439 } else {
440 //mainBoxLayout = new QHBoxLayout(mainBox); 440 //mainBoxLayout = new QHBoxLayout(mainBox);
441 //leftFrameLayout = new QVBoxLayout(leftFrame ); 441 //leftFrameLayout = new QVBoxLayout(leftFrame );
442 mMainFrame = new KDGanttMinimizeSplitter( Qt::Horizontal, this); 442 mMainFrame = new KDGanttMinimizeSplitter( Qt::Horizontal, this);
443 mMainFrame->setMinimizeDirection ( KDGanttMinimizeSplitter::Left); 443 mMainFrame->setMinimizeDirection ( KDGanttMinimizeSplitter::Left);
444 mLeftFrame = new KDGanttMinimizeSplitter( Qt::Vertical, mMainFrame); 444 mLeftFrame = new KDGanttMinimizeSplitter( Qt::Vertical, mMainFrame);
445 mLeftFrame->setMinimizeDirection ( KDGanttMinimizeSplitter::Up ); 445 mLeftFrame->setMinimizeDirection ( KDGanttMinimizeSplitter::Up );
446 } 446 }
447 mMainFrame->setSizePolicy( QSizePolicy (QSizePolicy::Expanding,QSizePolicy::Expanding) ); 447 mMainFrame->setSizePolicy( QSizePolicy (QSizePolicy::Expanding,QSizePolicy::Expanding) );
448 //QBoxLayout * leftFrameLayout; 448 //QBoxLayout * leftFrameLayout;
449 topLayout->addWidget( mMainFrame ); 449 topLayout->addWidget( mMainFrame );
450#ifdef DESKTOP_VERSION 450#ifdef DESKTOP_VERSION
451 mDateScrollBar = new QScrollBar ( 1, 365, 1,30, 200,QScrollBar::Horizontal, this ); 451 mDateScrollBar = new QScrollBar ( 1, 365, 1,30, 200,QScrollBar::Horizontal, this );
452 topLayout->addWidget( mDateScrollBar ); 452 topLayout->addWidget( mDateScrollBar );
453 connect( mDateScrollBar, SIGNAL( valueChanged ( int ) ),this, SLOT( scrollBarValue( int )) ); 453 connect( mDateScrollBar, SIGNAL( valueChanged ( int ) ),this, SLOT( scrollBarValue( int )) );
454 if ( QApplication::desktop()->width() < 800 ) 454 if ( QApplication::desktop()->width() < 800 )
455 mDateScrollBar->hide(); 455 mDateScrollBar->hide();
456#endif 456#endif
457 //mainBoxLayout->addWidget (mLeftFrame); 457 //mainBoxLayout->addWidget (mLeftFrame);
458 mDateNavigator = new DateNavigatorContainer( mLeftFrame, 458 mDateNavigator = new DateNavigatorContainer( mLeftFrame,
459 "CalendarView::DateNavigator" ); 459 "CalendarView::DateNavigator" );
460#if 0 460#if 0
461 // FIXME 461 // FIXME
462 mDateNavigator = new KDateNavigator(mLeftFrame, mCalendar, TRUE, 462 mDateNavigator = new KDateNavigator(mLeftFrame, mCalendar, TRUE,
463 "CalendarView::DateNavigator", QDate::currentDate()); 463 "CalendarView::DateNavigator", QDate::currentDate());
464#endif 464#endif
465 // mDateNavigator->blockSignals( true ); 465 // mDateNavigator->blockSignals( true );
466 //leftFrameLayout->addWidget( mDateNavigator ); 466 //leftFrameLayout->addWidget( mDateNavigator );
@@ -4594,194 +4594,194 @@ void CalendarView::showIncidence(Incidence *incidence)
4594 if ( incidence ) { 4594 if ( incidence ) {
4595 ShowIncidenceVisitor v; 4595 ShowIncidenceVisitor v;
4596 v.act( incidence, this ); 4596 v.act( incidence, this );
4597 } 4597 }
4598} 4598}
4599 4599
4600void CalendarView::editIncidence(Incidence *incidence) 4600void CalendarView::editIncidence(Incidence *incidence)
4601{ 4601{
4602 if ( incidence ) { 4602 if ( incidence ) {
4603 4603
4604 EditIncidenceVisitor v; 4604 EditIncidenceVisitor v;
4605 v.act( incidence, this ); 4605 v.act( incidence, this );
4606 4606
4607 } 4607 }
4608} 4608}
4609 4609
4610void CalendarView::deleteIncidence(Incidence *incidence) 4610void CalendarView::deleteIncidence(Incidence *incidence)
4611{ 4611{
4612 //qDebug(" CalendarView::deleteIncidence "); 4612 //qDebug(" CalendarView::deleteIncidence ");
4613 if ( incidence == 0 ) { 4613 if ( incidence == 0 ) {
4614 updateView(); 4614 updateView();
4615 emit updateSearchDialog(); 4615 emit updateSearchDialog();
4616 return; 4616 return;
4617 } 4617 }
4618 if ( incidence ) { 4618 if ( incidence ) {
4619 DeleteIncidenceVisitor v; 4619 DeleteIncidenceVisitor v;
4620 v.act( incidence, this ); 4620 v.act( incidence, this );
4621 } 4621 }
4622} 4622}
4623 4623
4624 4624
4625void CalendarView::lookForOutgoingMessages() 4625void CalendarView::lookForOutgoingMessages()
4626{ 4626{
4627 OutgoingDialog *ogd = mDialogManager->outgoingDialog(); 4627 OutgoingDialog *ogd = mDialogManager->outgoingDialog();
4628 ogd->loadMessages(); 4628 ogd->loadMessages();
4629} 4629}
4630 4630
4631void CalendarView::lookForIncomingMessages() 4631void CalendarView::lookForIncomingMessages()
4632{ 4632{
4633 IncomingDialog *icd = mDialogManager->incomingDialog(); 4633 IncomingDialog *icd = mDialogManager->incomingDialog();
4634 icd->retrieve(); 4634 icd->retrieve();
4635} 4635}
4636 4636
4637bool CalendarView::removeCompletedSubTodos( Todo* t ) 4637bool CalendarView::removeCompletedSubTodos( Todo* t )
4638{ 4638{
4639 bool deleteTodo = true; 4639 bool deleteTodo = true;
4640 QPtrList<Incidence> subTodos; 4640 QPtrList<Incidence> subTodos;
4641 Incidence *aTodo; 4641 Incidence *aTodo;
4642 subTodos = t->relations(); 4642 subTodos = t->relations();
4643 for (aTodo = subTodos.first(); aTodo; aTodo = subTodos.next()) { 4643 for (aTodo = subTodos.first(); aTodo; aTodo = subTodos.next()) {
4644 if (! removeCompletedSubTodos( (Todo*) aTodo )) 4644 if (! removeCompletedSubTodos( (Todo*) aTodo ))
4645 deleteTodo = false; 4645 deleteTodo = false;
4646 } 4646 }
4647 if ( deleteTodo ) { 4647 if ( deleteTodo ) {
4648 if ( t->isCompleted() && !t->doesRecur()) { 4648 if ( t->isCompleted() && !t->doesRecur()) {
4649 checkExternalId( t ); 4649 checkExternalId( t );
4650 mCalendar->deleteTodo( t ); 4650 mCalendar->deleteTodo( t );
4651 changeTodoDisplay( t,KOGlobals::EVENTDELETED ); 4651 changeTodoDisplay( t,KOGlobals::EVENTDELETED );
4652 } 4652 }
4653 else 4653 else
4654 deleteTodo = false; 4654 deleteTodo = false;
4655 } 4655 }
4656 return deleteTodo; 4656 return deleteTodo;
4657 4657
4658} 4658}
4659void CalendarView::purgeCompleted() 4659void CalendarView::purgeCompleted()
4660{ 4660{
4661 int result = KMessageBox::warningContinueCancel(this, 4661 int result = KMessageBox::warningContinueCancel(this,
4662 i18n("Delete all completed todos?\n(Completed recurring todos\nwill not be deleted!)"),i18n("Purge Todos"),i18n("Purge")); 4662 i18n("Delete all completed todos?\n(Completed recurring todos\nwill not be deleted!)"),i18n("Purge Todos"),i18n("Purge"));
4663 4663
4664 if (result == KMessageBox::Continue) { 4664 if (result == KMessageBox::Continue) {
4665 4665
4666 QPtrList<Todo> todoCal; 4666 QPtrList<Todo> todoCal;
4667 QPtrList<Todo> rootTodos; 4667 QPtrList<Todo> rootTodos;
4668 //QPtrList<Incidence> rel; 4668 //QPtrList<Incidence> rel;
4669 Todo *aTodo; 4669 Todo *aTodo;
4670 todoCal = calendar()->todos(); 4670 todoCal = calendar()->todos();
4671 for (aTodo = todoCal.first(); aTodo; aTodo = todoCal.next()) { 4671 for (aTodo = todoCal.first(); aTodo; aTodo = todoCal.next()) {
4672 if ( !aTodo->relatedTo() ) 4672 if ( !aTodo->relatedTo() )
4673 rootTodos.append( aTodo ); 4673 rootTodos.append( aTodo );
4674 } 4674 }
4675 for (aTodo = rootTodos.first(); aTodo; aTodo = rootTodos.next()) { 4675 for (aTodo = rootTodos.first(); aTodo; aTodo = rootTodos.next()) {
4676 removeCompletedSubTodos( aTodo ); 4676 removeCompletedSubTodos( aTodo );
4677 } 4677 }
4678 4678
4679 updateView(); 4679 updateView();
4680 } 4680 }
4681} 4681}
4682 4682
4683void CalendarView::slotCalendarChanged() 4683void CalendarView::slotCalendarChanged()
4684{ 4684{
4685 ; 4685 ;
4686} 4686}
4687 4687
4688void CalendarView::keyPressEvent ( QKeyEvent *e) 4688void CalendarView::keyPressEvent ( QKeyEvent *e)
4689{ 4689{
4690 //qDebug(" alendarView::keyPressEvent "); 4690 //qDebug("CalendarView::keyPressEvent ");
4691 e->ignore(); 4691 e->ignore();
4692} 4692}
4693 4693
4694 4694
4695bool CalendarView::sync(KSyncManager* manager, QString filename, int mode) 4695bool CalendarView::sync(KSyncManager* manager, QString filename, int mode)
4696{ 4696{
4697 4697
4698 if ( manager != mSyncManager) 4698 if ( manager != mSyncManager)
4699 qDebug("KO: Internal error-1. SyncManager mismatch "); 4699 qDebug("KO: Internal error-1. SyncManager mismatch ");
4700 if ( filename == QDir::homeDirPath ()+"/.kdecalendardump.ics" ) { 4700 if ( filename == QDir::homeDirPath ()+"/.kdecalendardump.ics" ) {
4701 qDebug("KO: SyncKDE request detected!"); 4701 qDebug("KO: SyncKDE request detected!");
4702 } 4702 }
4703 mCurrentSyncDevice = mSyncManager->getCurrentSyncDevice(); 4703 mCurrentSyncDevice = mSyncManager->getCurrentSyncDevice();
4704 mCurrentSyncName = mSyncManager->getCurrentSyncName(); 4704 mCurrentSyncName = mSyncManager->getCurrentSyncName();
4705 return syncCalendar( filename, mode ); 4705 return syncCalendar( filename, mode );
4706} 4706}
4707bool CalendarView::syncExternal(KSyncManager* manager, QString resource) 4707bool CalendarView::syncExternal(KSyncManager* manager, QString resource)
4708{ 4708{
4709 //mSyncManager = manager; 4709 //mSyncManager = manager;
4710 if ( manager != mSyncManager) 4710 if ( manager != mSyncManager)
4711 qDebug("KO: Internal error-2. SyncManager mismatch "); 4711 qDebug("KO: Internal error-2. SyncManager mismatch ");
4712 mCurrentSyncDevice = mSyncManager->getCurrentSyncDevice(); 4712 mCurrentSyncDevice = mSyncManager->getCurrentSyncDevice();
4713 mCurrentSyncName = mSyncManager->getCurrentSyncName(); 4713 mCurrentSyncName = mSyncManager->getCurrentSyncName();
4714 if ( resource == "sharp" ) 4714 if ( resource == "sharp" )
4715 syncExternal( 0 ); 4715 syncExternal( 0 );
4716 if ( resource == "phone" ) 4716 if ( resource == "phone" )
4717 syncExternal( 1 ); 4717 syncExternal( 1 );
4718 // pending setmodified 4718 // pending setmodified
4719 return true; 4719 return true;
4720} 4720}
4721void CalendarView::setSyncManager(KSyncManager* manager) 4721void CalendarView::setSyncManager(KSyncManager* manager)
4722{ 4722{
4723 mSyncManager = manager; 4723 mSyncManager = manager;
4724} 4724}
4725 4725
4726void CalendarView::removeSyncInfo( QString syncProfile) 4726void CalendarView::removeSyncInfo( QString syncProfile)
4727{ 4727{
4728 qDebug("KO: removeSyncInfo for profile %s ", syncProfile.latin1()); 4728 qDebug("KO: removeSyncInfo for profile %s ", syncProfile.latin1());
4729 mCalendar->removeSyncInfo( syncProfile ); 4729 mCalendar->removeSyncInfo( syncProfile );
4730 4730
4731} 4731}
4732 4732
4733void CalendarView::undo_delete() 4733void CalendarView::undo_delete()
4734{ 4734{
4735 //qDebug("undo_delete() "); 4735 //qDebug("undo_delete() ");
4736 Incidence* undo = mCalendar->undoIncidence(); 4736 Incidence* undo = mCalendar->undoIncidence();
4737 if ( !undo ) { 4737 if ( !undo ) {
4738 KMessageBox::sorry(this,i18n("There is nothing to undo!"), 4738 KMessageBox::sorry(this,i18n("There is nothing to undo!"),
4739 i18n("KO/Pi")); 4739 i18n("KO/Pi"));
4740 return; 4740 return;
4741 } 4741 }
4742 if ( KMessageBox::Continue ==KMessageBox::warningContinueCancel(this,KGlobal::formatMessage ( undo->summary(),0 ) + 4742 if ( KMessageBox::Continue ==KMessageBox::warningContinueCancel(this,KGlobal::formatMessage ( undo->summary(),0 ) +
4743 i18n("\nAre you sure you want\nto restore this?"), 4743 i18n("\nAre you sure you want\nto restore this?"),
4744 i18n("KO/Pi Confirmation"),i18n("Restore"))) { 4744 i18n("KO/Pi Confirmation"),i18n("Restore"))) {
4745 mCalendar->undoDeleteIncidence(); 4745 mCalendar->undoDeleteIncidence();
4746 updateView(); 4746 updateView();
4747 } 4747 }
4748} 4748}
4749 4749
4750void CalendarView::slotViewerClosed() 4750void CalendarView::slotViewerClosed()
4751{ 4751{
4752 QTimer::singleShot( 50, this, SLOT ( resetFocus() ) ); 4752 QTimer::singleShot( 50, this, SLOT ( resetFocus() ) );
4753} 4753}
4754 4754
4755void CalendarView::resetFocus() 4755void CalendarView::resetFocus()
4756{ 4756{
4757 if ( mViewerCallerIsSearchDialog ) { 4757 if ( mViewerCallerIsSearchDialog ) {
4758 if ( mDialogManager->getSearchDialog()->isVisible() ){ 4758 if ( mDialogManager->getSearchDialog()->isVisible() ){
4759 mDialogManager->getSearchDialog()->raise(); 4759 mDialogManager->getSearchDialog()->raise();
4760 mDialogManager->getSearchDialog()->setActiveWindow(); 4760 mDialogManager->getSearchDialog()->setActiveWindow();
4761 mDialogManager->getSearchDialog()->listview()->resetFocus(); 4761 mDialogManager->getSearchDialog()->listview()->resetFocus();
4762 } else 4762 } else
4763 mViewerCallerIsSearchDialog = false; 4763 mViewerCallerIsSearchDialog = false;
4764 } 4764 }
4765 if ( !mViewerCallerIsSearchDialog ) { 4765 if ( !mViewerCallerIsSearchDialog ) {
4766 //mViewManager->currentView()->setFocus(); 4766 //mViewManager->currentView()->setFocus();
4767 //qDebug("sssssssssssssssset focus "); 4767 //qDebug("sssssssssssssssset focus ");
4768 topLevelWidget()->raise(); 4768 topLevelWidget()->raise();
4769 setActiveWindow(); 4769 setActiveWindow();
4770 //setFocus(); 4770 //setFocus();
4771 } 4771 }
4772 mViewerCallerIsSearchDialog = false; 4772 mViewerCallerIsSearchDialog = false;
4773} 4773}
4774 4774
4775void CalendarView::showNextAlarms() 4775void CalendarView::showNextAlarms()
4776{ 4776{
4777 QString message; 4777 QString message;
4778 QDateTime nextAl = mCalendar->nextAlarmEventDateTime(); 4778 QDateTime nextAl = mCalendar->nextAlarmEventDateTime();
4779 if ( nextAl.isValid() && mNextAlarmDateTime > QDateTime::currentDateTime() ) { 4779 if ( nextAl.isValid() && mNextAlarmDateTime > QDateTime::currentDateTime() ) {
4780 QString sum = mCalendar->nextSummary(); 4780 QString sum = mCalendar->nextSummary();
4781 QDateTime nextA = mNextAlarmDateTime; 4781 QDateTime nextA = mNextAlarmDateTime;
4782 QDateTime cur = QDateTime::currentDateTime(); 4782 QDateTime cur = QDateTime::currentDateTime();
4783 int secs = cur.secsTo( nextA ); 4783 int secs = cur.secsTo( nextA );
4784 int min = secs /60; 4784 int min = secs /60;
4785 int hours = min /60; 4785 int hours = min /60;
4786 min = min % 60; 4786 min = min % 60;
4787 int days = hours /24; 4787 int days = hours /24;