summaryrefslogtreecommitdiffabout
path: root/korganizer/komonthview.cpp
Unidiff
Diffstat (limited to 'korganizer/komonthview.cpp') (more/less context) (show whitespace changes)
-rw-r--r--korganizer/komonthview.cpp18
1 files changed, 15 insertions, 3 deletions
diff --git a/korganizer/komonthview.cpp b/korganizer/komonthview.cpp
index 5926abe..ffb2e1e 100644
--- a/korganizer/komonthview.cpp
+++ b/korganizer/komonthview.cpp
@@ -548,23 +548,24 @@ void MonthViewCell::insertEvent(Event *event)
548 item->setReply(false); 548 item->setReply(false);
549#endif 549#endif
550 mItemList->insertItem( item ); 550 mItemList->insertItem( item );
551 mToolTip += "\n"; 551 mToolTip += "\n";
552} 552}
553void MonthViewCell::insertTodo(Todo *todo) 553void MonthViewCell::insertTodo(Todo *todo)
554{ 554{
555 QString text; 555 QString text;
556 mItemList->setFocusPolicy(WheelFocus);
556 if (todo->hasDueDate()) { 557 if (todo->hasDueDate()) {
557 if (!todo->doesFloat()) { 558 if (!todo->doesFloat()) {
558 text += KGlobal::locale()->formatTime(todo->dtDue().time()); 559 text += KGlobal::locale()->formatTime(todo->dtDue().time());
559 text += " "; 560 text += " ";
560 } 561 }
561 } 562 }
562 text += i18n("Td: %1").arg(todo->summary()); 563 text += i18n("T: %1").arg(todo->summary());
563 564
564 MonthViewItem *item = new MonthViewItem( todo, mDate, text ); 565 MonthViewItem *item = new MonthViewItem( todo, mDate, text );
565 //item->setPalette( mStandardPalette ); 566 //item->setPalette( mStandardPalette );
566 QPalette pal; 567 QPalette pal;
567 if (KOPrefs::instance()->mMonthViewUsesCategoryColor) { 568 if (KOPrefs::instance()->mMonthViewUsesCategoryColor) {
568 QStringList categories = todo->categories(); 569 QStringList categories = todo->categories();
569 QString cat = categories.first(); 570 QString cat = categories.first();
570 if ( KOPrefs::instance()->mMonthViewUsesForegroundColor ) { 571 if ( KOPrefs::instance()->mMonthViewUsesForegroundColor ) {
@@ -777,17 +778,16 @@ void MonthViewCell::contextMenu( QListBoxItem *item )
777 MonthViewItem *eventItem = static_cast<MonthViewItem *>( item ); 778 MonthViewItem *eventItem = static_cast<MonthViewItem *>( item );
778 Incidence *incidence = eventItem->incidence(); 779 Incidence *incidence = eventItem->incidence();
779 if ( incidence ) mMonthView->showContextMenu( incidence ); 780 if ( incidence ) mMonthView->showContextMenu( incidence );
780} 781}
781 782
782void MonthViewCell::selection( QListBoxItem *item ) 783void MonthViewCell::selection( QListBoxItem *item )
783{ 784{
784 if ( !item ) return; 785 if ( !item ) return;
785
786 mMonthView->setSelectedCell( this ); 786 mMonthView->setSelectedCell( this );
787} 787}
788 788
789 789
790// ******************************************************************************* 790// *******************************************************************************
791// ******************************************************************************* 791// *******************************************************************************
792// ******************************************************************************* 792// *******************************************************************************
793 793
@@ -1260,20 +1260,26 @@ void KOMonthView::updateView()
1260 1260
1261 //qDebug("update time %d ", ti.elapsed()); 1261 //qDebug("update time %d ", ti.elapsed());
1262} 1262}
1263 1263
1264void KOMonthView::resizeEvent(QResizeEvent * e) 1264void KOMonthView::resizeEvent(QResizeEvent * e)
1265{ 1265{
1266 qDebug("KOMonthView::resizeEvent %d %d -- %d %d ", e->size().width(), e->size().height(), e->oldSize().width(), e->oldSize().height()); 1266 qDebug("KOMonthView::resizeEvent %d %d -- %d %d ", e->size().width(), e->size().height(), e->oldSize().width(), e->oldSize().height());
1267 if ( ignoreResizeEvent ) { 1267 if ( ignoreResizeEvent ) {
1268 int diff = e->size().height() - e->oldSize().height();
1269 if ( diff < 0 )
1270 diff = diff * (-1);
1271 if ( diff == ignoreResizeEventHeight ) {
1268 qDebug("KOMonthView::resizeEvent ignored "); 1272 qDebug("KOMonthView::resizeEvent ignored ");
1269 --ignoreResizeEvent; 1273 --ignoreResizeEvent;
1270 return; 1274 return;
1271 } 1275 }
1276 ignoreResizeEvent = 0;
1277 }
1272 if ( e->size().width()+ e->size().height() < 240 ) 1278 if ( e->size().width()+ e->size().height() < 240 )
1273 return; 1279 return;
1274 computeLayout(); 1280 computeLayout();
1275 clPending = true; 1281 clPending = true;
1276 if ( mShowWeekView ) 1282 if ( mShowWeekView )
1277 mCellsW[0]->setFocus(); 1283 mCellsW[0]->setFocus();
1278 else 1284 else
1279 mCells[0]->setFocus(); 1285 mCells[0]->setFocus();
@@ -1506,17 +1512,17 @@ void KOMonthView::showContextMenu( Incidence *incidence )
1506 */ 1512 */
1507} 1513}
1508MonthViewCell * KOMonthView::selectedCell( ) 1514MonthViewCell * KOMonthView::selectedCell( )
1509{ 1515{
1510 return mSelectedCell; 1516 return mSelectedCell;
1511} 1517}
1512void KOMonthView::setSelectedCell( MonthViewCell *cell ) 1518void KOMonthView::setSelectedCell( MonthViewCell *cell )
1513{ 1519{
1514 // qDebug("KOMonthView::setSelectedCell "); 1520 //qDebug("KOMonthView::setSelectedCell %x ", cell);
1515 if ( mSelectedCell && mSelectedCell != cell ) { 1521 if ( mSelectedCell && mSelectedCell != cell ) {
1516 MonthViewCell * mvc = mSelectedCell; 1522 MonthViewCell * mvc = mSelectedCell;
1517 mSelectedCell = cell; 1523 mSelectedCell = cell;
1518 mvc->deselect(); 1524 mvc->deselect();
1519 } else 1525 } else
1520 mSelectedCell = cell; 1526 mSelectedCell = cell;
1521 // if ( mSelectedCell ) 1527 // if ( mSelectedCell )
1522 // mSelectedCell->select(); 1528 // mSelectedCell->select();
@@ -1545,23 +1551,29 @@ void KOMonthView::clearSelection()
1545} 1551}
1546void KOMonthView::keyPressEvent ( QKeyEvent * e ) 1552void KOMonthView::keyPressEvent ( QKeyEvent * e )
1547{ 1553{
1548 //qDebug("KOMonthView::keyPressEvent "); 1554 //qDebug("KOMonthView::keyPressEvent ");
1549 switch(e->key()) { 1555 switch(e->key()) {
1550 case Key_Up: 1556 case Key_Up:
1551 { 1557 {
1552 emit prevMonth(); 1558 emit prevMonth();
1559 if ( mShowWeekView )
1560 mCellsW[0]->setFocus();
1561 else
1553 mCells[0]->setFocus(); 1562 mCells[0]->setFocus();
1554 } 1563 }
1555 e->accept(); 1564 e->accept();
1556 break; 1565 break;
1557 case Key_Down: 1566 case Key_Down:
1558 { 1567 {
1559 emit nextMonth(); 1568 emit nextMonth();
1569 if ( mShowWeekView )
1570 mCellsW[0]->setFocus();
1571 else
1560 mCells[0]->setFocus(); 1572 mCells[0]->setFocus();
1561 1573
1562 } 1574 }
1563 e->accept(); 1575 e->accept();
1564 break; 1576 break;
1565 case Key_Return: 1577 case Key_Return:
1566 case Key_Enter: 1578 case Key_Enter:
1567 { 1579 {