summaryrefslogtreecommitdiffabout
Unidiff
Diffstat (more/less context) (ignore whitespace changes)
-rw-r--r--korganizer/komonthview.cpp55
-rw-r--r--korganizer/komonthview.h8
-rw-r--r--korganizer/koviewmanager.cpp2
3 files changed, 48 insertions, 17 deletions
diff --git a/korganizer/komonthview.cpp b/korganizer/komonthview.cpp
index 940d288..ca35a86 100644
--- a/korganizer/komonthview.cpp
+++ b/korganizer/komonthview.cpp
@@ -80,49 +80,49 @@ KNoScrollListBox::KNoScrollListBox(QWidget *parent,const char *name)
80 : QListBox(parent, name, WRepaintNoErase) 80 : QListBox(parent, name, WRepaintNoErase)
81{ 81{
82#ifndef DESKTOP_VERSION 82#ifndef DESKTOP_VERSION
83 QPEApplication::setStylusOperation( viewport(), QPEApplication::RightOnHold ); 83 QPEApplication::setStylusOperation( viewport(), QPEApplication::RightOnHold );
84#endif 84#endif
85 mWT = new KNOWhatsThis(this); 85 mWT = new KNOWhatsThis(this);
86} 86}
87KNoScrollListBox::~KNoScrollListBox() 87KNoScrollListBox::~KNoScrollListBox()
88{ 88{
89 89
90} 90}
91QString KNoScrollListBox::getWhatsThisText(QPoint p) 91QString KNoScrollListBox::getWhatsThisText(QPoint p)
92{ 92{
93 QListBoxItem* item = itemAt ( p ); 93 QListBoxItem* item = itemAt ( p );
94 if ( ! item ) { 94 if ( ! item ) {
95 return i18n("Click in the cell\nto add an event!"); 95 return i18n("Click in the cell\nto add an event!");
96 } 96 }
97 return KIncidenceFormatter::instance()->getFormattedText(((MonthViewItem*) item)->incidence(), 97 return KIncidenceFormatter::instance()->getFormattedText(((MonthViewItem*) item)->incidence(),
98 KOPrefs::instance()->mWTshowDetails, 98 KOPrefs::instance()->mWTshowDetails,
99 KOPrefs::instance()->mWTshowCreated, 99 KOPrefs::instance()->mWTshowCreated,
100 KOPrefs::instance()->mWTshowChanged); 100 KOPrefs::instance()->mWTshowChanged);
101} 101}
102void KNoScrollListBox::keyPressEvent(QKeyEvent *e) 102void KNoScrollListBox::keyPressEvent(QKeyEvent *e)
103{ 103{
104 104 //qDebug("KNoScrollListBox::keyPressEvent ");
105 switch(e->key()) { 105 switch(e->key()) {
106 case Key_Right: 106 case Key_Right:
107 if ( e->state() == Qt::ControlButton|| e->state() == Qt::ShiftButton ) 107 if ( e->state() == Qt::ControlButton|| e->state() == Qt::ShiftButton )
108 { 108 {
109 e->ignore(); 109 e->ignore();
110 return; 110 return;
111 } 111 }
112 scrollBy(10,0); 112 scrollBy(10,0);
113 break; 113 break;
114 case Key_Left: 114 case Key_Left:
115 if (e->state() == Qt::ControlButton|| e->state() == Qt::ShiftButton ) 115 if (e->state() == Qt::ControlButton|| e->state() == Qt::ShiftButton )
116 { 116 {
117 e->ignore(); 117 e->ignore();
118 return; 118 return;
119 } 119 }
120 scrollBy(-10,0); 120 scrollBy(-10,0);
121 break; 121 break;
122 case Key_Up: 122 case Key_Up:
123 if( e->state() == Qt::ControlButton|| e->state() == Qt::ShiftButton) { 123 if( e->state() == Qt::ControlButton|| e->state() == Qt::ShiftButton) {
124 e->ignore(); 124 e->ignore();
125 break; 125 break;
126 } 126 }
127 if ( count() ) { 127 if ( count() ) {
128 setCurrentItem((currentItem()+count()-1)%count()); 128 setCurrentItem((currentItem()+count()-1)%count());
@@ -133,48 +133,59 @@ void KNoScrollListBox::keyPressEvent(QKeyEvent *e)
133 setTopItem(topItem()-1); 133 setTopItem(topItem()-1);
134 } 134 }
135 } 135 }
136 } 136 }
137 break; 137 break;
138 case Key_Down: 138 case Key_Down:
139 if(e->state() == Qt::ControlButton|| e->state() == Qt::ShiftButton) { 139 if(e->state() == Qt::ControlButton|| e->state() == Qt::ShiftButton) {
140 e->ignore(); 140 e->ignore();
141 break; 141 break;
142 } 142 }
143 if ( count () ) { 143 if ( count () ) {
144 setCurrentItem((currentItem()+1)%count()); 144 setCurrentItem((currentItem()+1)%count());
145 if(!itemVisible(currentItem())) { 145 if(!itemVisible(currentItem())) {
146 if(currentItem() == 0) { 146 if(currentItem() == 0) {
147 setTopItem(0); 147 setTopItem(0);
148 } else { 148 } else {
149 setTopItem(topItem()+1); 149 setTopItem(topItem()+1);
150 } 150 }
151 } 151 }
152 } 152 }
153 break; 153 break;
154 case Key_I: 154 case Key_I:
155 QTimer::singleShot( 11, this, SLOT ( oneDown() ) ); 155 QTimer::singleShot( 11, this, SLOT ( oneDown() ) );
156 e->ignore(); 156 e->ignore();
157 break;
158 case Key_Return:
159 case Key_Enter:
160 {
161 if ( currentItem() >= 0 ) {
162 emit doubleClicked( item( currentItem() ) );
163 e->accept();
164 } else {
165 e->ignore();
166 }
167 }
157 break; 168 break;
158 case Key_Shift: 169 case Key_Shift:
159 emit shiftDown(); 170 emit shiftDown();
160 break; 171 break;
161 default: 172 default:
162 e->ignore(); 173 e->ignore();
163 break; 174 break;
164 } 175 }
165} 176}
166 177
167void KNoScrollListBox::oneDown() 178void KNoScrollListBox::oneDown()
168{ 179{
169 if ( count () ) { 180 if ( count () ) {
170 setCurrentItem((currentItem()+1)%count()); 181 setCurrentItem((currentItem()+1)%count());
171 if(!itemVisible(currentItem())) { 182 if(!itemVisible(currentItem())) {
172 if(currentItem() == 0) { 183 if(currentItem() == 0) {
173 setTopItem(0); 184 setTopItem(0);
174 } else { 185 } else {
175 setTopItem(topItem()+1); 186 setTopItem(topItem()+1);
176 } 187 }
177 } 188 }
178 } 189 }
179} 190}
180void KNoScrollListBox::keyReleaseEvent(QKeyEvent *e) 191void KNoScrollListBox::keyReleaseEvent(QKeyEvent *e)
@@ -292,50 +303,50 @@ void MonthViewItem::paint(QPainter *p)
292 if ( mMultiday == 1 ) { 303 if ( mMultiday == 1 ) {
293 // p->fillRect ( x, yyy-sizeM/2+1, sizeM/2, size, QBrush ( QBrush::SolidPattern ) ); 304 // p->fillRect ( x, yyy-sizeM/2+1, sizeM/2, size, QBrush ( QBrush::SolidPattern ) );
294 305
295 p->drawLine ( x+1, yyy-sizeM/2, x+1, yyy+sizeM/2 ); 306 p->drawLine ( x+1, yyy-sizeM/2, x+1, yyy+sizeM/2 );
296 } 307 }
297 if ( mMultiday == 3 ) { 308 if ( mMultiday == 3 ) {
298 // p->fillRect ( x+sizeM, yyy-sizeM/2+1, sizeM/2, size, QBrush ( QBrush::SolidPattern ) ); 309 // p->fillRect ( x+sizeM, yyy-sizeM/2+1, sizeM/2, size, QBrush ( QBrush::SolidPattern ) );
299 p->drawLine ( x+sizeM +sizeM/2-1, yyy-sizeM/2, x+sizeM +sizeM/2-1, yyy+sizeM/2 ); 310 p->drawLine ( x+sizeM +sizeM/2-1, yyy-sizeM/2, x+sizeM +sizeM/2-1, yyy+sizeM/2 );
300 311
301 } 312 }
302 x += sizeM/2 + 1; 313 x += sizeM/2 + 1;
303 x += sizeM + 1; 314 x += sizeM + 1;
304 } 315 }
305 316
306 if ( mIncidence->type() == "Todo" ){ 317 if ( mIncidence->type() == "Todo" ){
307 Todo* td = ( Todo* ) mIncidence; 318 Todo* td = ( Todo* ) mIncidence;
308 if ( td->isCompleted() ) { 319 if ( td->isCompleted() ) {
309 int half = size/2; 320 int half = size/2;
310 p->drawLine ( x, heihei/2, x +half , heihei/2 +half ) ; 321 p->drawLine ( x, heihei/2, x +half , heihei/2 +half ) ;
311 p->drawLine ( x +half , heihei/2 +half , x +half+half +2 , heihei/2 -2 ) ; 322 p->drawLine ( x +half , heihei/2 +half , x +half+half +2 , heihei/2 -2 ) ;
312 x += half+half + 4; 323 x += half+half + 4;
313 324
314 } else { 325 } else {
315 int val = td->percentComplete()/20; 326 int val = td->percentComplete()/20;
316 p->fillRect ( x+1, y-1, val ,size+2,Qt::black ); 327 p->fillRect ( x+1, y-2, val ,size+4,Qt::black );
317 p->drawRect ( x, y-1,7,size+2); 328 p->drawRect ( x, y-2,7,size+4);
318 x += size + 3; 329 x += size + 3;
319 } 330 }
320 } 331 }
321 QFontMetrics fm = p->fontMetrics(); 332 QFontMetrics fm = p->fontMetrics();
322 int yPos; 333 int yPos;
323 int pmheight = size; 334 int pmheight = size;
324 if( pmheight < fm.height() ) 335 if( pmheight < fm.height() )
325 yPos = fm.ascent() + fm.leading()/2; 336 yPos = fm.ascent() + fm.leading()/2;
326 else 337 else
327 yPos = pmheight/2 - fm.height()/2 + fm.ascent(); 338 yPos = pmheight/2 - fm.height()/2 + fm.ascent();
328 p->setPen( palette().color( QPalette::Normal, sel ? \ 339 p->setPen( palette().color( QPalette::Normal, sel ? \
329 QColorGroup::HighlightedText : QColorGroup::Foreground ) ); 340 QColorGroup::HighlightedText : QColorGroup::Foreground ) );
330 p->drawText( x, yPos, text() ); 341 p->drawText( x, yPos, text() );
331 if ( mIncidence->cancelled() ) { 342 if ( mIncidence->cancelled() ) {
332 int wid = fm.width( text() ); 343 int wid = fm.width( text() );
333 p->drawLine( x, heihei/2-1 ,x+wid, heihei/2-1 ); 344 p->drawLine( x, heihei/2-1 ,x+wid, heihei/2-1 );
334 } 345 }
335 346
336} 347}
337 348
338int MonthViewItem::height(const QListBox *lb) const 349int MonthViewItem::height(const QListBox *lb) const
339{ 350{
340 int ret = 10; 351 int ret = 10;
341 if ( lb ) 352 if ( lb )
@@ -1031,63 +1042,65 @@ KOMonthView::KOMonthView(Calendar *calendar, QWidget *parent, const char *name)
1031 label = new QLabel( mWeekView ); 1042 label = new QLabel( mWeekView );
1032 label->setFont(bfont); 1043 label->setFont(bfont);
1033 label->setFrameStyle(QFrame::Panel|QFrame::Raised); 1044 label->setFrameStyle(QFrame::Panel|QFrame::Raised);
1034 label->setLineWidth(1); 1045 label->setLineWidth(1);
1035 label->setAlignment(AlignCenter); 1046 label->setAlignment(AlignCenter);
1036 mDayLabelsW.insert( i, label ); 1047 mDayLabelsW.insert( i, label );
1037 } 1048 }
1038 1049
1039 bfont.setBold( false ); 1050 bfont.setBold( false );
1040 mWeekLabels.resize( mNumWeeks+1 ); 1051 mWeekLabels.resize( mNumWeeks+1 );
1041 mWeekLabelsW.resize( 2 ); 1052 mWeekLabelsW.resize( 2 );
1042 for( i = 0; i < mNumWeeks+1; i++ ) { 1053 for( i = 0; i < mNumWeeks+1; i++ ) {
1043 KOWeekButton *label = new KOWeekButton( mMonthView ); 1054 KOWeekButton *label = new KOWeekButton( mMonthView );
1044 label->setFocusPolicy(NoFocus); 1055 label->setFocusPolicy(NoFocus);
1045 label->setFont(bfont); 1056 label->setFont(bfont);
1046 connect( label, SIGNAL( selectWeekNum ( int )),this, SLOT( selectInternalWeekNum ( int )) ); 1057 connect( label, SIGNAL( selectWeekNum ( int )),this, SLOT( selectInternalWeekNum ( int )) );
1047 label->setFlat(true); 1058 label->setFlat(true);
1048 QWhatsThis::add(label,i18n("Click on the week number to\nshow week zoomed")); 1059 QWhatsThis::add(label,i18n("Click on the week number to\nshow week zoomed"));
1049 //label->setFrameStyle(QFrame::Panel|QFrame::Raised); 1060 //label->setFrameStyle(QFrame::Panel|QFrame::Raised);
1050 //label->setLineWidth(1); 1061 //label->setLineWidth(1);
1051 //label->setAlignment(AlignCenter); 1062 //label->setAlignment(AlignCenter);
1052 mWeekLabels.insert( i, label ); 1063 mWeekLabels.insert( i, label );
1053 } 1064 }
1054 mWeekLabels[mNumWeeks]->setText( i18n("W")); 1065 mWeekLabels[mNumWeeks]->setText( i18n("W"));
1066 mWeekLabels[0]->setFocusPolicy(WheelFocus);
1055 QWhatsThis::add(mWeekLabels[mNumWeeks],i18n("Click on this to\nselect week number")); 1067 QWhatsThis::add(mWeekLabels[mNumWeeks],i18n("Click on this to\nselect week number"));
1056 1068
1057 for( i = 0; i < 1+1; i++ ) { 1069 for( i = 0; i < 1+1; i++ ) {
1058 KOWeekButton *label = new KOWeekButton( mWeekView ); 1070 KOWeekButton *label = new KOWeekButton( mWeekView );
1059 label->setFocusPolicy(NoFocus); 1071 label->setFocusPolicy(NoFocus);
1060 label->setFont(bfont); 1072 label->setFont(bfont);
1061 connect( label, SIGNAL( selectWeekNum ( int )),this, SLOT( selectInternalWeekNum ( int )) ); 1073 connect( label, SIGNAL( selectWeekNum ( int )),this, SLOT( selectInternalWeekNum ( int )) );
1062 label->setFlat(true); 1074 label->setFlat(true);
1063 QWhatsThis::add(label,i18n("Click on the week number to\nshow week zoomed")); 1075 QWhatsThis::add(label,i18n("Click on the week number to\nshow week zoomed"));
1064 //label->setFrameStyle(QFrame::Panel|QFrame::Raised); 1076 //label->setFrameStyle(QFrame::Panel|QFrame::Raised);
1065 //label->setLineWidth(1); 1077 //label->setLineWidth(1);
1066 //label->setAlignment(AlignCenter); 1078 //label->setAlignment(AlignCenter);
1067 mWeekLabelsW.insert( i, label ); 1079 mWeekLabelsW.insert( i, label );
1068 } 1080 }
1069 mWeekLabelsW[1]->setText( i18n("W")); 1081 mWeekLabelsW[1]->setText( i18n("W"));
1082 mWeekLabelsW[0]->setFocusPolicy(WheelFocus);
1070 1083
1071 1084
1072 int row, col; 1085 int row, col;
1073 mCells.resize( mNumCells ); 1086 mCells.resize( mNumCells );
1074 for( row = 0; row < mNumWeeks; ++row ) { 1087 for( row = 0; row < mNumWeeks; ++row ) {
1075 for( col = 0; col < mDaysPerWeek; ++col ) { 1088 for( col = 0; col < mDaysPerWeek; ++col ) {
1076 MonthViewCell *cell = new MonthViewCell( this, mMonthView ); 1089 MonthViewCell *cell = new MonthViewCell( this, mMonthView );
1077 mCells.insert( row * mDaysPerWeek + col, cell ); 1090 mCells.insert( row * mDaysPerWeek + col, cell );
1078 1091
1079 connect( cell, SIGNAL( defaultAction( Incidence * ) ), 1092 connect( cell, SIGNAL( defaultAction( Incidence * ) ),
1080 SLOT( defaultAction( Incidence * ) ) ); 1093 SLOT( defaultAction( Incidence * ) ) );
1081 connect( cell, SIGNAL( newEventSignal( QDateTime ) ), 1094 connect( cell, SIGNAL( newEventSignal( QDateTime ) ),
1082 SIGNAL( newEventSignal( QDateTime ) ) ); 1095 SIGNAL( newEventSignal( QDateTime ) ) );
1083 connect( cell, SIGNAL( showDaySignal( QDate ) ), 1096 connect( cell, SIGNAL( showDaySignal( QDate ) ),
1084 SIGNAL( showDaySignal( QDate ) ) ); 1097 SIGNAL( showDaySignal( QDate ) ) );
1085 } 1098 }
1086 } 1099 }
1087 mCellsW.resize( mDaysPerWeek ); 1100 mCellsW.resize( mDaysPerWeek );
1088 for( col = 0; col < mDaysPerWeek; ++col ) { 1101 for( col = 0; col < mDaysPerWeek; ++col ) {
1089 MonthViewCell *cell = new MonthViewCell( this, mWeekView ); 1102 MonthViewCell *cell = new MonthViewCell( this, mWeekView );
1090 mCellsW.insert( col, cell ); 1103 mCellsW.insert( col, cell );
1091 1104
1092 connect( cell, SIGNAL( defaultAction( Incidence * ) ), 1105 connect( cell, SIGNAL( defaultAction( Incidence * ) ),
1093 SLOT( defaultAction( Incidence * ) ) ); 1106 SLOT( defaultAction( Incidence * ) ) );
@@ -1445,89 +1458,103 @@ void KOMonthView::updateView()
1445 } 1458 }
1446 } 1459 }
1447 } 1460 }
1448 // insert due todos 1461 // insert due todos
1449 QPtrList<Todo> todos = calendar()->todos( ); 1462 QPtrList<Todo> todos = calendar()->todos( );
1450 Todo *todo; 1463 Todo *todo;
1451 for(todo = todos.first(); todo; todo = todos.next()) { 1464 for(todo = todos.first(); todo; todo = todos.next()) {
1452 //insertTodo( todo ); 1465 //insertTodo( todo );
1453 if ( todo->hasDueDate() ) { 1466 if ( todo->hasDueDate() ) {
1454 int day = mStartDate.daysTo( todo->dtDue().date() ); 1467 int day = mStartDate.daysTo( todo->dtDue().date() );
1455 if ( day >= 0 && day < timeSpan + 1) { 1468 if ( day >= 0 && day < timeSpan + 1) {
1456 (*cells)[day]->insertTodo( todo ); 1469 (*cells)[day]->insertTodo( todo );
1457 } 1470 }
1458 } 1471 }
1459 } 1472 }
1460 1473
1461 for( i = 0; i < timeSpan+1; ++i ) { 1474 for( i = 0; i < timeSpan+1; ++i ) {
1462 (*cells)[i]->finishUpdateCell(); 1475 (*cells)[i]->finishUpdateCell();
1463 } 1476 }
1464 processSelectionChange(); 1477 processSelectionChange();
1465 //qApp->processEvents(); 1478 //qApp->processEvents();
1466 for( i = 0; i < timeSpan+1; ++i ) { 1479 for( i = 0; i < timeSpan+1; ++i ) {
1467 (*cells)[i]->repaintfinishUpdateCell(); 1480 (*cells)[i]->repaintfinishUpdateCell();
1468 } 1481 }
1469 (*cells)[0]->setFocus(); 1482 setKeyBFocus();
1470
1471
1472#else 1483#else
1473 // old code 1484 // old code
1474 //qDebug("+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ "); 1485 //qDebug("+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ ");
1475 int i; 1486 int i;
1476 for( i = 0; i < (*cells).count(); ++i ) { 1487 for( i = 0; i < (*cells).count(); ++i ) {
1477 (*cells)[i]->updateCell(); 1488 (*cells)[i]->updateCell();
1478 } 1489 }
1479 1490
1480 //qDebug("KOMonthView::updateView() "); 1491 //qDebug("KOMonthView::updateView() ");
1481 processSelectionChange(); 1492 processSelectionChange();
1482 // qDebug("---------------------------------------------------------------------+ "); 1493 // qDebug("---------------------------------------------------------------------+ ");
1483 (*cells)[0]->setFocus(); 1494 (*cells)[0]->setFocus();
1484#endif 1495#endif
1485 1496
1486 //qDebug("update time %d ", ti.elapsed()); 1497 //qDebug("update time %d ", ti.elapsed());
1487} 1498}
1488 1499
1500void KOMonthView::setKeyBoardFocus()
1501{
1502 bool shootAgain = false;
1503 if ( mShowWeekView ) {
1504 shootAgain = !mWeekLabelsW[0]->hasFocus();
1505 mWeekLabelsW[0]->setFocus();
1506 }
1507 else {
1508 shootAgain = !mWeekLabels[0]->hasFocus();
1509 mWeekLabels[0]->setFocus();
1510 }
1511 if ( shootAgain ) {
1512 QTimer::singleShot( 0, this, SLOT ( setKeyBFocus() ) );
1513 }
1514}
1515void KOMonthView::setKeyBFocus()
1516{
1517 //qDebug("KOMonthView::setKeyBFocus() ");
1518 QTimer::singleShot( 0, this, SLOT ( setKeyBoardFocus() ) );
1519}
1489void KOMonthView::resizeEvent(QResizeEvent * e) 1520void KOMonthView::resizeEvent(QResizeEvent * e)
1490{ 1521{
1491 //qDebug("KOMonthView::resizeEvent %d %d -- %d %d ", e->size().width(), e->size().height(), e->oldSize().width(), e->oldSize().height()); 1522 //qDebug("KOMonthView::resizeEvent %d %d -- %d %d ", e->size().width(), e->size().height(), e->oldSize().width(), e->oldSize().height());
1492 if ( isVisible() ) { 1523 if ( isVisible() ) {
1493 //qDebug("KOMonthView::isVisible "); 1524 //qDebug("KOMonthView::isVisible ");
1494 slotComputeLayout(); 1525 slotComputeLayout();
1495 } else 1526 } else
1496 mComputeLayoutTimer->start( 100 ); 1527 mComputeLayoutTimer->start( 100 );
1497} 1528}
1498 1529
1499void KOMonthView::slotComputeLayout() 1530void KOMonthView::slotComputeLayout()
1500{ 1531{
1501 mComputeLayoutTimer->stop(); 1532 mComputeLayoutTimer->stop();
1502 //qDebug("KOMonthView::Post - resizeEvent %d %d ", width(), height() ); 1533 //qDebug("KOMonthView::Post - resizeEvent %d %d ", width(), height() );
1503 computeLayout(); 1534 computeLayout();
1504 clPending = true; 1535 clPending = true;
1505 if ( mShowWeekView ) 1536 setKeyBFocus();
1506 mCellsW[0]->setFocus();
1507 else
1508 mCells[0]->setFocus();
1509
1510} 1537}
1511void KOMonthView::computeLayoutWeek() 1538void KOMonthView::computeLayoutWeek()
1512{ 1539{
1513 static int lastWid = 0; 1540 static int lastWid = 0;
1514 static int lastHei = 0; 1541 static int lastHei = 0;
1515 int daysToShow; 1542 int daysToShow;
1516 bool combinedSatSun = false; 1543 bool combinedSatSun = false;
1517 if (mShowSatSunComp = KOPrefs::instance()->mMonthViewSatSunTog ) { 1544 if (mShowSatSunComp = KOPrefs::instance()->mMonthViewSatSunTog ) {
1518 daysToShow = 6; 1545 daysToShow = 6;
1519 combinedSatSun = true; 1546 combinedSatSun = true;
1520 } 1547 }
1521 int tWid = topLevelWidget()->size().width(); 1548 int tWid = topLevelWidget()->size().width();
1522 int tHei = topLevelWidget()->size().height(); 1549 int tHei = topLevelWidget()->size().height();
1523 1550
1524 int wid = width();//e 1551 int wid = width();//e
1525 int hei = height()-1-mNavigatorBar->height(); 1552 int hei = height()-1-mNavigatorBar->height();
1526 1553
1527 if ( ((wid *3)/2) < tWid && (( hei *3) /2) < tHei ) 1554 if ( ((wid *3)/2) < tWid && (( hei *3) /2) < tHei )
1528 return; 1555 return;
1529 1556
1530 if ( lastWid == width() && lastHei == height() ) { 1557 if ( lastWid == width() && lastHei == height() ) {
1531 //qDebug("KOListWeekView::No compute layout needed "); 1558 //qDebug("KOListWeekView::No compute layout needed ");
1532 return; 1559 return;
1533 } 1560 }
@@ -1796,66 +1823,62 @@ void KOMonthView::processSelectionChange()
1796{ 1823{
1797 QPtrList<Incidence> incidences = selectedIncidences(); 1824 QPtrList<Incidence> incidences = selectedIncidences();
1798 if (incidences.count() > 0) { 1825 if (incidences.count() > 0) {
1799 emit incidenceSelected( incidences.first() ); 1826 emit incidenceSelected( incidences.first() );
1800 } else { 1827 } else {
1801 emit incidenceSelected( 0 ); 1828 emit incidenceSelected( 0 );
1802 clearSelection(); 1829 clearSelection();
1803 } 1830 }
1804} 1831}
1805 1832
1806void KOMonthView::clearSelection() 1833void KOMonthView::clearSelection()
1807{ 1834{
1808 if ( mSelectedCell ) { 1835 if ( mSelectedCell ) {
1809 mSelectedCell->deselect(); 1836 mSelectedCell->deselect();
1810 mSelectedCell = 0; 1837 mSelectedCell = 0;
1811 } 1838 }
1812} 1839}
1813void KOMonthView::keyPressEvent ( QKeyEvent * e ) 1840void KOMonthView::keyPressEvent ( QKeyEvent * e )
1814{ 1841{
1815 //qDebug("KOMonthView::keyPressEvent "); 1842 //qDebug("KOMonthView::keyPressEvent ");
1816 switch(e->key()) { 1843 switch(e->key()) {
1817 case Key_Up: 1844 case Key_Up:
1818 { 1845 {
1819 if ( mShowWeekView ) { 1846 if ( mShowWeekView ) {
1820 mCellsW[0]->setFocus();
1821 emit selectWeekNum ( currentWeek() - 1 ); 1847 emit selectWeekNum ( currentWeek() - 1 );
1822 } 1848 }
1823 else { 1849 else {
1824 mCells[0]->setFocus();
1825 emit prevMonth(); 1850 emit prevMonth();
1826 } 1851 }
1827 } 1852 }
1828 e->accept(); 1853 e->accept();
1829 break; 1854 break;
1830 case Key_Down: 1855 case Key_Down:
1831 { 1856 {
1832 if ( mShowWeekView ) { 1857 if ( mShowWeekView ) {
1833 mCellsW[0]->setFocus();
1834 emit selectWeekNum ( currentWeek() +1); 1858 emit selectWeekNum ( currentWeek() +1);
1835 } 1859 }
1836 else { 1860 else {
1837 mCells[0]->setFocus();
1838 emit nextMonth(); 1861 emit nextMonth();
1839 } 1862 }
1840 1863
1841 } 1864 }
1842 e->accept(); 1865 e->accept();
1843 break; 1866 break;
1844 case Key_Return: 1867 case Key_Return:
1845 case Key_Enter: 1868 case Key_Enter:
1846 { 1869 {
1847 selectInternalWeekNum ( currentWeek() ); 1870 selectInternalWeekNum ( currentWeek() );
1848 } 1871 }
1849 e->accept(); 1872 e->accept();
1850 break; 1873 break;
1851 case Key_D: 1874 case Key_D:
1852 if ( mSelectedCell ) { 1875 if ( mSelectedCell ) {
1853 mSelectedCell->showDay(); 1876 mSelectedCell->showDay();
1854 e->accept(); 1877 e->accept();
1855 } else { 1878 } else {
1856 e->ignore(); 1879 e->ignore();
1857 } 1880 }
1858 break; 1881 break;
1859 default: 1882 default:
1860 e->ignore(); 1883 e->ignore();
1861 break; 1884 break;
diff --git a/korganizer/komonthview.h b/korganizer/komonthview.h
index 9e724c7..c1ca3d4 100644
--- a/korganizer/komonthview.h
+++ b/korganizer/komonthview.h
@@ -40,48 +40,53 @@
40#include "navigatorbar.h" 40#include "navigatorbar.h"
41 41
42#ifdef DESKTOP_VERSION 42#ifdef DESKTOP_VERSION
43class QToolTipGroup; 43class QToolTipGroup;
44#endif 44#endif
45 45
46class KNOWhatsThis; 46class KNOWhatsThis;
47class KOWeekButton : public QPushButton 47class KOWeekButton : public QPushButton
48{ 48{
49 Q_OBJECT 49 Q_OBJECT
50 public: 50 public:
51 KOWeekButton( QWidget *parent=0, const char *name=0 ) : 51 KOWeekButton( QWidget *parent=0, const char *name=0 ) :
52 QPushButton( parent, name) 52 QPushButton( parent, name)
53 { 53 {
54 connect( this, SIGNAL( clicked() ), 54 connect( this, SIGNAL( clicked() ),
55 SLOT( bottonClicked() )); 55 SLOT( bottonClicked() ));
56 mNumber = -1; 56 mNumber = -1;
57 } 57 }
58 void setWeekNum ( int num ) {mNumber = num; setText( QString::number ( num ));} 58 void setWeekNum ( int num ) {mNumber = num; setText( QString::number ( num ));}
59 int getWeekNum() { return mNumber;} 59 int getWeekNum() { return mNumber;}
60 signals: 60 signals:
61 void selectWeekNum ( int ); 61 void selectWeekNum ( int );
62private: 62private:
63 int mNumber; 63 int mNumber;
64 void keyPressEvent ( QKeyEvent * e )
65 {
66 e->ignore();
67 }
68
64private slots : 69private slots :
65 void bottonClicked() { if ( mNumber > 0 ) emit selectWeekNum ( mNumber ); } 70 void bottonClicked() { if ( mNumber > 0 ) emit selectWeekNum ( mNumber ); }
66}; 71};
67 72
68class KNoScrollListBox: public QListBox 73class KNoScrollListBox: public QListBox
69{ 74{
70 Q_OBJECT 75 Q_OBJECT
71 public: 76 public:
72 KNoScrollListBox(QWidget *parent=0, const char *name=0); 77 KNoScrollListBox(QWidget *parent=0, const char *name=0);
73 ~KNoScrollListBox(); 78 ~KNoScrollListBox();
74 QString getWhatsThisText(QPoint p) ; 79 QString getWhatsThisText(QPoint p) ;
75 80
76 signals: 81 signals:
77 void shiftDown(); 82 void shiftDown();
78 void shiftUp(); 83 void shiftUp();
79 void rightClick(); 84 void rightClick();
80 85
81 protected slots: 86 protected slots:
82 void oneDown(); 87 void oneDown();
83 void keyPressEvent(QKeyEvent *); 88 void keyPressEvent(QKeyEvent *);
84 void keyReleaseEvent(QKeyEvent *); 89 void keyReleaseEvent(QKeyEvent *);
85 void mousePressEvent(QMouseEvent *); 90 void mousePressEvent(QMouseEvent *);
86 91
87 private: 92 private:
@@ -142,49 +147,48 @@ class MonthViewCell : public KNoScrollListBox
142 147
143 void setPrimary( bool ); 148 void setPrimary( bool );
144 bool isPrimary() const; 149 bool isPrimary() const;
145 150
146 void setHoliday( bool ); 151 void setHoliday( bool );
147 void setHoliday( const QString & ); 152 void setHoliday( const QString & );
148 153
149 void updateCell(); 154 void updateCell();
150 void startUpdateCell(); 155 void startUpdateCell();
151 void finishUpdateCell(); 156 void finishUpdateCell();
152 void repaintfinishUpdateCell(); 157 void repaintfinishUpdateCell();
153 void insertEvent(Event *); 158 void insertEvent(Event *);
154 void insertTodo(Todo *); 159 void insertTodo(Todo *);
155 160
156 void updateConfig( bool bigFont = false ); 161 void updateConfig( bool bigFont = false );
157 162
158 void enableScrollBars( bool ); 163 void enableScrollBars( bool );
159 164
160 Incidence *selectedIncidence(); 165 Incidence *selectedIncidence();
161 QDate selectedIncidenceDate(); 166 QDate selectedIncidenceDate();
162 QPushButton * dateLabel() { return mLabel; } 167 QPushButton * dateLabel() { return mLabel; }
163 168
164 void deselect(); 169 void deselect();
165 void select(); 170 void select();
166
167#ifdef DESKTOP_VERSION 171#ifdef DESKTOP_VERSION
168 static QToolTipGroup *toolTipGroup(); 172 static QToolTipGroup *toolTipGroup();
169#endif 173#endif
170 signals: 174 signals:
171 void defaultAction( Incidence * ); 175 void defaultAction( Incidence * );
172 void newEventSignal( QDateTime ); 176 void newEventSignal( QDateTime );
173 void showDaySignal( QDate ); 177 void showDaySignal( QDate );
174 178
175 protected: 179 protected:
176 QStringList mToolTip; 180 QStringList mToolTip;
177 void resizeEvent( QResizeEvent * ); 181 void resizeEvent( QResizeEvent * );
178 182
179 183
180public slots: 184public slots:
181 void showDay(); 185 void showDay();
182 186
183 protected slots: 187 protected slots:
184 void defaultAction( QListBoxItem * ); 188 void defaultAction( QListBoxItem * );
185 void contextMenu( QListBoxItem * ); 189 void contextMenu( QListBoxItem * );
186 void selection( QListBoxItem * ); 190 void selection( QListBoxItem * );
187 void cellClicked( QListBoxItem * ); 191 void cellClicked( QListBoxItem * );
188 void newEvent(); 192 void newEvent();
189 193
190 private: 194 private:
@@ -236,48 +240,50 @@ class KOMonthView: public KOEventView
236 virtual DateList selectedDates(); 240 virtual DateList selectedDates();
237 241
238 virtual void printPreview(CalPrinter *calPrinter, 242 virtual void printPreview(CalPrinter *calPrinter,
239 const QDate &, const QDate &); 243 const QDate &, const QDate &);
240 bool isMonthView() { return !mShowWeekView; } 244 bool isMonthView() { return !mShowWeekView; }
241 bool isUpdatePossible() { return updatePossible; } 245 bool isUpdatePossible() { return updatePossible; }
242 246
243 MonthViewCell * selectedCell(); 247 MonthViewCell * selectedCell();
244 bool skipResize; 248 bool skipResize;
245 NavigatorBar* navigatorBar() { return mNavigatorBar ;} 249 NavigatorBar* navigatorBar() { return mNavigatorBar ;}
246 public slots: 250 public slots:
247 virtual void updateView(); 251 virtual void updateView();
248 virtual void updateConfig(); 252 virtual void updateConfig();
249 virtual void showDates(const QDate &start, const QDate &end); 253 virtual void showDates(const QDate &start, const QDate &end);
250 virtual void showEvents(QPtrList<Event> eventList); 254 virtual void showEvents(QPtrList<Event> eventList);
251 255
252 void changeEventDisplay(Event *, int); 256 void changeEventDisplay(Event *, int);
253 257
254 void clearSelection(); 258 void clearSelection();
255 259
256 void showContextMenu( Incidence * ); 260 void showContextMenu( Incidence * );
257 261
258 void setSelectedCell( MonthViewCell * ); 262 void setSelectedCell( MonthViewCell * );
259 void switchView(); 263 void switchView();
264 void setKeyBoardFocus();
265 void setKeyBFocus();
260 266
261 protected slots: 267 protected slots:
262 void slotComputeLayout(); 268 void slotComputeLayout();
263 void selectInternalWeekNum ( int ); 269 void selectInternalWeekNum ( int );
264 void processSelectionChange(); 270 void processSelectionChange();
265 signals: 271 signals:
266 void nextMonth(); 272 void nextMonth();
267 void prevMonth(); 273 void prevMonth();
268 void selectWeekNum ( int ); 274 void selectWeekNum ( int );
269 void selectMonth (); 275 void selectMonth ();
270 void showDaySignal( QDate ); 276 void showDaySignal( QDate );
271 protected: 277 protected:
272 void resizeEvent(QResizeEvent *); 278 void resizeEvent(QResizeEvent *);
273 void viewChanged(); 279 void viewChanged();
274 void updateDayLabels(); 280 void updateDayLabels();
275 281
276 private: 282 private:
277 QTimer* mComputeLayoutTimer; 283 QTimer* mComputeLayoutTimer;
278 NavigatorBar* mNavigatorBar; 284 NavigatorBar* mNavigatorBar;
279 int currentWeek(); 285 int currentWeek();
280 bool clPending; 286 bool clPending;
281 QWidgetStack * mWidStack; 287 QWidgetStack * mWidStack;
282 QWidget* mMonthView; 288 QWidget* mMonthView;
283 QWidget* mWeekView; 289 QWidget* mWeekView;
diff --git a/korganizer/koviewmanager.cpp b/korganizer/koviewmanager.cpp
index 53cd011..548ffd3 100644
--- a/korganizer/koviewmanager.cpp
+++ b/korganizer/koviewmanager.cpp
@@ -626,77 +626,79 @@ if (!mMonthView) {
626 mMonthView->navigatorBar(), SLOT( selectDates( const KCal::DateList & ) ) ); 626 mMonthView->navigatorBar(), SLOT( selectDates( const KCal::DateList & ) ) );
627 627
628 628
629 connect( mMonthView->navigatorBar(), SIGNAL( monthSelected ( int ) ), 629 connect( mMonthView->navigatorBar(), SIGNAL( monthSelected ( int ) ),
630 mMainView->dateNavigator(), SLOT( slotMonthSelect( int ) ) ); 630 mMainView->dateNavigator(), SLOT( slotMonthSelect( int ) ) );
631 631
632 } 632 }
633} 633}
634void KOViewManager::showMonthViewWeek() 634void KOViewManager::showMonthViewWeek()
635{ 635{
636 createMonthView(); 636 createMonthView();
637 globalFlagBlockAgenda = 1; 637 globalFlagBlockAgenda = 1;
638 bool full = true; 638 bool full = true;
639 if ( mCurrentView == mMonthView) 639 if ( mCurrentView == mMonthView)
640 full = mMainView->leftFrame()->isVisible(); 640 full = mMainView->leftFrame()->isVisible();
641 if ( !KOPrefs::instance()->mMonthViewWeek ) { 641 if ( !KOPrefs::instance()->mMonthViewWeek ) {
642 mMonthView->switchView(); 642 mMonthView->switchView();
643 if ( KOPrefs::instance()->mViewChangeHoldNonFullscreen && mMainView->leftFrame()->isVisible() ) 643 if ( KOPrefs::instance()->mViewChangeHoldNonFullscreen && mMainView->leftFrame()->isVisible() )
644 full = false; 644 full = false;
645 else 645 else
646 full = true; 646 full = true;
647 } 647 }
648 mMainView->dateNavigator()->selectWeek(); 648 mMainView->dateNavigator()->selectWeek();
649 showView(mMonthView, full ); 649 showView(mMonthView, full );
650 mMonthView->setKeyBFocus();
650} 651}
651 652
652void KOViewManager::showMonth( const QDate & date ) 653void KOViewManager::showMonth( const QDate & date )
653{ 654{
654 mMainView->dateNavigator()->blockSignals( true ); 655 mMainView->dateNavigator()->blockSignals( true );
655 mMainView->dateNavigator()->selectDate( date ); 656 mMainView->dateNavigator()->selectDate( date );
656 mMainView->dateNavigator()->blockSignals( false ); 657 mMainView->dateNavigator()->blockSignals( false );
657 showMonthView(); 658 showMonthView();
658} 659}
659void KOViewManager::showMonthView() 660void KOViewManager::showMonthView()
660 { 661 {
661 662
662 createMonthView(); 663 createMonthView();
663 globalFlagBlockAgenda = 1; 664 globalFlagBlockAgenda = 1;
664 //mFlagShowNextxDays = false; 665 //mFlagShowNextxDays = false;
665 bool full = true; 666 bool full = true;
666 if ( mCurrentView == mMonthView) 667 if ( mCurrentView == mMonthView)
667 full = mMainView->leftFrame()->isVisible(); 668 full = mMainView->leftFrame()->isVisible();
668 // if(mMonthView == mCurrentView) return; 669 // if(mMonthView == mCurrentView) return;
669 if ( KOPrefs::instance()->mMonthViewWeek ) { 670 if ( KOPrefs::instance()->mMonthViewWeek ) {
670 mMonthView->switchView(); 671 mMonthView->switchView();
671 if ( KOPrefs::instance()->mViewChangeHoldNonFullscreen && mMainView->leftFrame()->isVisible() ) 672 if ( KOPrefs::instance()->mViewChangeHoldNonFullscreen && mMainView->leftFrame()->isVisible() )
672 full = false; 673 full = false;
673 else 674 else
674 full = true; 675 full = true;
675 } 676 }
676 mMainView->dateNavigator()->selectMonth(); 677 mMainView->dateNavigator()->selectMonth();
677 678
678 showView(mMonthView, full ); 679 showView(mMonthView, full );
680 mMonthView->setKeyBFocus();
679 681
680} 682}
681 683
682void KOViewManager::showTodoView() 684void KOViewManager::showTodoView()
683{ 685{
684 //mFlagShowNextxDays = false; 686 //mFlagShowNextxDays = false;
685 if ( !mTodoView ) { 687 if ( !mTodoView ) {
686 mTodoView = new KOTodoView( mMainView->calendar(), mMainView->viewStack(), 688 mTodoView = new KOTodoView( mMainView->calendar(), mMainView->viewStack(),
687 "KOViewManager::TodoView" ); 689 "KOViewManager::TodoView" );
688 690
689 addView( mTodoView ); 691 addView( mTodoView );
690 // QPEApplication::setStylusOperation( mTodoView, QPEApplication::RightOnHold ); 692 // QPEApplication::setStylusOperation( mTodoView, QPEApplication::RightOnHold );
691 693
692 // SIGNALS/SLOTS FOR TODO VIEW 694 // SIGNALS/SLOTS FOR TODO VIEW
693 connect( mTodoView, SIGNAL( newTodoSignal() ), 695 connect( mTodoView, SIGNAL( newTodoSignal() ),
694 mMainView, SLOT( newTodo() ) ); 696 mMainView, SLOT( newTodo() ) );
695 connect( mTodoView, SIGNAL( newSubTodoSignal( Todo * ) ), 697 connect( mTodoView, SIGNAL( newSubTodoSignal( Todo * ) ),
696 mMainView, SLOT( newSubTodo( Todo *) ) ); 698 mMainView, SLOT( newSubTodo( Todo *) ) );
697 connect( mTodoView, SIGNAL( showTodoSignal( Todo *) ), 699 connect( mTodoView, SIGNAL( showTodoSignal( Todo *) ),
698 mMainView, SLOT( showTodo( Todo * ) ) ); 700 mMainView, SLOT( showTodo( Todo * ) ) );
699 connect( mTodoView, SIGNAL( editTodoSignal( Todo * ) ), 701 connect( mTodoView, SIGNAL( editTodoSignal( Todo * ) ),
700 mMainView, SLOT( editTodo( Todo * ) ) ); 702 mMainView, SLOT( editTodo( Todo * ) ) );
701 connect( mTodoView, SIGNAL( deleteTodoSignal( Todo * ) ), 703 connect( mTodoView, SIGNAL( deleteTodoSignal( Todo * ) ),
702 mMainView, SLOT( deleteTodo( Todo * ) ) ); 704 mMainView, SLOT( deleteTodo( Todo * ) ) );