summaryrefslogtreecommitdiffabout
path: root/korganizer
authorzautrix <zautrix>2005-01-11 15:48:26 (UTC)
committer zautrix <zautrix>2005-01-11 15:48:26 (UTC)
commitff808c2b4cd2751e7f99dd7cb5c1e44886ac151f (patch) (unidiff)
tree7cd2fdcfea35ca54b94aff1b113c92482a904fae /korganizer
parent7738615474fd5186928e3f4dcdc58b483f7ad1a9 (diff)
downloadkdepimpi-ff808c2b4cd2751e7f99dd7cb5c1e44886ac151f.zip
kdepimpi-ff808c2b4cd2751e7f99dd7cb5c1e44886ac151f.tar.gz
kdepimpi-ff808c2b4cd2751e7f99dd7cb5c1e44886ac151f.tar.bz2
tooltips added
Diffstat (limited to 'korganizer') (more/less context) (ignore whitespace changes)
-rw-r--r--korganizer/komonthview.cpp40
-rw-r--r--korganizer/komonthview.h11
2 files changed, 45 insertions, 6 deletions
diff --git a/korganizer/komonthview.cpp b/korganizer/komonthview.cpp
index 08232e2..9344567 100644
--- a/korganizer/komonthview.cpp
+++ b/korganizer/komonthview.cpp
@@ -33,79 +33,81 @@
33#include <qapplication.h> 33#include <qapplication.h>
34#endif 34#endif
35 35
36#include <kdebug.h> 36#include <kdebug.h>
37#include <klocale.h> 37#include <klocale.h>
38#include <kglobal.h> 38#include <kglobal.h>
39#include <kconfig.h> 39#include <kconfig.h>
40#include <kiconloader.h> 40#include <kiconloader.h>
41 41
42#include <kcalendarsystem.h> 42#include <kcalendarsystem.h>
43 43
44#ifndef KORG_NOPRINTER 44#ifndef KORG_NOPRINTER
45#include "calprinter.h" 45#include "calprinter.h"
46#endif 46#endif
47#include "koprefs.h" 47#include "koprefs.h"
48#ifndef KORG_NOPLUGINS 48#ifndef KORG_NOPLUGINS
49#include "kocore.h" 49#include "kocore.h"
50#endif 50#endif
51#include "koglobals.h" 51#include "koglobals.h"
52#include <libkcal/kincidenceformatter.h> 52#include <libkcal/kincidenceformatter.h>
53 53
54#include "komonthview.h" 54#include "komonthview.h"
55 55
56#define PIXMAP_SIZE 5 56#define PIXMAP_SIZE 5
57 57#ifdef DESKTOP_VERSION
58 QToolTipGroup *MonthViewCell::mToolTipGroup = 0;
59#endif
58class KNOWhatsThis :public QWhatsThis 60class KNOWhatsThis :public QWhatsThis
59{ 61{
60public: 62public:
61 KNOWhatsThis( KNoScrollListBox* sbox ) : QWhatsThis( sbox ), _wid( sbox) { }; 63 KNOWhatsThis( KNoScrollListBox* sbox ) : QWhatsThis( sbox ), _wid( sbox) { };
62 64
63protected: 65protected:
64 virtual QString text( const QPoint& p) 66 virtual QString text( const QPoint& p)
65 { 67 {
66 return _wid->getWhatsThisText(p) ; 68 return _wid->getWhatsThisText(p) ;
67 }; 69 };
68private: 70private:
69 KNoScrollListBox* _wid; 71 KNoScrollListBox* _wid;
70 72
71}; 73};
72 74
73 75
74KNoScrollListBox::KNoScrollListBox(QWidget *parent,const char *name) 76KNoScrollListBox::KNoScrollListBox(QWidget *parent,const char *name)
75 : QListBox(parent, name) 77 : QListBox(parent, name)
76{ 78{
77#ifndef DESKTOP_VERSION 79#ifndef DESKTOP_VERSION
78 QPEApplication::setStylusOperation( viewport(), QPEApplication::RightOnHold ); 80 QPEApplication::setStylusOperation( viewport(), QPEApplication::RightOnHold );
79#endif 81#endif
80 new KNOWhatsThis(this); 82 new KNOWhatsThis(this);
81} 83}
82 84
83QString KNoScrollListBox::getWhatsThisText(QPoint p) 85QString KNoScrollListBox::getWhatsThisText(QPoint p)
84{ 86{
85 QListBoxItem* item = itemAt ( p ); 87 QListBoxItem* item = itemAt ( p );
86 if ( ! item ) { 88 if ( ! item ) {
87 return i18n("Click in the cell or\non the date label\nto add an event!"); 89 return i18n("Click in the cell\nto add an event!");
88 } 90 }
89 return KIncidenceFormatter::instance()->getFormattedText(((MonthViewItem*) item)->incidence()); 91 return KIncidenceFormatter::instance()->getFormattedText(((MonthViewItem*) item)->incidence());
90} 92}
91void KNoScrollListBox::keyPressEvent(QKeyEvent *e) 93void KNoScrollListBox::keyPressEvent(QKeyEvent *e)
92{ 94{
93 95
94 switch(e->key()) { 96 switch(e->key()) {
95 case Key_Right: 97 case Key_Right:
96 // if ( e->state() == Qt::ControlButton ) 98 // if ( e->state() == Qt::ControlButton )
97 { 99 {
98 e->ignore(); 100 e->ignore();
99 return; 101 return;
100 } 102 }
101 scrollBy(4,0); 103 scrollBy(4,0);
102 break; 104 break;
103 case Key_Left: 105 case Key_Left:
104 // if ( e->state() == Qt::ControlButton ) 106 // if ( e->state() == Qt::ControlButton )
105 { 107 {
106 e->ignore(); 108 e->ignore();
107 return; 109 return;
108 } 110 }
109 scrollBy(-4,0); 111 scrollBy(-4,0);
110 break; 112 break;
111 case Key_Up: 113 case Key_Up:
@@ -274,49 +276,56 @@ MonthViewCell::MonthViewCell( KOMonthView *parent)
274 mItemList->setFrameStyle( QFrame::Panel | QFrame::Plain ); 276 mItemList->setFrameStyle( QFrame::Panel | QFrame::Plain );
275 mItemList->setLineWidth( 1 ); 277 mItemList->setLineWidth( 1 );
276 topLayout->addWidget( mItemList ); 278 topLayout->addWidget( mItemList );
277 mLabel->raise(); 279 mLabel->raise();
278 // QColor( 0,0,255 ) QColor( 160,1600,255 ) 280 // QColor( 0,0,255 ) QColor( 160,1600,255 )
279 mStandardPalette = palette(); 281 mStandardPalette = palette();
280 mStandardPalette.setColor(QColorGroup::Base, mStandardPalette.color( QPalette::Normal, QColorGroup::Background ) ); 282 mStandardPalette.setColor(QColorGroup::Base, mStandardPalette.color( QPalette::Normal, QColorGroup::Background ) );
281 283
282 enableScrollBars( false ); 284 enableScrollBars( false );
283 updateConfig(); 285 updateConfig();
284 //connect( mLabel, SIGNAL( clicked( )), SLOT( newEvent() )); 286 //connect( mLabel, SIGNAL( clicked( )), SLOT( newEvent() ));
285 connect( mLabel, SIGNAL( clicked( )), SLOT( showDay() )); 287 connect( mLabel, SIGNAL( clicked( )), SLOT( showDay() ));
286 connect( mItemList, SIGNAL( doubleClicked( QListBoxItem *) ), 288 connect( mItemList, SIGNAL( doubleClicked( QListBoxItem *) ),
287 SLOT( defaultAction( QListBoxItem * ) ) ); 289 SLOT( defaultAction( QListBoxItem * ) ) );
288 connect( mItemList, SIGNAL( rightButtonPressed( QListBoxItem *, 290 connect( mItemList, SIGNAL( rightButtonPressed( QListBoxItem *,
289 const QPoint &) ), 291 const QPoint &) ),
290 SLOT( contextMenu( QListBoxItem * ) ) ); 292 SLOT( contextMenu( QListBoxItem * ) ) );
291 connect( mItemList, SIGNAL( highlighted( QListBoxItem *) ), 293 connect( mItemList, SIGNAL( highlighted( QListBoxItem *) ),
292 SLOT( selection( QListBoxItem * ) ) ); 294 SLOT( selection( QListBoxItem * ) ) );
293 connect( mItemList, SIGNAL( clicked( QListBoxItem * ) ), 295 connect( mItemList, SIGNAL( clicked( QListBoxItem * ) ),
294 SLOT( cellClicked( QListBoxItem * ) ) ); 296 SLOT( cellClicked( QListBoxItem * ) ) );
295 connect( mItemList, SIGNAL( clicked( QListBoxItem * ) ), 297 connect( mItemList, SIGNAL( clicked( QListBoxItem * ) ),
296 SLOT( selection( QListBoxItem * ) ) ); 298 SLOT( selection( QListBoxItem * ) ) );
297} 299}
298 300#ifdef DESKTOP_VERSION
301QToolTipGroup *MonthViewCell::toolTipGroup()
302{
303 if (!mToolTipGroup) mToolTipGroup = new QToolTipGroup(0);
304 return mToolTipGroup;
305}
306#endif
307
299void MonthViewCell::setDate( const QDate &date ) 308void MonthViewCell::setDate( const QDate &date )
300{ 309{
301// kdDebug() << "MonthViewCell::setDate(): " << date.toString() << endl; 310// kdDebug() << "MonthViewCell::setDate(): " << date.toString() << endl;
302 311
303 mDate = date; 312 mDate = date;
304 313
305 QString text; 314 QString text;
306 bool smallDisplay = QApplication::desktop()->width() < 320 && KOPrefs::instance()->mMonthViewSatSunTog; 315 bool smallDisplay = QApplication::desktop()->width() < 320 && KOPrefs::instance()->mMonthViewSatSunTog;
307 if ( KOGlobals::self()->calendarSystem()->day( date ) == 1 || (date.dayOfWeek() == 7 && !smallDisplay ) || KOPrefs::instance()->mMonthShowShort) { 316 if ( KOGlobals::self()->calendarSystem()->day( date ) == 1 || (date.dayOfWeek() == 7 && !smallDisplay ) || KOPrefs::instance()->mMonthShowShort) {
308 text = KOGlobals::self()->calendarSystem()->monthName( date, true ) + " "; 317 text = KOGlobals::self()->calendarSystem()->monthName( date, true ) + " ";
309 mLabel->resize( mLabelBigSize ); 318 mLabel->resize( mLabelBigSize );
310 text += QString::number( KOGlobals::self()->calendarSystem()->day(mDate) ); 319 text += QString::number( KOGlobals::self()->calendarSystem()->day(mDate) );
311 } else { 320 } else {
312 mLabel->resize( mLabelSize ); 321 mLabel->resize( mLabelSize );
313 text += QString::number( KOGlobals::self()->calendarSystem()->day(mDate) ); 322 text += QString::number( KOGlobals::self()->calendarSystem()->day(mDate) );
314 } 323 }
315 mLabel->setText( text ); 324 mLabel->setText( text );
316 325
317 //resizeEvent( 0 ); 326 //resizeEvent( 0 );
318} 327}
319 328
320QDate MonthViewCell::date() const 329QDate MonthViewCell::date() const
321{ 330{
322 return mDate; 331 return mDate;
@@ -371,90 +380,99 @@ void MonthViewCell::setHoliday( const QString &holiday )
371{ 380{
372 mHolidayString = holiday; 381 mHolidayString = holiday;
373 382
374 if ( !holiday.isEmpty() ) { 383 if ( !holiday.isEmpty() ) {
375 setHoliday( true ); 384 setHoliday( true );
376 } 385 }
377} 386}
378void MonthViewCell::keyPressEvent ( QKeyEvent * e ) 387void MonthViewCell::keyPressEvent ( QKeyEvent * e )
379{ 388{
380 389
381 e->ignore(); 390 e->ignore();
382 391
383} 392}
384void MonthViewCell::updateCell() 393void MonthViewCell::updateCell()
385{ 394{
386 395
387 setPrimary( mDate.month()%2 ); 396 setPrimary( mDate.month()%2 );
388 setHoliday( KOGlobals::self()->calendarSystem()->dayOfWeek(mDate) == KOGlobals::self()->calendarSystem()->weekDayOfPray() || ( mDate.dayOfWeek() == 6 ) && KOPrefs::instance()-> mExcludeSaturdays); 397 setHoliday( KOGlobals::self()->calendarSystem()->dayOfWeek(mDate) == KOGlobals::self()->calendarSystem()->weekDayOfPray() || ( mDate.dayOfWeek() == 6 ) && KOPrefs::instance()-> mExcludeSaturdays);
389 if ( mDate == QDate::currentDate() ) { 398 if ( mDate == QDate::currentDate() ) {
390 mItemList->setLineWidth( 3 ); 399 mItemList->setLineWidth( 3 );
391 } else { 400 } else {
392 mItemList->setLineWidth( 1 ); 401 mItemList->setLineWidth( 1 );
393 } 402 }
394 mItemList->clear(); 403 mItemList->clear();
404#ifdef DESKTOP_VERSION
405 QToolTip::remove(this);
406#endif
407 QString tipText("");
395 //qApp->processEvents(); 408 //qApp->processEvents();
396 if ( !mHolidayString.isEmpty() ) { 409 if ( !mHolidayString.isEmpty() ) {
397 MonthViewItem *item = new MonthViewItem( 0, mDate, mHolidayString ); 410 MonthViewItem *item = new MonthViewItem( 0, mDate, mHolidayString );
398 item->setPalette( mHolidayPalette ); 411 item->setPalette( mHolidayPalette );
399 mItemList->insertItem( item ); 412 mItemList->insertItem( item );
413 tipText += mHolidayString+"\n";
400 } 414 }
401 //mLabel->setMaximumWidth( width() - mItemList->lineWidth()*2); 415 //mLabel->setMaximumWidth( width() - mItemList->lineWidth()*2);
402 QPtrList<Event> events = mMonthView->calendar()->events( mDate, true ); 416 QPtrList<Event> events = mMonthView->calendar()->events( mDate, true );
403 Event *event; 417 Event *event;
404 for( event = events.first(); event; event = events.next() ) { 418 for( event = events.first(); event; event = events.next() ) {
405 if ( event->categories().contains("Holiday") || 419 if ( event->categories().contains("Holiday") ||
406 event->categories().contains(i18n("Holiday"))) { 420 event->categories().contains(i18n("Holiday"))) {
407 setHoliday( true ); 421 setHoliday( true );
408 if ( mDate.dayOfWeek() == 7 ) 422 if ( mDate.dayOfWeek() == 7 )
409 mItemList->setLineWidth( 3 ); 423 mItemList->setLineWidth( 3 );
410 } 424 }
411 QString text; 425 QString text;
412 if (event->isMultiDay()) { 426 if (event->isMultiDay()) {
413 QString prefix = "<->"; 427 QString prefix = "<->";
414 if ( event->doesRecur() ) { 428 if ( event->doesRecur() ) {
415 if ( event->recursOn( mDate) ) 429 if ( event->recursOn( mDate) )
416 prefix ="->" ; 430 prefix ="->" ;
417 else { 431 else {
418 int days = event->dtStart().date().daysTo ( event->dtEnd().date() ); 432 int days = event->dtStart().date().daysTo ( event->dtEnd().date() );
419 if ( event->recursOn( mDate.addDays( -days)) ) 433 if ( event->recursOn( mDate.addDays( -days)) )
420 prefix ="<-" ; 434 prefix ="<-" ;
421 } 435 }
422 436
423 } else { 437 } else {
424 if (mDate == event->dtStart().date()) { 438 if (mDate == event->dtStart().date()) {
425 prefix ="->" ; 439 prefix ="->" ;
426 } else if (mDate == event->dtEnd().date()) { 440 } else if (mDate == event->dtEnd().date()) {
427 prefix ="<-" ; 441 prefix ="<-" ;
428 } 442 }
429 } 443 }
430 text = prefix + event->summary(); 444 text = prefix + event->summary();
445 tipText += text;
431 } else { 446 } else {
432 if (event->doesFloat()) 447 if (event->doesFloat()) {
433 text = event->summary(); 448 text = event->summary();
449 tipText += text;
450 }
434 else { 451 else {
435 text = KGlobal::locale()->formatTime(event->dtStart().time()); 452 text = KGlobal::locale()->formatTime(event->dtStart().time());
436 text += " " + event->summary(); 453 text += " " + event->summary();
454 tipText += KGlobal::locale()->formatTime(event->dtStart().time()) +"-"+KGlobal::locale()->formatTime(event->dtEnd().time())+" " + event->summary();
437 } 455 }
438 } 456 }
439 457
440 MonthViewItem *item = new MonthViewItem( event, mDate, text ); 458 MonthViewItem *item = new MonthViewItem( event, mDate, text );
441 QPalette pal; 459 QPalette pal;
442 if (KOPrefs::instance()->mMonthViewUsesCategoryColor) { 460 if (KOPrefs::instance()->mMonthViewUsesCategoryColor) {
443 QStringList categories = event->categories(); 461 QStringList categories = event->categories();
444 QString cat = categories.first(); 462 QString cat = categories.first();
445 if ( KOPrefs::instance()->mMonthViewUsesForegroundColor ) { 463 if ( KOPrefs::instance()->mMonthViewUsesForegroundColor ) {
446 pal = getPalette(); 464 pal = getPalette();
447 if (cat.isEmpty()) { 465 if (cat.isEmpty()) {
448 pal.setColor(QColorGroup::Foreground,KOPrefs::instance()->mEventColor); 466 pal.setColor(QColorGroup::Foreground,KOPrefs::instance()->mEventColor);
449 } else { 467 } else {
450 pal.setColor(QColorGroup::Foreground, *(KOPrefs::instance()->categoryColor(cat))); 468 pal.setColor(QColorGroup::Foreground, *(KOPrefs::instance()->categoryColor(cat)));
451 } 469 }
452 470
453 } else { 471 } else {
454 if (cat.isEmpty()) { 472 if (cat.isEmpty()) {
455 pal = QPalette(KOPrefs::instance()->mEventColor, KOPrefs::instance()->mEventColor); 473 pal = QPalette(KOPrefs::instance()->mEventColor, KOPrefs::instance()->mEventColor);
456 } else { 474 } else {
457 pal = QPalette(*(KOPrefs::instance()->categoryColor(cat)), *(KOPrefs::instance()->categoryColor(cat))); 475 pal = QPalette(*(KOPrefs::instance()->categoryColor(cat)), *(KOPrefs::instance()->categoryColor(cat)));
458 } 476 }
459 } 477 }
460 478
@@ -462,93 +480,102 @@ void MonthViewCell::updateCell()
462 pal = mStandardPalette ; 480 pal = mStandardPalette ;
463 } 481 }
464 item->setPalette( pal ); 482 item->setPalette( pal );
465 item->setRecur( event->recurrence()->doesRecur() ); 483 item->setRecur( event->recurrence()->doesRecur() );
466 item->setAlarm( event->isAlarmEnabled() ); 484 item->setAlarm( event->isAlarmEnabled() );
467 item->setMoreInfo( event->description().length() > 0 ); 485 item->setMoreInfo( event->description().length() > 0 );
468 Attendee *me = event->attendeeByMails(KOPrefs::instance()->mAdditionalMails, 486 Attendee *me = event->attendeeByMails(KOPrefs::instance()->mAdditionalMails,
469 KOPrefs::instance()->email()); 487 KOPrefs::instance()->email());
470 if ( me != 0 ) { 488 if ( me != 0 ) {
471 if ( me->status() == Attendee::NeedsAction && me->RSVP()) 489 if ( me->status() == Attendee::NeedsAction && me->RSVP())
472 item->setReply(true); 490 item->setReply(true);
473 else 491 else
474 item->setReply(false); 492 item->setReply(false);
475 } else 493 } else
476 item->setReply(false); 494 item->setReply(false);
477 bool insert = true; 495 bool insert = true;
478 if ( !(event->doesRecur() == Recurrence::rNone) ) { 496 if ( !(event->doesRecur() == Recurrence::rNone) ) {
479 if ( !KOPrefs::instance()->mMonthDailyRecur && event->doesRecur() == Recurrence::rDaily ) 497 if ( !KOPrefs::instance()->mMonthDailyRecur && event->doesRecur() == Recurrence::rDaily )
480 insert = false; 498 insert = false;
481 else 499 else
482 if ( !KOPrefs::instance()->mMonthWeeklyRecur && event->doesRecur() == Recurrence::rWeekly ) 500 if ( !KOPrefs::instance()->mMonthWeeklyRecur && event->doesRecur() == Recurrence::rWeekly )
483 insert = false; 501 insert = false;
484 502
485 } 503 }
486 if ( insert ) 504 if ( insert ) {
487 mItemList->insertItem( item ); 505 mItemList->insertItem( item );
506 tipText += "\n";
507 } else
508 tipText = "";
488 } 509 }
489 510
490 // insert due todos 511 // insert due todos
491 QPtrList<Todo> todos = mMonthView->calendar()->todos( mDate ); 512 QPtrList<Todo> todos = mMonthView->calendar()->todos( mDate );
492 Todo *todo; 513 Todo *todo;
493 for(todo = todos.first(); todo; todo = todos.next()) { 514 for(todo = todos.first(); todo; todo = todos.next()) {
494 QString text; 515 QString text;
495 if (todo->hasDueDate()) { 516 if (todo->hasDueDate()) {
496 if (!todo->doesFloat()) { 517 if (!todo->doesFloat()) {
497 text += KGlobal::locale()->formatTime(todo->dtDue().time()); 518 text += KGlobal::locale()->formatTime(todo->dtDue().time());
498 text += " "; 519 text += " ";
499 } 520 }
500 } 521 }
501 text += i18n("To-Do: %1").arg(todo->summary()); 522 text += i18n("To-Do: %1").arg(todo->summary());
502 523
503 MonthViewItem *item = new MonthViewItem( todo, mDate, text ); 524 MonthViewItem *item = new MonthViewItem( todo, mDate, text );
504 //item->setPalette( mStandardPalette ); 525 //item->setPalette( mStandardPalette );
505 QPalette pal; 526 QPalette pal;
506 if (KOPrefs::instance()->mMonthViewUsesCategoryColor) { 527 if (KOPrefs::instance()->mMonthViewUsesCategoryColor) {
507 QStringList categories = todo->categories(); 528 QStringList categories = todo->categories();
508 QString cat = categories.first(); 529 QString cat = categories.first();
509 if ( KOPrefs::instance()->mMonthViewUsesForegroundColor ) { 530 if ( KOPrefs::instance()->mMonthViewUsesForegroundColor ) {
510 pal = getPalette(); 531 pal = getPalette();
511 if (cat.isEmpty()) { 532 if (cat.isEmpty()) {
512 pal.setColor(QColorGroup::Foreground,KOPrefs::instance()->mEventColor); 533 pal.setColor(QColorGroup::Foreground,KOPrefs::instance()->mEventColor);
513 } else { 534 } else {
514 pal.setColor(QColorGroup::Foreground, *(KOPrefs::instance()->categoryColor(cat))); 535 pal.setColor(QColorGroup::Foreground, *(KOPrefs::instance()->categoryColor(cat)));
515 } 536 }
516 537
517 } else { 538 } else {
518 if (cat.isEmpty()) { 539 if (cat.isEmpty()) {
519 pal = QPalette(KOPrefs::instance()->mEventColor, KOPrefs::instance()->mEventColor); 540 pal = QPalette(KOPrefs::instance()->mEventColor, KOPrefs::instance()->mEventColor);
520 } else { 541 } else {
521 pal = QPalette(*(KOPrefs::instance()->categoryColor(cat)), *(KOPrefs::instance()->categoryColor(cat))); 542 pal = QPalette(*(KOPrefs::instance()->categoryColor(cat)), *(KOPrefs::instance()->categoryColor(cat)));
522 } 543 }
523 } 544 }
524 545
525 } else { 546 } else {
526 pal = mStandardPalette ; 547 pal = mStandardPalette ;
527 } 548 }
528 item->setPalette( pal ); 549 item->setPalette( pal );
529 mItemList->insertItem( item ); 550 mItemList->insertItem( item );
551 tipText += text+"\n";
530 } 552 }
553#ifdef DESKTOP_VERSION
554 if (tipText != "")
555 QToolTip::add(this,tipText,toolTipGroup(),"");
556#endif
557
531 //setMyPalette(); 558 //setMyPalette();
532 setMyPalette(); 559 setMyPalette();
533 resizeEvent( 0 ); 560 resizeEvent( 0 );
534 // if ( isVisible()) 561 // if ( isVisible())
535 // qApp->processEvents(); 562 // qApp->processEvents();
536} 563}
537 564
538void MonthViewCell::updateConfig() 565void MonthViewCell::updateConfig()
539{ 566{
540 567
541 setFont( KOPrefs::instance()->mMonthViewFont ); 568 setFont( KOPrefs::instance()->mMonthViewFont );
542 569
543 QFontMetrics fm( font() ); 570 QFontMetrics fm( font() );
544 mLabelSize = fm.size( 0, "30" ) + QSize( 4, 2 ); 571 mLabelSize = fm.size( 0, "30" ) + QSize( 4, 2 );
545 mLabelBigSize = fm.size( 0, "Mag 30" ) + QSize( 2, 2 ); 572 mLabelBigSize = fm.size( 0, "Mag 30" ) + QSize( 2, 2 );
546 mHolidayPalette = mStandardPalette; 573 mHolidayPalette = mStandardPalette;
547 mPrimaryPalette = mStandardPalette; 574 mPrimaryPalette = mStandardPalette;
548 mNonPrimaryPalette = mStandardPalette; 575 mNonPrimaryPalette = mStandardPalette;
549 if ( KOPrefs::instance()->mMonthViewUsesDayColors ) { 576 if ( KOPrefs::instance()->mMonthViewUsesDayColors ) {
550 mHolidayPalette.setColor(QColorGroup::Base, KOPrefs::instance()->mMonthViewHolidayColor ); 577 mHolidayPalette.setColor(QColorGroup::Base, KOPrefs::instance()->mMonthViewHolidayColor );
551 mHolidayPalette.setColor(QColorGroup::Background, KOPrefs::instance()->mMonthViewHolidayColor ); 578 mHolidayPalette.setColor(QColorGroup::Background, KOPrefs::instance()->mMonthViewHolidayColor );
552 mHolidayPalette.setColor(QColorGroup::Foreground, KOPrefs::instance()->mMonthViewHolidayColor.dark()); 579 mHolidayPalette.setColor(QColorGroup::Foreground, KOPrefs::instance()->mMonthViewHolidayColor.dark());
553 mPrimaryPalette.setColor(QColorGroup::Foreground,KOPrefs::instance()->mMonthViewOddColor.dark()); 580 mPrimaryPalette.setColor(QColorGroup::Foreground,KOPrefs::instance()->mMonthViewOddColor.dark());
554 mPrimaryPalette.setColor(QColorGroup::Base,KOPrefs::instance()->mMonthViewOddColor); 581 mPrimaryPalette.setColor(QColorGroup::Base,KOPrefs::instance()->mMonthViewOddColor);
@@ -793,48 +820,51 @@ void KOMonthView::printPreview(CalPrinter *calPrinter, const QDate &fd,
793 820
794void KOMonthView::updateConfig() 821void KOMonthView::updateConfig()
795{ 822{
796 823
797 mWeekStartsMonday = KGlobal::locale()->weekStartsMonday(); 824 mWeekStartsMonday = KGlobal::locale()->weekStartsMonday();
798 825
799 QFontMetrics fontmetric(mDayLabels[0]->font()); 826 QFontMetrics fontmetric(mDayLabels[0]->font());
800 mWidthLongDayLabel = 0; 827 mWidthLongDayLabel = 0;
801 828
802 for (int i = 0; i < 7; i++) { 829 for (int i = 0; i < 7; i++) {
803 int width = fontmetric.width(KOGlobals::self()->calendarSystem()->weekDayName(i+1)); 830 int width = fontmetric.width(KOGlobals::self()->calendarSystem()->weekDayName(i+1));
804 if ( width > mWidthLongDayLabel ) mWidthLongDayLabel = width; 831 if ( width > mWidthLongDayLabel ) mWidthLongDayLabel = width;
805 } 832 }
806 bool temp = mShowSatSunComp ; 833 bool temp = mShowSatSunComp ;
807 mShowSatSunComp = KOPrefs::instance()->mMonthViewSatSunTog ; 834 mShowSatSunComp = KOPrefs::instance()->mMonthViewSatSunTog ;
808 if ( temp != KOPrefs::instance()->mMonthViewSatSunTog ) 835 if ( temp != KOPrefs::instance()->mMonthViewSatSunTog )
809 computeLayout(); 836 computeLayout();
810 updateDayLabels(); 837 updateDayLabels();
811 //qDebug("KOMonthView::updateConfig() %d %d %d ",height(), mDayLabels[0]->sizeHint().height() ,mNumWeeks); 838 //qDebug("KOMonthView::updateConfig() %d %d %d ",height(), mDayLabels[0]->sizeHint().height() ,mNumWeeks);
812 int cellHeight = (height() - mDayLabels[0]->sizeHint().height()) /mNumWeeks; 839 int cellHeight = (height() - mDayLabels[0]->sizeHint().height()) /mNumWeeks;
813 //resizeEvent( 0 ); 840 //resizeEvent( 0 );
814 for (uint i = 0; i < mCells.count(); ++i) { 841 for (uint i = 0; i < mCells.count(); ++i) {
815 mCells[i]->updateConfig(); 842 mCells[i]->updateConfig();
816 } 843 }
844#ifdef DESKTOP_VERSION
845 MonthViewCell::toolTipGroup()->setEnabled(KOPrefs::instance()->mEnableToolTips);
846#endif
817} 847}
818 848
819void KOMonthView::updateDayLabels() 849void KOMonthView::updateDayLabels()
820{ 850{
821 851
822 for (int i = 0; i < 7; i++) { 852 for (int i = 0; i < 7; i++) {
823 if (mWeekStartsMonday) { 853 if (mWeekStartsMonday) {
824 bool show = mShortDayLabels; 854 bool show = mShortDayLabels;
825 if ( i > 4 && mShowSatSunComp && mWidthLongDayLabel > mDayLabels[i]->width() ) 855 if ( i > 4 && mShowSatSunComp && mWidthLongDayLabel > mDayLabels[i]->width() )
826 show = true; 856 show = true;
827 mDayLabels[i]->setText(KOGlobals::self()->calendarSystem()->weekDayName(i+1,show)); 857 mDayLabels[i]->setText(KOGlobals::self()->calendarSystem()->weekDayName(i+1,show));
828 } else { 858 } else {
829 if (i==0) mDayLabels[i]->setText(KOGlobals::self()->calendarSystem()->weekDayName(7,mShortDayLabels)); 859 if (i==0) mDayLabels[i]->setText(KOGlobals::self()->calendarSystem()->weekDayName(7,mShortDayLabels));
830 else mDayLabels[i]->setText(KOGlobals::self()->calendarSystem()->weekDayName(i,mShortDayLabels)); 860 else mDayLabels[i]->setText(KOGlobals::self()->calendarSystem()->weekDayName(i,mShortDayLabels));
831 861
832 } 862 }
833 } 863 }
834} 864}
835 865
836void KOMonthView::showDates(const QDate &start, const QDate &) 866void KOMonthView::showDates(const QDate &start, const QDate &)
837{ 867{
838// kdDebug() << "KOMonthView::showDates(): " << start.toString() << endl; 868// kdDebug() << "KOMonthView::showDates(): " << start.toString() << endl;
839 869
840 870
diff --git a/korganizer/komonthview.h b/korganizer/komonthview.h
index 5124057..4c1567c 100644
--- a/korganizer/komonthview.h
+++ b/korganizer/komonthview.h
@@ -15,48 +15,52 @@
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 <qlayout.h> 28#include <qlayout.h>
29#include <qintdict.h> 29#include <qintdict.h>
30#include <qpushbutton.h> 30#include <qpushbutton.h>
31#include <qvaluelist.h> 31#include <qvaluelist.h>
32#include <qptrvector.h> 32#include <qptrvector.h>
33 33
34#include <libkcal/calendar.h> 34#include <libkcal/calendar.h>
35#include <libkcal/event.h> 35#include <libkcal/event.h>
36 36
37#include "koeventview.h" 37#include "koeventview.h"
38 38
39#ifdef DESKTOP_VERSION
40class QToolTipGroup;
41#endif
42
39class KOWeekButton : public QPushButton 43class KOWeekButton : public QPushButton
40{ 44{
41 Q_OBJECT 45 Q_OBJECT
42 public: 46 public:
43 KOWeekButton( QWidget *parent=0, const char *name=0 ) : 47 KOWeekButton( QWidget *parent=0, const char *name=0 ) :
44 QPushButton( parent, name) 48 QPushButton( parent, name)
45 { 49 {
46 connect( this, SIGNAL( clicked() ), 50 connect( this, SIGNAL( clicked() ),
47 SLOT( bottonClicked() )); 51 SLOT( bottonClicked() ));
48 mNumber = -1; 52 mNumber = -1;
49 } 53 }
50 void setWeekNum ( int num ) {mNumber = num; setText( QString::number ( num ));} 54 void setWeekNum ( int num ) {mNumber = num; setText( QString::number ( num ));}
51 signals: 55 signals:
52 void selectWeekNum ( int ); 56 void selectWeekNum ( int );
53private: 57private:
54 int mNumber; 58 int mNumber;
55private slots : 59private slots :
56 void bottonClicked() { if ( mNumber > 0 ) emit selectWeekNum ( mNumber ); } 60 void bottonClicked() { if ( mNumber > 0 ) emit selectWeekNum ( mNumber ); }
57}; 61};
58 62
59class KNoScrollListBox: public QListBox 63class KNoScrollListBox: public QListBox
60{ 64{
61 Q_OBJECT 65 Q_OBJECT
62 public: 66 public:
@@ -119,76 +123,81 @@ class MonthViewCell : public QWidget
119 public: 123 public:
120 MonthViewCell( KOMonthView * ); 124 MonthViewCell( KOMonthView * );
121 125
122 void setDate( const QDate & ); 126 void setDate( const QDate & );
123 QDate date() const; 127 QDate date() const;
124 128
125 void setPrimary( bool ); 129 void setPrimary( bool );
126 bool isPrimary() const; 130 bool isPrimary() const;
127 131
128 void setHoliday( bool ); 132 void setHoliday( bool );
129 void setHoliday( const QString & ); 133 void setHoliday( const QString & );
130 134
131 void updateCell(); 135 void updateCell();
132 136
133 void updateConfig(); 137 void updateConfig();
134 138
135 void enableScrollBars( bool ); 139 void enableScrollBars( bool );
136 140
137 Incidence *selectedIncidence(); 141 Incidence *selectedIncidence();
138 QDate selectedIncidenceDate(); 142 QDate selectedIncidenceDate();
139 143
140 void deselect(); 144 void deselect();
141 void select(); 145 void select();
142 146
147#ifdef DESKTOP_VERSION
148 static QToolTipGroup *toolTipGroup();
149#endif
143 signals: 150 signals:
144 void defaultAction( Incidence * ); 151 void defaultAction( Incidence * );
145 void newEventSignal( QDateTime ); 152 void newEventSignal( QDateTime );
146 void showDaySignal( QDate ); 153 void showDaySignal( QDate );
147 154
148 protected: 155 protected:
149 void resizeEvent( QResizeEvent * ); 156 void resizeEvent( QResizeEvent * );
150 157
151 protected slots: 158 protected slots:
152 void defaultAction( QListBoxItem * ); 159 void defaultAction( QListBoxItem * );
153 void contextMenu( QListBoxItem * ); 160 void contextMenu( QListBoxItem * );
154 void selection( QListBoxItem * ); 161 void selection( QListBoxItem * );
155 void cellClicked( QListBoxItem * ); 162 void cellClicked( QListBoxItem * );
156 void newEvent(); 163 void newEvent();
157 void showDay(); 164 void showDay();
158 165
159 private: 166 private:
160 KOMonthView *mMonthView; 167 KOMonthView *mMonthView;
161 168
162 QDate mDate; 169 QDate mDate;
163 bool mPrimary; 170 bool mPrimary;
164 bool mHoliday; 171 bool mHoliday;
165 QString mHolidayString; 172 QString mHolidayString;
166 173
167 //QLabel *mLabel; 174 //QLabel *mLabel;
168 QPushButton *mLabel; 175 QPushButton *mLabel;
169 QListBox *mItemList; 176 QListBox *mItemList;
170 177#ifdef DESKTOP_VERSION
178 static QToolTipGroup *mToolTipGroup;
179#endif
171 QSize mLabelSize; 180 QSize mLabelSize;
172 QSize mLabelBigSize; 181 QSize mLabelBigSize;
173 QPalette mHolidayPalette; 182 QPalette mHolidayPalette;
174 QPalette mStandardPalette; 183 QPalette mStandardPalette;
175 QPalette mPrimaryPalette; 184 QPalette mPrimaryPalette;
176 QPalette mNonPrimaryPalette; 185 QPalette mNonPrimaryPalette;
177 void setMyPalette(); 186 void setMyPalette();
178 QPalette getPalette (); 187 QPalette getPalette ();
179 void keyPressEvent ( QKeyEvent * ) ; 188 void keyPressEvent ( QKeyEvent * ) ;
180 189
181}; 190};
182 191
183 192
184class KOMonthView: public KOEventView 193class KOMonthView: public KOEventView
185{ 194{
186 Q_OBJECT 195 Q_OBJECT
187 public: 196 public:
188 KOMonthView(Calendar *cal, QWidget *parent = 0, const char *name = 0 ); 197 KOMonthView(Calendar *cal, QWidget *parent = 0, const char *name = 0 );
189 ~KOMonthView(); 198 ~KOMonthView();
190 199
191 /** Returns maximum number of days supported by the komonthview */ 200 /** Returns maximum number of days supported by the komonthview */
192 virtual int maxDatesHint(); 201 virtual int maxDatesHint();
193 202
194 /** Returns number of currently shown dates. */ 203 /** Returns number of currently shown dates. */