summaryrefslogtreecommitdiffabout
path: root/korganizer
authorzautrix <zautrix>2005-03-30 23:17:42 (UTC)
committer zautrix <zautrix>2005-03-30 23:17:42 (UTC)
commit529c0fb8a8bf15e7bd375ddeb355c5802baf4c93 (patch) (unidiff)
tree72ebca6de7e54f2cf89d3d6df61d3b40aa66a444 /korganizer
parent28ac86e2efbc10f210dbd2d5ac0053f4e6198d57 (diff)
downloadkdepimpi-529c0fb8a8bf15e7bd375ddeb355c5802baf4c93.zip
kdepimpi-529c0fb8a8bf15e7bd375ddeb355c5802baf4c93.tar.gz
kdepimpi-529c0fb8a8bf15e7bd375ddeb355c5802baf4c93.tar.bz2
key fix
Diffstat (limited to 'korganizer') (more/less context) (ignore whitespace changes)
-rw-r--r--korganizer/komonthview.cpp19
-rw-r--r--korganizer/komonthview.h3
-rw-r--r--korganizer/mainwindow.cpp26
-rw-r--r--korganizer/mainwindow.h1
4 files changed, 46 insertions, 3 deletions
diff --git a/korganizer/komonthview.cpp b/korganizer/komonthview.cpp
index ca35a86..b9ce4f4 100644
--- a/korganizer/komonthview.cpp
+++ b/korganizer/komonthview.cpp
@@ -619,768 +619,769 @@ void MonthViewCell::insertEvent(Event *event)
619 mToolTipText += prefix + text; 619 mToolTipText += prefix + text;
620 } else { 620 } else {
621 if (event->doesFloat()) { 621 if (event->doesFloat()) {
622 text = event->summary(); 622 text = event->summary();
623 mToolTipText += text; 623 mToolTipText += text;
624 } 624 }
625 else { 625 else {
626 text = KGlobal::locale()->formatTime(event->dtStart().time()); 626 text = KGlobal::locale()->formatTime(event->dtStart().time());
627 text += " " + event->summary(); 627 text += " " + event->summary();
628 mToolTipText += KGlobal::locale()->formatTime(event->dtStart().time()) +"-"+KGlobal::locale()->formatTime(event->dtEnd().time())+" " + event->summary(); 628 mToolTipText += KGlobal::locale()->formatTime(event->dtStart().time()) +"-"+KGlobal::locale()->formatTime(event->dtEnd().time())+" " + event->summary();
629 } 629 }
630 } 630 }
631 MonthViewItem *item ; 631 MonthViewItem *item ;
632 if ( mCurrentAvailItem ) { 632 if ( mCurrentAvailItem ) {
633 item = mCurrentAvailItem; 633 item = mCurrentAvailItem;
634 mCurrentAvailItem = (MonthViewItem*) item->next(); 634 mCurrentAvailItem = (MonthViewItem*) item->next();
635 item->recycle( event, mDate, text ); 635 item->recycle( event, mDate, text );
636 } else { 636 } else {
637 if ( mAvailItemList.count() ) { 637 if ( mAvailItemList.count() ) {
638 item = mAvailItemList.first(); 638 item = mAvailItemList.first();
639 mAvailItemList.remove( item ); 639 mAvailItemList.remove( item );
640 item->recycle( event, mDate, text ); 640 item->recycle( event, mDate, text );
641 insertNewItem = true; 641 insertNewItem = true;
642 } else { 642 } else {
643 insertNewItem = true; 643 insertNewItem = true;
644 item = new MonthViewItem( event, mDate, text ); 644 item = new MonthViewItem( event, mDate, text );
645 } 645 }
646 } 646 }
647 QPalette pal; 647 QPalette pal;
648 if (KOPrefs::instance()->mMonthViewUsesCategoryColor) { 648 if (KOPrefs::instance()->mMonthViewUsesCategoryColor) {
649 QStringList categories = event->categories(); 649 QStringList categories = event->categories();
650 QString cat = categories.first(); 650 QString cat = categories.first();
651 if ( KOPrefs::instance()->mMonthViewUsesForegroundColor ) { 651 if ( KOPrefs::instance()->mMonthViewUsesForegroundColor ) {
652 pal = getPalette(); 652 pal = getPalette();
653 if (cat.isEmpty()) { 653 if (cat.isEmpty()) {
654 pal.setColor(QColorGroup::Foreground,KOPrefs::instance()->mEventColor); 654 pal.setColor(QColorGroup::Foreground,KOPrefs::instance()->mEventColor);
655 } else { 655 } else {
656 pal.setColor(QColorGroup::Foreground, *(KOPrefs::instance()->categoryColor(cat))); 656 pal.setColor(QColorGroup::Foreground, *(KOPrefs::instance()->categoryColor(cat)));
657 } 657 }
658 658
659 } else { 659 } else {
660 if (cat.isEmpty()) { 660 if (cat.isEmpty()) {
661 pal = QPalette(KOPrefs::instance()->mEventColor, KOPrefs::instance()->mEventColor); 661 pal = QPalette(KOPrefs::instance()->mEventColor, KOPrefs::instance()->mEventColor);
662 } else { 662 } else {
663 pal = QPalette(*(KOPrefs::instance()->categoryColor(cat)), *(KOPrefs::instance()->categoryColor(cat))); 663 pal = QPalette(*(KOPrefs::instance()->categoryColor(cat)), *(KOPrefs::instance()->categoryColor(cat)));
664 } 664 }
665 } 665 }
666 666
667 } else { 667 } else {
668 pal = mStandardPalette ; 668 pal = mStandardPalette ;
669 } 669 }
670 item->setPalette( pal ); 670 item->setPalette( pal );
671 item->setRecur( event->recurrence()->doesRecur() ); 671 item->setRecur( event->recurrence()->doesRecur() );
672 item->setAlarm( event->isAlarmEnabled() && multiday < 2 ); 672 item->setAlarm( event->isAlarmEnabled() && multiday < 2 );
673 item->setMoreInfo( event->description().length() > 0 ); 673 item->setMoreInfo( event->description().length() > 0 );
674#ifdef DESKTOP_VERSION 674#ifdef DESKTOP_VERSION
675 Attendee *me = event->attendeeByMails(KOPrefs::instance()->mAdditionalMails, 675 Attendee *me = event->attendeeByMails(KOPrefs::instance()->mAdditionalMails,
676 KOPrefs::instance()->email()); 676 KOPrefs::instance()->email());
677 if ( me != 0 ) { 677 if ( me != 0 ) {
678 if ( me->status() == Attendee::NeedsAction && me->RSVP()) 678 if ( me->status() == Attendee::NeedsAction && me->RSVP())
679 item->setReply(true && multiday < 2); 679 item->setReply(true && multiday < 2);
680 else 680 else
681 item->setReply(false); 681 item->setReply(false);
682 } else 682 } else
683 item->setReply(false); 683 item->setReply(false);
684#endif 684#endif
685 item->setMultiDay( multiday ); 685 item->setMultiDay( multiday );
686 if ( insertNewItem) 686 if ( insertNewItem)
687 insertItem( item ); 687 insertItem( item );
688 mToolTip.append( mToolTipText ); 688 mToolTip.append( mToolTipText );
689} 689}
690void MonthViewCell::insertTodo(Todo *todo) 690void MonthViewCell::insertTodo(Todo *todo)
691{ 691{
692 bool insertNewItem = false; 692 bool insertNewItem = false;
693 setFocusPolicy(WheelFocus); 693 setFocusPolicy(WheelFocus);
694 QString text; 694 QString text;
695 if (todo->hasDueDate()) { 695 if (todo->hasDueDate()) {
696 if (!todo->doesFloat()) { 696 if (!todo->doesFloat()) {
697 text += KGlobal::locale()->formatTime(todo->dtDue().time()); 697 text += KGlobal::locale()->formatTime(todo->dtDue().time());
698 text += " "; 698 text += " ";
699 } 699 }
700 } 700 }
701 text += todo->summary(); 701 text += todo->summary();
702 MonthViewItem *item ; 702 MonthViewItem *item ;
703 if ( mCurrentAvailItem ) { 703 if ( mCurrentAvailItem ) {
704 item = mCurrentAvailItem; 704 item = mCurrentAvailItem;
705 mCurrentAvailItem = (MonthViewItem*) item->next(); 705 mCurrentAvailItem = (MonthViewItem*) item->next();
706 item->recycle( todo, mDate, text ); 706 item->recycle( todo, mDate, text );
707 } else { 707 } else {
708 if ( mAvailItemList.count() ) { 708 if ( mAvailItemList.count() ) {
709 item = mAvailItemList.first(); 709 item = mAvailItemList.first();
710 mAvailItemList.remove( item ); 710 mAvailItemList.remove( item );
711 item->recycle( todo, mDate, text ); 711 item->recycle( todo, mDate, text );
712 insertNewItem = true; 712 insertNewItem = true;
713 } else { 713 } else {
714 insertNewItem = true; 714 insertNewItem = true;
715 item = new MonthViewItem( todo, mDate, text ); 715 item = new MonthViewItem( todo, mDate, text );
716 } 716 }
717 } 717 }
718 //MonthViewItem *item = new MonthViewItem( todo, mDate, text ); 718 //MonthViewItem *item = new MonthViewItem( todo, mDate, text );
719 //item->setPalette( mStandardPalette ); 719 //item->setPalette( mStandardPalette );
720 QPalette pal; 720 QPalette pal;
721 if (KOPrefs::instance()->mMonthViewUsesCategoryColor) { 721 if (KOPrefs::instance()->mMonthViewUsesCategoryColor) {
722 QStringList categories = todo->categories(); 722 QStringList categories = todo->categories();
723 QString cat = categories.first(); 723 QString cat = categories.first();
724 if ( KOPrefs::instance()->mMonthViewUsesForegroundColor ) { 724 if ( KOPrefs::instance()->mMonthViewUsesForegroundColor ) {
725 pal = getPalette(); 725 pal = getPalette();
726 if (cat.isEmpty()) { 726 if (cat.isEmpty()) {
727 pal.setColor(QColorGroup::Foreground,KOPrefs::instance()->mEventColor); 727 pal.setColor(QColorGroup::Foreground,KOPrefs::instance()->mEventColor);
728 } else { 728 } else {
729 pal.setColor(QColorGroup::Foreground, *(KOPrefs::instance()->categoryColor(cat))); 729 pal.setColor(QColorGroup::Foreground, *(KOPrefs::instance()->categoryColor(cat)));
730 } 730 }
731 731
732 } else { 732 } else {
733 if (cat.isEmpty()) { 733 if (cat.isEmpty()) {
734 pal = QPalette(KOPrefs::instance()->mEventColor, KOPrefs::instance()->mEventColor); 734 pal = QPalette(KOPrefs::instance()->mEventColor, KOPrefs::instance()->mEventColor);
735 } else { 735 } else {
736 pal = QPalette(*(KOPrefs::instance()->categoryColor(cat)), *(KOPrefs::instance()->categoryColor(cat))); 736 pal = QPalette(*(KOPrefs::instance()->categoryColor(cat)), *(KOPrefs::instance()->categoryColor(cat)));
737 } 737 }
738 } 738 }
739 739
740 } else { 740 } else {
741 pal = mStandardPalette ; 741 pal = mStandardPalette ;
742 } 742 }
743 item->setPalette( pal ); 743 item->setPalette( pal );
744 item->setRecur( todo->recurrence()->doesRecur() ); 744 item->setRecur( todo->recurrence()->doesRecur() );
745 item->setAlarm( todo->isAlarmEnabled() ); 745 item->setAlarm( todo->isAlarmEnabled() );
746 item->setMoreInfo( todo->description().length() > 0 ); 746 item->setMoreInfo( todo->description().length() > 0 );
747 if ( insertNewItem) 747 if ( insertNewItem)
748 insertItem( item ); 748 insertItem( item );
749 mToolTip.append( text ); 749 mToolTip.append( text );
750} 750}
751void MonthViewCell::repaintfinishUpdateCell() 751void MonthViewCell::repaintfinishUpdateCell()
752{ 752{
753 MonthViewItem *mitem = (MonthViewItem*) firstItem (); 753 MonthViewItem *mitem = (MonthViewItem*) firstItem ();
754 while ( mitem ) { 754 while ( mitem ) {
755 mitem->setBlockRepaint( false ); 755 mitem->setBlockRepaint( false );
756 updateItem ( mitem ); 756 updateItem ( mitem );
757 mitem = (MonthViewItem *)mitem->next(); 757 mitem = (MonthViewItem *)mitem->next();
758 } 758 }
759} 759}
760void MonthViewCell::finishUpdateCell() 760void MonthViewCell::finishUpdateCell()
761{ 761{
762 while ( mCurrentAvailItem ) { 762 while ( mCurrentAvailItem ) {
763 MonthViewItem *item = mCurrentAvailItem; 763 MonthViewItem *item = mCurrentAvailItem;
764 mCurrentAvailItem = (MonthViewItem *)item->next(); 764 mCurrentAvailItem = (MonthViewItem *)item->next();
765 mAvailItemList.append( item ); 765 mAvailItemList.append( item );
766 takeItem ( item ); 766 takeItem ( item );
767 } 767 }
768 768
769 769
770#ifdef DESKTOP_VERSION 770#ifdef DESKTOP_VERSION
771 if (mToolTip.count() > 0 ) { 771 if (mToolTip.count() > 0 ) {
772 mToolTip.sort(); 772 mToolTip.sort();
773 QToolTip::add(this,mToolTip.join("\n"),toolTipGroup(),""); 773 QToolTip::add(this,mToolTip.join("\n"),toolTipGroup(),"");
774 } 774 }
775#endif 775#endif
776 sort(); 776 sort();
777 //setMyPalette(); 777 //setMyPalette();
778 setMyPalette(); 778 setMyPalette();
779 779
780 resizeEvent( 0 ); 780 resizeEvent( 0 );
781 781
782} 782}
783void MonthViewCell::updateCell() 783void MonthViewCell::updateCell()
784{ 784{
785 //qDebug("MonthViewCell::updateCell() "); 785 //qDebug("MonthViewCell::updateCell() ");
786 if ( !mMonthView->isUpdatePossible() ) 786 if ( !mMonthView->isUpdatePossible() )
787 return; 787 return;
788 startUpdateCell(); 788 startUpdateCell();
789 //mLabel->setMaximumWidth( width() - mItemList->lineWidth()*2); 789 //mLabel->setMaximumWidth( width() - mItemList->lineWidth()*2);
790 QPtrList<Event> events = mMonthView->calendar()->events( mDate, true ); 790 QPtrList<Event> events = mMonthView->calendar()->events( mDate, true );
791 Event *event; 791 Event *event;
792 for( event = events.first(); event; event = events.next() ) { // for event 792 for( event = events.first(); event; event = events.next() ) { // for event
793 insertEvent(event); 793 insertEvent(event);
794 } 794 }
795 // insert due todos 795 // insert due todos
796 QPtrList<Todo> todos = mMonthView->calendar()->todos( mDate ); 796 QPtrList<Todo> todos = mMonthView->calendar()->todos( mDate );
797 Todo *todo; 797 Todo *todo;
798 for(todo = todos.first(); todo; todo = todos.next()) { 798 for(todo = todos.first(); todo; todo = todos.next()) {
799 insertTodo( todo ); 799 insertTodo( todo );
800 } 800 }
801 finishUpdateCell(); 801 finishUpdateCell();
802 // if ( isVisible()) 802 // if ( isVisible())
803 //qApp->processEvents(); 803 //qApp->processEvents();
804} 804}
805 805
806void MonthViewCell::updateConfig( bool bigFont ) // = false 806void MonthViewCell::updateConfig( bool bigFont ) // = false
807{ 807{
808 808
809 if ( bigFont ) { 809 if ( bigFont ) {
810 QFont fo = KOPrefs::instance()->mMonthViewFont; 810 QFont fo = KOPrefs::instance()->mMonthViewFont;
811 int ps = fo.pointSize() + 2; 811 int ps = fo.pointSize() + 2;
812 if ( ps < 18 ) 812 if ( ps < 18 )
813 ps += 2; 813 ps += 2;
814 fo.setPointSize( ps ); 814 fo.setPointSize( ps );
815 setFont( fo ); 815 setFont( fo );
816 } else 816 } else
817 setFont( KOPrefs::instance()->mMonthViewFont ); 817 setFont( KOPrefs::instance()->mMonthViewFont );
818 818
819 QFontMetrics fm( font() ); 819 QFontMetrics fm( font() );
820 mLabelSize = fm.size( 0, "30" ) + QSize( 4, 2 ); 820 mLabelSize = fm.size( 0, "30" ) + QSize( 4, 2 );
821 mLabelBigSize = fm.size( 0, "Mag 30" ) + QSize( 2, 2 ); 821 mLabelBigSize = fm.size( 0, "Mag 30" ) + QSize( 2, 2 );
822 mHolidayPalette = mStandardPalette; 822 mHolidayPalette = mStandardPalette;
823 mPrimaryPalette = mStandardPalette; 823 mPrimaryPalette = mStandardPalette;
824 mNonPrimaryPalette = mStandardPalette; 824 mNonPrimaryPalette = mStandardPalette;
825 if ( KOPrefs::instance()->mMonthViewUsesDayColors ) { 825 if ( KOPrefs::instance()->mMonthViewUsesDayColors ) {
826 mHolidayPalette.setColor(QColorGroup::Base, KOPrefs::instance()->mMonthViewHolidayColor ); 826 mHolidayPalette.setColor(QColorGroup::Base, KOPrefs::instance()->mMonthViewHolidayColor );
827 mHolidayPalette.setColor(QColorGroup::Background, KOPrefs::instance()->mMonthViewHolidayColor ); 827 mHolidayPalette.setColor(QColorGroup::Background, KOPrefs::instance()->mMonthViewHolidayColor );
828 mHolidayPalette.setColor(QColorGroup::Foreground, KOPrefs::instance()->mMonthViewHolidayColor.dark()); 828 mHolidayPalette.setColor(QColorGroup::Foreground, KOPrefs::instance()->mMonthViewHolidayColor.dark());
829 mPrimaryPalette.setColor(QColorGroup::Foreground,KOPrefs::instance()->mMonthViewOddColor.dark()); 829 mPrimaryPalette.setColor(QColorGroup::Foreground,KOPrefs::instance()->mMonthViewOddColor.dark());
830 mPrimaryPalette.setColor(QColorGroup::Base,KOPrefs::instance()->mMonthViewOddColor); 830 mPrimaryPalette.setColor(QColorGroup::Base,KOPrefs::instance()->mMonthViewOddColor);
831 mPrimaryPalette.setColor(QColorGroup::Background,KOPrefs::instance()->mMonthViewOddColor); 831 mPrimaryPalette.setColor(QColorGroup::Background,KOPrefs::instance()->mMonthViewOddColor);
832 mNonPrimaryPalette.setColor(QColorGroup::Foreground,KOPrefs::instance()->mMonthViewEvenColor.dark()); 832 mNonPrimaryPalette.setColor(QColorGroup::Foreground,KOPrefs::instance()->mMonthViewEvenColor.dark());
833 mNonPrimaryPalette.setColor(QColorGroup::Base,KOPrefs::instance()->mMonthViewEvenColor); 833 mNonPrimaryPalette.setColor(QColorGroup::Base,KOPrefs::instance()->mMonthViewEvenColor);
834 mNonPrimaryPalette.setColor(QColorGroup::Background,KOPrefs::instance()->mMonthViewEvenColor); 834 mNonPrimaryPalette.setColor(QColorGroup::Background,KOPrefs::instance()->mMonthViewEvenColor);
835 } 835 }
836 //updateCell(); 836 //updateCell();
837} 837}
838 838
839void MonthViewCell::enableScrollBars( bool enabled ) 839void MonthViewCell::enableScrollBars( bool enabled )
840{ 840{
841 if ( enabled ) { 841 if ( enabled ) {
842 QListBoxItem *fi = firstItem (); 842 QListBoxItem *fi = firstItem ();
843 if (fi ) { 843 if (fi ) {
844 int ihei = fi->height( this ); 844 int ihei = fi->height( this );
845 int hei = numRows () * ihei; 845 int hei = numRows () * ihei;
846 if ( hei < height() - horizontalScrollBar()->height () ) { 846 if ( hei < height() - horizontalScrollBar()->height () ) {
847 setVScrollBarMode(QScrollView::AlwaysOff); 847 setVScrollBarMode(QScrollView::AlwaysOff);
848 } 848 }
849 else 849 else
850 setVScrollBarMode(QScrollView::Auto); 850 setVScrollBarMode(QScrollView::Auto);
851 if ( ihei *3 > height() ) 851 if ( ihei *3 > height() )
852 setHScrollBarMode(QScrollView::AlwaysOff); 852 setHScrollBarMode(QScrollView::AlwaysOff);
853 else 853 else
854 setHScrollBarMode(QScrollView::Auto); 854 setHScrollBarMode(QScrollView::Auto);
855 } else { 855 } else {
856 setVScrollBarMode(QScrollView::Auto); 856 setVScrollBarMode(QScrollView::Auto);
857 setHScrollBarMode(QScrollView::Auto); 857 setHScrollBarMode(QScrollView::Auto);
858 } 858 }
859 } else { 859 } else {
860 setVScrollBarMode(QScrollView::AlwaysOff); 860 setVScrollBarMode(QScrollView::AlwaysOff);
861 setHScrollBarMode(QScrollView::AlwaysOff); 861 setHScrollBarMode(QScrollView::AlwaysOff);
862 } 862 }
863} 863}
864 864
865Incidence *MonthViewCell::selectedIncidence() 865Incidence *MonthViewCell::selectedIncidence()
866{ 866{
867 int index = currentItem(); 867 int index = currentItem();
868 if ( index < 0 ) return 0; 868 if ( index < 0 ) return 0;
869 869
870 MonthViewItem *mitem = 870 MonthViewItem *mitem =
871 static_cast<MonthViewItem *>( item( index ) ); 871 static_cast<MonthViewItem *>( item( index ) );
872 872
873 if ( !mitem ) return 0; 873 if ( !mitem ) return 0;
874 874
875 return mitem->incidence(); 875 return mitem->incidence();
876} 876}
877 877
878QDate MonthViewCell::selectedIncidenceDate() 878QDate MonthViewCell::selectedIncidenceDate()
879{ 879{
880 QDate qd; 880 QDate qd;
881 int index = currentItem(); 881 int index = currentItem();
882 if ( index < 0 ) return qd; 882 if ( index < 0 ) return qd;
883 883
884 MonthViewItem *mitem = 884 MonthViewItem *mitem =
885 static_cast<MonthViewItem *>( item( index ) ); 885 static_cast<MonthViewItem *>( item( index ) );
886 886
887 if ( !mitem ) return qd; 887 if ( !mitem ) return qd;
888 888
889 return mitem->incidenceDate(); 889 return mitem->incidenceDate();
890} 890}
891 891
892void MonthViewCell::deselect() 892void MonthViewCell::deselect()
893{ 893{
894 clearSelection(); 894 clearSelection();
895 enableScrollBars( false ); 895 enableScrollBars( false );
896 // updateCell(); 896 // updateCell();
897} 897}
898void MonthViewCell::select() 898void MonthViewCell::select()
899{ 899{
900 ;// updateCell(); 900 ;// updateCell();
901} 901}
902 902
903void MonthViewCell::resizeEvent ( QResizeEvent * e ) 903void MonthViewCell::resizeEvent ( QResizeEvent * e )
904{ 904{
905 if ( !mMonthView->isUpdatePossible() ) 905 if ( !mMonthView->isUpdatePossible() )
906 return; 906 return;
907 //qDebug("++++++++++++++MonthViewCell::resizeEvent %d %d ", width(), height()); 907 //qDebug("++++++++++++++MonthViewCell::resizeEvent %d %d ", width(), height());
908 deselect(); 908 deselect();
909 mLabel->setMaximumHeight( height() - lineWidth()*2 ); 909 mLabel->setMaximumHeight( height() - lineWidth()*2 );
910 910
911 QString text; 911 QString text;
912 mLabel->setText( text ); 912 mLabel->setText( text );
913 bool smallDisplay = QApplication::desktop()->width() < 320 && KOPrefs::instance()->mMonthViewSatSunTog; 913 bool smallDisplay = QApplication::desktop()->width() < 320 && KOPrefs::instance()->mMonthViewSatSunTog;
914 if ( KOPrefs::instance()->mMonthViewWeek || KOGlobals::self()->calendarSystem()->day( mDate ) == 1 || (mDate.dayOfWeek() == 7 && !smallDisplay ) || KOPrefs::instance()->mMonthShowShort) { 914 if ( KOPrefs::instance()->mMonthViewWeek || KOGlobals::self()->calendarSystem()->day( mDate ) == 1 || (mDate.dayOfWeek() == 7 && !smallDisplay ) || KOPrefs::instance()->mMonthShowShort) {
915 text = KOGlobals::self()->calendarSystem()->monthName( mDate, true ) + " "; 915 text = KOGlobals::self()->calendarSystem()->monthName( mDate, true ) + " ";
916 mLabel->resize( mLabelBigSize ); 916 mLabel->resize( mLabelBigSize );
917 text += QString::number( KOGlobals::self()->calendarSystem()->day(mDate) ); 917 text += QString::number( KOGlobals::self()->calendarSystem()->day(mDate) );
918 } else { 918 } else {
919 mLabel->resize( mLabelSize ); 919 mLabel->resize( mLabelSize );
920 text += QString::number( KOGlobals::self()->calendarSystem()->day(mDate) ); 920 text += QString::number( KOGlobals::self()->calendarSystem()->day(mDate) );
921 } 921 }
922 mLabel->setText( text ); 922 mLabel->setText( text );
923 923
924 int size = height() - mLabel->height() - lineWidth()-1; 924 int size = height() - mLabel->height() - lineWidth()-1;
925 //qDebug("LW %d ", lineWidth()); 925 //qDebug("LW %d ", lineWidth());
926 if ( size > 0 ) 926 if ( size > 0 )
927 verticalScrollBar()->setMaximumHeight( size ); 927 verticalScrollBar()->setMaximumHeight( size );
928 size = width() - mLabel->width() -lineWidth()-1; 928 size = width() - mLabel->width() -lineWidth()-1;
929 if ( size > 0 ) 929 if ( size > 0 )
930 horizontalScrollBar()->setMaximumWidth( size ); 930 horizontalScrollBar()->setMaximumWidth( size );
931 mLabel->move( width()-lineWidth() - mLabel->width(), height()-lineWidth() - mLabel->height() ); 931 mLabel->move( width()-lineWidth() - mLabel->width(), height()-lineWidth() - mLabel->height() );
932 //mLabel->setMaximumWidth( width() - mItemList->lineWidth()*2); 932 //mLabel->setMaximumWidth( width() - mItemList->lineWidth()*2);
933 // mItemList->resize ( width(), height () ); 933 // mItemList->resize ( width(), height () );
934 if ( e ) 934 if ( e )
935 KNoScrollListBox::resizeEvent ( e ); 935 KNoScrollListBox::resizeEvent ( e );
936} 936}
937 937
938void MonthViewCell::defaultAction( QListBoxItem *item ) 938void MonthViewCell::defaultAction( QListBoxItem *item )
939{ 939{
940 if ( !item ) return; 940 if ( !item ) return;
941 941
942 MonthViewItem *eventItem = static_cast<MonthViewItem *>( item ); 942 MonthViewItem *eventItem = static_cast<MonthViewItem *>( item );
943 Incidence *incidence = eventItem->incidence(); 943 Incidence *incidence = eventItem->incidence();
944 if ( incidence ) mMonthView->defaultAction( incidence ); 944 if ( incidence ) mMonthView->defaultAction( incidence );
945} 945}
946void MonthViewCell::showDay() 946void MonthViewCell::showDay()
947{ 947{
948 emit showDaySignal( date() ); 948 emit showDaySignal( date() );
949} 949}
950void MonthViewCell::newEvent() 950void MonthViewCell::newEvent()
951{ 951{
952 QDateTime dt( date(), QTime( KOPrefs::instance()->mStartTime, 0 ) ); 952 QDateTime dt( date(), QTime( KOPrefs::instance()->mStartTime, 0 ) );
953 emit newEventSignal( dt ); 953 emit newEventSignal( dt );
954} 954}
955void MonthViewCell::cellClicked( QListBoxItem *item ) 955void MonthViewCell::cellClicked( QListBoxItem *item )
956{ 956{
957 static QListBoxItem * lastClicked = 0; 957 static QListBoxItem * lastClicked = 0;
958 if ( item == 0 ) { 958 if ( item == 0 ) {
959 QDateTime dt( date(), QTime( KOPrefs::instance()->mStartTime, 0 ) ); 959 QDateTime dt( date(), QTime( KOPrefs::instance()->mStartTime, 0 ) );
960 emit newEventSignal( dt ); 960 emit newEventSignal( dt );
961 return; 961 return;
962 } 962 }
963 /* 963 /*
964 if ( lastClicked ) 964 if ( lastClicked )
965 if ( ! item ) { 965 if ( ! item ) {
966 if ( lastClicked->listBox() != item->listBox() ) 966 if ( lastClicked->listBox() != item->listBox() )
967 lastClicked->listBox()->clearSelection(); 967 lastClicked->listBox()->clearSelection();
968 } 968 }
969 */ 969 */
970 970
971 mMonthView->setSelectedCell( this ); 971 mMonthView->setSelectedCell( this );
972 if( KOPrefs::instance()->mEnableMonthScroll || KOPrefs::instance()->mMonthViewWeek ) enableScrollBars( true ); 972 if( KOPrefs::instance()->mEnableMonthScroll || KOPrefs::instance()->mMonthViewWeek ) enableScrollBars( true );
973 select(); 973 select();
974} 974}
975 975
976void MonthViewCell::contextMenu( QListBoxItem *item ) 976void MonthViewCell::contextMenu( QListBoxItem *item )
977{ 977{
978 if ( !item ) return; 978 if ( !item ) return;
979 979
980 MonthViewItem *eventItem = static_cast<MonthViewItem *>( item ); 980 MonthViewItem *eventItem = static_cast<MonthViewItem *>( item );
981 Incidence *incidence = eventItem->incidence(); 981 Incidence *incidence = eventItem->incidence();
982 if ( incidence ) mMonthView->showContextMenu( incidence ); 982 if ( incidence ) mMonthView->showContextMenu( incidence );
983} 983}
984 984
985void MonthViewCell::selection( QListBoxItem *item ) 985void MonthViewCell::selection( QListBoxItem *item )
986{ 986{
987 if ( !item ) return; 987 if ( !item ) return;
988 988
989 mMonthView->setSelectedCell( this ); 989 mMonthView->setSelectedCell( this );
990} 990}
991 991
992 992
993// ******************************************************************************* 993// *******************************************************************************
994// ******************************************************************************* 994// *******************************************************************************
995// ******************************************************************************* 995// *******************************************************************************
996 996
997 997
998KOMonthView::KOMonthView(Calendar *calendar, QWidget *parent, const char *name) 998KOMonthView::KOMonthView(Calendar *calendar, QWidget *parent, const char *name)
999 : KOEventView( calendar, parent, name ), 999 : KOEventView( calendar, parent, name ),
1000 mDaysPerWeek( 7 ), mNumWeeks( 6 ), mNumCells( mDaysPerWeek * mNumWeeks ), 1000 mDaysPerWeek( 7 ), mNumWeeks( 6 ), mNumCells( mDaysPerWeek * mNumWeeks ),
1001 mWidthLongDayLabel( 0 ), mSelectedCell( 0 ) 1001 mWidthLongDayLabel( 0 ), mSelectedCell( 0 )
1002{ 1002{
1003 mFlagKeyPressed = false;
1003 mShortDayLabelsM = false; 1004 mShortDayLabelsM = false;
1004 mShortDayLabelsW = false; 1005 mShortDayLabelsW = false;
1005 skipResize = false; 1006 skipResize = false;
1006 clPending = true; 1007 clPending = true;
1007 mNavigatorBar = new NavigatorBar( QDate::currentDate(), this, "useBigPixmaps" ); 1008 mNavigatorBar = new NavigatorBar( QDate::currentDate(), this, "useBigPixmaps" );
1008 mWidStack = new QWidgetStack( this ); 1009 mWidStack = new QWidgetStack( this );
1009 QVBoxLayout* hb = new QVBoxLayout( this ); 1010 QVBoxLayout* hb = new QVBoxLayout( this );
1010 mMonthView = new QWidget( mWidStack ); 1011 mMonthView = new QWidget( mWidStack );
1011 mWeekView = new QWidget( mWidStack ); 1012 mWeekView = new QWidget( mWidStack );
1012#if QT_VERSION >= 0x030000 1013#if QT_VERSION >= 0x030000
1013 mWidStack->addWidget(mMonthView ); 1014 mWidStack->addWidget(mMonthView );
1014 mWidStack->addWidget(mWeekView ); 1015 mWidStack->addWidget(mWeekView );
1015#else 1016#else
1016 mWidStack->addWidget( mMonthView, 1 ); 1017 mWidStack->addWidget( mMonthView, 1 );
1017 mWidStack->addWidget( mWeekView , 1 ); 1018 mWidStack->addWidget( mWeekView , 1 );
1018#endif 1019#endif
1019 hb->addWidget( mNavigatorBar ); 1020 hb->addWidget( mNavigatorBar );
1020 hb->addWidget( mWidStack ); 1021 hb->addWidget( mWidStack );
1021 mShowWeekView = KOPrefs::instance()->mMonthViewWeek; 1022 mShowWeekView = KOPrefs::instance()->mMonthViewWeek;
1022 updatePossible = false; 1023 updatePossible = false;
1023 //updatePossible = true; 1024 //updatePossible = true;
1024 mCells.setAutoDelete( true ); 1025 mCells.setAutoDelete( true );
1025 mShowSatSunComp = KOPrefs::instance()->mMonthViewSatSunTog ; 1026 mShowSatSunComp = KOPrefs::instance()->mMonthViewSatSunTog ;
1026 mDayLabels.resize( mDaysPerWeek ); 1027 mDayLabels.resize( mDaysPerWeek );
1027 mDayLabelsW.resize( mDaysPerWeek ); 1028 mDayLabelsW.resize( mDaysPerWeek );
1028 QFont bfont = font(); 1029 QFont bfont = font();
1029 if ( QApplication::desktop()->width() < 650 ) { 1030 if ( QApplication::desktop()->width() < 650 ) {
1030 bfont.setPointSize( bfont.pointSize() - 2 ); 1031 bfont.setPointSize( bfont.pointSize() - 2 );
1031 } 1032 }
1032 bfont.setBold( true ); 1033 bfont.setBold( true );
1033 int i; 1034 int i;
1034 1035
1035 for( i = 0; i < mDaysPerWeek; i++ ) { 1036 for( i = 0; i < mDaysPerWeek; i++ ) {
1036 QLabel *label = new QLabel( mMonthView ); 1037 QLabel *label = new QLabel( mMonthView );
1037 label->setFont(bfont); 1038 label->setFont(bfont);
1038 label->setFrameStyle(QFrame::Panel|QFrame::Raised); 1039 label->setFrameStyle(QFrame::Panel|QFrame::Raised);
1039 label->setLineWidth(1); 1040 label->setLineWidth(1);
1040 label->setAlignment(AlignCenter); 1041 label->setAlignment(AlignCenter);
1041 mDayLabels.insert( i, label ); 1042 mDayLabels.insert( i, label );
1042 label = new QLabel( mWeekView ); 1043 label = new QLabel( mWeekView );
1043 label->setFont(bfont); 1044 label->setFont(bfont);
1044 label->setFrameStyle(QFrame::Panel|QFrame::Raised); 1045 label->setFrameStyle(QFrame::Panel|QFrame::Raised);
1045 label->setLineWidth(1); 1046 label->setLineWidth(1);
1046 label->setAlignment(AlignCenter); 1047 label->setAlignment(AlignCenter);
1047 mDayLabelsW.insert( i, label ); 1048 mDayLabelsW.insert( i, label );
1048 } 1049 }
1049 1050
1050 bfont.setBold( false ); 1051 bfont.setBold( false );
1051 mWeekLabels.resize( mNumWeeks+1 ); 1052 mWeekLabels.resize( mNumWeeks+1 );
1052 mWeekLabelsW.resize( 2 ); 1053 mWeekLabelsW.resize( 2 );
1053 for( i = 0; i < mNumWeeks+1; i++ ) { 1054 for( i = 0; i < mNumWeeks+1; i++ ) {
1054 KOWeekButton *label = new KOWeekButton( mMonthView ); 1055 KOWeekButton *label = new KOWeekButton( mMonthView );
1055 label->setFocusPolicy(NoFocus); 1056 label->setFocusPolicy(NoFocus);
1056 label->setFont(bfont); 1057 label->setFont(bfont);
1057 connect( label, SIGNAL( selectWeekNum ( int )),this, SLOT( selectInternalWeekNum ( int )) ); 1058 connect( label, SIGNAL( selectWeekNum ( int )),this, SLOT( selectInternalWeekNum ( int )) );
1058 label->setFlat(true); 1059 label->setFlat(true);
1059 QWhatsThis::add(label,i18n("Click on the week number to\nshow week zoomed")); 1060 QWhatsThis::add(label,i18n("Click on the week number to\nshow week zoomed"));
1060 //label->setFrameStyle(QFrame::Panel|QFrame::Raised); 1061 //label->setFrameStyle(QFrame::Panel|QFrame::Raised);
1061 //label->setLineWidth(1); 1062 //label->setLineWidth(1);
1062 //label->setAlignment(AlignCenter); 1063 //label->setAlignment(AlignCenter);
1063 mWeekLabels.insert( i, label ); 1064 mWeekLabels.insert( i, label );
1064 } 1065 }
1065 mWeekLabels[mNumWeeks]->setText( i18n("W")); 1066 mWeekLabels[mNumWeeks]->setText( i18n("W"));
1066 mWeekLabels[0]->setFocusPolicy(WheelFocus); 1067 mWeekLabels[0]->setFocusPolicy(WheelFocus);
1067 QWhatsThis::add(mWeekLabels[mNumWeeks],i18n("Click on this to\nselect week number")); 1068 QWhatsThis::add(mWeekLabels[mNumWeeks],i18n("Click on this to\nselect week number"));
1068 1069
1069 for( i = 0; i < 1+1; i++ ) { 1070 for( i = 0; i < 1+1; i++ ) {
1070 KOWeekButton *label = new KOWeekButton( mWeekView ); 1071 KOWeekButton *label = new KOWeekButton( mWeekView );
1071 label->setFocusPolicy(NoFocus); 1072 label->setFocusPolicy(NoFocus);
1072 label->setFont(bfont); 1073 label->setFont(bfont);
1073 connect( label, SIGNAL( selectWeekNum ( int )),this, SLOT( selectInternalWeekNum ( int )) ); 1074 connect( label, SIGNAL( selectWeekNum ( int )),this, SLOT( selectInternalWeekNum ( int )) );
1074 label->setFlat(true); 1075 label->setFlat(true);
1075 QWhatsThis::add(label,i18n("Click on the week number to\nshow week zoomed")); 1076 QWhatsThis::add(label,i18n("Click on the week number to\nshow week zoomed"));
1076 //label->setFrameStyle(QFrame::Panel|QFrame::Raised); 1077 //label->setFrameStyle(QFrame::Panel|QFrame::Raised);
1077 //label->setLineWidth(1); 1078 //label->setLineWidth(1);
1078 //label->setAlignment(AlignCenter); 1079 //label->setAlignment(AlignCenter);
1079 mWeekLabelsW.insert( i, label ); 1080 mWeekLabelsW.insert( i, label );
1080 } 1081 }
1081 mWeekLabelsW[1]->setText( i18n("W")); 1082 mWeekLabelsW[1]->setText( i18n("W"));
1082 mWeekLabelsW[0]->setFocusPolicy(WheelFocus); 1083 mWeekLabelsW[0]->setFocusPolicy(WheelFocus);
1083 1084
1084 1085
1085 int row, col; 1086 int row, col;
1086 mCells.resize( mNumCells ); 1087 mCells.resize( mNumCells );
1087 for( row = 0; row < mNumWeeks; ++row ) { 1088 for( row = 0; row < mNumWeeks; ++row ) {
1088 for( col = 0; col < mDaysPerWeek; ++col ) { 1089 for( col = 0; col < mDaysPerWeek; ++col ) {
1089 MonthViewCell *cell = new MonthViewCell( this, mMonthView ); 1090 MonthViewCell *cell = new MonthViewCell( this, mMonthView );
1090 mCells.insert( row * mDaysPerWeek + col, cell ); 1091 mCells.insert( row * mDaysPerWeek + col, cell );
1091 1092
1092 connect( cell, SIGNAL( defaultAction( Incidence * ) ), 1093 connect( cell, SIGNAL( defaultAction( Incidence * ) ),
1093 SLOT( defaultAction( Incidence * ) ) ); 1094 SLOT( defaultAction( Incidence * ) ) );
1094 connect( cell, SIGNAL( newEventSignal( QDateTime ) ), 1095 connect( cell, SIGNAL( newEventSignal( QDateTime ) ),
1095 SIGNAL( newEventSignal( QDateTime ) ) ); 1096 SIGNAL( newEventSignal( QDateTime ) ) );
1096 connect( cell, SIGNAL( showDaySignal( QDate ) ), 1097 connect( cell, SIGNAL( showDaySignal( QDate ) ),
1097 SIGNAL( showDaySignal( QDate ) ) ); 1098 SIGNAL( showDaySignal( QDate ) ) );
1098 } 1099 }
1099 } 1100 }
1100 mCellsW.resize( mDaysPerWeek ); 1101 mCellsW.resize( mDaysPerWeek );
1101 for( col = 0; col < mDaysPerWeek; ++col ) { 1102 for( col = 0; col < mDaysPerWeek; ++col ) {
1102 MonthViewCell *cell = new MonthViewCell( this, mWeekView ); 1103 MonthViewCell *cell = new MonthViewCell( this, mWeekView );
1103 mCellsW.insert( col, cell ); 1104 mCellsW.insert( col, cell );
1104 1105
1105 connect( cell, SIGNAL( defaultAction( Incidence * ) ), 1106 connect( cell, SIGNAL( defaultAction( Incidence * ) ),
1106 SLOT( defaultAction( Incidence * ) ) ); 1107 SLOT( defaultAction( Incidence * ) ) );
1107 connect( cell, SIGNAL( newEventSignal( QDateTime ) ), 1108 connect( cell, SIGNAL( newEventSignal( QDateTime ) ),
1108 SIGNAL( newEventSignal( QDateTime ) ) ); 1109 SIGNAL( newEventSignal( QDateTime ) ) );
1109 connect( cell, SIGNAL( showDaySignal( QDate ) ), 1110 connect( cell, SIGNAL( showDaySignal( QDate ) ),
1110 SIGNAL( showDaySignal( QDate ) ) ); 1111 SIGNAL( showDaySignal( QDate ) ) );
1111 cell->updateConfig(KOPrefs::instance()->mMonthViewUsesBigFont ); 1112 cell->updateConfig(KOPrefs::instance()->mMonthViewUsesBigFont );
1112 } 1113 }
1113 1114
1114 //connect( mWeekLabels[mNumWeeks], SIGNAL( clicked() ), SLOT( switchView() ) ); 1115 //connect( mWeekLabels[mNumWeeks], SIGNAL( clicked() ), SLOT( switchView() ) );
1115 mContextMenu = eventPopup(); 1116 mContextMenu = eventPopup();
1116 // updateConfig(); //useless here... 1117 // updateConfig(); //useless here...
1117 // ... but we need mWidthLongDayLabel computed 1118 // ... but we need mWidthLongDayLabel computed
1118 QFontMetrics fontmetric(mDayLabels[0]->font()); 1119 QFontMetrics fontmetric(mDayLabels[0]->font());
1119 mWidthLongDayLabel = 0; 1120 mWidthLongDayLabel = 0;
1120 for (int i = 0; i < 7; i++) { 1121 for (int i = 0; i < 7; i++) {
1121 int width = fontmetric.width(KOGlobals::self()->calendarSystem()->weekDayName(i+1)); 1122 int width = fontmetric.width(KOGlobals::self()->calendarSystem()->weekDayName(i+1));
1122 if ( width > mWidthLongDayLabel ) mWidthLongDayLabel = width; 1123 if ( width > mWidthLongDayLabel ) mWidthLongDayLabel = width;
1123 } 1124 }
1124 1125
1125 //mWeekLabels[mNumWeeks]->setText( i18n("W")); 1126 //mWeekLabels[mNumWeeks]->setText( i18n("W"));
1126 1127
1127#if 0 1128#if 0
1128 if ( mShowWeekView ) 1129 if ( mShowWeekView )
1129 mWidStack->raiseWidget( mWeekView ); 1130 mWidStack->raiseWidget( mWeekView );
1130 else 1131 else
1131 mWidStack->raiseWidget( mMonthView ); 1132 mWidStack->raiseWidget( mMonthView );
1132#endif 1133#endif
1133 1134
1134 emit incidenceSelected( 0 ); 1135 emit incidenceSelected( 0 );
1135 1136
1136 mComputeLayoutTimer = new QTimer( this ); 1137 mComputeLayoutTimer = new QTimer( this );
1137 connect (mComputeLayoutTimer ,SIGNAL(timeout()), this, SLOT ( slotComputeLayout())); 1138 connect (mComputeLayoutTimer ,SIGNAL(timeout()), this, SLOT ( slotComputeLayout()));
1138 1139
1139 1140
1140#ifndef DESKTOP_VERSION 1141#ifndef DESKTOP_VERSION
1141 resize( QApplication::desktop()->size() ); 1142 resize( QApplication::desktop()->size() );
1142#else 1143#else
1143 resize(640, 480 ); 1144 resize(640, 480 );
1144 updatePossible = true; 1145 updatePossible = true;
1145#endif 1146#endif
1146 computeLayout(); 1147 computeLayout();
1147 1148
1148 if ( mShowWeekView ) 1149 if ( mShowWeekView )
1149 mWidStack->raiseWidget( mWeekView ); 1150 mWidStack->raiseWidget( mWeekView );
1150 else 1151 else
1151 mWidStack->raiseWidget( mMonthView ); 1152 mWidStack->raiseWidget( mMonthView );
1152} 1153}
1153 1154
1154KOMonthView::~KOMonthView() 1155KOMonthView::~KOMonthView()
1155{ 1156{
1156 delete mContextMenu; 1157 delete mContextMenu;
1157} 1158}
1158 1159
1159void KOMonthView::selectInternalWeekNum ( int n ) 1160void KOMonthView::selectInternalWeekNum ( int n )
1160{ 1161{
1161 switchView(); 1162 switchView();
1162 if ( !KOPrefs::instance()->mMonthViewWeek ) 1163 if ( !KOPrefs::instance()->mMonthViewWeek )
1163 emit selectMonth (); 1164 emit selectMonth ();
1164 else 1165 else
1165 emit selectWeekNum ( n ); 1166 emit selectWeekNum ( n );
1166} 1167}
1167 1168
1168int KOMonthView::currentWeek() 1169int KOMonthView::currentWeek()
1169{ 1170{
1170 if ( mShowWeekView ) 1171 if ( mShowWeekView )
1171 return mWeekLabelsW[0]->getWeekNum(); 1172 return mWeekLabelsW[0]->getWeekNum();
1172 return mWeekLabels[0]->getWeekNum(); 1173 return mWeekLabels[0]->getWeekNum();
1173} 1174}
1174void KOMonthView::switchView() 1175void KOMonthView::switchView()
1175{ 1176{
1176 if ( selectedCell( ) ) 1177 if ( selectedCell( ) )
1177 selectedCell()->deselect(); 1178 selectedCell()->deselect();
1178 mShowWeekView = !mShowWeekView; 1179 mShowWeekView = !mShowWeekView;
1179 KOPrefs::instance()->mMonthViewWeek = mShowWeekView; 1180 KOPrefs::instance()->mMonthViewWeek = mShowWeekView;
1180 if ( clPending ) { 1181 if ( clPending ) {
1181 computeLayout(); 1182 computeLayout();
1182 updateConfig(); 1183 updateConfig();
1183 } 1184 }
1184 if ( mShowWeekView ) 1185 if ( mShowWeekView )
1185 mWidStack->raiseWidget( mWeekView ); 1186 mWidStack->raiseWidget( mWeekView );
1186 else 1187 else
1187 mWidStack->raiseWidget( mMonthView ); 1188 mWidStack->raiseWidget( mMonthView );
1188 clPending = false; 1189 clPending = false;
1189} 1190}
1190 1191
1191int KOMonthView::maxDatesHint() 1192int KOMonthView::maxDatesHint()
1192{ 1193{
1193 return mNumCells; 1194 return mNumCells;
1194} 1195}
1195 1196
1196int KOMonthView::currentDateCount() 1197int KOMonthView::currentDateCount()
1197{ 1198{
1198 return mNumCells; 1199 return mNumCells;
1199} 1200}
1200 1201
1201QPtrList<Incidence> KOMonthView::selectedIncidences() 1202QPtrList<Incidence> KOMonthView::selectedIncidences()
1202{ 1203{
1203 QPtrList<Incidence> selected; 1204 QPtrList<Incidence> selected;
1204 1205
1205 if ( mSelectedCell ) { 1206 if ( mSelectedCell ) {
1206 Incidence *incidence = mSelectedCell->selectedIncidence(); 1207 Incidence *incidence = mSelectedCell->selectedIncidence();
1207 if ( incidence ) selected.append( incidence ); 1208 if ( incidence ) selected.append( incidence );
1208 } 1209 }
1209 1210
1210 return selected; 1211 return selected;
1211} 1212}
1212 1213
1213DateList KOMonthView::selectedDates() 1214DateList KOMonthView::selectedDates()
1214{ 1215{
1215 DateList selected; 1216 DateList selected;
1216 1217
1217 if ( mSelectedCell ) { 1218 if ( mSelectedCell ) {
1218 QDate qd = mSelectedCell->selectedIncidenceDate(); 1219 QDate qd = mSelectedCell->selectedIncidenceDate();
1219 if ( qd.isValid() ) selected.append( qd ); 1220 if ( qd.isValid() ) selected.append( qd );
1220 } 1221 }
1221 1222
1222 return selected; 1223 return selected;
1223} 1224}
1224 1225
1225void KOMonthView::printPreview(CalPrinter *calPrinter, const QDate &fd, 1226void KOMonthView::printPreview(CalPrinter *calPrinter, const QDate &fd,
1226 const QDate &td) 1227 const QDate &td)
1227{ 1228{
1228#ifndef KORG_NOPRINTER 1229#ifndef KORG_NOPRINTER
1229 calPrinter->preview(CalPrinter::Month, fd, td); 1230 calPrinter->preview(CalPrinter::Month, fd, td);
1230#endif 1231#endif
1231} 1232}
1232 1233
1233void KOMonthView::updateConfig() 1234void KOMonthView::updateConfig()
1234{ 1235{
1235 1236
1236 int mWeekStartsMonday = KGlobal::locale()->weekStartsMonday(); 1237 int mWeekStartsMonday = KGlobal::locale()->weekStartsMonday();
1237 1238
1238 if ( mShowWeekView || KOPrefs::instance()->mMonthViewSatSunTog ) { 1239 if ( mShowWeekView || KOPrefs::instance()->mMonthViewSatSunTog ) {
1239 mWeekStartsMonday = true; 1240 mWeekStartsMonday = true;
1240 } 1241 }
1241 QFontMetrics fontmetric(mDayLabels[0]->font()); 1242 QFontMetrics fontmetric(mDayLabels[0]->font());
1242 mWidthLongDayLabel = 0; 1243 mWidthLongDayLabel = 0;
1243 1244
1244 for (int i = 0; i < 7; i++) { 1245 for (int i = 0; i < 7; i++) {
1245 int width = fontmetric.width(KOGlobals::self()->calendarSystem()->weekDayName(i+1)); 1246 int width = fontmetric.width(KOGlobals::self()->calendarSystem()->weekDayName(i+1));
1246 if ( width > mWidthLongDayLabel ) mWidthLongDayLabel = width; 1247 if ( width > mWidthLongDayLabel ) mWidthLongDayLabel = width;
1247 } 1248 }
1248 bool temp = mShowSatSunComp ; 1249 bool temp = mShowSatSunComp ;
1249 mShowSatSunComp = KOPrefs::instance()->mMonthViewSatSunTog ; 1250 mShowSatSunComp = KOPrefs::instance()->mMonthViewSatSunTog ;
1250 if ( ! mShowWeekView ) { 1251 if ( ! mShowWeekView ) {
1251 if ( temp != KOPrefs::instance()->mMonthViewSatSunTog ) 1252 if ( temp != KOPrefs::instance()->mMonthViewSatSunTog )
1252 computeLayout(); 1253 computeLayout();
1253 } 1254 }
1254 updateDayLabels(); 1255 updateDayLabels();
1255 //qDebug("KOMonthView::updateConfig() %d %d %d ",height(), mDayLabels[0]->sizeHint().height() ,mNumWeeks); 1256 //qDebug("KOMonthView::updateConfig() %d %d %d ",height(), mDayLabels[0]->sizeHint().height() ,mNumWeeks);
1256 //int cellHeight = (height() - mDayLabels[0]->sizeHint().height()) /mNumWeeks; 1257 //int cellHeight = (height() - mDayLabels[0]->sizeHint().height()) /mNumWeeks;
1257 //resizeEvent( 0 ); 1258 //resizeEvent( 0 );
1258 for (uint i = 0; i < mCells.count(); ++i) { 1259 for (uint i = 0; i < mCells.count(); ++i) {
1259 mCells[i]->updateConfig(); 1260 mCells[i]->updateConfig();
1260 } 1261 }
1261 1262
1262 for (uint i = 0; i < mCellsW.count(); ++i) { 1263 for (uint i = 0; i < mCellsW.count(); ++i) {
1263 mCellsW[i]->updateConfig(KOPrefs::instance()->mMonthViewUsesBigFont); 1264 mCellsW[i]->updateConfig(KOPrefs::instance()->mMonthViewUsesBigFont);
1264 } 1265 }
1265#ifdef DESKTOP_VERSION 1266#ifdef DESKTOP_VERSION
1266 MonthViewCell::toolTipGroup()->setEnabled(KOPrefs::instance()->mEnableToolTips); 1267 MonthViewCell::toolTipGroup()->setEnabled(KOPrefs::instance()->mEnableToolTips);
1267#endif 1268#endif
1268 updateView(); 1269 updateView();
1269} 1270}
1270 1271
1271void KOMonthView::updateDayLabels() 1272void KOMonthView::updateDayLabels()
1272{ 1273{
1273 1274
1274 QPtrVector<QLabel> *mDayLabelsT; 1275 QPtrVector<QLabel> *mDayLabelsT;
1275 1276
1276 mDayLabelsT = &mDayLabelsW; 1277 mDayLabelsT = &mDayLabelsW;
1277 for (int i = 0; i < 7; i++) { 1278 for (int i = 0; i < 7; i++) {
1278 { 1279 {
1279 bool show = mShortDayLabelsW; 1280 bool show = mShortDayLabelsW;
1280 if ( i > 4 && mShowSatSunComp && mWidthLongDayLabel > (*mDayLabelsT)[i]->width() ) 1281 if ( i > 4 && mShowSatSunComp && mWidthLongDayLabel > (*mDayLabelsT)[i]->width() )
1281 show = true; 1282 show = true;
1282 (*mDayLabelsT)[i]->setText(KOGlobals::self()->calendarSystem()->weekDayName(i+1,show)); 1283 (*mDayLabelsT)[i]->setText(KOGlobals::self()->calendarSystem()->weekDayName(i+1,show));
1283 } 1284 }
1284 } 1285 }
1285 mDayLabelsT = &mDayLabels; 1286 mDayLabelsT = &mDayLabels;
1286 for (int i = 0; i < 7; i++) { 1287 for (int i = 0; i < 7; i++) {
1287 if (KGlobal::locale()->weekStartsMonday() || KOPrefs::instance()->mMonthViewSatSunTog ) { 1288 if (KGlobal::locale()->weekStartsMonday() || KOPrefs::instance()->mMonthViewSatSunTog ) {
1288 bool show = mShortDayLabelsM; 1289 bool show = mShortDayLabelsM;
1289 if ( i > 4 && mShowSatSunComp && mWidthLongDayLabel > (*mDayLabelsT)[i]->width() ) 1290 if ( i > 4 && mShowSatSunComp && mWidthLongDayLabel > (*mDayLabelsT)[i]->width() )
1290 show = true; 1291 show = true;
1291 (*mDayLabelsT)[i]->setText(KOGlobals::self()->calendarSystem()->weekDayName(i+1,show)); 1292 (*mDayLabelsT)[i]->setText(KOGlobals::self()->calendarSystem()->weekDayName(i+1,show));
1292 } else { 1293 } else {
1293 if (i==0) (*mDayLabelsT)[i]->setText(KOGlobals::self()->calendarSystem()->weekDayName(7,mShortDayLabelsM)); 1294 if (i==0) (*mDayLabelsT)[i]->setText(KOGlobals::self()->calendarSystem()->weekDayName(7,mShortDayLabelsM));
1294 else (*mDayLabelsT)[i]->setText(KOGlobals::self()->calendarSystem()->weekDayName(i,mShortDayLabelsM)); 1295 else (*mDayLabelsT)[i]->setText(KOGlobals::self()->calendarSystem()->weekDayName(i,mShortDayLabelsM));
1295 1296
1296 } 1297 }
1297 } 1298 }
1298 1299
1299} 1300}
1300 1301
1301void KOMonthView::showDates(const QDate &start, const QDate &) 1302void KOMonthView::showDates(const QDate &start, const QDate &)
1302{ 1303{
1303 // kdDebug() << "KOMonthView::showDates(): " << start.toString() << endl; 1304 // kdDebug() << "KOMonthView::showDates(): " << start.toString() << endl;
1304 1305
1305 QPtrVector<MonthViewCell> *cells; 1306 QPtrVector<MonthViewCell> *cells;
1306 QPtrVector<QLabel> *dayLabels; 1307 QPtrVector<QLabel> *dayLabels;
1307 QPtrVector<KOWeekButton> *weekLabels; 1308 QPtrVector<KOWeekButton> *weekLabels;
1308 int weekNum = 6; 1309 int weekNum = 6;
1309 mStartDate = start; 1310 mStartDate = start;
1310 if ( mShowWeekView ) { 1311 if ( mShowWeekView ) {
1311 weekNum = 1; 1312 weekNum = 1;
1312 cells = &mCellsW; 1313 cells = &mCellsW;
1313 dayLabels = &mDayLabelsW; 1314 dayLabels = &mDayLabelsW;
1314 weekLabels = &mWeekLabelsW; 1315 weekLabels = &mWeekLabelsW;
1315 if ( !KGlobal::locale()->weekStartsMonday() ) { 1316 if ( !KGlobal::locale()->weekStartsMonday() ) {
1316 mStartDate = mStartDate.addDays( 1 ); 1317 mStartDate = mStartDate.addDays( 1 );
1317 } 1318 }
1318 } else { 1319 } else {
1319 cells = &mCells; 1320 cells = &mCells;
1320 dayLabels = &mDayLabels; 1321 dayLabels = &mDayLabels;
1321 weekLabels = &mWeekLabels; 1322 weekLabels = &mWeekLabels;
1322 } 1323 }
1323 1324
1324 int mWeekStartsMonday = KGlobal::locale()->weekStartsMonday(); 1325 int mWeekStartsMonday = KGlobal::locale()->weekStartsMonday();
1325 1326
1326 if ( mShowWeekView || KOPrefs::instance()->mMonthViewSatSunTog ) { 1327 if ( mShowWeekView || KOPrefs::instance()->mMonthViewSatSunTog ) {
1327 mWeekStartsMonday = true; 1328 mWeekStartsMonday = true;
1328 } 1329 }
1329 int startWeekDay = mWeekStartsMonday ? 1 : 7; 1330 int startWeekDay = mWeekStartsMonday ? 1 : 7;
1330 1331
1331 while( KOGlobals::self()->calendarSystem()->dayOfWeek(mStartDate) != startWeekDay ) { 1332 while( KOGlobals::self()->calendarSystem()->dayOfWeek(mStartDate) != startWeekDay ) {
1332 mStartDate = mStartDate.addDays( -1 ); 1333 mStartDate = mStartDate.addDays( -1 );
1333 } 1334 }
1334 bool primary = false; 1335 bool primary = false;
1335 uint i; 1336 uint i;
1336 for( i = 0; i < (*cells).size(); ++i ) { 1337 for( i = 0; i < (*cells).size(); ++i ) {
1337 QDate date = mStartDate.addDays( i ); 1338 QDate date = mStartDate.addDays( i );
1338 (*cells)[i]->setDate( date ); 1339 (*cells)[i]->setDate( date );
1339 1340
1340#ifndef KORG_NOPLUGINS 1341#ifndef KORG_NOPLUGINS
1341 // add holiday, if present 1342 // add holiday, if present
1342 QString hstring(KOCore::self()->holiday(date)); 1343 QString hstring(KOCore::self()->holiday(date));
1343 (*cells)[i]->setHoliday( hstring ); 1344 (*cells)[i]->setHoliday( hstring );
1344#endif 1345#endif
1345 1346
1346 } 1347 }
1347 QDate date = mStartDate.addDays( mWeekStartsMonday ? 3 : 4 ); 1348 QDate date = mStartDate.addDays( mWeekStartsMonday ? 3 : 4 );
1348 for( i = 0; i < weekNum; ++i ) { 1349 for( i = 0; i < weekNum; ++i ) {
1349 int wno; 1350 int wno;
1350 // remember, according to ISO 8601, the first week of the year is the 1351 // remember, according to ISO 8601, the first week of the year is the
1351 // first week that contains a thursday. Thus we must subtract off 4, 1352 // first week that contains a thursday. Thus we must subtract off 4,
1352 // not just 1. 1353 // not just 1.
1353 int dayOfYear = date.dayOfYear(); 1354 int dayOfYear = date.dayOfYear();
1354 if (dayOfYear % 7 != 0) 1355 if (dayOfYear % 7 != 0)
1355 wno = dayOfYear / 7 + 1; 1356 wno = dayOfYear / 7 + 1;
1356 else 1357 else
1357 wno =dayOfYear / 7; 1358 wno =dayOfYear / 7;
1358 (*weekLabels)[i]->setWeekNum( wno ); 1359 (*weekLabels)[i]->setWeekNum( wno );
1359 date = date.addDays( 7 ); 1360 date = date.addDays( 7 );
1360 } 1361 }
1361 updateView(); 1362 updateView();
1362} 1363}
1363 1364
1364void KOMonthView::showEvents(QPtrList<Event>) 1365void KOMonthView::showEvents(QPtrList<Event>)
1365{ 1366{
1366 qDebug("KOMonthView::selectEvents is not implemented yet. "); 1367 qDebug("KOMonthView::selectEvents is not implemented yet. ");
1367} 1368}
1368 1369
1369void KOMonthView::changeEventDisplay(Event *, int) 1370void KOMonthView::changeEventDisplay(Event *, int)
1370{ 1371{
1371 // this should be re-written to be much more efficient, but this 1372 // this should be re-written to be much more efficient, but this
1372 // quick-and-dirty-hack gets the job done for right now. 1373 // quick-and-dirty-hack gets the job done for right now.
1373 updateView(); 1374 updateView();
1374} 1375}
1375 1376
1376void KOMonthView::updateView() 1377void KOMonthView::updateView()
1377{ 1378{
1378 1379
1379 if ( !updatePossible ) 1380 if ( !updatePossible )
1380 return; 1381 return;
1381 //qDebug("UUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUU "); 1382 //qDebug("UUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUU ");
1382 //QTime ti; 1383 //QTime ti;
1383 //ti.start(); 1384 //ti.start();
1384 clearSelection(); 1385 clearSelection();
1385 QPtrVector<MonthViewCell> *cells; 1386 QPtrVector<MonthViewCell> *cells;
1386 if ( mShowWeekView ) { 1387 if ( mShowWeekView ) {
@@ -1456,431 +1457,447 @@ void KOMonthView::updateView()
1456 (*cells)[iii]->insertEvent( event ); 1457 (*cells)[iii]->insertEvent( event );
1457 } 1458 }
1458 } 1459 }
1459 } 1460 }
1460 } 1461 }
1461 // insert due todos 1462 // insert due todos
1462 QPtrList<Todo> todos = calendar()->todos( ); 1463 QPtrList<Todo> todos = calendar()->todos( );
1463 Todo *todo; 1464 Todo *todo;
1464 for(todo = todos.first(); todo; todo = todos.next()) { 1465 for(todo = todos.first(); todo; todo = todos.next()) {
1465 //insertTodo( todo ); 1466 //insertTodo( todo );
1466 if ( todo->hasDueDate() ) { 1467 if ( todo->hasDueDate() ) {
1467 int day = mStartDate.daysTo( todo->dtDue().date() ); 1468 int day = mStartDate.daysTo( todo->dtDue().date() );
1468 if ( day >= 0 && day < timeSpan + 1) { 1469 if ( day >= 0 && day < timeSpan + 1) {
1469 (*cells)[day]->insertTodo( todo ); 1470 (*cells)[day]->insertTodo( todo );
1470 } 1471 }
1471 } 1472 }
1472 } 1473 }
1473 1474
1474 for( i = 0; i < timeSpan+1; ++i ) { 1475 for( i = 0; i < timeSpan+1; ++i ) {
1475 (*cells)[i]->finishUpdateCell(); 1476 (*cells)[i]->finishUpdateCell();
1476 } 1477 }
1477 processSelectionChange(); 1478 processSelectionChange();
1478 //qApp->processEvents(); 1479 //qApp->processEvents();
1479 for( i = 0; i < timeSpan+1; ++i ) { 1480 for( i = 0; i < timeSpan+1; ++i ) {
1480 (*cells)[i]->repaintfinishUpdateCell(); 1481 (*cells)[i]->repaintfinishUpdateCell();
1481 } 1482 }
1482 setKeyBFocus(); 1483 setKeyBFocus();
1483#else 1484#else
1484 // old code 1485 // old code
1485 //qDebug("+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ "); 1486 //qDebug("+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ ");
1486 int i; 1487 int i;
1487 for( i = 0; i < (*cells).count(); ++i ) { 1488 for( i = 0; i < (*cells).count(); ++i ) {
1488 (*cells)[i]->updateCell(); 1489 (*cells)[i]->updateCell();
1489 } 1490 }
1490 1491
1491 //qDebug("KOMonthView::updateView() "); 1492 //qDebug("KOMonthView::updateView() ");
1492 processSelectionChange(); 1493 processSelectionChange();
1493 // qDebug("---------------------------------------------------------------------+ "); 1494 // qDebug("---------------------------------------------------------------------+ ");
1494 (*cells)[0]->setFocus(); 1495 (*cells)[0]->setFocus();
1495#endif 1496#endif
1496 1497
1497 //qDebug("update time %d ", ti.elapsed()); 1498 //qDebug("update time %d ", ti.elapsed());
1498} 1499}
1499 1500
1500void KOMonthView::setKeyBoardFocus() 1501void KOMonthView::setKeyBoardFocus()
1501{ 1502{
1502 bool shootAgain = false; 1503 bool shootAgain = false;
1503 if ( mShowWeekView ) { 1504 if ( mShowWeekView ) {
1504 shootAgain = !mWeekLabelsW[0]->hasFocus(); 1505 shootAgain = !mWeekLabelsW[0]->hasFocus();
1505 mWeekLabelsW[0]->setFocus(); 1506 mWeekLabelsW[0]->setFocus();
1506 } 1507 }
1507 else { 1508 else {
1508 shootAgain = !mWeekLabels[0]->hasFocus(); 1509 shootAgain = !mWeekLabels[0]->hasFocus();
1509 mWeekLabels[0]->setFocus(); 1510 mWeekLabels[0]->setFocus();
1510 } 1511 }
1511 if ( shootAgain ) { 1512 if ( shootAgain ) {
1512 QTimer::singleShot( 0, this, SLOT ( setKeyBFocus() ) ); 1513 QTimer::singleShot( 0, this, SLOT ( setKeyBFocus() ) );
1513 } 1514 }
1514} 1515}
1515void KOMonthView::setKeyBFocus() 1516void KOMonthView::setKeyBFocus()
1516{ 1517{
1517 //qDebug("KOMonthView::setKeyBFocus() "); 1518 //qDebug("KOMonthView::setKeyBFocus() ");
1518 QTimer::singleShot( 0, this, SLOT ( setKeyBoardFocus() ) ); 1519 QTimer::singleShot( 0, this, SLOT ( setKeyBoardFocus() ) );
1519} 1520}
1520void KOMonthView::resizeEvent(QResizeEvent * e) 1521void KOMonthView::resizeEvent(QResizeEvent * e)
1521{ 1522{
1522 //qDebug("KOMonthView::resizeEvent %d %d -- %d %d ", e->size().width(), e->size().height(), e->oldSize().width(), e->oldSize().height()); 1523 //qDebug("KOMonthView::resizeEvent %d %d -- %d %d ", e->size().width(), e->size().height(), e->oldSize().width(), e->oldSize().height());
1523 if ( isVisible() ) { 1524 if ( isVisible() ) {
1524 //qDebug("KOMonthView::isVisible "); 1525 //qDebug("KOMonthView::isVisible ");
1525 slotComputeLayout(); 1526 slotComputeLayout();
1526 } else 1527 } else
1527 mComputeLayoutTimer->start( 100 ); 1528 mComputeLayoutTimer->start( 100 );
1528} 1529}
1529 1530
1530void KOMonthView::slotComputeLayout() 1531void KOMonthView::slotComputeLayout()
1531{ 1532{
1532 mComputeLayoutTimer->stop(); 1533 mComputeLayoutTimer->stop();
1533 //qDebug("KOMonthView::Post - resizeEvent %d %d ", width(), height() ); 1534 //qDebug("KOMonthView::Post - resizeEvent %d %d ", width(), height() );
1534 computeLayout(); 1535 computeLayout();
1535 clPending = true; 1536 clPending = true;
1536 setKeyBFocus(); 1537 setKeyBFocus();
1537} 1538}
1538void KOMonthView::computeLayoutWeek() 1539void KOMonthView::computeLayoutWeek()
1539{ 1540{
1540 static int lastWid = 0; 1541 static int lastWid = 0;
1541 static int lastHei = 0; 1542 static int lastHei = 0;
1542 int daysToShow; 1543 int daysToShow;
1543 bool combinedSatSun = false; 1544 bool combinedSatSun = false;
1544 if (mShowSatSunComp = KOPrefs::instance()->mMonthViewSatSunTog ) { 1545 if (mShowSatSunComp = KOPrefs::instance()->mMonthViewSatSunTog ) {
1545 daysToShow = 6; 1546 daysToShow = 6;
1546 combinedSatSun = true; 1547 combinedSatSun = true;
1547 } 1548 }
1548 int tWid = topLevelWidget()->size().width(); 1549 int tWid = topLevelWidget()->size().width();
1549 int tHei = topLevelWidget()->size().height(); 1550 int tHei = topLevelWidget()->size().height();
1550 1551
1551 int wid = width();//e 1552 int wid = width();//e
1552 int hei = height()-1-mNavigatorBar->height(); 1553 int hei = height()-1-mNavigatorBar->height();
1553 1554
1554 if ( ((wid *3)/2) < tWid && (( hei *3) /2) < tHei ) 1555 if ( ((wid *3)/2) < tWid && (( hei *3) /2) < tHei )
1555 return; 1556 return;
1556 1557
1557 if ( lastWid == width() && lastHei == height() ) { 1558 if ( lastWid == width() && lastHei == height() ) {
1558 //qDebug("KOListWeekView::No compute layout needed "); 1559 //qDebug("KOListWeekView::No compute layout needed ");
1559 return; 1560 return;
1560 } 1561 }
1561 lastWid = width(); 1562 lastWid = width();
1562 lastHei = height(); 1563 lastHei = height();
1563 1564
1564 1565
1565 if ( wid < hei ) 1566 if ( wid < hei )
1566 daysToShow = 2; 1567 daysToShow = 2;
1567 else 1568 else
1568 daysToShow = 3; 1569 daysToShow = 3;
1569 mShowSatSunComp = true; 1570 mShowSatSunComp = true;
1570 combinedSatSun = true; 1571 combinedSatSun = true;
1571 1572
1572 //qDebug("KOMonthView::computeLayout() WWW ------------------------------------ "); 1573 //qDebug("KOMonthView::computeLayout() WWW ------------------------------------ ");
1573 QFontMetrics fm ( mWeekLabels[0]->font() ); 1574 QFontMetrics fm ( mWeekLabels[0]->font() );
1574 int weeklabelwid = fm.width( "888" ); 1575 int weeklabelwid = fm.width( "888" );
1575 wid -= weeklabelwid; 1576 wid -= weeklabelwid;
1576 1577
1577 int colWid = wid / daysToShow; 1578 int colWid = wid / daysToShow;
1578 int lastCol = wid - ( colWid*6 ); 1579 int lastCol = wid - ( colWid*6 );
1579 int dayLabelHei = mDayLabelsW[0]->sizeHint().height(); 1580 int dayLabelHei = mDayLabelsW[0]->sizeHint().height();
1580 int cellHei = (hei - (5- daysToShow )*dayLabelHei) /(5- daysToShow ); 1581 int cellHei = (hei - (5- daysToShow )*dayLabelHei) /(5- daysToShow );
1581 int colModulo = wid % daysToShow; 1582 int colModulo = wid % daysToShow;
1582 int rowModulo = (hei- (5- daysToShow )*dayLabelHei) % daysToShow-1; 1583 int rowModulo = (hei- (5- daysToShow )*dayLabelHei) % daysToShow-1;
1583 //qDebug("rowmod %d ", rowModulo); 1584 //qDebug("rowmod %d ", rowModulo);
1584 int i; 1585 int i;
1585 int x,y,w,h; 1586 int x,y,w,h;
1586 x= 0; 1587 x= 0;
1587 y= 0; 1588 y= 0;
1588 w = colWid; 1589 w = colWid;
1589 h = dayLabelHei ; 1590 h = dayLabelHei ;
1590 for ( i = 0; i < 7; i++) { 1591 for ( i = 0; i < 7; i++) {
1591 if ( i && !( i % daysToShow) && i < 6) { 1592 if ( i && !( i % daysToShow) && i < 6) {
1592 y += hei/(5-daysToShow); 1593 y += hei/(5-daysToShow);
1593 x = 0; 1594 x = 0;
1594 w = colWid; 1595 w = colWid;
1595 } 1596 }
1596 if ( ((i) % daysToShow) >= daysToShow-colModulo ) { 1597 if ( ((i) % daysToShow) >= daysToShow-colModulo ) {
1597 ++w; 1598 ++w;
1598 } 1599 }
1599 if ( i >= 5 ) { 1600 if ( i >= 5 ) {
1600 mDayLabelsW[i]->setGeometry( x+weeklabelwid,y,w/2+w%2,h); 1601 mDayLabelsW[i]->setGeometry( x+weeklabelwid,y,w/2+w%2,h);
1601 x -= (w/2 ); 1602 x -= (w/2 );
1602 } 1603 }
1603 else 1604 else
1604 mDayLabelsW[i]->setGeometry( x+weeklabelwid,y,w,h); 1605 mDayLabelsW[i]->setGeometry( x+weeklabelwid,y,w,h);
1605 x += w; 1606 x += w;
1606 } 1607 }
1607 x= 0; 1608 x= 0;
1608 y= dayLabelHei; 1609 y= dayLabelHei;
1609 w = colWid; 1610 w = colWid;
1610 h = cellHei; 1611 h = cellHei;
1611 int max = 0; 1612 int max = 0;
1612 for ( i = 0; i < mCellsW.count(); ++i) { 1613 for ( i = 0; i < mCellsW.count(); ++i) {
1613 if ( i > 6 ) { 1614 if ( i > 6 ) {
1614 mCellsW[i]->hide(); 1615 mCellsW[i]->hide();
1615 continue; 1616 continue;
1616 } 1617 }
1617 1618
1618 w = colWid; 1619 w = colWid;
1619 if ( ((i) % daysToShow) >= daysToShow-colModulo ) { 1620 if ( ((i) % daysToShow) >= daysToShow-colModulo ) {
1620 ++w; 1621 ++w;
1621 } 1622 }
1622 if ( i == (daysToShow-1-rowModulo)*7) 1623 if ( i == (daysToShow-1-rowModulo)*7)
1623 ++h; 1624 ++h;
1624 1625
1625 if ( i >= 5 ) { 1626 if ( i >= 5 ) {
1626 if ( i ==5 ) { 1627 if ( i ==5 ) {
1627 max = h/2; 1628 max = h/2;
1628 mCellsW[i]->setGeometry ( x+weeklabelwid,y,w,max ); 1629 mCellsW[i]->setGeometry ( x+weeklabelwid,y,w,max );
1629 x -= w ;y += h/2; 1630 x -= w ;y += h/2;
1630 } else { 1631 } else {
1631 if ( ((i-1) % daysToShow) >= daysToShow-colModulo ) { 1632 if ( ((i-1) % daysToShow) >= daysToShow-colModulo ) {
1632 ++w; 1633 ++w;
1633 } 1634 }
1634 max = h-h/2; 1635 max = h-h/2;
1635 mCellsW[i]->setGeometry ( x+weeklabelwid,y,w,max ); 1636 mCellsW[i]->setGeometry ( x+weeklabelwid,y,w,max );
1636 y -= h/2; 1637 y -= h/2;
1637 } 1638 }
1638 } else { 1639 } else {
1639 max = h; 1640 max = h;
1640 mCellsW[i]->setGeometry ( x+weeklabelwid,y,w,h ); 1641 mCellsW[i]->setGeometry ( x+weeklabelwid,y,w,h );
1641 } 1642 }
1642 1643
1643 1644
1644 x += w; 1645 x += w;
1645 if ( x + w/2 > wid ) { 1646 if ( x + w/2 > wid ) {
1646 x = 0; 1647 x = 0;
1647 y += h+dayLabelHei ; 1648 y += h+dayLabelHei ;
1648 } 1649 }
1649 //mCellsW[i]->dateLabel()->setMaximumHeight( max - mCellsW[i]->lineWidth()*2 ); 1650 //mCellsW[i]->dateLabel()->setMaximumHeight( max - mCellsW[i]->lineWidth()*2 );
1650 } 1651 }
1651 y= dayLabelHei; 1652 y= dayLabelHei;
1652 h = cellHei ; 1653 h = cellHei ;
1653 mWeekLabelsW[0]->setGeometry( 0,y,weeklabelwid,hei-dayLabelHei); 1654 mWeekLabelsW[0]->setGeometry( 0,y,weeklabelwid,hei-dayLabelHei);
1654 mWeekLabelsW[1]->setGeometry( 0,0,weeklabelwid,dayLabelHei); 1655 mWeekLabelsW[1]->setGeometry( 0,0,weeklabelwid,dayLabelHei);
1655 // qDebug("RRRRRRRRRRRRR %d %d old %d %d", e->size().width(),e->size().height() , e->oldSize().width(),e->oldSize().height()); 1656 // qDebug("RRRRRRRRRRRRR %d %d old %d %d", e->size().width(),e->size().height() , e->oldSize().width(),e->oldSize().height());
1656 //qDebug("parent %d %d ", topLevelWidget()->size().width(), topLevelWidget()->size().height()); 1657 //qDebug("parent %d %d ", topLevelWidget()->size().width(), topLevelWidget()->size().height());
1657 mShortDayLabelsW = mDayLabelsW[0]->width()-2 < mWidthLongDayLabel ; 1658 mShortDayLabelsW = mDayLabelsW[0]->width()-2 < mWidthLongDayLabel ;
1658 updateDayLabels(); 1659 updateDayLabels();
1659 //bool forceUpdate = !updatePossible; 1660 //bool forceUpdate = !updatePossible;
1660 updatePossible = true; 1661 updatePossible = true;
1661 //mWeekLabels[mNumWeeks]->setText( i18n("M")); 1662 //mWeekLabels[mNumWeeks]->setText( i18n("M"));
1662 //if ( forceUpdate ) 1663 //if ( forceUpdate )
1663 // updateView(); 1664 // updateView();
1664} 1665}
1665void KOMonthView::computeLayout() 1666void KOMonthView::computeLayout()
1666{ 1667{
1667 1668
1668 1669
1669 static int lastWid = 0; 1670 static int lastWid = 0;
1670 static int lastHei = 0; 1671 static int lastHei = 0;
1671 1672
1672 if ( mShowWeekView ){ 1673 if ( mShowWeekView ){
1673 computeLayoutWeek(); 1674 computeLayoutWeek();
1674 return; 1675 return;
1675 } 1676 }
1676 int daysToShow = 7; 1677 int daysToShow = 7;
1677 bool combinedSatSun = false; 1678 bool combinedSatSun = false;
1678 if (mShowSatSunComp = KOPrefs::instance()->mMonthViewSatSunTog ) { 1679 if (mShowSatSunComp = KOPrefs::instance()->mMonthViewSatSunTog ) {
1679 daysToShow = 6; 1680 daysToShow = 6;
1680 combinedSatSun = true; 1681 combinedSatSun = true;
1681 } 1682 }
1682 int tWid = topLevelWidget()->size().width(); 1683 int tWid = topLevelWidget()->size().width();
1683 int tHei = topLevelWidget()->size().height(); 1684 int tHei = topLevelWidget()->size().height();
1684 1685
1685 int wid = width();//e 1686 int wid = width();//e
1686 int hei = height()-1-mNavigatorBar->height(); 1687 int hei = height()-1-mNavigatorBar->height();
1687 1688
1688 if ( ((wid *3)/2) < tWid && (( hei *3) /2) < tHei ) { 1689 if ( ((wid *3)/2) < tWid && (( hei *3) /2) < tHei ) {
1689 return; 1690 return;
1690 } 1691 }
1691 if ( lastWid == width() && lastHei == height() ){ 1692 if ( lastWid == width() && lastHei == height() ){
1692 //qDebug("KOMonthview::No compute layout needed "); 1693 //qDebug("KOMonthview::No compute layout needed ");
1693 return; 1694 return;
1694 } 1695 }
1695 1696
1696 lastWid = width(); 1697 lastWid = width();
1697 lastHei = height(); 1698 lastHei = height();
1698 //qDebug("KOMonthView::computeLayout() MMM ------------------- "); 1699 //qDebug("KOMonthView::computeLayout() MMM ------------------- ");
1699 QFontMetrics fm ( mWeekLabels[0]->font() ); 1700 QFontMetrics fm ( mWeekLabels[0]->font() );
1700 int weeklabelwid = fm.width( "888" ); 1701 int weeklabelwid = fm.width( "888" );
1701 wid -= weeklabelwid; 1702 wid -= weeklabelwid;
1702 1703
1703 int colWid = wid / daysToShow; 1704 int colWid = wid / daysToShow;
1704 int lastCol = wid - ( colWid*6 ); 1705 int lastCol = wid - ( colWid*6 );
1705 int dayLabelHei = mDayLabels[0]->sizeHint().height(); 1706 int dayLabelHei = mDayLabels[0]->sizeHint().height();
1706 int cellHei = (hei - dayLabelHei) /6; 1707 int cellHei = (hei - dayLabelHei) /6;
1707 int colModulo = wid % daysToShow; 1708 int colModulo = wid % daysToShow;
1708 int rowModulo = (hei- dayLabelHei) % 6; 1709 int rowModulo = (hei- dayLabelHei) % 6;
1709 //qDebug("rowmod %d ", rowModulo); 1710 //qDebug("rowmod %d ", rowModulo);
1710 int i; 1711 int i;
1711 int x,y,w,h; 1712 int x,y,w,h;
1712 x= 0; 1713 x= 0;
1713 y= 0; 1714 y= 0;
1714 w = colWid; 1715 w = colWid;
1715 h = dayLabelHei ; 1716 h = dayLabelHei ;
1716 for ( i = 0; i < 7; i++) { 1717 for ( i = 0; i < 7; i++) {
1717 if ( i == daysToShow-colModulo ) 1718 if ( i == daysToShow-colModulo )
1718 ++w; 1719 ++w;
1719 if ( combinedSatSun ) { 1720 if ( combinedSatSun ) {
1720 if ( i >= daysToShow-1 ) { 1721 if ( i >= daysToShow-1 ) {
1721 mDayLabels[i]->setGeometry( x+weeklabelwid,y,w/2,h); 1722 mDayLabels[i]->setGeometry( x+weeklabelwid,y,w/2,h);
1722 x -= w/2 ; 1723 x -= w/2 ;
1723 } 1724 }
1724 else 1725 else
1725 mDayLabels[i]->setGeometry( x+weeklabelwid,y,w,h); 1726 mDayLabels[i]->setGeometry( x+weeklabelwid,y,w,h);
1726 } else 1727 } else
1727 mDayLabels[i]->setGeometry( x+weeklabelwid,y,w,h); 1728 mDayLabels[i]->setGeometry( x+weeklabelwid,y,w,h);
1728 x += w; 1729 x += w;
1729 } 1730 }
1730 x= 0; 1731 x= 0;
1731 y= dayLabelHei; 1732 y= dayLabelHei;
1732 w = colWid; 1733 w = colWid;
1733 h = cellHei ; 1734 h = cellHei ;
1734 int max = 0; 1735 int max = 0;
1735 for ( i = 0; i < mCells.count(); ++i) { 1736 for ( i = 0; i < mCells.count(); ++i) {
1736 //qDebug("iii %d ", i); 1737 //qDebug("iii %d ", i);
1737 w = colWid; 1738 w = colWid;
1738 if ( ((i) % 7) >= 7-colModulo ) { 1739 if ( ((i) % 7) >= 7-colModulo ) {
1739 ++w; 1740 ++w;
1740 } 1741 }
1741 if ( i == (6-rowModulo)*7) 1742 if ( i == (6-rowModulo)*7)
1742 ++h; 1743 ++h;
1743 if ( combinedSatSun ) { 1744 if ( combinedSatSun ) {
1744 if ( (i)%7 >= daysToShow-1 ) { 1745 if ( (i)%7 >= daysToShow-1 ) {
1745 if ( (i)%7 == daysToShow-1 ) { 1746 if ( (i)%7 == daysToShow-1 ) {
1746 max = h/2; 1747 max = h/2;
1747 mCells[i]->setGeometry ( x+weeklabelwid,y,w,max ); 1748 mCells[i]->setGeometry ( x+weeklabelwid,y,w,max );
1748 x -= w ;y += h/2; 1749 x -= w ;y += h/2;
1749 } else { 1750 } else {
1750 max = h-h/2; 1751 max = h-h/2;
1751 mCells[i]->setGeometry ( x+weeklabelwid,y,w,max ); 1752 mCells[i]->setGeometry ( x+weeklabelwid,y,w,max );
1752 y -= h/2; 1753 y -= h/2;
1753 } 1754 }
1754 } else { 1755 } else {
1755 max = h; 1756 max = h;
1756 mCells[i]->setGeometry ( x+weeklabelwid,y,w,h ); 1757 mCells[i]->setGeometry ( x+weeklabelwid,y,w,h );
1757 } 1758 }
1758 1759
1759 } 1760 }
1760 else { 1761 else {
1761 max = h; 1762 max = h;
1762 mCells[i]->setGeometry ( x+weeklabelwid,y,w,h ); 1763 mCells[i]->setGeometry ( x+weeklabelwid,y,w,h );
1763 } 1764 }
1764 x += w; 1765 x += w;
1765 if ( x + w/2 > wid ) { 1766 if ( x + w/2 > wid ) {
1766 x = 0; 1767 x = 0;
1767 y += h; 1768 y += h;
1768 } 1769 }
1769 //mCells[i]->dateLabel()->setMaximumHeight( max- mCells[i]->lineWidth()*2 ); 1770 //mCells[i]->dateLabel()->setMaximumHeight( max- mCells[i]->lineWidth()*2 );
1770 } 1771 }
1771 y= dayLabelHei; 1772 y= dayLabelHei;
1772 h = cellHei ; 1773 h = cellHei ;
1773 for ( i = 0; i < 6; i++) { 1774 for ( i = 0; i < 6; i++) {
1774 if ( i == (6-rowModulo)) 1775 if ( i == (6-rowModulo))
1775 ++h; 1776 ++h;
1776 mWeekLabels[i]->setGeometry( 0,y,weeklabelwid,h); 1777 mWeekLabels[i]->setGeometry( 0,y,weeklabelwid,h);
1777 y += h; 1778 y += h;
1778 } 1779 }
1779 mWeekLabels[6]->setGeometry( 0,0,weeklabelwid,dayLabelHei); 1780 mWeekLabels[6]->setGeometry( 0,0,weeklabelwid,dayLabelHei);
1780 // qDebug("RRRRRRRRRRRRR %d %d old %d %d", e->size().width(),e->size().height() , e->oldSize().width(),e->oldSize().height()); 1781 // qDebug("RRRRRRRRRRRRR %d %d old %d %d", e->size().width(),e->size().height() , e->oldSize().width(),e->oldSize().height());
1781 //qDebug("parent %d %d ", topLevelWidget()->size().width(), topLevelWidget()->size().height()); 1782 //qDebug("parent %d %d ", topLevelWidget()->size().width(), topLevelWidget()->size().height());
1782 mShortDayLabelsM = mDayLabels[0]->width()-2 < mWidthLongDayLabel ; 1783 mShortDayLabelsM = mDayLabels[0]->width()-2 < mWidthLongDayLabel ;
1783 updateDayLabels(); 1784 updateDayLabels();
1784 //bool forceUpdate = !updatePossible; 1785 //bool forceUpdate = !updatePossible;
1785 updatePossible = true; 1786 updatePossible = true;
1786 //mWeekLabels[mNumWeeks]->setText( i18n("W")); 1787 //mWeekLabels[mNumWeeks]->setText( i18n("W"));
1787} 1788}
1788 1789
1789void KOMonthView::showContextMenu( Incidence *incidence ) 1790void KOMonthView::showContextMenu( Incidence *incidence )
1790{ 1791{
1791 mContextMenu->showIncidencePopup(incidence); 1792 mContextMenu->showIncidencePopup(incidence);
1792 /* 1793 /*
1793 if( incidence && incidence->type() == "Event" ) { 1794 if( incidence && incidence->type() == "Event" ) {
1794 Event *event = static_cast<Event *>(incidence); 1795 Event *event = static_cast<Event *>(incidence);
1795 mContextMenu->showEventPopup(event); 1796 mContextMenu->showEventPopup(event);
1796 } else { 1797 } else {
1797 kdDebug() << "MonthView::showContextMenu(): cast failed." << endl; 1798 kdDebug() << "MonthView::showContextMenu(): cast failed." << endl;
1798 } 1799 }
1799 */ 1800 */
1800} 1801}
1801MonthViewCell * KOMonthView::selectedCell( ) 1802MonthViewCell * KOMonthView::selectedCell( )
1802{ 1803{
1803 return mSelectedCell; 1804 return mSelectedCell;
1804} 1805}
1805void KOMonthView::setSelectedCell( MonthViewCell *cell ) 1806void KOMonthView::setSelectedCell( MonthViewCell *cell )
1806{ 1807{
1807 //qDebug("KOMonthView::setSelectedCell "); 1808 //qDebug("KOMonthView::setSelectedCell ");
1808 if ( mSelectedCell && mSelectedCell != cell ) { 1809 if ( mSelectedCell && mSelectedCell != cell ) {
1809 MonthViewCell * mvc = mSelectedCell; 1810 MonthViewCell * mvc = mSelectedCell;
1810 mSelectedCell = cell; 1811 mSelectedCell = cell;
1811 mvc->deselect(); 1812 mvc->deselect();
1812 } else 1813 } else
1813 mSelectedCell = cell; 1814 mSelectedCell = cell;
1814 // if ( mSelectedCell ) 1815 // if ( mSelectedCell )
1815 // mSelectedCell->select(); 1816 // mSelectedCell->select();
1816 if ( !mSelectedCell ) 1817 if ( !mSelectedCell )
1817 emit incidenceSelected( 0 ); 1818 emit incidenceSelected( 0 );
1818 else 1819 else
1819 emit incidenceSelected( mSelectedCell->selectedIncidence() ); 1820 emit incidenceSelected( mSelectedCell->selectedIncidence() );
1820} 1821}
1821 1822
1822void KOMonthView::processSelectionChange() 1823void KOMonthView::processSelectionChange()
1823{ 1824{
1824 QPtrList<Incidence> incidences = selectedIncidences(); 1825 QPtrList<Incidence> incidences = selectedIncidences();
1825 if (incidences.count() > 0) { 1826 if (incidences.count() > 0) {
1826 emit incidenceSelected( incidences.first() ); 1827 emit incidenceSelected( incidences.first() );
1827 } else { 1828 } else {
1828 emit incidenceSelected( 0 ); 1829 emit incidenceSelected( 0 );
1829 clearSelection(); 1830 clearSelection();
1830 } 1831 }
1831} 1832}
1832 1833
1833void KOMonthView::clearSelection() 1834void KOMonthView::clearSelection()
1834{ 1835{
1835 if ( mSelectedCell ) { 1836 if ( mSelectedCell ) {
1836 mSelectedCell->deselect(); 1837 mSelectedCell->deselect();
1837 mSelectedCell = 0; 1838 mSelectedCell = 0;
1838 } 1839 }
1839} 1840}
1841
1842void KOMonthView::keyReleaseEvent ( QKeyEvent * e)
1843{
1844 if ( !e->isAutoRepeat() ) {
1845 mFlagKeyPressed = false;
1846 }
1847}
1848
1840void KOMonthView::keyPressEvent ( QKeyEvent * e ) 1849void KOMonthView::keyPressEvent ( QKeyEvent * e )
1841{ 1850{
1842 //qDebug("KOMonthView::keyPressEvent "); 1851
1852 qApp->processEvents();
1853 if ( e->isAutoRepeat() && !mFlagKeyPressed ) {
1854 //e->ignore();
1855 e->accept();
1856 return;
1857 }
1858 if (! e->isAutoRepeat() )
1859 mFlagKeyPressed = true;
1843 switch(e->key()) { 1860 switch(e->key()) {
1844 case Key_Up: 1861 case Key_Up:
1845 { 1862 {
1846 if ( mShowWeekView ) { 1863 if ( mShowWeekView ) {
1847 emit selectWeekNum ( currentWeek() - 1 ); 1864 emit selectWeekNum ( currentWeek() - 1 );
1848 } 1865 }
1849 else { 1866 else {
1850 emit prevMonth(); 1867 emit prevMonth();
1851 } 1868 }
1852 } 1869 }
1853 e->accept(); 1870 e->accept();
1854 break; 1871 break;
1855 case Key_Down: 1872 case Key_Down:
1856 { 1873 {
1857 if ( mShowWeekView ) { 1874 if ( mShowWeekView ) {
1858 emit selectWeekNum ( currentWeek() +1); 1875 emit selectWeekNum ( currentWeek() +1);
1859 } 1876 }
1860 else { 1877 else {
1861 emit nextMonth(); 1878 emit nextMonth();
1862 } 1879 }
1863 1880
1864 } 1881 }
1865 e->accept(); 1882 e->accept();
1866 break; 1883 break;
1867 case Key_Return: 1884 case Key_Return:
1868 case Key_Enter: 1885 case Key_Enter:
1869 { 1886 {
1870 selectInternalWeekNum ( currentWeek() ); 1887 selectInternalWeekNum ( currentWeek() );
1871 } 1888 }
1872 e->accept(); 1889 e->accept();
1873 break; 1890 break;
1874 case Key_D: 1891 case Key_D:
1875 if ( mSelectedCell ) { 1892 if ( mSelectedCell ) {
1876 mSelectedCell->showDay(); 1893 mSelectedCell->showDay();
1877 e->accept(); 1894 e->accept();
1878 } else { 1895 } else {
1879 e->ignore(); 1896 e->ignore();
1880 } 1897 }
1881 break; 1898 break;
1882 default: 1899 default:
1883 e->ignore(); 1900 e->ignore();
1884 break; 1901 break;
1885 } 1902 }
1886} 1903}
diff --git a/korganizer/komonthview.h b/korganizer/komonthview.h
index c1ca3d4..88050fe 100644
--- a/korganizer/komonthview.h
+++ b/korganizer/komonthview.h
@@ -1,320 +1,321 @@
1/* 1/*
2 This file is part of KOrganizer. 2 This file is part of KOrganizer.
3 Copyright (c) 2000,2001 Cornelius Schumacher <schumacher@kde.org> 3 Copyright (c) 2000,2001 Cornelius Schumacher <schumacher@kde.org>
4 4
5 This program is free software; you can redistribute it and/or modify 5 This program is free software; you can redistribute it and/or modify
6 it under the terms of the GNU General Public License as published by 6 it under the terms of the GNU General Public License as published by
7 the Free Software Foundation; either version 2 of the License, or 7 the Free Software Foundation; either version 2 of the License, or
8 (at your option) any later version. 8 (at your option) any later version.
9 9
10 This program is distributed in the hope that it will be useful, 10 This program is distributed in the hope that it will be useful,
11 but WITHOUT ANY WARRANTY; without even the implied warranty of 11 but WITHOUT ANY WARRANTY; without even the implied warranty of
12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 GNU General Public License for more details. 13 GNU General Public License for more details.
14 14
15 You should have received a copy of the GNU General Public License 15 You should have received a copy of the GNU General Public License
16 along with this program; if not, write to the Free Software 16 along with this program; if not, write to the Free Software
17 Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. 17 Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
18*/ 18*/
19 19
20#ifndef _KOMONTHVIEW_H 20#ifndef _KOMONTHVIEW_H
21#define _KOMONTHVIEW_H 21#define _KOMONTHVIEW_H
22 22
23#include <qlabel.h> 23#include <qlabel.h>
24#include <qframe.h> 24#include <qframe.h>
25#include <qdatetime.h> 25#include <qdatetime.h>
26#include <qlistbox.h> 26#include <qlistbox.h>
27#include <qpoint.h> 27#include <qpoint.h>
28#include <qwidgetstack.h> 28#include <qwidgetstack.h>
29#include <qlayout.h> 29#include <qlayout.h>
30#include <qtimer.h> 30#include <qtimer.h>
31#include <qintdict.h> 31#include <qintdict.h>
32#include <qpushbutton.h> 32#include <qpushbutton.h>
33#include <qvaluelist.h> 33#include <qvaluelist.h>
34#include <qptrvector.h> 34#include <qptrvector.h>
35 35
36#include <libkcal/calendar.h> 36#include <libkcal/calendar.h>
37#include <libkcal/event.h> 37#include <libkcal/event.h>
38 38
39#include "koeventview.h" 39#include "koeventview.h"
40#include "navigatorbar.h" 40#include "navigatorbar.h"
41 41
42#ifdef DESKTOP_VERSION 42#ifdef DESKTOP_VERSION
43class QToolTipGroup; 43class QToolTipGroup;
44#endif 44#endif
45 45
46class KNOWhatsThis; 46class KNOWhatsThis;
47class KOWeekButton : public QPushButton 47class KOWeekButton : public QPushButton
48{ 48{
49 Q_OBJECT 49 Q_OBJECT
50 public: 50 public:
51 KOWeekButton( QWidget *parent=0, const char *name=0 ) : 51 KOWeekButton( QWidget *parent=0, const char *name=0 ) :
52 QPushButton( parent, name) 52 QPushButton( parent, name)
53 { 53 {
54 connect( this, SIGNAL( clicked() ), 54 connect( this, SIGNAL( clicked() ),
55 SLOT( bottonClicked() )); 55 SLOT( bottonClicked() ));
56 mNumber = -1; 56 mNumber = -1;
57 } 57 }
58 void setWeekNum ( int num ) {mNumber = num; setText( QString::number ( num ));} 58 void setWeekNum ( int num ) {mNumber = num; setText( QString::number ( num ));}
59 int getWeekNum() { return mNumber;} 59 int getWeekNum() { return mNumber;}
60 signals: 60 signals:
61 void selectWeekNum ( int ); 61 void selectWeekNum ( int );
62private: 62private:
63 int mNumber; 63 int mNumber;
64 void keyPressEvent ( QKeyEvent * e ) 64 void keyPressEvent ( QKeyEvent * e )
65 { 65 {
66 e->ignore(); 66 e->ignore();
67 } 67 }
68 68
69private slots : 69private slots :
70 void bottonClicked() { if ( mNumber > 0 ) emit selectWeekNum ( mNumber ); } 70 void bottonClicked() { if ( mNumber > 0 ) emit selectWeekNum ( mNumber ); }
71}; 71};
72 72
73class KNoScrollListBox: public QListBox 73class KNoScrollListBox: public QListBox
74{ 74{
75 Q_OBJECT 75 Q_OBJECT
76 public: 76 public:
77 KNoScrollListBox(QWidget *parent=0, const char *name=0); 77 KNoScrollListBox(QWidget *parent=0, const char *name=0);
78 ~KNoScrollListBox(); 78 ~KNoScrollListBox();
79 QString getWhatsThisText(QPoint p) ; 79 QString getWhatsThisText(QPoint p) ;
80 80
81 signals: 81 signals:
82 void shiftDown(); 82 void shiftDown();
83 void shiftUp(); 83 void shiftUp();
84 void rightClick(); 84 void rightClick();
85 85
86 protected slots: 86 protected slots:
87 void oneDown(); 87 void oneDown();
88 void keyPressEvent(QKeyEvent *); 88 void keyPressEvent(QKeyEvent *);
89 void keyReleaseEvent(QKeyEvent *); 89 void keyReleaseEvent(QKeyEvent *);
90 void mousePressEvent(QMouseEvent *); 90 void mousePressEvent(QMouseEvent *);
91 91
92 private: 92 private:
93 KNOWhatsThis * mWT; 93 KNOWhatsThis * mWT;
94}; 94};
95 95
96 96
97class MonthViewItem: public QListBoxItem 97class MonthViewItem: public QListBoxItem
98{ 98{
99 public: 99 public:
100 MonthViewItem( Incidence *, QDate qd, const QString & title ); 100 MonthViewItem( Incidence *, QDate qd, const QString & title );
101 void recycle( Incidence *incidence, QDate qd, const QString & s); 101 void recycle( Incidence *incidence, QDate qd, const QString & s);
102 void setRecur(bool on) { mRecur = on; } 102 void setRecur(bool on) { mRecur = on; }
103 void setAlarm(bool on) { mAlarm = on; } 103 void setAlarm(bool on) { mAlarm = on; }
104 void setReply(bool on) { mReply = on; } 104 void setReply(bool on) { mReply = on; }
105 void setMoreInfo(bool on) { mInfo = on; } 105 void setMoreInfo(bool on) { mInfo = on; }
106 void setMultiDay(int type) { mMultiday = type; } 106 void setMultiDay(int type) { mMultiday = type; }
107 void setBlockRepaint(bool on) { mblockRepaint = on; } 107 void setBlockRepaint(bool on) { mblockRepaint = on; }
108 108
109 109
110 void setPalette(const QPalette &p) { mPalette = p; } 110 void setPalette(const QPalette &p) { mPalette = p; }
111 QPalette palette() const { return mPalette; } 111 QPalette palette() const { return mPalette; }
112 112
113 Incidence *incidence() const { return mIncidence; } 113 Incidence *incidence() const { return mIncidence; }
114 QDate incidenceDate() { return mDate; } 114 QDate incidenceDate() { return mDate; }
115 115
116 protected: 116 protected:
117 virtual void paint(QPainter *); 117 virtual void paint(QPainter *);
118 virtual int height(const QListBox *) const; 118 virtual int height(const QListBox *) const;
119 virtual int width(const QListBox *) const; 119 virtual int width(const QListBox *) const;
120 120
121 private: 121 private:
122 bool mblockRepaint; 122 bool mblockRepaint;
123 int mMultiday; 123 int mMultiday;
124 bool mRecur; 124 bool mRecur;
125 bool mAlarm; 125 bool mAlarm;
126 bool mReply; 126 bool mReply;
127 bool mInfo; 127 bool mInfo;
128 128
129 QPalette mPalette; 129 QPalette mPalette;
130 QDate mDate; 130 QDate mDate;
131 131
132 Incidence *mIncidence; 132 Incidence *mIncidence;
133}; 133};
134 134
135 135
136class KOMonthView; 136class KOMonthView;
137 137
138class MonthViewCell : public KNoScrollListBox 138class MonthViewCell : public KNoScrollListBox
139{ 139{
140 Q_OBJECT 140 Q_OBJECT
141 public: 141 public:
142 MonthViewCell(KOMonthView *,QWidget* ); 142 MonthViewCell(KOMonthView *,QWidget* );
143 ~MonthViewCell() {mAvailItemList.setAutoDelete( true );} 143 ~MonthViewCell() {mAvailItemList.setAutoDelete( true );}
144 144
145 void setDate( const QDate & ); 145 void setDate( const QDate & );
146 QDate date() const; 146 QDate date() const;
147 147
148 void setPrimary( bool ); 148 void setPrimary( bool );
149 bool isPrimary() const; 149 bool isPrimary() const;
150 150
151 void setHoliday( bool ); 151 void setHoliday( bool );
152 void setHoliday( const QString & ); 152 void setHoliday( const QString & );
153 153
154 void updateCell(); 154 void updateCell();
155 void startUpdateCell(); 155 void startUpdateCell();
156 void finishUpdateCell(); 156 void finishUpdateCell();
157 void repaintfinishUpdateCell(); 157 void repaintfinishUpdateCell();
158 void insertEvent(Event *); 158 void insertEvent(Event *);
159 void insertTodo(Todo *); 159 void insertTodo(Todo *);
160 160
161 void updateConfig( bool bigFont = false ); 161 void updateConfig( bool bigFont = false );
162 162
163 void enableScrollBars( bool ); 163 void enableScrollBars( bool );
164 164
165 Incidence *selectedIncidence(); 165 Incidence *selectedIncidence();
166 QDate selectedIncidenceDate(); 166 QDate selectedIncidenceDate();
167 QPushButton * dateLabel() { return mLabel; } 167 QPushButton * dateLabel() { return mLabel; }
168 168
169 void deselect(); 169 void deselect();
170 void select(); 170 void select();
171#ifdef DESKTOP_VERSION 171#ifdef DESKTOP_VERSION
172 static QToolTipGroup *toolTipGroup(); 172 static QToolTipGroup *toolTipGroup();
173#endif 173#endif
174 signals: 174 signals:
175 void defaultAction( Incidence * ); 175 void defaultAction( Incidence * );
176 void newEventSignal( QDateTime ); 176 void newEventSignal( QDateTime );
177 void showDaySignal( QDate ); 177 void showDaySignal( QDate );
178 178
179 protected: 179 protected:
180 QStringList mToolTip; 180 QStringList mToolTip;
181 void resizeEvent( QResizeEvent * ); 181 void resizeEvent( QResizeEvent * );
182 182
183 183
184public slots: 184public slots:
185 void showDay(); 185 void showDay();
186 186
187 protected slots: 187 protected slots:
188 void defaultAction( QListBoxItem * ); 188 void defaultAction( QListBoxItem * );
189 void contextMenu( QListBoxItem * ); 189 void contextMenu( QListBoxItem * );
190 void selection( QListBoxItem * ); 190 void selection( QListBoxItem * );
191 void cellClicked( QListBoxItem * ); 191 void cellClicked( QListBoxItem * );
192 void newEvent(); 192 void newEvent();
193 193
194 private: 194 private:
195 MonthViewItem* mCurrentAvailItem; 195 MonthViewItem* mCurrentAvailItem;
196 QPtrList <MonthViewItem> mAvailItemList; 196 QPtrList <MonthViewItem> mAvailItemList;
197 KOMonthView *mMonthView; 197 KOMonthView *mMonthView;
198 int currentPalette; 198 int currentPalette;
199 199
200 QDate mDate; 200 QDate mDate;
201 bool mPrimary; 201 bool mPrimary;
202 bool mHoliday; 202 bool mHoliday;
203 QString mHolidayString; 203 QString mHolidayString;
204 204
205 //QLabel *mLabel; 205 //QLabel *mLabel;
206 QPushButton *mLabel; 206 QPushButton *mLabel;
207 //QListBox *mItemList; 207 //QListBox *mItemList;
208#ifdef DESKTOP_VERSION 208#ifdef DESKTOP_VERSION
209 static QToolTipGroup *mToolTipGroup; 209 static QToolTipGroup *mToolTipGroup;
210#endif 210#endif
211 QSize mLabelSize; 211 QSize mLabelSize;
212 QSize mLabelBigSize; 212 QSize mLabelBigSize;
213 QPalette mHolidayPalette; 213 QPalette mHolidayPalette;
214 QPalette mStandardPalette; 214 QPalette mStandardPalette;
215 QPalette mPrimaryPalette; 215 QPalette mPrimaryPalette;
216 QPalette mNonPrimaryPalette; 216 QPalette mNonPrimaryPalette;
217 void setMyPalette(); 217 void setMyPalette();
218 QPalette getPalette (); 218 QPalette getPalette ();
219 219
220}; 220};
221 221
222 222
223class KOMonthView: public KOEventView 223class KOMonthView: public KOEventView
224{ 224{
225 Q_OBJECT 225 Q_OBJECT
226 public: 226 public:
227 KOMonthView(Calendar *cal, QWidget *parent = 0, const char *name = 0 ); 227 KOMonthView(Calendar *cal, QWidget *parent = 0, const char *name = 0 );
228 ~KOMonthView(); 228 ~KOMonthView();
229 229
230 /** Returns maximum number of days supported by the komonthview */ 230 /** Returns maximum number of days supported by the komonthview */
231 virtual int maxDatesHint(); 231 virtual int maxDatesHint();
232 232
233 /** Returns number of currently shown dates. */ 233 /** Returns number of currently shown dates. */
234 virtual int currentDateCount(); 234 virtual int currentDateCount();
235 235
236 /** returns the currently selected events */ 236 /** returns the currently selected events */
237 virtual QPtrList<Incidence> selectedIncidences(); 237 virtual QPtrList<Incidence> selectedIncidences();
238 238
239 /** returns dates of the currently selected events */ 239 /** returns dates of the currently selected events */
240 virtual DateList selectedDates(); 240 virtual DateList selectedDates();
241 241
242 virtual void printPreview(CalPrinter *calPrinter, 242 virtual void printPreview(CalPrinter *calPrinter,
243 const QDate &, const QDate &); 243 const QDate &, const QDate &);
244 bool isMonthView() { return !mShowWeekView; } 244 bool isMonthView() { return !mShowWeekView; }
245 bool isUpdatePossible() { return updatePossible; } 245 bool isUpdatePossible() { return updatePossible; }
246 246
247 MonthViewCell * selectedCell(); 247 MonthViewCell * selectedCell();
248 bool skipResize; 248 bool skipResize;
249 NavigatorBar* navigatorBar() { return mNavigatorBar ;} 249 NavigatorBar* navigatorBar() { return mNavigatorBar ;}
250 public slots: 250 public slots:
251 virtual void updateView(); 251 virtual void updateView();
252 virtual void updateConfig(); 252 virtual void updateConfig();
253 virtual void showDates(const QDate &start, const QDate &end); 253 virtual void showDates(const QDate &start, const QDate &end);
254 virtual void showEvents(QPtrList<Event> eventList); 254 virtual void showEvents(QPtrList<Event> eventList);
255 255
256 void changeEventDisplay(Event *, int); 256 void changeEventDisplay(Event *, int);
257 257
258 void clearSelection(); 258 void clearSelection();
259 259
260 void showContextMenu( Incidence * ); 260 void showContextMenu( Incidence * );
261 261
262 void setSelectedCell( MonthViewCell * ); 262 void setSelectedCell( MonthViewCell * );
263 void switchView(); 263 void switchView();
264 void setKeyBoardFocus(); 264 void setKeyBoardFocus();
265 void setKeyBFocus(); 265 void setKeyBFocus();
266 266
267 protected slots: 267 protected slots:
268 void slotComputeLayout(); 268 void slotComputeLayout();
269 void selectInternalWeekNum ( int ); 269 void selectInternalWeekNum ( int );
270 void processSelectionChange(); 270 void processSelectionChange();
271 signals: 271 signals:
272 void nextMonth(); 272 void nextMonth();
273 void prevMonth(); 273 void prevMonth();
274 void selectWeekNum ( int ); 274 void selectWeekNum ( int );
275 void selectMonth (); 275 void selectMonth ();
276 void showDaySignal( QDate ); 276 void showDaySignal( QDate );
277 protected: 277 protected:
278 void resizeEvent(QResizeEvent *); 278 void resizeEvent(QResizeEvent *);
279 void viewChanged(); 279 void viewChanged();
280 void updateDayLabels(); 280 void updateDayLabels();
281 281
282 private: 282 private:
283 QTimer* mComputeLayoutTimer; 283 QTimer* mComputeLayoutTimer;
284 NavigatorBar* mNavigatorBar; 284 NavigatorBar* mNavigatorBar;
285 int currentWeek(); 285 int currentWeek();
286 bool clPending; 286 bool clPending;
287 QWidgetStack * mWidStack; 287 QWidgetStack * mWidStack;
288 QWidget* mMonthView; 288 QWidget* mMonthView;
289 QWidget* mWeekView; 289 QWidget* mWeekView;
290 bool mShowWeekView; 290 bool mShowWeekView;
291 bool updatePossible; 291 bool updatePossible;
292 int mDaysPerWeek; 292 int mDaysPerWeek;
293 int mNumWeeks; 293 int mNumWeeks;
294 int mNumCells; 294 int mNumCells;
295 //bool mWeekStartsMonday; 295 //bool mWeekStartsMonday;
296 bool mShowSatSunComp; 296 bool mShowSatSunComp;
297 void computeLayout(); 297 void computeLayout();
298 void computeLayoutWeek(); 298 void computeLayoutWeek();
299 299
300 QPtrVector<MonthViewCell> mCells; 300 QPtrVector<MonthViewCell> mCells;
301 QPtrVector<QLabel> mDayLabels; 301 QPtrVector<QLabel> mDayLabels;
302 QPtrVector<KOWeekButton> mWeekLabels; 302 QPtrVector<KOWeekButton> mWeekLabels;
303 QPtrVector<MonthViewCell> mCellsW; 303 QPtrVector<MonthViewCell> mCellsW;
304 QPtrVector<QLabel> mDayLabelsW; 304 QPtrVector<QLabel> mDayLabelsW;
305 QPtrVector<KOWeekButton> mWeekLabelsW; 305 QPtrVector<KOWeekButton> mWeekLabelsW;
306 306
307 bool mShortDayLabelsM; 307 bool mShortDayLabelsM;
308 bool mShortDayLabelsW; 308 bool mShortDayLabelsW;
309 int mWidthLongDayLabel; 309 int mWidthLongDayLabel;
310 310
311 QDate mStartDate; 311 QDate mStartDate;
312 312
313 MonthViewCell *mSelectedCell; 313 MonthViewCell *mSelectedCell;
314 314 bool mFlagKeyPressed;
315 KOEventPopupMenu *mContextMenu; 315 KOEventPopupMenu *mContextMenu;
316 void keyPressEvent ( QKeyEvent * ) ; 316 void keyPressEvent ( QKeyEvent * ) ;
317 void keyReleaseEvent ( QKeyEvent * ) ;
317 318
318}; 319};
319 320
320#endif 321#endif
diff --git a/korganizer/mainwindow.cpp b/korganizer/mainwindow.cpp
index ae03a09..09a0880 100644
--- a/korganizer/mainwindow.cpp
+++ b/korganizer/mainwindow.cpp
@@ -1,588 +1,599 @@
1#include <stdlib.h> 1#include <stdlib.h>
2 2
3#include <qaction.h> 3#include <qaction.h>
4#include <qpopupmenu.h> 4#include <qpopupmenu.h>
5#include <qpainter.h> 5#include <qpainter.h>
6#include <qwhatsthis.h> 6#include <qwhatsthis.h>
7#include <qpushbutton.h> 7#include <qpushbutton.h>
8#include <qmessagebox.h> 8#include <qmessagebox.h>
9#include <qlineedit.h> 9#include <qlineedit.h>
10#include <qtextcodec.h> 10#include <qtextcodec.h>
11#include <qfile.h> 11#include <qfile.h>
12#include <qdir.h> 12#include <qdir.h>
13#include <qapp.h> 13#include <qapp.h>
14#include <qfileinfo.h> 14#include <qfileinfo.h>
15#include <qlabel.h> 15#include <qlabel.h>
16#include <qspinbox.h> 16#include <qspinbox.h>
17#include <qcheckbox.h> 17#include <qcheckbox.h>
18#include <qmap.h> 18#include <qmap.h>
19#include <qwmatrix.h> 19#include <qwmatrix.h>
20#include <qtextbrowser.h> 20#include <qtextbrowser.h>
21#include <qtextstream.h> 21#include <qtextstream.h>
22#ifndef DESKTOP_VERSION 22#ifndef DESKTOP_VERSION
23#include <qpe/global.h> 23#include <qpe/global.h>
24#include <qpe/qpemenubar.h> 24#include <qpe/qpemenubar.h>
25#include <qpe/qpetoolbar.h> 25#include <qpe/qpetoolbar.h>
26#include <qpe/resource.h> 26#include <qpe/resource.h>
27#include <qpe/qpeapplication.h> 27#include <qpe/qpeapplication.h>
28#include <qtopia/alarmserver.h> 28#include <qtopia/alarmserver.h>
29#include <qtopia/qcopenvelope_qws.h> 29#include <qtopia/qcopenvelope_qws.h>
30#include <unistd.h> // for sleep 30#include <unistd.h> // for sleep
31#else 31#else
32#include <qmenubar.h> 32#include <qmenubar.h>
33#include <qtoolbar.h> 33#include <qtoolbar.h>
34#include <qapplication.h> 34#include <qapplication.h>
35//#include <resource.h> 35//#include <resource.h>
36 36
37#endif 37#endif
38#include <libkcal/calendarlocal.h> 38#include <libkcal/calendarlocal.h>
39#include <libkcal/todo.h> 39#include <libkcal/todo.h>
40#include <libkcal/phoneformat.h> 40#include <libkcal/phoneformat.h>
41#include <libkdepim/ksyncprofile.h> 41#include <libkdepim/ksyncprofile.h>
42#include <libkdepim/phoneaccess.h> 42#include <libkdepim/phoneaccess.h>
43#include <libkcal/kincidenceformatter.h> 43#include <libkcal/kincidenceformatter.h>
44#include <libkdepim/kpimglobalprefs.h> 44#include <libkdepim/kpimglobalprefs.h>
45 45
46#include "calendarview.h" 46#include "calendarview.h"
47#include "koviewmanager.h" 47#include "koviewmanager.h"
48#include "datenavigator.h" 48#include "datenavigator.h"
49#include "koagendaview.h" 49#include "koagendaview.h"
50#include "koagenda.h" 50#include "koagenda.h"
51#include "kodialogmanager.h" 51#include "kodialogmanager.h"
52#include "kdialogbase.h" 52#include "kdialogbase.h"
53#include "kapplication.h" 53#include "kapplication.h"
54#include "kofilterview.h" 54#include "kofilterview.h"
55#include "kstandarddirs.h" 55#include "kstandarddirs.h"
56#include "koprefs.h" 56#include "koprefs.h"
57#include "kfiledialog.h" 57#include "kfiledialog.h"
58#include "koglobals.h" 58#include "koglobals.h"
59#include "kglobal.h" 59#include "kglobal.h"
60#include "ktoolbar.h" 60#include "ktoolbar.h"
61#include "klocale.h" 61#include "klocale.h"
62#include "kconfig.h" 62#include "kconfig.h"
63#include "simplealarmclient.h" 63#include "simplealarmclient.h"
64#include "externalapphandler.h" 64#include "externalapphandler.h"
65 65
66using namespace KCal; 66using namespace KCal;
67#ifndef _WIN32_ 67#ifndef _WIN32_
68#include <unistd.h> 68#include <unistd.h>
69#else 69#else
70#ifdef _OL_IMPORT_ 70#ifdef _OL_IMPORT_
71#include "koimportoldialog.h" 71#include "koimportoldialog.h"
72#endif 72#endif
73#endif 73#endif
74#include "mainwindow.h" 74#include "mainwindow.h"
75 75
76 76
77class KOex2phonePrefs : public QDialog 77class KOex2phonePrefs : public QDialog
78{ 78{
79 public: 79 public:
80 KOex2phonePrefs( QWidget *parent=0, const char *name=0 ) : 80 KOex2phonePrefs( QWidget *parent=0, const char *name=0 ) :
81 QDialog( parent, name, true ) 81 QDialog( parent, name, true )
82 { 82 {
83 setCaption( i18n("Export to phone options") ); 83 setCaption( i18n("Export to phone options") );
84 QVBoxLayout* lay = new QVBoxLayout( this ); 84 QVBoxLayout* lay = new QVBoxLayout( this );
85 lay->setSpacing( 3 ); 85 lay->setSpacing( 3 );
86 lay->setMargin( 3 ); 86 lay->setMargin( 3 );
87 QLabel *lab; 87 QLabel *lab;
88 lay->addWidget(lab = new QLabel( i18n("Please read Help-Sync Howto\nto know what settings to use."), this ) ); 88 lay->addWidget(lab = new QLabel( i18n("Please read Help-Sync Howto\nto know what settings to use."), this ) );
89 lab->setAlignment (AlignHCenter ); 89 lab->setAlignment (AlignHCenter );
90 QHBox* temphb; 90 QHBox* temphb;
91 temphb = new QHBox( this ); 91 temphb = new QHBox( this );
92 new QLabel( i18n("I/O device: "), temphb ); 92 new QLabel( i18n("I/O device: "), temphb );
93 mPhoneDevice = new QLineEdit( temphb); 93 mPhoneDevice = new QLineEdit( temphb);
94 lay->addWidget( temphb ); 94 lay->addWidget( temphb );
95 temphb = new QHBox( this ); 95 temphb = new QHBox( this );
96 new QLabel( i18n("Connection: "), temphb ); 96 new QLabel( i18n("Connection: "), temphb );
97 mPhoneConnection = new QLineEdit( temphb); 97 mPhoneConnection = new QLineEdit( temphb);
98 lay->addWidget( temphb ); 98 lay->addWidget( temphb );
99 temphb = new QHBox( this ); 99 temphb = new QHBox( this );
100 new QLabel( i18n("Model(opt.): "), temphb ); 100 new QLabel( i18n("Model(opt.): "), temphb );
101 mPhoneModel = new QLineEdit( temphb); 101 mPhoneModel = new QLineEdit( temphb);
102 lay->addWidget( temphb ); 102 lay->addWidget( temphb );
103 mWriteBackFuture= new QCheckBox( i18n("Write back events in future only"), this ); 103 mWriteBackFuture= new QCheckBox( i18n("Write back events in future only"), this );
104 mWriteBackFuture->setChecked( true ); 104 mWriteBackFuture->setChecked( true );
105 lay->addWidget( mWriteBackFuture ); 105 lay->addWidget( mWriteBackFuture );
106 temphb = new QHBox( this ); 106 temphb = new QHBox( this );
107 new QLabel( i18n("Max. weeks in future: ") , temphb ); 107 new QLabel( i18n("Max. weeks in future: ") , temphb );
108 mWriteBackFutureWeeks= new QSpinBox(1,104, 1, temphb); 108 mWriteBackFutureWeeks= new QSpinBox(1,104, 1, temphb);
109 mWriteBackFutureWeeks->setValue( 8 ); 109 mWriteBackFutureWeeks->setValue( 8 );
110 lay->addWidget( temphb ); 110 lay->addWidget( temphb );
111 lay->addWidget(lab = new QLabel( i18n("NOTE: This will remove all old\ntodo/calendar data on phone!"), this ) ); 111 lay->addWidget(lab = new QLabel( i18n("NOTE: This will remove all old\ntodo/calendar data on phone!"), this ) );
112 lab->setAlignment (AlignHCenter ); 112 lab->setAlignment (AlignHCenter );
113 QPushButton * ok = new QPushButton( i18n("Export to mobile phone!"), this ); 113 QPushButton * ok = new QPushButton( i18n("Export to mobile phone!"), this );
114 lay->addWidget( ok ); 114 lay->addWidget( ok );
115 QPushButton * cancel = new QPushButton( i18n("Cancel"), this ); 115 QPushButton * cancel = new QPushButton( i18n("Cancel"), this );
116 lay->addWidget( cancel ); 116 lay->addWidget( cancel );
117 connect ( ok,SIGNAL(clicked() ),this , SLOT ( accept() ) ); 117 connect ( ok,SIGNAL(clicked() ),this , SLOT ( accept() ) );
118 connect (cancel, SIGNAL(clicked() ), this, SLOT ( reject()) ); 118 connect (cancel, SIGNAL(clicked() ), this, SLOT ( reject()) );
119 resize( 220, 240 ); 119 resize( 220, 240 );
120 qApp->processEvents(); 120 qApp->processEvents();
121 int dw = QApplication::desktop()->width(); 121 int dw = QApplication::desktop()->width();
122 int dh = QApplication::desktop()->height(); 122 int dh = QApplication::desktop()->height();
123 move( (dw-width())/2, (dh - height() )/2 ); 123 move( (dw-width())/2, (dh - height() )/2 );
124 } 124 }
125 125
126public: 126public:
127 QLineEdit* mPhoneConnection, *mPhoneDevice, *mPhoneModel; 127 QLineEdit* mPhoneConnection, *mPhoneDevice, *mPhoneModel;
128 QCheckBox* mWriteBackFuture; 128 QCheckBox* mWriteBackFuture;
129 QSpinBox* mWriteBackFutureWeeks; 129 QSpinBox* mWriteBackFutureWeeks;
130}; 130};
131 131
132int globalFlagBlockStartup; 132int globalFlagBlockStartup;
133MainWindow::MainWindow( QWidget *parent, const char *name, QString msg) : 133MainWindow::MainWindow( QWidget *parent, const char *name, QString msg) :
134 QMainWindow( parent, name ) 134 QMainWindow( parent, name )
135{ 135{
136 136
137 mClosed = false; 137 mClosed = false;
138 //QString confFile = KStandardDirs::appDir() + "config/korganizerrc"; 138 //QString confFile = KStandardDirs::appDir() + "config/korganizerrc";
139 QString confFile = locateLocal("config","korganizerrc"); 139 QString confFile = locateLocal("config","korganizerrc");
140 QFileInfo finf ( confFile ); 140 QFileInfo finf ( confFile );
141 bool showWarning = !finf.exists(); 141 bool showWarning = !finf.exists();
142 setIcon(SmallIcon( "ko24" ) ); 142 setIcon(SmallIcon( "ko24" ) );
143 mBlockAtStartup = true; 143 mBlockAtStartup = true;
144 mFlagKeyPressed = false; 144 mFlagKeyPressed = false;
145 setCaption("KO/Pi"); 145 setCaption("KO/Pi");
146 KOPrefs *p = KOPrefs::instance(); 146 KOPrefs *p = KOPrefs::instance();
147 KPimGlobalPrefs::instance()->setGlobalConfig(); 147 KPimGlobalPrefs::instance()->setGlobalConfig();
148 if ( p->mHourSize > 22 ) 148 if ( p->mHourSize > 22 )
149 p->mHourSize = 22; 149 p->mHourSize = 22;
150 QMainWindow::ToolBarDock tbd; 150 QMainWindow::ToolBarDock tbd;
151 if ( p->mToolBarHor ) { 151 if ( p->mToolBarHor ) {
152 if ( p->mToolBarUp ) 152 if ( p->mToolBarUp )
153 tbd = Bottom; 153 tbd = Bottom;
154 else 154 else
155 tbd = Top; 155 tbd = Top;
156 } 156 }
157 else { 157 else {
158 if ( p->mToolBarUp ) 158 if ( p->mToolBarUp )
159 tbd = Right; 159 tbd = Right;
160 else 160 else
161 tbd = Left; 161 tbd = Left;
162 } 162 }
163 if ( KOPrefs::instance()->mUseAppColors ) 163 if ( KOPrefs::instance()->mUseAppColors )
164 QApplication::setPalette( QPalette (KOPrefs::instance()->mAppColor1, KOPrefs::instance()->mAppColor2), true ); 164 QApplication::setPalette( QPalette (KOPrefs::instance()->mAppColor1, KOPrefs::instance()->mAppColor2), true );
165 globalFlagBlockStartup = 1; 165 globalFlagBlockStartup = 1;
166 iconToolBar = new QPEToolBar( this ); 166 iconToolBar = new QPEToolBar( this );
167 addToolBar (iconToolBar , tbd ); 167 addToolBar (iconToolBar , tbd );
168 168
169 if ( KOPrefs::instance()->mShowIconFilter ) { 169#ifdef DESKTOP_VERSION
170 if ( KOPrefs::instance()->mShowIconFilter )
171#else
172 if ( KOPrefs::instance()->mShowIconFilter || !p->mShowIconOnetoolbar )
173#endif
174
175{
170 if ( p->mToolBarHorF ) { 176 if ( p->mToolBarHorF ) {
171 if ( p->mToolBarUpF ) 177 if ( p->mToolBarUpF )
172 tbd = Bottom; 178 tbd = Bottom;
173 else 179 else
174 tbd = Top; 180 tbd = Top;
175 } 181 }
176 else { 182 else {
177 if ( p->mToolBarUpF ) 183 if ( p->mToolBarUpF )
178 tbd = Right; 184 tbd = Right;
179 else 185 else
180 tbd = Left; 186 tbd = Left;
181 } 187 }
182 filterToolBar = new QPEToolBar ( this ); 188 filterToolBar = new QPEToolBar ( this );
183 filterMenubar = new QPEMenuBar( filterToolBar ); 189 filterMenubar = new QPEMenuBar( filterToolBar );
184 QFontMetrics fm ( filterMenubar->font() ); 190 QFontMetrics fm ( filterMenubar->font() );
185 191
186 filterPopupMenu = new QPopupMenu( this ); 192 filterPopupMenu = new QPopupMenu( this );
187 filterMenubar->insertItem( i18n("No Filter"), filterPopupMenu,0 ); 193 filterMenubar->insertItem( i18n("No Filter"), filterPopupMenu,0 );
188 QString addTest = "Ax"; 194 QString addTest = "Ax";
189#ifdef DESKTOP_VERSION 195#ifdef DESKTOP_VERSION
190 addTest = "AAAx"; 196 addTest = "AAAx";
191#endif 197#endif
192 filterMenubar->setFixedWidth( fm.width( i18n("No Filter")+addTest ) ); 198 filterMenubar->setFixedWidth( fm.width( i18n("No Filter")+addTest ) );
193 addToolBar (filterToolBar , tbd ); 199 addToolBar (filterToolBar , tbd );
194 connect ( filterPopupMenu , SIGNAL( activated ( int ) ), this, SLOT (selectFilterPopup( int ) ) ); 200 connect ( filterPopupMenu , SIGNAL( activated ( int ) ), this, SLOT (selectFilterPopup( int ) ) );
195 connect ( filterPopupMenu , SIGNAL( aboutToShow() ), this, SLOT (fillFilterMenuPopup() ) ); 201 connect ( filterPopupMenu , SIGNAL( aboutToShow() ), this, SLOT (fillFilterMenuPopup() ) );
202 if ( !KOPrefs::instance()->mShowIconFilter && !p->mShowIconOnetoolbar )
203 filterToolBar->hide();
196 } else { 204 } else {
197 filterToolBar = 0; 205 filterToolBar = 0;
198 filterMenubar = 0; 206 filterMenubar = 0;
199 filterPopupMenu = 0; 207 filterPopupMenu = 0;
200 } 208 }
201 if ( p->mShowIconOnetoolbar ) { 209 if ( p->mShowIconOnetoolbar ) {
202 viewToolBar = iconToolBar ; 210 viewToolBar = iconToolBar ;
203 navigatorToolBar = iconToolBar ; 211 navigatorToolBar = iconToolBar ;
204 } else { 212 } else {
213#ifndef DESKTOP_VERSION
214 setToolBarsMovable( false );
215#endif
205 if ( p->mToolBarHorV ) { 216 if ( p->mToolBarHorV ) {
206 if ( p->mToolBarUpV ) 217 if ( p->mToolBarUpV )
207 tbd = Bottom; 218 tbd = Bottom;
208 else 219 else
209 tbd = Top; 220 tbd = Top;
210 } 221 }
211 else { 222 else {
212 if ( p->mToolBarUpV ) 223 if ( p->mToolBarUpV )
213 tbd = Right; 224 tbd = Right;
214 else 225 else
215 tbd = Left; 226 tbd = Left;
216 } 227 }
217 viewToolBar = new QPEToolBar( this ); 228 viewToolBar = new QPEToolBar( this );
218 addToolBar (viewToolBar , tbd ); 229 addToolBar (viewToolBar , tbd );
219 if ( p->mToolBarHorN ) { 230 if ( p->mToolBarHorN ) {
220 if ( p->mToolBarUpN ) 231 if ( p->mToolBarUpN )
221 tbd = Bottom; 232 tbd = Bottom;
222 else 233 else
223 tbd = Top; 234 tbd = Top;
224 } 235 }
225 else { 236 else {
226 if ( p->mToolBarUpN ) 237 if ( p->mToolBarUpN )
227 tbd = Right; 238 tbd = Right;
228 else 239 else
229 tbd = Left; 240 tbd = Left;
230 } 241 }
231 navigatorToolBar = new QPEToolBar( this ); 242 navigatorToolBar = new QPEToolBar( this );
232 addToolBar (navigatorToolBar , tbd ); 243 addToolBar (navigatorToolBar , tbd );
233 } 244 }
234 245
235 246
236 247
237 mCalendarModifiedFlag = false; 248 mCalendarModifiedFlag = false;
238 QLabel* splash = new QLabel(i18n("KO/Pi is starting ... "), this ); 249 QLabel* splash = new QLabel(i18n("KO/Pi is starting ... "), this );
239 splash->setAlignment ( AlignCenter ); 250 splash->setAlignment ( AlignCenter );
240 setCentralWidget( splash ); 251 setCentralWidget( splash );
241#ifndef DESKTOP_VERSION 252#ifndef DESKTOP_VERSION
242 showMaximized(); 253 showMaximized();
243#endif 254#endif
244 255
245 //qDebug("Mainwidget x %d y %d w %d h %d", x(), y(), width(), height ()); 256 //qDebug("Mainwidget x %d y %d w %d h %d", x(), y(), width(), height ());
246 setDefaultPreferences(); 257 setDefaultPreferences();
247 mCalendar = new CalendarLocal(); 258 mCalendar = new CalendarLocal();
248 mView = new CalendarView( mCalendar, this,"mCalendar " ); 259 mView = new CalendarView( mCalendar, this,"mCalendar " );
249 mView->hide(); 260 mView->hide();
250 //mView->resize(splash->size() ); 261 //mView->resize(splash->size() );
251 initActions(); 262 initActions();
252 mSyncManager = new KSyncManager((QWidget*)this, (KSyncInterface*)mView, KSyncManager::KOPI, KOPrefs::instance(), syncMenu); 263 mSyncManager = new KSyncManager((QWidget*)this, (KSyncInterface*)mView, KSyncManager::KOPI, KOPrefs::instance(), syncMenu);
253 mSyncManager->setBlockSave(false); 264 mSyncManager->setBlockSave(false);
254 mView->setSyncManager(mSyncManager); 265 mView->setSyncManager(mSyncManager);
255#ifndef DESKTOP_VERSION 266#ifndef DESKTOP_VERSION
256 iconToolBar->show(); 267 iconToolBar->show();
257 qApp->processEvents(); 268 qApp->processEvents();
258#endif 269#endif
259 //qDebug("Splashwidget x %d y %d w %d h %d", splash-> x(), splash->y(), splash->width(),splash-> height ()); 270 //qDebug("Splashwidget x %d y %d w %d h %d", splash-> x(), splash->y(), splash->width(),splash-> height ());
260 int vh = height() ; 271 int vh = height() ;
261 int vw = width(); 272 int vw = width();
262 //qDebug("Toolbar hei %d ",iconToolBar->height() ); 273 //qDebug("Toolbar hei %d ",iconToolBar->height() );
263 if ( iconToolBar->orientation () == Qt:: Horizontal ) { 274 if ( iconToolBar->orientation () == Qt:: Horizontal ) {
264 vh -= iconToolBar->height(); 275 vh -= iconToolBar->height();
265 } else { 276 } else {
266 vw -= iconToolBar->height(); 277 vw -= iconToolBar->height();
267 } 278 }
268 //mView->setMaximumSize( splash->size() ); 279 //mView->setMaximumSize( splash->size() );
269 //mView->resize( splash->size() ); 280 //mView->resize( splash->size() );
270 //qDebug("MainView x %d y %d w %d h %d", mView->x(),mView-> y(), mView->width(), mView->height ()); 281 //qDebug("MainView x %d y %d w %d h %d", mView->x(),mView-> y(), mView->width(), mView->height ());
271 mView->readSettings(); 282 mView->readSettings();
272 bool newFile = false; 283 bool newFile = false;
273 if( !QFile::exists( defaultFileName() ) ) { 284 if( !QFile::exists( defaultFileName() ) ) {
274 QFileInfo finfo ( defaultFileName() ); 285 QFileInfo finfo ( defaultFileName() );
275 QString oldFile = QDir::convertSeparators( QDir::homeDirPath()+"/Applications/korganizer/mycalendar.ics"); 286 QString oldFile = QDir::convertSeparators( QDir::homeDirPath()+"/Applications/korganizer/mycalendar.ics");
276 qDebug("oldfile %s ", oldFile.latin1()); 287 qDebug("oldfile %s ", oldFile.latin1());
277 QString message = "You are starting KO/Pi for the\nfirst time after updating to a\nversion >= 1.9.1. The location of the\ndefault calendar file has changed.\nA mycalendar.ics file was detected\nat the old location.\nThis file will be loaded now\nand stored at the new location!\n(Config file location has changed, too!)\nPlease read menu Help-What's New!\n"; 288 QString message = "You are starting KO/Pi for the\nfirst time after updating to a\nversion >= 1.9.1. The location of the\ndefault calendar file has changed.\nA mycalendar.ics file was detected\nat the old location.\nThis file will be loaded now\nand stored at the new location!\n(Config file location has changed, too!)\nPlease read menu Help-What's New!\n";
278 finfo.setFile( oldFile ); 289 finfo.setFile( oldFile );
279 if (finfo.exists() ) { 290 if (finfo.exists() ) {
280 KMessageBox::information( this, message); 291 KMessageBox::information( this, message);
281 mView->openCalendar( oldFile ); 292 mView->openCalendar( oldFile );
282 qApp->processEvents(); 293 qApp->processEvents();
283 } else { 294 } else {
284 oldFile = QDir::convertSeparators( QDir::homeDirPath()+"/korganizer/mycalendar.ics"); 295 oldFile = QDir::convertSeparators( QDir::homeDirPath()+"/korganizer/mycalendar.ics");
285 finfo.setFile( oldFile ); 296 finfo.setFile( oldFile );
286 if (finfo.exists() ) { 297 if (finfo.exists() ) {
287 KMessageBox::information( this, message); 298 KMessageBox::information( this, message);
288 mView->openCalendar( oldFile ); 299 mView->openCalendar( oldFile );
289 qApp->processEvents(); 300 qApp->processEvents();
290 } 301 }
291 } 302 }
292 mView->saveCalendar( defaultFileName() ); 303 mView->saveCalendar( defaultFileName() );
293 newFile = true; 304 newFile = true;
294 } 305 }
295 306
296 QTime neededSaveTime = QDateTime::currentDateTime().time(); 307 QTime neededSaveTime = QDateTime::currentDateTime().time();
297 mView->openCalendar( defaultFileName() ); 308 mView->openCalendar( defaultFileName() );
298 int msNeeded = neededSaveTime.msecsTo( QDateTime::currentDateTime().time() ); 309 int msNeeded = neededSaveTime.msecsTo( QDateTime::currentDateTime().time() );
299 qDebug("KO: Calendar loading time: %d ms",msNeeded ); 310 qDebug("KO: Calendar loading time: %d ms",msNeeded );
300 311
301 if ( KPimGlobalPrefs::instance()->mPreferredLanguage != KOPrefs::instance()->mOldLoadedLanguage ) { 312 if ( KPimGlobalPrefs::instance()->mPreferredLanguage != KOPrefs::instance()->mOldLoadedLanguage ) {
302 KOPrefs::instance()->setAllDefaults(); 313 KOPrefs::instance()->setAllDefaults();
303 int count = mView->addCategories(); 314 int count = mView->addCategories();
304 } 315 }
305 processIncidenceSelection( 0 ); 316 processIncidenceSelection( 0 );
306 connect( mView, SIGNAL( incidenceSelected( Incidence * ) ), 317 connect( mView, SIGNAL( incidenceSelected( Incidence * ) ),
307 SLOT( processIncidenceSelection( Incidence * ) ) ); 318 SLOT( processIncidenceSelection( Incidence * ) ) );
308 connect( mView, SIGNAL( modifiedChanged( bool ) ), 319 connect( mView, SIGNAL( modifiedChanged( bool ) ),
309 SLOT( slotModifiedChanged( bool ) ) ); 320 SLOT( slotModifiedChanged( bool ) ) );
310 321
311 322
312 connect( mView, SIGNAL( tempDisableBR(bool) ), 323 connect( mView, SIGNAL( tempDisableBR(bool) ),
313 SLOT( disableBR(bool) ) ); 324 SLOT( disableBR(bool) ) );
314 connect( &mSaveTimer, SIGNAL( timeout() ), SLOT( save() ) ); 325 connect( &mSaveTimer, SIGNAL( timeout() ), SLOT( save() ) );
315 mView->setModified( false ); 326 mView->setModified( false );
316 mBlockAtStartup = false; 327 mBlockAtStartup = false;
317 mView->setModified( false ); 328 mView->setModified( false );
318 setCentralWidget( mView ); 329 setCentralWidget( mView );
319 globalFlagBlockStartup = 0; 330 globalFlagBlockStartup = 0;
320 mView->show(); 331 mView->show();
321 delete splash; 332 delete splash;
322 if ( newFile ) 333 if ( newFile )
323 mView->updateConfig(); 334 mView->updateConfig();
324 // qApp->processEvents(); 335 // qApp->processEvents();
325 //qDebug("MainView x %d y %d w %d h %d", mView->x(),mView-> y(), mView->width(), mView->height ()); 336 //qDebug("MainView x %d y %d w %d h %d", mView->x(),mView-> y(), mView->width(), mView->height ());
326 //fillSyncMenu(); 337 //fillSyncMenu();
327 338
328 339
329 connect(mSyncManager , SIGNAL( save() ), this, SLOT( save() ) ); 340 connect(mSyncManager , SIGNAL( save() ), this, SLOT( save() ) );
330 connect(mView , SIGNAL( save() ), this, SLOT( save() ) ); 341 connect(mView , SIGNAL( save() ), this, SLOT( save() ) );
331 connect(mView , SIGNAL( saveStopTimer() ), this, SLOT( saveStopTimer() ) ); 342 connect(mView , SIGNAL( saveStopTimer() ), this, SLOT( saveStopTimer() ) );
332 connect(mSyncManager , SIGNAL( request_file() ), this, SLOT( syncFileRequest() ) ); 343 connect(mSyncManager , SIGNAL( request_file() ), this, SLOT( syncFileRequest() ) );
333 connect(mSyncManager , SIGNAL( getFile( bool )), this, SLOT(getFile( bool ) ) ); 344 connect(mSyncManager , SIGNAL( getFile( bool )), this, SLOT(getFile( bool ) ) );
334 mSyncManager->setDefaultFileName( sentSyncFile()); 345 mSyncManager->setDefaultFileName( sentSyncFile());
335 connect ( syncMenu, SIGNAL( activated ( int ) ), mSyncManager, SLOT (slotSyncMenu( int ) ) ); 346 connect ( syncMenu, SIGNAL( activated ( int ) ), mSyncManager, SLOT (slotSyncMenu( int ) ) );
336 mSyncManager->fillSyncMenu(); 347 mSyncManager->fillSyncMenu();
337 348
338 349
339 350
340 mView->viewManager()->agendaView()->setStartHour( KOPrefs::instance()->mDayBegins ); 351 mView->viewManager()->agendaView()->setStartHour( KOPrefs::instance()->mDayBegins );
341 if ( showWarning ) { 352 if ( showWarning ) {
342 KMessageBox::information( this, 353 KMessageBox::information( this,
343 "You are starting KO/Pi for the first time.\nPlease read menu: Help-What's New,\nif you did an update!\nPlease choose your timezone in the \nConfigure Dialog TAB Time Zone!\nPlease choose your language\nin the TAB Locale!\nYou get the Configure Dialog\nvia Menu: Actions - Configure....\nClick OK to show the Configure Dialog!\n", "KO/Pi information"); 354 "You are starting KO/Pi for the first time.\nPlease read menu: Help-What's New,\nif you did an update!\nPlease choose your timezone in the \nConfigure Dialog TAB Time Zone!\nPlease choose your language\nin the TAB Locale!\nYou get the Configure Dialog\nvia Menu: Actions - Configure....\nClick OK to show the Configure Dialog!\n", "KO/Pi information");
344 qApp->processEvents(); 355 qApp->processEvents();
345 mView->dialogManager()->showSyncOptions(); 356 mView->dialogManager()->showSyncOptions();
346 } 357 }
347 358
348 //US listen for result adressed from Ka/Pi 359 //US listen for result adressed from Ka/Pi
349#ifndef DESKTOP_VERSION 360#ifndef DESKTOP_VERSION
350 connect(qApp, SIGNAL (appMessage ( const QCString &, const QByteArray & )), ExternalAppHandler::instance(), SLOT (appMessage ( const QCString &, const QByteArray & ))); 361 connect(qApp, SIGNAL (appMessage ( const QCString &, const QByteArray & )), ExternalAppHandler::instance(), SLOT (appMessage ( const QCString &, const QByteArray & )));
351#endif 362#endif
352#ifndef DESKTOP_VERSION 363#ifndef DESKTOP_VERSION
353 infrared = 0; 364 infrared = 0;
354#endif 365#endif
355 updateFilterToolbar(); 366 updateFilterToolbar();
356 updateWeek( mView->startDate() ); 367 updateWeek( mView->startDate() );
357 connect( mView->dateNavigator(), SIGNAL( datesSelected( const KCal::DateList & ) ), 368 connect( mView->dateNavigator(), SIGNAL( datesSelected( const KCal::DateList & ) ),
358 SLOT( updateWeekNum( const KCal::DateList & ) ) ); 369 SLOT( updateWeekNum( const KCal::DateList & ) ) );
359 mBRdisabled = false; 370 mBRdisabled = false;
360 //toggleBeamReceive(); 371 //toggleBeamReceive();
361} 372}
362MainWindow::~MainWindow() 373MainWindow::~MainWindow()
363{ 374{
364 //qDebug("MainWindow::~MainWindow() "); 375 //qDebug("MainWindow::~MainWindow() ");
365 //save toolbar location 376 //save toolbar location
366 delete mCalendar; 377 delete mCalendar;
367 delete mSyncManager; 378 delete mSyncManager;
368#ifndef DESKTOP_VERSION 379#ifndef DESKTOP_VERSION
369 if ( infrared ) 380 if ( infrared )
370 delete infrared; 381 delete infrared;
371#endif 382#endif
372 383
373 384
374} 385}
375 386
376void MainWindow::disableBR(bool b) 387void MainWindow::disableBR(bool b)
377{ 388{
378#ifndef DESKTOP_VERSION 389#ifndef DESKTOP_VERSION
379 if ( b ) { 390 if ( b ) {
380 if ( infrared ) { 391 if ( infrared ) {
381 toggleBeamReceive(); 392 toggleBeamReceive();
382 mBRdisabled = true; 393 mBRdisabled = true;
383 } 394 }
384 mBRdisabled = true; 395 mBRdisabled = true;
385 } else { 396 } else {
386 if ( mBRdisabled ) { 397 if ( mBRdisabled ) {
387 mBRdisabled = false; 398 mBRdisabled = false;
388 //makes no sense,because other cal ap is probably running 399 //makes no sense,because other cal ap is probably running
389 // toggleBeamReceive(); 400 // toggleBeamReceive();
390 } 401 }
391 } 402 }
392#endif 403#endif
393 404
394} 405}
395bool MainWindow::beamReceiveEnabled() 406bool MainWindow::beamReceiveEnabled()
396{ 407{
397#ifndef DESKTOP_VERSION 408#ifndef DESKTOP_VERSION
398 return ( infrared != 0 ); 409 return ( infrared != 0 );
399#endif 410#endif
400 return false; 411 return false;
401} 412}
402 413
403void MainWindow::toggleBeamReceive() 414void MainWindow::toggleBeamReceive()
404{ 415{
405 if ( mBRdisabled ) 416 if ( mBRdisabled )
406 return; 417 return;
407#ifndef DESKTOP_VERSION 418#ifndef DESKTOP_VERSION
408 if ( infrared ) { 419 if ( infrared ) {
409 qDebug("disable BeamReceive "); 420 qDebug("disable BeamReceive ");
410 delete infrared; 421 delete infrared;
411 infrared = 0; 422 infrared = 0;
412 brAction->setOn(false); 423 brAction->setOn(false);
413 return; 424 return;
414 } 425 }
415 qDebug("enable BeamReceive "); 426 qDebug("enable BeamReceive ");
416 brAction->setOn(true); 427 brAction->setOn(true);
417 infrared = new QCopChannel("QPE/Application/datebook",this, "channel" ) ; 428 infrared = new QCopChannel("QPE/Application/datebook",this, "channel" ) ;
418 QObject::connect( infrared, SIGNAL (received ( const QCString &, const QByteArray & )),this, SLOT(recieve( const QCString&, const QByteArray& ))); 429 QObject::connect( infrared, SIGNAL (received ( const QCString &, const QByteArray & )),this, SLOT(recieve( const QCString&, const QByteArray& )));
419#endif 430#endif
420} 431}
421void MainWindow::showMaximized () 432void MainWindow::showMaximized ()
422{ 433{
423#ifndef DESKTOP_VERSION 434#ifndef DESKTOP_VERSION
424 if ( ! globalFlagBlockStartup ) 435 if ( ! globalFlagBlockStartup )
425 if ( mClosed ) 436 if ( mClosed )
426 mView->goToday(); 437 mView->goToday();
427#endif 438#endif
428 QWidget::showMaximized () ; 439 QWidget::showMaximized () ;
429 mClosed = false; 440 mClosed = false;
430} 441}
431void MainWindow::closeEvent( QCloseEvent* ce ) 442void MainWindow::closeEvent( QCloseEvent* ce )
432{ 443{
433 444
434 445
435 446
436 if ( ! KOPrefs::instance()->mAskForQuit ) { 447 if ( ! KOPrefs::instance()->mAskForQuit ) {
437 saveOnClose(); 448 saveOnClose();
438 mClosed = true; 449 mClosed = true;
439 ce->accept(); 450 ce->accept();
440 return; 451 return;
441 452
442 } 453 }
443 454
444 switch( QMessageBox::information( this, "KO/Pi", 455 switch( QMessageBox::information( this, "KO/Pi",
445 i18n("Do you really want\nto close KO/Pi?"), 456 i18n("Do you really want\nto close KO/Pi?"),
446 i18n("Close"), i18n("No"), 457 i18n("Close"), i18n("No"),
447 0, 0 ) ) { 458 0, 0 ) ) {
448 case 0: 459 case 0:
449 saveOnClose(); 460 saveOnClose();
450 mClosed = true; 461 mClosed = true;
451 ce->accept(); 462 ce->accept();
452 break; 463 break;
453 case 1: 464 case 1:
454 ce->ignore(); 465 ce->ignore();
455 break; 466 break;
456 case 2: 467 case 2:
457 468
458 default: 469 default:
459 break; 470 break;
460 } 471 }
461 472
462 473
463} 474}
464 475
465void MainWindow::recieve( const QCString& cmsg, const QByteArray& data ) 476void MainWindow::recieve( const QCString& cmsg, const QByteArray& data )
466{ 477{
467 QDataStream stream( data, IO_ReadOnly ); 478 QDataStream stream( data, IO_ReadOnly );
468 // QMessageBox::about( this, "About KOrganizer/Pi", "*" +msg +"*" ); 479 // QMessageBox::about( this, "About KOrganizer/Pi", "*" +msg +"*" );
469 //QString datamess; 480 //QString datamess;
470 //qDebug("message "); 481 //qDebug("message ");
471 qDebug("KO: QCOP message received: %s ", cmsg.data() ); 482 qDebug("KO: QCOP message received: %s ", cmsg.data() );
472 483
473 if ( cmsg == "setDocument(QString)" ) { 484 if ( cmsg == "setDocument(QString)" ) {
474 QDataStream stream( data, IO_ReadOnly ); 485 QDataStream stream( data, IO_ReadOnly );
475 QString fileName; 486 QString fileName;
476 stream >> fileName; 487 stream >> fileName;
477 //qDebug("filename %s ", fileName.latin1()); 488 //qDebug("filename %s ", fileName.latin1());
478 showMaximized(); 489 showMaximized();
479 raise(); 490 raise();
480 KOPrefs::instance()->mLastSyncedLocalFile = fileName ; 491 KOPrefs::instance()->mLastSyncedLocalFile = fileName ;
481 mSyncManager->slotSyncMenu( 1002 ); 492 mSyncManager->slotSyncMenu( 1002 );
482 return; 493 return;
483 } 494 }
484 495
485 if ( cmsg == "-writeFile" ) { 496 if ( cmsg == "-writeFile" ) {
486 // I made from the "-writeFile" an "-writeAlarm" 497 // I made from the "-writeFile" an "-writeAlarm"
487 mView->viewManager()->showWhatsNextView(); 498 mView->viewManager()->showWhatsNextView();
488 mCalendar->checkAlarmForIncidence( 0, true); 499 mCalendar->checkAlarmForIncidence( 0, true);
489 showMaximized(); 500 showMaximized();
490 raise(); 501 raise();
491 return; 502 return;
492 503
493 } 504 }
494 if ( cmsg == "-writeFileSilent" ) { 505 if ( cmsg == "-writeFileSilent" ) {
495 // I made from the "-writeFile" an "-writeAlarm" 506 // I made from the "-writeFile" an "-writeAlarm"
496 // mView->viewManager()->showWhatsNextView(); 507 // mView->viewManager()->showWhatsNextView();
497 mCalendar->checkAlarmForIncidence( 0, true); 508 mCalendar->checkAlarmForIncidence( 0, true);
498 //showMaximized(); 509 //showMaximized();
499 //raise(); 510 //raise();
500 hide(); 511 hide();
501 return; 512 return;
502 } 513 }
503 if ( cmsg == "-newCountdown" ) { 514 if ( cmsg == "-newCountdown" ) {
504 qDebug("newCountdown "); 515 qDebug("newCountdown ");
505 516
506 } 517 }
507 QString msg ; 518 QString msg ;
508 QString allmsg = cmsg; 519 QString allmsg = cmsg;
509 while ( allmsg.length() > 0 ) { 520 while ( allmsg.length() > 0 ) {
510 int nextC = allmsg.find( "-", 1 ); 521 int nextC = allmsg.find( "-", 1 );
511 if ( nextC == -1 ) { 522 if ( nextC == -1 ) {
512 msg = allmsg; 523 msg = allmsg;
513 allmsg = ""; 524 allmsg = "";
514 } else{ 525 } else{
515 msg = allmsg.left( nextC ); 526 msg = allmsg.left( nextC );
516 allmsg = allmsg.mid( nextC, allmsg.length()-nextC ); 527 allmsg = allmsg.mid( nextC, allmsg.length()-nextC );
517 } 528 }
518 //qDebug("msg: %s all: %s ", msg.latin1(), allmsg.latin1() ); 529 //qDebug("msg: %s all: %s ", msg.latin1(), allmsg.latin1() );
519 if ( msg == "-newEvent" ) { 530 if ( msg == "-newEvent" ) {
520 mView->newEvent(); 531 mView->newEvent();
521 } 532 }
522 if ( msg == "-newTodo" ) { 533 if ( msg == "-newTodo" ) {
523 mView->newTodo(); 534 mView->newTodo();
524 535
525 } 536 }
526 if ( msg == "-showWN" ) { 537 if ( msg == "-showWN" ) {
527 mView->viewManager()->showWhatsNextView(); 538 mView->viewManager()->showWhatsNextView();
528 } 539 }
529 if ( msg == "-showTodo" ) { 540 if ( msg == "-showTodo" ) {
530 mView->viewManager()->showTodoView(); 541 mView->viewManager()->showTodoView();
531 } 542 }
532 if ( msg == "-showList" ) { 543 if ( msg == "-showList" ) {
533 mView->viewManager()->showListView(); 544 mView->viewManager()->showListView();
534 } 545 }
535 else if ( msg == "-showDay" ) { 546 else if ( msg == "-showDay" ) {
536 mView->viewManager()->showDayView(); 547 mView->viewManager()->showDayView();
537 } 548 }
538 else if ( msg == "-showWWeek" ) { 549 else if ( msg == "-showWWeek" ) {
539 mView->viewManager()->showWorkWeekView(); 550 mView->viewManager()->showWorkWeekView();
540 } 551 }
541 else if ( msg == "-ringSync" ) { 552 else if ( msg == "-ringSync" ) {
542 mSyncManager->multiSync( false ); 553 mSyncManager->multiSync( false );
543 } 554 }
544 else if ( msg == "-showWeek" ) { 555 else if ( msg == "-showWeek" ) {
545 mView->viewManager()->showWeekView(); 556 mView->viewManager()->showWeekView();
546 } 557 }
547 else if ( msg == "-showTodo" ) { 558 else if ( msg == "-showTodo" ) {
548 mView->viewManager()->showTodoView(); 559 mView->viewManager()->showTodoView();
549 } 560 }
550 else if ( msg == "-showJournal" ) { 561 else if ( msg == "-showJournal" ) {
551 mView->dateNavigator()->selectDates( 1 ); 562 mView->dateNavigator()->selectDates( 1 );
552 mView->dateNavigator()->selectToday(); 563 mView->dateNavigator()->selectToday();
553 mView->viewManager()->showJournalView(); 564 mView->viewManager()->showJournalView();
554 } 565 }
555 else if ( msg == "-showKO" ) { 566 else if ( msg == "-showKO" ) {
556 mView->viewManager()->showNextXView(); 567 mView->viewManager()->showNextXView();
557 } 568 }
558 else if ( msg == "-showWNext" ) { 569 else if ( msg == "-showWNext" ) {
559 mView->viewManager()->showWhatsNextView(); 570 mView->viewManager()->showWhatsNextView();
560 } 571 }
561 else if ( msg == "nextView()" ) { 572 else if ( msg == "nextView()" ) {
562 mView->viewManager()->showNextView(); 573 mView->viewManager()->showNextView();
563 } 574 }
564 else if ( msg == "-showNextXView" ) { 575 else if ( msg == "-showNextXView" ) {
565 mView->viewManager()->showNextXView(); 576 mView->viewManager()->showNextXView();
566 } 577 }
567 578
568 579
569 } 580 }
570 581
571 showMaximized(); 582 showMaximized();
572 raise(); 583 raise();
573} 584}
574 585
575QPixmap MainWindow::loadPixmap( QString name ) 586QPixmap MainWindow::loadPixmap( QString name )
576{ 587{
577 return SmallIcon( name ); 588 return SmallIcon( name );
578 589
579} 590}
580void MainWindow::initActions() 591void MainWindow::initActions()
581{ 592{
582 //KOPrefs::instance()->mShowFullMenu 593 //KOPrefs::instance()->mShowFullMenu
583 iconToolBar->clear(); 594 iconToolBar->clear();
584 KOPrefs *p = KOPrefs::instance(); 595 KOPrefs *p = KOPrefs::instance();
585 //QPEMenuBar *menuBar1;// = new QPEMenuBar( iconToolBar ); 596 //QPEMenuBar *menuBar1;// = new QPEMenuBar( iconToolBar );
586 597
587 QPopupMenu *viewMenu = new QPopupMenu( this ); 598 QPopupMenu *viewMenu = new QPopupMenu( this );
588 QPopupMenu *actionMenu = new QPopupMenu( this ); 599 QPopupMenu *actionMenu = new QPopupMenu( this );
@@ -2029,384 +2040,397 @@ void MainWindow::fillFilterMenu()
2029 selectFilterMenu->insertItem( filter->name(), iii ); 2040 selectFilterMenu->insertItem( filter->name(), iii );
2030 if ( filter == curfilter) 2041 if ( filter == curfilter)
2031 selectFilterMenu->setItemChecked( iii, checkitem ); 2042 selectFilterMenu->setItemChecked( iii, checkitem );
2032 filter = fili.next(); 2043 filter = fili.next();
2033 ++iii; 2044 ++iii;
2034 } 2045 }
2035 if ( !checkitem ) 2046 if ( !checkitem )
2036 selectFilterMenu->setItemChecked( 1, true ); 2047 selectFilterMenu->setItemChecked( 1, true );
2037} 2048}
2038void MainWindow::fillFilterMenuPopup() 2049void MainWindow::fillFilterMenuPopup()
2039{ 2050{
2040 filterPopupMenu->clear(); 2051 filterPopupMenu->clear();
2041 filterPopupMenu->insertItem(i18n ( "No Filter" ), 0 ); 2052 filterPopupMenu->insertItem(i18n ( "No Filter" ), 0 );
2042 2053
2043 filterPopupMenu->insertSeparator(); 2054 filterPopupMenu->insertSeparator();
2044 QPtrList<CalFilter> fili = mView->filters(); 2055 QPtrList<CalFilter> fili = mView->filters();
2045 CalFilter *curfilter = mView->filterView()->selectedFilter(); 2056 CalFilter *curfilter = mView->filterView()->selectedFilter();
2046 CalFilter *filter = fili.first(); 2057 CalFilter *filter = fili.first();
2047 int iii = 1; 2058 int iii = 1;
2048 bool checkitem = mView->filterView()->filtersEnabled(); 2059 bool checkitem = mView->filterView()->filtersEnabled();
2049 while(filter) { 2060 while(filter) {
2050 filterPopupMenu->insertItem( filter->name(), iii ); 2061 filterPopupMenu->insertItem( filter->name(), iii );
2051 if ( filter == curfilter) 2062 if ( filter == curfilter)
2052 filterPopupMenu->setItemChecked( iii, checkitem ); 2063 filterPopupMenu->setItemChecked( iii, checkitem );
2053 filter = fili.next(); 2064 filter = fili.next();
2054 ++iii; 2065 ++iii;
2055 } 2066 }
2056 if ( !checkitem ) 2067 if ( !checkitem )
2057 filterPopupMenu->setItemChecked( 0, true ); 2068 filterPopupMenu->setItemChecked( 0, true );
2058} 2069}
2059void MainWindow::selectFilter( int fil ) 2070void MainWindow::selectFilter( int fil )
2060{ 2071{
2061 2072
2062 if ( fil == 0 ) { 2073 if ( fil == 0 ) {
2063 mView->editFilters( ); 2074 mView->editFilters( );
2064 } else if ( fil == 1 ){ 2075 } else if ( fil == 1 ){
2065 if ( mView->filterView()->filtersEnabled() ) 2076 if ( mView->filterView()->filtersEnabled() )
2066 mView->toggleFilerEnabled( ); 2077 mView->toggleFilerEnabled( );
2067 } else { 2078 } else {
2068 if ( !mView->filterView()->filtersEnabled() ) { 2079 if ( !mView->filterView()->filtersEnabled() ) {
2069 mView->filterView()->blockSignals( true ); 2080 mView->filterView()->blockSignals( true );
2070 mView->toggleFilerEnabled( ); 2081 mView->toggleFilerEnabled( );
2071 mView->filterView()->blockSignals( false ); 2082 mView->filterView()->blockSignals( false );
2072 } 2083 }
2073 mView->selectFilter( fil-2 ); 2084 mView->selectFilter( fil-2 );
2074 } 2085 }
2075} 2086}
2076void MainWindow::updateFilterToolbar() 2087void MainWindow::updateFilterToolbar()
2077{ 2088{
2078 if ( filterMenubar ) { 2089 if ( filterMenubar ) {
2079 if ( !mView->filterView()->filtersEnabled() ) { 2090 if ( !mView->filterView()->filtersEnabled() ) {
2080 filterMenubar->changeItem( 0, i18n("No Filter") ); 2091 filterMenubar->changeItem( 0, i18n("No Filter") );
2081 } else { 2092 } else {
2082 CalFilter *curfilter = mView->filterView()->selectedFilter(); 2093 CalFilter *curfilter = mView->filterView()->selectedFilter();
2083 if ( curfilter ) { 2094 if ( curfilter ) {
2084 filterMenubar->changeItem( 0, curfilter->name() ); 2095 filterMenubar->changeItem( 0, curfilter->name() );
2085 } 2096 }
2086 } 2097 }
2087 } 2098 }
2088} 2099}
2089void MainWindow::selectFilterPopup( int fil ) 2100void MainWindow::selectFilterPopup( int fil )
2090{ 2101{
2091 selectFilter( fil + 1 ); 2102 selectFilter( fil + 1 );
2092 2103
2093} 2104}
2094void MainWindow::configureToolBar( int item ) 2105void MainWindow::configureToolBar( int item )
2095{ 2106{
2096 2107
2097 configureToolBarMenu->setItemChecked( item, !configureToolBarMenu-> isItemChecked ( item ) ); 2108 configureToolBarMenu->setItemChecked( item, !configureToolBarMenu-> isItemChecked ( item ) );
2098 KOPrefs *p = KOPrefs::instance(); 2109 KOPrefs *p = KOPrefs::instance();
2099 p-> mShowIconStretch= configureToolBarMenu->isItemChecked( 5 ); 2110 p-> mShowIconStretch= configureToolBarMenu->isItemChecked( 5 );
2100 p-> mShowIconOnetoolbar = configureToolBarMenu->isItemChecked( 6 ); 2111 p-> mShowIconOnetoolbar = configureToolBarMenu->isItemChecked( 6 );
2101 p-> mShowIconFilter = configureToolBarMenu->isItemChecked( 7 ); 2112 p-> mShowIconFilter = configureToolBarMenu->isItemChecked( 7 );
2102 p-> mShowIconNewEvent= configureToolBarMenu->isItemChecked( 10 ); 2113 p-> mShowIconNewEvent= configureToolBarMenu->isItemChecked( 10 );
2103 p->mShowIconNewTodo = configureToolBarMenu->isItemChecked( 20 ); 2114 p->mShowIconNewTodo = configureToolBarMenu->isItemChecked( 20 );
2104 p->mShowIconNavigator = configureToolBarMenu->isItemChecked( 22 ); 2115 p->mShowIconNavigator = configureToolBarMenu->isItemChecked( 22 );
2105 p->mShowIconAllday = configureToolBarMenu->isItemChecked( 24 ); 2116 p->mShowIconAllday = configureToolBarMenu->isItemChecked( 24 );
2106 p->mShowIconFilterview = configureToolBarMenu->isItemChecked( 26 ); 2117 p->mShowIconFilterview = configureToolBarMenu->isItemChecked( 26 );
2107 p->mShowIconToggleFull = configureToolBarMenu->isItemChecked( 28 ); 2118 p->mShowIconToggleFull = configureToolBarMenu->isItemChecked( 28 );
2108 p-> mShowIconSearch= configureToolBarMenu->isItemChecked( 120 ); 2119 p-> mShowIconSearch= configureToolBarMenu->isItemChecked( 120 );
2109 p-> mShowIconList= configureToolBarMenu->isItemChecked( 30 ); 2120 p-> mShowIconList= configureToolBarMenu->isItemChecked( 30 );
2110 p-> mShowIconDay1= configureToolBarMenu->isItemChecked( 40 ); 2121 p-> mShowIconDay1= configureToolBarMenu->isItemChecked( 40 );
2111 p-> mShowIconDay5= configureToolBarMenu->isItemChecked( 50 ); 2122 p-> mShowIconDay5= configureToolBarMenu->isItemChecked( 50 );
2112 p-> mShowIconDay6= configureToolBarMenu->isItemChecked( 75 ); 2123 p-> mShowIconDay6= configureToolBarMenu->isItemChecked( 75 );
2113 p-> mShowIconDay7= configureToolBarMenu->isItemChecked( 60 ); 2124 p-> mShowIconDay7= configureToolBarMenu->isItemChecked( 60 );
2114 p-> mShowIconMonth= configureToolBarMenu->isItemChecked( 70 ); 2125 p-> mShowIconMonth= configureToolBarMenu->isItemChecked( 70 );
2115 p-> mShowIconTodoview= configureToolBarMenu->isItemChecked( 80 ); 2126 p-> mShowIconTodoview= configureToolBarMenu->isItemChecked( 80 );
2116 p-> mShowIconBackFast= configureToolBarMenu->isItemChecked( 200 ); 2127 p-> mShowIconBackFast= configureToolBarMenu->isItemChecked( 200 );
2117 p-> mShowIconBack = configureToolBarMenu->isItemChecked( 210 ); 2128 p-> mShowIconBack = configureToolBarMenu->isItemChecked( 210 );
2118 p-> mShowIconToday= configureToolBarMenu->isItemChecked( 130 ); 2129 p-> mShowIconToday= configureToolBarMenu->isItemChecked( 130 );
2119 p-> mShowIconForward= configureToolBarMenu->isItemChecked( 220 ); 2130 p-> mShowIconForward= configureToolBarMenu->isItemChecked( 220 );
2120 p-> mShowIconForwardFast= configureToolBarMenu->isItemChecked( 230 ); 2131 p-> mShowIconForwardFast= configureToolBarMenu->isItemChecked( 230 );
2121 p-> mShowIconNextDays= configureToolBarMenu->isItemChecked( 100 ); 2132 p-> mShowIconNextDays= configureToolBarMenu->isItemChecked( 100 );
2122 p-> mShowIconNext= configureToolBarMenu->isItemChecked( 110 ); 2133 p-> mShowIconNext= configureToolBarMenu->isItemChecked( 110 );
2123 p-> mShowIconJournal= configureToolBarMenu->isItemChecked( 90 ); 2134 p-> mShowIconJournal= configureToolBarMenu->isItemChecked( 90 );
2124 p-> mShowIconWhatsThis= configureToolBarMenu->isItemChecked( 300 ); 2135 p-> mShowIconWhatsThis= configureToolBarMenu->isItemChecked( 300 );
2125 p-> mShowIconWeekNum= configureToolBarMenu->isItemChecked( 400 ); 2136 p-> mShowIconWeekNum= configureToolBarMenu->isItemChecked( 400 );
2126 // initActions(); 2137 // initActions();
2127} 2138}
2128void MainWindow::setCaption ( const QString & c ) 2139void MainWindow::setCaption ( const QString & c )
2129{ 2140{
2130 QString cap = c; 2141 QString cap = c;
2131 cap.replace( QRegExp("\n"), " " ); 2142 cap.replace( QRegExp("\n"), " " );
2132 cap = cap.stripWhiteSpace(); 2143 cap = cap.stripWhiteSpace();
2133 if ( cap.isEmpty() ) 2144 if ( cap.isEmpty() )
2134 cap = "KO/Pi"; 2145 cap = "KO/Pi";
2135 QWidget::setCaption( cap ); 2146 QWidget::setCaption( cap );
2136} 2147}
2137void MainWindow::setCaptionToDates() 2148void MainWindow::setCaptionToDates()
2138{ 2149{
2139 QString selDates; 2150 QString selDates;
2140 QDate date = mView->startDate(); 2151 QDate date = mView->startDate();
2141 if ( ! date.isValid() ) { 2152 if ( ! date.isValid() ) {
2142 setCaption(""); 2153 setCaption("");
2143 return; 2154 return;
2144 } 2155 }
2145 selDates = KGlobal::locale()->formatDate( date, true); 2156 selDates = KGlobal::locale()->formatDate( date, true);
2146 if (mView->startDate() < mView->endDate() ) 2157 if (mView->startDate() < mView->endDate() )
2147 selDates += " - " + KGlobal::locale()->formatDate(mView->endDate(), true); 2158 selDates += " - " + KGlobal::locale()->formatDate(mView->endDate(), true);
2148 else { 2159 else {
2149 QString addString; 2160 QString addString;
2150 if ( date == QDateTime::currentDateTime().date() ) 2161 if ( date == QDateTime::currentDateTime().date() )
2151 addString = i18n("Today"); 2162 addString = i18n("Today");
2152 else if ( date == QDateTime::currentDateTime().date().addDays(1) ) 2163 else if ( date == QDateTime::currentDateTime().date().addDays(1) )
2153 addString = i18n("Tomorrow"); 2164 addString = i18n("Tomorrow");
2154 if ( !addString.isEmpty() ) 2165 if ( !addString.isEmpty() )
2155 selDates = addString+", "+selDates ; 2166 selDates = addString+", "+selDates ;
2156 } 2167 }
2157 setCaption( i18n("Dates: ") + selDates ); 2168 setCaption( i18n("Dates: ") + selDates );
2158 2169
2159} 2170}
2160void MainWindow::showConfigureAgenda( ) 2171void MainWindow::showConfigureAgenda( )
2161{ 2172{
2162 int iii; 2173 int iii;
2163 for ( iii = 1;iii<= 10 ;++iii ){ 2174 for ( iii = 1;iii<= 10 ;++iii ){
2164 configureAgendaMenu->setItemChecked( (iii+1)*2, false ); 2175 configureAgendaMenu->setItemChecked( (iii+1)*2, false );
2165 } 2176 }
2166 configureAgendaMenu->setItemChecked( (KOPrefs::instance()->mHourSize/2)*2, true ); 2177 configureAgendaMenu->setItemChecked( (KOPrefs::instance()->mHourSize/2)*2, true );
2167} 2178}
2168void MainWindow::configureAgenda( int item ) 2179void MainWindow::configureAgenda( int item )
2169{ 2180{
2170 if ( KOPrefs::instance()->mHourSize == item ) 2181 if ( KOPrefs::instance()->mHourSize == item )
2171 return; 2182 return;
2172 KOPrefs::instance()->mHourSize=item; 2183 KOPrefs::instance()->mHourSize=item;
2173 mView->viewManager()->agendaView()->updateConfig(); 2184 mView->viewManager()->agendaView()->updateConfig();
2174} 2185}
2175 2186
2176void MainWindow::saveCalendar() 2187void MainWindow::saveCalendar()
2177{ 2188{
2178 QString fn = KOPrefs::instance()->mLastSaveFile; 2189 QString fn = KOPrefs::instance()->mLastSaveFile;
2179 fn = KFileDialog::getSaveFileName( fn, i18n("Save backup filename"), this ); 2190 fn = KFileDialog::getSaveFileName( fn, i18n("Save backup filename"), this );
2180 2191
2181 if ( fn == "" ) 2192 if ( fn == "" )
2182 return; 2193 return;
2183 QFileInfo info; 2194 QFileInfo info;
2184 info.setFile( fn ); 2195 info.setFile( fn );
2185 QString mes; 2196 QString mes;
2186 bool createbup = true; 2197 bool createbup = true;
2187 if ( info. exists() ) { 2198 if ( info. exists() ) {
2188 mes = i18n("Backup file\nalready exists!\nOld backup file from:\n%1\nOverwrite?\n").arg(KGlobal::locale()->formatDateTime(info.lastModified (), true, false )) ; 2199 mes = i18n("Backup file\nalready exists!\nOld backup file from:\n%1\nOverwrite?\n").arg(KGlobal::locale()->formatDateTime(info.lastModified (), true, false )) ;
2189 int result = QMessageBox::warning( this, i18n("KO/Pi: Warning!"),mes, 2200 int result = QMessageBox::warning( this, i18n("KO/Pi: Warning!"),mes,
2190 i18n("Overwrite!"), i18n("Cancel"), 0, 2201 i18n("Overwrite!"), i18n("Cancel"), 0,
2191 0, 1 ); 2202 0, 1 );
2192 if ( result != 0 ) { 2203 if ( result != 0 ) {
2193 createbup = false; 2204 createbup = false;
2194 } 2205 }
2195 } 2206 }
2196 if ( createbup ) { 2207 if ( createbup ) {
2197 mView->saveCalendar( fn ); 2208 mView->saveCalendar( fn );
2198 mes = i18n("KO/Pi:Saved %1").arg(fn); 2209 mes = i18n("KO/Pi:Saved %1").arg(fn);
2199 KOPrefs::instance()->mLastSaveFile = fn; 2210 KOPrefs::instance()->mLastSaveFile = fn;
2200 setCaption(mes); 2211 setCaption(mes);
2201 } 2212 }
2202} 2213}
2203void MainWindow::loadCalendar() 2214void MainWindow::loadCalendar()
2204{ 2215{
2205 2216
2206 QString fn = KOPrefs::instance()->mLastLoadFile; 2217 QString fn = KOPrefs::instance()->mLastLoadFile;
2207 fn = KFileDialog::getOpenFileName( fn, i18n("Load backup filename"), this ); 2218 fn = KFileDialog::getOpenFileName( fn, i18n("Load backup filename"), this );
2208 2219
2209 if ( fn == "" ) 2220 if ( fn == "" )
2210 return; 2221 return;
2211 QFileInfo info; 2222 QFileInfo info;
2212 info.setFile( fn ); 2223 info.setFile( fn );
2213 QString mess; 2224 QString mess;
2214 bool loadbup = true; 2225 bool loadbup = true;
2215 if ( info. exists() ) { 2226 if ( info. exists() ) {
2216 mess = i18n("Backup file from:\n%1\nLoading backup\nfile will delete\nyour current Data!\n").arg(KGlobal::locale()->formatDateTime(info.lastModified (), true, false )); 2227 mess = i18n("Backup file from:\n%1\nLoading backup\nfile will delete\nyour current Data!\n").arg(KGlobal::locale()->formatDateTime(info.lastModified (), true, false ));
2217 int result = QMessageBox::warning( this, "KO/Pi: Warning!", 2228 int result = QMessageBox::warning( this, "KO/Pi: Warning!",
2218 mess, 2229 mess,
2219 i18n("Load!"), i18n("Cancel"), 0, 2230 i18n("Load!"), i18n("Cancel"), 0,
2220 0, 1 ); 2231 0, 1 );
2221 if ( result != 0 ) { 2232 if ( result != 0 ) {
2222 loadbup = false; 2233 loadbup = false;
2223 } 2234 }
2224 } else { 2235 } else {
2225 QMessageBox::warning( this, i18n("KO/Pi: Warning!"), 2236 QMessageBox::warning( this, i18n("KO/Pi: Warning!"),
2226 i18n("Backup file\ndoes not exist!\nNothing loaded!"), 0, 0, 2237 i18n("Backup file\ndoes not exist!\nNothing loaded!"), 0, 0,
2227 0, 1 ); 2238 0, 1 );
2228 2239
2229 return; 2240 return;
2230 } 2241 }
2231 if ( loadbup ) { 2242 if ( loadbup ) {
2232 mView->openCalendar( fn ); 2243 mView->openCalendar( fn );
2233 KOPrefs::instance()->mLastLoadFile = fn; 2244 KOPrefs::instance()->mLastLoadFile = fn;
2234 mess = i18n("KO/Pi:Loaded %1").arg(fn) ; 2245 mess = i18n("KO/Pi:Loaded %1").arg(fn) ;
2235 setCaption(mess); 2246 setCaption(mess);
2236 } 2247 }
2237 2248
2238} 2249}
2239void MainWindow::quickImportIcal() 2250void MainWindow::quickImportIcal()
2240{ 2251{
2241 importFile( KOPrefs::instance()->mLastImportFile, false ); 2252 importFile( KOPrefs::instance()->mLastImportFile, false );
2242} 2253}
2243void MainWindow::importFile( QString fn, bool quick ) 2254void MainWindow::importFile( QString fn, bool quick )
2244{ 2255{
2245 QFileInfo info; 2256 QFileInfo info;
2246 info.setFile( fn ); 2257 info.setFile( fn );
2247 QString mess; 2258 QString mess;
2248 bool loadbup = true; 2259 bool loadbup = true;
2249 if ( !info. exists() ) { 2260 if ( !info. exists() ) {
2250 mess = i18n("Import file \n...%1\ndoes not exist!\nNothing imported!\n").arg(fn.right( 30)); 2261 mess = i18n("Import file \n...%1\ndoes not exist!\nNothing imported!\n").arg(fn.right( 30));
2251 int result = QMessageBox::warning( this, i18n("KO/Pi: Warning!"), 2262 int result = QMessageBox::warning( this, i18n("KO/Pi: Warning!"),
2252 mess ); 2263 mess );
2253 return; 2264 return;
2254 } 2265 }
2255 int result = 0; 2266 int result = 0;
2256 if ( !quick ) { 2267 if ( !quick ) {
2257 mess = i18n( "Import file \n...%1\nfrom:\n%2\nDuplicated entries\nwill not be imported!\n").arg(fn.right( 25)).arg(KGlobal::locale()->formatDateTime(info.lastModified (), true, false )); 2268 mess = i18n( "Import file \n...%1\nfrom:\n%2\nDuplicated entries\nwill not be imported!\n").arg(fn.right( 25)).arg(KGlobal::locale()->formatDateTime(info.lastModified (), true, false ));
2258 result = QMessageBox::warning( this, "KO/Pi: Warning!", 2269 result = QMessageBox::warning( this, "KO/Pi: Warning!",
2259 mess, 2270 mess,
2260 "Import", "Cancel", 0, 2271 "Import", "Cancel", 0,
2261 0, 1 ); 2272 0, 1 );
2262 } 2273 }
2263 if ( result == 0 ) { 2274 if ( result == 0 ) {
2264 if ( mView->openCalendar( fn, true )) { 2275 if ( mView->openCalendar( fn, true )) {
2265 KOPrefs::instance()->mLastImportFile = fn; 2276 KOPrefs::instance()->mLastImportFile = fn;
2266 setCaption(i18n("Imported file successfully")); 2277 setCaption(i18n("Imported file successfully"));
2267 } else { 2278 } else {
2268 setCaption(i18n("Error importing file")); 2279 setCaption(i18n("Error importing file"));
2269 } 2280 }
2270 } 2281 }
2271} 2282}
2272 2283
2273void MainWindow::importIcal() 2284void MainWindow::importIcal()
2274{ 2285{
2275 2286
2276 QString fn =KOPrefs::instance()->mLastImportFile; 2287 QString fn =KOPrefs::instance()->mLastImportFile;
2277 2288
2278 fn =KFileDialog:: getOpenFileName( fn, i18n("Import filename(*.ics/*.vcs)"), this ); 2289 fn =KFileDialog:: getOpenFileName( fn, i18n("Import filename(*.ics/*.vcs)"), this );
2279 if ( fn == "" ) 2290 if ( fn == "" )
2280 return; 2291 return;
2281 importFile( fn, true ); 2292 importFile( fn, true );
2282 2293
2283} 2294}
2284 2295
2285void MainWindow::exportVCalendar() 2296void MainWindow::exportVCalendar()
2286{ 2297{
2287 QString fn = KOPrefs::instance()->mLastVcalFile; 2298 QString fn = KOPrefs::instance()->mLastVcalFile;
2288 fn = KFileDialog::getSaveFileName( fn, i18n("Export vcal filename(*.vcs)"), this ); 2299 fn = KFileDialog::getSaveFileName( fn, i18n("Export vcal filename(*.vcs)"), this );
2289 if ( fn == "" ) 2300 if ( fn == "" )
2290 return; 2301 return;
2291 QFileInfo info; 2302 QFileInfo info;
2292 info.setFile( fn ); 2303 info.setFile( fn );
2293 QString mes; 2304 QString mes;
2294 bool createbup = true; 2305 bool createbup = true;
2295 if ( info. exists() ) { 2306 if ( info. exists() ) {
2296 mes = i18n("Save file\nalready exists!\nOld save file from:\n%1\nOverwrite?\n").arg (KGlobal::locale()->formatDateTime(info.lastModified (), true, false ) ); 2307 mes = i18n("Save file\nalready exists!\nOld save file from:\n%1\nOverwrite?\n").arg (KGlobal::locale()->formatDateTime(info.lastModified (), true, false ) );
2297 int result = QMessageBox::warning( this, i18n("KO/Pi: Warning!"),mes, 2308 int result = QMessageBox::warning( this, i18n("KO/Pi: Warning!"),mes,
2298 i18n("Overwrite!"), i18n("Cancel"), 0, 2309 i18n("Overwrite!"), i18n("Cancel"), 0,
2299 0, 1 ); 2310 0, 1 );
2300 if ( result != 0 ) { 2311 if ( result != 0 ) {
2301 createbup = false; 2312 createbup = false;
2302 } 2313 }
2303 } 2314 }
2304 if ( createbup ) { 2315 if ( createbup ) {
2305 if ( mView->exportVCalendar( fn ) ) { 2316 if ( mView->exportVCalendar( fn ) ) {
2306 KOPrefs::instance()->mLastVcalFile = fn; 2317 KOPrefs::instance()->mLastVcalFile = fn;
2307 if ( fn.length() > 20 ) 2318 if ( fn.length() > 20 )
2308 mes = i18n("KO/Pi:Exported to ...%1").arg(fn.right(20)) ; 2319 mes = i18n("KO/Pi:Exported to ...%1").arg(fn.right(20)) ;
2309 else 2320 else
2310 mes = i18n("KO/Pi:Exported to %1").arg(fn ); 2321 mes = i18n("KO/Pi:Exported to %1").arg(fn );
2311 setCaption(mes); 2322 setCaption(mes);
2312 } 2323 }
2313 } 2324 }
2314 2325
2315} 2326}
2316QString MainWindow::sentSyncFile() 2327QString MainWindow::sentSyncFile()
2317{ 2328{
2318#ifdef DESKTOP_VERSION 2329#ifdef DESKTOP_VERSION
2319 return locateLocal( "tmp", "copysynccal.ics" ); 2330 return locateLocal( "tmp", "copysynccal.ics" );
2320#else 2331#else
2321 return QString( "/tmp/copysynccal.ics" ); 2332 return QString( "/tmp/copysynccal.ics" );
2322#endif 2333#endif
2323} 2334}
2324 2335
2325void MainWindow::syncFileRequest() 2336void MainWindow::syncFileRequest()
2326{ 2337{
2327 if ( KOPrefs::instance()->mPassiveSyncWithDesktop ) { 2338 if ( KOPrefs::instance()->mPassiveSyncWithDesktop ) {
2328 mSyncManager->slotSyncMenu( 999 ); 2339 mSyncManager->slotSyncMenu( 999 );
2329 } 2340 }
2330 2341
2331 setCaption(i18n("Saving Data to temp file ..." )); 2342 setCaption(i18n("Saving Data to temp file ..." ));
2332 mView->saveCalendar( sentSyncFile() ); 2343 mView->saveCalendar( sentSyncFile() );
2333 setCaption(i18n("Data saved to temp file!" )); 2344 setCaption(i18n("Data saved to temp file!" ));
2334 2345
2335} 2346}
2336void MainWindow::getFile( bool success ) 2347void MainWindow::getFile( bool success )
2337{ 2348{
2338 if ( ! success ) { 2349 if ( ! success ) {
2339 setCaption( i18n("Error receiving file. Nothing changed!") ); 2350 setCaption( i18n("Error receiving file. Nothing changed!") );
2340 return; 2351 return;
2341 } 2352 }
2342 mView->openCalendar( sentSyncFile() ); 2353 mView->openCalendar( sentSyncFile() );
2343 if ( KOPrefs::instance()->mPassiveSyncWithDesktop ) { 2354 if ( KOPrefs::instance()->mPassiveSyncWithDesktop ) {
2344 mSyncManager->slotSyncMenu( 999 ); 2355 mSyncManager->slotSyncMenu( 999 );
2345 } 2356 }
2346 setCaption( i18n("Pi-Sync successful!") ); 2357 setCaption( i18n("Pi-Sync successful!") );
2347} 2358}
2348 2359
2349void MainWindow::printSel( ) 2360void MainWindow::printSel( )
2350{ 2361{
2351 mView->viewManager()->agendaView()->agenda()->printSelection(); 2362 mView->viewManager()->agendaView()->agenda()->printSelection();
2352} 2363}
2353 2364
2354void MainWindow::printCal() 2365void MainWindow::printCal()
2355{ 2366{
2356 mView->print();//mCp->showDialog(); 2367 mView->print();//mCp->showDialog();
2357} 2368}
2358 2369
2359 2370
2360#include "libkdepim/kdatepicker.h" 2371#include "libkdepim/kdatepicker.h"
2361#include <kdatetbl.h> 2372#include <kdatetbl.h>
2362 2373
2363void MainWindow::weekAction() 2374void MainWindow::weekAction()
2364{ 2375{
2365 int month; 2376 int month;
2366 KPopupFrame* popup = new KPopupFrame(this); 2377 KPopupFrame* popup = new KPopupFrame(this);
2367 KDateInternalWeekPicker* picker = new KDateInternalWeekPicker(popup); 2378 KDateInternalWeekPicker* picker = new KDateInternalWeekPicker(popup);
2368 // ----- 2379 // -----
2369 picker->resize(picker->sizeHint()); 2380 picker->resize(picker->sizeHint());
2370 popup->setMainWidget(picker); 2381 popup->setMainWidget(picker);
2371 picker->setFocus(); 2382 picker->setFocus();
2372 connect(picker, SIGNAL(closeMe(int)), popup, SLOT(close(int))); 2383 connect(picker, SIGNAL(closeMe(int)), popup, SLOT(close(int)));
2373 int x = 0; 2384 int x = 0;
2374 int y = iconToolBar->height(); 2385 int y = iconToolBar->height();
2375 int dX = 0; 2386 int dX = 0;
2376 int dY = 0; 2387 int dY = 0;
2377 if ( iconToolBar->orientation () == Qt:: Horizontal ) { 2388 if ( iconToolBar->orientation () == Qt:: Horizontal ) {
2378 if ( iconToolBar->y() > height()/2 ) { 2389 if ( iconToolBar->y() > height()/2 ) {
2379 dY = picker->sizeHint().height()+8; 2390 dY = picker->sizeHint().height()+8;
2380 y = 0; 2391 y = 0;
2381 } 2392 }
2382 } else { 2393 } else {
2383 if ( iconToolBar->x() > width()/2 ) { // right side 2394 if ( iconToolBar->x() > width()/2 ) { // right side
2384 x=0; 2395 x=0;
2385 dX= picker->sizeHint().width()+8; 2396 dX= picker->sizeHint().width()+8;
2386 y = 0; 2397 y = 0;
2387 } else { 2398 } else {
2388 x= iconToolBar->width(); 2399 x= iconToolBar->width();
2389 y = 0; 2400 y = 0;
2390 } 2401 }
2391 } 2402 }
2392 //qDebug("dax %d dy %d %d %d ", dX, dY, iconToolBar->x(), iconToolBar->y() ); 2403 //qDebug("dax %d dy %d %d %d ", dX, dY, iconToolBar->x(), iconToolBar->y() );
2393 if(popup->exec(iconToolBar->mapToGlobal(QPoint(x,y)-QPoint( dX,dY)))) 2404 if(popup->exec(iconToolBar->mapToGlobal(QPoint(x,y)-QPoint( dX,dY))))
2394 { 2405 {
2395 month = picker->getResult(); 2406 month = picker->getResult();
2396 emit selectWeek ( month ); 2407 emit selectWeek ( month );
2397 //qDebug("weekSelected %d ", month); 2408 //qDebug("weekSelected %d ", month);
2398 } 2409 }
2399 delete popup; 2410 delete popup;
2400} 2411}
2401 2412
2402void MainWindow::hideEvent ( QHideEvent * ) 2413void MainWindow::hideEvent ( QHideEvent * )
2403{ 2414{
2404 QString message; 2415 QString message;
2405 QDateTime nextA = mCalendar->nextAlarmEventDateTime(); 2416 QDateTime nextA = mCalendar->nextAlarmEventDateTime();
2406 if ( nextA.isValid() ) { 2417 if ( nextA.isValid() ) {
2407 QString sum = mCalendar->nextSummary(); 2418 QString sum = mCalendar->nextSummary();
2408 2419
2409 message = i18n("%1 %2 - %3 (next event/todo with alarm)").arg( KGlobal::locale()->formatTime(nextA.time() , false)).arg(sum ).arg( KGlobal::locale()->formatDate(nextA.date() , false)); 2420 message = i18n("%1 %2 - %3 (next event/todo with alarm)").arg( KGlobal::locale()->formatTime(nextA.time() , false)).arg(sum ).arg( KGlobal::locale()->formatDate(nextA.date() , false));
2410 setCaption( message ); 2421 setCaption( message );
2411 } 2422 }
2412} 2423}
2424
2425void MainWindow::resizeEvent( QResizeEvent* e)
2426{
2427#ifndef DESKTOP_VERSION
2428 if ( !KOPrefs::instance()->mShowIconFilter && !KOPrefs::instance()->mShowIconOnetoolbar ) {
2429 if (QApplication::desktop()->width() > QApplication::desktop()->height() )
2430 filterToolBar->hide();
2431 else
2432 filterToolBar->show();
2433 }
2434#endif
2435 QMainWindow::resizeEvent( e);
2436}
diff --git a/korganizer/mainwindow.h b/korganizer/mainwindow.h
index 7c16aeb..4d1753f 100644
--- a/korganizer/mainwindow.h
+++ b/korganizer/mainwindow.h
@@ -1,172 +1,173 @@
1#ifndef KORGE_MAINWINDOW_H 1#ifndef KORGE_MAINWINDOW_H
2#define KORGE_MAINWINDOW_H 2#define KORGE_MAINWINDOW_H
3 3
4#include <qmainwindow.h> 4#include <qmainwindow.h>
5#include <qtimer.h> 5#include <qtimer.h>
6#include <qdict.h> 6#include <qdict.h>
7#include <qfile.h> 7#include <qfile.h>
8#include <qmenubar.h> 8#include <qmenubar.h>
9#include <qtextstream.h> 9#include <qtextstream.h>
10#include <qregexp.h> 10#include <qregexp.h>
11 11
12#include <libkcal/incidence.h> 12#include <libkcal/incidence.h>
13#include "simplealarmclient.h" 13#include "simplealarmclient.h"
14#include <ksyncmanager.h> 14#include <ksyncmanager.h>
15#ifndef DESKTOP_VERSION 15#ifndef DESKTOP_VERSION
16#include <qcopchannel_qws.h> 16#include <qcopchannel_qws.h>
17#endif 17#endif
18class QAction; 18class QAction;
19class CalendarView; 19class CalendarView;
20class KSyncProfile; 20class KSyncProfile;
21#ifdef DESKTOP_VERSION 21#ifdef DESKTOP_VERSION
22 22
23#define QPEToolBar QToolBar 23#define QPEToolBar QToolBar
24#define QPEMenuBar QMenuBar 24#define QPEMenuBar QMenuBar
25#endif 25#endif
26class QPEToolBar; 26class QPEToolBar;
27class QPEMenuBar; 27class QPEMenuBar;
28 28
29 29
30namespace KCal { 30namespace KCal {
31class CalendarLocal; 31class CalendarLocal;
32} 32}
33 33
34class KOMenuBar : public QMenuBar 34class KOMenuBar : public QMenuBar
35{ 35{
36 public: 36 public:
37 KOMenuBar( QWidget *parent=0 ): QMenuBar (parent ) {;} 37 KOMenuBar( QWidget *parent=0 ): QMenuBar (parent ) {;}
38 QSize sizeHint () const{ qDebug("sizejint ");return QSize ( 40,25 );} 38 QSize sizeHint () const{ qDebug("sizejint ");return QSize ( 40,25 );}
39}; 39};
40 40
41using namespace KCal; 41using namespace KCal;
42 42
43class MainWindow : public QMainWindow 43class MainWindow : public QMainWindow
44{ 44{
45 Q_OBJECT 45 Q_OBJECT
46 public: 46 public:
47 MainWindow( QWidget *parent = 0, const char *name = 0, QString command = ""); 47 MainWindow( QWidget *parent = 0, const char *name = 0, QString command = "");
48 ~MainWindow(); 48 ~MainWindow();
49 bool beamReceiveEnabled(); 49 bool beamReceiveEnabled();
50 static QString defaultFileName(); 50 static QString defaultFileName();
51 static QString syncFileName(); 51 static QString syncFileName();
52 static QString resourcePath(); 52 static QString resourcePath();
53 public slots: 53 public slots:
54 void setCaption ( const QString & ); 54 void setCaption ( const QString & );
55 void updateWeekNum(const KCal::DateList &); 55 void updateWeekNum(const KCal::DateList &);
56 void updateWeek(QDate); 56 void updateWeek(QDate);
57 void updateFilterToolbar(); 57 void updateFilterToolbar();
58 virtual void showMaximized (); 58 virtual void showMaximized ();
59 void configureAgenda( int ); 59 void configureAgenda( int );
60 void recieve( const QCString& msg, const QByteArray& data ); 60 void recieve( const QCString& msg, const QByteArray& data );
61 protected slots: 61 protected slots:
62 void setCaptionToDates(); 62 void setCaptionToDates();
63 void weekAction(); 63 void weekAction();
64 void about(); 64 void about();
65 void licence(); 65 void licence();
66 void faq(); 66 void faq();
67 void usertrans(); 67 void usertrans();
68 void features(); 68 void features();
69 void synchowto(); 69 void synchowto();
70 void kdesynchowto(); 70 void kdesynchowto();
71 void multisynchowto(); 71 void multisynchowto();
72 void whatsNew(); 72 void whatsNew();
73 void keyBindings(); 73 void keyBindings();
74 void aboutAutoSaving();; 74 void aboutAutoSaving();;
75 void aboutKnownBugs(); 75 void aboutKnownBugs();
76 76
77 void processIncidenceSelection( Incidence * ); 77 void processIncidenceSelection( Incidence * );
78 78
79 void importQtopia(); 79 void importQtopia();
80 void importBday(); 80 void importBday();
81 void importOL(); 81 void importOL();
82 void importIcal(); 82 void importIcal();
83 void importFile( QString, bool ); 83 void importFile( QString, bool );
84 void quickImportIcal(); 84 void quickImportIcal();
85 85
86 void slotModifiedChanged( bool ); 86 void slotModifiedChanged( bool );
87 87
88 void save(); 88 void save();
89 void saveStopTimer(); 89 void saveStopTimer();
90 void configureToolBar( int ); 90 void configureToolBar( int );
91 void printSel(); 91 void printSel();
92 void printCal(); 92 void printCal();
93 void saveCalendar(); 93 void saveCalendar();
94 void loadCalendar(); 94 void loadCalendar();
95 void exportVCalendar(); 95 void exportVCalendar();
96 void fillFilterMenu(); 96 void fillFilterMenu();
97 void fillFilterMenuTB(); 97 void fillFilterMenuTB();
98 void selectFilter( int ); 98 void selectFilter( int );
99 void fillFilterMenuPopup(); 99 void fillFilterMenuPopup();
100 void selectFilterPopup( int ); 100 void selectFilterPopup( int );
101 void exportToPhone( int ); 101 void exportToPhone( int );
102 void toggleBeamReceive(); 102 void toggleBeamReceive();
103 void disableBR(bool); 103 void disableBR(bool);
104 signals: 104 signals:
105 void selectWeek ( int ); 105 void selectWeek ( int );
106 private slots: 106 private slots:
107 void showConfigureAgenda(); 107 void showConfigureAgenda();
108 void getFile( bool ); 108 void getFile( bool );
109 void syncFileRequest(); 109 void syncFileRequest();
110 110
111 protected: 111 protected:
112 void hideEvent ( QHideEvent * ); 112 void hideEvent ( QHideEvent * );
113 QString sentSyncFile(); 113 QString sentSyncFile();
114 void displayText( QString, QString); 114 void displayText( QString, QString);
115 void enableIncidenceActions( bool ); 115 void enableIncidenceActions( bool );
116 116
117 private: 117 private:
118 bool mBRdisabled; 118 bool mBRdisabled;
119#ifndef DESKTOP_VERSION 119#ifndef DESKTOP_VERSION
120 QCopChannel* infrared; 120 QCopChannel* infrared;
121#endif 121#endif
122 QAction* brAction; 122 QAction* brAction;
123 KSyncManager* mSyncManager; 123 KSyncManager* mSyncManager;
124 bool mClosed; 124 bool mClosed;
125 void saveOnClose(); 125 void saveOnClose();
126 bool mFlagKeyPressed; 126 bool mFlagKeyPressed;
127 bool mBlockAtStartup; 127 bool mBlockAtStartup;
128 QPEToolBar *iconToolBar; 128 QPEToolBar *iconToolBar;
129 QPEToolBar *viewToolBar; 129 QPEToolBar *viewToolBar;
130 QPEToolBar *navigatorToolBar; 130 QPEToolBar *navigatorToolBar;
131 QPEToolBar *filterToolBar; 131 QPEToolBar *filterToolBar;
132 QPEMenuBar *filterMenubar; 132 QPEMenuBar *filterMenubar;
133 QPopupMenu * filterPopupMenu; 133 QPopupMenu * filterPopupMenu;
134 void initActions(); 134 void initActions();
135 void setDefaultPreferences(); 135 void setDefaultPreferences();
136 void resizeEvent( QResizeEvent* e);
136 void keyPressEvent ( QKeyEvent * ) ; 137 void keyPressEvent ( QKeyEvent * ) ;
137 void keyReleaseEvent ( QKeyEvent * ) ; 138 void keyReleaseEvent ( QKeyEvent * ) ;
138 QPopupMenu *configureToolBarMenu; 139 QPopupMenu *configureToolBarMenu;
139 QPopupMenu *selectFilterMenu; 140 QPopupMenu *selectFilterMenu;
140 QPopupMenu *selectFilterMenuTB; 141 QPopupMenu *selectFilterMenuTB;
141 QPopupMenu *configureAgendaMenu, *syncMenu; 142 QPopupMenu *configureAgendaMenu, *syncMenu;
142 CalendarLocal *mCalendar; 143 CalendarLocal *mCalendar;
143 CalendarView *mView; 144 CalendarView *mView;
144 QAction *mNewSubTodoAction; 145 QAction *mNewSubTodoAction;
145 QAction *mWeekAction; 146 QAction *mWeekAction;
146 QFont mWeekFont; 147 QFont mWeekFont;
147 QPixmap mWeekPixmap; 148 QPixmap mWeekPixmap;
148 QColor mWeekBgColor; 149 QColor mWeekBgColor;
149 150
150 QAction *mShowAction; 151 QAction *mShowAction;
151 QAction *mEditAction; 152 QAction *mEditAction;
152 QAction *mDeleteAction; 153 QAction *mDeleteAction;
153 QAction *mCloneAction; 154 QAction *mCloneAction;
154 QAction *mMoveAction; 155 QAction *mMoveAction;
155 QAction *mBeamAction; 156 QAction *mBeamAction;
156 QAction *mCancelAction; 157 QAction *mCancelAction;
157 158
158 QAction *mToggleNav; 159 QAction *mToggleNav;
159 QAction *mToggleFilter; 160 QAction *mToggleFilter;
160 QAction *mToggleAllday; 161 QAction *mToggleAllday;
161 QAction *actionFilterMenuTB; 162 QAction *actionFilterMenuTB;
162 163
163 void closeEvent( QCloseEvent* ce ); 164 void closeEvent( QCloseEvent* ce );
164 SimpleAlarmClient mAlarmClient; 165 SimpleAlarmClient mAlarmClient;
165 QTimer mSaveTimer; 166 QTimer mSaveTimer;
166 //bool mBlockSaveFlag; 167 //bool mBlockSaveFlag;
167 bool mCalendarModifiedFlag; 168 bool mCalendarModifiedFlag;
168 QPixmap loadPixmap( QString ); 169 QPixmap loadPixmap( QString );
169}; 170};
170 171
171 172
172#endif 173#endif