summaryrefslogtreecommitdiffabout
Unidiff
Diffstat (more/less context) (ignore whitespace changes)
-rw-r--r--bin/kdepim/WhatsNew.txt4
-rw-r--r--desktop/rpm/kdepim_rpm2
-rw-r--r--korganizer/komonthview.cpp20
-rw-r--r--korganizer/komonthview.h3
-rw-r--r--korganizer/koviewmanager.cpp4
-rw-r--r--version2
6 files changed, 22 insertions, 13 deletions
diff --git a/bin/kdepim/WhatsNew.txt b/bin/kdepim/WhatsNew.txt
index 6945864..65bb075 100644
--- a/bin/kdepim/WhatsNew.txt
+++ b/bin/kdepim/WhatsNew.txt
@@ -1,98 +1,102 @@
1Info about the changes in new versions of KDE-Pim/Pi 1Info about the changes in new versions of KDE-Pim/Pi
2 2
3********** VERSION 2.0.5 ************
4
5Bugfixes in KO/Pi.
6
3********** VERSION 2.0.4 ************ 7********** VERSION 2.0.4 ************
4 8
5KO/Pi: 9KO/Pi:
6Fixed problem loading translations for summary/location edit boxes in event/todo editor. 10Fixed problem loading translations for summary/location edit boxes in event/todo editor.
7 11
8Added a general "select week number" to the toolbar. 12Added a general "select week number" to the toolbar.
9 13
10Fixed some small problem of the new features introduced in version 2.0.3. 14Fixed some small problem of the new features introduced in version 2.0.3.
11 15
12Made it possible to specify one specific category as category color, 16Made it possible to specify one specific category as category color,
13if more than one categories are selected. 17if more than one categories are selected.
14 18
15Fixed a bug in saving colors for categories with non-ascii characters. 19Fixed a bug in saving colors for categories with non-ascii characters.
16(Like, e.g. German Umlauts). 20(Like, e.g. German Umlauts).
17Propably you have to set your colors again for those categories. 21Propably you have to set your colors again for those categories.
18 22
19 23
20********** VERSION 2.0.3 ************ 24********** VERSION 2.0.3 ************
21 25
22KO/Pi: 26KO/Pi:
23Added feature for changing alarm settings for many items at once: 27Added feature for changing alarm settings for many items at once:
24Open list view (or search dialog), select the desired items and choose in 28Open list view (or search dialog), select the desired items and choose in
25the popup menu: Set alarm for selected... 29the popup menu: Set alarm for selected...
26 30
27Added to the event/todo viewer the option to send an email to 31Added to the event/todo viewer the option to send an email to
28all attendees or all selected (with RSVP) attendees. 32all attendees or all selected (with RSVP) attendees.
29 33
30Made the week-month mode changing in month view faster. 34Made the week-month mode changing in month view faster.
31 35
32Made month view better useable with keyboard. 36Made month view better useable with keyboard.
33Now TAB key jumps to next cell with an event/todo. 37Now TAB key jumps to next cell with an event/todo.
34Scroll in cell with coursor keys, scroll in time (next week) with 38Scroll in cell with coursor keys, scroll in time (next week) with
35Shift/Control + coursorkeys. 39Shift/Control + coursorkeys.
36 40
37Fixed bug that the todo view flat mode was reset after first view update. 41Fixed bug that the todo view flat mode was reset after first view update.
38 42
39If a todo is displayed closed in the todo view, 43If a todo is displayed closed in the todo view,
40it is now displayed in overdue/due today color depending on the subtodos overdue/due today properties. 44it is now displayed in overdue/due today color depending on the subtodos overdue/due today properties.
41 45
42Added info about the numbers of years to the caption (title) information about a birthday event. 46Added info about the numbers of years to the caption (title) information about a birthday event.
43 47
44Made completion date in todo editor editable. 48Made completion date in todo editor editable.
45 49
46Added possibility to save/load templates for journals. 50Added possibility to save/load templates for journals.
47(Which is just a simple "save text to file" or "insert text from file". 51(Which is just a simple "save text to file" or "insert text from file".
48 52
49********** VERSION 2.0.2 ************ 53********** VERSION 2.0.2 ************
50 54
51KO/Pi: 55KO/Pi:
52Fixed the layout problem of the day label buttons 56Fixed the layout problem of the day label buttons
53of the agenda view introduced in version 2.0.1. 57of the agenda view introduced in version 2.0.1.
54 58
55Added WhatsThis support for the todo view and the list view. 59Added WhatsThis support for the todo view and the list view.
56 60
57Added a quite useful feature to the montview. 61Added a quite useful feature to the montview.
58Just click on the week numbers on the left. 62Just click on the week numbers on the left.
59And in the top right corner of month view/agenda view 63And in the top right corner of month view/agenda view
60there is now a "week number quick selector". 64there is now a "week number quick selector".
61(Click on the black triangle). 65(Click on the black triangle).
62 66
63Made the quite difficult timezone change in KO/Pi easy. 67Made the quite difficult timezone change in KO/Pi easy.
64 68
65OM/Pi: 69OM/Pi:
66Fixed too small icons on desktop. 70Fixed too small icons on desktop.
67Fixed non visible icons in mainwindow on Z with fastload enabled. 71Fixed non visible icons in mainwindow on Z with fastload enabled.
68Added signature file setting to smtp account config. 72Added signature file setting to smtp account config.
69And the signature can be edited and saved in the edit mail dialog. 73And the signature can be edited and saved in the edit mail dialog.
70That does mean: 74That does mean:
71Simply edit the signature for the selected smtp account in the 75Simply edit the signature for the selected smtp account in the
72edit new mail dialog and press the "save signature" button there. 76edit new mail dialog and press the "save signature" button there.
73Then the signature is saved to the file specified in the smtp account settings. 77Then the signature is saved to the file specified in the smtp account settings.
74If there is no file specified, it is saved automatically to the file 78If there is no file specified, it is saved automatically to the file
75kdepim/apps/kopiemail/<accountname>.sig. 79kdepim/apps/kopiemail/<accountname>.sig.
76 80
77 81
78 82
79********** VERSION 2.0.1 ************ 83********** VERSION 2.0.1 ************
80 84
81Oooops ... I forgot to test on the Zaurus 5500 ... 85Oooops ... I forgot to test on the Zaurus 5500 ...
82 86
83Fixed many problems of new (english) strings (and german translations) 87Fixed many problems of new (english) strings (and german translations)
84introduced in the latest versions, where the text was not fitting on the 88introduced in the latest versions, where the text was not fitting on the
85240x320 display of the Zaurus 5500. 89240x320 display of the Zaurus 5500.
86 90
87KO/Pi: 91KO/Pi:
88Added a popup menu ( press pen and hold to get popup ) to the agenda view 92Added a popup menu ( press pen and hold to get popup ) to the agenda view
89with many useful items (add event/todo, show next week, two weeks, month, journal). 93with many useful items (add event/todo, show next week, two weeks, month, journal).
90 94
91Added items to the todolist popup menu for: 95Added items to the todolist popup menu for:
92Display all opened, all closed or all todos flat. 96Display all opened, all closed or all todos flat.
93The "flat" view makes is possible to sort all todos after ,e.g., prio or date. 97The "flat" view makes is possible to sort all todos after ,e.g., prio or date.
94Made the reparenting of todos on the desktop possible via Drag&Drop. 98Made the reparenting of todos on the desktop possible via Drag&Drop.
95Fixed several bugs in setting the completed datetime for todos. 99Fixed several bugs in setting the completed datetime for todos.
96Added info about completed datetime of todos to the todo viewer. 100Added info about completed datetime of todos to the todo viewer.
97Now displaying a completed todo (with completed datetime set) in the agenda view 101Now displaying a completed todo (with completed datetime set) in the agenda view
98at the time of the completion. Such that now it is possible to see in the agenda view 102at the time of the completion. Such that now it is possible to see in the agenda view
diff --git a/desktop/rpm/kdepim_rpm b/desktop/rpm/kdepim_rpm
index 04c6aa1..4c53aac 100644
--- a/desktop/rpm/kdepim_rpm
+++ b/desktop/rpm/kdepim_rpm
@@ -1,84 +1,84 @@
1Summary: A collection of PIM programs 1Summary: A collection of PIM programs
2Name: KDE-Pim-Pi 2Name: KDE-Pim-Pi
3Version: 2.0.4 3Version: 2.0.5
4Release: SuSE_9.2 4Release: SuSE_9.2
5Copyright:GPL 5Copyright:GPL
6Group: Productivity/Pim 6Group: Productivity/Pim
7Source:http://sourceforge.net/projects/kdepimpi/ 7Source:http://sourceforge.net/projects/kdepimpi/
8URL:http://sourceforge.net/projects/kdepimpi/ 8URL:http://sourceforge.net/projects/kdepimpi/
9Packager: zautrix 9Packager: zautrix
10 10
11%description 11%description
12This package contains the platform-independent PIM programs from 12This package contains the platform-independent PIM programs from
13www.pi-sync.net, compiled for SuSE 9.2: 13www.pi-sync.net, compiled for SuSE 9.2:
14KTimeTacker/Pi 14KTimeTacker/Pi
15KPhone/Pi 15KPhone/Pi
16KAddressbook/Pi 16KAddressbook/Pi
17KOrganizer/Pi 17KOrganizer/Pi
18PasswordManager/Pi 18PasswordManager/Pi
19KOPieMail/Pi 19KOPieMail/Pi
20 20
21These applications do not need anything from the KDE-desktop 21These applications do not need anything from the KDE-desktop
22at all to run on Linux. However, there is a dependency from 22at all to run on Linux. However, there is a dependency from
23two KDE libs, because a small command line program is included 23two KDE libs, because a small command line program is included
24to make it possible to sync with the KDE-desktop applications. 24to make it possible to sync with the KDE-desktop applications.
25 25
26These applications are independent from the KDE-desktop 26These applications are independent from the KDE-desktop
27environment. That means, nothing of your existing 27environment. That means, nothing of your existing
28KDE-desktop setup will be changed, or any data 28KDE-desktop setup will be changed, or any data
29(calendar-addressbook) used by the KDE-desktop 29(calendar-addressbook) used by the KDE-desktop
30applications will be changed or accessed. 30applications will be changed or accessed.
31These applications stores their data and config in 31These applications stores their data and config in
32$HOME/kdepim/ 32$HOME/kdepim/
33However, because the same file format is used, 33However, because the same file format is used,
34an easy exchange of data with the KDE-desktop 34an easy exchange of data with the KDE-desktop
35is possible. 35is possible.
36A small command line program is included 36A small command line program is included
37to make it possible to sync with the KDE-desktop applications. 37to make it possible to sync with the KDE-desktop applications.
38You do not need to call this program from the commandline, 38You do not need to call this program from the commandline,
39it is called from the KDE-Pim/Pi apps when you choose there: 39it is called from the KDE-Pim/Pi apps when you choose there:
40Sync with KDE_Desktop. 40Sync with KDE_Desktop.
41If something is going wrong, please start the 41If something is going wrong, please start the
42KDE-Pim/Pi program itself from the console to get detailed output. 42KDE-Pim/Pi program itself from the console to get detailed output.
43 43
44After installation, you should have a 44After installation, you should have a
45PIM-pi 45PIM-pi
46folder in your KDE start menu, where you can 46folder in your KDE start menu, where you can
47start the applications from. 47start the applications from.
48 48
49These programs makes it possible to sync your Zaurus easily 49These programs makes it possible to sync your Zaurus easily
50(with the KDE-Pim/Pi programs running on the Zaurus) 50(with the KDE-Pim/Pi programs running on the Zaurus)
51with the KDE-desktop calendar/addressbook data. 51with the KDE-desktop calendar/addressbook data.
52If you want to use that, you have to update your 52If you want to use that, you have to update your
53KDE-desktop to version 3.3.0 or higher. 53KDE-desktop to version 3.3.0 or higher.
54SuSE 9.2 contains KDE 3.3.0 such that no update is needed. 54SuSE 9.2 contains KDE 3.3.0 such that no update is needed.
55Actually - after the (non difficult) configuration is set up - 55Actually - after the (non difficult) configuration is set up -
56with two mouseklicks on the Zaurus, 56with two mouseklicks on the Zaurus,
57the Zaurus syncs with the corresponding KDE-Pim/Pi 57the Zaurus syncs with the corresponding KDE-Pim/Pi
58program on the Linux Desktop which syncs automatically 58program on the Linux Desktop which syncs automatically
59with the KDE-desktop data. 59with the KDE-desktop data.
60 60
61If you want to use the KDE-desktop calendar/addressbook applications, 61If you want to use the KDE-desktop calendar/addressbook applications,
62just install these apps in this package and use them as a syncing tool for the 62just install these apps in this package and use them as a syncing tool for the
63Zaurus <-> KDE-desktop sync. 63Zaurus <-> KDE-desktop sync.
64The sync requires a network connection from your Zaurus to 64The sync requires a network connection from your Zaurus to
65the PC. A detailed Sync HowTo is available in the 65the PC. A detailed Sync HowTo is available in the
66Help menu of the applications. 66Help menu of the applications.
67 67
68These applications makes it also possible, that you can sync 68These applications makes it also possible, that you can sync
69(or just export the data to) your mobile phone with your 69(or just export the data to) your mobile phone with your
70data of the KDE-desktop calendar/addressbook applications. 70data of the KDE-desktop calendar/addressbook applications.
71This is tested and working for Nokia mobile phones, 71This is tested and working for Nokia mobile phones,
72it may work with others as well. 72it may work with others as well.
73(More info about that: -> Sync HowTo) 73(More info about that: -> Sync HowTo)
74 74
75NOTE: 75NOTE:
76When using SuSE 9.1 you have to update your KDE to 3.3.x 76When using SuSE 9.1 you have to update your KDE to 3.3.x
77and you have to make an online update in SuSE 9.1 to make it 77and you have to make an online update in SuSE 9.1 to make it
78possible to get the infrared connection working, such that 78possible to get the infrared connection working, such that
79you can sync your (Nokia) mobile phone via infrared. 79you can sync your (Nokia) mobile phone via infrared.
80 80
81%files 81%files
82/opt/kde3/share/applnk/PIM-pi/ 82/opt/kde3/share/applnk/PIM-pi/
83/opt/kdepimpi/ 83/opt/kdepimpi/
84/usr/lib/libmicro* 84/usr/lib/libmicro*
diff --git a/korganizer/komonthview.cpp b/korganizer/komonthview.cpp
index 9b9e164..6ae4c6f 100644
--- a/korganizer/komonthview.cpp
+++ b/korganizer/komonthview.cpp
@@ -697,194 +697,196 @@ QDate MonthViewCell::selectedIncidenceDate()
697 static_cast<MonthViewItem *>( mItemList->item( index ) ); 697 static_cast<MonthViewItem *>( mItemList->item( index ) );
698 698
699 if ( !item ) return qd; 699 if ( !item ) return qd;
700 700
701 return item->incidenceDate(); 701 return item->incidenceDate();
702} 702}
703 703
704void MonthViewCell::deselect() 704void MonthViewCell::deselect()
705{ 705{
706 mItemList->clearSelection(); 706 mItemList->clearSelection();
707 enableScrollBars( false ); 707 enableScrollBars( false );
708 // updateCell(); 708 // updateCell();
709} 709}
710void MonthViewCell::select() 710void MonthViewCell::select()
711{ 711{
712 ;// updateCell(); 712 ;// updateCell();
713} 713}
714 714
715void MonthViewCell::resizeEvent ( QResizeEvent * ) 715void MonthViewCell::resizeEvent ( QResizeEvent * )
716{ 716{
717 if ( !mMonthView->isUpdatePossible() ) 717 if ( !mMonthView->isUpdatePossible() )
718 return; 718 return;
719 719
720 int size = height() - mLabel->height() - 2; 720 int size = height() - mLabel->height() - 2;
721 if ( size > 0 ) 721 if ( size > 0 )
722 mItemList->verticalScrollBar()->setMaximumHeight( size ); 722 mItemList->verticalScrollBar()->setMaximumHeight( size );
723 size = width() - mLabel->width() -2; 723 size = width() - mLabel->width() -2;
724 if ( size > 0 ) 724 if ( size > 0 )
725 mItemList->horizontalScrollBar()->setMaximumWidth( size ); 725 mItemList->horizontalScrollBar()->setMaximumWidth( size );
726 mLabel->move( width()-mItemList->lineWidth() - mLabel->width(), height()-mItemList->lineWidth() - mLabel->height() ); 726 mLabel->move( width()-mItemList->lineWidth() - mLabel->width(), height()-mItemList->lineWidth() - mLabel->height() );
727 //mLabel->setMaximumWidth( width() - mItemList->lineWidth()*2); 727 //mLabel->setMaximumWidth( width() - mItemList->lineWidth()*2);
728} 728}
729 729
730void MonthViewCell::defaultAction( QListBoxItem *item ) 730void MonthViewCell::defaultAction( QListBoxItem *item )
731{ 731{
732 if ( !item ) return; 732 if ( !item ) return;
733 733
734 MonthViewItem *eventItem = static_cast<MonthViewItem *>( item ); 734 MonthViewItem *eventItem = static_cast<MonthViewItem *>( item );
735 Incidence *incidence = eventItem->incidence(); 735 Incidence *incidence = eventItem->incidence();
736 if ( incidence ) mMonthView->defaultAction( incidence ); 736 if ( incidence ) mMonthView->defaultAction( incidence );
737} 737}
738void MonthViewCell::showDay() 738void MonthViewCell::showDay()
739{ 739{
740 emit showDaySignal( date() ); 740 emit showDaySignal( date() );
741} 741}
742void MonthViewCell::newEvent() 742void MonthViewCell::newEvent()
743{ 743{
744 QDateTime dt( date(), QTime( KOPrefs::instance()->mStartTime, 0 ) ); 744 QDateTime dt( date(), QTime( KOPrefs::instance()->mStartTime, 0 ) );
745 emit newEventSignal( dt ); 745 emit newEventSignal( dt );
746} 746}
747void MonthViewCell::cellClicked( QListBoxItem *item ) 747void MonthViewCell::cellClicked( QListBoxItem *item )
748{ 748{
749 static QListBoxItem * lastClicked = 0; 749 static QListBoxItem * lastClicked = 0;
750 if ( item == 0 ) { 750 if ( item == 0 ) {
751 QDateTime dt( date(), QTime( KOPrefs::instance()->mStartTime, 0 ) ); 751 QDateTime dt( date(), QTime( KOPrefs::instance()->mStartTime, 0 ) );
752 emit newEventSignal( dt ); 752 emit newEventSignal( dt );
753 return; 753 return;
754 } 754 }
755 /* 755 /*
756 if ( lastClicked ) 756 if ( lastClicked )
757 if ( ! item ) { 757 if ( ! item ) {
758 if ( lastClicked->listBox() != item->listBox() ) 758 if ( lastClicked->listBox() != item->listBox() )
759 lastClicked->listBox()->clearSelection(); 759 lastClicked->listBox()->clearSelection();
760 } 760 }
761 */ 761 */
762 762
763 mMonthView->setSelectedCell( this ); 763 mMonthView->setSelectedCell( this );
764 if( KOPrefs::instance()->mEnableMonthScroll || KOPrefs::instance()->mMonthViewWeek ) enableScrollBars( true ); 764 if( KOPrefs::instance()->mEnableMonthScroll || KOPrefs::instance()->mMonthViewWeek ) enableScrollBars( true );
765 select(); 765 select();
766} 766}
767 767
768void MonthViewCell::contextMenu( QListBoxItem *item ) 768void MonthViewCell::contextMenu( QListBoxItem *item )
769{ 769{
770 if ( !item ) return; 770 if ( !item ) return;
771 771
772 MonthViewItem *eventItem = static_cast<MonthViewItem *>( item ); 772 MonthViewItem *eventItem = static_cast<MonthViewItem *>( item );
773 Incidence *incidence = eventItem->incidence(); 773 Incidence *incidence = eventItem->incidence();
774 if ( incidence ) mMonthView->showContextMenu( incidence ); 774 if ( incidence ) mMonthView->showContextMenu( incidence );
775} 775}
776 776
777void MonthViewCell::selection( QListBoxItem *item ) 777void MonthViewCell::selection( QListBoxItem *item )
778{ 778{
779 if ( !item ) return; 779 if ( !item ) return;
780 780
781 mMonthView->setSelectedCell( this ); 781 mMonthView->setSelectedCell( this );
782} 782}
783 783
784 784
785// ******************************************************************************* 785// *******************************************************************************
786// ******************************************************************************* 786// *******************************************************************************
787// ******************************************************************************* 787// *******************************************************************************
788 788
789 789
790KOMonthView::KOMonthView(Calendar *calendar, QWidget *parent, const char *name) 790KOMonthView::KOMonthView(Calendar *calendar, QWidget *parent, const char *name)
791 : KOEventView( calendar, parent, name ), 791 : KOEventView( calendar, parent, name ),
792 mDaysPerWeek( 7 ), mNumWeeks( 6 ), mNumCells( mDaysPerWeek * mNumWeeks ), 792 mDaysPerWeek( 7 ), mNumWeeks( 6 ), mNumCells( mDaysPerWeek * mNumWeeks ),
793 mShortDayLabels( false ), mWidthLongDayLabel( 0 ), mSelectedCell( 0 ) 793 mWidthLongDayLabel( 0 ), mSelectedCell( 0 )
794{ 794{
795 mShortDayLabelsM = false;
796 mShortDayLabelsW = false;
795 skipResize = false; 797 skipResize = false;
796 clPending = true; 798 clPending = true;
797 mNavigatorBar = new NavigatorBar( QDate::currentDate(), this, "useBigPixmaps" ); 799 mNavigatorBar = new NavigatorBar( QDate::currentDate(), this, "useBigPixmaps" );
798 mWidStack = new QWidgetStack( this ); 800 mWidStack = new QWidgetStack( this );
799 QVBoxLayout* hb = new QVBoxLayout( this ); 801 QVBoxLayout* hb = new QVBoxLayout( this );
800 mMonthView = new QWidget( mWidStack ); 802 mMonthView = new QWidget( mWidStack );
801 mWeekView = new QWidget( mWidStack ); 803 mWeekView = new QWidget( mWidStack );
802#if QT_VERSION >= 0x030000 804#if QT_VERSION >= 0x030000
803 mWidStack->addWidget(mMonthView ); 805 mWidStack->addWidget(mMonthView );
804 mWidStack->addWidget(mWeekView ); 806 mWidStack->addWidget(mWeekView );
805#else 807#else
806 mWidStack->addWidget( mMonthView, 1 ); 808 mWidStack->addWidget( mMonthView, 1 );
807 mWidStack->addWidget( mWeekView , 1 ); 809 mWidStack->addWidget( mWeekView , 1 );
808#endif 810#endif
809 hb->addWidget( mNavigatorBar ); 811 hb->addWidget( mNavigatorBar );
810 hb->addWidget( mWidStack ); 812 hb->addWidget( mWidStack );
811 mWeekStartsMonday = KGlobal::locale()->weekStartsMonday(); 813 mWeekStartsMonday = KGlobal::locale()->weekStartsMonday();
812 mShowWeekView = KOPrefs::instance()->mMonthViewWeek; 814 mShowWeekView = KOPrefs::instance()->mMonthViewWeek;
813 if ( mShowWeekView ) 815 if ( mShowWeekView )
814 mWeekStartsMonday = true; 816 mWeekStartsMonday = true;
815 updatePossible = false; 817 updatePossible = false;
816 //updatePossible = true; 818 //updatePossible = true;
817 mCells.setAutoDelete( true ); 819 mCells.setAutoDelete( true );
818 mShowSatSunComp = KOPrefs::instance()->mMonthViewSatSunTog ; 820 mShowSatSunComp = KOPrefs::instance()->mMonthViewSatSunTog ;
819 mDayLabels.resize( mDaysPerWeek ); 821 mDayLabels.resize( mDaysPerWeek );
820 mDayLabelsW.resize( mDaysPerWeek ); 822 mDayLabelsW.resize( mDaysPerWeek );
821 QFont bfont = font(); 823 QFont bfont = font();
822 if ( QApplication::desktop()->width() < 650 ) { 824 if ( QApplication::desktop()->width() < 650 ) {
823 bfont.setPointSize( bfont.pointSize() - 2 ); 825 bfont.setPointSize( bfont.pointSize() - 2 );
824 } 826 }
825 bfont.setBold( true ); 827 bfont.setBold( true );
826 int i; 828 int i;
827 829
828 for( i = 0; i < mDaysPerWeek; i++ ) { 830 for( i = 0; i < mDaysPerWeek; i++ ) {
829 QLabel *label = new QLabel( mMonthView ); 831 QLabel *label = new QLabel( mMonthView );
830 label->setFont(bfont); 832 label->setFont(bfont);
831 label->setFrameStyle(QFrame::Panel|QFrame::Raised); 833 label->setFrameStyle(QFrame::Panel|QFrame::Raised);
832 label->setLineWidth(1); 834 label->setLineWidth(1);
833 label->setAlignment(AlignCenter); 835 label->setAlignment(AlignCenter);
834 mDayLabels.insert( i, label ); 836 mDayLabels.insert( i, label );
835 label = new QLabel( mWeekView ); 837 label = new QLabel( mWeekView );
836 label->setFont(bfont); 838 label->setFont(bfont);
837 label->setFrameStyle(QFrame::Panel|QFrame::Raised); 839 label->setFrameStyle(QFrame::Panel|QFrame::Raised);
838 label->setLineWidth(1); 840 label->setLineWidth(1);
839 label->setAlignment(AlignCenter); 841 label->setAlignment(AlignCenter);
840 mDayLabelsW.insert( i, label ); 842 mDayLabelsW.insert( i, label );
841 } 843 }
842 844
843 bfont.setBold( false ); 845 bfont.setBold( false );
844 mWeekLabels.resize( mNumWeeks+1 ); 846 mWeekLabels.resize( mNumWeeks+1 );
845 mWeekLabelsW.resize( 2 ); 847 mWeekLabelsW.resize( 2 );
846 for( i = 0; i < mNumWeeks+1; i++ ) { 848 for( i = 0; i < mNumWeeks+1; i++ ) {
847 KOWeekButton *label = new KOWeekButton( mMonthView ); 849 KOWeekButton *label = new KOWeekButton( mMonthView );
848 label->setFocusPolicy(NoFocus); 850 label->setFocusPolicy(NoFocus);
849 label->setFont(bfont); 851 label->setFont(bfont);
850 connect( label, SIGNAL( selectWeekNum ( int )),this, SLOT( selectInternalWeekNum ( int )) ); 852 connect( label, SIGNAL( selectWeekNum ( int )),this, SLOT( selectInternalWeekNum ( int )) );
851 label->setFlat(true); 853 label->setFlat(true);
852 QWhatsThis::add(label,i18n("Click on the week number to\nshow week zoomed")); 854 QWhatsThis::add(label,i18n("Click on the week number to\nshow week zoomed"));
853 //label->setFrameStyle(QFrame::Panel|QFrame::Raised); 855 //label->setFrameStyle(QFrame::Panel|QFrame::Raised);
854 //label->setLineWidth(1); 856 //label->setLineWidth(1);
855 //label->setAlignment(AlignCenter); 857 //label->setAlignment(AlignCenter);
856 mWeekLabels.insert( i, label ); 858 mWeekLabels.insert( i, label );
857 } 859 }
858 mWeekLabels[mNumWeeks]->setText( i18n("W")); 860 mWeekLabels[mNumWeeks]->setText( i18n("W"));
859 QWhatsThis::add(mWeekLabels[mNumWeeks],i18n("Click on this to\nselect week number")); 861 QWhatsThis::add(mWeekLabels[mNumWeeks],i18n("Click on this to\nselect week number"));
860 862
861 for( i = 0; i < 1+1; i++ ) { 863 for( i = 0; i < 1+1; i++ ) {
862 KOWeekButton *label = new KOWeekButton( mWeekView ); 864 KOWeekButton *label = new KOWeekButton( mWeekView );
863 label->setFocusPolicy(NoFocus); 865 label->setFocusPolicy(NoFocus);
864 label->setFont(bfont); 866 label->setFont(bfont);
865 connect( label, SIGNAL( selectWeekNum ( int )),this, SLOT( selectInternalWeekNum ( int )) ); 867 connect( label, SIGNAL( selectWeekNum ( int )),this, SLOT( selectInternalWeekNum ( int )) );
866 label->setFlat(true); 868 label->setFlat(true);
867 QWhatsThis::add(label,i18n("Click on the week number to\nshow week zoomed")); 869 QWhatsThis::add(label,i18n("Click on the week number to\nshow week zoomed"));
868 //label->setFrameStyle(QFrame::Panel|QFrame::Raised); 870 //label->setFrameStyle(QFrame::Panel|QFrame::Raised);
869 //label->setLineWidth(1); 871 //label->setLineWidth(1);
870 //label->setAlignment(AlignCenter); 872 //label->setAlignment(AlignCenter);
871 mWeekLabelsW.insert( i, label ); 873 mWeekLabelsW.insert( i, label );
872 } 874 }
873 mWeekLabelsW[1]->setText( i18n("W")); 875 mWeekLabelsW[1]->setText( i18n("W"));
874 876
875 877
876 int row, col; 878 int row, col;
877 mCells.resize( mNumCells ); 879 mCells.resize( mNumCells );
878 for( row = 0; row < mNumWeeks; ++row ) { 880 for( row = 0; row < mNumWeeks; ++row ) {
879 for( col = 0; col < mDaysPerWeek; ++col ) { 881 for( col = 0; col < mDaysPerWeek; ++col ) {
880 MonthViewCell *cell = new MonthViewCell( this, mMonthView ); 882 MonthViewCell *cell = new MonthViewCell( this, mMonthView );
881 mCells.insert( row * mDaysPerWeek + col, cell ); 883 mCells.insert( row * mDaysPerWeek + col, cell );
882 884
883 connect( cell, SIGNAL( defaultAction( Incidence * ) ), 885 connect( cell, SIGNAL( defaultAction( Incidence * ) ),
884 SLOT( defaultAction( Incidence * ) ) ); 886 SLOT( defaultAction( Incidence * ) ) );
885 connect( cell, SIGNAL( newEventSignal( QDateTime ) ), 887 connect( cell, SIGNAL( newEventSignal( QDateTime ) ),
886 SIGNAL( newEventSignal( QDateTime ) ) ); 888 SIGNAL( newEventSignal( QDateTime ) ) );
887 connect( cell, SIGNAL( showDaySignal( QDate ) ), 889 connect( cell, SIGNAL( showDaySignal( QDate ) ),
888 SIGNAL( showDaySignal( QDate ) ) ); 890 SIGNAL( showDaySignal( QDate ) ) );
889 } 891 }
890 } 892 }
@@ -957,212 +959,212 @@ void KOMonthView::switchView()
957 } 959 }
958 if ( mShowWeekView ) 960 if ( mShowWeekView )
959 mWidStack->raiseWidget( mWeekView ); 961 mWidStack->raiseWidget( mWeekView );
960 else 962 else
961 mWidStack->raiseWidget( mMonthView ); 963 mWidStack->raiseWidget( mMonthView );
962 clPending = false; 964 clPending = false;
963} 965}
964 966
965int KOMonthView::maxDatesHint() 967int KOMonthView::maxDatesHint()
966{ 968{
967 return mNumCells; 969 return mNumCells;
968} 970}
969 971
970int KOMonthView::currentDateCount() 972int KOMonthView::currentDateCount()
971{ 973{
972 return mNumCells; 974 return mNumCells;
973} 975}
974 976
975QPtrList<Incidence> KOMonthView::selectedIncidences() 977QPtrList<Incidence> KOMonthView::selectedIncidences()
976{ 978{
977 QPtrList<Incidence> selected; 979 QPtrList<Incidence> selected;
978 980
979 if ( mSelectedCell ) { 981 if ( mSelectedCell ) {
980 Incidence *incidence = mSelectedCell->selectedIncidence(); 982 Incidence *incidence = mSelectedCell->selectedIncidence();
981 if ( incidence ) selected.append( incidence ); 983 if ( incidence ) selected.append( incidence );
982 } 984 }
983 985
984 return selected; 986 return selected;
985} 987}
986 988
987DateList KOMonthView::selectedDates() 989DateList KOMonthView::selectedDates()
988{ 990{
989 DateList selected; 991 DateList selected;
990 992
991 if ( mSelectedCell ) { 993 if ( mSelectedCell ) {
992 QDate qd = mSelectedCell->selectedIncidenceDate(); 994 QDate qd = mSelectedCell->selectedIncidenceDate();
993 if ( qd.isValid() ) selected.append( qd ); 995 if ( qd.isValid() ) selected.append( qd );
994 } 996 }
995 997
996 return selected; 998 return selected;
997} 999}
998 1000
999void KOMonthView::printPreview(CalPrinter *calPrinter, const QDate &fd, 1001void KOMonthView::printPreview(CalPrinter *calPrinter, const QDate &fd,
1000 const QDate &td) 1002 const QDate &td)
1001{ 1003{
1002#ifndef KORG_NOPRINTER 1004#ifndef KORG_NOPRINTER
1003 calPrinter->preview(CalPrinter::Month, fd, td); 1005 calPrinter->preview(CalPrinter::Month, fd, td);
1004#endif 1006#endif
1005} 1007}
1006 1008
1007void KOMonthView::updateConfig() 1009void KOMonthView::updateConfig()
1008{ 1010{
1009 1011
1010 mWeekStartsMonday = KGlobal::locale()->weekStartsMonday(); 1012 mWeekStartsMonday = KGlobal::locale()->weekStartsMonday();
1011 1013
1012 if ( mShowWeekView ) { 1014 if ( mShowWeekView ) {
1013 mWeekStartsMonday = true; 1015 mWeekStartsMonday = true;
1014 } 1016 }
1015 QFontMetrics fontmetric(mDayLabels[0]->font()); 1017 QFontMetrics fontmetric(mDayLabels[0]->font());
1016 mWidthLongDayLabel = 0; 1018 mWidthLongDayLabel = 0;
1017 1019
1018 for (int i = 0; i < 7; i++) { 1020 for (int i = 0; i < 7; i++) {
1019 int width = fontmetric.width(KOGlobals::self()->calendarSystem()->weekDayName(i+1)); 1021 int width = fontmetric.width(KOGlobals::self()->calendarSystem()->weekDayName(i+1));
1020 if ( width > mWidthLongDayLabel ) mWidthLongDayLabel = width; 1022 if ( width > mWidthLongDayLabel ) mWidthLongDayLabel = width;
1021 } 1023 }
1022 bool temp = mShowSatSunComp ; 1024 bool temp = mShowSatSunComp ;
1023 mShowSatSunComp = KOPrefs::instance()->mMonthViewSatSunTog ; 1025 mShowSatSunComp = KOPrefs::instance()->mMonthViewSatSunTog ;
1024 if ( ! mShowWeekView ) { 1026 if ( ! mShowWeekView ) {
1025 if ( temp != KOPrefs::instance()->mMonthViewSatSunTog ) 1027 if ( temp != KOPrefs::instance()->mMonthViewSatSunTog )
1026 computeLayout(); 1028 computeLayout();
1027 } 1029 }
1028 updateDayLabels(); 1030 updateDayLabels();
1029 //qDebug("KOMonthView::updateConfig() %d %d %d ",height(), mDayLabels[0]->sizeHint().height() ,mNumWeeks); 1031 //qDebug("KOMonthView::updateConfig() %d %d %d ",height(), mDayLabels[0]->sizeHint().height() ,mNumWeeks);
1030 //int cellHeight = (height() - mDayLabels[0]->sizeHint().height()) /mNumWeeks; 1032 //int cellHeight = (height() - mDayLabels[0]->sizeHint().height()) /mNumWeeks;
1031 //resizeEvent( 0 ); 1033 //resizeEvent( 0 );
1032 for (uint i = 0; i < mCells.count(); ++i) { 1034 for (uint i = 0; i < mCells.count(); ++i) {
1033 mCells[i]->updateConfig(); 1035 mCells[i]->updateConfig();
1034 } 1036 }
1035 1037
1036 for (uint i = 0; i < mCellsW.count(); ++i) { 1038 for (uint i = 0; i < mCellsW.count(); ++i) {
1037 mCellsW[i]->updateConfig(KOPrefs::instance()->mMonthViewUsesBigFont); 1039 mCellsW[i]->updateConfig(KOPrefs::instance()->mMonthViewUsesBigFont);
1038 } 1040 }
1039#ifdef DESKTOP_VERSION 1041#ifdef DESKTOP_VERSION
1040 MonthViewCell::toolTipGroup()->setEnabled(KOPrefs::instance()->mEnableToolTips); 1042 MonthViewCell::toolTipGroup()->setEnabled(KOPrefs::instance()->mEnableToolTips);
1041#endif 1043#endif
1042 updateView(); 1044 updateView();
1043} 1045}
1044 1046
1045void KOMonthView::updateDayLabels() 1047void KOMonthView::updateDayLabels()
1046{ 1048{
1047 1049
1048 QPtrVector<QLabel> *mDayLabelsT; 1050 QPtrVector<QLabel> *mDayLabelsT;
1049 1051
1050 mDayLabelsT = &mDayLabelsW; 1052 mDayLabelsT = &mDayLabelsW;
1051 for (int i = 0; i < 7; i++) { 1053 for (int i = 0; i < 7; i++) {
1052 if (mWeekStartsMonday) { 1054 if (mWeekStartsMonday) {
1053 bool show = mShortDayLabels; 1055 bool show = mShortDayLabelsW;
1054 if ( i > 4 && mShowSatSunComp && mWidthLongDayLabel > (*mDayLabelsT)[i]->width() ) 1056 if ( i > 4 && mShowSatSunComp && mWidthLongDayLabel > (*mDayLabelsT)[i]->width() )
1055 show = true; 1057 show = true;
1056 (*mDayLabelsT)[i]->setText(KOGlobals::self()->calendarSystem()->weekDayName(i+1,show)); 1058 (*mDayLabelsT)[i]->setText(KOGlobals::self()->calendarSystem()->weekDayName(i+1,show));
1057 } else { 1059 } else {
1058 if (i==0) (*mDayLabelsT)[i]->setText(KOGlobals::self()->calendarSystem()->weekDayName(7,mShortDayLabels)); 1060 if (i==0) (*mDayLabelsT)[i]->setText(KOGlobals::self()->calendarSystem()->weekDayName(7,mShortDayLabelsW));
1059 else (*mDayLabelsT)[i]->setText(KOGlobals::self()->calendarSystem()->weekDayName(i,mShortDayLabels)); 1061 else (*mDayLabelsT)[i]->setText(KOGlobals::self()->calendarSystem()->weekDayName(i,mShortDayLabelsW));
1060 1062
1061 } 1063 }
1062 } 1064 }
1063 mDayLabelsT = &mDayLabels; 1065 mDayLabelsT = &mDayLabels;
1064 for (int i = 0; i < 7; i++) { 1066 for (int i = 0; i < 7; i++) {
1065 if (mWeekStartsMonday) { 1067 if (mWeekStartsMonday) {
1066 bool show = mShortDayLabels; 1068 bool show = mShortDayLabelsM;
1067 if ( i > 4 && mShowSatSunComp && mWidthLongDayLabel > (*mDayLabelsT)[i]->width() ) 1069 if ( i > 4 && mShowSatSunComp && mWidthLongDayLabel > (*mDayLabelsT)[i]->width() )
1068 show = true; 1070 show = true;
1069 (*mDayLabelsT)[i]->setText(KOGlobals::self()->calendarSystem()->weekDayName(i+1,show)); 1071 (*mDayLabelsT)[i]->setText(KOGlobals::self()->calendarSystem()->weekDayName(i+1,show));
1070 } else { 1072 } else {
1071 if (i==0) (*mDayLabelsT)[i]->setText(KOGlobals::self()->calendarSystem()->weekDayName(7,mShortDayLabels)); 1073 if (i==0) (*mDayLabelsT)[i]->setText(KOGlobals::self()->calendarSystem()->weekDayName(7,mShortDayLabelsM));
1072 else (*mDayLabelsT)[i]->setText(KOGlobals::self()->calendarSystem()->weekDayName(i,mShortDayLabels)); 1074 else (*mDayLabelsT)[i]->setText(KOGlobals::self()->calendarSystem()->weekDayName(i,mShortDayLabelsM));
1073 1075
1074 } 1076 }
1075 } 1077 }
1076 1078
1077} 1079}
1078 1080
1079void KOMonthView::showDates(const QDate &start, const QDate &) 1081void KOMonthView::showDates(const QDate &start, const QDate &)
1080{ 1082{
1081 // kdDebug() << "KOMonthView::showDates(): " << start.toString() << endl; 1083 // kdDebug() << "KOMonthView::showDates(): " << start.toString() << endl;
1082 1084
1083 QPtrVector<MonthViewCell> *cells; 1085 QPtrVector<MonthViewCell> *cells;
1084 QPtrVector<QLabel> *dayLabels; 1086 QPtrVector<QLabel> *dayLabels;
1085 QPtrVector<KOWeekButton> *weekLabels; 1087 QPtrVector<KOWeekButton> *weekLabels;
1086 int weekNum = 6; 1088 int weekNum = 6;
1087 if ( mShowWeekView ) { 1089 if ( mShowWeekView ) {
1088 weekNum = 1; 1090 weekNum = 1;
1089 cells = &mCellsW; 1091 cells = &mCellsW;
1090 dayLabels = &mDayLabelsW; 1092 dayLabels = &mDayLabelsW;
1091 weekLabels = &mWeekLabelsW; 1093 weekLabels = &mWeekLabelsW;
1092 } else { 1094 } else {
1093 cells = &mCells; 1095 cells = &mCells;
1094 dayLabels = &mDayLabels; 1096 dayLabels = &mDayLabels;
1095 weekLabels = &mWeekLabels; 1097 weekLabels = &mWeekLabels;
1096 } 1098 }
1097 1099
1098 mStartDate = start; 1100 mStartDate = start;
1099 1101
1100 int startWeekDay = mWeekStartsMonday ? 1 : 7; 1102 int startWeekDay = mWeekStartsMonday ? 1 : 7;
1101 1103
1102 while( KOGlobals::self()->calendarSystem()->dayOfWeek(mStartDate) != startWeekDay ) { 1104 while( KOGlobals::self()->calendarSystem()->dayOfWeek(mStartDate) != startWeekDay ) {
1103 mStartDate = mStartDate.addDays( -1 ); 1105 mStartDate = mStartDate.addDays( -1 );
1104 } 1106 }
1105 1107
1106 bool primary = false; 1108 bool primary = false;
1107 uint i; 1109 uint i;
1108 for( i = 0; i < (*cells).size(); ++i ) { 1110 for( i = 0; i < (*cells).size(); ++i ) {
1109 QDate date = mStartDate.addDays( i ); 1111 QDate date = mStartDate.addDays( i );
1110 (*cells)[i]->setDate( date ); 1112 (*cells)[i]->setDate( date );
1111 1113
1112#ifndef KORG_NOPLUGINS 1114#ifndef KORG_NOPLUGINS
1113 // add holiday, if present 1115 // add holiday, if present
1114 QString hstring(KOCore::self()->holiday(date)); 1116 QString hstring(KOCore::self()->holiday(date));
1115 (*cells)[i]->setHoliday( hstring ); 1117 (*cells)[i]->setHoliday( hstring );
1116#endif 1118#endif
1117 1119
1118 } 1120 }
1119 QDate date = mStartDate.addDays( mWeekStartsMonday ? 3 : 4 ); 1121 QDate date = mStartDate.addDays( mWeekStartsMonday ? 3 : 4 );
1120 for( i = 0; i < weekNum; ++i ) { 1122 for( i = 0; i < weekNum; ++i ) {
1121 int wno; 1123 int wno;
1122 // remember, according to ISO 8601, the first week of the year is the 1124 // remember, according to ISO 8601, the first week of the year is the
1123 // first week that contains a thursday. Thus we must subtract off 4, 1125 // first week that contains a thursday. Thus we must subtract off 4,
1124 // not just 1. 1126 // not just 1.
1125 int dayOfYear = date.dayOfYear(); 1127 int dayOfYear = date.dayOfYear();
1126 if (dayOfYear % 7 != 0) 1128 if (dayOfYear % 7 != 0)
1127 wno = dayOfYear / 7 + 1; 1129 wno = dayOfYear / 7 + 1;
1128 else 1130 else
1129 wno =dayOfYear / 7; 1131 wno =dayOfYear / 7;
1130 (*weekLabels)[i]->setWeekNum( wno ); 1132 (*weekLabels)[i]->setWeekNum( wno );
1131 date = date.addDays( 7 ); 1133 date = date.addDays( 7 );
1132 } 1134 }
1133 updateView(); 1135 updateView();
1134} 1136}
1135 1137
1136void KOMonthView::showEvents(QPtrList<Event>) 1138void KOMonthView::showEvents(QPtrList<Event>)
1137{ 1139{
1138 qDebug("KOMonthView::selectEvents is not implemented yet. "); 1140 qDebug("KOMonthView::selectEvents is not implemented yet. ");
1139} 1141}
1140 1142
1141void KOMonthView::changeEventDisplay(Event *, int) 1143void KOMonthView::changeEventDisplay(Event *, int)
1142{ 1144{
1143 // this should be re-written to be much more efficient, but this 1145 // this should be re-written to be much more efficient, but this
1144 // quick-and-dirty-hack gets the job done for right now. 1146 // quick-and-dirty-hack gets the job done for right now.
1145 updateView(); 1147 updateView();
1146} 1148}
1147 1149
1148void KOMonthView::updateView() 1150void KOMonthView::updateView()
1149{ 1151{
1150 1152
1151 if ( !updatePossible ) 1153 if ( !updatePossible )
1152 return; 1154 return;
1153 //QTime ti; 1155 //QTime ti;
1154 //ti.start(); 1156 //ti.start();
1155 QPtrVector<MonthViewCell> *cells; 1157 QPtrVector<MonthViewCell> *cells;
1156 if ( mShowWeekView ) { 1158 if ( mShowWeekView ) {
1157 cells = &mCellsW; 1159 cells = &mCellsW;
1158 } else { 1160 } else {
1159 cells = &mCells; 1161 cells = &mCells;
1160 } 1162 }
1161#if 1 1163#if 1
1162 int i; 1164 int i;
1163 int timeSpan = (*cells).size()-1; 1165 int timeSpan = (*cells).size()-1;
1164 if ( KOPrefs::instance()->mMonthViewWeek ) 1166 if ( KOPrefs::instance()->mMonthViewWeek )
1165 timeSpan = 6; 1167 timeSpan = 6;
1166 for( i = 0; i < timeSpan + 1; ++i ) { 1168 for( i = 0; i < timeSpan + 1; ++i ) {
1167 (*cells)[i]->startUpdateCell(); 1169 (*cells)[i]->startUpdateCell();
1168 } 1170 }
@@ -1293,306 +1295,306 @@ void KOMonthView::computeLayoutWeek()
1293 1295
1294 if ( ((wid *3)/2) < tWid && (( hei *3) /2) < tHei ) 1296 if ( ((wid *3)/2) < tWid && (( hei *3) /2) < tHei )
1295 return; 1297 return;
1296 1298
1297 if ( lastWid == width() && lastHei == height() ) 1299 if ( lastWid == width() && lastHei == height() )
1298 return; 1300 return;
1299 lastWid = width(); 1301 lastWid = width();
1300 lastHei = height(); 1302 lastHei = height();
1301 1303
1302 1304
1303 if ( wid < hei ) 1305 if ( wid < hei )
1304 daysToShow = 2; 1306 daysToShow = 2;
1305 else 1307 else
1306 daysToShow = 3; 1308 daysToShow = 3;
1307 mShowSatSunComp = true; 1309 mShowSatSunComp = true;
1308 combinedSatSun = true; 1310 combinedSatSun = true;
1309 1311
1310 //qDebug("KOMonthView::computeLayout() WWW ------------------------------------ "); 1312 //qDebug("KOMonthView::computeLayout() WWW ------------------------------------ ");
1311 QFontMetrics fm ( mWeekLabels[0]->font() ); 1313 QFontMetrics fm ( mWeekLabels[0]->font() );
1312 int weeklabelwid = fm.width( "888" ); 1314 int weeklabelwid = fm.width( "888" );
1313 wid -= weeklabelwid; 1315 wid -= weeklabelwid;
1314 1316
1315 int colWid = wid / daysToShow; 1317 int colWid = wid / daysToShow;
1316 int lastCol = wid - ( colWid*6 ); 1318 int lastCol = wid - ( colWid*6 );
1317 int dayLabelHei = mDayLabelsW[0]->sizeHint().height(); 1319 int dayLabelHei = mDayLabelsW[0]->sizeHint().height();
1318 int cellHei = (hei - (5- daysToShow )*dayLabelHei) /(5- daysToShow ); 1320 int cellHei = (hei - (5- daysToShow )*dayLabelHei) /(5- daysToShow );
1319 int colModulo = wid % daysToShow; 1321 int colModulo = wid % daysToShow;
1320 int rowModulo = (hei- (5- daysToShow )*dayLabelHei) % daysToShow-1; 1322 int rowModulo = (hei- (5- daysToShow )*dayLabelHei) % daysToShow-1;
1321 //qDebug("rowmod %d ", rowModulo); 1323 //qDebug("rowmod %d ", rowModulo);
1322 int i; 1324 int i;
1323 int x,y,w,h; 1325 int x,y,w,h;
1324 x= 0; 1326 x= 0;
1325 y= 0; 1327 y= 0;
1326 w = colWid; 1328 w = colWid;
1327 h = dayLabelHei ; 1329 h = dayLabelHei ;
1328 for ( i = 0; i < 7; i++) { 1330 for ( i = 0; i < 7; i++) {
1329 if ( i && !( i % daysToShow) && i < 6) { 1331 if ( i && !( i % daysToShow) && i < 6) {
1330 y += hei/(5-daysToShow); 1332 y += hei/(5-daysToShow);
1331 x = 0; 1333 x = 0;
1332 w = colWid; 1334 w = colWid;
1333 } 1335 }
1334 if ( ((i) % daysToShow) >= daysToShow-colModulo ) { 1336 if ( ((i) % daysToShow) >= daysToShow-colModulo ) {
1335 ++w; 1337 ++w;
1336 } 1338 }
1337 if ( i >= 5 ) { 1339 if ( i >= 5 ) {
1338 mDayLabelsW[i]->setGeometry( x+weeklabelwid,y,w/2+w%2,h); 1340 mDayLabelsW[i]->setGeometry( x+weeklabelwid,y,w/2+w%2,h);
1339 x -= (w/2 ); 1341 x -= (w/2 );
1340 } 1342 }
1341 else 1343 else
1342 mDayLabelsW[i]->setGeometry( x+weeklabelwid,y,w,h); 1344 mDayLabelsW[i]->setGeometry( x+weeklabelwid,y,w,h);
1343 x += w; 1345 x += w;
1344 } 1346 }
1345 x= 0; 1347 x= 0;
1346 y= dayLabelHei; 1348 y= dayLabelHei;
1347 w = colWid; 1349 w = colWid;
1348 h = cellHei; 1350 h = cellHei;
1349 for ( i = 0; i < mCellsW.count(); ++i) { 1351 for ( i = 0; i < mCellsW.count(); ++i) {
1350 if ( i > 6 ) { 1352 if ( i > 6 ) {
1351 mCellsW[i]->hide(); 1353 mCellsW[i]->hide();
1352 continue; 1354 continue;
1353 } 1355 }
1354 1356
1355 w = colWid; 1357 w = colWid;
1356 if ( ((i) % daysToShow) >= daysToShow-colModulo ) { 1358 if ( ((i) % daysToShow) >= daysToShow-colModulo ) {
1357 ++w; 1359 ++w;
1358 } 1360 }
1359 if ( i == (daysToShow-1-rowModulo)*7) 1361 if ( i == (daysToShow-1-rowModulo)*7)
1360 ++h; 1362 ++h;
1361 1363
1362 if ( i >= 5 ) { 1364 if ( i >= 5 ) {
1363 if ( i ==5 ) { 1365 if ( i ==5 ) {
1364 mCellsW[i]->setGeometry ( x+weeklabelwid,y,w,h/2 ); 1366 mCellsW[i]->setGeometry ( x+weeklabelwid,y,w,h/2 );
1365 x -= w ;y += h/2; 1367 x -= w ;y += h/2;
1366 } else { 1368 } else {
1367 if ( ((i-1) % daysToShow) >= daysToShow-colModulo ) { 1369 if ( ((i-1) % daysToShow) >= daysToShow-colModulo ) {
1368 ++w; 1370 ++w;
1369 } 1371 }
1370 mCellsW[i]->setGeometry ( x+weeklabelwid,y,w,h-h/2 ); 1372 mCellsW[i]->setGeometry ( x+weeklabelwid,y,w,h-h/2 );
1371 y -= h/2; 1373 y -= h/2;
1372 } 1374 }
1373 } else 1375 } else
1374 mCellsW[i]->setGeometry ( x+weeklabelwid,y,w,h ); 1376 mCellsW[i]->setGeometry ( x+weeklabelwid,y,w,h );
1375 1377
1376 1378
1377 x += w; 1379 x += w;
1378 if ( x + w/2 > wid ) { 1380 if ( x + w/2 > wid ) {
1379 x = 0; 1381 x = 0;
1380 y += h+dayLabelHei ; 1382 y += h+dayLabelHei ;
1381 } 1383 }
1382 } 1384 }
1383 y= dayLabelHei; 1385 y= dayLabelHei;
1384 h = cellHei ; 1386 h = cellHei ;
1385 mWeekLabelsW[0]->setGeometry( 0,y,weeklabelwid,hei-dayLabelHei); 1387 mWeekLabelsW[0]->setGeometry( 0,y,weeklabelwid,hei-dayLabelHei);
1386 mWeekLabelsW[1]->setGeometry( 0,0,weeklabelwid,dayLabelHei); 1388 mWeekLabelsW[1]->setGeometry( 0,0,weeklabelwid,dayLabelHei);
1387 // qDebug("RRRRRRRRRRRRR %d %d old %d %d", e->size().width(),e->size().height() , e->oldSize().width(),e->oldSize().height()); 1389 // qDebug("RRRRRRRRRRRRR %d %d old %d %d", e->size().width(),e->size().height() , e->oldSize().width(),e->oldSize().height());
1388 //qDebug("parent %d %d ", topLevelWidget()->size().width(), topLevelWidget()->size().height()); 1390 //qDebug("parent %d %d ", topLevelWidget()->size().width(), topLevelWidget()->size().height());
1389 mShortDayLabels = mDayLabelsW[0]->width() < mWidthLongDayLabel ; 1391 mShortDayLabelsW = mDayLabelsW[0]->width()-2 < mWidthLongDayLabel ;
1390 updateDayLabels(); 1392 updateDayLabels();
1391 //bool forceUpdate = !updatePossible; 1393 //bool forceUpdate = !updatePossible;
1392 updatePossible = true; 1394 updatePossible = true;
1393 //mWeekLabels[mNumWeeks]->setText( i18n("M")); 1395 //mWeekLabels[mNumWeeks]->setText( i18n("M"));
1394 //if ( forceUpdate ) 1396 //if ( forceUpdate )
1395 // updateView(); 1397 // updateView();
1396} 1398}
1397void KOMonthView::computeLayout() 1399void KOMonthView::computeLayout()
1398{ 1400{
1399 1401
1400 1402
1401 static int lastWid = 0; 1403 static int lastWid = 0;
1402 static int lastHei = 0; 1404 static int lastHei = 0;
1403 1405
1404 if ( mShowWeekView ){ 1406 if ( mShowWeekView ){
1405 computeLayoutWeek(); 1407 computeLayoutWeek();
1406 return; 1408 return;
1407 } 1409 }
1408 int daysToShow = 7; 1410 int daysToShow = 7;
1409 bool combinedSatSun = false; 1411 bool combinedSatSun = false;
1410 if (mShowSatSunComp = KOPrefs::instance()->mMonthViewSatSunTog ) { 1412 if (mShowSatSunComp = KOPrefs::instance()->mMonthViewSatSunTog ) {
1411 daysToShow = 6; 1413 daysToShow = 6;
1412 combinedSatSun = true; 1414 combinedSatSun = true;
1413 } 1415 }
1414 int tWid = topLevelWidget()->size().width(); 1416 int tWid = topLevelWidget()->size().width();
1415 int tHei = topLevelWidget()->size().height(); 1417 int tHei = topLevelWidget()->size().height();
1416 1418
1417 int wid = width();//e 1419 int wid = width();//e
1418 int hei = height()-1-mNavigatorBar->height(); 1420 int hei = height()-1-mNavigatorBar->height();
1419 1421
1420 if ( ((wid *3)/2) < tWid && (( hei *3) /2) < tHei ) { 1422 if ( ((wid *3)/2) < tWid && (( hei *3) /2) < tHei ) {
1421 return; 1423 return;
1422 } 1424 }
1423 if ( lastWid == width() && lastHei == height() ){ 1425 if ( lastWid == width() && lastHei == height() ){
1424 return; 1426 return;
1425 } 1427 }
1426 1428
1427 lastWid = width(); 1429 lastWid = width();
1428 lastHei = height(); 1430 lastHei = height();
1429 //qDebug("KOMonthView::computeLayout() MMM ------------------------------------ "); 1431 //qDebug("KOMonthView::computeLayout() MMM ------------------------------------ ");
1430 QFontMetrics fm ( mWeekLabels[0]->font() ); 1432 QFontMetrics fm ( mWeekLabels[0]->font() );
1431 int weeklabelwid = fm.width( "888" ); 1433 int weeklabelwid = fm.width( "888" );
1432 wid -= weeklabelwid; 1434 wid -= weeklabelwid;
1433 1435
1434 int colWid = wid / daysToShow; 1436 int colWid = wid / daysToShow;
1435 int lastCol = wid - ( colWid*6 ); 1437 int lastCol = wid - ( colWid*6 );
1436 int dayLabelHei = mDayLabels[0]->sizeHint().height(); 1438 int dayLabelHei = mDayLabels[0]->sizeHint().height();
1437 int cellHei = (hei - dayLabelHei) /6; 1439 int cellHei = (hei - dayLabelHei) /6;
1438 int colModulo = wid % daysToShow; 1440 int colModulo = wid % daysToShow;
1439 int rowModulo = (hei- dayLabelHei) % 6; 1441 int rowModulo = (hei- dayLabelHei) % 6;
1440 //qDebug("rowmod %d ", rowModulo); 1442 //qDebug("rowmod %d ", rowModulo);
1441 int i; 1443 int i;
1442 int x,y,w,h; 1444 int x,y,w,h;
1443 x= 0; 1445 x= 0;
1444 y= 0; 1446 y= 0;
1445 w = colWid; 1447 w = colWid;
1446 h = dayLabelHei ; 1448 h = dayLabelHei ;
1447 for ( i = 0; i < 7; i++) { 1449 for ( i = 0; i < 7; i++) {
1448 if ( i == daysToShow-colModulo ) 1450 if ( i == daysToShow-colModulo )
1449 ++w; 1451 ++w;
1450 if ( combinedSatSun ) { 1452 if ( combinedSatSun ) {
1451 if ( i >= daysToShow-1 ) { 1453 if ( i >= daysToShow-1 ) {
1452 mDayLabels[i]->setGeometry( x+weeklabelwid,y,w/2,h); 1454 mDayLabels[i]->setGeometry( x+weeklabelwid,y,w/2,h);
1453 x -= w/2 ; 1455 x -= w/2 ;
1454 } 1456 }
1455 else 1457 else
1456 mDayLabels[i]->setGeometry( x+weeklabelwid,y,w,h); 1458 mDayLabels[i]->setGeometry( x+weeklabelwid,y,w,h);
1457 } else 1459 } else
1458 mDayLabels[i]->setGeometry( x+weeklabelwid,y,w,h); 1460 mDayLabels[i]->setGeometry( x+weeklabelwid,y,w,h);
1459 x += w; 1461 x += w;
1460 } 1462 }
1461 x= 0; 1463 x= 0;
1462 y= dayLabelHei; 1464 y= dayLabelHei;
1463 w = colWid; 1465 w = colWid;
1464 h = cellHei ; 1466 h = cellHei ;
1465 for ( i = 0; i < mCells.count(); ++i) { 1467 for ( i = 0; i < mCells.count(); ++i) {
1466 //qDebug("iii %d ", i); 1468 //qDebug("iii %d ", i);
1467 w = colWid; 1469 w = colWid;
1468 if ( ((i) % 7) >= 7-colModulo ) { 1470 if ( ((i) % 7) >= 7-colModulo ) {
1469 ++w; 1471 ++w;
1470 } 1472 }
1471 if ( i == (6-rowModulo)*7) 1473 if ( i == (6-rowModulo)*7)
1472 ++h; 1474 ++h;
1473 if ( combinedSatSun ) { 1475 if ( combinedSatSun ) {
1474 if ( (i)%7 >= daysToShow-1 ) { 1476 if ( (i)%7 >= daysToShow-1 ) {
1475 if ( (i)%7 == daysToShow-1 ) { 1477 if ( (i)%7 == daysToShow-1 ) {
1476 mCells[i]->setGeometry ( x+weeklabelwid,y,w,h/2 ); 1478 mCells[i]->setGeometry ( x+weeklabelwid,y,w,h/2 );
1477 x -= w ;y += h/2; 1479 x -= w ;y += h/2;
1478 } else { 1480 } else {
1479 mCells[i]->setGeometry ( x+weeklabelwid,y,w,h-h/2 ); 1481 mCells[i]->setGeometry ( x+weeklabelwid,y,w,h-h/2 );
1480 y -= h/2; 1482 y -= h/2;
1481 } 1483 }
1482 } else 1484 } else
1483 mCells[i]->setGeometry ( x+weeklabelwid,y,w,h ); 1485 mCells[i]->setGeometry ( x+weeklabelwid,y,w,h );
1484 1486
1485 } 1487 }
1486 else 1488 else
1487 mCells[i]->setGeometry ( x+weeklabelwid,y,w,h ); 1489 mCells[i]->setGeometry ( x+weeklabelwid,y,w,h );
1488 x += w; 1490 x += w;
1489 if ( x + w/2 > wid ) { 1491 if ( x + w/2 > wid ) {
1490 x = 0; 1492 x = 0;
1491 y += h; 1493 y += h;
1492 } 1494 }
1493 } 1495 }
1494 y= dayLabelHei; 1496 y= dayLabelHei;
1495 h = cellHei ; 1497 h = cellHei ;
1496 for ( i = 0; i < 6; i++) { 1498 for ( i = 0; i < 6; i++) {
1497 if ( i == (6-rowModulo)) 1499 if ( i == (6-rowModulo))
1498 ++h; 1500 ++h;
1499 mWeekLabels[i]->setGeometry( 0,y,weeklabelwid,h); 1501 mWeekLabels[i]->setGeometry( 0,y,weeklabelwid,h);
1500 y += h; 1502 y += h;
1501 } 1503 }
1502 mWeekLabels[6]->setGeometry( 0,0,weeklabelwid,dayLabelHei); 1504 mWeekLabels[6]->setGeometry( 0,0,weeklabelwid,dayLabelHei);
1503 // qDebug("RRRRRRRRRRRRR %d %d old %d %d", e->size().width(),e->size().height() , e->oldSize().width(),e->oldSize().height()); 1505 // qDebug("RRRRRRRRRRRRR %d %d old %d %d", e->size().width(),e->size().height() , e->oldSize().width(),e->oldSize().height());
1504 //qDebug("parent %d %d ", topLevelWidget()->size().width(), topLevelWidget()->size().height()); 1506 //qDebug("parent %d %d ", topLevelWidget()->size().width(), topLevelWidget()->size().height());
1505 mShortDayLabels = mDayLabels[0]->width() < mWidthLongDayLabel ; 1507 mShortDayLabelsM = mDayLabels[0]->width()-2 < mWidthLongDayLabel ;
1506 updateDayLabels(); 1508 updateDayLabels();
1507 //bool forceUpdate = !updatePossible; 1509 //bool forceUpdate = !updatePossible;
1508 updatePossible = true; 1510 updatePossible = true;
1509 //mWeekLabels[mNumWeeks]->setText( i18n("W")); 1511 //mWeekLabels[mNumWeeks]->setText( i18n("W"));
1510} 1512}
1511 1513
1512void KOMonthView::showContextMenu( Incidence *incidence ) 1514void KOMonthView::showContextMenu( Incidence *incidence )
1513{ 1515{
1514 mContextMenu->showIncidencePopup(incidence); 1516 mContextMenu->showIncidencePopup(incidence);
1515 /* 1517 /*
1516 if( incidence && incidence->type() == "Event" ) { 1518 if( incidence && incidence->type() == "Event" ) {
1517 Event *event = static_cast<Event *>(incidence); 1519 Event *event = static_cast<Event *>(incidence);
1518 mContextMenu->showEventPopup(event); 1520 mContextMenu->showEventPopup(event);
1519 } else { 1521 } else {
1520 kdDebug() << "MonthView::showContextMenu(): cast failed." << endl; 1522 kdDebug() << "MonthView::showContextMenu(): cast failed." << endl;
1521 } 1523 }
1522 */ 1524 */
1523} 1525}
1524MonthViewCell * KOMonthView::selectedCell( ) 1526MonthViewCell * KOMonthView::selectedCell( )
1525{ 1527{
1526 return mSelectedCell; 1528 return mSelectedCell;
1527} 1529}
1528void KOMonthView::setSelectedCell( MonthViewCell *cell ) 1530void KOMonthView::setSelectedCell( MonthViewCell *cell )
1529{ 1531{
1530 // qDebug("KOMonthView::setSelectedCell "); 1532 // qDebug("KOMonthView::setSelectedCell ");
1531 if ( mSelectedCell && mSelectedCell != cell ) { 1533 if ( mSelectedCell && mSelectedCell != cell ) {
1532 MonthViewCell * mvc = mSelectedCell; 1534 MonthViewCell * mvc = mSelectedCell;
1533 mSelectedCell = cell; 1535 mSelectedCell = cell;
1534 mvc->deselect(); 1536 mvc->deselect();
1535 } else 1537 } else
1536 mSelectedCell = cell; 1538 mSelectedCell = cell;
1537 // if ( mSelectedCell ) 1539 // if ( mSelectedCell )
1538 // mSelectedCell->select(); 1540 // mSelectedCell->select();
1539 if ( !mSelectedCell ) 1541 if ( !mSelectedCell )
1540 emit incidenceSelected( 0 ); 1542 emit incidenceSelected( 0 );
1541 else 1543 else
1542 emit incidenceSelected( mSelectedCell->selectedIncidence() ); 1544 emit incidenceSelected( mSelectedCell->selectedIncidence() );
1543} 1545}
1544 1546
1545void KOMonthView::processSelectionChange() 1547void KOMonthView::processSelectionChange()
1546{ 1548{
1547 QPtrList<Incidence> incidences = selectedIncidences(); 1549 QPtrList<Incidence> incidences = selectedIncidences();
1548 if (incidences.count() > 0) { 1550 if (incidences.count() > 0) {
1549 emit incidenceSelected( incidences.first() ); 1551 emit incidenceSelected( incidences.first() );
1550 } else { 1552 } else {
1551 emit incidenceSelected( 0 ); 1553 emit incidenceSelected( 0 );
1552 } 1554 }
1553} 1555}
1554 1556
1555void KOMonthView::clearSelection() 1557void KOMonthView::clearSelection()
1556{ 1558{
1557 if ( mSelectedCell ) { 1559 if ( mSelectedCell ) {
1558 mSelectedCell->deselect(); 1560 mSelectedCell->deselect();
1559 mSelectedCell = 0; 1561 mSelectedCell = 0;
1560 } 1562 }
1561} 1563}
1562void KOMonthView::keyPressEvent ( QKeyEvent * e ) 1564void KOMonthView::keyPressEvent ( QKeyEvent * e )
1563{ 1565{
1564 //qDebug("KOMonthView::keyPressEvent "); 1566 //qDebug("KOMonthView::keyPressEvent ");
1565 switch(e->key()) { 1567 switch(e->key()) {
1566 case Key_Up: 1568 case Key_Up:
1567 { 1569 {
1568 emit prevMonth(); 1570 emit prevMonth();
1569 if ( mShowWeekView ) 1571 if ( mShowWeekView )
1570 mCellsW[0]->setFocus(); 1572 mCellsW[0]->setFocus();
1571 else 1573 else
1572 mCells[0]->setFocus(); 1574 mCells[0]->setFocus();
1573 } 1575 }
1574 e->accept(); 1576 e->accept();
1575 break; 1577 break;
1576 case Key_Down: 1578 case Key_Down:
1577 { 1579 {
1578 emit nextMonth(); 1580 emit nextMonth();
1579 if ( mShowWeekView ) 1581 if ( mShowWeekView )
1580 mCellsW[0]->setFocus(); 1582 mCellsW[0]->setFocus();
1581 else 1583 else
1582 mCells[0]->setFocus(); 1584 mCells[0]->setFocus();
1583 1585
1584 } 1586 }
1585 e->accept(); 1587 e->accept();
1586 break; 1588 break;
1587 case Key_Return: 1589 case Key_Return:
1588 case Key_Enter: 1590 case Key_Enter:
1589 { 1591 {
1590 selectInternalWeekNum ( currentWeek() ); 1592 selectInternalWeekNum ( currentWeek() );
1591 } 1593 }
1592 e->accept(); 1594 e->accept();
1593 break; 1595 break;
1594 default: 1596 default:
1595 e->ignore(); 1597 e->ignore();
1596 break; 1598 break;
1597 } 1599 }
1598} 1600}
diff --git a/korganizer/komonthview.h b/korganizer/komonthview.h
index bf861ef..03f9dc6 100644
--- a/korganizer/komonthview.h
+++ b/korganizer/komonthview.h
@@ -189,109 +189,110 @@ class MonthViewCell : public QWidget
189 QListBox *mItemList; 189 QListBox *mItemList;
190#ifdef DESKTOP_VERSION 190#ifdef DESKTOP_VERSION
191 static QToolTipGroup *mToolTipGroup; 191 static QToolTipGroup *mToolTipGroup;
192#endif 192#endif
193 QSize mLabelSize; 193 QSize mLabelSize;
194 QSize mLabelBigSize; 194 QSize mLabelBigSize;
195 QPalette mHolidayPalette; 195 QPalette mHolidayPalette;
196 QPalette mStandardPalette; 196 QPalette mStandardPalette;
197 QPalette mPrimaryPalette; 197 QPalette mPrimaryPalette;
198 QPalette mNonPrimaryPalette; 198 QPalette mNonPrimaryPalette;
199 void setMyPalette(); 199 void setMyPalette();
200 QPalette getPalette (); 200 QPalette getPalette ();
201 void keyPressEvent ( QKeyEvent * ) ; 201 void keyPressEvent ( QKeyEvent * ) ;
202 202
203}; 203};
204 204
205 205
206class KOMonthView: public KOEventView 206class KOMonthView: public KOEventView
207{ 207{
208 Q_OBJECT 208 Q_OBJECT
209 public: 209 public:
210 KOMonthView(Calendar *cal, QWidget *parent = 0, const char *name = 0 ); 210 KOMonthView(Calendar *cal, QWidget *parent = 0, const char *name = 0 );
211 ~KOMonthView(); 211 ~KOMonthView();
212 212
213 /** Returns maximum number of days supported by the komonthview */ 213 /** Returns maximum number of days supported by the komonthview */
214 virtual int maxDatesHint(); 214 virtual int maxDatesHint();
215 215
216 /** Returns number of currently shown dates. */ 216 /** Returns number of currently shown dates. */
217 virtual int currentDateCount(); 217 virtual int currentDateCount();
218 218
219 /** returns the currently selected events */ 219 /** returns the currently selected events */
220 virtual QPtrList<Incidence> selectedIncidences(); 220 virtual QPtrList<Incidence> selectedIncidences();
221 221
222 /** returns dates of the currently selected events */ 222 /** returns dates of the currently selected events */
223 virtual DateList selectedDates(); 223 virtual DateList selectedDates();
224 224
225 virtual void printPreview(CalPrinter *calPrinter, 225 virtual void printPreview(CalPrinter *calPrinter,
226 const QDate &, const QDate &); 226 const QDate &, const QDate &);
227 bool isMonthView() { return true; } 227 bool isMonthView() { return true; }
228 bool isUpdatePossible() { return updatePossible; } 228 bool isUpdatePossible() { return updatePossible; }
229 229
230 MonthViewCell * selectedCell(); 230 MonthViewCell * selectedCell();
231 bool skipResize; 231 bool skipResize;
232 NavigatorBar* navigatorBar() { return mNavigatorBar ;} 232 NavigatorBar* navigatorBar() { return mNavigatorBar ;}
233 public slots: 233 public slots:
234 virtual void updateView(); 234 virtual void updateView();
235 virtual void updateConfig(); 235 virtual void updateConfig();
236 virtual void showDates(const QDate &start, const QDate &end); 236 virtual void showDates(const QDate &start, const QDate &end);
237 virtual void showEvents(QPtrList<Event> eventList); 237 virtual void showEvents(QPtrList<Event> eventList);
238 238
239 void changeEventDisplay(Event *, int); 239 void changeEventDisplay(Event *, int);
240 240
241 void clearSelection(); 241 void clearSelection();
242 242
243 void showContextMenu( Incidence * ); 243 void showContextMenu( Incidence * );
244 244
245 void setSelectedCell( MonthViewCell * ); 245 void setSelectedCell( MonthViewCell * );
246 246
247 protected slots: 247 protected slots:
248 void selectInternalWeekNum ( int ); 248 void selectInternalWeekNum ( int );
249 void switchView(); 249 void switchView();
250 void processSelectionChange(); 250 void processSelectionChange();
251 signals: 251 signals:
252 void nextMonth(); 252 void nextMonth();
253 void prevMonth(); 253 void prevMonth();
254 void selectWeekNum ( int ); 254 void selectWeekNum ( int );
255 void showDaySignal( QDate ); 255 void showDaySignal( QDate );
256 protected: 256 protected:
257 void resizeEvent(QResizeEvent *); 257 void resizeEvent(QResizeEvent *);
258 void viewChanged(); 258 void viewChanged();
259 void updateDayLabels(); 259 void updateDayLabels();
260 260
261 private: 261 private:
262 NavigatorBar* mNavigatorBar; 262 NavigatorBar* mNavigatorBar;
263 int currentWeek(); 263 int currentWeek();
264 bool clPending; 264 bool clPending;
265 QWidgetStack * mWidStack; 265 QWidgetStack * mWidStack;
266 QWidget* mMonthView; 266 QWidget* mMonthView;
267 QWidget* mWeekView; 267 QWidget* mWeekView;
268 bool mShowWeekView; 268 bool mShowWeekView;
269 bool updatePossible; 269 bool updatePossible;
270 int mDaysPerWeek; 270 int mDaysPerWeek;
271 int mNumWeeks; 271 int mNumWeeks;
272 int mNumCells; 272 int mNumCells;
273 bool mWeekStartsMonday; 273 bool mWeekStartsMonday;
274 bool mShowSatSunComp; 274 bool mShowSatSunComp;
275 void computeLayout(); 275 void computeLayout();
276 void computeLayoutWeek(); 276 void computeLayoutWeek();
277 277
278 QPtrVector<MonthViewCell> mCells; 278 QPtrVector<MonthViewCell> mCells;
279 QPtrVector<QLabel> mDayLabels; 279 QPtrVector<QLabel> mDayLabels;
280 QPtrVector<KOWeekButton> mWeekLabels; 280 QPtrVector<KOWeekButton> mWeekLabels;
281 QPtrVector<MonthViewCell> mCellsW; 281 QPtrVector<MonthViewCell> mCellsW;
282 QPtrVector<QLabel> mDayLabelsW; 282 QPtrVector<QLabel> mDayLabelsW;
283 QPtrVector<KOWeekButton> mWeekLabelsW; 283 QPtrVector<KOWeekButton> mWeekLabelsW;
284 284
285 bool mShortDayLabels; 285 bool mShortDayLabelsM;
286 bool mShortDayLabelsW;
286 int mWidthLongDayLabel; 287 int mWidthLongDayLabel;
287 288
288 QDate mStartDate; 289 QDate mStartDate;
289 290
290 MonthViewCell *mSelectedCell; 291 MonthViewCell *mSelectedCell;
291 292
292 KOEventPopupMenu *mContextMenu; 293 KOEventPopupMenu *mContextMenu;
293 void keyPressEvent ( QKeyEvent * ) ; 294 void keyPressEvent ( QKeyEvent * ) ;
294 295
295}; 296};
296 297
297#endif 298#endif
diff --git a/korganizer/koviewmanager.cpp b/korganizer/koviewmanager.cpp
index 90be237..b0f26d1 100644
--- a/korganizer/koviewmanager.cpp
+++ b/korganizer/koviewmanager.cpp
@@ -13,237 +13,239 @@
13 but WITHOUT ANY WARRANTY; without even the implied warranty of 13 but WITHOUT ANY WARRANTY; without even the implied warranty of
14 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.See the 14 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.See the
15 GNU General Public License for more details. 15 GNU General Public License for more details.
16 16
17 You should have received a copy of the GNU General Public License 17 You should have received a copy of the GNU General Public License
18 along with this program; if not, write to the Free Software 18 along with this program; if not, write to the Free Software
19 Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. 19 Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
20 20
21 As a special exception, permission is given to link this program 21 As a special exception, permission is given to link this program
22 with any edition of Qt, and distribute the resulting executable, 22 with any edition of Qt, and distribute the resulting executable,
23 without including the source code for Qt in the source distribution. 23 without including the source code for Qt in the source distribution.
24*/ 24*/
25 25
26#include <qwidgetstack.h> 26#include <qwidgetstack.h>
27 27
28#include <kconfig.h> 28#include <kconfig.h>
29#include <kglobal.h> 29#include <kglobal.h>
30#ifndef DESKTOP_VERSION 30#ifndef DESKTOP_VERSION
31#include <qpe/qpeapplication.h> 31#include <qpe/qpeapplication.h>
32#else 32#else
33#include <qapplication.h> 33#include <qapplication.h>
34#endif 34#endif
35#include <qdatetime.h> 35#include <qdatetime.h>
36#include "calendarview.h" 36#include "calendarview.h"
37#include "datenavigator.h" 37#include "datenavigator.h"
38#include "kotodoview.h" 38#include "kotodoview.h"
39#include "koagendaview.h" 39#include "koagendaview.h"
40#include "kodialogmanager.h" 40#include "kodialogmanager.h"
41#include "komonthview.h" 41#include "komonthview.h"
42#include "kolistview.h" 42#include "kolistview.h"
43#include "kowhatsnextview.h" 43#include "kowhatsnextview.h"
44#include "kojournalview.h" 44#include "kojournalview.h"
45#include "kotimespanview.h" 45#include "kotimespanview.h"
46#include "koprefs.h" 46#include "koprefs.h"
47#include "navigatorbar.h" 47#include "navigatorbar.h"
48#include "kdatenavigator.h" 48#include "kdatenavigator.h"
49 49
50#include "koviewmanager.h" 50#include "koviewmanager.h"
51//extern bool externFlagMonthviewBlockPainting; 51//extern bool externFlagMonthviewBlockPainting;
52 52
53//bool globalFlagBlockPainting = false; 53//bool globalFlagBlockPainting = false;
54int globalFlagBlockAgenda = 0; 54int globalFlagBlockAgenda = 0;
55int globalFlagBlockLabel = 0; 55int globalFlagBlockLabel = 0;
56int globalFlagBlockAgendaItemPaint = 1; 56int globalFlagBlockAgendaItemPaint = 1;
57int globalFlagBlockAgendaItemUpdate = 1; 57int globalFlagBlockAgendaItemUpdate = 1;
58 58
59 59
60KOViewManager::KOViewManager( CalendarView *mainView ) : 60KOViewManager::KOViewManager( CalendarView *mainView ) :
61 QObject(), mMainView( mainView ) 61 QObject(), mMainView( mainView )
62{ 62{
63 mCurrentView = 0; 63 mCurrentView = 0;
64 64
65 mWhatsNextView = 0; 65 mWhatsNextView = 0;
66 mTodoView = 0; 66 mTodoView = 0;
67 mAgendaView = 0; 67 mAgendaView = 0;
68 mMonthView = 0; 68 mMonthView = 0;
69 mListView = 0; 69 mListView = 0;
70 mJournalView = 0; 70 mJournalView = 0;
71 mTimeSpanView = 0; 71 mTimeSpanView = 0;
72 mCurrentAgendaView = 0 ; 72 mCurrentAgendaView = 0 ;
73 mFlagShowNextxDays = false; 73 mFlagShowNextxDays = false;
74} 74}
75 75
76KOViewManager::~KOViewManager() 76KOViewManager::~KOViewManager()
77{ 77{
78} 78}
79 79
80 80
81KOrg::BaseView *KOViewManager::currentView() 81KOrg::BaseView *KOViewManager::currentView()
82{ 82{
83 return mCurrentView; 83 return mCurrentView;
84} 84}
85 85
86void KOViewManager::readSettings(KConfig *config) 86void KOViewManager::readSettings(KConfig *config)
87{ 87{
88 config->setGroup("General"); 88 config->setGroup("General");
89 QString view = config->readEntry("Current View"); 89 QString view = config->readEntry("Current View");
90 if (view == "WhatsNext") showWhatsNextView(); 90 if (view == "WhatsNext") showWhatsNextView();
91 else if (view == "Month") showMonthView(); 91 else if (view == "Month") showMonthView();
92 else if (view == "List") showListView(); 92 else if (view == "List") showListView();
93 else if (view == "Journal") showJournalView(); 93 else if (view == "Journal") showJournalView();
94 else if (view == "TimeSpan") showTimeSpanView(); 94 else if (view == "TimeSpan") showTimeSpanView();
95 else if (view == "Todo") showTodoView(); 95 else if (view == "Todo") showTodoView();
96 else { 96 else {
97 showAgendaView(); 97 showAgendaView();
98 } 98 }
99} 99}
100 100
101void KOViewManager::showDateView( int view, QDate date) 101void KOViewManager::showDateView( int view, QDate date)
102{ 102{
103 static int lastMode = 0; 103 static int lastMode = 0;
104 static int lastCount = 0; 104 static int lastCount = 0;
105 static bool lastNDMode = false; 105 static bool lastNDMode = false;
106 static QDate lastDate; 106 static QDate lastDate;
107 //qDebug("date %d %s", view, date.toString().latin1()); 107 //qDebug("date %d %s", view, date.toString().latin1());
108 108
109 if (view != 9)
110 lastMode = 0;
109 //qDebug("%d %d ", lastNDMode, mFlagShowNextxDays ); 111 //qDebug("%d %d ", lastNDMode, mFlagShowNextxDays );
110 bool savemFlagShowNextxDays = mFlagShowNextxDays; 112 bool savemFlagShowNextxDays = mFlagShowNextxDays;
111 mFlagShowNextxDays = false; 113 mFlagShowNextxDays = false;
112 if ( view == 3 ) { 114 if ( view == 3 ) {
113 //mCurrentAgendaView = 1 ; 115 //mCurrentAgendaView = 1 ;
114 lastDate = mMainView->dateNavigator()->selectedDates().first(); 116 lastDate = mMainView->dateNavigator()->selectedDates().first();
115 lastCount = mMainView->dateNavigator()->selectedDates().count(); 117 lastCount = mMainView->dateNavigator()->selectedDates().count();
116 lastNDMode = savemFlagShowNextxDays; 118 lastNDMode = savemFlagShowNextxDays;
117 mMainView->showDay( date ); 119 mMainView->showDay( date );
120 lastMode = 1;
118 } else if (view == 4 ) { 121 } else if (view == 4 ) {
119 mCurrentAgendaView = 7 ; 122 mCurrentAgendaView = 7 ;
120 mMainView->dateNavigator()->selectDates( date, 7 ); 123 mMainView->dateNavigator()->selectDates( date, 7 );
121 } else if (view == 5 ) { 124 } else if (view == 5 ) {
122 mCurrentAgendaView = 14 ; 125 mCurrentAgendaView = 14 ;
123 mMainView->dateNavigator()->selectDates( date, 14); 126 mMainView->dateNavigator()->selectDates( date, 14);
124 } else if (view == 6 ) { 127 } else if (view == 6 ) {
125 //mMainView->dateNavigator()->selectDates( date, 7 ); 128 //mMainView->dateNavigator()->selectDates( date, 7 );
126 showMonthView(); 129 showMonthView();
127 } else if (view == 7 ) { 130 } else if (view == 7 ) {
128 mMainView->dateNavigator()->selectDate( date ); 131 mMainView->dateNavigator()->selectDate( date );
129 showJournalView(); 132 showJournalView();
130 } else if (view == 8 ) { 133 } else if (view == 8 ) {
131 globalFlagBlockAgenda = 1; 134 globalFlagBlockAgenda = 1;
132 if ( mCurrentAgendaView != 3 ) 135 if ( mCurrentAgendaView != 3 )
133 mCurrentAgendaView = -1; 136 mCurrentAgendaView = -1;
134 showAgendaView(KOPrefs::instance()->mFullViewMonth); 137 showAgendaView(KOPrefs::instance()->mFullViewMonth);
135 globalFlagBlockAgenda = 2; 138 globalFlagBlockAgenda = 2;
136 mMainView->dateNavigator()->selectDates( date , 139 mMainView->dateNavigator()->selectDates( date ,
137 KOPrefs::instance()->mNextXDays ); 140 KOPrefs::instance()->mNextXDays );
138 mFlagShowNextxDays = true; 141 mFlagShowNextxDays = true;
139 mCurrentAgendaView = 3 ; 142 mCurrentAgendaView = 3 ;
140 } if (view == 9) { // return behaviour, for getting back from mode == 3 (single day mode ) 143 } if (view == 9) { // return behaviour, for getting back from mode == 3 (single day mode )
141 if ( lastMode ) { 144 if ( lastMode ) {
142 mCurrentAgendaView = lastCount ; 145 mCurrentAgendaView = lastCount ;
143 mMainView->dateNavigator()->selectDates( lastDate, lastCount); 146 mMainView->dateNavigator()->selectDates( lastDate, lastCount);
144 mFlagShowNextxDays = lastNDMode; 147 mFlagShowNextxDays = lastNDMode;
145 if ( mFlagShowNextxDays ) { 148 if ( mFlagShowNextxDays ) {
146 mCurrentAgendaView = 3 ; 149 mCurrentAgendaView = 3 ;
147 } 150 }
148 } else 151 } else
149 showWeekView(); 152 showWeekView();
150 } else if (view == 10) { 153 } else if (view == 10) {
151 mMainView->dateNavigator()->selectDates( date,mMainView->dateNavigator()->selectedDates().count() ); 154 mMainView->dateNavigator()->selectDates( date,mMainView->dateNavigator()->selectedDates().count() );
152 } 155 }
153 lastMode = view;
154} 156}
155 157
156 158
157 159
158void KOViewManager::writeSettings(KConfig *config) 160void KOViewManager::writeSettings(KConfig *config)
159{ 161{
160 config->setGroup("General"); 162 config->setGroup("General");
161 163
162 QString view; 164 QString view;
163 if (mCurrentView == mWhatsNextView) view = "WhatsNext"; 165 if (mCurrentView == mWhatsNextView) view = "WhatsNext";
164 else if (mCurrentView == mMonthView) view = "Month"; 166 else if (mCurrentView == mMonthView) view = "Month";
165 else if (mCurrentView == mListView) view = "List"; 167 else if (mCurrentView == mListView) view = "List";
166 else if (mCurrentView == mJournalView) view = "Journal"; 168 else if (mCurrentView == mJournalView) view = "Journal";
167 else if (mCurrentView == mTimeSpanView) view = "TimeSpan"; 169 else if (mCurrentView == mTimeSpanView) view = "TimeSpan";
168 else if (mCurrentView == mTodoView) view = "Todo"; 170 else if (mCurrentView == mTodoView) view = "Todo";
169 else view = "Agenda"; 171 else view = "Agenda";
170 172
171 config->writeEntry("Current View",view); 173 config->writeEntry("Current View",view);
172 174
173 if (mAgendaView) { 175 if (mAgendaView) {
174 mAgendaView->writeSettings(config); 176 mAgendaView->writeSettings(config);
175 } 177 }
176 if (mTimeSpanView) { 178 if (mTimeSpanView) {
177 mTimeSpanView->writeSettings(config); 179 mTimeSpanView->writeSettings(config);
178 } 180 }
179 if (mListView) { 181 if (mListView) {
180 mListView->writeSettings(config); 182 mListView->writeSettings(config);
181 } 183 }
182 if (mTodoView) { 184 if (mTodoView) {
183 mTodoView->saveLayout(config,"Todo View"); 185 mTodoView->saveLayout(config,"Todo View");
184 } 186 }
185} 187}
186 188
187void KOViewManager::showView(KOrg::BaseView *view, bool fullScreen ) 189void KOViewManager::showView(KOrg::BaseView *view, bool fullScreen )
188{ 190{
189 191
190 //mFlagShowNextxDays = false; 192 //mFlagShowNextxDays = false;
191 //if(view == mCurrentView) return; 193 //if(view == mCurrentView) return;
192 if ( view == 0 ) { 194 if ( view == 0 ) {
193 view = mCurrentView; 195 view = mCurrentView;
194 if ( view == 0 ) 196 if ( view == 0 )
195 return; 197 return;
196 } 198 }
197 bool full = fullScreen; 199 bool full = fullScreen;
198 if(view == mCurrentView && view != mWhatsNextView ) { 200 if(view == mCurrentView && view != mWhatsNextView ) {
199 if ( mCurrentAgendaView < 0 ) 201 if ( mCurrentAgendaView < 0 )
200 return; 202 return;
201 full = mMainView->leftFrame()->isVisible(); 203 full = mMainView->leftFrame()->isVisible();
202 } else { 204 } else {
203 if ( view == mMonthView && mMonthView) 205 if ( view == mMonthView && mMonthView)
204 ;//mMonthView->skipResize = true ; 206 ;//mMonthView->skipResize = true ;
205 mCurrentView = view; 207 mCurrentView = view;
206 // bool full = fullScreen; 208 // bool full = fullScreen;
207 bool isFull = !mMainView->leftFrame()->isVisible(); 209 bool isFull = !mMainView->leftFrame()->isVisible();
208 if ( isFull && KOPrefs::instance()->mViewChangeHoldFullscreen ) 210 if ( isFull && KOPrefs::instance()->mViewChangeHoldFullscreen )
209 full = true; 211 full = true;
210 if ( !isFull && KOPrefs::instance()->mViewChangeHoldNonFullscreen ) 212 if ( !isFull && KOPrefs::instance()->mViewChangeHoldNonFullscreen )
211 full = false; 213 full = false;
212 } 214 }
213 if ( mAgendaView ) mAgendaView->deleteSelectedDateTime(); 215 if ( mAgendaView ) mAgendaView->deleteSelectedDateTime();
214 //raiseCurrentView( full ); 216 //raiseCurrentView( full );
215 mMainView->processIncidenceSelection( 0 ); 217 mMainView->processIncidenceSelection( 0 );
216 //mMainView->updateView(); 218 //mMainView->updateView();
217 raiseCurrentView( full, true ); 219 raiseCurrentView( full, true );
218 mMainView->adaptNavigationUnits(); 220 mMainView->adaptNavigationUnits();
219} 221}
220 222
221void KOViewManager::raiseCurrentView( bool fullScreen, bool callUpdateView ) 223void KOViewManager::raiseCurrentView( bool fullScreen, bool callUpdateView )
222{ 224{
223 mCurrentAgendaView = 0; 225 mCurrentAgendaView = 0;
224 if ( fullScreen ) { 226 if ( fullScreen ) {
225 mMainView->leftFrame()->hide(); 227 mMainView->leftFrame()->hide();
226 } else { 228 } else {
227 mMainView->leftFrame()->show(); 229 mMainView->leftFrame()->show();
228 } 230 }
229 emit signalFullScreen( !fullScreen ); 231 emit signalFullScreen( !fullScreen );
230 if ( callUpdateView ) 232 if ( callUpdateView )
231 mMainView->updateView(); 233 mMainView->updateView();
232 234
233 if ( globalFlagBlockAgenda == 5 ) { 235 if ( globalFlagBlockAgenda == 5 ) {
234 globalFlagBlockAgenda = 4; 236 globalFlagBlockAgenda = 4;
235 globalFlagBlockAgendaItemPaint = 1; 237 globalFlagBlockAgendaItemPaint = 1;
236 } 238 }
237 mMainView->viewStack()->raiseWidget(mCurrentView); 239 mMainView->viewStack()->raiseWidget(mCurrentView);
238 if ( globalFlagBlockAgenda == 4 ) { 240 if ( globalFlagBlockAgenda == 4 ) {
239 if ( mCurrentView == mAgendaView ) { 241 if ( mCurrentView == mAgendaView ) {
240 //globalFlagBlockAgenda =1 ; 242 //globalFlagBlockAgenda =1 ;
241 if ( KOPrefs::instance()->mSetTimeToDayStartAt ) 243 if ( KOPrefs::instance()->mSetTimeToDayStartAt )
242 mAgendaView->setStartHour( KOPrefs::instance()->mDayBegins ); 244 mAgendaView->setStartHour( KOPrefs::instance()->mDayBegins );
243 else if ( KOPrefs::instance()->mCenterOnCurrentTime ) 245 else if ( KOPrefs::instance()->mCenterOnCurrentTime )
244 mAgendaView->setStartHour( QTime::currentTime ().hour() ); 246 mAgendaView->setStartHour( QTime::currentTime ().hour() );
245 qApp->processEvents(); 247 qApp->processEvents();
246 //qDebug("qApp->processEvents() "); 248 //qDebug("qApp->processEvents() ");
247 globalFlagBlockAgenda = 0; 249 globalFlagBlockAgenda = 0;
248 mAgendaView->repaintAgenda(); 250 mAgendaView->repaintAgenda();
249 251
diff --git a/version b/version
index 0584395..2976531 100644
--- a/version
+++ b/version
@@ -1 +1 @@
version = "2.0.4"; version = "2.0.5";