summaryrefslogtreecommitdiffabout
authorzautrix <zautrix>2005-03-23 13:55:05 (UTC)
committer zautrix <zautrix>2005-03-23 13:55:05 (UTC)
commit53ba86911c8d22d2ca14ac19da85a728de710642 (patch) (unidiff)
tree429910d6955c629fc921e9a3bd537ec90d2378b7
parent913291ec9784520cc6ff9769081c03bd74a5ab07 (diff)
downloadkdepimpi-53ba86911c8d22d2ca14ac19da85a728de710642.zip
kdepimpi-53ba86911c8d22d2ca14ac19da85a728de710642.tar.gz
kdepimpi-53ba86911c8d22d2ca14ac19da85a728de710642.tar.bz2
layout fixes
Diffstat (more/less context) (ignore whitespace changes)
-rw-r--r--korganizer/datenavigatorcontainer.cpp6
-rw-r--r--korganizer/koagendaitem.cpp8
-rw-r--r--korganizer/koagendaview.cpp1
-rw-r--r--korganizer/komonthview.cpp26
-rw-r--r--korganizer/komonthview.h3
-rw-r--r--korganizer/koviewmanager.cpp1
6 files changed, 36 insertions, 9 deletions
diff --git a/korganizer/datenavigatorcontainer.cpp b/korganizer/datenavigatorcontainer.cpp
index 548c364..d1caff3 100644
--- a/korganizer/datenavigatorcontainer.cpp
+++ b/korganizer/datenavigatorcontainer.cpp
@@ -5,195 +5,197 @@
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#include "koprefs.h" 36#include "koprefs.h"
37 37
38DateNavigatorContainer::DateNavigatorContainer( QWidget *parent, 38DateNavigatorContainer::DateNavigatorContainer( QWidget *parent,
39 const char *name ) 39 const char *name )
40 : QWidget( parent, name ), mCalendar( 0 ), 40 : QWidget( parent, name ), mCalendar( 0 ),
41 mHorizontalCount( 1 ), mVerticalCount( 1 ) 41 mHorizontalCount( 1 ), mVerticalCount( 1 )
42{ 42{
43 mExtraViews.setAutoDelete( true ); 43 mExtraViews.setAutoDelete( true );
44 44
45 mNavigatorView = new KDateNavigator( this, name ); 45 mNavigatorView = new KDateNavigator( this, name );
46 46
47 connectNavigatorView( mNavigatorView ); 47 connectNavigatorView( mNavigatorView );
48 //setSizePolicy( QSizePolicy (QSizePolicy::Expanding,QSizePolicy::Expanding) ); 48 //setSizePolicy( QSizePolicy (QSizePolicy::Expanding,QSizePolicy::Expanding) );
49 mLastDisplayedDN = 0; 49 mLastDisplayedDN = 0;
50 mUpdateTimer; 50 mUpdateTimer;
51 mUpdateTimer = new QTimer( this ); 51 mUpdateTimer = new QTimer( this );
52 connect (mUpdateTimer ,SIGNAL(timeout()), this, SLOT ( checkUpdateDayMatrixDates() )); 52 connect (mUpdateTimer ,SIGNAL(timeout()), this, SLOT ( checkUpdateDayMatrixDates() ));
53 mFirstSelectedDate = QDate::currentDate();
54 mSelectedDateCount = 1;
53} 55}
54 56
55DateNavigatorContainer::~DateNavigatorContainer() 57DateNavigatorContainer::~DateNavigatorContainer()
56{ 58{
57} 59}
58 60
59void DateNavigatorContainer::connectNavigatorView( KDateNavigator *v ) 61void DateNavigatorContainer::connectNavigatorView( KDateNavigator *v )
60{ 62{
61 connect( v, SIGNAL( datesSelected( const KCal::DateList & ) ), 63 connect( v, SIGNAL( datesSelected( const KCal::DateList & ) ),
62 SIGNAL( datesSelected( const KCal::DateList & ) ) ); 64 SIGNAL( datesSelected( const KCal::DateList & ) ) );
63#if 0 65#if 0
64 connect( v, SIGNAL( incidenceDropped( Incidence *, const QDate & ) ), 66 connect( v, SIGNAL( incidenceDropped( Incidence *, const QDate & ) ),
65 SIGNAL( incidenceDropped( Incidence *, const QDate & ) ) ); 67 SIGNAL( incidenceDropped( Incidence *, const QDate & ) ) );
66 connect( v, SIGNAL( incidenceDroppedMove( Incidence *, const QDate & ) ), 68 connect( v, SIGNAL( incidenceDroppedMove( Incidence *, const QDate & ) ),
67 SIGNAL( incidenceDroppedMove( Incidence *, const QDate & ) ) ); 69 SIGNAL( incidenceDroppedMove( Incidence *, const QDate & ) ) );
68#endif 70#endif
69 connect( v, SIGNAL( weekClicked( const QDate & ) ), 71 connect( v, SIGNAL( weekClicked( const QDate & ) ),
70 SIGNAL( weekClicked( const QDate & ) ) ); 72 SIGNAL( weekClicked( const QDate & ) ) );
71 73
72 connect( v, SIGNAL( goPrevious() ), SIGNAL( goPrevious() ) ); 74 connect( v, SIGNAL( goPrevious() ), SIGNAL( goPrevious() ) );
73 connect( v, SIGNAL( goNext() ), SIGNAL( goNext() ) ); 75 connect( v, SIGNAL( goNext() ), SIGNAL( goNext() ) );
74 76
75 connect( v, SIGNAL( goNextMonth() ), SIGNAL( goNextMonth() ) ); 77 connect( v, SIGNAL( goNextMonth() ), SIGNAL( goNextMonth() ) );
76 connect( v, SIGNAL( goPrevMonth() ), SIGNAL( goPrevMonth() ) ); 78 connect( v, SIGNAL( goPrevMonth() ), SIGNAL( goPrevMonth() ) );
77 connect( v, SIGNAL( goNextYear() ), SIGNAL( goNextYear() ) ); 79 connect( v, SIGNAL( goNextYear() ), SIGNAL( goNextYear() ) );
78 connect( v, SIGNAL( goPrevYear() ), SIGNAL( goPrevYear() ) ); 80 connect( v, SIGNAL( goPrevYear() ), SIGNAL( goPrevYear() ) );
79 81
80 connect( v, SIGNAL( monthSelected( int ) ), SLOT( slotMonthSelected( int ) ) ); 82 connect( v, SIGNAL( monthSelected( int ) ), SLOT( slotMonthSelected( int ) ) );
81} 83}
82 84
83void DateNavigatorContainer::slotMonthSelected( int month ) 85void DateNavigatorContainer::slotMonthSelected( int month )
84{ 86{
85 //qDebug("slotMonthSelected %d ", month); 87 //qDebug("slotMonthSelected %d ", month);
86 QDate baseDate = mNavigatorView->baseDate(); 88 QDate baseDate = mNavigatorView->baseDate();
87 if ( baseDate.month() == month ) 89 if ( baseDate.month() == month )
88 return; 90 return;
89 //qDebug("month %d %d ",baseDate.month(),month); 91 //qDebug("month %d %d ",baseDate.month(),month);
90 QDate date = QDate ( baseDate.year(), baseDate.month() , 15 ); 92 QDate date = QDate ( baseDate.year(), baseDate.month() , 15 );
91 date = date.addDays( -(baseDate.month()-month ) *30 ); 93 date = date.addDays( -(baseDate.month()-month ) *30 );
92 QDate newBase = QDate ( date.year(), date.month() , baseDate.day() ); 94 QDate newBase = QDate ( date.year(), date.month() , baseDate.day() );
93 95
94#if 0 96#if 0
95 mFirstSelectedDate = dateList.first() ; 97 mFirstSelectedDate = dateList.first() ;
96 mSelectedDateCount = dateList.count() ; 98 mSelectedDateCount = dateList.count() ;
97 99
98 KDateNavigator *view = mExtraViews.at( 0 ); 100 KDateNavigator *view = mExtraViews.at( 0 );
99 QDate date = view->baseDate(); 101 QDate date = view->baseDate();
100 102
101 QDate curEnd = date.addDays( (mLastDisplayedDN)*30 +7); 103 QDate curEnd = date.addDays( (mLastDisplayedDN)*30 +7);
102 //qDebug("End %s %s ",lDate.toString().latin1(),curEnd.toString().latin1() ); 104 //qDebug("End %s %s ",lDate.toString().latin1(),curEnd.toString().latin1() );
103 if ( lDate < curEnd && date.addDays( -30 ) < fDate) { 105 if ( lDate < curEnd && date.addDays( -30 ) < fDate) {
104 mNavigatorView->dayMatrix()->setSelectedDaysFrom( fDate , lDate ); 106 mNavigatorView->dayMatrix()->setSelectedDaysFrom( fDate , lDate );
105 mNavigatorView->dayMatrix()->repaint( false ); 107 mNavigatorView->dayMatrix()->repaint( false );
106 for( uint i = 0; i < mLastDisplayedDN; ++i ) { 108 for( uint i = 0; i < mLastDisplayedDN; ++i ) {
107 KDateNavigator *n = mExtraViews.at( i ); 109 KDateNavigator *n = mExtraViews.at( i );
108 if ( n->dayMatrix()->setSelectedDaysFrom( fDate , lDate ) ) { 110 if ( n->dayMatrix()->setSelectedDaysFrom( fDate , lDate ) ) {
109 n->dayMatrix()->repaint( false ); 111 n->dayMatrix()->repaint( false );
110 } 112 }
111 } 113 }
112 return; 114 return;
113 } 115 }
114#endif 116#endif
115 //qDebug("NEW BASE %s", newBase.toString().latin1()); 117 //qDebug("NEW BASE %s", newBase.toString().latin1());
116 mNavigatorView->setBaseDate( newBase ); 118 mNavigatorView->setBaseDate( newBase );
117 QDate last = lastAvailableDate(); 119 QDate last = lastAvailableDate();
118 QDate first = firstAvailableDate(); 120 QDate first = firstAvailableDate();
119 121
120 QDate selFirst = mFirstSelectedDate; 122 QDate selFirst = mFirstSelectedDate;
121 QDate selLast = selFirst.addDays( mSelectedDateCount-1 ); 123 QDate selLast = selFirst.addDays( mSelectedDateCount-1 );
122 if ( selFirst >= first && selLast <= last ) { 124 if ( selFirst >= first && selLast <= last ) {
123 setBaseDates(); 125 setBaseDates();
124 updateDayMatrixDates(); 126 updateDayMatrixDates();
125 } 127 }
126 else { 128 else {
127 setBaseDates(); 129 setBaseDates();
128 updateDayMatrixDates(); 130 updateDayMatrixDates();
129 emit monthSelected( month ); 131 emit monthSelected( month );
130 } 132 }
131} 133}
132void DateNavigatorContainer::setCalendar( Calendar *cal ) 134void DateNavigatorContainer::setCalendar( Calendar *cal )
133{ 135{
134 mCalendar = cal; 136 mCalendar = cal;
135 mNavigatorView->setCalendar( cal ); 137 mNavigatorView->setCalendar( cal );
136 for( uint i = 0; i < mLastDisplayedDN; ++i ) { 138 for( uint i = 0; i < mLastDisplayedDN; ++i ) {
137 KDateNavigator *n = mExtraViews.at( i ); 139 KDateNavigator *n = mExtraViews.at( i );
138 n->setCalendar( cal ); 140 n->setCalendar( cal );
139 } 141 }
140} 142}
141void DateNavigatorContainer::checkUpdateDayMatrixDates() 143void DateNavigatorContainer::checkUpdateDayMatrixDates()
142{ 144{
143 qDebug("wid %d hei %d ", width(), height()); 145 //qDebug("KODNC: wid %d hei %d ", width(), height());
144 mUpdateTimer->stop(); 146 mUpdateTimer->stop();
145 //return; 147 //return;
146 if ( width() < 3 || height() < 3 ) 148 if ( width() < 3 || height() < 3 )
147 return; 149 return;
148 static int lastWid = 0; 150 static int lastWid = 0;
149 static int lastHei = 0; 151 static int lastHei = 0;
150 if ( lastWid == width() && height() == lastHei ) { 152 if ( lastWid == width() && height() == lastHei ) {
151 qDebug("no layout computing needed. "); 153 qDebug("KODNC: No layout computing needed. ");
152 } else { 154 } else {
153 lastWid = width(); 155 lastWid = width();
154 lastHei = height(); 156 lastHei = height();
155 157
156 QSize minSize = mNavigatorView->yourSizeHint(); 158 QSize minSize = mNavigatorView->yourSizeHint();
157 159
158 int verticalCount = size().height() / minSize.height(); 160 int verticalCount = size().height() / minSize.height();
159 int horizontalCount = size().width() / minSize.width(); 161 int horizontalCount = size().width() / minSize.width();
160 //qDebug(" wattdatt %d new %d %d ", size().width() ,e->size().width() , minSize.width() ); 162 //qDebug(" wattdatt %d new %d %d ", size().width() ,e->size().width() , minSize.width() );
161 //qDebug("COUNT %d %d %d %d ", verticalCount, horizontalCount , mVerticalCount, mHorizontalCount ); 163 //qDebug("COUNT %d %d %d %d ", verticalCount, horizontalCount , mVerticalCount, mHorizontalCount );
162 bool fontchange = false; 164 bool fontchange = false;
163 if ( horizontalCount == 1) 165 if ( horizontalCount == 1)
164 horizontalCount = size().width() / mNavigatorView->yourFullSizeHint().width(); 166 horizontalCount = size().width() / mNavigatorView->yourFullSizeHint().width();
165 QFont fo; 167 QFont fo;
166 if ( horizontalCount != mHorizontalCount || 168 if ( horizontalCount != mHorizontalCount ||
167 verticalCount != mVerticalCount ) { 169 verticalCount != mVerticalCount ) {
168 uint count = horizontalCount * verticalCount; 170 uint count = horizontalCount * verticalCount;
169 if ( count == 0 ) { 171 if ( count == 0 ) {
170 bool ok; 172 bool ok;
171 fo = mNavigatorView->yourFontHint( size() , &ok ); 173 fo = mNavigatorView->yourFontHint( size() , &ok );
172 //mNavigatorView->resize( size() ); 174 //mNavigatorView->resize( size() );
173 //if ( ! ok ) 175 //if ( ! ok )
174 // return; 176 // return;
175 int butt = 2; 177 int butt = 2;
176 horizontalCount = size().width() / mNavigatorView->sizeHintTwoButtons( ).width(); 178 horizontalCount = size().width() / mNavigatorView->sizeHintTwoButtons( ).width();
177 if ( horizontalCount <= 1 ) 179 if ( horizontalCount <= 1 )
178 minSize = mNavigatorView->sizeHintTwoButtons( 4 ); 180 minSize = mNavigatorView->sizeHintTwoButtons( 4 );
179 else 181 else
180 minSize = mNavigatorView->sizeHintTwoButtons(); 182 minSize = mNavigatorView->sizeHintTwoButtons();
181 verticalCount = size().height() / minSize.height(); 183 verticalCount = size().height() / minSize.height();
182 horizontalCount = size().width() / minSize.width(); 184 horizontalCount = size().width() / minSize.width();
183 if ( horizontalCount == 0 ) 185 if ( horizontalCount == 0 )
184 horizontalCount = 1; 186 horizontalCount = 1;
185 if ( verticalCount == 0 ) 187 if ( verticalCount == 0 )
186 verticalCount = 1; 188 verticalCount = 1;
187 fontchange = true; 189 fontchange = true;
188 count = horizontalCount * verticalCount; 190 count = horizontalCount * verticalCount;
189 } else { 191 } else {
190 if ( mNavigatorView->fontChanged() ) { 192 if ( mNavigatorView->fontChanged() ) {
191 fontchange = true; 193 fontchange = true;
192 fo = KOPrefs::instance()->mDateNavigatorFont; 194 fo = KOPrefs::instance()->mDateNavigatorFont;
193 mNavigatorView->changeFont( fo ); 195 mNavigatorView->changeFont( fo );
194 mNavigatorView->unsetFontChanged(); 196 mNavigatorView->unsetFontChanged();
195 } 197 }
196 } 198 }
197 199
198 mLastDisplayedDN = horizontalCount*verticalCount-1; 200 mLastDisplayedDN = horizontalCount*verticalCount-1;
199 while ( count > ( mExtraViews.count() + 1 ) ) { 201 while ( count > ( mExtraViews.count() + 1 ) ) {
diff --git a/korganizer/koagendaitem.cpp b/korganizer/koagendaitem.cpp
index 7e6fa48..82d1eab 100644
--- a/korganizer/koagendaitem.cpp
+++ b/korganizer/koagendaitem.cpp
@@ -459,105 +459,105 @@ QPixmap * KOAgendaItem::paintPixSel()
459} 459}
460void KOAgendaItem::paintEvent ( QPaintEvent *e ) 460void KOAgendaItem::paintEvent ( QPaintEvent *e )
461{ 461{
462 462
463 if ( globalFlagBlockAgendaItemPaint ) 463 if ( globalFlagBlockAgendaItemPaint )
464 return; 464 return;
465 if ( globalFlagBlockAgenda > 0 && globalFlagBlockAgenda < 5 ) 465 if ( globalFlagBlockAgenda > 0 && globalFlagBlockAgenda < 5 )
466 return; 466 return;
467 int yy; 467 int yy;
468 if ( mAllDay ) 468 if ( mAllDay )
469 yy = y(); 469 yy = y();
470 else 470 else
471 yy = mCellYTop * ( height() / cellHeight() ); 471 yy = mCellYTop * ( height() / cellHeight() );
472 int xx = x(); 472 int xx = x();
473 473
474 if ( xPaintCoord != xx || yPaintCoord != yy || 474 if ( xPaintCoord != xx || yPaintCoord != yy ||
475 wPaintCoord != width() || hPaintCoord != height()) { 475 wPaintCoord != width() || hPaintCoord != height()) {
476 xPaintCoord= xx; 476 xPaintCoord= xx;
477 yPaintCoord = yy; 477 yPaintCoord = yy;
478 wPaintCoord = width(); 478 wPaintCoord = width();
479 hPaintCoord = height(); 479 hPaintCoord = height();
480 globalFlagBlockAgendaItemUpdate = 0; 480 globalFlagBlockAgendaItemUpdate = 0;
481 paintMe( mSelected ); 481 paintMe( mSelected );
482 //qDebug("calling paintMe "); 482 //qDebug("calling paintMe ");
483 globalFlagBlockAgendaItemUpdate = 1; 483 globalFlagBlockAgendaItemUpdate = 1;
484 } 484 }
485 int rx, ry, rw, rh; 485 int rx, ry, rw, rh;
486 rx = e->rect().x(); 486 rx = e->rect().x();
487 ry = e->rect().y(); 487 ry = e->rect().y();
488 rw = e->rect().width(); 488 rw = e->rect().width();
489 rh = e->rect().height(); 489 rh = e->rect().height();
490 //qDebug(" paintevent %s %d %d %d %d", mIncidence->summary().latin1(), x(), yy, width(), height()); 490 //qDebug(" paintevent %s %d %d %d %d", mIncidence->summary().latin1(), x(), yy, width(), height());
491 491
492 QPixmap* paintFrom ; 492 QPixmap* paintFrom ;
493 if ( mSelected ) { 493 if ( mSelected ) {
494 paintFrom = paintPixSel(); 494 paintFrom = paintPixSel();
495 } else { 495 } else {
496 if ( mAllDay ) 496 if ( mAllDay )
497 paintFrom = paintPixAllday(); 497 paintFrom = paintPixAllday();
498 else 498 else
499 paintFrom = paintPix(); 499 paintFrom = paintPix();
500 } 500 }
501 xx += rx; 501 xx += rx;
502 502
503 if ( xx < 0 ) { 503 if ( xx < 0 ) {
504 rw = rw + xx; 504 rw = rw + xx;
505 rx -= xx; 505 rx -= xx;
506 xx = 0; 506 xx = 0;
507 if ( rw < 0 ) { 507 if ( rw <= 1 ) {
508 qDebug("KOAgendaItem::Width1 < 0. Returning "); 508 qDebug("KOAgendaItem::Width1 <= 1 (%d). Returning. %s",rw,mDisplayedText.latin1());
509 return; 509 return;
510 } 510 }
511 } 511 }
512 if ( paintFrom->width() < xx+rw ) { 512 if ( paintFrom->width() < xx+rw ) {
513 rw = paintFrom->width() - xx; 513 rw = paintFrom->width() - xx;
514 if ( rw < 0 ) { 514 if ( rw <= 1 ) {
515 qDebug("KOAgendaItem::Width2 < 0. Returning "); 515 qDebug("KOAgendaItem::Width2 <= 1 (%d). Returning.%s ",rw,mDisplayedText.latin1() );
516 return; 516 return;
517 } 517 }
518 } 518 }
519 //qDebug("%d %d %d %d %d %d %d",rx, ry, paintFrom, xx ,yPaintCoord+ry, rw, rh); 519 //qDebug("%d %d %d %d %d %d %d",rx, ry, paintFrom, xx ,yPaintCoord+ry, rw, rh);
520 bitBlt (this, rx, ry, paintFrom, xx ,yPaintCoord+ry, rw, rh ,CopyROP); 520 bitBlt (this, rx, ry, paintFrom, xx ,yPaintCoord+ry, rw, rh ,CopyROP);
521} 521}
522void KOAgendaItem::computeText() 522void KOAgendaItem::computeText()
523{ 523{
524 524
525 mDisplayedText = mIncidence->summary(); 525 mDisplayedText = mIncidence->summary();
526 if ( (mIncidence->type() == "Todo") ) { 526 if ( (mIncidence->type() == "Todo") ) {
527 if ( static_cast<Todo*>(mIncidence)->hasDueDate() ) { 527 if ( static_cast<Todo*>(mIncidence)->hasDueDate() ) {
528 if ( static_cast<Todo*>(mIncidence)->dtDue().date() < QDate::currentDate() ) 528 if ( static_cast<Todo*>(mIncidence)->dtDue().date() < QDate::currentDate() )
529 mDisplayedText += i18n(" (") +KGlobal::locale()->formatDate((static_cast<Todo*>(mIncidence))->dtDue().date(), true)+")"; 529 mDisplayedText += i18n(" (") +KGlobal::locale()->formatDate((static_cast<Todo*>(mIncidence))->dtDue().date(), true)+")";
530 else if ( !(mIncidence->doesFloat())) 530 else if ( !(mIncidence->doesFloat()))
531 mDisplayedText += i18n(" (") +KGlobal::locale()->formatTime((static_cast<Todo*>(mIncidence))->dtDue().time())+")"; 531 mDisplayedText += i18n(" (") +KGlobal::locale()->formatTime((static_cast<Todo*>(mIncidence))->dtDue().time())+")";
532 } 532 }
533 } else { 533 } else {
534 if ( !(mIncidence->doesFloat()) && KOPrefs::instance()->mShowTimeInAgenda) 534 if ( !(mIncidence->doesFloat()) && KOPrefs::instance()->mShowTimeInAgenda)
535 mDisplayedText += ": " +KGlobal::locale()->formatTime((static_cast<Event*>(mIncidence))->dtStart().time()) + "-" + KGlobal::locale()->formatTime((static_cast<Event*>(mIncidence))->dtEnd().time()) ; 535 mDisplayedText += ": " +KGlobal::locale()->formatTime((static_cast<Event*>(mIncidence))->dtStart().time()) + "-" + KGlobal::locale()->formatTime((static_cast<Event*>(mIncidence))->dtEnd().time()) ;
536 536
537 if ( mAllDay ) { 537 if ( mAllDay ) {
538 if ( mIncidence->dtStart().date().addDays(3) < mIncidence->dtEnd().date() ) { 538 if ( mIncidence->dtStart().date().addDays(3) < mIncidence->dtEnd().date() ) {
539 mDisplayedText += ": " +KGlobal::locale()->formatDate((static_cast<Event*>(mIncidence))->dtStart().date(), true) + " - " + KGlobal::locale()->formatDate((static_cast<Event*>(mIncidence))->dtEnd().date(), true) ; 539 mDisplayedText += ": " +KGlobal::locale()->formatDate((static_cast<Event*>(mIncidence))->dtStart().date(), true) + " - " + KGlobal::locale()->formatDate((static_cast<Event*>(mIncidence))->dtEnd().date(), true) ;
540 } 540 }
541 } 541 }
542 542
543 } 543 }
544 544
545 if ( !mIncidence->location().isEmpty() ) { 545 if ( !mIncidence->location().isEmpty() ) {
546 if ( mAllDay ) 546 if ( mAllDay )
547 mDisplayedText += " ("; 547 mDisplayedText += " (";
548 else 548 else
549 mDisplayedText += "\n("; 549 mDisplayedText += "\n(";
550 mDisplayedText += mIncidence->location() +")"; 550 mDisplayedText += mIncidence->location() +")";
551 } 551 }
552 552
553 QString tipText = mIncidence->summary(); 553 QString tipText = mIncidence->summary();
554 if ( !mIncidence->doesFloat() ) { 554 if ( !mIncidence->doesFloat() ) {
555 if ( mIncidence->type() == "Event" ) { 555 if ( mIncidence->type() == "Event" ) {
556 if ( (static_cast<Event*>(mIncidence))->isMultiDay() ) { 556 if ( (static_cast<Event*>(mIncidence))->isMultiDay() ) {
557 tipText += "\n"+i18n("From: ")+mIncidence->dtStartStr(); 557 tipText += "\n"+i18n("From: ")+mIncidence->dtStartStr();
558 tipText += "\n"+i18n("To: ")+(static_cast<Event*>(mIncidence))->dtEndStr(); 558 tipText += "\n"+i18n("To: ")+(static_cast<Event*>(mIncidence))->dtEndStr();
559 } 559 }
560 else { 560 else {
561 tipText += "\n"+i18n("Time: ")+mIncidence->dtStartTimeStr(); 561 tipText += "\n"+i18n("Time: ")+mIncidence->dtStartTimeStr();
562 tipText += " - "+(static_cast<Event*>(mIncidence))->dtEndTimeStr(); 562 tipText += " - "+(static_cast<Event*>(mIncidence))->dtEndTimeStr();
563 } 563 }
diff --git a/korganizer/koagendaview.cpp b/korganizer/koagendaview.cpp
index eb3a6cd..5508210 100644
--- a/korganizer/koagendaview.cpp
+++ b/korganizer/koagendaview.cpp
@@ -222,96 +222,97 @@ void TimeLabels::contentsMouseMoveEvent ( QMouseEvent * e )
222 tSize = 22; 222 tSize = 22;
223 tSize = (tSize-2)/2; 223 tSize = (tSize-2)/2;
224 topLevelWidget()->setCaption(i18n("New Agendasize: %1").arg(tSize)); 224 topLevelWidget()->setCaption(i18n("New Agendasize: %1").arg(tSize));
225 225
226} 226}
227void TimeLabels::contentsMouseReleaseEvent ( QMouseEvent * e ) 227void TimeLabels::contentsMouseReleaseEvent ( QMouseEvent * e )
228{ 228{
229 topLevelWidget()->setCaption( mOrgCap ); 229 topLevelWidget()->setCaption( mOrgCap );
230 int diff = mMouseDownY - e->pos().y(); 230 int diff = mMouseDownY - e->pos().y();
231 if ( diff < 10 && diff > -10 ) 231 if ( diff < 10 && diff > -10 )
232 return; 232 return;
233 int tSize = KOPrefs::instance()->mHourSize + (diff/10); 233 int tSize = KOPrefs::instance()->mHourSize + (diff/10);
234 if ( tSize < 4 ) 234 if ( tSize < 4 )
235 tSize = 4; 235 tSize = 4;
236 if ( tSize > 22 ) 236 if ( tSize > 22 )
237 tSize = 22; 237 tSize = 22;
238 tSize = (tSize/2)*2; 238 tSize = (tSize/2)*2;
239 if ( tSize == KOPrefs::instance()->mHourSize ) 239 if ( tSize == KOPrefs::instance()->mHourSize )
240 return; 240 return;
241 KOPrefs::instance()->mHourSize = tSize; 241 KOPrefs::instance()->mHourSize = tSize;
242 emit scaleChanged(); 242 emit scaleChanged();
243} 243}
244 244
245/** This is called in response to repaint() */ 245/** This is called in response to repaint() */
246void TimeLabels::paintEvent(QPaintEvent*) 246void TimeLabels::paintEvent(QPaintEvent*)
247{ 247{
248 248
249 // kdDebug() << "paintevent..." << endl; 249 // kdDebug() << "paintevent..." << endl;
250 // this is another hack! 250 // this is another hack!
251 // QPainter painter(this); 251 // QPainter painter(this);
252 //QString c 252 //QString c
253 repaintContents(contentsX(), contentsY(), visibleWidth(), visibleHeight()); 253 repaintContents(contentsX(), contentsY(), visibleWidth(), visibleHeight());
254} 254}
255 255
256//////////////////////////////////////////////////////////////////////////// 256////////////////////////////////////////////////////////////////////////////
257 257
258EventIndicator::EventIndicator(Location loc,QWidget *parent,const char *name) 258EventIndicator::EventIndicator(Location loc,QWidget *parent,const char *name)
259 : QFrame(parent,name) 259 : QFrame(parent,name)
260{ 260{
261 mColumns = 1; 261 mColumns = 1;
262 mTopBox = 0; 262 mTopBox = 0;
263 mLocation = loc; 263 mLocation = loc;
264 mTopLayout = 0; 264 mTopLayout = 0;
265 mPaintWidget = 0; 265 mPaintWidget = 0;
266 mXOffset = 0; 266 mXOffset = 0;
267 if (mLocation == Top) mPixmap = SmallIcon("1uparrow"); 267 if (mLocation == Top) mPixmap = SmallIcon("1uparrow");
268 else mPixmap = SmallIcon("1downarrow"); 268 else mPixmap = SmallIcon("1downarrow");
269 mEnabled.resize(mColumns); 269 mEnabled.resize(mColumns);
270 mEnabled.fill( false );
270 setMinimumHeight(mPixmap.height()); 271 setMinimumHeight(mPixmap.height());
271} 272}
272 273
273EventIndicator::~EventIndicator() 274EventIndicator::~EventIndicator()
274{ 275{
275} 276}
276 277
277void EventIndicator::drawContents(QPainter *p) 278void EventIndicator::drawContents(QPainter *p)
278{ 279{
279 280
280 // kdDebug() << "======== top: " << contentsRect().top() << " bottom " << // contentsRect().bottom() << " left " << contentsRect().left() << " right " << contentsRect().right() << endl; 281 // kdDebug() << "======== top: " << contentsRect().top() << " bottom " << // contentsRect().bottom() << " left " << contentsRect().left() << " right " << contentsRect().right() << endl;
281 KDGanttSplitterHandle* han = 0; 282 KDGanttSplitterHandle* han = 0;
282 if ( mPaintWidget ) 283 if ( mPaintWidget )
283 han = mPaintWidget->firstHandle(); 284 han = mPaintWidget->firstHandle();
284 if ( ! han ) { 285 if ( ! han ) {
285 int i; 286 int i;
286 for(i=0;i<mColumns;++i) { 287 for(i=0;i<mColumns;++i) {
287 if (mEnabled[i]) { 288 if (mEnabled[i]) {
288 int cellWidth = contentsRect().right()/mColumns; 289 int cellWidth = contentsRect().right()/mColumns;
289 int xOffset = KOGlobals::self()->reverseLayout() ? 290 int xOffset = KOGlobals::self()->reverseLayout() ?
290 (mColumns - 1 - i)*cellWidth + (cellWidth -mPixmap.width())/2 : 291 (mColumns - 1 - i)*cellWidth + (cellWidth -mPixmap.width())/2 :
291 i*cellWidth + (cellWidth -mPixmap.width()) /2; 292 i*cellWidth + (cellWidth -mPixmap.width()) /2;
292 p->drawPixmap(QPoint(1+xOffset,0),mPixmap); 293 p->drawPixmap(QPoint(1+xOffset,0),mPixmap);
293 } 294 }
294 } 295 }
295 } else { 296 } else {
296 han->repaint(); 297 han->repaint();
297 //mPaintWidget->setBackgroundColor( red ); 298 //mPaintWidget->setBackgroundColor( red );
298 299
299 QPainter pa( han ); 300 QPainter pa( han );
300 int i; 301 int i;
301 bool setColor = false; 302 bool setColor = false;
302 for(i=0;i<mColumns;++i) { 303 for(i=0;i<mColumns;++i) {
303 if (mEnabled[i]) { 304 if (mEnabled[i]) {
304 setColor = true; 305 setColor = true;
305 306
306 int cellWidth = contentsRect().right()/mColumns; 307 int cellWidth = contentsRect().right()/mColumns;
307 int xOffset = KOGlobals::self()->reverseLayout() ? 308 int xOffset = KOGlobals::self()->reverseLayout() ?
308 (mColumns - 1 - i)*cellWidth + cellWidth/2 -mPixmap.width()/2 : 309 (mColumns - 1 - i)*cellWidth + cellWidth/2 -mPixmap.width()/2 :
309 i*cellWidth + cellWidth/2 -mPixmap.width()/2; 310 i*cellWidth + cellWidth/2 -mPixmap.width()/2;
310 pa.drawPixmap(QPoint(mXOffset + xOffset,0),mPixmap); 311 pa.drawPixmap(QPoint(mXOffset + xOffset,0),mPixmap);
311 //qDebug("222draw pix %d ",xOffset ); 312 //qDebug("222draw pix %d ",xOffset );
312 313
313 } 314 }
314 315
315 } 316 }
316 pa.end(); 317 pa.end();
317 318
diff --git a/korganizer/komonthview.cpp b/korganizer/komonthview.cpp
index 9fd1f68..8ee5bc3 100644
--- a/korganizer/komonthview.cpp
+++ b/korganizer/komonthview.cpp
@@ -949,96 +949,101 @@ KOMonthView::KOMonthView(Calendar *calendar, QWidget *parent, const char *name)
949 for( row = 0; row < mNumWeeks; ++row ) { 949 for( row = 0; row < mNumWeeks; ++row ) {
950 for( col = 0; col < mDaysPerWeek; ++col ) { 950 for( col = 0; col < mDaysPerWeek; ++col ) {
951 MonthViewCell *cell = new MonthViewCell( this, mMonthView ); 951 MonthViewCell *cell = new MonthViewCell( this, mMonthView );
952 mCells.insert( row * mDaysPerWeek + col, cell ); 952 mCells.insert( row * mDaysPerWeek + col, cell );
953 953
954 connect( cell, SIGNAL( defaultAction( Incidence * ) ), 954 connect( cell, SIGNAL( defaultAction( Incidence * ) ),
955 SLOT( defaultAction( Incidence * ) ) ); 955 SLOT( defaultAction( Incidence * ) ) );
956 connect( cell, SIGNAL( newEventSignal( QDateTime ) ), 956 connect( cell, SIGNAL( newEventSignal( QDateTime ) ),
957 SIGNAL( newEventSignal( QDateTime ) ) ); 957 SIGNAL( newEventSignal( QDateTime ) ) );
958 connect( cell, SIGNAL( showDaySignal( QDate ) ), 958 connect( cell, SIGNAL( showDaySignal( QDate ) ),
959 SIGNAL( showDaySignal( QDate ) ) ); 959 SIGNAL( showDaySignal( QDate ) ) );
960 } 960 }
961 } 961 }
962 mCellsW.resize( mDaysPerWeek ); 962 mCellsW.resize( mDaysPerWeek );
963 for( col = 0; col < mDaysPerWeek; ++col ) { 963 for( col = 0; col < mDaysPerWeek; ++col ) {
964 MonthViewCell *cell = new MonthViewCell( this, mWeekView ); 964 MonthViewCell *cell = new MonthViewCell( this, mWeekView );
965 mCellsW.insert( col, cell ); 965 mCellsW.insert( col, cell );
966 966
967 connect( cell, SIGNAL( defaultAction( Incidence * ) ), 967 connect( cell, SIGNAL( defaultAction( Incidence * ) ),
968 SLOT( defaultAction( Incidence * ) ) ); 968 SLOT( defaultAction( Incidence * ) ) );
969 connect( cell, SIGNAL( newEventSignal( QDateTime ) ), 969 connect( cell, SIGNAL( newEventSignal( QDateTime ) ),
970 SIGNAL( newEventSignal( QDateTime ) ) ); 970 SIGNAL( newEventSignal( QDateTime ) ) );
971 connect( cell, SIGNAL( showDaySignal( QDate ) ), 971 connect( cell, SIGNAL( showDaySignal( QDate ) ),
972 SIGNAL( showDaySignal( QDate ) ) ); 972 SIGNAL( showDaySignal( QDate ) ) );
973 cell->updateConfig(KOPrefs::instance()->mMonthViewUsesBigFont ); 973 cell->updateConfig(KOPrefs::instance()->mMonthViewUsesBigFont );
974 } 974 }
975 975
976 //connect( mWeekLabels[mNumWeeks], SIGNAL( clicked() ), SLOT( switchView() ) ); 976 //connect( mWeekLabels[mNumWeeks], SIGNAL( clicked() ), SLOT( switchView() ) );
977 mContextMenu = eventPopup(); 977 mContextMenu = eventPopup();
978 // updateConfig(); //useless here... 978 // updateConfig(); //useless here...
979 // ... but we need mWidthLongDayLabel computed 979 // ... but we need mWidthLongDayLabel computed
980 QFontMetrics fontmetric(mDayLabels[0]->font()); 980 QFontMetrics fontmetric(mDayLabels[0]->font());
981 mWidthLongDayLabel = 0; 981 mWidthLongDayLabel = 0;
982 for (int i = 0; i < 7; i++) { 982 for (int i = 0; i < 7; i++) {
983 int width = fontmetric.width(KOGlobals::self()->calendarSystem()->weekDayName(i+1)); 983 int width = fontmetric.width(KOGlobals::self()->calendarSystem()->weekDayName(i+1));
984 if ( width > mWidthLongDayLabel ) mWidthLongDayLabel = width; 984 if ( width > mWidthLongDayLabel ) mWidthLongDayLabel = width;
985 } 985 }
986 986
987 //mWeekLabels[mNumWeeks]->setText( i18n("W")); 987 //mWeekLabels[mNumWeeks]->setText( i18n("W"));
988 988
989#if 0 989#if 0
990 if ( mShowWeekView ) 990 if ( mShowWeekView )
991 mWidStack->raiseWidget( mWeekView ); 991 mWidStack->raiseWidget( mWeekView );
992 else 992 else
993 mWidStack->raiseWidget( mMonthView ); 993 mWidStack->raiseWidget( mMonthView );
994#endif 994#endif
995 995
996 emit incidenceSelected( 0 ); 996 emit incidenceSelected( 0 );
997
998 mComputeLayoutTimer = new QTimer( this );
999 connect (mComputeLayoutTimer ,SIGNAL(timeout()), this, SLOT ( slotComputeLayout()));
1000
1001
997#ifndef DESKTOP_VERSION 1002#ifndef DESKTOP_VERSION
998 resize( QApplication::desktop()->size() ); 1003 resize( QApplication::desktop()->size() );
999#else 1004#else
1000 resize(640, 480 ); 1005 resize(640, 480 );
1001 updatePossible = true; 1006 updatePossible = true;
1002#endif 1007#endif
1003 computeLayout(); 1008 computeLayout();
1004 1009
1005 if ( mShowWeekView ) 1010 if ( mShowWeekView )
1006 mWidStack->raiseWidget( mWeekView ); 1011 mWidStack->raiseWidget( mWeekView );
1007 else 1012 else
1008 mWidStack->raiseWidget( mMonthView ); 1013 mWidStack->raiseWidget( mMonthView );
1009} 1014}
1010 1015
1011KOMonthView::~KOMonthView() 1016KOMonthView::~KOMonthView()
1012{ 1017{
1013 delete mContextMenu; 1018 delete mContextMenu;
1014} 1019}
1015 1020
1016void KOMonthView::selectInternalWeekNum ( int n ) 1021void KOMonthView::selectInternalWeekNum ( int n )
1017{ 1022{
1018 switchView(); 1023 switchView();
1019 if ( !KOPrefs::instance()->mMonthViewWeek ) 1024 if ( !KOPrefs::instance()->mMonthViewWeek )
1020 emit selectMonth (); 1025 emit selectMonth ();
1021 else 1026 else
1022 emit selectWeekNum ( n ); 1027 emit selectWeekNum ( n );
1023} 1028}
1024 1029
1025int KOMonthView::currentWeek() 1030int KOMonthView::currentWeek()
1026{ 1031{
1027 if ( mShowWeekView ) 1032 if ( mShowWeekView )
1028 return mWeekLabelsW[0]->getWeekNum(); 1033 return mWeekLabelsW[0]->getWeekNum();
1029 return mWeekLabels[0]->getWeekNum(); 1034 return mWeekLabels[0]->getWeekNum();
1030} 1035}
1031void KOMonthView::switchView() 1036void KOMonthView::switchView()
1032{ 1037{
1033 if ( selectedCell( ) ) 1038 if ( selectedCell( ) )
1034 selectedCell()->deselect(); 1039 selectedCell()->deselect();
1035 mShowWeekView = !mShowWeekView; 1040 mShowWeekView = !mShowWeekView;
1036 KOPrefs::instance()->mMonthViewWeek = mShowWeekView; 1041 KOPrefs::instance()->mMonthViewWeek = mShowWeekView;
1037 if ( clPending ) { 1042 if ( clPending ) {
1038 computeLayout(); 1043 computeLayout();
1039 updateConfig(); 1044 updateConfig();
1040 } 1045 }
1041 if ( mShowWeekView ) 1046 if ( mShowWeekView )
1042 mWidStack->raiseWidget( mWeekView ); 1047 mWidStack->raiseWidget( mWeekView );
1043 else 1048 else
1044 mWidStack->raiseWidget( mMonthView ); 1049 mWidStack->raiseWidget( mMonthView );
@@ -1306,125 +1311,139 @@ void KOMonthView::updateView()
1306 if ( st < 0 ) st = 0; 1311 if ( st < 0 ) st = 0;
1307 if ( end > timeSpan ) end = timeSpan; 1312 if ( end > timeSpan ) end = timeSpan;
1308 int iii; 1313 int iii;
1309 for ( iii = st;iii<= end;++iii) 1314 for ( iii = st;iii<= end;++iii)
1310 (*cells)[iii]->insertEvent( event ); 1315 (*cells)[iii]->insertEvent( event );
1311 } 1316 }
1312 } 1317 }
1313 } 1318 }
1314 } 1319 }
1315 // insert due todos 1320 // insert due todos
1316 QPtrList<Todo> todos = calendar()->todos( ); 1321 QPtrList<Todo> todos = calendar()->todos( );
1317 Todo *todo; 1322 Todo *todo;
1318 for(todo = todos.first(); todo; todo = todos.next()) { 1323 for(todo = todos.first(); todo; todo = todos.next()) {
1319 //insertTodo( todo ); 1324 //insertTodo( todo );
1320 if ( todo->hasDueDate() ) { 1325 if ( todo->hasDueDate() ) {
1321 int day = mStartDate.daysTo( todo->dtDue().date() ); 1326 int day = mStartDate.daysTo( todo->dtDue().date() );
1322 if ( day >= 0 && day < timeSpan + 1) { 1327 if ( day >= 0 && day < timeSpan + 1) {
1323 (*cells)[day]->insertTodo( todo ); 1328 (*cells)[day]->insertTodo( todo );
1324 } 1329 }
1325 } 1330 }
1326 } 1331 }
1327 1332
1328 for( i = 0; i < timeSpan+1; ++i ) { 1333 for( i = 0; i < timeSpan+1; ++i ) {
1329 (*cells)[i]->finishUpdateCell(); 1334 (*cells)[i]->finishUpdateCell();
1330 } 1335 }
1331 processSelectionChange(); 1336 processSelectionChange();
1332 (*cells)[0]->setFocus(); 1337 (*cells)[0]->setFocus();
1333 1338
1334 1339
1335#else 1340#else
1336 // old code 1341 // old code
1337 //qDebug("+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ "); 1342 //qDebug("+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ ");
1338 int i; 1343 int i;
1339 for( i = 0; i < (*cells).count(); ++i ) { 1344 for( i = 0; i < (*cells).count(); ++i ) {
1340 (*cells)[i]->updateCell(); 1345 (*cells)[i]->updateCell();
1341 } 1346 }
1342 1347
1343 //qDebug("KOMonthView::updateView() "); 1348 //qDebug("KOMonthView::updateView() ");
1344 processSelectionChange(); 1349 processSelectionChange();
1345 // qDebug("---------------------------------------------------------------------+ "); 1350 // qDebug("---------------------------------------------------------------------+ ");
1346 (*cells)[0]->setFocus(); 1351 (*cells)[0]->setFocus();
1347#endif 1352#endif
1348 1353
1349 //qDebug("update time %d ", ti.elapsed()); 1354 //qDebug("update time %d ", ti.elapsed());
1350} 1355}
1351 1356
1352void KOMonthView::resizeEvent(QResizeEvent * e) 1357void KOMonthView::resizeEvent(QResizeEvent * e)
1353{ 1358{
1354 //qDebug("KOMonthView::resizeEvent %d %d -- %d %d ", e->size().width(), e->size().height(), e->oldSize().width(), e->oldSize().height()); 1359 qDebug("KOMonthView::resizeEvent %d %d -- %d %d ", e->size().width(), e->size().height(), e->oldSize().width(), e->oldSize().height());
1360 if ( isVisible() ) {
1361 qDebug("KOMonthView::isVisible ");
1362 slotComputeLayout();
1363 } else
1364 mComputeLayoutTimer->start( 100 );
1365}
1366
1367void KOMonthView::slotComputeLayout()
1368{
1369 mComputeLayoutTimer->stop();
1370 qDebug("KOMonthView::Post - resizeEvent %d %d ", width(), height() );
1355 computeLayout(); 1371 computeLayout();
1356 clPending = true; 1372 clPending = true;
1357 if ( mShowWeekView ) 1373 if ( mShowWeekView )
1358 mCellsW[0]->setFocus(); 1374 mCellsW[0]->setFocus();
1359 else 1375 else
1360 mCells[0]->setFocus(); 1376 mCells[0]->setFocus();
1377
1361} 1378}
1362void KOMonthView::computeLayoutWeek() 1379void KOMonthView::computeLayoutWeek()
1363{ 1380{
1364 static int lastWid = 0; 1381 static int lastWid = 0;
1365 static int lastHei = 0; 1382 static int lastHei = 0;
1366 int daysToShow; 1383 int daysToShow;
1367 bool combinedSatSun = false; 1384 bool combinedSatSun = false;
1368 if (mShowSatSunComp = KOPrefs::instance()->mMonthViewSatSunTog ) { 1385 if (mShowSatSunComp = KOPrefs::instance()->mMonthViewSatSunTog ) {
1369 daysToShow = 6; 1386 daysToShow = 6;
1370 combinedSatSun = true; 1387 combinedSatSun = true;
1371 } 1388 }
1372 int tWid = topLevelWidget()->size().width(); 1389 int tWid = topLevelWidget()->size().width();
1373 int tHei = topLevelWidget()->size().height(); 1390 int tHei = topLevelWidget()->size().height();
1374 1391
1375 int wid = width();//e 1392 int wid = width();//e
1376 int hei = height()-1-mNavigatorBar->height(); 1393 int hei = height()-1-mNavigatorBar->height();
1377 1394
1378 if ( ((wid *3)/2) < tWid && (( hei *3) /2) < tHei ) 1395 if ( ((wid *3)/2) < tWid && (( hei *3) /2) < tHei )
1379 return; 1396 return;
1380 1397
1381 if ( lastWid == width() && lastHei == height() ) 1398 if ( lastWid == width() && lastHei == height() ) {
1399 qDebug("KOListWeekView::No compute layout needed ");
1382 return; 1400 return;
1401 }
1383 lastWid = width(); 1402 lastWid = width();
1384 lastHei = height(); 1403 lastHei = height();
1385 1404
1386 1405
1387 if ( wid < hei ) 1406 if ( wid < hei )
1388 daysToShow = 2; 1407 daysToShow = 2;
1389 else 1408 else
1390 daysToShow = 3; 1409 daysToShow = 3;
1391 mShowSatSunComp = true; 1410 mShowSatSunComp = true;
1392 combinedSatSun = true; 1411 combinedSatSun = true;
1393 1412
1394 //qDebug("KOMonthView::computeLayout() WWW ------------------------------------ "); 1413 //qDebug("KOMonthView::computeLayout() WWW ------------------------------------ ");
1395 QFontMetrics fm ( mWeekLabels[0]->font() ); 1414 QFontMetrics fm ( mWeekLabels[0]->font() );
1396 int weeklabelwid = fm.width( "888" ); 1415 int weeklabelwid = fm.width( "888" );
1397 wid -= weeklabelwid; 1416 wid -= weeklabelwid;
1398 1417
1399 int colWid = wid / daysToShow; 1418 int colWid = wid / daysToShow;
1400 int lastCol = wid - ( colWid*6 ); 1419 int lastCol = wid - ( colWid*6 );
1401 int dayLabelHei = mDayLabelsW[0]->sizeHint().height(); 1420 int dayLabelHei = mDayLabelsW[0]->sizeHint().height();
1402 int cellHei = (hei - (5- daysToShow )*dayLabelHei) /(5- daysToShow ); 1421 int cellHei = (hei - (5- daysToShow )*dayLabelHei) /(5- daysToShow );
1403 int colModulo = wid % daysToShow; 1422 int colModulo = wid % daysToShow;
1404 int rowModulo = (hei- (5- daysToShow )*dayLabelHei) % daysToShow-1; 1423 int rowModulo = (hei- (5- daysToShow )*dayLabelHei) % daysToShow-1;
1405 //qDebug("rowmod %d ", rowModulo); 1424 //qDebug("rowmod %d ", rowModulo);
1406 int i; 1425 int i;
1407 int x,y,w,h; 1426 int x,y,w,h;
1408 x= 0; 1427 x= 0;
1409 y= 0; 1428 y= 0;
1410 w = colWid; 1429 w = colWid;
1411 h = dayLabelHei ; 1430 h = dayLabelHei ;
1412 for ( i = 0; i < 7; i++) { 1431 for ( i = 0; i < 7; i++) {
1413 if ( i && !( i % daysToShow) && i < 6) { 1432 if ( i && !( i % daysToShow) && i < 6) {
1414 y += hei/(5-daysToShow); 1433 y += hei/(5-daysToShow);
1415 x = 0; 1434 x = 0;
1416 w = colWid; 1435 w = colWid;
1417 } 1436 }
1418 if ( ((i) % daysToShow) >= daysToShow-colModulo ) { 1437 if ( ((i) % daysToShow) >= daysToShow-colModulo ) {
1419 ++w; 1438 ++w;
1420 } 1439 }
1421 if ( i >= 5 ) { 1440 if ( i >= 5 ) {
1422 mDayLabelsW[i]->setGeometry( x+weeklabelwid,y,w/2+w%2,h); 1441 mDayLabelsW[i]->setGeometry( x+weeklabelwid,y,w/2+w%2,h);
1423 x -= (w/2 ); 1442 x -= (w/2 );
1424 } 1443 }
1425 else 1444 else
1426 mDayLabelsW[i]->setGeometry( x+weeklabelwid,y,w,h); 1445 mDayLabelsW[i]->setGeometry( x+weeklabelwid,y,w,h);
1427 x += w; 1446 x += w;
1428 } 1447 }
1429 x= 0; 1448 x= 0;
1430 y= dayLabelHei; 1449 y= dayLabelHei;
@@ -1460,102 +1479,103 @@ void KOMonthView::computeLayoutWeek()
1460 1479
1461 x += w; 1480 x += w;
1462 if ( x + w/2 > wid ) { 1481 if ( x + w/2 > wid ) {
1463 x = 0; 1482 x = 0;
1464 y += h+dayLabelHei ; 1483 y += h+dayLabelHei ;
1465 } 1484 }
1466 } 1485 }
1467 y= dayLabelHei; 1486 y= dayLabelHei;
1468 h = cellHei ; 1487 h = cellHei ;
1469 mWeekLabelsW[0]->setGeometry( 0,y,weeklabelwid,hei-dayLabelHei); 1488 mWeekLabelsW[0]->setGeometry( 0,y,weeklabelwid,hei-dayLabelHei);
1470 mWeekLabelsW[1]->setGeometry( 0,0,weeklabelwid,dayLabelHei); 1489 mWeekLabelsW[1]->setGeometry( 0,0,weeklabelwid,dayLabelHei);
1471 // qDebug("RRRRRRRRRRRRR %d %d old %d %d", e->size().width(),e->size().height() , e->oldSize().width(),e->oldSize().height()); 1490 // qDebug("RRRRRRRRRRRRR %d %d old %d %d", e->size().width(),e->size().height() , e->oldSize().width(),e->oldSize().height());
1472 //qDebug("parent %d %d ", topLevelWidget()->size().width(), topLevelWidget()->size().height()); 1491 //qDebug("parent %d %d ", topLevelWidget()->size().width(), topLevelWidget()->size().height());
1473 mShortDayLabelsW = mDayLabelsW[0]->width()-2 < mWidthLongDayLabel ; 1492 mShortDayLabelsW = mDayLabelsW[0]->width()-2 < mWidthLongDayLabel ;
1474 updateDayLabels(); 1493 updateDayLabels();
1475 //bool forceUpdate = !updatePossible; 1494 //bool forceUpdate = !updatePossible;
1476 updatePossible = true; 1495 updatePossible = true;
1477 //mWeekLabels[mNumWeeks]->setText( i18n("M")); 1496 //mWeekLabels[mNumWeeks]->setText( i18n("M"));
1478 //if ( forceUpdate ) 1497 //if ( forceUpdate )
1479 // updateView(); 1498 // updateView();
1480} 1499}
1481void KOMonthView::computeLayout() 1500void KOMonthView::computeLayout()
1482{ 1501{
1483 1502
1484 1503
1485 static int lastWid = 0; 1504 static int lastWid = 0;
1486 static int lastHei = 0; 1505 static int lastHei = 0;
1487 1506
1488 if ( mShowWeekView ){ 1507 if ( mShowWeekView ){
1489 computeLayoutWeek(); 1508 computeLayoutWeek();
1490 return; 1509 return;
1491 } 1510 }
1492 int daysToShow = 7; 1511 int daysToShow = 7;
1493 bool combinedSatSun = false; 1512 bool combinedSatSun = false;
1494 if (mShowSatSunComp = KOPrefs::instance()->mMonthViewSatSunTog ) { 1513 if (mShowSatSunComp = KOPrefs::instance()->mMonthViewSatSunTog ) {
1495 daysToShow = 6; 1514 daysToShow = 6;
1496 combinedSatSun = true; 1515 combinedSatSun = true;
1497 } 1516 }
1498 int tWid = topLevelWidget()->size().width(); 1517 int tWid = topLevelWidget()->size().width();
1499 int tHei = topLevelWidget()->size().height(); 1518 int tHei = topLevelWidget()->size().height();
1500 1519
1501 int wid = width();//e 1520 int wid = width();//e
1502 int hei = height()-1-mNavigatorBar->height(); 1521 int hei = height()-1-mNavigatorBar->height();
1503 1522
1504 if ( ((wid *3)/2) < tWid && (( hei *3) /2) < tHei ) { 1523 if ( ((wid *3)/2) < tWid && (( hei *3) /2) < tHei ) {
1505 return; 1524 return;
1506 } 1525 }
1507 if ( lastWid == width() && lastHei == height() ){ 1526 if ( lastWid == width() && lastHei == height() ){
1527 qDebug("KOMonthview::No compute layout needed ");
1508 return; 1528 return;
1509 } 1529 }
1510 1530
1511 lastWid = width(); 1531 lastWid = width();
1512 lastHei = height(); 1532 lastHei = height();
1513 //qDebug("KOMonthView::computeLayout() MMM ------------------------------------ "); 1533 qDebug("KOMonthView::computeLayout() MMM ------------------- ");
1514 QFontMetrics fm ( mWeekLabels[0]->font() ); 1534 QFontMetrics fm ( mWeekLabels[0]->font() );
1515 int weeklabelwid = fm.width( "888" ); 1535 int weeklabelwid = fm.width( "888" );
1516 wid -= weeklabelwid; 1536 wid -= weeklabelwid;
1517 1537
1518 int colWid = wid / daysToShow; 1538 int colWid = wid / daysToShow;
1519 int lastCol = wid - ( colWid*6 ); 1539 int lastCol = wid - ( colWid*6 );
1520 int dayLabelHei = mDayLabels[0]->sizeHint().height(); 1540 int dayLabelHei = mDayLabels[0]->sizeHint().height();
1521 int cellHei = (hei - dayLabelHei) /6; 1541 int cellHei = (hei - dayLabelHei) /6;
1522 int colModulo = wid % daysToShow; 1542 int colModulo = wid % daysToShow;
1523 int rowModulo = (hei- dayLabelHei) % 6; 1543 int rowModulo = (hei- dayLabelHei) % 6;
1524 //qDebug("rowmod %d ", rowModulo); 1544 //qDebug("rowmod %d ", rowModulo);
1525 int i; 1545 int i;
1526 int x,y,w,h; 1546 int x,y,w,h;
1527 x= 0; 1547 x= 0;
1528 y= 0; 1548 y= 0;
1529 w = colWid; 1549 w = colWid;
1530 h = dayLabelHei ; 1550 h = dayLabelHei ;
1531 for ( i = 0; i < 7; i++) { 1551 for ( i = 0; i < 7; i++) {
1532 if ( i == daysToShow-colModulo ) 1552 if ( i == daysToShow-colModulo )
1533 ++w; 1553 ++w;
1534 if ( combinedSatSun ) { 1554 if ( combinedSatSun ) {
1535 if ( i >= daysToShow-1 ) { 1555 if ( i >= daysToShow-1 ) {
1536 mDayLabels[i]->setGeometry( x+weeklabelwid,y,w/2,h); 1556 mDayLabels[i]->setGeometry( x+weeklabelwid,y,w/2,h);
1537 x -= w/2 ; 1557 x -= w/2 ;
1538 } 1558 }
1539 else 1559 else
1540 mDayLabels[i]->setGeometry( x+weeklabelwid,y,w,h); 1560 mDayLabels[i]->setGeometry( x+weeklabelwid,y,w,h);
1541 } else 1561 } else
1542 mDayLabels[i]->setGeometry( x+weeklabelwid,y,w,h); 1562 mDayLabels[i]->setGeometry( x+weeklabelwid,y,w,h);
1543 x += w; 1563 x += w;
1544 } 1564 }
1545 x= 0; 1565 x= 0;
1546 y= dayLabelHei; 1566 y= dayLabelHei;
1547 w = colWid; 1567 w = colWid;
1548 h = cellHei ; 1568 h = cellHei ;
1549 for ( i = 0; i < mCells.count(); ++i) { 1569 for ( i = 0; i < mCells.count(); ++i) {
1550 //qDebug("iii %d ", i); 1570 //qDebug("iii %d ", i);
1551 w = colWid; 1571 w = colWid;
1552 if ( ((i) % 7) >= 7-colModulo ) { 1572 if ( ((i) % 7) >= 7-colModulo ) {
1553 ++w; 1573 ++w;
1554 } 1574 }
1555 if ( i == (6-rowModulo)*7) 1575 if ( i == (6-rowModulo)*7)
1556 ++h; 1576 ++h;
1557 if ( combinedSatSun ) { 1577 if ( combinedSatSun ) {
1558 if ( (i)%7 >= daysToShow-1 ) { 1578 if ( (i)%7 >= daysToShow-1 ) {
1559 if ( (i)%7 == daysToShow-1 ) { 1579 if ( (i)%7 == daysToShow-1 ) {
1560 mCells[i]->setGeometry ( x+weeklabelwid,y,w,h/2 ); 1580 mCells[i]->setGeometry ( x+weeklabelwid,y,w,h/2 );
1561 x -= w ;y += h/2; 1581 x -= w ;y += h/2;
diff --git a/korganizer/komonthview.h b/korganizer/komonthview.h
index a92421b..89912e0 100644
--- a/korganizer/komonthview.h
+++ b/korganizer/komonthview.h
@@ -1,77 +1,78 @@
1/* 1/*
2 This file is part of KOrganizer. 2 This file is part of KOrganizer.
3 Copyright (c) 2000,2001 Cornelius Schumacher <schumacher@kde.org> 3 Copyright (c) 2000,2001 Cornelius Schumacher <schumacher@kde.org>
4 4
5 This program is free software; you can redistribute it and/or modify 5 This program is free software; you can redistribute it and/or modify
6 it under the terms of the GNU General Public License as published by 6 it under the terms of the GNU General Public License as published by
7 the Free Software Foundation; either version 2 of the License, or 7 the Free Software Foundation; either version 2 of the License, or
8 (at your option) any later version. 8 (at your option) any later version.
9 9
10 This program is distributed in the hope that it will be useful, 10 This program is distributed in the hope that it will be useful,
11 but WITHOUT ANY WARRANTY; without even the implied warranty of 11 but WITHOUT ANY WARRANTY; without even the implied warranty of
12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 GNU General Public License for more details. 13 GNU General Public License for more details.
14 14
15 You should have received a copy of the GNU General Public License 15 You should have received a copy of the GNU General Public License
16 along with this program; if not, write to the Free Software 16 along with this program; if not, write to the Free Software
17 Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. 17 Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
18*/ 18*/
19 19
20#ifndef _KOMONTHVIEW_H 20#ifndef _KOMONTHVIEW_H
21#define _KOMONTHVIEW_H 21#define _KOMONTHVIEW_H
22 22
23#include <qlabel.h> 23#include <qlabel.h>
24#include <qframe.h> 24#include <qframe.h>
25#include <qdatetime.h> 25#include <qdatetime.h>
26#include <qlistbox.h> 26#include <qlistbox.h>
27#include <qpoint.h> 27#include <qpoint.h>
28#include <qwidgetstack.h> 28#include <qwidgetstack.h>
29#include <qlayout.h> 29#include <qlayout.h>
30#include <qtimer.h>
30#include <qintdict.h> 31#include <qintdict.h>
31#include <qpushbutton.h> 32#include <qpushbutton.h>
32#include <qvaluelist.h> 33#include <qvaluelist.h>
33#include <qptrvector.h> 34#include <qptrvector.h>
34 35
35#include <libkcal/calendar.h> 36#include <libkcal/calendar.h>
36#include <libkcal/event.h> 37#include <libkcal/event.h>
37 38
38#include "koeventview.h" 39#include "koeventview.h"
39#include "navigatorbar.h" 40#include "navigatorbar.h"
40 41
41#ifdef DESKTOP_VERSION 42#ifdef DESKTOP_VERSION
42class QToolTipGroup; 43class QToolTipGroup;
43#endif 44#endif
44 45
45class KNOWhatsThis; 46class KNOWhatsThis;
46class KOWeekButton : public QPushButton 47class KOWeekButton : public QPushButton
47{ 48{
48 Q_OBJECT 49 Q_OBJECT
49 public: 50 public:
50 KOWeekButton( QWidget *parent=0, const char *name=0 ) : 51 KOWeekButton( QWidget *parent=0, const char *name=0 ) :
51 QPushButton( parent, name) 52 QPushButton( parent, name)
52 { 53 {
53 connect( this, SIGNAL( clicked() ), 54 connect( this, SIGNAL( clicked() ),
54 SLOT( bottonClicked() )); 55 SLOT( bottonClicked() ));
55 mNumber = -1; 56 mNumber = -1;
56 } 57 }
57 void setWeekNum ( int num ) {mNumber = num; setText( QString::number ( num ));} 58 void setWeekNum ( int num ) {mNumber = num; setText( QString::number ( num ));}
58 int getWeekNum() { return mNumber;} 59 int getWeekNum() { return mNumber;}
59 signals: 60 signals:
60 void selectWeekNum ( int ); 61 void selectWeekNum ( int );
61private: 62private:
62 int mNumber; 63 int mNumber;
63private slots : 64private slots :
64 void bottonClicked() { if ( mNumber > 0 ) emit selectWeekNum ( mNumber ); } 65 void bottonClicked() { if ( mNumber > 0 ) emit selectWeekNum ( mNumber ); }
65}; 66};
66 67
67class KNoScrollListBox: public QListBox 68class KNoScrollListBox: public QListBox
68{ 69{
69 Q_OBJECT 70 Q_OBJECT
70 public: 71 public:
71 KNoScrollListBox(QWidget *parent=0, const char *name=0); 72 KNoScrollListBox(QWidget *parent=0, const char *name=0);
72 ~KNoScrollListBox(); 73 ~KNoScrollListBox();
73 QString getWhatsThisText(QPoint p) ; 74 QString getWhatsThisText(QPoint p) ;
74 75
75 signals: 76 signals:
76 void shiftDown(); 77 void shiftDown();
77 void shiftUp(); 78 void shiftUp();
@@ -206,99 +207,101 @@ public slots:
206 void keyPressEvent ( QKeyEvent * ) ; 207 void keyPressEvent ( QKeyEvent * ) ;
207 208
208}; 209};
209 210
210 211
211class KOMonthView: public KOEventView 212class KOMonthView: public KOEventView
212{ 213{
213 Q_OBJECT 214 Q_OBJECT
214 public: 215 public:
215 KOMonthView(Calendar *cal, QWidget *parent = 0, const char *name = 0 ); 216 KOMonthView(Calendar *cal, QWidget *parent = 0, const char *name = 0 );
216 ~KOMonthView(); 217 ~KOMonthView();
217 218
218 /** Returns maximum number of days supported by the komonthview */ 219 /** Returns maximum number of days supported by the komonthview */
219 virtual int maxDatesHint(); 220 virtual int maxDatesHint();
220 221
221 /** Returns number of currently shown dates. */ 222 /** Returns number of currently shown dates. */
222 virtual int currentDateCount(); 223 virtual int currentDateCount();
223 224
224 /** returns the currently selected events */ 225 /** returns the currently selected events */
225 virtual QPtrList<Incidence> selectedIncidences(); 226 virtual QPtrList<Incidence> selectedIncidences();
226 227
227 /** returns dates of the currently selected events */ 228 /** returns dates of the currently selected events */
228 virtual DateList selectedDates(); 229 virtual DateList selectedDates();
229 230
230 virtual void printPreview(CalPrinter *calPrinter, 231 virtual void printPreview(CalPrinter *calPrinter,
231 const QDate &, const QDate &); 232 const QDate &, const QDate &);
232 bool isMonthView() { return !mShowWeekView; } 233 bool isMonthView() { return !mShowWeekView; }
233 bool isUpdatePossible() { return updatePossible; } 234 bool isUpdatePossible() { return updatePossible; }
234 235
235 MonthViewCell * selectedCell(); 236 MonthViewCell * selectedCell();
236 bool skipResize; 237 bool skipResize;
237 NavigatorBar* navigatorBar() { return mNavigatorBar ;} 238 NavigatorBar* navigatorBar() { return mNavigatorBar ;}
238 public slots: 239 public slots:
239 virtual void updateView(); 240 virtual void updateView();
240 virtual void updateConfig(); 241 virtual void updateConfig();
241 virtual void showDates(const QDate &start, const QDate &end); 242 virtual void showDates(const QDate &start, const QDate &end);
242 virtual void showEvents(QPtrList<Event> eventList); 243 virtual void showEvents(QPtrList<Event> eventList);
243 244
244 void changeEventDisplay(Event *, int); 245 void changeEventDisplay(Event *, int);
245 246
246 void clearSelection(); 247 void clearSelection();
247 248
248 void showContextMenu( Incidence * ); 249 void showContextMenu( Incidence * );
249 250
250 void setSelectedCell( MonthViewCell * ); 251 void setSelectedCell( MonthViewCell * );
251 void switchView(); 252 void switchView();
252 253
253 protected slots: 254 protected slots:
255 void slotComputeLayout();
254 void selectInternalWeekNum ( int ); 256 void selectInternalWeekNum ( int );
255 void processSelectionChange(); 257 void processSelectionChange();
256 signals: 258 signals:
257 void nextMonth(); 259 void nextMonth();
258 void prevMonth(); 260 void prevMonth();
259 void selectWeekNum ( int ); 261 void selectWeekNum ( int );
260 void selectMonth (); 262 void selectMonth ();
261 void showDaySignal( QDate ); 263 void showDaySignal( QDate );
262 protected: 264 protected:
263 void resizeEvent(QResizeEvent *); 265 void resizeEvent(QResizeEvent *);
264 void viewChanged(); 266 void viewChanged();
265 void updateDayLabels(); 267 void updateDayLabels();
266 268
267 private: 269 private:
270 QTimer* mComputeLayoutTimer;
268 NavigatorBar* mNavigatorBar; 271 NavigatorBar* mNavigatorBar;
269 int currentWeek(); 272 int currentWeek();
270 bool clPending; 273 bool clPending;
271 QWidgetStack * mWidStack; 274 QWidgetStack * mWidStack;
272 QWidget* mMonthView; 275 QWidget* mMonthView;
273 QWidget* mWeekView; 276 QWidget* mWeekView;
274 bool mShowWeekView; 277 bool mShowWeekView;
275 bool updatePossible; 278 bool updatePossible;
276 int mDaysPerWeek; 279 int mDaysPerWeek;
277 int mNumWeeks; 280 int mNumWeeks;
278 int mNumCells; 281 int mNumCells;
279 bool mWeekStartsMonday; 282 bool mWeekStartsMonday;
280 bool mShowSatSunComp; 283 bool mShowSatSunComp;
281 void computeLayout(); 284 void computeLayout();
282 void computeLayoutWeek(); 285 void computeLayoutWeek();
283 286
284 QPtrVector<MonthViewCell> mCells; 287 QPtrVector<MonthViewCell> mCells;
285 QPtrVector<QLabel> mDayLabels; 288 QPtrVector<QLabel> mDayLabels;
286 QPtrVector<KOWeekButton> mWeekLabels; 289 QPtrVector<KOWeekButton> mWeekLabels;
287 QPtrVector<MonthViewCell> mCellsW; 290 QPtrVector<MonthViewCell> mCellsW;
288 QPtrVector<QLabel> mDayLabelsW; 291 QPtrVector<QLabel> mDayLabelsW;
289 QPtrVector<KOWeekButton> mWeekLabelsW; 292 QPtrVector<KOWeekButton> mWeekLabelsW;
290 293
291 bool mShortDayLabelsM; 294 bool mShortDayLabelsM;
292 bool mShortDayLabelsW; 295 bool mShortDayLabelsW;
293 int mWidthLongDayLabel; 296 int mWidthLongDayLabel;
294 297
295 QDate mStartDate; 298 QDate mStartDate;
296 299
297 MonthViewCell *mSelectedCell; 300 MonthViewCell *mSelectedCell;
298 301
299 KOEventPopupMenu *mContextMenu; 302 KOEventPopupMenu *mContextMenu;
300 void keyPressEvent ( QKeyEvent * ) ; 303 void keyPressEvent ( QKeyEvent * ) ;
301 304
302}; 305};
303 306
304#endif 307#endif
diff --git a/korganizer/koviewmanager.cpp b/korganizer/koviewmanager.cpp
index cc0ce9b..94d74f1 100644
--- a/korganizer/koviewmanager.cpp
+++ b/korganizer/koviewmanager.cpp
@@ -196,96 +196,97 @@ void KOViewManager::writeSettings(KConfig *config)
196 if (mTodoView) { 196 if (mTodoView) {
197 mTodoView->saveLayout(config,"Todo View"); 197 mTodoView->saveLayout(config,"Todo View");
198 } 198 }
199} 199}
200 200
201void KOViewManager::showView(KOrg::BaseView *view, bool fullScreen ) 201void KOViewManager::showView(KOrg::BaseView *view, bool fullScreen )
202{ 202{
203 203
204 //mFlagShowNextxDays = false; 204 //mFlagShowNextxDays = false;
205 //if(view == mCurrentView) return; 205 //if(view == mCurrentView) return;
206 if ( view == 0 ) { 206 if ( view == 0 ) {
207 view = mCurrentView; 207 view = mCurrentView;
208 if ( view == 0 ) 208 if ( view == 0 )
209 return; 209 return;
210 } 210 }
211 bool full = fullScreen; 211 bool full = fullScreen;
212 if(view == mCurrentView && view != mWhatsNextView ) { 212 if(view == mCurrentView && view != mWhatsNextView ) {
213 if ( mCurrentAgendaView < 0 ) 213 if ( mCurrentAgendaView < 0 )
214 return; 214 return;
215 if ( view != mMonthView ) 215 if ( view != mMonthView )
216 full = mMainView->leftFrame()->isVisible(); 216 full = mMainView->leftFrame()->isVisible();
217 } else { 217 } else {
218 if ( view == mMonthView && mMonthView) 218 if ( view == mMonthView && mMonthView)
219 ;//mMonthView->skipResize = true ; 219 ;//mMonthView->skipResize = true ;
220 mCurrentView = view; 220 mCurrentView = view;
221 // bool full = fullScreen; 221 // bool full = fullScreen;
222 bool isFull = !mMainView->leftFrame()->isVisible(); 222 bool isFull = !mMainView->leftFrame()->isVisible();
223 if ( isFull && KOPrefs::instance()->mViewChangeHoldFullscreen ) 223 if ( isFull && KOPrefs::instance()->mViewChangeHoldFullscreen )
224 full = true; 224 full = true;
225 if ( !isFull && KOPrefs::instance()->mViewChangeHoldNonFullscreen ) 225 if ( !isFull && KOPrefs::instance()->mViewChangeHoldNonFullscreen )
226 full = false; 226 full = false;
227 } 227 }
228 if ( mAgendaView ) mAgendaView->deleteSelectedDateTime(); 228 if ( mAgendaView ) mAgendaView->deleteSelectedDateTime();
229 //raiseCurrentView( full ); 229 //raiseCurrentView( full );
230 mMainView->processIncidenceSelection( 0 ); 230 mMainView->processIncidenceSelection( 0 );
231 //mMainView->updateView(); 231 //mMainView->updateView();
232 raiseCurrentView( full, true ); 232 raiseCurrentView( full, true );
233 mMainView->adaptNavigationUnits(); 233 mMainView->adaptNavigationUnits();
234} 234}
235 235
236void KOViewManager::raiseCurrentView( bool fullScreen, bool callUpdateView ) 236void KOViewManager::raiseCurrentView( bool fullScreen, bool callUpdateView )
237{ 237{
238 mCurrentAgendaView = 0; 238 mCurrentAgendaView = 0;
239 if ( fullScreen ) { 239 if ( fullScreen ) {
240 mMainView->leftFrame()->hide(); 240 mMainView->leftFrame()->hide();
241 } else { 241 } else {
242 mMainView->leftFrame()->show(); 242 mMainView->leftFrame()->show();
243 } 243 }
244 //if ( mCurrentView == mMonthView ) qApp->processEvents();
244 emit signalFullScreen( !fullScreen ); 245 emit signalFullScreen( !fullScreen );
245 if ( callUpdateView ) 246 if ( callUpdateView )
246 mMainView->updateView(); 247 mMainView->updateView();
247 248
248 if ( globalFlagBlockAgenda == 5 ) { 249 if ( globalFlagBlockAgenda == 5 ) {
249 globalFlagBlockAgenda = 4; 250 globalFlagBlockAgenda = 4;
250 globalFlagBlockAgendaItemPaint = 1; 251 globalFlagBlockAgendaItemPaint = 1;
251 } 252 }
252 mMainView->viewStack()->raiseWidget(mCurrentView); 253 mMainView->viewStack()->raiseWidget(mCurrentView);
253 if ( globalFlagBlockAgenda == 4 ) { 254 if ( globalFlagBlockAgenda == 4 ) {
254 if ( mCurrentView == mAgendaView ) { 255 if ( mCurrentView == mAgendaView ) {
255 //globalFlagBlockAgenda =1 ; 256 //globalFlagBlockAgenda =1 ;
256 if ( KOPrefs::instance()->mSetTimeToDayStartAt ) 257 if ( KOPrefs::instance()->mSetTimeToDayStartAt )
257 mAgendaView->setStartHour( KOPrefs::instance()->mDayBegins ); 258 mAgendaView->setStartHour( KOPrefs::instance()->mDayBegins );
258 else if ( KOPrefs::instance()->mCenterOnCurrentTime ) 259 else if ( KOPrefs::instance()->mCenterOnCurrentTime )
259 mAgendaView->setStartHour( QTime::currentTime ().hour() ); 260 mAgendaView->setStartHour( QTime::currentTime ().hour() );
260 qApp->processEvents(); 261 qApp->processEvents();
261 //qDebug("qApp->processEvents() "); 262 //qDebug("qApp->processEvents() ");
262 globalFlagBlockAgenda = 0; 263 globalFlagBlockAgenda = 0;
263 mAgendaView->repaintAgenda(); 264 mAgendaView->repaintAgenda();
264 265
265 } 266 }
266 globalFlagBlockAgenda = 0; 267 globalFlagBlockAgenda = 0;
267 } 268 }
268 emit signalAgendaView( mCurrentView == mAgendaView ); 269 emit signalAgendaView( mCurrentView == mAgendaView );
269 //qDebug("raiseCurrentView ende "); 270 //qDebug("raiseCurrentView ende ");
270 271
271} 272}
272 273
273void KOViewManager::updateView() 274void KOViewManager::updateView()
274{ 275{
275 // qDebug("KOViewManager::updateView() "); 276 // qDebug("KOViewManager::updateView() ");
276 // if we are updating mTodoView, we get endless recursion 277 // if we are updating mTodoView, we get endless recursion
277 if ( mTodoView == mCurrentView ) 278 if ( mTodoView == mCurrentView )
278 return; 279 return;
279 if ( mCurrentView ) mCurrentView->updateView(); 280 if ( mCurrentView ) mCurrentView->updateView();
280 281
281} 282}
282 283
283void KOViewManager::updateView(const QDate &start, const QDate &end) 284void KOViewManager::updateView(const QDate &start, const QDate &end)
284{ 285{
285 // kdDebug() << "KOViewManager::updateView()" << endl; 286 // kdDebug() << "KOViewManager::updateView()" << endl;
286 287
287 if (mCurrentView) mCurrentView->showDates(start, end); 288 if (mCurrentView) mCurrentView->showDates(start, end);
288 289
289 if (mTodoView && mTodoView == mCurrentView ) mTodoView->updateView(); 290 if (mTodoView && mTodoView == mCurrentView ) mTodoView->updateView();
290} 291}
291 292