summaryrefslogtreecommitdiffabout
Unidiff
Diffstat (more/less context) (ignore whitespace changes)
-rw-r--r--korganizer/kotodoview.cpp2
1 files changed, 1 insertions, 1 deletions
diff --git a/korganizer/kotodoview.cpp b/korganizer/kotodoview.cpp
index 4f42c83..86e1bd9 100644
--- a/korganizer/kotodoview.cpp
+++ b/korganizer/kotodoview.cpp
@@ -332,513 +332,513 @@ void KOTodoListView::contentsMousePressEvent(QMouseEvent* e)
332 treeStepSize() * (i->depth() + (rootIsDecorated() ? 1 : 0)) + 332 treeStepSize() * (i->depth() + (rootIsDecorated() ? 1 : 0)) +
333 itemMargin() +i->height()|| 333 itemMargin() +i->height()||
334 X < header()->sectionPos(0)) { 334 X < header()->sectionPos(0)) {
335 rootClicked = false; 335 rootClicked = false;
336 } 336 }
337 } else { 337 } else {
338 rootClicked = false; 338 rootClicked = false;
339 } 339 }
340#ifndef KORG_NODND 340#ifndef KORG_NODND
341 mMousePressed = false; 341 mMousePressed = false;
342 if (! rootClicked && !( e->button() == RightButton) ) { 342 if (! rootClicked && !( e->button() == RightButton) ) {
343 mPressPos = e->pos(); 343 mPressPos = e->pos();
344 mMousePressed = true; 344 mMousePressed = true;
345 } else { 345 } else {
346 mMousePressed = false; 346 mMousePressed = false;
347 } 347 }
348#endif 348#endif
349 //qDebug("KOTodoListView::contentsMousePressEvent %d", rootClicked); 349 //qDebug("KOTodoListView::contentsMousePressEvent %d", rootClicked);
350#ifndef DESKTOP_VERSION 350#ifndef DESKTOP_VERSION
351 if (!( e->button() == RightButton && rootClicked) ) 351 if (!( e->button() == RightButton && rootClicked) )
352 QListView::contentsMousePressEvent(e); 352 QListView::contentsMousePressEvent(e);
353#else 353#else
354 QListView::contentsMousePressEvent(e); 354 QListView::contentsMousePressEvent(e);
355#endif 355#endif
356} 356}
357void KOTodoListView::paintEvent(QPaintEvent* e) 357void KOTodoListView::paintEvent(QPaintEvent* e)
358{ 358{
359 emit paintNeeded(); 359 emit paintNeeded();
360 QListView::paintEvent( e); 360 QListView::paintEvent( e);
361} 361}
362void KOTodoListView::contentsMouseMoveEvent(QMouseEvent* e) 362void KOTodoListView::contentsMouseMoveEvent(QMouseEvent* e)
363{ 363{
364 364
365#ifndef KORG_NODND 365#ifndef KORG_NODND
366 //QListView::contentsMouseMoveEvent(e); 366 //QListView::contentsMouseMoveEvent(e);
367 if (mMousePressed && (mPressPos - e->pos()).manhattanLength() > 367 if (mMousePressed && (mPressPos - e->pos()).manhattanLength() >
368 QApplication::startDragDistance()*3) { 368 QApplication::startDragDistance()*3) {
369 mMousePressed = false; 369 mMousePressed = false;
370 QListViewItem *item = itemAt(contentsToViewport(mPressPos)); 370 QListViewItem *item = itemAt(contentsToViewport(mPressPos));
371 if (item) { 371 if (item) {
372 DndFactory factory( mCalendar ); 372 DndFactory factory( mCalendar );
373 ICalDrag *vd = factory.createDrag( 373 ICalDrag *vd = factory.createDrag(
374 ((KOTodoViewItem *)item)->todo(),viewport()); 374 ((KOTodoViewItem *)item)->todo(),viewport());
375 internalDrop = false; 375 internalDrop = false;
376 // we cannot do any senseful here, because the DnD is still broken in Qt 376 // we cannot do any senseful here, because the DnD is still broken in Qt
377 if (vd->drag()) { 377 if (vd->drag()) {
378 if ( !internalDrop ) { 378 if ( !internalDrop ) {
379 //emit deleteTodo( ((KOTodoViewItem *)item)->todo() ); 379 //emit deleteTodo( ((KOTodoViewItem *)item)->todo() );
380 qDebug("Dnd: External move: Delete drag source "); 380 qDebug("Dnd: External move: Delete drag source ");
381 } else 381 } else
382 qDebug("Dnd: Internal move "); 382 qDebug("Dnd: Internal move ");
383 383
384 } else { 384 } else {
385 if ( !internalDrop ) { 385 if ( !internalDrop ) {
386 qDebug("Dnd: External Copy"); 386 qDebug("Dnd: External Copy");
387 } else 387 } else
388 qDebug("DnD: Internal copy: Copy pending"); 388 qDebug("DnD: Internal copy: Copy pending");
389 } 389 }
390 } 390 }
391 } 391 }
392#endif 392#endif
393} 393}
394void KOTodoListView::keyReleaseEvent ( QKeyEvent *e ) 394void KOTodoListView::keyReleaseEvent ( QKeyEvent *e )
395{ 395{
396 if ( !e->isAutoRepeat() ) { 396 if ( !e->isAutoRepeat() ) {
397 mFlagKeyPressed = false; 397 mFlagKeyPressed = false;
398 } 398 }
399} 399}
400 400
401 401
402void KOTodoListView::keyPressEvent ( QKeyEvent * e ) 402void KOTodoListView::keyPressEvent ( QKeyEvent * e )
403{ 403{
404 qApp->processEvents(); 404 qApp->processEvents();
405 if ( e->isAutoRepeat() && !mFlagKeyPressed ) { 405 if ( e->isAutoRepeat() && !mFlagKeyPressed ) {
406 e->ignore(); 406 e->ignore();
407 // qDebug(" ignore %d",e->isAutoRepeat() ); 407 // qDebug(" ignore %d",e->isAutoRepeat() );
408 return; 408 return;
409 } 409 }
410 if (! e->isAutoRepeat() ) 410 if (! e->isAutoRepeat() )
411 mFlagKeyPressed = true; 411 mFlagKeyPressed = true;
412 QListViewItem* cn; 412 QListViewItem* cn;
413 if ( e->key() == Qt::Key_Return || e->key() == Qt::Key_Enter ) { 413 if ( e->key() == Qt::Key_Return || e->key() == Qt::Key_Enter ) {
414 cn = currentItem(); 414 cn = currentItem();
415 if ( cn ) { 415 if ( cn ) {
416 KOTodoViewItem* ci = (KOTodoViewItem*)( cn ); 416 KOTodoViewItem* ci = (KOTodoViewItem*)( cn );
417 if ( ci ){ 417 if ( ci ){
418 if ( e->state() == ShiftButton ) 418 if ( e->state() == ShiftButton )
419 ci->setOn( false ); 419 ci->setOn( false );
420 else 420 else
421 ci->setOn( true ); 421 ci->setOn( true );
422 cn = cn->itemBelow(); 422 cn = cn->itemBelow();
423 if ( cn ) { 423 if ( cn ) {
424 setCurrentItem ( cn ); 424 setCurrentItem ( cn );
425 ensureItemVisible ( cn ); 425 ensureItemVisible ( cn );
426 } 426 }
427 427
428 } 428 }
429 } 429 }
430 430
431 return; 431 return;
432 } 432 }
433 433
434 if ( e->state() == Qt::ControlButton || e->state() == Qt::ShiftButton || mName != "todolistsmall" ) { 434 if ( e->state() == Qt::ControlButton || e->state() == Qt::ShiftButton || mName != "todolistsmall" ) {
435 switch ( e->key() ) { 435 switch ( e->key() ) {
436 case Qt::Key_Down: 436 case Qt::Key_Down:
437 case Qt::Key_Up: 437 case Qt::Key_Up:
438 QListView::keyPressEvent ( e ); 438 QListView::keyPressEvent ( e );
439 break; 439 break;
440 case Qt::Key_Left: 440 case Qt::Key_Left:
441 case Qt::Key_Right: 441 case Qt::Key_Right:
442 QListView::keyPressEvent ( e ); 442 QListView::keyPressEvent ( e );
443 e->accept(); 443 e->accept();
444 return; 444 return;
445 break; 445 break;
446 default: 446 default:
447 e->ignore(); 447 e->ignore();
448 break; 448 break;
449 } 449 }
450 return; 450 return;
451 } 451 }
452 e->ignore(); 452 e->ignore();
453} 453}
454void KOTodoListView::contentsMouseReleaseEvent(QMouseEvent *e) 454void KOTodoListView::contentsMouseReleaseEvent(QMouseEvent *e)
455{ 455{
456 QListView::contentsMouseReleaseEvent(e); 456 QListView::contentsMouseReleaseEvent(e);
457 mMousePressed = false; 457 mMousePressed = false;
458} 458}
459 459
460void KOTodoListView::contentsMouseDoubleClickEvent(QMouseEvent *e) 460void KOTodoListView::contentsMouseDoubleClickEvent(QMouseEvent *e)
461{ 461{
462 if (!e) return; 462 if (!e) return;
463 463
464 QPoint vp = contentsToViewport(e->pos()); 464 QPoint vp = contentsToViewport(e->pos());
465 465
466 QListViewItem *item = itemAt(vp); 466 QListViewItem *item = itemAt(vp);
467 467
468 emit double_Clicked(item); 468 emit double_Clicked(item);
469 if (!item) return; 469 if (!item) return;
470 470
471 emit doubleClicked(item,vp,0); 471 emit doubleClicked(item,vp,0);
472} 472}
473 473
474///////////////////////////////////////////////////////////////////////////// 474/////////////////////////////////////////////////////////////////////////////
475 475
476KOQuickTodo::KOQuickTodo(QWidget *parent) : 476KOQuickTodo::KOQuickTodo(QWidget *parent) :
477 QLineEdit(parent) 477 QLineEdit(parent)
478{ 478{
479 setText(i18n("Click to add a new Todo")); 479 setText(i18n("Click to add a new Todo"));
480} 480}
481 481
482void KOQuickTodo::focusInEvent(QFocusEvent *ev) 482void KOQuickTodo::focusInEvent(QFocusEvent *ev)
483{ 483{
484 if ( text()==i18n("Click to add a new Todo") ) 484 if ( text()==i18n("Click to add a new Todo") )
485 setText(""); 485 setText("");
486 QLineEdit::focusInEvent(ev); 486 QLineEdit::focusInEvent(ev);
487} 487}
488 488
489void KOQuickTodo::focusOutEvent(QFocusEvent *ev) 489void KOQuickTodo::focusOutEvent(QFocusEvent *ev)
490{ 490{
491 setText(i18n("Click to add a new Todo")); 491 setText(i18n("Click to add a new Todo"));
492 QLineEdit::focusOutEvent(ev); 492 QLineEdit::focusOutEvent(ev);
493} 493}
494 494
495///////////////////////////////////////////////////////////////////////////// 495/////////////////////////////////////////////////////////////////////////////
496 496
497KOTodoView::KOTodoView(Calendar *calendar,QWidget* parent,const char* name) : 497KOTodoView::KOTodoView(Calendar *calendar,QWidget* parent,const char* name) :
498 KOrg::BaseView(calendar,parent,name) 498 KOrg::BaseView(calendar,parent,name)
499{ 499{
500 mCategoryPopupMenu = 0; 500 mCategoryPopupMenu = 0;
501 mPendingUpdateBeforeRepaint = false; 501 mPendingUpdateBeforeRepaint = false;
502 isFlatDisplay = false; 502 isFlatDisplay = false;
503 mNavigator = 0; 503 mNavigator = 0;
504 QBoxLayout *topLayout = new QVBoxLayout(this); 504 QBoxLayout *topLayout = new QVBoxLayout(this);
505 mName = QString ( name ); 505 mName = QString ( name );
506 mBlockUpdate = false; 506 mBlockUpdate = false;
507 mQuickAdd = new KOQuickTodo(this); 507 mQuickAdd = new KOQuickTodo(this);
508 topLayout->addWidget(mQuickAdd); 508 topLayout->addWidget(mQuickAdd);
509 509
510 if ( !KOPrefs::instance()->mEnableQuickTodo ) mQuickAdd->hide(); 510 if ( !KOPrefs::instance()->mEnableQuickTodo ) mQuickAdd->hide();
511 511
512 mTodoListView = new KOTodoListView(calendar,this, name ); 512 mTodoListView = new KOTodoListView(calendar,this, name );
513 topLayout->addWidget(mTodoListView); 513 topLayout->addWidget(mTodoListView);
514 //mTodoListView->header()->setMaximumHeight(30); 514 //mTodoListView->header()->setMaximumHeight(30);
515 mTodoListView->setRootIsDecorated(true); 515 mTodoListView->setRootIsDecorated(true);
516 mTodoListView->setAllColumnsShowFocus(true); 516 mTodoListView->setAllColumnsShowFocus(true);
517 517
518 mTodoListView->setShowSortIndicator(true); 518 mTodoListView->setShowSortIndicator(true);
519 519
520 mTodoListView->addColumn(i18n("Todo")); 520 mTodoListView->addColumn(i18n("Todo"));
521 mTodoListView->addColumn(i18n("Prio")); 521 mTodoListView->addColumn(i18n("Prio"));
522 mTodoListView->setColumnAlignment(1,AlignHCenter); 522 mTodoListView->setColumnAlignment(1,AlignHCenter);
523 mTodoListView->addColumn(i18n("Complete")); 523 mTodoListView->addColumn(i18n("Complete"));
524 mTodoListView->setColumnAlignment(2,AlignCenter); 524 mTodoListView->setColumnAlignment(2,AlignCenter);
525 525
526 mTodoListView->addColumn(i18n("Due Date")); 526 mTodoListView->addColumn(i18n("Due Date"));
527 mTodoListView->setColumnAlignment(3,AlignLeft); 527 mTodoListView->setColumnAlignment(3,AlignLeft);
528 mTodoListView->addColumn(i18n("Due Time")); 528 mTodoListView->addColumn(i18n("Due Time"));
529 mTodoListView->setColumnAlignment(4,AlignHCenter); 529 mTodoListView->setColumnAlignment(4,AlignHCenter);
530 530
531 mTodoListView->addColumn(i18n("Start Date")); 531 mTodoListView->addColumn(i18n("Start Date"));
532 mTodoListView->setColumnAlignment(5,AlignLeft); 532 mTodoListView->setColumnAlignment(5,AlignLeft);
533 mTodoListView->addColumn(i18n("Start Time")); 533 mTodoListView->addColumn(i18n("Start Time"));
534 mTodoListView->setColumnAlignment(6,AlignHCenter); 534 mTodoListView->setColumnAlignment(6,AlignHCenter);
535 535
536 mTodoListView->addColumn(i18n("Cancelled")); 536 mTodoListView->addColumn(i18n("Cancelled"));
537 mTodoListView->addColumn(i18n("Categories")); 537 mTodoListView->addColumn(i18n("Categories"));
538 mTodoListView->addColumn(i18n("Calendar")); 538 mTodoListView->addColumn(i18n("Calendar"));
539#if 0 539#if 0
540 mTodoListView->addColumn(i18n("Sort Id")); 540 mTodoListView->addColumn(i18n("Sort Id"));
541 mTodoListView->setColumnAlignment(4,AlignHCenter); 541 mTodoListView->setColumnAlignment(4,AlignHCenter);
542#endif 542#endif
543 543
544 mTodoListView->setMinimumHeight( 60 ); 544 mTodoListView->setMinimumHeight( 60 );
545 mTodoListView->setItemsRenameable( true ); 545 mTodoListView->setItemsRenameable( true );
546 mTodoListView->setRenameable( 0 ); 546 mTodoListView->setRenameable( 0 );
547 mTodoListView->setColumnWidth( 0, 120 ); 547 mTodoListView->setColumnWidth( 0, 120 );
548 int iii = 0; 548 int iii = 0;
549 for ( iii = 0; iii< 10 ; ++iii ) 549 for ( iii = 0; iii< 10 ; ++iii )
550 mTodoListView->setColumnWidthMode( iii, QListView::Manual ); 550 mTodoListView->setColumnWidthMode( iii, QListView::Manual );
551 551
552 552
553 mKOTodoViewWhatsThis = new KOTodoViewWhatsThis(mTodoListView->viewport(),this); 553 mKOTodoViewWhatsThis = new KOTodoViewWhatsThis(mTodoListView->viewport(),this);
554 554
555 mPriorityPopupMenu = new QPopupMenu(this); 555 mPriorityPopupMenu = new QPopupMenu(this);
556 for (int i = 1; i <= 5; i++) { 556 for (int i = 1; i <= 5; i++) {
557 QString label = QString ("%1").arg (i); 557 QString label = QString ("%1").arg (i);
558 mPriority[mPriorityPopupMenu->insertItem (label)] = i; 558 mPriority[mPriorityPopupMenu->insertItem (label)] = i;
559 } 559 }
560 connect (mPriorityPopupMenu, SIGNAL(activated (int)), SLOT (setNewPriority(int))); 560 connect (mPriorityPopupMenu, SIGNAL(activated (int)), SLOT (setNewPriority(int)));
561 561
562 mPercentageCompletedPopupMenu = new QPopupMenu(this); 562 mPercentageCompletedPopupMenu = new QPopupMenu(this);
563 for (int i = 0; i <= 100; i+=20) { 563 for (int i = 0; i <= 100; i+=20) {
564 QString label = QString ("%1 %").arg (i); 564 QString label = QString ("%1 %").arg (i);
565 mPercentage[mPercentageCompletedPopupMenu->insertItem (label)] = i; 565 mPercentage[mPercentageCompletedPopupMenu->insertItem (label)] = i;
566 } 566 }
567 connect (mPercentageCompletedPopupMenu, SIGNAL (activated (int)), SLOT (setNewPercentage (int))); 567 connect (mPercentageCompletedPopupMenu, SIGNAL (activated (int)), SLOT (setNewPercentage (int)));
568 568
569 569
570 mCategoryPopupMenu = new QPopupMenu (this); 570 mCategoryPopupMenu = new QPopupMenu (this);
571 mCategoryPopupMenu->setCheckable (true); 571 mCategoryPopupMenu->setCheckable (true);
572 connect (mCategoryPopupMenu, SIGNAL (activated (int)), SLOT (changedCategories (int))); 572 connect (mCategoryPopupMenu, SIGNAL (activated (int)), SLOT (changedCategories (int)));
573 connect (mCategoryPopupMenu, SIGNAL (aboutToShow ()), SLOT (fillCategories ())); 573 connect (mCategoryPopupMenu, SIGNAL (aboutToShow ()), SLOT (fillCategories ()));
574 574
575 mCalPopupMenu = new QPopupMenu (this); 575 mCalPopupMenu = new QPopupMenu (this);
576 mCalPopupMenu->setCheckable (true); 576 mCalPopupMenu->setCheckable (true);
577 connect (mCalPopupMenu, SIGNAL (activated (int)), SLOT (changedCal (int))); 577 connect (mCalPopupMenu, SIGNAL (activated (int)), SLOT (changedCal (int)));
578 connect (mCalPopupMenu, SIGNAL (aboutToShow ()), SLOT (fillCal ())); 578 connect (mCalPopupMenu, SIGNAL (aboutToShow ()), SLOT (fillCal ()));
579 579
580 580
581 581
582 582
583 mItemPopupMenu = new QPopupMenu(this); 583 mItemPopupMenu = new QPopupMenu(this);
584 mItemPopupMenu->insertItem(i18n("Show"), this, 584 mItemPopupMenu->insertItem(i18n("Show"), this,
585 SLOT (showTodo())); 585 SLOT (showTodo()));
586 mItemPopupMenu->insertItem(i18n("Edit..."), this, 586 mItemPopupMenu->insertItem(i18n("Edit..."), this,
587 SLOT (editTodo())); 587 SLOT (editTodo()));
588 mItemPopupMenu->insertItem( i18n("Delete"), this, 588 mItemPopupMenu->insertItem( i18n("Delete..."), this,
589 SLOT (deleteTodo())); 589 SLOT (deleteTodo()));
590 mItemPopupMenu->insertItem( i18n("Clone..."), this, 590 mItemPopupMenu->insertItem( i18n("Clone..."), this,
591 SLOT (cloneTodo())); 591 SLOT (cloneTodo()));
592 mItemPopupMenu->insertItem( i18n("Move..."), this, 592 mItemPopupMenu->insertItem( i18n("Move..."), this,
593 SLOT (moveTodo())); 593 SLOT (moveTodo()));
594#ifndef DESKTOP_VERSION 594#ifndef DESKTOP_VERSION
595 mItemPopupMenu->insertItem( i18n("Beam..."), this, 595 mItemPopupMenu->insertItem( i18n("Beam..."), this,
596 SLOT (beamTodo())); 596 SLOT (beamTodo()));
597#endif 597#endif
598 mItemPopupMenu->insertItem( i18n("Toggle Cancel"), this, 598 mItemPopupMenu->insertItem( i18n("Toggle Cancel"), this,
599 SLOT (cancelTodo())); 599 SLOT (cancelTodo()));
600 mItemPopupMenu->insertItem( i18n("Categories"), mCategoryPopupMenu); 600 mItemPopupMenu->insertItem( i18n("Categories"), mCategoryPopupMenu);
601 mItemPopupMenu->insertItem( i18n("Calendar"), mCalPopupMenu); 601 mItemPopupMenu->insertItem( i18n("Calendar"), mCalPopupMenu);
602 mItemPopupMenu->insertSeparator(); 602 mItemPopupMenu->insertSeparator();
603 mItemPopupMenu->insertItem( i18n("Start/Stop todo..."), this, 603 mItemPopupMenu->insertItem( i18n("Start/Stop todo..."), this,
604 SLOT (toggleRunningItem())); 604 SLOT (toggleRunningItem()));
605 mItemPopupMenu->insertSeparator(); 605 mItemPopupMenu->insertSeparator();
606 /* 606 /*
607 mItemPopupMenu->insertItem( i18n("New Todo..."), this, 607 mItemPopupMenu->insertItem( i18n("New Todo..."), this,
608 SLOT (newTodo())); 608 SLOT (newTodo()));
609 */ 609 */
610 mItemPopupMenu->insertItem(i18n("New Sub-Todo..."), this, 610 mItemPopupMenu->insertItem(i18n("New Sub-Todo..."), this,
611 SLOT (newSubTodo())); 611 SLOT (newSubTodo()));
612 mItemPopupMenu->insertItem(i18n("Unparent Todo"), this, 612 mItemPopupMenu->insertItem(i18n("Unparent Todo"), this,
613 SLOT (unparentTodo()),0,21); 613 SLOT (unparentTodo()),0,21);
614 mItemPopupMenu->insertItem(i18n("Reparent Todo"), this, 614 mItemPopupMenu->insertItem(i18n("Reparent Todo"), this,
615 SLOT (reparentTodo()),0,22); 615 SLOT (reparentTodo()),0,22);
616 mItemPopupMenu->insertSeparator(); 616 mItemPopupMenu->insertSeparator();
617#if 0 617#if 0
618 mItemPopupMenu->insertItem(i18n("Delete completed To-Dos","Purge Completed..."), 618 mItemPopupMenu->insertItem(i18n("Delete completed To-Dos","Purge Completed..."),
619 this, SLOT( purgeCompleted() ) ); 619 this, SLOT( purgeCompleted() ) );
620 mItemPopupMenu->insertItem(i18n("toggle completed To-Dos","Show Completed"), 620 mItemPopupMenu->insertItem(i18n("toggle completed To-Dos","Show Completed"),
621 this, SLOT( toggleCompleted() ),0, 33 ); 621 this, SLOT( toggleCompleted() ),0, 33 );
622 mItemPopupMenu->insertItem(i18n("toggle quick todo","Show Quick Todo"), 622 mItemPopupMenu->insertItem(i18n("toggle quick todo","Show Quick Todo"),
623 this, SLOT( toggleQuickTodo() ),0, 34 ); 623 this, SLOT( toggleQuickTodo() ),0, 34 );
624 mItemPopupMenu->insertItem(i18n("toggle running todo","Hide not Running"), 624 mItemPopupMenu->insertItem(i18n("toggle running todo","Hide not Running"),
625 this, SLOT( toggleRunning() ),0, 35 ); 625 this, SLOT( toggleRunning() ),0, 35 );
626 626
627#endif 627#endif
628 mPopupMenu = new QPopupMenu(this); 628 mPopupMenu = new QPopupMenu(this);
629 mPopupMenu->insertItem(SmallIconSet("todo"), i18n("New Todo..."), this, 629 mPopupMenu->insertItem(SmallIconSet("todo"), i18n("New Todo..."), this,
630 SLOT (newTodo()),0,1); 630 SLOT (newTodo()),0,1);
631 mPopupMenu->insertItem(i18n("delete completed To-Dos","Purge Completed..."), 631 mPopupMenu->insertItem(i18n("delete completed To-Dos","Purge Completed..."),
632 this, SLOT(purgeCompleted()),0,2); 632 this, SLOT(purgeCompleted()),0,2);
633 mPopupMenu->insertItem(i18n("Show Completed"), 633 mPopupMenu->insertItem(i18n("Show Completed"),
634 this, SLOT( toggleCompleted() ),0,3 ); 634 this, SLOT( toggleCompleted() ),0,3 );
635 mPopupMenu->insertItem(i18n("toggle running todo","Hide not Running"), 635 mPopupMenu->insertItem(i18n("toggle running todo","Hide not Running"),
636 this, SLOT( toggleRunning() ),0,5 ); 636 this, SLOT( toggleRunning() ),0,5 );
637 mPopupMenu->insertItem(i18n(" set all open","Display all opened"), 637 mPopupMenu->insertItem(i18n(" set all open","Display all opened"),
638 this, SLOT( setAllOpen() ),0,6 ); 638 this, SLOT( setAllOpen() ),0,6 );
639 mPopupMenu->insertItem(i18n(" set all close","Display all closed"), 639 mPopupMenu->insertItem(i18n(" set all close","Display all closed"),
640 this, SLOT( setAllClose() ),0,7 ); 640 this, SLOT( setAllClose() ),0,7 );
641 mPopupMenu->insertItem(i18n(" set all flat","Display all flat"), 641 mPopupMenu->insertItem(i18n(" set all flat","Display all flat"),
642 this, SLOT( setAllFlat() ),0,8 ); 642 this, SLOT( setAllFlat() ),0,8 );
643 mPopupMenu->insertSeparator(); 643 mPopupMenu->insertSeparator();
644 mPopupMenu->insertItem(i18n("toggle quick todo","Show Quick Todo"), 644 mPopupMenu->insertItem(i18n("toggle quick todo","Show Quick Todo"),
645 this, SLOT( toggleQuickTodo() ),0,4 ); 645 this, SLOT( toggleQuickTodo() ),0,4 );
646 mDocPrefs = new DocPrefs( name ); 646 mDocPrefs = new DocPrefs( name );
647 647
648 mItemPopupMenu->insertItem(i18n("Todo View"),mPopupMenu ); 648 mItemPopupMenu->insertItem(i18n("Todo View"),mPopupMenu );
649 mPopupMenu->setCheckable( true ); 649 mPopupMenu->setCheckable( true );
650 mItemPopupMenu->setCheckable( true ); 650 mItemPopupMenu->setCheckable( true );
651 651
652 652
653 mPopupMenu->setItemChecked( 3,KOPrefs::instance()->mShowCompletedTodo ); 653 mPopupMenu->setItemChecked( 3,KOPrefs::instance()->mShowCompletedTodo );
654 mItemPopupMenu->setItemChecked( 33 , KOPrefs::instance()->mShowCompletedTodo ); 654 mItemPopupMenu->setItemChecked( 33 , KOPrefs::instance()->mShowCompletedTodo );
655 655
656 mPopupMenu->setItemChecked(4,KOPrefs::instance()->mEnableQuickTodo); 656 mPopupMenu->setItemChecked(4,KOPrefs::instance()->mEnableQuickTodo);
657 mItemPopupMenu->setItemChecked( 34 , KOPrefs::instance()->mEnableQuickTodo ); 657 mItemPopupMenu->setItemChecked( 34 , KOPrefs::instance()->mEnableQuickTodo );
658 658
659 mPopupMenu->setItemChecked(5,KOPrefs::instance()->mHideNonStartedTodos); 659 mPopupMenu->setItemChecked(5,KOPrefs::instance()->mHideNonStartedTodos);
660 mItemPopupMenu->setItemChecked( 35 , KOPrefs::instance()->mHideNonStartedTodos ); 660 mItemPopupMenu->setItemChecked( 35 , KOPrefs::instance()->mHideNonStartedTodos );
661 661
662 662
663 // Double clicking conflicts with opening/closing the subtree 663 // Double clicking conflicts with opening/closing the subtree
664 connect( mTodoListView, SIGNAL( doubleClicked( QListViewItem *) ), 664 connect( mTodoListView, SIGNAL( doubleClicked( QListViewItem *) ),
665 SLOT( editItem( QListViewItem *) ) ); 665 SLOT( editItem( QListViewItem *) ) );
666 /* 666 /*
667 connect( mTodoListView, SIGNAL( rightButtonClicked ( QListViewItem *, 667 connect( mTodoListView, SIGNAL( rightButtonClicked ( QListViewItem *,
668 const QPoint &,int ) ), 668 const QPoint &,int ) ),
669 SLOT( popupMenu( QListViewItem *, const QPoint & ,int) ) ); 669 SLOT( popupMenu( QListViewItem *, const QPoint & ,int) ) );
670 */ 670 */
671 connect( mTodoListView, SIGNAL( contextRequest ( QListViewItem *, 671 connect( mTodoListView, SIGNAL( contextRequest ( QListViewItem *,
672 const QPoint &,int ) ), 672 const QPoint &,int ) ),
673 SLOT( popupMenu( QListViewItem *, const QPoint & ,int) ) ); 673 SLOT( popupMenu( QListViewItem *, const QPoint & ,int) ) );
674 connect( mTodoListView, SIGNAL( clicked( QListViewItem * ) ), 674 connect( mTodoListView, SIGNAL( clicked( QListViewItem * ) ),
675 SLOT( itemClicked( QListViewItem * ) ) ); 675 SLOT( itemClicked( QListViewItem * ) ) );
676 connect( mTodoListView, SIGNAL( double_Clicked( QListViewItem * ) ), 676 connect( mTodoListView, SIGNAL( double_Clicked( QListViewItem * ) ),
677 SLOT( itemDoubleClicked( QListViewItem * ) ) ); 677 SLOT( itemDoubleClicked( QListViewItem * ) ) );
678 connect( mTodoListView, SIGNAL( todoDropped( Todo *, int ) ), 678 connect( mTodoListView, SIGNAL( todoDropped( Todo *, int ) ),
679 SLOT( updateView() ) ); 679 SLOT( updateView() ) );
680 connect( mTodoListView, SIGNAL( todoDropped( Todo *, int ) ), 680 connect( mTodoListView, SIGNAL( todoDropped( Todo *, int ) ),
681 SLOT( todoModified(Todo *, int) ) ); 681 SLOT( todoModified(Todo *, int) ) );
682 connect( mTodoListView, SIGNAL( expanded( QListViewItem * ) ), 682 connect( mTodoListView, SIGNAL( expanded( QListViewItem * ) ),
683 SLOT( itemStateChanged( QListViewItem * ) ) ); 683 SLOT( itemStateChanged( QListViewItem * ) ) );
684 connect( mTodoListView, SIGNAL( collapsed( QListViewItem * ) ), 684 connect( mTodoListView, SIGNAL( collapsed( QListViewItem * ) ),
685 SLOT( itemStateChanged( QListViewItem * ) ) ); 685 SLOT( itemStateChanged( QListViewItem * ) ) );
686 connect( mTodoListView, SIGNAL( paintNeeded() ), 686 connect( mTodoListView, SIGNAL( paintNeeded() ),
687 SLOT( paintNeeded()) ); 687 SLOT( paintNeeded()) );
688 688
689#if 0 689#if 0
690 connect(mTodoListView,SIGNAL(selectionChanged(QListViewItem *)), 690 connect(mTodoListView,SIGNAL(selectionChanged(QListViewItem *)),
691 SLOT(selectionChanged(QListViewItem *))); 691 SLOT(selectionChanged(QListViewItem *)));
692 connect(mTodoListView,SIGNAL(clicked(QListViewItem *)), 692 connect(mTodoListView,SIGNAL(clicked(QListViewItem *)),
693 SLOT(selectionChanged(QListViewItem *))); 693 SLOT(selectionChanged(QListViewItem *)));
694 connect(mTodoListView,SIGNAL(pressed(QListViewItem *)), 694 connect(mTodoListView,SIGNAL(pressed(QListViewItem *)),
695 SLOT(selectionChanged(QListViewItem *))); 695 SLOT(selectionChanged(QListViewItem *)));
696#endif 696#endif
697 697
698 connect( mTodoListView, SIGNAL(reparentTodoSignal( Todo *,Todo * ) ), SIGNAL(reparentTodoSignal( Todo *,Todo * ) )); 698 connect( mTodoListView, SIGNAL(reparentTodoSignal( Todo *,Todo * ) ), SIGNAL(reparentTodoSignal( Todo *,Todo * ) ));
699 connect( mTodoListView, SIGNAL(unparentTodoSignal(Todo *) ), SIGNAL(unparentTodoSignal(Todo *) )); 699 connect( mTodoListView, SIGNAL(unparentTodoSignal(Todo *) ), SIGNAL(unparentTodoSignal(Todo *) ));
700 connect( mTodoListView, SIGNAL( deleteTodo(Todo *) ), SIGNAL(deleteTodoSignal(Todo *) )); 700 connect( mTodoListView, SIGNAL( deleteTodo(Todo *) ), SIGNAL(deleteTodoSignal(Todo *) ));
701 701
702 connect( mTodoListView, SIGNAL(selectionChanged() ), 702 connect( mTodoListView, SIGNAL(selectionChanged() ),
703 SLOT( processSelectionChange() ) ); 703 SLOT( processSelectionChange() ) );
704 connect( mQuickAdd, SIGNAL( returnPressed () ), 704 connect( mQuickAdd, SIGNAL( returnPressed () ),
705 SLOT( addQuickTodo() ) ); 705 SLOT( addQuickTodo() ) );
706 706
707} 707}
708 708
709KOTodoView::~KOTodoView() 709KOTodoView::~KOTodoView()
710{ 710{
711 711
712#if QT_VERSION >= 0x030000 712#if QT_VERSION >= 0x030000
713 713
714#else 714#else
715 delete mKOTodoViewWhatsThis; 715 delete mKOTodoViewWhatsThis;
716#endif 716#endif
717 717
718 delete mDocPrefs; 718 delete mDocPrefs;
719} 719}
720QString KOTodoView::getWhatsThisText(QPoint p) 720QString KOTodoView::getWhatsThisText(QPoint p)
721{ 721{
722 KOTodoViewItem* item = ( KOTodoViewItem* ) mTodoListView->itemAt( p ); 722 KOTodoViewItem* item = ( KOTodoViewItem* ) mTodoListView->itemAt( p );
723 if ( item ) 723 if ( item )
724 return KIncidenceFormatter::instance()->getFormattedText( item->todo(), 724 return KIncidenceFormatter::instance()->getFormattedText( item->todo(),
725 KOPrefs::instance()->mWTshowDetails, 725 KOPrefs::instance()->mWTshowDetails,
726 KOPrefs::instance()->mWTshowCreated, 726 KOPrefs::instance()->mWTshowCreated,
727 KOPrefs::instance()->mWTshowChanged); 727 KOPrefs::instance()->mWTshowChanged);
728 return i18n("That is the todo view" ); 728 return i18n("That is the todo view" );
729 729
730} 730}
731 731
732void KOTodoView::jumpToDate () 732void KOTodoView::jumpToDate ()
733{ 733{
734 // if (mActiveItem) { 734 // if (mActiveItem) {
735// mActiveItem->todo()); 735// mActiveItem->todo());
736// if ( mActiveItem->todo()->hasDueDate() ) 736// if ( mActiveItem->todo()->hasDueDate() )
737// emit mActiveItem->todo()jumpToTime( mTodo->dtDue().date() ); 737// emit mActiveItem->todo()jumpToTime( mTodo->dtDue().date() );
738} 738}
739void KOTodoView::paintNeeded() 739void KOTodoView::paintNeeded()
740{ 740{
741 if ( mPendingUpdateBeforeRepaint ) { 741 if ( mPendingUpdateBeforeRepaint ) {
742 updateView(); 742 updateView();
743 mPendingUpdateBeforeRepaint = false; 743 mPendingUpdateBeforeRepaint = false;
744 } 744 }
745} 745}
746void KOTodoView::paintEvent(QPaintEvent * pevent) 746void KOTodoView::paintEvent(QPaintEvent * pevent)
747{ 747{
748 if ( mPendingUpdateBeforeRepaint ) { 748 if ( mPendingUpdateBeforeRepaint ) {
749 updateView(); 749 updateView();
750 mPendingUpdateBeforeRepaint = false; 750 mPendingUpdateBeforeRepaint = false;
751 } 751 }
752 KOrg::BaseView::paintEvent( pevent); 752 KOrg::BaseView::paintEvent( pevent);
753} 753}
754 754
755void KOTodoView::updateView() 755void KOTodoView::updateView()
756{ 756{
757 pendingSubtodo = 0; 757 pendingSubtodo = 0;
758 if ( mBlockUpdate ) { 758 if ( mBlockUpdate ) {
759 return; 759 return;
760 } 760 }
761 if ( !isVisible() ) { 761 if ( !isVisible() ) {
762 mPendingUpdateBeforeRepaint = true; 762 mPendingUpdateBeforeRepaint = true;
763 return; 763 return;
764 } 764 }
765 //qDebug("KOTodoView::updateView() %x", this); 765 //qDebug("KOTodoView::updateView() %x", this);
766 if ( isFlatDisplay ) { 766 if ( isFlatDisplay ) {
767 displayAllFlat(); 767 displayAllFlat();
768 return; 768 return;
769 } 769 }
770 storeCurrentItem(); 770 storeCurrentItem();
771 //qDebug("update "); 771 //qDebug("update ");
772// kdDebug() << "KOTodoView::updateView()" << endl; 772// kdDebug() << "KOTodoView::updateView()" << endl;
773 QFont fo = KOPrefs::instance()->mTodoViewFont; 773 QFont fo = KOPrefs::instance()->mTodoViewFont;
774 774
775 775
776 mTodoListView->clear(); 776 mTodoListView->clear();
777 if ( mName == "todolistsmall" ) { 777 if ( mName == "todolistsmall" ) {
778 if ( KOPrefs::instance()->mTodoViewUsesSmallFont ) { 778 if ( KOPrefs::instance()->mTodoViewUsesSmallFont ) {
779 int ps = fo.pointSize() -2; 779 int ps = fo.pointSize() -2;
780 if ( ps > 12 ) 780 if ( ps > 12 )
781 ps -= 2; 781 ps -= 2;
782 fo.setPointSize( ps ); 782 fo.setPointSize( ps );
783 } 783 }
784 } 784 }
785 785
786 mTodoListView->setFont( fo ); 786 mTodoListView->setFont( fo );
787 // QFontMetrics fm ( KOPrefs::instance()->mTodoViewFont ); 787 // QFontMetrics fm ( KOPrefs::instance()->mTodoViewFont );
788 //mTodoListView->header()->setMaximumHeight(fm.height()); 788 //mTodoListView->header()->setMaximumHeight(fm.height());
789 QPtrList<Todo> todoList = calendar()->todos(); 789 QPtrList<Todo> todoList = calendar()->todos();
790 790
791/* 791/*
792 kdDebug() << "KOTodoView::updateView(): Todo List:" << endl; 792 kdDebug() << "KOTodoView::updateView(): Todo List:" << endl;
793 Event *t; 793 Event *t;
794 for(t = todoList.first(); t; t = todoList.next()) { 794 for(t = todoList.first(); t; t = todoList.next()) {
795 kdDebug() << " " << t->getSummary() << endl; 795 kdDebug() << " " << t->getSummary() << endl;
796 796
797 if (t->getRelatedTo()) { 797 if (t->getRelatedTo()) {
798 kdDebug() << " (related to " << t->getRelatedTo()->getSummary() << ")" << endl; 798 kdDebug() << " (related to " << t->getRelatedTo()->getSummary() << ")" << endl;
799 } 799 }
800 800
801 QPtrList<Event> l = t->getRelations(); 801 QPtrList<Event> l = t->getRelations();
802 Event *c; 802 Event *c;
803 for(c=l.first();c;c=l.next()) { 803 for(c=l.first();c;c=l.next()) {
804 kdDebug() << " - relation: " << c->getSummary() << endl; 804 kdDebug() << " - relation: " << c->getSummary() << endl;
805 } 805 }
806 } 806 }
807*/ 807*/
808 808
809 // Put for each Event a KOTodoViewItem in the list view. Don't rely on a 809 // Put for each Event a KOTodoViewItem in the list view. Don't rely on a
810 // specific order of events. That means that we have to generate parent items 810 // specific order of events. That means that we have to generate parent items
811 // recursively for proper hierarchical display of Todos. 811 // recursively for proper hierarchical display of Todos.
812 mTodoMap.clear(); 812 mTodoMap.clear();
813 Todo *todo; 813 Todo *todo;
814 todo = todoList.first();// todo; todo = todoList.next()) { 814 todo = todoList.first();// todo; todo = todoList.next()) {
815 while ( todo ) { 815 while ( todo ) {
816 bool next = true; 816 bool next = true;
817 // qDebug("todo %s ", todo->summary().latin1()); 817 // qDebug("todo %s ", todo->summary().latin1());
818 Incidence *incidence = todo->relatedTo(); 818 Incidence *incidence = todo->relatedTo();
819 while ( incidence ) { 819 while ( incidence ) {
820 if ( incidence->typeID() == todoID ) { 820 if ( incidence->typeID() == todoID ) {
821 //qDebug("related %s ",incidence->summary().latin1() ); 821 //qDebug("related %s ",incidence->summary().latin1() );
822 if ( !(todoList.contains ( ((Todo* )incidence ) ) ) && incidence->calEnabled() ) { 822 if ( !(todoList.contains ( ((Todo* )incidence ) ) ) && incidence->calEnabled() ) {
823 //qDebug("related not found "); 823 //qDebug("related not found ");
824 todoList.remove( ); 824 todoList.remove( );
825 todo = todoList.current(); 825 todo = todoList.current();
826 next = false; 826 next = false;
827 incidence = 0; 827 incidence = 0;
828 828
829 } else { 829 } else {
830 //qDebug("related found "); 830 //qDebug("related found ");
831 incidence = incidence->relatedTo(); 831 incidence = incidence->relatedTo();
832 } 832 }
833 } else 833 } else
834 incidence = 0; 834 incidence = 0;
835 } 835 }
836 if ( next ) 836 if ( next )
837 todo = todoList.next(); 837 todo = todoList.next();
838 } 838 }
839 839
840 for(todo = todoList.first(); todo; todo = todoList.next()) { 840 for(todo = todoList.first(); todo; todo = todoList.next()) {
841 if (!mTodoMap.contains(todo) && checkTodo( todo ) ) 841 if (!mTodoMap.contains(todo) && checkTodo( todo ) )
842 { 842 {
843 insertTodoItem(todo); 843 insertTodoItem(todo);
844 } 844 }