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) (side-by-side diff)
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 @@
#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++) {
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 @@
#include <libkcal/calendar.h>
#include <libkcal/event.h>
#include "koeventview.h"
+#ifdef DESKTOP_VERSION
+class QToolTipGroup;
+#endif
+
class KOWeekButton : public QPushButton
{
Q_OBJECT
public:
KOWeekButton( QWidget *parent=0, const char *name=0 ) :
QPushButton( parent, name)
@@ -137,12 +141,15 @@ class MonthViewCell : public QWidget
Incidence *selectedIncidence();
QDate selectedIncidenceDate();
void deselect();
void select();
+#ifdef DESKTOP_VERSION
+ static QToolTipGroup *toolTipGroup();
+#endif
signals:
void defaultAction( Incidence * );
void newEventSignal( QDateTime );
void showDaySignal( QDate );
protected:
@@ -164,13 +171,15 @@ class MonthViewCell : public QWidget
bool mHoliday;
QString mHolidayString;
//QLabel *mLabel;
QPushButton *mLabel;
QListBox *mItemList;
-
+#ifdef DESKTOP_VERSION
+ static QToolTipGroup *mToolTipGroup;
+#endif
QSize mLabelSize;
QSize mLabelBigSize;
QPalette mHolidayPalette;
QPalette mStandardPalette;
QPalette mPrimaryPalette;
QPalette mNonPrimaryPalette;