summaryrefslogtreecommitdiffabout
path: root/korganizer/komonthview.cpp
Side-by-side diff
Diffstat (limited to 'korganizer/komonthview.cpp') (more/less context) (ignore whitespace changes)
-rw-r--r--korganizer/komonthview.cpp40
1 files changed, 35 insertions, 5 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 @@
#include "koglobals.h"
#include <libkcal/kincidenceformatter.h>
#include "komonthview.h"
#define PIXMAP_SIZE 5
-
+#ifdef DESKTOP_VERSION
+ QToolTipGroup *MonthViewCell::mToolTipGroup = 0;
+#endif
class KNOWhatsThis :public QWhatsThis
{
public:
KNOWhatsThis( KNoScrollListBox* sbox ) : QWhatsThis( sbox ), _wid( sbox) { };
protected:
@@ -81,13 +83,13 @@ KNoScrollListBox::KNoScrollListBox(QWidget *parent,const char *name)
}
QString KNoScrollListBox::getWhatsThisText(QPoint p)
{
QListBoxItem* item = itemAt ( p );
if ( ! item ) {
- return i18n("Click in the cell or\non the date label\nto add an event!");
+ return i18n("Click in the cell\nto add an event!");
}
return KIncidenceFormatter::instance()->getFormattedText(((MonthViewItem*) item)->incidence());
}
void KNoScrollListBox::keyPressEvent(QKeyEvent *e)
{
@@ -292,13 +294,20 @@ MonthViewCell::MonthViewCell( KOMonthView *parent)
SLOT( selection( QListBoxItem * ) ) );
connect( mItemList, SIGNAL( clicked( QListBoxItem * ) ),
SLOT( cellClicked( QListBoxItem * ) ) );
connect( mItemList, SIGNAL( clicked( QListBoxItem * ) ),
SLOT( selection( QListBoxItem * ) ) );
}
-
+#ifdef DESKTOP_VERSION
+QToolTipGroup *MonthViewCell::toolTipGroup()
+{
+ if (!mToolTipGroup) mToolTipGroup = new QToolTipGroup(0);
+ return mToolTipGroup;
+}
+#endif
+
void MonthViewCell::setDate( const QDate &date )
{
// kdDebug() << "MonthViewCell::setDate(): " << date.toString() << endl;
mDate = date;
@@ -389,17 +398,22 @@ void MonthViewCell::updateCell()
if ( mDate == QDate::currentDate() ) {
mItemList->setLineWidth( 3 );
} else {
mItemList->setLineWidth( 1 );
}
mItemList->clear();
+#ifdef DESKTOP_VERSION
+ QToolTip::remove(this);
+#endif
+ QString tipText("");
//qApp->processEvents();
if ( !mHolidayString.isEmpty() ) {
MonthViewItem *item = new MonthViewItem( 0, mDate, mHolidayString );
item->setPalette( mHolidayPalette );
mItemList->insertItem( item );
+ tipText += mHolidayString+"\n";
}
//mLabel->setMaximumWidth( width() - mItemList->lineWidth()*2);
QPtrList<Event> events = mMonthView->calendar()->events( mDate, true );
Event *event;
for( event = events.first(); event; event = events.next() ) {
if ( event->categories().contains("Holiday") ||
@@ -425,18 +439,22 @@ void MonthViewCell::updateCell()
prefix ="->" ;
} else if (mDate == event->dtEnd().date()) {
prefix ="<-" ;
}
}
text = prefix + event->summary();
+ tipText += text;
} else {
- if (event->doesFloat())
+ if (event->doesFloat()) {
text = event->summary();
+ tipText += text;
+ }
else {
text = KGlobal::locale()->formatTime(event->dtStart().time());
text += " " + event->summary();
+ tipText += KGlobal::locale()->formatTime(event->dtStart().time()) +"-"+KGlobal::locale()->formatTime(event->dtEnd().time())+" " + event->summary();
}
}
MonthViewItem *item = new MonthViewItem( event, mDate, text );
QPalette pal;
if (KOPrefs::instance()->mMonthViewUsesCategoryColor) {
@@ -480,14 +498,17 @@ void MonthViewCell::updateCell()
insert = false;
else
if ( !KOPrefs::instance()->mMonthWeeklyRecur && event->doesRecur() == Recurrence::rWeekly )
insert = false;
}
- if ( insert )
+ if ( insert ) {
mItemList->insertItem( item );
+ tipText += "\n";
+ } else
+ tipText = "";
}
// insert due todos
QPtrList<Todo> todos = mMonthView->calendar()->todos( mDate );
Todo *todo;
for(todo = todos.first(); todo; todo = todos.next()) {
@@ -524,13 +545,19 @@ void MonthViewCell::updateCell()
} else {
pal = mStandardPalette ;
}
item->setPalette( pal );
mItemList->insertItem( item );
+ tipText += text+"\n";
}
+#ifdef DESKTOP_VERSION
+ if (tipText != "")
+ QToolTip::add(this,tipText,toolTipGroup(),"");
+#endif
+
//setMyPalette();
setMyPalette();
resizeEvent( 0 );
// if ( isVisible())
// qApp->processEvents();
}
@@ -811,12 +838,15 @@ void KOMonthView::updateConfig()
//qDebug("KOMonthView::updateConfig() %d %d %d ",height(), mDayLabels[0]->sizeHint().height() ,mNumWeeks);
int cellHeight = (height() - mDayLabels[0]->sizeHint().height()) /mNumWeeks;
//resizeEvent( 0 );
for (uint i = 0; i < mCells.count(); ++i) {
mCells[i]->updateConfig();
}
+#ifdef DESKTOP_VERSION
+ MonthViewCell::toolTipGroup()->setEnabled(KOPrefs::instance()->mEnableToolTips);
+#endif
}
void KOMonthView::updateDayLabels()
{
for (int i = 0; i < 7; i++) {