summaryrefslogtreecommitdiffabout
path: root/korganizer
authorzautrix <zautrix>2005-03-30 13:24:56 (UTC)
committer zautrix <zautrix>2005-03-30 13:24:56 (UTC)
commit056f171723a9301aea5a65340dffeda34e078abf (patch) (unidiff)
tree7930525c801dd9c5d9a910b71bca7dc79e10f666 /korganizer
parentb5222dd7a607f78235b1ea39fea0f95a9c08ccd3 (diff)
downloadkdepimpi-056f171723a9301aea5a65340dffeda34e078abf.zip
kdepimpi-056f171723a9301aea5a65340dffeda34e078abf.tar.gz
kdepimpi-056f171723a9301aea5a65340dffeda34e078abf.tar.bz2
fixes
Diffstat (limited to 'korganizer') (more/less context) (ignore whitespace changes)
-rw-r--r--korganizer/datenavigatorcontainer.cpp36
-rw-r--r--korganizer/kdatenavigator.cpp1
2 files changed, 17 insertions, 20 deletions
diff --git a/korganizer/datenavigatorcontainer.cpp b/korganizer/datenavigatorcontainer.cpp
index 27ba9e0..f6f62a4 100644
--- a/korganizer/datenavigatorcontainer.cpp
+++ b/korganizer/datenavigatorcontainer.cpp
@@ -112,226 +112,224 @@ void DateNavigatorContainer::jumpMonth( int month )
112 112
113 QDate baseDate = mNavigatorView->baseDate(); 113 QDate baseDate = mNavigatorView->baseDate();
114 computeMonthSelected( baseDate.month() + month, false ); 114 computeMonthSelected( baseDate.month() + month, false );
115} 115}
116void DateNavigatorContainer::slotMonthSelected( int month ) 116void DateNavigatorContainer::slotMonthSelected( int month )
117{ 117{
118 computeMonthSelected( month, true ); 118 computeMonthSelected( month, true );
119} 119}
120void DateNavigatorContainer::computeMonthSelected( int month , bool forceEmit ) 120void DateNavigatorContainer::computeMonthSelected( int month , bool forceEmit )
121{ 121{
122 //qDebug("slotMonthSelected %d ", month); 122 //qDebug("slotMonthSelected %d ", month);
123 QDate baseDate = mNavigatorView->baseDate(); 123 QDate baseDate = mNavigatorView->baseDate();
124 if ( baseDate.month() == month ) 124 if ( baseDate.month() == month )
125 return; 125 return;
126 //qDebug("month %d %d ",baseDate.month(),month); 126 //qDebug("month %d %d ",baseDate.month(),month);
127 QDate date = QDate ( baseDate.year(), baseDate.month() , 15 ); 127 QDate date = QDate ( baseDate.year(), baseDate.month() , 15 );
128 date = date.addDays( -(baseDate.month()-month ) *30 ); 128 date = date.addDays( -(baseDate.month()-month ) *30 );
129 QDate newBase = QDate ( date.year(), date.month() ,1 ); 129 QDate newBase = QDate ( date.year(), date.month() ,1 );
130 130
131 //qDebug("NEW BASE %s", newBase.toString().latin1()); 131 //qDebug("NEW BASE %s", newBase.toString().latin1());
132 mNavigatorView->setBaseDate( newBase ); 132 mNavigatorView->setBaseDate( newBase );
133 QDate last = lastAvailableDate(); 133 QDate last = lastAvailableDate();
134 QDate first = firstAvailableDate(); 134 QDate first = firstAvailableDate();
135 135
136 QDate selFirst = mFirstSelectedDate; 136 QDate selFirst = mFirstSelectedDate;
137 QDate selLast = selFirst.addDays( mSelectedDateCount-1 ); 137 QDate selLast = selFirst.addDays( mSelectedDateCount-1 );
138 if ( selFirst >= first && selLast <= last ) { 138 if ( selFirst >= first && selLast <= last ) {
139 setBaseDates(); 139 setBaseDates();
140 if ( forceEmit ) 140 if ( forceEmit )
141 updateDayMatrixDates(); 141 updateDayMatrixDates();
142 } 142 }
143 else { 143 else {
144 setBaseDates(); 144 setBaseDates();
145 if ( forceEmit ) 145 if ( forceEmit )
146 updateDayMatrixDates(); 146 updateDayMatrixDates();
147 if ( forceEmit ) 147 if ( forceEmit )
148 emit monthSelected( month ); 148 emit monthSelected( month );
149 } 149 }
150} 150}
151void DateNavigatorContainer::setCalendar( Calendar *cal ) 151void DateNavigatorContainer::setCalendar( Calendar *cal )
152{ 152{
153 mCalendar = cal; 153 mCalendar = cal;
154 mNavigatorView->setCalendar( cal ); 154 mNavigatorView->setCalendar( cal );
155 for( uint i = 0; i < mLastDisplayedDN; ++i ) { 155 for( uint i = 0; i < mLastDisplayedDN; ++i ) {
156 KDateNavigator *n = mExtraViews.at( i ); 156 KDateNavigator *n = mExtraViews.at( i );
157 n->setCalendar( cal ); 157 n->setCalendar( cal );
158 } 158 }
159} 159}
160void DateNavigatorContainer::checkUpdateDayMatrixDates() 160void DateNavigatorContainer::checkUpdateDayMatrixDates()
161{ 161{
162 //qDebug("KODNC: wid %d hei %d ", width(), height()); 162 //qDebug("KODNC: wid %d hei %d ", width(), height());
163 mUpdateTimer->stop(); 163 mUpdateTimer->stop();
164 //return; 164 //return;
165 if ( width() < 3 || height() < 3 ) 165 if ( width() < 3 || height() < 3 )
166 return; 166 return;
167 static int lastWid = 0; 167 static int lastWid = 0;
168 static int lastHei = 0; 168 static int lastHei = 0;
169 if ( lastWid == width() && height() == lastHei ) { 169 if ( lastWid == width() && height() == lastHei ) {
170 qDebug("KODNC: No layout computing needed. "); 170 qDebug("KODNC: No layout computing needed. ");
171 } else { 171 } else {
172 lastWid = width(); 172 lastWid = width();
173 lastHei = height(); 173 lastHei = height();
174 174
175 QSize minSize = mNavigatorView->yourSizeHint(); 175 QSize minSize = mNavigatorView->yourSizeHint();
176 176
177 int verticalCount = size().height() / minSize.height(); 177 int verticalCount = size().height() / minSize.height();
178 int horizontalCount = size().width() / minSize.width(); 178 int horizontalCount = size().width() / minSize.width();
179 //qDebug(" wattdatt %d new %d %d ", size().width() ,e->size().width() , minSize.width() ); 179 //qDebug(" wattdatt %d new %d %d ", size().width() ,e->size().width() , minSize.width() );
180 //qDebug("COUNT %d %d %d %d ", verticalCount, horizontalCount , mVerticalCount, mHorizontalCount ); 180 //qDebug("COUNT %d %d %d %d ", verticalCount, horizontalCount , mVerticalCount, mHorizontalCount );
181 bool fontchange = false; 181 bool fontchange = false;
182 if ( horizontalCount == 1) 182 if ( horizontalCount == 1)
183 horizontalCount = size().width() / mNavigatorView->yourFullSizeHint().width(); 183 horizontalCount = size().width() / mNavigatorView->yourFullSizeHint().width();
184 QFont fo; 184 QFont fo;
185 if ( horizontalCount != mHorizontalCount || 185 if ( horizontalCount != mHorizontalCount ||
186 verticalCount != mVerticalCount ) { 186 verticalCount != mVerticalCount ) {
187 uint count = horizontalCount * verticalCount; 187 uint count = horizontalCount * verticalCount;
188 if ( count == 0 ) { 188 if ( count == 0 ) {
189 bool ok; 189 bool ok;
190 fo = mNavigatorView->yourFontHint( size() , &ok ); 190 fo = mNavigatorView->yourFontHint( size() , &ok );
191 //mNavigatorView->resize( size() ); 191 //mNavigatorView->resize( size() );
192 //if ( ! ok ) 192 //if ( ! ok )
193 // return; 193 // return;
194 int butt = 2; 194 int butt = 2;
195 horizontalCount = size().width() / mNavigatorView->sizeHintTwoButtons( ).width(); 195 horizontalCount = size().width() / mNavigatorView->sizeHintTwoButtons( ).width();
196 if ( horizontalCount <= 1 ) 196 if ( horizontalCount <= 1 )
197 minSize = mNavigatorView->sizeHintTwoButtons( 4 ); 197 minSize = mNavigatorView->sizeHintTwoButtons( 4 );
198 else 198 else
199 minSize = mNavigatorView->sizeHintTwoButtons(); 199 minSize = mNavigatorView->sizeHintTwoButtons();
200 verticalCount = size().height() / minSize.height(); 200 verticalCount = size().height() / minSize.height();
201 horizontalCount = size().width() / minSize.width(); 201 horizontalCount = size().width() / minSize.width();
202 if ( horizontalCount == 0 ) 202 if ( horizontalCount == 0 )
203 horizontalCount = 1; 203 horizontalCount = 1;
204 if ( verticalCount == 0 ) 204 if ( verticalCount == 0 )
205 verticalCount = 1; 205 verticalCount = 1;
206 fontchange = true; 206 fontchange = true;
207 count = horizontalCount * verticalCount; 207 count = horizontalCount * verticalCount;
208 } else { 208 }
209 if ( mNavigatorView->fontChanged() ) { 209
210 fontchange = true;
211 fo = KOPrefs::instance()->mDateNavigatorFont;
212 mNavigatorView->changeFont( fo );
213 mNavigatorView->unsetFontChanged();
214 }
215 }
216
217 mLastDisplayedDN = horizontalCount*verticalCount-1; 210 mLastDisplayedDN = horizontalCount*verticalCount-1;
218 while ( count > ( mExtraViews.count() + 1 ) ) { 211 while ( count > ( mExtraViews.count() + 1 ) ) {
219 KDateNavigator *n = new KDateNavigator( this ); 212 KDateNavigator *n = new KDateNavigator( this );
220 n->setMonthSignalOffset ( mExtraViews.count()+1 ); 213 n->setMonthSignalOffset ( mExtraViews.count()+1 );
221 mExtraViews.append( n ); 214 mExtraViews.append( n );
222 n->setCalendar( mCalendar ); 215 n->setCalendar( mCalendar );
223 connectNavigatorView( n ); 216 connectNavigatorView( n );
224 // n->show(); 217 // n->show();
225 } 218 }
226 219
227
228 setBaseDates(); 220 setBaseDates();
229 if ( fontchange ) {
230 //mNavigatorView->changeFont( fo );
231 uint i;
232 for( i = 0; i < mExtraViews.count(); ++i ) {
233 KDateNavigator *view = mExtraViews.at( i );
234 view->changeFont( fo );
235 }
236 }
237 mHorizontalCount = horizontalCount; 221 mHorizontalCount = horizontalCount;
238 mVerticalCount = verticalCount; 222 mVerticalCount = verticalCount;
239 223
240 } 224 }
241 225 if ( !fontchange ) {
226 if ( mNavigatorView->fontChanged() ) {
227 fontchange = true;
228 fo = KOPrefs::instance()->mDateNavigatorFont;
229 mNavigatorView->changeFont( fo );
230 mNavigatorView->unsetFontChanged();
231 }
232 }
233 if ( fontchange ) {
234 uint i;
235 for( i = 0; i < mLastDisplayedDN; ++i ) {
236 KDateNavigator *view = mExtraViews.at( i );
237 view->changeFont( fo );
238 }
239 }
242 int theight = height() / mVerticalCount; 240 int theight = height() / mVerticalCount;
243 int twidth = width() / mHorizontalCount; 241 int twidth = width() / mHorizontalCount;
244 242
245 NavigatorBar *bar = mNavigatorView->navigatorBar(); 243 NavigatorBar *bar = mNavigatorView->navigatorBar();
246 if ( mHorizontalCount > 1 ) bar->showButtons( true, false ); 244 if ( mHorizontalCount > 1 ) bar->showButtons( true, false );
247 else bar->showButtons( true, true ); 245 else bar->showButtons( true, true );
248 246
249 mNavigatorView->setGeometry(0, 247 mNavigatorView->setGeometry(0,
250 0, twidth, theight ); 248 0, twidth, theight );
251 for( uint i = 0; i < mLastDisplayedDN; ++i ) { 249 for( uint i = 0; i < mLastDisplayedDN; ++i ) {
252 int x = ( i + 1 ) % mHorizontalCount; 250 int x = ( i + 1 ) % mHorizontalCount;
253 int y = ( i + 1 ) / mHorizontalCount; 251 int y = ( i + 1 ) / mHorizontalCount;
254 252
255 KDateNavigator *view = mExtraViews.at( i ); 253 KDateNavigator *view = mExtraViews.at( i );
256 bar = view->navigatorBar(); 254 bar = view->navigatorBar();
257 if ( y > 0 ) bar->showButtons( false, false ); 255 if ( y > 0 ) bar->showButtons( false, false );
258 else { 256 else {
259 if ( x + 1 == mHorizontalCount ) bar->showButtons( false, true ); 257 if ( x + 1 == mHorizontalCount ) bar->showButtons( false, true );
260 else bar->showButtons( false, false ); 258 else bar->showButtons( false, false );
261 } 259 }
262 view->setGeometry( x * twidth, 260 view->setGeometry( x * twidth,
263 y * theight, twidth, theight ); 261 y * theight, twidth, theight );
264 } 262 }
265 int iii = 0; 263 int iii = 0;
266 int ccc = mHorizontalCount * mVerticalCount; 264 int ccc = mHorizontalCount * mVerticalCount;
267 mNavigatorView->show(); 265 mNavigatorView->show();
268 while ( iii < ( mExtraViews.count() ) ) { 266 while ( iii < ( mExtraViews.count() ) ) {
269 if ( iii < ccc-1 ) 267 if ( iii < ccc-1 )
270 mExtraViews.at( iii )->show(); 268 mExtraViews.at( iii )->show();
271 else 269 else
272 mExtraViews.at( iii )->hide(); 270 mExtraViews.at( iii )->hide();
273 ++iii; 271 ++iii;
274 } 272 }
275 } 273 }
276 274
277 QDate last = lastAvailableDate(); 275 QDate last = lastAvailableDate();
278 QDate first = firstAvailableDate(); 276 QDate first = firstAvailableDate();
279 277
280 QDate selFirst = mFirstSelectedDate; 278 QDate selFirst = mFirstSelectedDate;
281 QDate selLast = selFirst.addDays( mSelectedDateCount-1 ); 279 QDate selLast = selFirst.addDays( mSelectedDateCount-1 );
282 if ( selFirst >= first && selLast <= last ) { 280 if ( selFirst >= first && selLast <= last ) {
283 updateDayMatrixDates(); 281 updateDayMatrixDates();
284 } 282 }
285 else { 283 else {
286 updateDayMatrixDates(); 284 updateDayMatrixDates();
287 emit monthSelected( mFirstSelectedDate.month() ); 285 emit monthSelected( mFirstSelectedDate.month() );
288 } 286 }
289} 287}
290void DateNavigatorContainer::updateDayMatrixDates() 288void DateNavigatorContainer::updateDayMatrixDates()
291{ 289{
292 QDate fDate = mFirstSelectedDate; 290 QDate fDate = mFirstSelectedDate;
293 QDate lDate = fDate.addDays( mSelectedDateCount - 1 ); 291 QDate lDate = fDate.addDays( mSelectedDateCount - 1 );
294 mNavigatorView->dayMatrix()->setSelectedDaysFrom( fDate , lDate ); 292 mNavigatorView->dayMatrix()->setSelectedDaysFrom( fDate , lDate );
295 mNavigatorView->dayMatrix()->repaint( false ); 293 mNavigatorView->dayMatrix()->repaint( false );
296 for( uint i = 0; i < mLastDisplayedDN; ++i ) { 294 for( uint i = 0; i < mLastDisplayedDN; ++i ) {
297 KDateNavigator *n = mExtraViews.at( i ); 295 KDateNavigator *n = mExtraViews.at( i );
298 if ( n->dayMatrix()->setSelectedDaysFrom( fDate , lDate ) ) { 296 if ( n->dayMatrix()->setSelectedDaysFrom( fDate , lDate ) ) {
299 n->dayMatrix()->repaint( false ); 297 n->dayMatrix()->repaint( false );
300 } 298 }
301 } 299 }
302} 300}
303 301
304void DateNavigatorContainer::updateDayMatrix() 302void DateNavigatorContainer::updateDayMatrix()
305{ 303{
306 mNavigatorView->updateDayMatrix(); 304 mNavigatorView->updateDayMatrix();
307 for( uint i = 0; i < mLastDisplayedDN; ++i ) { 305 for( uint i = 0; i < mLastDisplayedDN; ++i ) {
308 KDateNavigator *n = mExtraViews.at( i ); 306 KDateNavigator *n = mExtraViews.at( i );
309 n->updateDayMatrix(); 307 n->updateDayMatrix();
310 } 308 }
311} 309}
312 310
313void DateNavigatorContainer::updateToday() 311void DateNavigatorContainer::updateToday()
314{ 312{
315 qDebug("DateNavigatorContainer::updateToday() NOT IMPL "); 313 qDebug("DateNavigatorContainer::updateToday() NOT IMPL ");
316#if 0 314#if 0
317 mNavigatorView->updateToday(); 315 mNavigatorView->updateToday();
318 KDateNavigator *n; 316 KDateNavigator *n;
319 for( n = mExtraViews.first(); n; n = mExtraViews.next() ) { 317 for( n = mExtraViews.first(); n; n = mExtraViews.next() ) {
320 n->updateToday(); 318 n->updateToday();
321 } 319 }
322#endif 320#endif
323} 321}
324 322
325void DateNavigatorContainer::updateView() 323void DateNavigatorContainer::updateView()
326{ 324{
327 mNavigatorView->updateView(); 325 mNavigatorView->updateView();
328 for( uint i = 0; i < mLastDisplayedDN; ++i ) { 326 for( uint i = 0; i < mLastDisplayedDN; ++i ) {
329 KDateNavigator *n = mExtraViews.at( i ); 327 KDateNavigator *n = mExtraViews.at( i );
330 n->updateView(); 328 n->updateView();
331 } 329 }
332} 330}
333 331
334void DateNavigatorContainer::updateConfig() 332void DateNavigatorContainer::updateConfig()
335{ 333{
336 mNavigatorView->updateConfig(); 334 mNavigatorView->updateConfig();
337 for( uint i = 0; i < mLastDisplayedDN; ++i ) { 335 for( uint i = 0; i < mLastDisplayedDN; ++i ) {
diff --git a/korganizer/kdatenavigator.cpp b/korganizer/kdatenavigator.cpp
index 2fca49e..1d09f40 100644
--- a/korganizer/kdatenavigator.cpp
+++ b/korganizer/kdatenavigator.cpp
@@ -1,160 +1,159 @@
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 mMonthSignalOffset = 0; 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
65 setFont( KOPrefs::instance()->mDateNavigatorFont ); 64 setFont( KOPrefs::instance()->mDateNavigatorFont );
66 mNavigatorBar = new NavigatorBar( startDate, this ); 65 mNavigatorBar = new NavigatorBar( startDate, this );
67 topLayout->addMultiCellWidget( mNavigatorBar, 0, 0, 0, 7 ); 66 topLayout->addMultiCellWidget( mNavigatorBar, 0, 0, 0, 7 );
68 //mNavigatorBar->resize( 1,1); 67 //mNavigatorBar->resize( 1,1);
69 connect( mNavigatorBar, SIGNAL( goPrevYear() ), SIGNAL( goPrevYear() ) ); 68 connect( mNavigatorBar, SIGNAL( goPrevYear() ), SIGNAL( goPrevYear() ) );
70 connect( mNavigatorBar, SIGNAL( goPrevMonth() ), SIGNAL( goPrevMonth() ) ); 69 connect( mNavigatorBar, SIGNAL( goPrevMonth() ), SIGNAL( goPrevMonth() ) );
71 connect( mNavigatorBar, SIGNAL( goNextMonth() ), SIGNAL( goNextMonth() ) ); 70 connect( mNavigatorBar, SIGNAL( goNextMonth() ), SIGNAL( goNextMonth() ) );
72 connect( mNavigatorBar, SIGNAL( goNextYear() ), SIGNAL( goNextYear() ) ); 71 connect( mNavigatorBar, SIGNAL( goNextYear() ), SIGNAL( goNextYear() ) );
73 connect( mNavigatorBar, SIGNAL( monthSelected( int ) ), SLOT( slotMonthSelected( int ) ) ); 72 connect( mNavigatorBar, SIGNAL( monthSelected( int ) ), SLOT( slotMonthSelected( int ) ) );
74 73
75 // get the day of the week on the first day 74 // get the day of the week on the first day
76 QDate dayone(m_MthYr.year(), m_MthYr.month(), 1); 75 QDate dayone(m_MthYr.year(), m_MthYr.month(), 1);
77 m_fstDayOfWk = dayone.dayOfWeek(); 76 m_fstDayOfWk = dayone.dayOfWeek();
78 77
79 int i; 78 int i;
80 79
81 // Set up the heading fields. 80 // Set up the heading fields.
82 for( i = 0; i < 7; i++ ) { 81 for( i = 0; i < 7; i++ ) {
83 headings[i] = new QLabel("",this); 82 headings[i] = new QLabel("",this);
84 //headings[i]->setFont(QFont("Arial", 10, QFont::Bold)); 83 //headings[i]->setFont(QFont("Arial", 10, QFont::Bold));
85 headings[i]->setAlignment(AlignCenter); 84 headings[i]->setAlignment(AlignCenter);
86 headings[i]->installEventFilter(this); 85 headings[i]->installEventFilter(this);
87 86
88 topLayout->addWidget(headings[i],1,i+1); 87 topLayout->addWidget(headings[i],1,i+1);
89 } 88 }
90 89
91 // Create the weeknumber labels 90 // Create the weeknumber labels
92 for( i = 0; i < 6; i++ ) { 91 for( i = 0; i < 6; i++ ) {
93 weeknos[i] = new QLabel(this); 92 weeknos[i] = new QLabel(this);
94 weeknos[i]->setAlignment(AlignCenter); 93 weeknos[i]->setAlignment(AlignCenter);
95 //weeknos[i]->setFont(QFont("Arial", 10)); 94 //weeknos[i]->setFont(QFont("Arial", 10));
96 if(!m_bShowWeekNums) { 95 if(!m_bShowWeekNums) {
97 weeknos[i]->hide(); 96 weeknos[i]->hide();
98 } 97 }
99 weeknos[i]->installEventFilter(this); 98 weeknos[i]->installEventFilter(this);
100 99
101 topLayout->addWidget(weeknos[i],i+2,0); 100 topLayout->addWidget(weeknos[i],i+2,0);
102 } 101 }
103 102
104 daymatrix = new KODayMatrix( this, "KDateNavigator::DayMatrix"); 103 daymatrix = new KODayMatrix( this, "KDateNavigator::DayMatrix");
105 daymatrix->setFrameStyle(QFrame::Panel|QFrame::Sunken); 104 daymatrix->setFrameStyle(QFrame::Panel|QFrame::Sunken);
106 daymatrix->setLineWidth(1); 105 daymatrix->setLineWidth(1);
107 106
108 connect( daymatrix, SIGNAL( selected( const KCal::DateList & ) ), 107 connect( daymatrix, SIGNAL( selected( const KCal::DateList & ) ),
109 SIGNAL( datesSelected( const KCal::DateList & ) ) ); 108 SIGNAL( datesSelected( const KCal::DateList & ) ) );
110 109
111 connect( daymatrix, SIGNAL( eventDropped( Event * ) ), 110 connect( daymatrix, SIGNAL( eventDropped( Event * ) ),
112 SIGNAL( eventDropped( Event * ) ) ); 111 SIGNAL( eventDropped( Event * ) ) );
113 112
114 topLayout->addMultiCellWidget(daymatrix,2,7,1,7); 113 topLayout->addMultiCellWidget(daymatrix,2,7,1,7);
115 114
116 // read settings from configuration file. 115 // read settings from configuration file.
117 updateConfig(); 116 updateConfig();
118 enableRollover(FollowMonth); 117 enableRollover(FollowMonth);
119 mySizeHint = sizeHintTwoButtons(); 118 mySizeHint = sizeHintTwoButtons();
120 myFullSizeHint = sizeHintTwoButtons( 4 ); 119 myFullSizeHint = sizeHintTwoButtons( 4 );
121 mFontChanged = false; 120 mFontChanged = false;
122 //resize ( 3,3 ); 121 //resize ( 3,3 );
123 122
124} 123}
125void KDateNavigator::changeFont ( QFont fo ) 124void KDateNavigator::changeFont ( QFont fo )
126{ 125{
127 setFont( fo ); 126 setFont( fo );
128 mNavigatorBar->resetFont( fo ); 127 mNavigatorBar->resetFont( fo );
129} 128}
130QFont KDateNavigator::yourFontHint( QSize si , bool *b) 129QFont KDateNavigator::yourFontHint( QSize si , bool *b)
131{ 130{
132 QFont fo = KOPrefs::instance()->mDateNavigatorFont; 131 QFont fo = KOPrefs::instance()->mDateNavigatorFont;
133 *b = false; 132 *b = false;
134 int fontPoint = fo.pointSize(); 133 int fontPoint = fo.pointSize();
135 while ( fontPoint > 5 ) { 134 while ( fontPoint > 5 ) {
136 --fontPoint; 135 --fontPoint;
137 fo.setPointSize( fontPoint ); 136 fo.setPointSize( fontPoint );
138 setFont( fo ); 137 setFont( fo );
139 mFontChanged = true; 138 mFontChanged = true;
140 mNavigatorBar->resetFont( fo ); 139 mNavigatorBar->resetFont( fo );
141 QSize sh = sizeHintTwoButtons( 2 ); 140 QSize sh = sizeHintTwoButtons( 2 );
142 //qDebug("fp %d %d %d %d %d", fontPoint, si.width() , sh.width() , si.height() , sh.height() ); 141 //qDebug("fp %d %d %d %d %d", fontPoint, si.width() , sh.width() , si.height() , sh.height() );
143 if ( si.width() > sh.width() && si.height() > sh.height()) { 142 if ( si.width() > sh.width() && si.height() > sh.height()) {
144 if ( si.width() / sh.width() == 1 ) { 143 if ( si.width() / sh.width() == 1 ) {
145 if ( si.width() < sizeHintTwoButtons( 4 ).width()) 144 if ( si.width() < sizeHintTwoButtons( 4 ).width())
146 continue; 145 continue;
147 } 146 }
148 *b = true; 147 *b = true;
149 //qDebug("fooooooooooooooooooooooouuuuund "); 148 //qDebug("fooooooooooooooooooooooouuuuund ");
150 break; 149 break;
151 } 150 }
152 } 151 }
153 //qDebug("returnnnnnnnnnnnnnnnnnnn %d", fo.pointSize() ); 152 //qDebug("returnnnnnnnnnnnnnnnnnnn %d", fo.pointSize() );
154 return fo; 153 return fo;
155} 154}
156QSize KDateNavigator::sizeHint() const 155QSize KDateNavigator::sizeHint() const
157{ 156{
158 QFontMetrics fm ( font() ); 157 QFontMetrics fm ( font() );
159 QSize day = daymatrix->sizeHint(); 158 QSize day = daymatrix->sizeHint();
160 QSize nav = mNavigatorBar->sizeHint(); 159 QSize nav = mNavigatorBar->sizeHint();