summaryrefslogtreecommitdiffabout
authorzautrix <zautrix>2005-03-19 21:14:06 (UTC)
committer zautrix <zautrix>2005-03-19 21:14:06 (UTC)
commit6c913e8e5fb19ef3c5a74b94757aeabb9b808cc4 (patch) (unidiff)
tree0facf1e6f5040d1345f1e067efe44d2382a3981a
parent88e1a262374ba8cb018469f7873df45b12050c67 (diff)
downloadkdepimpi-6c913e8e5fb19ef3c5a74b94757aeabb9b808cc4.zip
kdepimpi-6c913e8e5fb19ef3c5a74b94757aeabb9b808cc4.tar.gz
kdepimpi-6c913e8e5fb19ef3c5a74b94757aeabb9b808cc4.tar.bz2
month select fix
Diffstat (more/less context) (ignore whitespace changes)
-rw-r--r--korganizer/datenavigatorcontainer.cpp1
-rw-r--r--korganizer/kdatenavigator.cpp12
-rw-r--r--korganizer/kdatenavigator.h5
3 files changed, 14 insertions, 4 deletions
diff --git a/korganizer/datenavigatorcontainer.cpp b/korganizer/datenavigatorcontainer.cpp
index cbfc5b2..3f6e29b 100644
--- a/korganizer/datenavigatorcontainer.cpp
+++ b/korganizer/datenavigatorcontainer.cpp
@@ -1,218 +1,219 @@
1/* 1/*
2 This file is part of KOrganizer. 2 This file is part of KOrganizer.
3 3
4 Copyright (c) 2001,2002,2003 Cornelius Schumacher <schumacher@kde.org> 4 Copyright (c) 2001,2002,2003 Cornelius Schumacher <schumacher@kde.org>
5 Copyright (C) 2003-2004 Reinhold Kainhofer <reinhold@kainhofer.com> 5 Copyright (C) 2003-2004 Reinhold Kainhofer <reinhold@kainhofer.com>
6 6
7 This program is free software; you can redistribute it and/or modify 7 This program is free software; you can redistribute it and/or modify
8 it under the terms of the GNU General Public License as published by 8 it under the terms of the GNU General Public License as published by
9 the Free Software Foundation; either version 2 of the License, or 9 the Free Software Foundation; either version 2 of the License, or
10 (at your option) any later version. 10 (at your option) any later version.
11 11
12 This program is distributed in the hope that it will be useful, 12 This program is distributed in the hope that it will be useful,
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 <kdebug.h> 26#include <kdebug.h>
27#include <klocale.h> 27#include <klocale.h>
28 28
29//#include "koglobals.h" 29//#include "koglobals.h"
30#include "navigatorbar.h" 30#include "navigatorbar.h"
31#include "kdatenavigator.h" 31#include "kdatenavigator.h"
32 32
33#include <kcalendarsystem.h> 33#include <kcalendarsystem.h>
34 34
35#include "datenavigatorcontainer.h" 35#include "datenavigatorcontainer.h"
36 36
37DateNavigatorContainer::DateNavigatorContainer( QWidget *parent, 37DateNavigatorContainer::DateNavigatorContainer( QWidget *parent,
38 const char *name ) 38 const char *name )
39 : QWidget( parent, name ), mCalendar( 0 ), 39 : QWidget( parent, name ), mCalendar( 0 ),
40 mHorizontalCount( 1 ), mVerticalCount( 1 ) 40 mHorizontalCount( 1 ), mVerticalCount( 1 )
41{ 41{
42 mExtraViews.setAutoDelete( true ); 42 mExtraViews.setAutoDelete( true );
43 43
44 mNavigatorView = new KDateNavigator( this, name ); 44 mNavigatorView = new KDateNavigator( this, name );
45 45
46 connectNavigatorView( mNavigatorView ); 46 connectNavigatorView( mNavigatorView );
47} 47}
48 48
49DateNavigatorContainer::~DateNavigatorContainer() 49DateNavigatorContainer::~DateNavigatorContainer()
50{ 50{
51} 51}
52 52
53void DateNavigatorContainer::connectNavigatorView( KDateNavigator *v ) 53void DateNavigatorContainer::connectNavigatorView( KDateNavigator *v )
54{ 54{
55 connect( v, SIGNAL( datesSelected( const KCal::DateList & ) ), 55 connect( v, SIGNAL( datesSelected( const KCal::DateList & ) ),
56 SIGNAL( datesSelected( const KCal::DateList & ) ) ); 56 SIGNAL( datesSelected( const KCal::DateList & ) ) );
57#if 0 57#if 0
58 connect( v, SIGNAL( incidenceDropped( Incidence *, const QDate & ) ), 58 connect( v, SIGNAL( incidenceDropped( Incidence *, const QDate & ) ),
59 SIGNAL( incidenceDropped( Incidence *, const QDate & ) ) ); 59 SIGNAL( incidenceDropped( Incidence *, const QDate & ) ) );
60 connect( v, SIGNAL( incidenceDroppedMove( Incidence *, const QDate & ) ), 60 connect( v, SIGNAL( incidenceDroppedMove( Incidence *, const QDate & ) ),
61 SIGNAL( incidenceDroppedMove( Incidence *, const QDate & ) ) ); 61 SIGNAL( incidenceDroppedMove( Incidence *, const QDate & ) ) );
62#endif 62#endif
63 connect( v, SIGNAL( weekClicked( const QDate & ) ), 63 connect( v, SIGNAL( weekClicked( const QDate & ) ),
64 SIGNAL( weekClicked( const QDate & ) ) ); 64 SIGNAL( weekClicked( const QDate & ) ) );
65 65
66 connect( v, SIGNAL( goPrevious() ), SIGNAL( goPrevious() ) ); 66 connect( v, SIGNAL( goPrevious() ), SIGNAL( goPrevious() ) );
67 connect( v, SIGNAL( goNext() ), SIGNAL( goNext() ) ); 67 connect( v, SIGNAL( goNext() ), SIGNAL( goNext() ) );
68 68
69 connect( v, SIGNAL( goNextMonth() ), SIGNAL( goNextMonth() ) ); 69 connect( v, SIGNAL( goNextMonth() ), SIGNAL( goNextMonth() ) );
70 connect( v, SIGNAL( goPrevMonth() ), SIGNAL( goPrevMonth() ) ); 70 connect( v, SIGNAL( goPrevMonth() ), SIGNAL( goPrevMonth() ) );
71 connect( v, SIGNAL( goNextYear() ), SIGNAL( goNextYear() ) ); 71 connect( v, SIGNAL( goNextYear() ), SIGNAL( goNextYear() ) );
72 connect( v, SIGNAL( goPrevYear() ), SIGNAL( goPrevYear() ) ); 72 connect( v, SIGNAL( goPrevYear() ), SIGNAL( goPrevYear() ) );
73 73
74 connect( v, SIGNAL( monthSelected( int ) ), SIGNAL( monthSelected( int ) ) ); 74 connect( v, SIGNAL( monthSelected( int ) ), SIGNAL( monthSelected( int ) ) );
75} 75}
76 76
77void DateNavigatorContainer::setCalendar( Calendar *cal ) 77void DateNavigatorContainer::setCalendar( Calendar *cal )
78{ 78{
79 mCalendar = cal; 79 mCalendar = cal;
80 mNavigatorView->setCalendar( cal ); 80 mNavigatorView->setCalendar( cal );
81 KDateNavigator *n; 81 KDateNavigator *n;
82 for( n = mExtraViews.first(); n; n = mExtraViews.next() ) { 82 for( n = mExtraViews.first(); n; n = mExtraViews.next() ) {
83 n->setCalendar( cal ); 83 n->setCalendar( cal );
84 } 84 }
85} 85}
86 86
87void DateNavigatorContainer::updateDayMatrix() 87void DateNavigatorContainer::updateDayMatrix()
88{ 88{
89 mNavigatorView->updateDayMatrix(); 89 mNavigatorView->updateDayMatrix();
90 KDateNavigator *n; 90 KDateNavigator *n;
91 for( n = mExtraViews.first(); n; n = mExtraViews.next() ) { 91 for( n = mExtraViews.first(); n; n = mExtraViews.next() ) {
92 n->updateDayMatrix(); 92 n->updateDayMatrix();
93 } 93 }
94} 94}
95 95
96void DateNavigatorContainer::updateToday() 96void DateNavigatorContainer::updateToday()
97{ 97{
98 qDebug("DateNavigatorContainer::updateToday() NOT IMPL "); 98 qDebug("DateNavigatorContainer::updateToday() NOT IMPL ");
99#if 0 99#if 0
100 mNavigatorView->updateToday(); 100 mNavigatorView->updateToday();
101 KDateNavigator *n; 101 KDateNavigator *n;
102 for( n = mExtraViews.first(); n; n = mExtraViews.next() ) { 102 for( n = mExtraViews.first(); n; n = mExtraViews.next() ) {
103 n->updateToday(); 103 n->updateToday();
104 } 104 }
105#endif 105#endif
106} 106}
107 107
108void DateNavigatorContainer::updateView() 108void DateNavigatorContainer::updateView()
109{ 109{
110 mNavigatorView->updateView(); 110 mNavigatorView->updateView();
111 KDateNavigator *n; 111 KDateNavigator *n;
112 for( n = mExtraViews.first(); n; n = mExtraViews.next() ) { 112 for( n = mExtraViews.first(); n; n = mExtraViews.next() ) {
113 n->updateView(); 113 n->updateView();
114 } 114 }
115} 115}
116 116
117void DateNavigatorContainer::updateConfig() 117void DateNavigatorContainer::updateConfig()
118{ 118{
119 mNavigatorView->updateConfig(); 119 mNavigatorView->updateConfig();
120 KDateNavigator *n; 120 KDateNavigator *n;
121 for( n = mExtraViews.first(); n; n = mExtraViews.next() ) { 121 for( n = mExtraViews.first(); n; n = mExtraViews.next() ) {
122 n->updateConfig(); 122 n->updateConfig();
123 } 123 }
124} 124}
125 125
126void DateNavigatorContainer::selectDates( const DateList &dateList ) 126void DateNavigatorContainer::selectDates( const DateList &dateList )
127{ 127{
128 mNavigatorView->selectDates( dateList ); 128 mNavigatorView->selectDates( dateList );
129 setBaseDates(); 129 setBaseDates();
130} 130}
131 131
132void DateNavigatorContainer::setBaseDates() 132void DateNavigatorContainer::setBaseDates()
133{ 133{
134 KCal::DateList dateList = mNavigatorView->selectedDates(); 134 KCal::DateList dateList = mNavigatorView->selectedDates();
135 if ( dateList.isEmpty() ) { 135 if ( dateList.isEmpty() ) {
136 kdError() << "DateNavigatorContainer::selectDates() empty list." << endl; 136 kdError() << "DateNavigatorContainer::selectDates() empty list." << endl;
137 } 137 }
138 QDate baseDate = dateList.first(); 138 QDate baseDate = dateList.first();
139 KDateNavigator *n; 139 KDateNavigator *n;
140 for( n = mExtraViews.first(); n; n = mExtraViews.next() ) { 140 for( n = mExtraViews.first(); n; n = mExtraViews.next() ) {
141 baseDate = baseDate.addDays( baseDate.daysInMonth () ); 141 baseDate = baseDate.addDays( baseDate.daysInMonth () );
142 n->setBaseDate( baseDate ); 142 n->setBaseDate( baseDate );
143 } 143 }
144} 144}
145 145
146void DateNavigatorContainer::resizeEvent( QResizeEvent * ) 146void DateNavigatorContainer::resizeEvent( QResizeEvent * )
147{ 147{
148#if 0 148#if 0
149 kdDebug(5850) << "DateNavigatorContainer::resizeEvent()" << endl; 149 kdDebug(5850) << "DateNavigatorContainer::resizeEvent()" << endl;
150 kdDebug(5850) << " CURRENT SIZE: " << size() << endl; 150 kdDebug(5850) << " CURRENT SIZE: " << size() << endl;
151 kdDebug(5850) << " MINIMUM SIZEHINT: " << minimumSizeHint() << endl; 151 kdDebug(5850) << " MINIMUM SIZEHINT: " << minimumSizeHint() << endl;
152 kdDebug(5850) << " SIZEHINT: " << sizeHint() << endl; 152 kdDebug(5850) << " SIZEHINT: " << sizeHint() << endl;
153 kdDebug(5850) << " MINIMUM SIZE: " << minimumSize() << endl; 153 kdDebug(5850) << " MINIMUM SIZE: " << minimumSize() << endl;
154#endif 154#endif
155 155
156 QSize minSize = mNavigatorView->minimumSizeHint(); 156 QSize minSize = mNavigatorView->minimumSizeHint();
157 157
158// kdDebug(5850) << " NAVIGATORVIEW minimumSizeHint: " << minSize << endl; 158// kdDebug(5850) << " NAVIGATORVIEW minimumSizeHint: " << minSize << endl;
159 159
160 int verticalCount = size().height() / minSize.height(); 160 int verticalCount = size().height() / minSize.height();
161 int horizontalCount = size().width() / minSize.width(); 161 int horizontalCount = size().width() / minSize.width();
162 //qDebug("COUNT %d %d %d %d ", verticalCount, horizontalCount , mVerticalCount, mHorizontalCount ); 162 //qDebug("COUNT %d %d %d %d ", verticalCount, horizontalCount , mVerticalCount, mHorizontalCount );
163 if ( horizontalCount != mHorizontalCount || 163 if ( horizontalCount != mHorizontalCount ||
164 verticalCount != mVerticalCount ) { 164 verticalCount != mVerticalCount ) {
165 uint count = horizontalCount * verticalCount; 165 uint count = horizontalCount * verticalCount;
166 if ( count == 0 ) return; 166 if ( count == 0 ) return;
167 167
168 while ( count > ( mExtraViews.count() + 1 ) ) { 168 while ( count > ( mExtraViews.count() + 1 ) ) {
169 KDateNavigator *n = new KDateNavigator( this ); 169 KDateNavigator *n = new KDateNavigator( this );
170 n->setMonthSignalOffset ( mExtraViews.count()+1 );
170 mExtraViews.append( n ); 171 mExtraViews.append( n );
171 n->setCalendar( mCalendar ); 172 n->setCalendar( mCalendar );
172 setBaseDates(); 173 setBaseDates();
173 connectNavigatorView( n ); 174 connectNavigatorView( n );
174 n->show(); 175 n->show();
175 } 176 }
176 177
177 while ( count < ( mExtraViews.count() + 1 ) ) { 178 while ( count < ( mExtraViews.count() + 1 ) ) {
178 mExtraViews.removeLast(); 179 mExtraViews.removeLast();
179 } 180 }
180 181
181 mHorizontalCount = horizontalCount; 182 mHorizontalCount = horizontalCount;
182 mVerticalCount = verticalCount; 183 mVerticalCount = verticalCount;
183 } 184 }
184 185
185 int height = size().height() / verticalCount; 186 int height = size().height() / verticalCount;
186 int width = size().width() / horizontalCount; 187 int width = size().width() / horizontalCount;
187 188
188 NavigatorBar *bar = mNavigatorView->navigatorBar(); 189 NavigatorBar *bar = mNavigatorView->navigatorBar();
189 if ( horizontalCount > 1 ) bar->showButtons( true, false ); 190 if ( horizontalCount > 1 ) bar->showButtons( true, false );
190 else bar->showButtons( true, true ); 191 else bar->showButtons( true, true );
191 192
192 mNavigatorView->setGeometry(0, 193 mNavigatorView->setGeometry(0,
193 0, width, height ); 194 0, width, height );
194 for( uint i = 0; i < mExtraViews.count(); ++i ) { 195 for( uint i = 0; i < mExtraViews.count(); ++i ) {
195 int x = ( i + 1 ) % horizontalCount; 196 int x = ( i + 1 ) % horizontalCount;
196 int y = ( i + 1 ) / horizontalCount; 197 int y = ( i + 1 ) / horizontalCount;
197 198
198 KDateNavigator *view = mExtraViews.at( i ); 199 KDateNavigator *view = mExtraViews.at( i );
199 bar = view->navigatorBar(); 200 bar = view->navigatorBar();
200 if ( y > 0 ) bar->showButtons( false, false ); 201 if ( y > 0 ) bar->showButtons( false, false );
201 else { 202 else {
202 if ( x + 1 == horizontalCount ) bar->showButtons( false, true ); 203 if ( x + 1 == horizontalCount ) bar->showButtons( false, true );
203 else bar->showButtons( false, false ); 204 else bar->showButtons( false, false );
204 } 205 }
205 view->setGeometry( x * width, 206 view->setGeometry( x * width,
206 y * height, width, height ); 207 y * height, width, height );
207 } 208 }
208} 209}
209 210
210QSize DateNavigatorContainer::minimumSizeHint() const 211QSize DateNavigatorContainer::minimumSizeHint() const
211{ 212{
212 return mNavigatorView->minimumSizeHint(); 213 return mNavigatorView->minimumSizeHint();
213} 214}
214 215
215QSize DateNavigatorContainer::sizeHint() const 216QSize DateNavigatorContainer::sizeHint() const
216{ 217{
217 return mNavigatorView->sizeHint(); 218 return mNavigatorView->sizeHint();
218} 219}
diff --git a/korganizer/kdatenavigator.cpp b/korganizer/kdatenavigator.cpp
index e76a85a..ab9a40f 100644
--- a/korganizer/kdatenavigator.cpp
+++ b/korganizer/kdatenavigator.cpp
@@ -1,381 +1,389 @@
1/* 1/*
2 This file is part of KOrganizer. 2 This file is part of KOrganizer.
3 Copyright (c) 2001,2002 Cornelius Schumacher <schumacher@kde.org> 3 Copyright (c) 2001,2002 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 As a special exception, permission is given to link this program 19 As a special exception, permission is given to link this program
20 with any edition of Qt, and distribute the resulting executable, 20 with any edition of Qt, and distribute the resulting executable,
21 without including the source code for Qt in the source distribution. 21 without including the source code for Qt in the source distribution.
22*/ 22*/
23 23
24#include <qstring.h> 24#include <qstring.h>
25#include <qkeycode.h> 25#include <qkeycode.h>
26#include <qlayout.h> 26#include <qlayout.h>
27#include <qtimer.h> 27#include <qtimer.h>
28#include <qframe.h> 28#include <qframe.h>
29#include <qlabel.h> 29#include <qlabel.h>
30#include <qapplication.h> 30#include <qapplication.h>
31 31
32#include <kdebug.h> 32#include <kdebug.h>
33#include <klocale.h> 33#include <klocale.h>
34#include <kglobal.h> 34#include <kglobal.h>
35 35
36#include "koglobals.h" 36#include "koglobals.h"
37#include "koprefs.h" 37#include "koprefs.h"
38#ifndef KORG_NOPLUGINS 38#ifndef KORG_NOPLUGINS
39#include "kocore.h" 39#include "kocore.h"
40#endif 40#endif
41 41
42#include <kcalendarsystem.h> 42#include <kcalendarsystem.h>
43 43
44#include "navigatorbar.h" 44#include "navigatorbar.h"
45 45
46#include "kdatenavigator.h" 46#include "kdatenavigator.h"
47 47
48KDateNavigator::KDateNavigator( QWidget *parent, const char *name ) 48KDateNavigator::KDateNavigator( QWidget *parent, const char *name )
49 : QFrame(parent, name), 49 : QFrame(parent, name),
50 updateTimer(0L) 50 updateTimer(0L)
51{ 51{
52 setFrameStyle(QFrame::NoFrame); 52 setFrameStyle(QFrame::NoFrame);
53 QDate startDate = QDate::currentDate(); 53 QDate startDate = QDate::currentDate();
54 QGridLayout *topLayout = new QGridLayout(this,8,8); 54 QGridLayout *topLayout = new QGridLayout(this,8,8);
55 55
56 if (! startDate.isValid()) { 56 if (! startDate.isValid()) {
57 qDebug("KDateNavigator::invalid startdate "); 57 qDebug("KDateNavigator::invalid startdate ");
58 startDate = QDate::currentDate(); 58 startDate = QDate::currentDate();
59 } 59 }
60 60 mMonthSignalOffset = 0;
61 mSelectedDates.append(startDate); 61 mSelectedDates.append(startDate);
62 m_MthYr = startDate; 62 m_MthYr = startDate;
63 m_bShowWeekNums = true; 63 m_bShowWeekNums = true;
64 64
65 setFont( KOPrefs::instance()->mDateNavigatorFont ); 65 setFont( KOPrefs::instance()->mDateNavigatorFont );
66 mNavigatorBar = new NavigatorBar( startDate, this ); 66 mNavigatorBar = new NavigatorBar( startDate, this );
67 topLayout->addMultiCellWidget( mNavigatorBar, 0, 0, 0, 7 ); 67 topLayout->addMultiCellWidget( mNavigatorBar, 0, 0, 0, 7 );
68 //mNavigatorBar->resize( 1,1); 68 //mNavigatorBar->resize( 1,1);
69 connect( mNavigatorBar, SIGNAL( goPrevYear() ), SIGNAL( goPrevYear() ) ); 69 connect( mNavigatorBar, SIGNAL( goPrevYear() ), SIGNAL( goPrevYear() ) );
70 connect( mNavigatorBar, SIGNAL( goPrevMonth() ), SIGNAL( goPrevMonth() ) ); 70 connect( mNavigatorBar, SIGNAL( goPrevMonth() ), SIGNAL( goPrevMonth() ) );
71 connect( mNavigatorBar, SIGNAL( goNextMonth() ), SIGNAL( goNextMonth() ) ); 71 connect( mNavigatorBar, SIGNAL( goNextMonth() ), SIGNAL( goNextMonth() ) );
72 connect( mNavigatorBar, SIGNAL( goNextYear() ), SIGNAL( goNextYear() ) ); 72 connect( mNavigatorBar, SIGNAL( goNextYear() ), SIGNAL( goNextYear() ) );
73 connect( mNavigatorBar, SIGNAL( monthSelected( int ) ), SIGNAL( monthSelected( int ) ) ); 73 connect( mNavigatorBar, SIGNAL( monthSelected( int ) ), SLOT( slotMonthSelected( int ) ) );
74 74
75 // get the day of the week on the first day 75 // get the day of the week on the first day
76 QDate dayone(m_MthYr.year(), m_MthYr.month(), 1); 76 QDate dayone(m_MthYr.year(), m_MthYr.month(), 1);
77 m_fstDayOfWk = dayone.dayOfWeek(); 77 m_fstDayOfWk = dayone.dayOfWeek();
78 78
79 int i; 79 int i;
80 80
81 // Set up the heading fields. 81 // Set up the heading fields.
82 for( i = 0; i < 7; i++ ) { 82 for( i = 0; i < 7; i++ ) {
83 headings[i] = new QLabel("",this); 83 headings[i] = new QLabel("",this);
84 //headings[i]->setFont(QFont("Arial", 10, QFont::Bold)); 84 //headings[i]->setFont(QFont("Arial", 10, QFont::Bold));
85 headings[i]->setAlignment(AlignCenter); 85 headings[i]->setAlignment(AlignCenter);
86 86
87 topLayout->addWidget(headings[i],1,i+1); 87 topLayout->addWidget(headings[i],1,i+1);
88 } 88 }
89 89
90 // Create the weeknumber labels 90 // Create the weeknumber labels
91 for( i = 0; i < 6; i++ ) { 91 for( i = 0; i < 6; i++ ) {
92 weeknos[i] = new QLabel(this); 92 weeknos[i] = new QLabel(this);
93 weeknos[i]->setAlignment(AlignCenter); 93 weeknos[i]->setAlignment(AlignCenter);
94 //weeknos[i]->setFont(QFont("Arial", 10)); 94 //weeknos[i]->setFont(QFont("Arial", 10));
95 if(!m_bShowWeekNums) { 95 if(!m_bShowWeekNums) {
96 weeknos[i]->hide(); 96 weeknos[i]->hide();
97 } 97 }
98 weeknos[i]->installEventFilter(this); 98 weeknos[i]->installEventFilter(this);
99 99
100 topLayout->addWidget(weeknos[i],i+2,0); 100 topLayout->addWidget(weeknos[i],i+2,0);
101 } 101 }
102 102
103 daymatrix = new KODayMatrix( this, "KDateNavigator::DayMatrix"); 103 daymatrix = new KODayMatrix( this, "KDateNavigator::DayMatrix");
104 daymatrix->setFrameStyle(QFrame::Panel|QFrame::Sunken); 104 daymatrix->setFrameStyle(QFrame::Panel|QFrame::Sunken);
105 daymatrix->setLineWidth(1); 105 daymatrix->setLineWidth(1);
106 106
107 connect( daymatrix, SIGNAL( selected( const KCal::DateList & ) ), 107 connect( daymatrix, SIGNAL( selected( const KCal::DateList & ) ),
108 SIGNAL( datesSelected( const KCal::DateList & ) ) ); 108 SIGNAL( datesSelected( const KCal::DateList & ) ) );
109 109
110 connect( daymatrix, SIGNAL( eventDropped( Event * ) ), 110 connect( daymatrix, SIGNAL( eventDropped( Event * ) ),
111 SIGNAL( eventDropped( Event * ) ) ); 111 SIGNAL( eventDropped( Event * ) ) );
112 112
113 topLayout->addMultiCellWidget(daymatrix,2,7,1,7); 113 topLayout->addMultiCellWidget(daymatrix,2,7,1,7);
114 114
115 // read settings from configuration file. 115 // read settings from configuration file.
116 updateConfig(); 116 updateConfig();
117 enableRollover(FollowMonth); 117 enableRollover(FollowMonth);
118 //setFixedSize ( sizeHint() ); 118 //setFixedSize ( sizeHint() );
119} 119}
120void KDateNavigator::slotMonthSelected( int m )
121{
122 if ( m_MthYr.month() <= mMonthSignalOffset)
123 m += 12;
124 int mo = m - mMonthSignalOffset;
125 emit monthSelected( m - mMonthSignalOffset );
126
127}
120void KDateNavigator::setCalendar( Calendar *cal ) 128void KDateNavigator::setCalendar( Calendar *cal )
121{ 129{
122 daymatrix->setCalendar( cal ); 130 daymatrix->setCalendar( cal );
123} 131}
124 132
125void KDateNavigator::setBaseDate( const QDate &date ) 133void KDateNavigator::setBaseDate( const QDate &date )
126{ 134{
127 m_MthYr = date; 135 m_MthYr = date;
128 136
129 updateDates(); 137 updateDates();
130 updateView(); 138 updateView();
131 139
132 KCal::DateList dates; 140 KCal::DateList dates;
133 dates.append( date ); 141 dates.append( date );
134 mNavigatorBar->selectDates( dates ); 142 mNavigatorBar->selectDates( dates );
135 143
136 daymatrix->clearSelection(); 144 daymatrix->clearSelection();
137 daymatrix->repaint(); 145 daymatrix->repaint();
138} 146}
139 147
140void KDateNavigator::enableRollover(RolloverType r) 148void KDateNavigator::enableRollover(RolloverType r)
141{ 149{
142 switch(r) 150 switch(r)
143 { 151 {
144 case None : 152 case None :
145 if (updateTimer) 153 if (updateTimer)
146 { 154 {
147 updateTimer->stop(); 155 updateTimer->stop();
148 delete updateTimer; 156 delete updateTimer;
149 updateTimer=0L; 157 updateTimer=0L;
150 } 158 }
151 break; 159 break;
152 case FollowDay : 160 case FollowDay :
153 case FollowMonth : 161 case FollowMonth :
154 if (!updateTimer) 162 if (!updateTimer)
155 { 163 {
156 updateTimer = new QTimer(this); 164 updateTimer = new QTimer(this);
157 QObject::connect(updateTimer,SIGNAL(timeout()), 165 QObject::connect(updateTimer,SIGNAL(timeout()),
158 this,SLOT(possiblyPastMidnight())); 166 this,SLOT(possiblyPastMidnight()));
159 } 167 }
160 updateTimer->start(0,true); 168 updateTimer->start(0,true);
161 lastDayChecked = QDate::currentDate(); 169 lastDayChecked = QDate::currentDate();
162 } 170 }
163 updateRollover=r; 171 updateRollover=r;
164} 172}
165 173
166 174
167KDateNavigator::~KDateNavigator() 175KDateNavigator::~KDateNavigator()
168{ 176{
169} 177}
170 178
171 179
172void KDateNavigator::passedMidnight() 180void KDateNavigator::passedMidnight()
173{ 181{
174 QDate today = QDate::currentDate(); 182 QDate today = QDate::currentDate();
175 bool emitMonth = false; 183 bool emitMonth = false;
176 184
177 if (today.month() != lastDayChecked.month()) 185 if (today.month() != lastDayChecked.month())
178 { 186 {
179 if (updateRollover==FollowMonth && 187 if (updateRollover==FollowMonth &&
180 daymatrix->isEndOfMonth()) { 188 daymatrix->isEndOfMonth()) {
181 goNextMonth(); 189 goNextMonth();
182 emitMonth=true; 190 emitMonth=true;
183 } 191 }
184 } 192 }
185 daymatrix->recalculateToday(); 193 daymatrix->recalculateToday();
186 daymatrix->repaint(); 194 daymatrix->repaint();
187 emit dayPassed(today); 195 emit dayPassed(today);
188 if (emitMonth) { emit monthPassed(today); } 196 if (emitMonth) { emit monthPassed(today); }
189} 197}
190 198
191/* slot */ void KDateNavigator::possiblyPastMidnight() 199/* slot */ void KDateNavigator::possiblyPastMidnight()
192{ 200{
193 if (lastDayChecked!=QDate::currentDate()) 201 if (lastDayChecked!=QDate::currentDate())
194 { 202 {
195 passedMidnight(); 203 passedMidnight();
196 lastDayChecked=QDate::currentDate(); 204 lastDayChecked=QDate::currentDate();
197 } 205 }
198 // Set the timer to go off 1 second after midnight 206 // Set the timer to go off 1 second after midnight
199 // or after 8 minutes, whichever comes first. 207 // or after 8 minutes, whichever comes first.
200 if (updateTimer) 208 if (updateTimer)
201 { 209 {
202 QTime now = QTime::currentTime(); 210 QTime now = QTime::currentTime();
203 QTime midnight = QTime(23,59,59); 211 QTime midnight = QTime(23,59,59);
204 int msecsWait = QMIN(480000,now.msecsTo(midnight)+2000); 212 int msecsWait = QMIN(480000,now.msecsTo(midnight)+2000);
205 213
206 // qDebug(QString("Waiting %1 msec from %2 to %3.").arg(msecsWait)) 214 // qDebug(QString("Waiting %1 msec from %2 to %3.").arg(msecsWait))
207 //.arg(now.toString()).arg(midnight.toString())); 215 //.arg(now.toString()).arg(midnight.toString()));
208 216
209 updateTimer->stop(); 217 updateTimer->stop();
210 updateTimer->start(msecsWait,true); 218 updateTimer->start(msecsWait,true);
211 } 219 }
212} 220}
213 221
214void KDateNavigator::updateDates() 222void KDateNavigator::updateDates()
215{ 223{
216 // Find the first day of the week of the current month. 224 // Find the first day of the week of the current month.
217 //int d1 = KOGlobals::self()->calendarSystem()->day( m_MthYr ); 225 //int d1 = KOGlobals::self()->calendarSystem()->day( m_MthYr );
218 QDate dayone( m_MthYr.year(), m_MthYr.month(), m_MthYr.day() ); 226 QDate dayone( m_MthYr.year(), m_MthYr.month(), m_MthYr.day() );
219 int d2 = KOGlobals::self()->calendarSystem()->day( dayone ); 227 int d2 = KOGlobals::self()->calendarSystem()->day( dayone );
220 //int di = d1 - d2 + 1; 228 //int di = d1 - d2 + 1;
221 dayone = dayone.addDays( -d2 + 1 ); 229 dayone = dayone.addDays( -d2 + 1 );
222 230
223 int m_fstDayOfWkCalsys = KOGlobals::self()->calendarSystem()->dayOfWeek( dayone ); 231 int m_fstDayOfWkCalsys = KOGlobals::self()->calendarSystem()->dayOfWeek( dayone );
224 232
225 // If month begins on Monday and Monday is first day of week, 233 // If month begins on Monday and Monday is first day of week,
226 // month should begin on second line. Sunday doesn't have this problem. 234 // month should begin on second line. Sunday doesn't have this problem.
227 int nextLine = ( ( m_fstDayOfWkCalsys == 1) && 235 int nextLine = ( ( m_fstDayOfWkCalsys == 1) &&
228 ( KGlobal::locale()->weekStartsMonday() == 1 ) ) ? 7 : 0; 236 ( KGlobal::locale()->weekStartsMonday() == 1 ) ) ? 7 : 0;
229 237
230 // update the matrix dates 238 // update the matrix dates
231 int index = (KGlobal::locale()->weekStartsMonday() ? 1 : 0) - m_fstDayOfWkCalsys - nextLine; 239 int index = (KGlobal::locale()->weekStartsMonday() ? 1 : 0) - m_fstDayOfWkCalsys - nextLine;
232 240
233 241
234 daymatrix->updateView(dayone.addDays(index)); 242 daymatrix->updateView(dayone.addDays(index));
235//each updateDates is followed by an updateView -> repaint is issued there ! 243//each updateDates is followed by an updateView -> repaint is issued there !
236// daymatrix->repaint(); 244// daymatrix->repaint();
237} 245}
238 246
239void KDateNavigator::updateDayMatrix() 247void KDateNavigator::updateDayMatrix()
240{ 248{
241 daymatrix->updateView(); 249 daymatrix->updateView();
242 //daymatrix->repaint(); 250 //daymatrix->repaint();
243} 251}
244 252
245 253
246void KDateNavigator::updateView() 254void KDateNavigator::updateView()
247{ 255{
248 256
249 setUpdatesEnabled( false ); 257 setUpdatesEnabled( false );
250 258
251 int i; 259 int i;
252 260
253// kdDebug() << "updateView() -> daymatrix->updateView()" << endl; 261// kdDebug() << "updateView() -> daymatrix->updateView()" << endl;
254 daymatrix->updateView(); 262 daymatrix->updateView();
255 263
256 // set the week numbers. 264 // set the week numbers.
257 for(i = 0; i < 6; i++) { 265 for(i = 0; i < 6; i++) {
258 QString weeknum; 266 QString weeknum;
259 // remember, according to ISO 8601, the first week of the year is the 267 // remember, according to ISO 8601, the first week of the year is the
260 // first week that contains a thursday. Thus we must subtract off 4, 268 // first week that contains a thursday. Thus we must subtract off 4,
261 // not just 1. 269 // not just 1.
262 270
263 //ET int dayOfYear = buttons[(i + 1) * 7 - 4]->date().dayOfYear(); 271 //ET int dayOfYear = buttons[(i + 1) * 7 - 4]->date().dayOfYear();
264 int dayOfYear = KOGlobals::self()->calendarSystem()->dayOfYear((daymatrix->getDate((i+1)*7-4))); 272 int dayOfYear = KOGlobals::self()->calendarSystem()->dayOfYear((daymatrix->getDate((i+1)*7-4)));
265 273
266 int add = 0; 274 int add = 0;
267 if ( ! KGlobal::locale()->weekStartsMonday() ) 275 if ( ! KGlobal::locale()->weekStartsMonday() )
268 ++add; 276 ++add;
269 if (dayOfYear % 7 != 0) 277 if (dayOfYear % 7 != 0)
270 weeknum.setNum(dayOfYear / 7 + 1+add); 278 weeknum.setNum(dayOfYear / 7 + 1+add);
271 else 279 else
272 weeknum.setNum(dayOfYear / 7 +add); 280 weeknum.setNum(dayOfYear / 7 +add);
273 weeknos[i]->setText(weeknum); 281 weeknos[i]->setText(weeknum);
274 } 282 }
275 283
276 setUpdatesEnabled( true ); 284 setUpdatesEnabled( true );
277// kdDebug() << "updateView() -> repaint()" << endl; 285// kdDebug() << "updateView() -> repaint()" << endl;
278 repaint(); 286 repaint();
279 // daymatrix->repaint(); 287 // daymatrix->repaint();
280} 288}
281 289
282void KDateNavigator::updateConfig() 290void KDateNavigator::updateConfig()
283{ 291{
284 int day; 292 int day;
285 for(int i=0; i<7; i++) { 293 for(int i=0; i<7; i++) {
286 // take the first letter of the day name to be the abbreviation 294 // take the first letter of the day name to be the abbreviation
287 if (KGlobal::locale()->weekStartsMonday()) { 295 if (KGlobal::locale()->weekStartsMonday()) {
288 day = i+1; 296 day = i+1;
289 } else { 297 } else {
290 if (i==0) day = 7; 298 if (i==0) day = 7;
291 else day = i; 299 else day = i;
292 } 300 }
293 QString dayName = KOGlobals::self()->calendarSystem()->weekDayName( day, 301 QString dayName = KOGlobals::self()->calendarSystem()->weekDayName( day,
294 true ); 302 true );
295 if ( KOPrefs::instance()->mCompactDialogs ) dayName = dayName.left( 1 ); 303 if ( KOPrefs::instance()->mCompactDialogs ) dayName = dayName.left( 1 );
296 headings[i]->setText( dayName ); 304 headings[i]->setText( dayName );
297 } 305 }
298 updateDates(); 306 updateDates();
299 updateView(); 307 updateView();
300} 308}
301 309
302void KDateNavigator::setShowWeekNums(bool enabled) 310void KDateNavigator::setShowWeekNums(bool enabled)
303{ 311{
304 m_bShowWeekNums = enabled; 312 m_bShowWeekNums = enabled;
305 for(int i=0; i<6; i++) { 313 for(int i=0; i<6; i++) {
306 if(enabled) 314 if(enabled)
307 weeknos[i]->show(); 315 weeknos[i]->show();
308 else 316 else
309 weeknos[i]->hide(); 317 weeknos[i]->hide();
310 } 318 }
311 resize(size()); 319 resize(size());
312} 320}
313 321
314void KDateNavigator::selectDates(const DateList& dateList) 322void KDateNavigator::selectDates(const DateList& dateList)
315{ 323{
316 324
317 if (dateList.count() > 0) { 325 if (dateList.count() > 0) {
318 mNavigatorBar->selectDates( dateList ); 326 mNavigatorBar->selectDates( dateList );
319 mSelectedDates = dateList; 327 mSelectedDates = dateList;
320 328
321 // set our record of the month and year that this datetbl is 329 // set our record of the month and year that this datetbl is
322 // displaying. 330 // displaying.
323 m_MthYr = mSelectedDates.first(); 331 m_MthYr = mSelectedDates.first();
324 332
325 333
326 // set our record of the first day of the week of the current 334 // set our record of the first day of the week of the current
327 // month. This needs to be done before calling dayToIndex, since it 335 // month. This needs to be done before calling dayToIndex, since it
328 // relies on this information being up to date. 336 // relies on this information being up to date.
329 QDate dayone(m_MthYr.year(), m_MthYr.month(), 1); 337 QDate dayone(m_MthYr.year(), m_MthYr.month(), 1);
330 m_fstDayOfWk = dayone.dayOfWeek(); 338 m_fstDayOfWk = dayone.dayOfWeek();
331 339
332 updateDates(); 340 updateDates();
333 341
334 daymatrix->setSelectedDaysFrom(*(dateList.begin()), *(--dateList.end())); 342 daymatrix->setSelectedDaysFrom(*(dateList.begin()), *(--dateList.end()));
335 343
336 updateView(); 344 updateView();
337 } 345 }
338} 346}
339 347
340int KDateNavigator::dayNum(int row, int col) 348int KDateNavigator::dayNum(int row, int col)
341{ 349{
342 return 7 * (row - 1) + (col + 1) - m_fstDayOfWk; 350 return 7 * (row - 1) + (col + 1) - m_fstDayOfWk;
343} 351}
344 352
345int KDateNavigator::dayToIndex(int dayNum) 353int KDateNavigator::dayToIndex(int dayNum)
346{ 354{
347 int row, col; 355 int row, col;
348 356
349 row = (dayNum+m_fstDayOfWk-1-(KGlobal::locale()->weekStartsMonday() ? 1 : 0)) / 7; 357 row = (dayNum+m_fstDayOfWk-1-(KGlobal::locale()->weekStartsMonday() ? 1 : 0)) / 7;
350 if (KGlobal::locale()->weekStartsMonday() && (m_fstDayOfWk == 1)) 358 if (KGlobal::locale()->weekStartsMonday() && (m_fstDayOfWk == 1))
351 row++; 359 row++;
352 col = (dayNum+m_fstDayOfWk-1-(KGlobal::locale()->weekStartsMonday() ? 1 : 0)) % 7; 360 col = (dayNum+m_fstDayOfWk-1-(KGlobal::locale()->weekStartsMonday() ? 1 : 0)) % 7;
353 return row * 7 + col; 361 return row * 7 + col;
354} 362}
355 363
356void KDateNavigator::wheelEvent (QWheelEvent *e) 364void KDateNavigator::wheelEvent (QWheelEvent *e)
357{ 365{
358 if(e->delta()>0) emit goPrevious(); 366 if(e->delta()>0) emit goPrevious();
359 else emit goNext(); 367 else emit goNext();
360 368
361 e->accept(); 369 e->accept();
362} 370}
363 371
364bool KDateNavigator::eventFilter (QObject *o,QEvent *e) 372bool KDateNavigator::eventFilter (QObject *o,QEvent *e)
365{ 373{
366 if (e->type() == QEvent::MouseButtonPress) { 374 if (e->type() == QEvent::MouseButtonPress) {
367 int i; 375 int i;
368 for(i=0;i<6;++i) { 376 for(i=0;i<6;++i) {
369 if (o == weeknos[i]) { 377 if (o == weeknos[i]) {
370 QDate weekstart = daymatrix->getDate(i*7); 378 QDate weekstart = daymatrix->getDate(i*7);
371 emit weekClicked(weekstart); 379 emit weekClicked(weekstart);
372 break; 380 break;
373 } 381 }
374 } 382 }
375 return true; 383 return true;
376 } else { 384 } else {
377 return false; 385 return false;
378 } 386 }
379} 387}
380 388
381//#include "kdatenavigator.moc" 389//#include "kdatenavigator.moc"
diff --git a/korganizer/kdatenavigator.h b/korganizer/kdatenavigator.h
index 0aeb77a..56822fa 100644
--- a/korganizer/kdatenavigator.h
+++ b/korganizer/kdatenavigator.h
@@ -1,150 +1,151 @@
1/* 1/*
2 This file is part of KOrganizer. 2 This file is part of KOrganizer.
3 Copyright (c) 2001 Cornelius Schumacher <schumacher@kde.org> 3 Copyright (c) 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 As a special exception, permission is given to link this program 19 As a special exception, permission is given to link this program
20 with any edition of Qt, and distribute the resulting executable, 20 with any edition of Qt, and distribute the resulting executable,
21 without including the source code for Qt in the source distribution. 21 without including the source code for Qt in the source distribution.
22*/ 22*/
23#ifndef KDATENAVIGATOR_H 23#ifndef KDATENAVIGATOR_H
24#define KDATENAVIGATOR_H 24#define KDATENAVIGATOR_H
25 25
26#include <qframe.h> 26#include <qframe.h>
27#include <qdatetime.h> 27#include <qdatetime.h>
28#include <qlabel.h> 28#include <qlabel.h>
29 29
30#include <libkcal/calendar.h> 30#include <libkcal/calendar.h>
31 31
32#include "kodaymatrix.h" 32#include "kodaymatrix.h"
33 33
34class QPushButton; 34class QPushButton;
35class QTimer; 35class QTimer;
36 36
37class KCalendarSystem; 37class KCalendarSystem;
38 38
39class NavigatorBar; 39class NavigatorBar;
40 40
41class KDateNavigator: public QFrame 41class KDateNavigator: public QFrame
42{ 42{
43 Q_OBJECT 43 Q_OBJECT
44 public: 44 public:
45 KDateNavigator( QWidget *parent = 0,const char *name = 0 ); 45 KDateNavigator( QWidget *parent = 0,const char *name = 0 );
46 ~KDateNavigator(); 46 ~KDateNavigator();
47 47
48 /** The DateNavigator automatically checks for 48 /** The DateNavigator automatically checks for
49 * the passage of midnight. If rollover type is 49 * the passage of midnight. If rollover type is
50 * set to None, no signals are emitted and no 50 * set to None, no signals are emitted and no
51 * processing is done. With rollover set to 51 * processing is done. With rollover set to
52 * FollowDay, the day highlighter changes at 52 * FollowDay, the day highlighter changes at
53 * midnight and dayPassed() is emitted. 53 * midnight and dayPassed() is emitted.
54 * With FollowMonth, it has the same effect 54 * With FollowMonth, it has the same effect
55 * as FollowDay but also adjusts the month that is 55 * as FollowDay but also adjusts the month that is
56 * visible and emits monthPassed() when the month changes. 56 * visible and emits monthPassed() when the month changes.
57 */ 57 */
58 enum RolloverType { None, FollowDay, FollowMonth } ; 58 enum RolloverType { None, FollowDay, FollowMonth } ;
59 void enableRollover( RolloverType ); 59 void enableRollover( RolloverType );
60 60
61 void setShowWeekNums( bool enabled ); 61 void setShowWeekNums( bool enabled );
62 void setCalendar( Calendar * ); 62 void setCalendar( Calendar * );
63 void setBaseDate( const QDate & ); 63 void setBaseDate( const QDate & );
64 KCal::DateList selectedDates() const { return mSelectedDates; } 64 KCal::DateList selectedDates() const { return mSelectedDates; }
65 NavigatorBar *navigatorBar() const { return mNavigatorBar; } 65 NavigatorBar *navigatorBar() const { return mNavigatorBar; }
66 66 void setMonthSignalOffset ( int off ) { mMonthSignalOffset = off;}
67 public slots: 67 public slots:
68 void selectDates( const KCal::DateList & ); 68 void selectDates( const KCal::DateList & );
69 void updateView(); 69 void updateView();
70 void updateConfig(); 70 void updateConfig();
71 void updateDayMatrix(); 71 void updateDayMatrix();
72 72
73 signals: 73 signals:
74 void datesSelected( const KCal::DateList & ); 74 void datesSelected( const KCal::DateList & );
75 void eventDropped( Event * ); 75 void eventDropped( Event * );
76 void weekClicked( const QDate &); 76 void weekClicked( const QDate &);
77 77
78 void goPrevious(); 78 void goPrevious();
79 void goNext(); 79 void goNext();
80 80
81 void goNextMonth(); 81 void goNextMonth();
82 void goPrevMonth(); 82 void goPrevMonth();
83 void goNextYear(); 83 void goNextYear();
84 void goPrevYear(); 84 void goPrevYear();
85 void monthSelected( int ); 85 void monthSelected( int );
86 86
87 // Signals emitted at midnight carrying the new date. 87 // Signals emitted at midnight carrying the new date.
88 void dayPassed( QDate ); 88 void dayPassed( QDate );
89 void monthPassed( QDate ); 89 void monthPassed( QDate );
90 90
91 protected slots: 91 protected slots:
92 92
93 /** 93 /**
94 * Called regularly to see if we need to update the view 94 * Called regularly to see if we need to update the view
95 * wrt. the today box and the month box. Only important 95 * wrt. the today box and the month box. Only important
96 * if you leave KOrganizer idle for long periods of time. 96 * if you leave KOrganizer idle for long periods of time.
97 * 97 *
98 * Until we have a reliable way of setting QTimers to go 98 * Until we have a reliable way of setting QTimers to go
99 * off at a particular wall-clock time, we need this, 99 * off at a particular wall-clock time, we need this,
100 * which calls passedMidnight() at the right moments. 100 * which calls passedMidnight() at the right moments.
101 */ 101 */
102 void possiblyPastMidnight(); 102 void possiblyPastMidnight();
103 103
104 /** handles updating the view when midnight has come by due to idle time. 104 /** handles updating the view when midnight has come by due to idle time.
105 * 105 *
106 */ 106 */
107 void passedMidnight(); 107 void passedMidnight();
108 108 void slotMonthSelected( int m );
109 protected: 109 protected:
110 void updateDates(); 110 void updateDates();
111 111
112 void wheelEvent (QWheelEvent *); 112 void wheelEvent (QWheelEvent *);
113 113
114 bool eventFilter (QObject *,QEvent *); 114 bool eventFilter (QObject *,QEvent *);
115 115
116 private: 116 private:
117 int mMonthSignalOffset;
117 NavigatorBar *mNavigatorBar; 118 NavigatorBar *mNavigatorBar;
118 119
119 QFrame *headingSep; 120 QFrame *headingSep;
120 QFrame *weeknumSep; 121 QFrame *weeknumSep;
121 QLabel *headings[7]; 122 QLabel *headings[7];
122 QLabel *weeknos[7]; 123 QLabel *weeknos[7];
123 KODayMatrix *daymatrix; 124 KODayMatrix *daymatrix;
124 125
125 KCal::DateList mSelectedDates; 126 KCal::DateList mSelectedDates;
126 QDate m_MthYr; 127 QDate m_MthYr;
127 int m_fstDayOfWk; 128 int m_fstDayOfWk;
128 bool m_bShowWeekNums; 129 bool m_bShowWeekNums;
129 130
130 int dayNum(int row, int col); 131 int dayNum(int row, int col);
131 int dayToIndex(int dayNum); 132 int dayToIndex(int dayNum);
132 133
133 Calendar *mCalendar; 134 Calendar *mCalendar;
134 KCalendarSystem *mCalendarSystem; 135 KCalendarSystem *mCalendarSystem;
135 136
136 const QString *curHeaders; 137 const QString *curHeaders;
137 138
138 /** used to update the day view periodically, in particular every 139 /** used to update the day view periodically, in particular every
139 * midnight to move the "today" rectangle. 140 * midnight to move the "today" rectangle.
140 */ 141 */
141 QTimer *updateTimer; 142 QTimer *updateTimer;
142 QDate lastDayChecked; 143 QDate lastDayChecked;
143 RolloverType updateRollover; 144 RolloverType updateRollover;
144 145
145 // Disabling copy constructor and assignment operator 146 // Disabling copy constructor and assignment operator
146 KDateNavigator(const KDateNavigator & ); 147 KDateNavigator(const KDateNavigator & );
147 KDateNavigator &operator=(const KDateNavigator &); 148 KDateNavigator &operator=(const KDateNavigator &);
148}; 149};
149 150
150#endif 151#endif