author | zautrix <zautrix> | 2005-03-10 10:40:57 (UTC) |
---|---|---|
committer | zautrix <zautrix> | 2005-03-10 10:40:57 (UTC) |
commit | b96161e4dd7fc19eea87257c2455b85420dad35a (patch) (unidiff) | |
tree | d2e518cdc4c6c314f6e42960d12653ad6c7083d3 | |
parent | 4b05d69b961309df5d56714889c62ca530580914 (diff) | |
download | kdepimpi-b96161e4dd7fc19eea87257c2455b85420dad35a.zip kdepimpi-b96161e4dd7fc19eea87257c2455b85420dad35a.tar.gz kdepimpi-b96161e4dd7fc19eea87257c2455b85420dad35a.tar.bz2 |
todo month view fix
-rw-r--r-- | bin/kdepim/WhatsNew.txt | 2 | ||||
-rw-r--r-- | korganizer/komonthview.cpp | 32 | ||||
-rw-r--r-- | korganizer/komonthview.h | 5 |
3 files changed, 35 insertions, 4 deletions
diff --git a/bin/kdepim/WhatsNew.txt b/bin/kdepim/WhatsNew.txt index d4b7971..95a1866 100644 --- a/bin/kdepim/WhatsNew.txt +++ b/bin/kdepim/WhatsNew.txt | |||
@@ -1,40 +1,42 @@ | |||
1 | Info about the changes in new versions of KDE-Pim/Pi | 1 | Info about the changes in new versions of KDE-Pim/Pi |
2 | 2 | ||
3 | ********** VERSION 2.0.15 ************ | 3 | ********** VERSION 2.0.15 ************ |
4 | 4 | ||
5 | PwM/Pi: | 5 | PwM/Pi: |
6 | Added keyboard shorcuts for | 6 | Added keyboard shorcuts for |
7 | - toggling summary view (space bar) | 7 | - toggling summary view (space bar) |
8 | - delete item (delete + backspace key) | 8 | - delete item (delete + backspace key) |
9 | - add new item ( i + n key) | 9 | - add new item ( i + n key) |
10 | Fixed length of info in the title. | 10 | Fixed length of info in the title. |
11 | 11 | ||
12 | KO/Pi-KA/Pi: | 12 | KO/Pi-KA/Pi: |
13 | Changed "ME" menu bar entry to an icon. | 13 | Changed "ME" menu bar entry to an icon. |
14 | 14 | ||
15 | KO/Pi: | 15 | KO/Pi: |
16 | Fixed two minor bugs in displaying todos. | 16 | Fixed two minor bugs in displaying todos. |
17 | If in month view a cell is selected, the key shortcut "d" shows now that date. | ||
18 | Added complete info for a todo in month view as an icon left of the text. | ||
17 | 19 | ||
18 | 20 | ||
19 | ********** VERSION 2.0.14 ************ | 21 | ********** VERSION 2.0.14 ************ |
20 | 22 | ||
21 | Made Passwordmanager PwM/Pi more userfriendly: | 23 | Made Passwordmanager PwM/Pi more userfriendly: |
22 | Rearranged some toolbar icons, optimized setting of focus, fixed layout problems and more. | 24 | Rearranged some toolbar icons, optimized setting of focus, fixed layout problems and more. |
23 | Fixed bug in KO/Pi todo printing. | 25 | Fixed bug in KO/Pi todo printing. |
24 | Made Qtopia calendar import possible on desktop . | 26 | Made Qtopia calendar import possible on desktop . |
25 | 27 | ||
26 | ********** VERSION 2.0.13 ************ | 28 | ********** VERSION 2.0.13 ************ |
27 | 29 | ||
28 | Fixed a problem in the addressee select dialog and made it more user friendly by adding a minimize splitter. | 30 | Fixed a problem in the addressee select dialog and made it more user friendly by adding a minimize splitter. |
29 | 31 | ||
30 | In the search dialog you can switch now the focus from search line edit to the list view by pressing key "arrow down". | 32 | In the search dialog you can switch now the focus from search line edit to the list view by pressing key "arrow down". |
31 | 33 | ||
32 | OM/Pi: | 34 | OM/Pi: |
33 | Fixed a refresh problem of outgoing/sent/sendfailed folders after sending mails. | 35 | Fixed a refresh problem of outgoing/sent/sendfailed folders after sending mails. |
34 | Added missing German translation. | 36 | Added missing German translation. |
35 | Added warning if path is specified in local folder settings of account config. | 37 | Added warning if path is specified in local folder settings of account config. |
36 | 38 | ||
37 | ********** VERSION 2.0.12 ************ | 39 | ********** VERSION 2.0.12 ************ |
38 | 40 | ||
39 | KO/Pi: | 41 | KO/Pi: |
40 | Fixed a bug in todo start/due date handling for non recurring todos with a start and due date. | 42 | Fixed a bug in todo start/due date handling for non recurring todos with a start and due date. |
diff --git a/korganizer/komonthview.cpp b/korganizer/komonthview.cpp index f983ff9..4bf9dea 100644 --- a/korganizer/komonthview.cpp +++ b/korganizer/komonthview.cpp | |||
@@ -256,48 +256,64 @@ void MonthViewItem::paint(QPainter *p) | |||
256 | pa.setPoint (1, x+sizeM/2, yyy+sizeM/2 ); | 256 | pa.setPoint (1, x+sizeM/2, yyy+sizeM/2 ); |
257 | pa.setPoint (2, x+sizeM/2, yyy-sizeM/2 ); | 257 | pa.setPoint (2, x+sizeM/2, yyy-sizeM/2 ); |
258 | p->drawPolygon( pa ); | 258 | p->drawPolygon( pa ); |
259 | } | 259 | } |
260 | if ( mMultiday == 2 || mMultiday == 1 ) { | 260 | if ( mMultiday == 2 || mMultiday == 1 ) { |
261 | QPointArray pa ( 3 ); | 261 | QPointArray pa ( 3 ); |
262 | pa.setPoint (0, x+sizeM +sizeM/2, yyy ); | 262 | pa.setPoint (0, x+sizeM +sizeM/2, yyy ); |
263 | pa.setPoint (1, x+sizeM, yyy+sizeM/2 ); | 263 | pa.setPoint (1, x+sizeM, yyy+sizeM/2 ); |
264 | pa.setPoint (2, x+sizeM, yyy-sizeM/2 ); | 264 | pa.setPoint (2, x+sizeM, yyy-sizeM/2 ); |
265 | p->drawPolygon( pa ); | 265 | p->drawPolygon( pa ); |
266 | } | 266 | } |
267 | if ( mMultiday == 1 ) { | 267 | if ( mMultiday == 1 ) { |
268 | // p->fillRect ( x, yyy-sizeM/2+1, sizeM/2, size, QBrush ( QBrush::SolidPattern ) ); | 268 | // p->fillRect ( x, yyy-sizeM/2+1, sizeM/2, size, QBrush ( QBrush::SolidPattern ) ); |
269 | 269 | ||
270 | p->drawLine ( x+1, yyy-sizeM/2, x+1, yyy+sizeM/2 ); | 270 | p->drawLine ( x+1, yyy-sizeM/2, x+1, yyy+sizeM/2 ); |
271 | } | 271 | } |
272 | if ( mMultiday == 3 ) { | 272 | if ( mMultiday == 3 ) { |
273 | // p->fillRect ( x+sizeM, yyy-sizeM/2+1, sizeM/2, size, QBrush ( QBrush::SolidPattern ) ); | 273 | // p->fillRect ( x+sizeM, yyy-sizeM/2+1, sizeM/2, size, QBrush ( QBrush::SolidPattern ) ); |
274 | p->drawLine ( x+sizeM +sizeM/2-1, yyy-sizeM/2, x+sizeM +sizeM/2-1, yyy+sizeM/2 ); | 274 | p->drawLine ( x+sizeM +sizeM/2-1, yyy-sizeM/2, x+sizeM +sizeM/2-1, yyy+sizeM/2 ); |
275 | 275 | ||
276 | } | 276 | } |
277 | x += sizeM/2 + 1; | 277 | x += sizeM/2 + 1; |
278 | x += sizeM + 1; | 278 | x += sizeM + 1; |
279 | } | 279 | } |
280 | |||
281 | if ( mIncidence->type() == "Todo" ){ | ||
282 | Todo* td = ( Todo* ) mIncidence; | ||
283 | if ( td->isCompleted() ) { | ||
284 | int half = size/2; | ||
285 | p->drawLine ( x, heihei/2, x +half , heihei/2 +half ) ; | ||
286 | p->drawLine ( x +half , heihei/2 +half , x +half+half +2 , heihei/2 -2 ) ; | ||
287 | x += half+half + 4; | ||
288 | |||
289 | } else { | ||
290 | int val = td->percentComplete()/20; | ||
291 | p->fillRect ( x+1, y-1, val ,size+2,Qt::black ); | ||
292 | p->drawRect ( x, y-1,7,size+2); | ||
293 | x += size + 3; | ||
294 | } | ||
295 | } | ||
280 | QFontMetrics fm = p->fontMetrics(); | 296 | QFontMetrics fm = p->fontMetrics(); |
281 | int yPos; | 297 | int yPos; |
282 | int pmheight = size; | 298 | int pmheight = size; |
283 | if( pmheight < fm.height() ) | 299 | if( pmheight < fm.height() ) |
284 | yPos = fm.ascent() + fm.leading()/2; | 300 | yPos = fm.ascent() + fm.leading()/2; |
285 | else | 301 | else |
286 | yPos = pmheight/2 - fm.height()/2 + fm.ascent(); | 302 | yPos = pmheight/2 - fm.height()/2 + fm.ascent(); |
287 | p->setPen( palette().color( QPalette::Normal, sel ? \ | 303 | p->setPen( palette().color( QPalette::Normal, sel ? \ |
288 | QColorGroup::HighlightedText : QColorGroup::Foreground ) ); | 304 | QColorGroup::HighlightedText : QColorGroup::Foreground ) ); |
289 | p->drawText( x, yPos, text() ); | 305 | p->drawText( x, yPos, text() ); |
290 | if ( mIncidence->cancelled() ) { | 306 | if ( mIncidence->cancelled() ) { |
291 | int wid = fm.width( text() ); | 307 | int wid = fm.width( text() ); |
292 | p->drawLine( x, heihei/2 ,x+wid, heihei/2 ); | 308 | p->drawLine( x, heihei/2 ,x+wid, heihei/2 ); |
293 | } | 309 | } |
294 | 310 | ||
295 | } | 311 | } |
296 | 312 | ||
297 | int MonthViewItem::height(const QListBox *lb) const | 313 | int MonthViewItem::height(const QListBox *lb) const |
298 | { | 314 | { |
299 | if ( lb ) | 315 | if ( lb ) |
300 | return lb->fontMetrics().lineSpacing()+1; | 316 | return lb->fontMetrics().lineSpacing()+1; |
301 | return 10; | 317 | return 10; |
302 | } | 318 | } |
303 | 319 | ||
@@ -581,49 +597,49 @@ void MonthViewCell::insertEvent(Event *event) | |||
581 | Attendee *me = event->attendeeByMails(KOPrefs::instance()->mAdditionalMails, | 597 | Attendee *me = event->attendeeByMails(KOPrefs::instance()->mAdditionalMails, |
582 | KOPrefs::instance()->email()); | 598 | KOPrefs::instance()->email()); |
583 | if ( me != 0 ) { | 599 | if ( me != 0 ) { |
584 | if ( me->status() == Attendee::NeedsAction && me->RSVP()) | 600 | if ( me->status() == Attendee::NeedsAction && me->RSVP()) |
585 | item->setReply(true && multiday < 2); | 601 | item->setReply(true && multiday < 2); |
586 | else | 602 | else |
587 | item->setReply(false); | 603 | item->setReply(false); |
588 | } else | 604 | } else |
589 | item->setReply(false); | 605 | item->setReply(false); |
590 | #endif | 606 | #endif |
591 | item->setMultiDay( multiday ); | 607 | item->setMultiDay( multiday ); |
592 | mItemList->insertItem( item ); | 608 | mItemList->insertItem( item ); |
593 | mToolTip += "\n"; | 609 | mToolTip += "\n"; |
594 | } | 610 | } |
595 | void MonthViewCell::insertTodo(Todo *todo) | 611 | void MonthViewCell::insertTodo(Todo *todo) |
596 | { | 612 | { |
597 | mItemList->setFocusPolicy(WheelFocus); | 613 | mItemList->setFocusPolicy(WheelFocus); |
598 | QString text; | 614 | QString text; |
599 | if (todo->hasDueDate()) { | 615 | if (todo->hasDueDate()) { |
600 | if (!todo->doesFloat()) { | 616 | if (!todo->doesFloat()) { |
601 | text += KGlobal::locale()->formatTime(todo->dtDue().time()); | 617 | text += KGlobal::locale()->formatTime(todo->dtDue().time()); |
602 | text += " "; | 618 | text += " "; |
603 | } | 619 | } |
604 | } | 620 | } |
605 | text += i18n("T: %1").arg(todo->summary()); | 621 | text += todo->summary(); |
606 | 622 | ||
607 | MonthViewItem *item = new MonthViewItem( todo, mDate, text ); | 623 | MonthViewItem *item = new MonthViewItem( todo, mDate, text ); |
608 | //item->setPalette( mStandardPalette ); | 624 | //item->setPalette( mStandardPalette ); |
609 | QPalette pal; | 625 | QPalette pal; |
610 | if (KOPrefs::instance()->mMonthViewUsesCategoryColor) { | 626 | if (KOPrefs::instance()->mMonthViewUsesCategoryColor) { |
611 | QStringList categories = todo->categories(); | 627 | QStringList categories = todo->categories(); |
612 | QString cat = categories.first(); | 628 | QString cat = categories.first(); |
613 | if ( KOPrefs::instance()->mMonthViewUsesForegroundColor ) { | 629 | if ( KOPrefs::instance()->mMonthViewUsesForegroundColor ) { |
614 | pal = getPalette(); | 630 | pal = getPalette(); |
615 | if (cat.isEmpty()) { | 631 | if (cat.isEmpty()) { |
616 | pal.setColor(QColorGroup::Foreground,KOPrefs::instance()->mEventColor); | 632 | pal.setColor(QColorGroup::Foreground,KOPrefs::instance()->mEventColor); |
617 | } else { | 633 | } else { |
618 | pal.setColor(QColorGroup::Foreground, *(KOPrefs::instance()->categoryColor(cat))); | 634 | pal.setColor(QColorGroup::Foreground, *(KOPrefs::instance()->categoryColor(cat))); |
619 | } | 635 | } |
620 | 636 | ||
621 | } else { | 637 | } else { |
622 | if (cat.isEmpty()) { | 638 | if (cat.isEmpty()) { |
623 | pal = QPalette(KOPrefs::instance()->mEventColor, KOPrefs::instance()->mEventColor); | 639 | pal = QPalette(KOPrefs::instance()->mEventColor, KOPrefs::instance()->mEventColor); |
624 | } else { | 640 | } else { |
625 | pal = QPalette(*(KOPrefs::instance()->categoryColor(cat)), *(KOPrefs::instance()->categoryColor(cat))); | 641 | pal = QPalette(*(KOPrefs::instance()->categoryColor(cat)), *(KOPrefs::instance()->categoryColor(cat))); |
626 | } | 642 | } |
627 | } | 643 | } |
628 | 644 | ||
629 | } else { | 645 | } else { |
@@ -640,49 +656,49 @@ void MonthViewCell::finishUpdateCell() | |||
640 | { | 656 | { |
641 | #ifdef DESKTOP_VERSION | 657 | #ifdef DESKTOP_VERSION |
642 | if (mToolTip != "") | 658 | if (mToolTip != "") |
643 | QToolTip::add(this,mToolTip,toolTipGroup(),""); | 659 | QToolTip::add(this,mToolTip,toolTipGroup(),""); |
644 | #endif | 660 | #endif |
645 | mItemList->sort(); | 661 | mItemList->sort(); |
646 | //setMyPalette(); | 662 | //setMyPalette(); |
647 | setMyPalette(); | 663 | setMyPalette(); |
648 | QString text; | 664 | QString text; |
649 | bool smallDisplay = QApplication::desktop()->width() < 320 && KOPrefs::instance()->mMonthViewSatSunTog; | 665 | bool smallDisplay = QApplication::desktop()->width() < 320 && KOPrefs::instance()->mMonthViewSatSunTog; |
650 | if ( KOPrefs::instance()->mMonthViewWeek || KOGlobals::self()->calendarSystem()->day( mDate ) == 1 || (mDate.dayOfWeek() == 7 && !smallDisplay ) || KOPrefs::instance()->mMonthShowShort) { | 666 | if ( KOPrefs::instance()->mMonthViewWeek || KOGlobals::self()->calendarSystem()->day( mDate ) == 1 || (mDate.dayOfWeek() == 7 && !smallDisplay ) || KOPrefs::instance()->mMonthShowShort) { |
651 | text = KOGlobals::self()->calendarSystem()->monthName( mDate, true ) + " "; | 667 | text = KOGlobals::self()->calendarSystem()->monthName( mDate, true ) + " "; |
652 | mLabel->resize( mLabelBigSize ); | 668 | mLabel->resize( mLabelBigSize ); |
653 | text += QString::number( KOGlobals::self()->calendarSystem()->day(mDate) ); | 669 | text += QString::number( KOGlobals::self()->calendarSystem()->day(mDate) ); |
654 | } else { | 670 | } else { |
655 | mLabel->resize( mLabelSize ); | 671 | mLabel->resize( mLabelSize ); |
656 | text += QString::number( KOGlobals::self()->calendarSystem()->day(mDate) ); | 672 | text += QString::number( KOGlobals::self()->calendarSystem()->day(mDate) ); |
657 | } | 673 | } |
658 | 674 | ||
659 | mLabel->setText( text ); | 675 | mLabel->setText( text ); |
660 | resizeEvent( 0 ); | 676 | resizeEvent( 0 ); |
661 | } | 677 | } |
662 | void MonthViewCell::updateCell() | 678 | void MonthViewCell::updateCell() |
663 | { | 679 | { |
664 | qDebug("MonthViewCell::updateCell() "); | 680 | //qDebug("MonthViewCell::updateCell() "); |
665 | if ( !mMonthView->isUpdatePossible() ) | 681 | if ( !mMonthView->isUpdatePossible() ) |
666 | return; | 682 | return; |
667 | startUpdateCell(); | 683 | startUpdateCell(); |
668 | //mLabel->setMaximumWidth( width() - mItemList->lineWidth()*2); | 684 | //mLabel->setMaximumWidth( width() - mItemList->lineWidth()*2); |
669 | QPtrList<Event> events = mMonthView->calendar()->events( mDate, true ); | 685 | QPtrList<Event> events = mMonthView->calendar()->events( mDate, true ); |
670 | Event *event; | 686 | Event *event; |
671 | for( event = events.first(); event; event = events.next() ) { // for event | 687 | for( event = events.first(); event; event = events.next() ) { // for event |
672 | insertEvent(event); | 688 | insertEvent(event); |
673 | } | 689 | } |
674 | // insert due todos | 690 | // insert due todos |
675 | QPtrList<Todo> todos = mMonthView->calendar()->todos( mDate ); | 691 | QPtrList<Todo> todos = mMonthView->calendar()->todos( mDate ); |
676 | Todo *todo; | 692 | Todo *todo; |
677 | for(todo = todos.first(); todo; todo = todos.next()) { | 693 | for(todo = todos.first(); todo; todo = todos.next()) { |
678 | insertTodo( todo ); | 694 | insertTodo( todo ); |
679 | } | 695 | } |
680 | finishUpdateCell(); | 696 | finishUpdateCell(); |
681 | // if ( isVisible()) | 697 | // if ( isVisible()) |
682 | //qApp->processEvents(); | 698 | //qApp->processEvents(); |
683 | } | 699 | } |
684 | 700 | ||
685 | void MonthViewCell::updateConfig( bool bigFont ) // = false | 701 | void MonthViewCell::updateConfig( bool bigFont ) // = false |
686 | { | 702 | { |
687 | 703 | ||
688 | if ( bigFont ) { | 704 | if ( bigFont ) { |
@@ -1197,48 +1213,49 @@ void KOMonthView::showDates(const QDate &start, const QDate &) | |||
1197 | date = date.addDays( 7 ); | 1213 | date = date.addDays( 7 ); |
1198 | } | 1214 | } |
1199 | updateView(); | 1215 | updateView(); |
1200 | } | 1216 | } |
1201 | 1217 | ||
1202 | void KOMonthView::showEvents(QPtrList<Event>) | 1218 | void KOMonthView::showEvents(QPtrList<Event>) |
1203 | { | 1219 | { |
1204 | qDebug("KOMonthView::selectEvents is not implemented yet. "); | 1220 | qDebug("KOMonthView::selectEvents is not implemented yet. "); |
1205 | } | 1221 | } |
1206 | 1222 | ||
1207 | void KOMonthView::changeEventDisplay(Event *, int) | 1223 | void KOMonthView::changeEventDisplay(Event *, int) |
1208 | { | 1224 | { |
1209 | // this should be re-written to be much more efficient, but this | 1225 | // this should be re-written to be much more efficient, but this |
1210 | // quick-and-dirty-hack gets the job done for right now. | 1226 | // quick-and-dirty-hack gets the job done for right now. |
1211 | updateView(); | 1227 | updateView(); |
1212 | } | 1228 | } |
1213 | 1229 | ||
1214 | void KOMonthView::updateView() | 1230 | void KOMonthView::updateView() |
1215 | { | 1231 | { |
1216 | 1232 | ||
1217 | if ( !updatePossible ) | 1233 | if ( !updatePossible ) |
1218 | return; | 1234 | return; |
1219 | //QTime ti; | 1235 | //QTime ti; |
1220 | //ti.start(); | 1236 | //ti.start(); |
1237 | clearSelection(); | ||
1221 | QPtrVector<MonthViewCell> *cells; | 1238 | QPtrVector<MonthViewCell> *cells; |
1222 | if ( mShowWeekView ) { | 1239 | if ( mShowWeekView ) { |
1223 | cells = &mCellsW; | 1240 | cells = &mCellsW; |
1224 | } else { | 1241 | } else { |
1225 | cells = &mCells; | 1242 | cells = &mCells; |
1226 | } | 1243 | } |
1227 | #if 1 | 1244 | #if 1 |
1228 | int i; | 1245 | int i; |
1229 | int timeSpan = (*cells).size()-1; | 1246 | int timeSpan = (*cells).size()-1; |
1230 | if ( KOPrefs::instance()->mMonthViewWeek ) | 1247 | if ( KOPrefs::instance()->mMonthViewWeek ) |
1231 | timeSpan = 6; | 1248 | timeSpan = 6; |
1232 | for( i = 0; i < timeSpan + 1; ++i ) { | 1249 | for( i = 0; i < timeSpan + 1; ++i ) { |
1233 | (*cells)[i]->startUpdateCell(); | 1250 | (*cells)[i]->startUpdateCell(); |
1234 | } | 1251 | } |
1235 | 1252 | ||
1236 | QPtrList<Event> events = calendar()->events(); | 1253 | QPtrList<Event> events = calendar()->events(); |
1237 | Event *event; | 1254 | Event *event; |
1238 | QDateTime dt; | 1255 | QDateTime dt; |
1239 | bool ok; | 1256 | bool ok; |
1240 | QDate endDate = mStartDate.addDays( timeSpan ); | 1257 | QDate endDate = mStartDate.addDays( timeSpan ); |
1241 | for( event = events.first(); event; event = events.next() ) { // for event | 1258 | for( event = events.first(); event; event = events.next() ) { // for event |
1242 | if ( event->doesRecur() ) { | 1259 | if ( event->doesRecur() ) { |
1243 | bool last; | 1260 | bool last; |
1244 | QDateTime incidenceStart = event->recurrence()->getPreviousDateTime( QDateTime( mStartDate ) , &last ); | 1261 | QDateTime incidenceStart = event->recurrence()->getPreviousDateTime( QDateTime( mStartDate ) , &last ); |
@@ -1572,99 +1589,108 @@ void KOMonthView::computeLayout() | |||
1572 | updateDayLabels(); | 1589 | updateDayLabels(); |
1573 | //bool forceUpdate = !updatePossible; | 1590 | //bool forceUpdate = !updatePossible; |
1574 | updatePossible = true; | 1591 | updatePossible = true; |
1575 | //mWeekLabels[mNumWeeks]->setText( i18n("W")); | 1592 | //mWeekLabels[mNumWeeks]->setText( i18n("W")); |
1576 | } | 1593 | } |
1577 | 1594 | ||
1578 | void KOMonthView::showContextMenu( Incidence *incidence ) | 1595 | void KOMonthView::showContextMenu( Incidence *incidence ) |
1579 | { | 1596 | { |
1580 | mContextMenu->showIncidencePopup(incidence); | 1597 | mContextMenu->showIncidencePopup(incidence); |
1581 | /* | 1598 | /* |
1582 | if( incidence && incidence->type() == "Event" ) { | 1599 | if( incidence && incidence->type() == "Event" ) { |
1583 | Event *event = static_cast<Event *>(incidence); | 1600 | Event *event = static_cast<Event *>(incidence); |
1584 | mContextMenu->showEventPopup(event); | 1601 | mContextMenu->showEventPopup(event); |
1585 | } else { | 1602 | } else { |
1586 | kdDebug() << "MonthView::showContextMenu(): cast failed." << endl; | 1603 | kdDebug() << "MonthView::showContextMenu(): cast failed." << endl; |
1587 | } | 1604 | } |
1588 | */ | 1605 | */ |
1589 | } | 1606 | } |
1590 | MonthViewCell * KOMonthView::selectedCell( ) | 1607 | MonthViewCell * KOMonthView::selectedCell( ) |
1591 | { | 1608 | { |
1592 | return mSelectedCell; | 1609 | return mSelectedCell; |
1593 | } | 1610 | } |
1594 | void KOMonthView::setSelectedCell( MonthViewCell *cell ) | 1611 | void KOMonthView::setSelectedCell( MonthViewCell *cell ) |
1595 | { | 1612 | { |
1596 | // qDebug("KOMonthView::setSelectedCell "); | 1613 | //qDebug("KOMonthView::setSelectedCell "); |
1597 | if ( mSelectedCell && mSelectedCell != cell ) { | 1614 | if ( mSelectedCell && mSelectedCell != cell ) { |
1598 | MonthViewCell * mvc = mSelectedCell; | 1615 | MonthViewCell * mvc = mSelectedCell; |
1599 | mSelectedCell = cell; | 1616 | mSelectedCell = cell; |
1600 | mvc->deselect(); | 1617 | mvc->deselect(); |
1601 | } else | 1618 | } else |
1602 | mSelectedCell = cell; | 1619 | mSelectedCell = cell; |
1603 | // if ( mSelectedCell ) | 1620 | // if ( mSelectedCell ) |
1604 | // mSelectedCell->select(); | 1621 | // mSelectedCell->select(); |
1605 | if ( !mSelectedCell ) | 1622 | if ( !mSelectedCell ) |
1606 | emit incidenceSelected( 0 ); | 1623 | emit incidenceSelected( 0 ); |
1607 | else | 1624 | else |
1608 | emit incidenceSelected( mSelectedCell->selectedIncidence() ); | 1625 | emit incidenceSelected( mSelectedCell->selectedIncidence() ); |
1609 | } | 1626 | } |
1610 | 1627 | ||
1611 | void KOMonthView::processSelectionChange() | 1628 | void KOMonthView::processSelectionChange() |
1612 | { | 1629 | { |
1613 | QPtrList<Incidence> incidences = selectedIncidences(); | 1630 | QPtrList<Incidence> incidences = selectedIncidences(); |
1614 | if (incidences.count() > 0) { | 1631 | if (incidences.count() > 0) { |
1615 | emit incidenceSelected( incidences.first() ); | 1632 | emit incidenceSelected( incidences.first() ); |
1616 | } else { | 1633 | } else { |
1617 | emit incidenceSelected( 0 ); | 1634 | emit incidenceSelected( 0 ); |
1635 | clearSelection(); | ||
1618 | } | 1636 | } |
1619 | } | 1637 | } |
1620 | 1638 | ||
1621 | void KOMonthView::clearSelection() | 1639 | void KOMonthView::clearSelection() |
1622 | { | 1640 | { |
1623 | if ( mSelectedCell ) { | 1641 | if ( mSelectedCell ) { |
1624 | mSelectedCell->deselect(); | 1642 | mSelectedCell->deselect(); |
1625 | mSelectedCell = 0; | 1643 | mSelectedCell = 0; |
1626 | } | 1644 | } |
1627 | } | 1645 | } |
1628 | void KOMonthView::keyPressEvent ( QKeyEvent * e ) | 1646 | void KOMonthView::keyPressEvent ( QKeyEvent * e ) |
1629 | { | 1647 | { |
1630 | //qDebug("KOMonthView::keyPressEvent "); | 1648 | //qDebug("KOMonthView::keyPressEvent "); |
1631 | switch(e->key()) { | 1649 | switch(e->key()) { |
1632 | case Key_Up: | 1650 | case Key_Up: |
1633 | { | 1651 | { |
1634 | if ( mShowWeekView ) { | 1652 | if ( mShowWeekView ) { |
1635 | mCellsW[0]->setFocus(); | 1653 | mCellsW[0]->setFocus(); |
1636 | emit selectWeekNum ( currentWeek() - 1 ); | 1654 | emit selectWeekNum ( currentWeek() - 1 ); |
1637 | } | 1655 | } |
1638 | else { | 1656 | else { |
1639 | mCells[0]->setFocus(); | 1657 | mCells[0]->setFocus(); |
1640 | emit prevMonth(); | 1658 | emit prevMonth(); |
1641 | } | 1659 | } |
1642 | } | 1660 | } |
1643 | e->accept(); | 1661 | e->accept(); |
1644 | break; | 1662 | break; |
1645 | case Key_Down: | 1663 | case Key_Down: |
1646 | { | 1664 | { |
1647 | if ( mShowWeekView ) { | 1665 | if ( mShowWeekView ) { |
1648 | mCellsW[0]->setFocus(); | 1666 | mCellsW[0]->setFocus(); |
1649 | emit selectWeekNum ( currentWeek() +1); | 1667 | emit selectWeekNum ( currentWeek() +1); |
1650 | } | 1668 | } |
1651 | else { | 1669 | else { |
1652 | mCells[0]->setFocus(); | 1670 | mCells[0]->setFocus(); |
1653 | emit nextMonth(); | 1671 | emit nextMonth(); |
1654 | } | 1672 | } |
1655 | 1673 | ||
1656 | } | 1674 | } |
1657 | e->accept(); | 1675 | e->accept(); |
1658 | break; | 1676 | break; |
1659 | case Key_Return: | 1677 | case Key_Return: |
1660 | case Key_Enter: | 1678 | case Key_Enter: |
1661 | { | 1679 | { |
1662 | selectInternalWeekNum ( currentWeek() ); | 1680 | selectInternalWeekNum ( currentWeek() ); |
1663 | } | 1681 | } |
1664 | e->accept(); | 1682 | e->accept(); |
1665 | break; | 1683 | break; |
1684 | case Key_D: | ||
1685 | if ( mSelectedCell ) { | ||
1686 | mSelectedCell->showDay(); | ||
1687 | e->accept(); | ||
1688 | } else { | ||
1689 | e->ignore(); | ||
1690 | } | ||
1691 | break; | ||
1666 | default: | 1692 | default: |
1667 | e->ignore(); | 1693 | e->ignore(); |
1668 | break; | 1694 | break; |
1669 | } | 1695 | } |
1670 | } | 1696 | } |
diff --git a/korganizer/komonthview.h b/korganizer/komonthview.h index f92a69a..fd8cbf2 100644 --- a/korganizer/komonthview.h +++ b/korganizer/komonthview.h | |||
@@ -149,55 +149,58 @@ class MonthViewCell : public QWidget | |||
149 | void insertTodo(Todo *); | 149 | void insertTodo(Todo *); |
150 | 150 | ||
151 | void updateConfig( bool bigFont = false ); | 151 | void updateConfig( bool bigFont = false ); |
152 | 152 | ||
153 | void enableScrollBars( bool ); | 153 | void enableScrollBars( bool ); |
154 | 154 | ||
155 | Incidence *selectedIncidence(); | 155 | Incidence *selectedIncidence(); |
156 | QDate selectedIncidenceDate(); | 156 | QDate selectedIncidenceDate(); |
157 | 157 | ||
158 | void deselect(); | 158 | void deselect(); |
159 | void select(); | 159 | void select(); |
160 | 160 | ||
161 | #ifdef DESKTOP_VERSION | 161 | #ifdef DESKTOP_VERSION |
162 | static QToolTipGroup *toolTipGroup(); | 162 | static QToolTipGroup *toolTipGroup(); |
163 | #endif | 163 | #endif |
164 | signals: | 164 | signals: |
165 | void defaultAction( Incidence * ); | 165 | void defaultAction( Incidence * ); |
166 | void newEventSignal( QDateTime ); | 166 | void newEventSignal( QDateTime ); |
167 | void showDaySignal( QDate ); | 167 | void showDaySignal( QDate ); |
168 | 168 | ||
169 | protected: | 169 | protected: |
170 | QString mToolTip; | 170 | QString mToolTip; |
171 | void resizeEvent( QResizeEvent * ); | 171 | void resizeEvent( QResizeEvent * ); |
172 | 172 | ||
173 | |||
174 | public slots: | ||
175 | void showDay(); | ||
176 | |||
173 | protected slots: | 177 | protected slots: |
174 | void defaultAction( QListBoxItem * ); | 178 | void defaultAction( QListBoxItem * ); |
175 | void contextMenu( QListBoxItem * ); | 179 | void contextMenu( QListBoxItem * ); |
176 | void selection( QListBoxItem * ); | 180 | void selection( QListBoxItem * ); |
177 | void cellClicked( QListBoxItem * ); | 181 | void cellClicked( QListBoxItem * ); |
178 | void newEvent(); | 182 | void newEvent(); |
179 | void showDay(); | ||
180 | 183 | ||
181 | private: | 184 | private: |
182 | KOMonthView *mMonthView; | 185 | KOMonthView *mMonthView; |
183 | 186 | ||
184 | QDate mDate; | 187 | QDate mDate; |
185 | bool mPrimary; | 188 | bool mPrimary; |
186 | bool mHoliday; | 189 | bool mHoliday; |
187 | QString mHolidayString; | 190 | QString mHolidayString; |
188 | 191 | ||
189 | //QLabel *mLabel; | 192 | //QLabel *mLabel; |
190 | QPushButton *mLabel; | 193 | QPushButton *mLabel; |
191 | QListBox *mItemList; | 194 | QListBox *mItemList; |
192 | #ifdef DESKTOP_VERSION | 195 | #ifdef DESKTOP_VERSION |
193 | static QToolTipGroup *mToolTipGroup; | 196 | static QToolTipGroup *mToolTipGroup; |
194 | #endif | 197 | #endif |
195 | QSize mLabelSize; | 198 | QSize mLabelSize; |
196 | QSize mLabelBigSize; | 199 | QSize mLabelBigSize; |
197 | QPalette mHolidayPalette; | 200 | QPalette mHolidayPalette; |
198 | QPalette mStandardPalette; | 201 | QPalette mStandardPalette; |
199 | QPalette mPrimaryPalette; | 202 | QPalette mPrimaryPalette; |
200 | QPalette mNonPrimaryPalette; | 203 | QPalette mNonPrimaryPalette; |
201 | void setMyPalette(); | 204 | void setMyPalette(); |
202 | QPalette getPalette (); | 205 | QPalette getPalette (); |
203 | void keyPressEvent ( QKeyEvent * ) ; | 206 | void keyPressEvent ( QKeyEvent * ) ; |