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
@@ -51,13 +51,15 @@
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:
@@ -81,13 +83,13 @@ KNoScrollListBox::KNoScrollListBox(QWidget *parent,const char *name)
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
@@ -292,13 +294,20 @@ MonthViewCell::MonthViewCell( KOMonthView *parent)
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
@@ -389,17 +398,22 @@ void MonthViewCell::updateCell()
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") ||
@@ -425,18 +439,22 @@ void MonthViewCell::updateCell()
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) {
@@ -480,14 +498,17 @@ void MonthViewCell::updateCell()
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()) {
@@ -524,13 +545,19 @@ void MonthViewCell::updateCell()
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}
@@ -811,12 +838,15 @@ void KOMonthView::updateConfig()
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++) {
diff --git a/korganizer/komonthview.h b/korganizer/komonthview.h
index 5124057..4c1567c 100644
--- a/korganizer/komonthview.h
+++ b/korganizer/komonthview.h
@@ -33,12 +33,16 @@
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)
@@ -137,12 +141,15 @@ class MonthViewCell : public QWidget
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:
@@ -164,13 +171,15 @@ class MonthViewCell : public QWidget
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;