author | zautrix <zautrix> | 2005-03-27 23:25:35 (UTC) |
---|---|---|
committer | zautrix <zautrix> | 2005-03-27 23:25:35 (UTC) |
commit | 67dc8738c14716e18e4c433e5c0da474456c9859 (patch) (unidiff) | |
tree | b6bd7d0d0dcc0a389bd9dce57d124d035495aeeb /korganizer | |
parent | e73b9d31e463f39f666a008bdde8160a9e5c5dbf (diff) | |
download | kdepimpi-67dc8738c14716e18e4c433e5c0da474456c9859.zip kdepimpi-67dc8738c14716e18e4c433e5c0da474456c9859.tar.gz kdepimpi-67dc8738c14716e18e4c433e5c0da474456c9859.tar.bz2 |
small fixes
-rw-r--r-- | korganizer/koagenda.cpp | 8 | ||||
-rw-r--r-- | korganizer/koagendaview.cpp | 2 | ||||
-rw-r--r-- | korganizer/koeditorgeneraltodo.cpp | 3 | ||||
-rw-r--r-- | korganizer/navigatorbar.cpp | 6 |
4 files changed, 18 insertions, 1 deletions
diff --git a/korganizer/koagenda.cpp b/korganizer/koagenda.cpp index ed7a443..1a24887 100644 --- a/korganizer/koagenda.cpp +++ b/korganizer/koagenda.cpp | |||
@@ -412,96 +412,104 @@ bool KOAgenda::eventFilter_mouse(QObject *object, QMouseEvent *me) | |||
412 | viewportPos = me->pos(); | 412 | viewportPos = me->pos(); |
413 | } | 413 | } |
414 | static int startX = 0; | 414 | static int startX = 0; |
415 | static int startY = 0; | 415 | static int startY = 0; |
416 | static int blockmoveDist = ( QApplication::desktop()->width() < 480 ? 15 : 20 ); | 416 | static int blockmoveDist = ( QApplication::desktop()->width() < 480 ? 15 : 20 ); |
417 | static bool blockMoving = true; | 417 | static bool blockMoving = true; |
418 | switch (me->type()) { | 418 | switch (me->type()) { |
419 | case QEvent::MouseButtonPress: | 419 | case QEvent::MouseButtonPress: |
420 | if (me->button() == LeftButton) { | 420 | if (me->button() == LeftButton) { |
421 | mPopupTimer->start( 600 ); | 421 | mPopupTimer->start( 600 ); |
422 | mLeftMouseDown = true; | 422 | mLeftMouseDown = true; |
423 | } | 423 | } |
424 | blockMoving = true; | 424 | blockMoving = true; |
425 | startX = viewportPos.x(); | 425 | startX = viewportPos.x(); |
426 | startY = viewportPos.y(); | 426 | startY = viewportPos.y(); |
427 | if (object != viewport()) { | 427 | if (object != viewport()) { |
428 | mPopupItem = (KOAgendaItem *)object; | 428 | mPopupItem = (KOAgendaItem *)object; |
429 | mPopupKind = 1; | 429 | mPopupKind = 1; |
430 | if (me->button() == RightButton) { | 430 | if (me->button() == RightButton) { |
431 | popupMenu(); | 431 | popupMenu(); |
432 | } else if (me->button() == LeftButton) { | 432 | } else if (me->button() == LeftButton) { |
433 | mActionItem = (KOAgendaItem *)object; | 433 | mActionItem = (KOAgendaItem *)object; |
434 | if (mActionItem) { | 434 | if (mActionItem) { |
435 | if ( mSelectionHeight > 0 ) { | 435 | if ( mSelectionHeight > 0 ) { |
436 | int selectionCellX = mSelectionCellX * mGridSpacingX; | 436 | int selectionCellX = mSelectionCellX * mGridSpacingX; |
437 | int selectionYTop = mSelectionYTop; | 437 | int selectionYTop = mSelectionYTop; |
438 | int gridSpacingX = mGridSpacingX; | 438 | int gridSpacingX = mGridSpacingX; |
439 | int selectionHeight = mSelectionHeight; | 439 | int selectionHeight = mSelectionHeight; |
440 | clearSelection(); | 440 | clearSelection(); |
441 | repaintContents( selectionCellX, selectionYTop, | 441 | repaintContents( selectionCellX, selectionYTop, |
442 | gridSpacingX, selectionHeight,false ); | 442 | gridSpacingX, selectionHeight,false ); |
443 | } | 443 | } |
444 | selectItem(mActionItem); | 444 | selectItem(mActionItem); |
445 | Incidence *incidence = mActionItem->incidence(); | 445 | Incidence *incidence = mActionItem->incidence(); |
446 | if ( incidence->isReadOnly() /*|| incidence->recurrence()->doesRecur() */) { | 446 | if ( incidence->isReadOnly() /*|| incidence->recurrence()->doesRecur() */) { |
447 | mActionItem = 0; | 447 | mActionItem = 0; |
448 | } else { | 448 | } else { |
449 | startItemAction(viewportPos); | 449 | startItemAction(viewportPos); |
450 | } | 450 | } |
451 | } | 451 | } |
452 | } | 452 | } |
453 | } else { // ---------- viewport() | 453 | } else { // ---------- viewport() |
454 | mPopupItem = 0; | 454 | mPopupItem = 0; |
455 | mPopupKind = 2; | 455 | mPopupKind = 2; |
456 | selectItem(0); | 456 | selectItem(0); |
457 | mActionItem = 0; | 457 | mActionItem = 0; |
458 | mPopupPos = viewport()->mapToGlobal( me->pos() ); | 458 | mPopupPos = viewport()->mapToGlobal( me->pos() ); |
459 | if (me->button() == RightButton) { | 459 | if (me->button() == RightButton) { |
460 | int x,y; | ||
461 | viewportToContents(viewportPos.x(),viewportPos.y(),x,y); | ||
462 | int gx,gy; | ||
463 | contentsToGrid(x,y,gx,gy); | ||
464 | mCurrentCellX = gx; | ||
465 | mCurrentCellY = gy; | ||
466 | mStartCellX = gx; | ||
467 | mStartCellY = gy; | ||
460 | popupMenu(); | 468 | popupMenu(); |
461 | } else if (me->button() == LeftButton) { | 469 | } else if (me->button() == LeftButton) { |
462 | setCursor(arrowCursor); | 470 | setCursor(arrowCursor); |
463 | startSelectAction(viewportPos); | 471 | startSelectAction(viewportPos); |
464 | } | 472 | } |
465 | } | 473 | } |
466 | break; | 474 | break; |
467 | 475 | ||
468 | case QEvent::MouseButtonRelease: | 476 | case QEvent::MouseButtonRelease: |
469 | if (me->button() == LeftButton ) { | 477 | if (me->button() == LeftButton ) { |
470 | mPopupTimer->stop(); | 478 | mPopupTimer->stop(); |
471 | } | 479 | } |
472 | if (object != viewport()) { | 480 | if (object != viewport()) { |
473 | if (me->button() == LeftButton && mLeftMouseDown) { | 481 | if (me->button() == LeftButton && mLeftMouseDown) { |
474 | if (mActionItem) { | 482 | if (mActionItem) { |
475 | QPoint clipperPos = clipper()->mapFromGlobal(viewport()->mapToGlobal(viewportPos)); | 483 | QPoint clipperPos = clipper()->mapFromGlobal(viewport()->mapToGlobal(viewportPos)); |
476 | //qDebug(" %d %d %d ",clipperPos.y(),visibleHeight() , 9 ); | 484 | //qDebug(" %d %d %d ",clipperPos.y(),visibleHeight() , 9 ); |
477 | if ( mActionType == MOVE && (clipperPos.y() > visibleHeight()-2 ||clipperPos.y() < 0 ) ) { | 485 | if ( mActionType == MOVE && (clipperPos.y() > visibleHeight()-2 ||clipperPos.y() < 0 ) ) { |
478 | mScrollUpTimer.stop(); | 486 | mScrollUpTimer.stop(); |
479 | mScrollDownTimer.stop(); | 487 | mScrollDownTimer.stop(); |
480 | mActionItem->resetMove(); | 488 | mActionItem->resetMove(); |
481 | placeSubCells( mActionItem ); | 489 | placeSubCells( mActionItem ); |
482 | // emit startDragSignal( mActionItem->incidence() ); | 490 | // emit startDragSignal( mActionItem->incidence() ); |
483 | setCursor( arrowCursor ); | 491 | setCursor( arrowCursor ); |
484 | mActionItem = 0; | 492 | mActionItem = 0; |
485 | mActionType = NOP; | 493 | mActionType = NOP; |
486 | mItemMoved = 0; | 494 | mItemMoved = 0; |
487 | mLeftMouseDown = false; | 495 | mLeftMouseDown = false; |
488 | return true; | 496 | return true; |
489 | } | 497 | } |
490 | endItemAction(); | 498 | endItemAction(); |
491 | } | 499 | } |
492 | } | 500 | } |
493 | 501 | ||
494 | } else { // ---------- viewport() | 502 | } else { // ---------- viewport() |
495 | if (me->button() == LeftButton && mLeftMouseDown ) { //left click | 503 | if (me->button() == LeftButton && mLeftMouseDown ) { //left click |
496 | endSelectAction( true ); // emit new event signal | 504 | endSelectAction( true ); // emit new event signal |
497 | } | 505 | } |
498 | } | 506 | } |
499 | if (me->button() == LeftButton) | 507 | if (me->button() == LeftButton) |
500 | mLeftMouseDown = false; | 508 | mLeftMouseDown = false; |
501 | 509 | ||
502 | break; | 510 | break; |
503 | 511 | ||
504 | case QEvent::MouseMove: | 512 | case QEvent::MouseMove: |
505 | if ( !mLeftMouseDown ) | 513 | if ( !mLeftMouseDown ) |
506 | return true; | 514 | return true; |
507 | if ( blockMoving ) { | 515 | if ( blockMoving ) { |
diff --git a/korganizer/koagendaview.cpp b/korganizer/koagendaview.cpp index f6f390b..f452db0 100644 --- a/korganizer/koagendaview.cpp +++ b/korganizer/koagendaview.cpp | |||
@@ -687,187 +687,189 @@ void KOAgendaView::createDayLabels() | |||
687 | wid = f.width( "30" ); | 687 | wid = f.width( "30" ); |
688 | needWid = wid * selCount; | 688 | needWid = wid * selCount; |
689 | if ( needWid < maxWid ) | 689 | if ( needWid < maxWid ) |
690 | break; | 690 | break; |
691 | } | 691 | } |
692 | maxLen = 2; | 692 | maxLen = 2; |
693 | } | 693 | } |
694 | //qDebug("Max len %d ", dayTest.length() ); | 694 | //qDebug("Max len %d ", dayTest.length() ); |
695 | 695 | ||
696 | QFontMetrics tempF( dlf ); | 696 | QFontMetrics tempF( dlf ); |
697 | newHight = tempF.height(); | 697 | newHight = tempF.height(); |
698 | mDayLabels->setFont( dlf ); | 698 | mDayLabels->setFont( dlf ); |
699 | // mLayoutDayLabels = new QHBoxLayout(mDayLabels);; | 699 | // mLayoutDayLabels = new QHBoxLayout(mDayLabels);; |
700 | // mLayoutDayLabels->addSpacing(mTimeLabels->width()); | 700 | // mLayoutDayLabels->addSpacing(mTimeLabels->width()); |
701 | //mLayoutDayLabels->addSpacing( 2 ); | 701 | //mLayoutDayLabels->addSpacing( 2 ); |
702 | // QFont lFont = dlf; | 702 | // QFont lFont = dlf; |
703 | bool appendLabels = false; | 703 | bool appendLabels = false; |
704 | KOAgendaButton *dayLabel; | 704 | KOAgendaButton *dayLabel; |
705 | dayLabel = mDayLabelsList.first(); | 705 | dayLabel = mDayLabelsList.first(); |
706 | if ( !dayLabel ) { | 706 | if ( !dayLabel ) { |
707 | appendLabels = true; | 707 | appendLabels = true; |
708 | dayLabel = getNewDaylabel(); | 708 | dayLabel = getNewDaylabel(); |
709 | } | 709 | } |
710 | dayLabel->setFixedWidth( mTimeLabels->width()+2 ); | 710 | dayLabel->setFixedWidth( mTimeLabels->width()+2 ); |
711 | dayLabel->setFont( dlf ); | 711 | dayLabel->setFont( dlf ); |
712 | dayLabel->setNum( -1 ); | 712 | dayLabel->setNum( -1 ); |
713 | //dayLabel->setAlignment(QLabel::AlignHCenter); | 713 | //dayLabel->setAlignment(QLabel::AlignHCenter); |
714 | dayLabel->setText( KOGlobals::self()->calendarSystem()->monthName( mSelectedDates.first(), true ) ); | 714 | dayLabel->setText( KOGlobals::self()->calendarSystem()->monthName( mSelectedDates.first(), true ) ); |
715 | dayLabel->show(); | 715 | dayLabel->show(); |
716 | DateList::ConstIterator dit; | 716 | DateList::ConstIterator dit; |
717 | bool oneday = (mSelectedDates.first() == mSelectedDates.last() ); | 717 | bool oneday = (mSelectedDates.first() == mSelectedDates.last() ); |
718 | int counter = -1; | 718 | int counter = -1; |
719 | for( dit = mSelectedDates.begin(); dit != mSelectedDates.end(); ++dit ) { | 719 | for( dit = mSelectedDates.begin(); dit != mSelectedDates.end(); ++dit ) { |
720 | ++counter; | 720 | ++counter; |
721 | QDate date = *dit; | 721 | QDate date = *dit; |
722 | // QBoxLayout *dayLayout = new QVBoxLayout(mLayoutDayLabels); | 722 | // QBoxLayout *dayLayout = new QVBoxLayout(mLayoutDayLabels); |
723 | if ( ! appendLabels ) { | 723 | if ( ! appendLabels ) { |
724 | dayLabel = mDayLabelsList.next(); | 724 | dayLabel = mDayLabelsList.next(); |
725 | if ( !dayLabel ) | 725 | if ( !dayLabel ) |
726 | appendLabels = true; | 726 | appendLabels = true; |
727 | } | 727 | } |
728 | if ( appendLabels ) { | 728 | if ( appendLabels ) { |
729 | dayLabel = getNewDaylabel(); | 729 | dayLabel = getNewDaylabel(); |
730 | } | 730 | } |
731 | dayLabel->setMinimumWidth( 1 ); | 731 | dayLabel->setMinimumWidth( 1 ); |
732 | dayLabel->setMaximumWidth( 10240 ); | 732 | dayLabel->setMaximumWidth( 10240 ); |
733 | dayLabel->setFont( dlf ); | 733 | dayLabel->setFont( dlf ); |
734 | dayLabel->show(); | 734 | dayLabel->show(); |
735 | dayLabel->setAutoRepeat( false ); | ||
735 | dayLabel->setNum( counter ); | 736 | dayLabel->setNum( counter ); |
736 | QString str; | 737 | QString str; |
737 | int dW = KOGlobals::self()->calendarSystem()->dayOfWeek(date); | 738 | int dW = KOGlobals::self()->calendarSystem()->dayOfWeek(date); |
738 | QString dayName = KOGlobals::self()->calendarSystem()->weekDayName( dW, true ); | 739 | QString dayName = KOGlobals::self()->calendarSystem()->weekDayName( dW, true ); |
739 | switch ( maxLen ) { | 740 | switch ( maxLen ) { |
740 | case 2: | 741 | case 2: |
741 | str = QString::number( date.day() ); | 742 | str = QString::number( date.day() ); |
742 | break; | 743 | break; |
743 | 744 | ||
744 | case 3: | 745 | case 3: |
745 | str = dayName.left( 1 ) +QString::number( date.day()); | 746 | str = dayName.left( 1 ) +QString::number( date.day()); |
746 | 747 | ||
747 | break; | 748 | break; |
748 | case 4: | 749 | case 4: |
749 | str = dayName.left( 1 ) + " " +QString::number( date.day()); | 750 | str = dayName.left( 1 ) + " " +QString::number( date.day()); |
750 | 751 | ||
751 | break; | 752 | break; |
752 | case 5: | 753 | case 5: |
753 | str = dayName.left( 2 ) + " " +QString::number( date.day()); | 754 | str = dayName.left( 2 ) + " " +QString::number( date.day()); |
754 | 755 | ||
755 | break; | 756 | break; |
756 | case 6: | 757 | case 6: |
757 | str = dayName.left( 3 ) + " " +QString::number( date.day()); | 758 | str = dayName.left( 3 ) + " " +QString::number( date.day()); |
758 | break; | 759 | break; |
759 | 760 | ||
760 | default: | 761 | default: |
761 | break; | 762 | break; |
762 | } | 763 | } |
763 | if ( oneday ) { | 764 | if ( oneday ) { |
764 | QString addString; | 765 | QString addString; |
765 | if ( mSelectedDates.first() == QDateTime::currentDateTime().date() ) | 766 | if ( mSelectedDates.first() == QDateTime::currentDateTime().date() ) |
766 | addString = i18n("Today"); | 767 | addString = i18n("Today"); |
767 | else if ( mSelectedDates.first() == QDateTime::currentDateTime().date().addDays(1) ) | 768 | else if ( mSelectedDates.first() == QDateTime::currentDateTime().date().addDays(1) ) |
768 | addString = i18n("Tomorrow"); | 769 | addString = i18n("Tomorrow"); |
769 | else if ( mSelectedDates.first() == QDateTime::currentDateTime().date().addDays(-1) ) | 770 | else if ( mSelectedDates.first() == QDateTime::currentDateTime().date().addDays(-1) ) |
770 | addString = i18n("Yesterday"); | 771 | addString = i18n("Yesterday"); |
771 | else if ( mSelectedDates.first() == QDateTime::currentDateTime().date().addDays(-2) ) | 772 | else if ( mSelectedDates.first() == QDateTime::currentDateTime().date().addDays(-2) ) |
772 | addString = i18n("Day before yesterday"); | 773 | addString = i18n("Day before yesterday"); |
773 | else if ( mSelectedDates.first() == QDateTime::currentDateTime().date().addDays(2) ) | 774 | else if ( mSelectedDates.first() == QDateTime::currentDateTime().date().addDays(2) ) |
774 | addString = i18n("Day after tomorrow"); | 775 | addString = i18n("Day after tomorrow"); |
775 | if ( !addString.isEmpty() ) { | 776 | if ( !addString.isEmpty() ) { |
776 | str = addString+", " + str; | 777 | str = addString+", " + str; |
777 | } else { | 778 | } else { |
778 | str = KGlobal::locale()->formatDate( date, KOPrefs::instance()->mShortDateInViewer); | 779 | str = KGlobal::locale()->formatDate( date, KOPrefs::instance()->mShortDateInViewer); |
779 | } | 780 | } |
780 | } | 781 | } |
781 | dayLabel->setText(str); | 782 | dayLabel->setText(str); |
782 | //dayLabel->setAlignment(QLabel::AlignHCenter); | 783 | //dayLabel->setAlignment(QLabel::AlignHCenter); |
783 | if (date == QDate::currentDate()) { | 784 | if (date == QDate::currentDate()) { |
784 | QFont bFont = dlf; | 785 | QFont bFont = dlf; |
785 | bFont.setBold( true ); | 786 | bFont.setBold( true ); |
786 | dayLabel->setFont(bFont); | 787 | dayLabel->setFont(bFont); |
787 | } | 788 | } |
788 | //dayLayout->addWidget(dayLabel); | 789 | //dayLayout->addWidget(dayLabel); |
789 | 790 | ||
790 | #ifndef KORG_NOPLUGINS | 791 | #ifndef KORG_NOPLUGINS |
791 | CalendarDecoration::List cds = KOCore::self()->calendarDecorations(); | 792 | CalendarDecoration::List cds = KOCore::self()->calendarDecorations(); |
792 | CalendarDecoration *it; | 793 | CalendarDecoration *it; |
793 | for(it = cds.first(); it; it = cds.next()) { | 794 | for(it = cds.first(); it; it = cds.next()) { |
794 | QString text = it->shortText( date ); | 795 | QString text = it->shortText( date ); |
795 | if ( !text.isEmpty() ) { | 796 | if ( !text.isEmpty() ) { |
796 | QLabel *label = new QLabel(text,mDayLabels); | 797 | QLabel *label = new QLabel(text,mDayLabels); |
797 | label->setAlignment(AlignCenter); | 798 | label->setAlignment(AlignCenter); |
798 | dayLayout->addWidget(label); | 799 | dayLayout->addWidget(label); |
799 | } | 800 | } |
800 | } | 801 | } |
801 | 802 | ||
802 | for(it = cds.first(); it; it = cds.next()) { | 803 | for(it = cds.first(); it; it = cds.next()) { |
803 | QWidget *wid = it->smallWidget(mDayLabels,date); | 804 | QWidget *wid = it->smallWidget(mDayLabels,date); |
804 | if ( wid ) { | 805 | if ( wid ) { |
805 | // wid->setHeight(20); | 806 | // wid->setHeight(20); |
806 | dayLayout->addWidget(wid); | 807 | dayLayout->addWidget(wid); |
807 | } | 808 | } |
808 | } | 809 | } |
809 | #endif | 810 | #endif |
810 | } | 811 | } |
811 | if ( ! appendLabels ) { | 812 | if ( ! appendLabels ) { |
812 | dayLabel = mDayLabelsList.next(); | 813 | dayLabel = mDayLabelsList.next(); |
813 | if ( !dayLabel ) | 814 | if ( !dayLabel ) |
814 | appendLabels = true; | 815 | appendLabels = true; |
815 | } | 816 | } |
816 | if ( appendLabels ) { | 817 | if ( appendLabels ) { |
817 | dayLabel = getNewDaylabel(); | 818 | dayLabel = getNewDaylabel(); |
818 | } | 819 | } |
819 | //dayLabel->hide();//test only | 820 | //dayLabel->hide();//test only |
820 | 821 | ||
821 | int offset = (mAgenda->width() - mAgenda->verticalScrollBar()->width()-3 ) % mSelectedDates.count() ; | 822 | int offset = (mAgenda->width() - mAgenda->verticalScrollBar()->width()-3 ) % mSelectedDates.count() ; |
822 | if ( offset < 0 ) offset = 0; | 823 | if ( offset < 0 ) offset = 0; |
823 | //qDebug("mLayoutDayLabels->addSpacing %d ", mAgenda->verticalScrollBar()->width()+offset+2 ); | 824 | //qDebug("mLayoutDayLabels->addSpacing %d ", mAgenda->verticalScrollBar()->width()+offset+2 ); |
824 | dayLabel->setText(">");//QString::number ( mSelectedDates.first().month() ) ); | 825 | dayLabel->setText(">");//QString::number ( mSelectedDates.first().month() ) ); |
825 | dayLabel->setFont( dlf ); | 826 | dayLabel->setFont( dlf ); |
827 | dayLabel->setAutoRepeat( true ); | ||
826 | dayLabel->show(); | 828 | dayLabel->show(); |
827 | dayLabel->setNum( -2 ); | 829 | dayLabel->setNum( -2 ); |
828 | dayLabel->setFixedWidth( mAgenda->verticalScrollBar()->width()+ offset ); | 830 | dayLabel->setFixedWidth( mAgenda->verticalScrollBar()->width()+ offset ); |
829 | //qDebug("setToFixed %d ", mAgenda->verticalScrollBar()->width()+ offset+2); | 831 | //qDebug("setToFixed %d ", mAgenda->verticalScrollBar()->width()+ offset+2); |
830 | //mLayoutDayLabels->addSpacing(mAgenda->verticalScrollBar()->width()+ offset+2); | 832 | //mLayoutDayLabels->addSpacing(mAgenda->verticalScrollBar()->width()+ offset+2); |
831 | if ( !appendLabels ) { | 833 | if ( !appendLabels ) { |
832 | dayLabel = mDayLabelsList.next(); | 834 | dayLabel = mDayLabelsList.next(); |
833 | while ( dayLabel ) { | 835 | while ( dayLabel ) { |
834 | //qDebug("!dayLabel %d",dayLabel ); | 836 | //qDebug("!dayLabel %d",dayLabel ); |
835 | dayLabel->hide(); | 837 | dayLabel->hide(); |
836 | dayLabel = mDayLabelsList.next(); | 838 | dayLabel = mDayLabelsList.next(); |
837 | } | 839 | } |
838 | } | 840 | } |
839 | 841 | ||
840 | mDayLabelsFrame->setFixedHeight( newHight + 4 ); | 842 | mDayLabelsFrame->setFixedHeight( newHight + 4 ); |
841 | } | 843 | } |
842 | 844 | ||
843 | int KOAgendaView::maxDatesHint() | 845 | int KOAgendaView::maxDatesHint() |
844 | { | 846 | { |
845 | // Not sure about the max number of events, so return 0 for now. | 847 | // Not sure about the max number of events, so return 0 for now. |
846 | return 0; | 848 | return 0; |
847 | } | 849 | } |
848 | 850 | ||
849 | int KOAgendaView::currentDateCount() | 851 | int KOAgendaView::currentDateCount() |
850 | { | 852 | { |
851 | return mSelectedDates.count(); | 853 | return mSelectedDates.count(); |
852 | } | 854 | } |
853 | 855 | ||
854 | QPtrList<Incidence> KOAgendaView::selectedIncidences() | 856 | QPtrList<Incidence> KOAgendaView::selectedIncidences() |
855 | { | 857 | { |
856 | QPtrList<Incidence> selected; | 858 | QPtrList<Incidence> selected; |
857 | Incidence *incidence; | 859 | Incidence *incidence; |
858 | 860 | ||
859 | incidence = mAgenda->selectedIncidence(); | 861 | incidence = mAgenda->selectedIncidence(); |
860 | if (incidence) selected.append(incidence); | 862 | if (incidence) selected.append(incidence); |
861 | 863 | ||
862 | incidence = mAllDayAgenda->selectedIncidence(); | 864 | incidence = mAllDayAgenda->selectedIncidence(); |
863 | if (incidence) selected.append(incidence); | 865 | if (incidence) selected.append(incidence); |
864 | 866 | ||
865 | return selected; | 867 | return selected; |
866 | } | 868 | } |
867 | 869 | ||
868 | DateList KOAgendaView::selectedDates() | 870 | DateList KOAgendaView::selectedDates() |
869 | { | 871 | { |
870 | DateList selected; | 872 | DateList selected; |
871 | QDate qd; | 873 | QDate qd; |
872 | 874 | ||
873 | qd = mAgenda->selectedIncidenceDate(); | 875 | qd = mAgenda->selectedIncidenceDate(); |
diff --git a/korganizer/koeditorgeneraltodo.cpp b/korganizer/koeditorgeneraltodo.cpp index a9d1ed3..a03ec52 100644 --- a/korganizer/koeditorgeneraltodo.cpp +++ b/korganizer/koeditorgeneraltodo.cpp | |||
@@ -170,103 +170,104 @@ void KOEditorGeneralTodo::initCompletion(QWidget *parent, QBoxLayout *topLayout) | |||
170 | } | 170 | } |
171 | 171 | ||
172 | void KOEditorGeneralTodo::initPriority(QWidget *parent, QBoxLayout *topLayout) | 172 | void KOEditorGeneralTodo::initPriority(QWidget *parent, QBoxLayout *topLayout) |
173 | { | 173 | { |
174 | 174 | ||
175 | QHBox* h = new QHBox ( parent ); | 175 | QHBox* h = new QHBox ( parent ); |
176 | topLayout->addWidget( h ); | 176 | topLayout->addWidget( h ); |
177 | QLabel *priorityLabel = new QLabel(i18n("Priority:"), h); | 177 | QLabel *priorityLabel = new QLabel(i18n("Priority:"), h); |
178 | // topLayout->addWidget(priorityLabel); | 178 | // topLayout->addWidget(priorityLabel); |
179 | mPriorityCombo = new QComboBox( h ); | 179 | mPriorityCombo = new QComboBox( h ); |
180 | mPriorityCombo->insertItem(i18n("1 (high)")); | 180 | mPriorityCombo->insertItem(i18n("1 (high)")); |
181 | mPriorityCombo->insertItem(i18n("2")); | 181 | mPriorityCombo->insertItem(i18n("2")); |
182 | mPriorityCombo->insertItem(i18n("3")); | 182 | mPriorityCombo->insertItem(i18n("3")); |
183 | mPriorityCombo->insertItem(i18n("4")); | 183 | mPriorityCombo->insertItem(i18n("4")); |
184 | mPriorityCombo->insertItem(i18n("5 (low)")); | 184 | mPriorityCombo->insertItem(i18n("5 (low)")); |
185 | //topLayout->addWidget(mPriorityCombo); | 185 | //topLayout->addWidget(mPriorityCombo); |
186 | } | 186 | } |
187 | 187 | ||
188 | void KOEditorGeneralTodo::initStatus(QWidget *parent,QBoxLayout *topLayout) | 188 | void KOEditorGeneralTodo::initStatus(QWidget *parent,QBoxLayout *topLayout) |
189 | { | 189 | { |
190 | QBoxLayout *statusLayout = new QHBoxLayout(topLayout); | 190 | QBoxLayout *statusLayout = new QHBoxLayout(topLayout); |
191 | 191 | ||
192 | initCompletion( parent, statusLayout ); | 192 | initCompletion( parent, statusLayout ); |
193 | 193 | ||
194 | statusLayout->addStretch( 1 ); | 194 | statusLayout->addStretch( 1 ); |
195 | 195 | ||
196 | initPriority( parent, statusLayout ); | 196 | initPriority( parent, statusLayout ); |
197 | } | 197 | } |
198 | 198 | ||
199 | void KOEditorGeneralTodo::setDefaults(QDateTime due,bool allDay) | 199 | void KOEditorGeneralTodo::setDefaults(QDateTime due,bool allDay) |
200 | { | 200 | { |
201 | 201 | ||
202 | mSummaryEdit->load(KOLocationBox::SUMMARYTODO); | 202 | mSummaryEdit->load(KOLocationBox::SUMMARYTODO); |
203 | mLocationEdit->load(KOLocationBox::LOCATION); | 203 | mLocationEdit->load(KOLocationBox::LOCATION); |
204 | KOEditorGeneral::setDefaults(allDay); | 204 | KOEditorGeneral::setDefaults(allDay); |
205 | 205 | ||
206 | mTimeButton->setChecked( !allDay ); | 206 | mTimeButton->setChecked( !allDay ); |
207 | if(mTimeButton->isChecked()) { | 207 | if(mTimeButton->isChecked()) { |
208 | mTimeButton->setEnabled(true); | 208 | mTimeButton->setEnabled(true); |
209 | } | 209 | } |
210 | else { | 210 | else { |
211 | mTimeButton->setEnabled(false); | 211 | mTimeButton->setEnabled(false); |
212 | } | 212 | } |
213 | 213 | ||
214 | enableTimeEdits( !allDay ); | 214 | enableTimeEdits( !allDay ); |
215 | if ( due.isValid() ) { | 215 | if ( due.isValid() ) { |
216 | mDueCheck->setChecked(true); | 216 | mDueCheck->setChecked(true); |
217 | enableDueEdit(true); | 217 | enableDueEdit(true); |
218 | alarmDisable(false); | ||
218 | } else { | 219 | } else { |
219 | mDueCheck->setChecked(false); | 220 | mDueCheck->setChecked(false); |
220 | enableDueEdit(false); | 221 | enableDueEdit(false); |
221 | due = QDateTime::currentDateTime().addDays(7); | 222 | due = QDateTime::currentDateTime().addDays(7); |
223 | alarmDisable(true); | ||
222 | } | 224 | } |
223 | 225 | ||
224 | alarmDisable(true); | ||
225 | 226 | ||
226 | mStartCheck->setChecked(false); | 227 | mStartCheck->setChecked(false); |
227 | enableStartEdit(false); | 228 | enableStartEdit(false); |
228 | 229 | ||
229 | mDueDateEdit->setDate(due.date()); | 230 | mDueDateEdit->setDate(due.date()); |
230 | mDueTimeEdit->setTime(due.time()); | 231 | mDueTimeEdit->setTime(due.time()); |
231 | due = due.addDays(-7); | 232 | due = due.addDays(-7); |
232 | mStartDateEdit->setDate(due.date()); | 233 | mStartDateEdit->setDate(due.date()); |
233 | mStartTimeEdit->setTime(due.time()); | 234 | mStartTimeEdit->setTime(due.time()); |
234 | 235 | ||
235 | mPriorityCombo->setCurrentItem(2); | 236 | mPriorityCombo->setCurrentItem(2); |
236 | mCompletedLabel->setText(i18n(" completed"));; | 237 | mCompletedLabel->setText(i18n(" completed"));; |
237 | mCompletedCombo->setCurrentItem(0); | 238 | mCompletedCombo->setCurrentItem(0); |
238 | mCompleteDateEdit->hide(); | 239 | mCompleteDateEdit->hide(); |
239 | mCompleteTimeEdit->hide(); | 240 | mCompleteTimeEdit->hide(); |
240 | } | 241 | } |
241 | 242 | ||
242 | void KOEditorGeneralTodo::readTodo(Todo *todo) | 243 | void KOEditorGeneralTodo::readTodo(Todo *todo) |
243 | { | 244 | { |
244 | 245 | ||
245 | mSummaryEdit->load(KOLocationBox::SUMMARYTODO); | 246 | mSummaryEdit->load(KOLocationBox::SUMMARYTODO); |
246 | mLocationEdit->load(KOLocationBox::LOCATION); | 247 | mLocationEdit->load(KOLocationBox::LOCATION); |
247 | KOEditorGeneral::readIncidence(todo); | 248 | KOEditorGeneral::readIncidence(todo); |
248 | 249 | ||
249 | QDateTime dueDT; | 250 | QDateTime dueDT; |
250 | 251 | ||
251 | if (todo->hasDueDate()) { | 252 | if (todo->hasDueDate()) { |
252 | enableAlarmEdit(true); | 253 | enableAlarmEdit(true); |
253 | dueDT = todo->dtDue(); | 254 | dueDT = todo->dtDue(); |
254 | mDueDateEdit->setDate(todo->dtDue().date()); | 255 | mDueDateEdit->setDate(todo->dtDue().date()); |
255 | mDueTimeEdit->setTime(todo->dtDue().time()); | 256 | mDueTimeEdit->setTime(todo->dtDue().time()); |
256 | mDueCheck->setChecked(true); | 257 | mDueCheck->setChecked(true); |
257 | } else { | 258 | } else { |
258 | alarmDisable(true); | 259 | alarmDisable(true); |
259 | mDueDateEdit->setEnabled(false); | 260 | mDueDateEdit->setEnabled(false); |
260 | mDueTimeEdit->setEnabled(false); | 261 | mDueTimeEdit->setEnabled(false); |
261 | mDueDateEdit->setDate(QDate::currentDate()); | 262 | mDueDateEdit->setDate(QDate::currentDate()); |
262 | mDueTimeEdit->setTime(QTime::currentTime()); | 263 | mDueTimeEdit->setTime(QTime::currentTime()); |
263 | mDueCheck->setChecked(false); | 264 | mDueCheck->setChecked(false); |
264 | } | 265 | } |
265 | 266 | ||
266 | if (todo->hasStartDate()) { | 267 | if (todo->hasStartDate()) { |
267 | mStartDateEdit->setDate(todo->dtStart().date()); | 268 | mStartDateEdit->setDate(todo->dtStart().date()); |
268 | mStartTimeEdit->setTime(todo->dtStart().time()); | 269 | mStartTimeEdit->setTime(todo->dtStart().time()); |
269 | mStartCheck->setChecked(true); | 270 | mStartCheck->setChecked(true); |
270 | } else { | 271 | } else { |
271 | mStartDateEdit->setEnabled(false); | 272 | mStartDateEdit->setEnabled(false); |
272 | mStartTimeEdit->setEnabled(false); | 273 | mStartTimeEdit->setEnabled(false); |
diff --git a/korganizer/navigatorbar.cpp b/korganizer/navigatorbar.cpp index eca7c14..49149f2 100644 --- a/korganizer/navigatorbar.cpp +++ b/korganizer/navigatorbar.cpp | |||
@@ -106,96 +106,102 @@ NavigatorBar::NavigatorBar( const QDate & date, QWidget *parent, const char *nam | |||
106 | //mDateLabel->setFont( tfont ); | 106 | //mDateLabel->setFont( tfont ); |
107 | //mDateLabel->setAlignment( AlignCenter ); | 107 | //mDateLabel->setAlignment( AlignCenter ); |
108 | if ( QString ( name ) == QString("useBigPixmaps") ) { | 108 | if ( QString ( name ) == QString("useBigPixmaps") ) { |
109 | mNextMonth->setFlat( true); | 109 | mNextMonth->setFlat( true); |
110 | mNextWeek->setFlat( true); | 110 | mNextWeek->setFlat( true); |
111 | mNextYear->setFlat( true); | 111 | mNextYear->setFlat( true); |
112 | mSelectMonth->setFlat( true); | 112 | mSelectMonth->setFlat( true); |
113 | mPrevYear->setFlat( true); | 113 | mPrevYear->setFlat( true); |
114 | mPrevMonth->setFlat( true); | 114 | mPrevMonth->setFlat( true); |
115 | mPrevWeek->setFlat( true); | 115 | mPrevWeek->setFlat( true); |
116 | } else { | 116 | } else { |
117 | mPrevWeek->hide(); | 117 | mPrevWeek->hide(); |
118 | mNextWeek->hide(); | 118 | mNextWeek->hide(); |
119 | } | 119 | } |
120 | 120 | ||
121 | resetFont( font() ); | 121 | resetFont( font() ); |
122 | 122 | ||
123 | 123 | ||
124 | // set up control frame layout | 124 | // set up control frame layout |
125 | QBoxLayout *ctrlLayout = new QHBoxLayout( mCtrlFrame, 1 ); | 125 | QBoxLayout *ctrlLayout = new QHBoxLayout( mCtrlFrame, 1 ); |
126 | ctrlLayout->addWidget( mPrevYear, 3 ); | 126 | ctrlLayout->addWidget( mPrevYear, 3 ); |
127 | ctrlLayout->addWidget( mPrevMonth, 3 ); | 127 | ctrlLayout->addWidget( mPrevMonth, 3 ); |
128 | ctrlLayout->addWidget( mPrevWeek, 3 ); | 128 | ctrlLayout->addWidget( mPrevWeek, 3 ); |
129 | //ctrlLayout->addStretch( 1 ); | 129 | //ctrlLayout->addStretch( 1 ); |
130 | // ctrlLayout->addSpacing( 1 ); | 130 | // ctrlLayout->addSpacing( 1 ); |
131 | // ctrlLayout->addWidget( mDateLabel ); | 131 | // ctrlLayout->addWidget( mDateLabel ); |
132 | ctrlLayout->addWidget( mSelectMonth ); | 132 | ctrlLayout->addWidget( mSelectMonth ); |
133 | // ctrlLayout->addSpacing( 1 ); | 133 | // ctrlLayout->addSpacing( 1 ); |
134 | // ctrlLayout->addStretch( 1 ); | 134 | // ctrlLayout->addStretch( 1 ); |
135 | ctrlLayout->addWidget( mNextWeek, 3 ); | 135 | ctrlLayout->addWidget( mNextWeek, 3 ); |
136 | ctrlLayout->addWidget( mNextMonth, 3 ); | 136 | ctrlLayout->addWidget( mNextMonth, 3 ); |
137 | ctrlLayout->addWidget( mNextYear, 3 ); | 137 | ctrlLayout->addWidget( mNextYear, 3 ); |
138 | 138 | ||
139 | connect( mPrevYear, SIGNAL( clicked() ), SIGNAL( goPrevYear() ) ); | 139 | connect( mPrevYear, SIGNAL( clicked() ), SIGNAL( goPrevYear() ) ); |
140 | connect( mPrevMonth, SIGNAL( clicked() ), SIGNAL( goPrevMonth() ) ); | 140 | connect( mPrevMonth, SIGNAL( clicked() ), SIGNAL( goPrevMonth() ) ); |
141 | connect( mNextMonth, SIGNAL( clicked() ), SIGNAL( goNextMonth() ) ); | 141 | connect( mNextMonth, SIGNAL( clicked() ), SIGNAL( goNextMonth() ) ); |
142 | connect( mPrevWeek, SIGNAL( clicked() ), SIGNAL( goPrevWeek() ) ); | 142 | connect( mPrevWeek, SIGNAL( clicked() ), SIGNAL( goPrevWeek() ) ); |
143 | connect( mNextWeek, SIGNAL( clicked() ), SIGNAL( goNextWeek() ) ); | 143 | connect( mNextWeek, SIGNAL( clicked() ), SIGNAL( goNextWeek() ) ); |
144 | connect( mNextYear, SIGNAL( clicked() ), SIGNAL( goNextYear() ) ); | 144 | connect( mNextYear, SIGNAL( clicked() ), SIGNAL( goNextYear() ) ); |
145 | connect( mSelectMonth, SIGNAL( clicked() ),SLOT( selectMonth() ) ); | 145 | connect( mSelectMonth, SIGNAL( clicked() ),SLOT( selectMonth() ) ); |
146 | mPrevYear->setFocusPolicy(NoFocus); | 146 | mPrevYear->setFocusPolicy(NoFocus); |
147 | mPrevMonth->setFocusPolicy(NoFocus); | 147 | mPrevMonth->setFocusPolicy(NoFocus); |
148 | mNextMonth->setFocusPolicy(NoFocus); | 148 | mNextMonth->setFocusPolicy(NoFocus); |
149 | mPrevWeek->setFocusPolicy(NoFocus); | 149 | mPrevWeek->setFocusPolicy(NoFocus); |
150 | mNextWeek->setFocusPolicy(NoFocus); | 150 | mNextWeek->setFocusPolicy(NoFocus); |
151 | mNextYear->setFocusPolicy(NoFocus); | 151 | mNextYear->setFocusPolicy(NoFocus); |
152 | mSelectMonth->setFocusPolicy(NoFocus); | 152 | mSelectMonth->setFocusPolicy(NoFocus); |
153 | setSizePolicy( QSizePolicy ( QSizePolicy::Expanding ,QSizePolicy::Fixed ) ); | 153 | setSizePolicy( QSizePolicy ( QSizePolicy::Expanding ,QSizePolicy::Fixed ) ); |
154 | mPrevYear->setAutoRepeat( true ); | ||
155 | mPrevMonth->setAutoRepeat( true ); | ||
156 | mNextMonth->setAutoRepeat( true ); | ||
157 | mPrevWeek->setAutoRepeat( true ); | ||
158 | mNextWeek->setAutoRepeat( true ); | ||
159 | mNextYear->setAutoRepeat( true ); | ||
154 | 160 | ||
155 | } | 161 | } |
156 | 162 | ||
157 | NavigatorBar::~NavigatorBar() | 163 | NavigatorBar::~NavigatorBar() |
158 | { | 164 | { |
159 | } | 165 | } |
160 | QSize NavigatorBar::sizeHint() const | 166 | QSize NavigatorBar::sizeHint() const |
161 | { | 167 | { |
162 | int wid = mCurrentMinWid ; | 168 | int wid = mCurrentMinWid ; |
163 | if ( mPrevYear->isVisible() ) | 169 | if ( mPrevYear->isVisible() ) |
164 | wid += mCurrentButtonMinWid; | 170 | wid += mCurrentButtonMinWid; |
165 | if ( mPrevMonth->isVisible() ) | 171 | if ( mPrevMonth->isVisible() ) |
166 | wid += mCurrentButtonMinWid; | 172 | wid += mCurrentButtonMinWid; |
167 | if ( mPrevWeek->isVisible() ) | 173 | if ( mPrevWeek->isVisible() ) |
168 | wid += mCurrentButtonMinWid; | 174 | wid += mCurrentButtonMinWid; |
169 | if ( mNextMonth->isVisible() ) | 175 | if ( mNextMonth->isVisible() ) |
170 | wid += mCurrentButtonMinWid; | 176 | wid += mCurrentButtonMinWid; |
171 | if ( mNextWeek->isVisible() ) | 177 | if ( mNextWeek->isVisible() ) |
172 | wid += mCurrentButtonMinWid; | 178 | wid += mCurrentButtonMinWid; |
173 | if ( mNextYear->isVisible() ) | 179 | if ( mNextYear->isVisible() ) |
174 | wid += mCurrentButtonMinWid; | 180 | wid += mCurrentButtonMinWid; |
175 | //qDebug("ret %d %d ", wid, mCurrentHei); | 181 | //qDebug("ret %d %d ", wid, mCurrentHei); |
176 | return QSize ( wid, mCurrentHei ); | 182 | return QSize ( wid, mCurrentHei ); |
177 | } | 183 | } |
178 | QSize NavigatorBar::sizeHintTwoButtons( int butNum ) const | 184 | QSize NavigatorBar::sizeHintTwoButtons( int butNum ) const |
179 | { | 185 | { |
180 | return QSize ( mCurrentMinWid + butNum * mCurrentButtonMinWid , mCurrentHei ); | 186 | return QSize ( mCurrentMinWid + butNum * mCurrentButtonMinWid , mCurrentHei ); |
181 | } | 187 | } |
182 | void NavigatorBar::resetFont ( QFont fo ) | 188 | void NavigatorBar::resetFont ( QFont fo ) |
183 | { | 189 | { |
184 | 190 | ||
185 | QFont tfont = fo; | 191 | QFont tfont = fo; |
186 | if ( QApplication::desktop()->width() >= 480 ) | 192 | if ( QApplication::desktop()->width() >= 480 ) |
187 | tfont.setPointSize(tfont.pointSize()+2); | 193 | tfont.setPointSize(tfont.pointSize()+2); |
188 | tfont.setBold(true); | 194 | tfont.setBold(true); |
189 | 195 | ||
190 | mSelectMonth->setFont( tfont ); | 196 | mSelectMonth->setFont( tfont ); |
191 | // Set minimum width to width of widest month name label | 197 | // Set minimum width to width of widest month name label |
192 | int i; | 198 | int i; |
193 | int maxwidth = 0; | 199 | int maxwidth = 0; |
194 | QFontMetrics fm ( mSelectMonth->font() ); | 200 | QFontMetrics fm ( mSelectMonth->font() ); |
195 | int width = fm.width("September '00" ); | 201 | int width = fm.width("September '00" ); |
196 | maxwidth = width+2; | 202 | maxwidth = width+2; |
197 | int size = fm.height()+2; | 203 | int size = fm.height()+2; |
198 | if ( QApplication::desktop()->width() >= 480 ) { | 204 | if ( QApplication::desktop()->width() >= 480 ) { |
199 | size += 6; | 205 | size += 6; |
200 | maxwidth+= 6; | 206 | maxwidth+= 6; |
201 | } | 207 | } |