-rw-r--r-- | korganizer/kotodoview.cpp | 20 |
1 files changed, 10 insertions, 10 deletions
diff --git a/korganizer/kotodoview.cpp b/korganizer/kotodoview.cpp index 3ae977d..f46a103 100644 --- a/korganizer/kotodoview.cpp +++ b/korganizer/kotodoview.cpp | |||
@@ -431,220 +431,220 @@ void KOTodoListView::keyPressEvent ( QKeyEvent * e ) | |||
431 | 431 | ||
432 | } | 432 | } |
433 | } | 433 | } |
434 | 434 | ||
435 | e->accept(); | 435 | e->accept(); |
436 | return; | 436 | return; |
437 | } | 437 | } |
438 | 438 | ||
439 | if ( e->state() == Qt::ControlButton || e->state() == Qt::ShiftButton || mName != "todolistsmall" ) { | 439 | if ( e->state() == Qt::ControlButton || e->state() == Qt::ShiftButton || mName != "todolistsmall" ) { |
440 | switch ( e->key() ) { | 440 | switch ( e->key() ) { |
441 | case Qt::Key_Down: | 441 | case Qt::Key_Down: |
442 | case Qt::Key_Up: | 442 | case Qt::Key_Up: |
443 | QListView::keyPressEvent ( e ); | 443 | QListView::keyPressEvent ( e ); |
444 | e->accept(); | 444 | e->accept(); |
445 | break; | 445 | break; |
446 | case Qt::Key_Left: | 446 | case Qt::Key_Left: |
447 | case Qt::Key_Right: | 447 | case Qt::Key_Right: |
448 | QListView::keyPressEvent ( e ); | 448 | QListView::keyPressEvent ( e ); |
449 | e->accept(); | 449 | e->accept(); |
450 | return; | 450 | return; |
451 | break; | 451 | break; |
452 | default: | 452 | default: |
453 | e->ignore(); | 453 | e->ignore(); |
454 | break; | 454 | break; |
455 | } | 455 | } |
456 | return; | 456 | return; |
457 | } | 457 | } |
458 | e->ignore(); | 458 | e->ignore(); |
459 | } | 459 | } |
460 | void KOTodoListView::contentsMouseReleaseEvent(QMouseEvent *e) | 460 | void KOTodoListView::contentsMouseReleaseEvent(QMouseEvent *e) |
461 | { | 461 | { |
462 | QListView::contentsMouseReleaseEvent(e); | 462 | QListView::contentsMouseReleaseEvent(e); |
463 | mMousePressed = false; | 463 | mMousePressed = false; |
464 | } | 464 | } |
465 | 465 | ||
466 | void KOTodoListView::contentsMouseDoubleClickEvent(QMouseEvent *e) | 466 | void KOTodoListView::contentsMouseDoubleClickEvent(QMouseEvent *e) |
467 | { | 467 | { |
468 | if (!e) return; | 468 | if (!e) return; |
469 | 469 | ||
470 | QPoint vp = contentsToViewport(e->pos()); | 470 | QPoint vp = contentsToViewport(e->pos()); |
471 | 471 | ||
472 | QListViewItem *item = itemAt(vp); | 472 | QListViewItem *item = itemAt(vp); |
473 | 473 | ||
474 | emit double_Clicked(item); | 474 | emit double_Clicked(item); |
475 | if (!item) return; | 475 | if (!item) return; |
476 | 476 | ||
477 | emit doubleClicked(item,vp,0); | 477 | emit doubleClicked(item,vp,0); |
478 | } | 478 | } |
479 | 479 | ||
480 | ///////////////////////////////////////////////////////////////////////////// | 480 | ///////////////////////////////////////////////////////////////////////////// |
481 | 481 | ||
482 | KOQuickTodo::KOQuickTodo(QWidget *parent) : | 482 | KOQuickTodo::KOQuickTodo(QWidget *parent) : |
483 | QLineEdit(parent) | 483 | QLineEdit(parent) |
484 | { | 484 | { |
485 | setText(i18n("Click to add new Todo")); | 485 | setText(i18n("Click to add new Todo")); |
486 | } | 486 | } |
487 | 487 | ||
488 | void KOQuickTodo::focusInEvent(QFocusEvent *ev) | 488 | void KOQuickTodo::focusInEvent(QFocusEvent *ev) |
489 | { | 489 | { |
490 | if ( text()==i18n("Click to add new Todo") ) | 490 | if ( text()==i18n("Click to add new Todo") ) |
491 | setText(""); | 491 | setText(""); |
492 | QLineEdit::focusInEvent(ev); | 492 | QLineEdit::focusInEvent(ev); |
493 | } | 493 | } |
494 | 494 | ||
495 | void KOQuickTodo::focusOutEvent(QFocusEvent *ev) | 495 | void KOQuickTodo::focusOutEvent(QFocusEvent *ev) |
496 | { | 496 | { |
497 | setText(i18n("Click to add new Todo")); | 497 | setText(i18n("Click to add new Todo")); |
498 | QLineEdit::focusOutEvent(ev); | 498 | QLineEdit::focusOutEvent(ev); |
499 | } | 499 | } |
500 | 500 | ||
501 | ///////////////////////////////////////////////////////////////////////////// | 501 | ///////////////////////////////////////////////////////////////////////////// |
502 | 502 | ||
503 | KOTodoView::KOTodoView(Calendar *calendar,QWidget* parent,const char* name) : | 503 | KOTodoView::KOTodoView(Calendar *calendar,QWidget* parent,const char* name) : |
504 | KOrg::BaseView(calendar,parent,name) | 504 | KOrg::BaseView(calendar,parent,name) |
505 | { | 505 | { |
506 | mCategoryPopupMenu = 0; | 506 | mCategoryPopupMenu = 0; |
507 | mPendingUpdateBeforeRepaint = false; | 507 | mPendingUpdateBeforeRepaint = false; |
508 | isFlatDisplay = false; | 508 | isFlatDisplay = false; |
509 | mNavigator = 0; | 509 | mNavigator = 0; |
510 | QBoxLayout *topLayout = new QVBoxLayout(this); | 510 | QBoxLayout *topLayout = new QVBoxLayout(this); |
511 | mName = QString ( name ); | 511 | mName = QString ( name ); |
512 | mBlockUpdate = false; | 512 | mBlockUpdate = false; |
513 | mQuickBar = new QWidget( this ); | 513 | mQuickBar = new QWidget( this ); |
514 | topLayout->addWidget(mQuickBar); | 514 | topLayout->addWidget(mQuickBar); |
515 | 515 | ||
516 | mQuickAdd = new KOQuickTodo(mQuickBar); | 516 | mQuickAdd = new KOQuickTodo(mQuickBar); |
517 | QBoxLayout *quickLayout = new QHBoxLayout(mQuickBar); | 517 | QBoxLayout *quickLayout = new QHBoxLayout(mQuickBar); |
518 | quickLayout->addWidget( mQuickAdd ); | 518 | quickLayout->addWidget( mQuickAdd ); |
519 | mNewSubBut = new QPushButton( "sub",mQuickBar ); | 519 | mNewSubBut = new QPushButton( "sub",mQuickBar ); |
520 | QPushButton * s_done = new QPushButton( "D",mQuickBar ); | 520 | QPushButton * s_done = new QPushButton( "D",mQuickBar ); |
521 | QPushButton * s_run = new QPushButton( "R",mQuickBar ); | 521 | QPushButton * s_run = new QPushButton( "R",mQuickBar ); |
522 | QPushButton * allopen = new QPushButton( "O",mQuickBar ); | 522 | QPushButton * allopen = new QPushButton( "O",mQuickBar ); |
523 | QPushButton * allclose = new QPushButton( "C",mQuickBar ); | 523 | QPushButton * allclose = new QPushButton( "C",mQuickBar ); |
524 | QPushButton * flat = new QPushButton( "F",mQuickBar ); | 524 | QPushButton * flat = new QPushButton( "F",mQuickBar ); |
525 | 525 | ||
526 | int fixwid = mQuickAdd->sizeHint().height(); | 526 | int fixwid = mQuickAdd->sizeHint().height(); |
527 | int fixhei = fixwid; | ||
527 | if ( QApplication::desktop()->width() > 800 ) | 528 | if ( QApplication::desktop()->width() > 800 ) |
528 | fixwid *= 2; | 529 | fixwid = (fixwid*3)/2; |
529 | connect ( flat, SIGNAL ( clicked()), SLOT ( setAllFlat())); | 530 | connect ( flat, SIGNAL ( clicked()), SLOT ( setAllFlat())); |
530 | connect ( allopen, SIGNAL ( clicked()), SLOT ( setAllOpen())); | 531 | connect ( allopen, SIGNAL ( clicked()), SLOT ( setAllOpen())); |
531 | connect ( allclose, SIGNAL ( clicked()), SLOT ( setAllClose())); | 532 | connect ( allclose, SIGNAL ( clicked()), SLOT ( setAllClose())); |
532 | s_done->setPixmap( SmallIcon("greenhook16")); | 533 | s_done->setPixmap( SmallIcon("greenhook16")); |
533 | s_done->setFixedHeight( flat->sizeHint().height() ); | ||
534 | connect ( s_done, SIGNAL ( clicked()), SLOT ( toggleCompleted())); | 534 | connect ( s_done, SIGNAL ( clicked()), SLOT ( toggleCompleted())); |
535 | s_run->setPixmap( SmallIcon("ko16old")); | 535 | s_run->setPixmap( SmallIcon("ko16old")); |
536 | connect ( s_run, SIGNAL ( clicked()), SLOT ( toggleRunning())); | 536 | connect ( s_run, SIGNAL ( clicked()), SLOT ( toggleRunning())); |
537 | 537 | ||
538 | connect ( mNewSubBut, SIGNAL ( clicked()), SLOT ( newSubTodo())); | 538 | connect ( mNewSubBut, SIGNAL ( clicked()), SLOT ( newSubTodo())); |
539 | 539 | ||
540 | mNewSubBut->setFixedWidth(mNewSubBut->sizeHint().width() ); | 540 | mNewSubBut->setFixedWidth(mNewSubBut->sizeHint().width() ); |
541 | mNewSubBut->setEnabled( false ); | 541 | mNewSubBut->setEnabled( false ); |
542 | flat->setFixedWidth( fixwid ); | 542 | flat->setFixedWidth( fixwid ); |
543 | s_done->setFixedWidth( fixwid ); | 543 | s_done->setFixedWidth( fixwid ); |
544 | allopen->setFixedWidth( fixwid ); | 544 | allopen->setFixedWidth( fixwid ); |
545 | allclose->setFixedWidth( fixwid ); | 545 | allclose->setFixedWidth( fixwid ); |
546 | s_run->setFixedWidth( fixwid ); | 546 | s_run->setFixedWidth( fixwid ); |
547 | if ( QApplication::desktop()->width() < 800 ) { | 547 | |
548 | flat->setFixedHeight( fixwid ); | 548 | flat->setFixedHeight(fixhei ); |
549 | s_done->setFixedHeight( fixwid ); | 549 | s_done->setFixedHeight(fixhei ); |
550 | allopen->setFixedHeight( fixwid ); | 550 | allopen->setFixedHeight(fixhei ); |
551 | allclose->setFixedHeight( fixwid ); | 551 | allclose->setFixedHeight(fixhei ); |
552 | s_run->setFixedHeight( fixwid ); | 552 | s_run->setFixedHeight(fixhei ); |
553 | mNewSubBut->setFixedHeight( fixwid ); | 553 | mNewSubBut->setFixedHeight(fixhei ); |
554 | } | 554 | |
555 | quickLayout->addWidget( mNewSubBut ); | 555 | quickLayout->addWidget( mNewSubBut ); |
556 | quickLayout->addWidget( s_done ); | 556 | quickLayout->addWidget( s_done ); |
557 | quickLayout->addWidget( s_run ); | 557 | quickLayout->addWidget( s_run ); |
558 | quickLayout->addWidget( allopen ); | 558 | quickLayout->addWidget( allopen ); |
559 | quickLayout->addWidget( allclose ); | 559 | quickLayout->addWidget( allclose ); |
560 | quickLayout->addWidget( flat ); | 560 | quickLayout->addWidget( flat ); |
561 | 561 | ||
562 | if ( !KOPrefs::instance()->mEnableQuickTodo ) mQuickBar->hide(); | 562 | if ( !KOPrefs::instance()->mEnableQuickTodo ) mQuickBar->hide(); |
563 | 563 | ||
564 | mTodoListView = new KOTodoListView(calendar,this, name ); | 564 | mTodoListView = new KOTodoListView(calendar,this, name ); |
565 | topLayout->addWidget(mTodoListView); | 565 | topLayout->addWidget(mTodoListView); |
566 | //mTodoListView->header()->setMaximumHeight(30); | 566 | //mTodoListView->header()->setMaximumHeight(30); |
567 | mTodoListView->setRootIsDecorated(true); | 567 | mTodoListView->setRootIsDecorated(true); |
568 | mTodoListView->setAllColumnsShowFocus(true); | 568 | mTodoListView->setAllColumnsShowFocus(true); |
569 | 569 | ||
570 | mTodoListView->setShowSortIndicator(true); | 570 | mTodoListView->setShowSortIndicator(true); |
571 | 571 | ||
572 | mTodoListView->addColumn(i18n("Todo")); | 572 | mTodoListView->addColumn(i18n("Todo")); |
573 | mTodoListView->addColumn(i18n("Prio")); | 573 | mTodoListView->addColumn(i18n("Prio")); |
574 | mTodoListView->setColumnAlignment(1,AlignHCenter); | 574 | mTodoListView->setColumnAlignment(1,AlignHCenter); |
575 | mTodoListView->addColumn(i18n("Complete")); | 575 | mTodoListView->addColumn(i18n("Complete")); |
576 | mTodoListView->setColumnAlignment(2,AlignCenter); | 576 | mTodoListView->setColumnAlignment(2,AlignCenter); |
577 | 577 | ||
578 | mTodoListView->addColumn(i18n("Due Date")); | 578 | mTodoListView->addColumn(i18n("Due Date")); |
579 | mTodoListView->setColumnAlignment(3,AlignLeft); | 579 | mTodoListView->setColumnAlignment(3,AlignLeft); |
580 | mTodoListView->addColumn(i18n("Due Time")); | 580 | mTodoListView->addColumn(i18n("Due Time")); |
581 | mTodoListView->setColumnAlignment(4,AlignHCenter); | 581 | mTodoListView->setColumnAlignment(4,AlignHCenter); |
582 | 582 | ||
583 | mTodoListView->addColumn(i18n("Start Date")); | 583 | mTodoListView->addColumn(i18n("Start Date")); |
584 | mTodoListView->setColumnAlignment(5,AlignLeft); | 584 | mTodoListView->setColumnAlignment(5,AlignLeft); |
585 | mTodoListView->addColumn(i18n("Start Time")); | 585 | mTodoListView->addColumn(i18n("Start Time")); |
586 | mTodoListView->setColumnAlignment(6,AlignHCenter); | 586 | mTodoListView->setColumnAlignment(6,AlignHCenter); |
587 | 587 | ||
588 | //mTodoListView->addColumn(i18n("Cancelled")); | 588 | //mTodoListView->addColumn(i18n("Cancelled")); |
589 | mTodoListView->addColumn(i18n("Categories")); | 589 | mTodoListView->addColumn(i18n("Categories")); |
590 | mTodoListView->addColumn(i18n("Calendar")); | 590 | mTodoListView->addColumn(i18n("Calendar")); |
591 | mTodoListView->addColumn(i18n("Last Modified")); | 591 | mTodoListView->addColumn(i18n("Last Modified")); |
592 | mTodoListView->addColumn(i18n("Created")); | 592 | mTodoListView->addColumn(i18n("Created")); |
593 | mTodoListView->addColumn(i18n("Last Modified Sub")); | 593 | mTodoListView->addColumn(i18n("Last Modified Sub")); |
594 | #if 0 | 594 | #if 0 |
595 | mTodoListView->addColumn(i18n("Sort Id")); | 595 | mTodoListView->addColumn(i18n("Sort Id")); |
596 | mTodoListView->setColumnAlignment(4,AlignHCenter); | 596 | mTodoListView->setColumnAlignment(4,AlignHCenter); |
597 | #endif | 597 | #endif |
598 | 598 | ||
599 | mTodoListView->setMinimumHeight( 60 ); | 599 | mTodoListView->setMinimumHeight( 60 ); |
600 | mTodoListView->setItemsRenameable( true ); | 600 | mTodoListView->setItemsRenameable( true ); |
601 | mTodoListView->setRenameable( 0 ); | 601 | mTodoListView->setRenameable( 0 ); |
602 | mTodoListView->setColumnWidth( 0, 120 ); | 602 | mTodoListView->setColumnWidth( 0, 120 ); |
603 | int iii = 0; | 603 | int iii = 0; |
604 | for ( iii = 0; iii< 12 ; ++iii ) | 604 | for ( iii = 0; iii< 12 ; ++iii ) |
605 | mTodoListView->setColumnWidthMode( iii, QListView::Manual ); | 605 | mTodoListView->setColumnWidthMode( iii, QListView::Manual ); |
606 | 606 | ||
607 | 607 | ||
608 | mKOTodoViewWhatsThis = new KOTodoViewWhatsThis(mTodoListView->viewport(),this); | 608 | mKOTodoViewWhatsThis = new KOTodoViewWhatsThis(mTodoListView->viewport(),this); |
609 | 609 | ||
610 | mPriorityPopupMenu = new QPopupMenu(this); | 610 | mPriorityPopupMenu = new QPopupMenu(this); |
611 | for (int i = 1; i <= 5; i++) { | 611 | for (int i = 1; i <= 5; i++) { |
612 | QString label = QString ("%1").arg (i); | 612 | QString label = QString ("%1").arg (i); |
613 | mPriority[mPriorityPopupMenu->insertItem (label)] = i; | 613 | mPriority[mPriorityPopupMenu->insertItem (label)] = i; |
614 | } | 614 | } |
615 | connect (mPriorityPopupMenu, SIGNAL(activated (int)), SLOT (setNewPriority(int))); | 615 | connect (mPriorityPopupMenu, SIGNAL(activated (int)), SLOT (setNewPriority(int))); |
616 | 616 | ||
617 | mPercentageCompletedPopupMenu = new QPopupMenu(this); | 617 | mPercentageCompletedPopupMenu = new QPopupMenu(this); |
618 | for (int i = 0; i <= 100; i+=20) { | 618 | for (int i = 0; i <= 100; i+=20) { |
619 | QString label = QString ("%1 %").arg (i); | 619 | QString label = QString ("%1 %").arg (i); |
620 | mPercentage[mPercentageCompletedPopupMenu->insertItem (label)] = i; | 620 | mPercentage[mPercentageCompletedPopupMenu->insertItem (label)] = i; |
621 | } | 621 | } |
622 | connect (mPercentageCompletedPopupMenu, SIGNAL (activated (int)), SLOT (setNewPercentage (int))); | 622 | connect (mPercentageCompletedPopupMenu, SIGNAL (activated (int)), SLOT (setNewPercentage (int))); |
623 | 623 | ||
624 | 624 | ||
625 | mCategoryPopupMenu = new QPopupMenu (this); | 625 | mCategoryPopupMenu = new QPopupMenu (this); |
626 | mCategoryPopupMenu->setCheckable (true); | 626 | mCategoryPopupMenu->setCheckable (true); |
627 | connect (mCategoryPopupMenu, SIGNAL (activated (int)), SLOT (changedCategories (int))); | 627 | connect (mCategoryPopupMenu, SIGNAL (activated (int)), SLOT (changedCategories (int))); |
628 | connect (mCategoryPopupMenu, SIGNAL (aboutToShow ()), SLOT (fillCategories ())); | 628 | connect (mCategoryPopupMenu, SIGNAL (aboutToShow ()), SLOT (fillCategories ())); |
629 | 629 | ||
630 | mCalPopupMenu = new QPopupMenu (this); | 630 | mCalPopupMenu = new QPopupMenu (this); |
631 | mCalPopupMenu->setCheckable (true); | 631 | mCalPopupMenu->setCheckable (true); |
632 | connect (mCalPopupMenu, SIGNAL (activated (int)), SLOT (changedCal (int))); | 632 | connect (mCalPopupMenu, SIGNAL (activated (int)), SLOT (changedCal (int))); |
633 | connect (mCalPopupMenu, SIGNAL (aboutToShow ()), SLOT (fillCal ())); | 633 | connect (mCalPopupMenu, SIGNAL (aboutToShow ()), SLOT (fillCal ())); |
634 | 634 | ||
635 | 635 | ||
636 | 636 | ||
637 | 637 | ||
638 | mItemPopupMenu = new QPopupMenu(this); | 638 | mItemPopupMenu = new QPopupMenu(this); |
639 | mItemPopupMenu->insertItem(i18n("Show"), this, | 639 | mItemPopupMenu->insertItem(i18n("Show"), this, |
640 | SLOT (showTodo())); | 640 | SLOT (showTodo())); |
641 | mItemPopupMenu->insertItem(i18n("Edit..."), this, | 641 | mItemPopupMenu->insertItem(i18n("Edit..."), this, |
642 | SLOT (editTodo())); | 642 | SLOT (editTodo())); |
643 | mItemPopupMenu->insertItem( i18n("Delete..."), this, | 643 | mItemPopupMenu->insertItem( i18n("Delete..."), this, |
644 | SLOT (deleteTodo())); | 644 | SLOT (deleteTodo())); |
645 | mItemPopupMenu->insertItem( i18n("Clone..."), this, | 645 | mItemPopupMenu->insertItem( i18n("Clone..."), this, |
646 | SLOT (cloneTodo())); | 646 | SLOT (cloneTodo())); |
647 | mItemPopupMenu->insertItem( i18n("Move..."), this, | 647 | mItemPopupMenu->insertItem( i18n("Move..."), this, |
648 | SLOT (moveTodo())); | 648 | SLOT (moveTodo())); |
649 | #ifndef DESKTOP_VERSION | 649 | #ifndef DESKTOP_VERSION |
650 | mItemPopupMenu->insertItem( i18n("Beam..."), this, | 650 | mItemPopupMenu->insertItem( i18n("Beam..."), this, |