summaryrefslogtreecommitdiffabout
authorzautrix <zautrix>2005-04-22 13:00:34 (UTC)
committer zautrix <zautrix>2005-04-22 13:00:34 (UTC)
commit81158fa914f6d0f3aeb049d28d2ecfb5f5c0e261 (patch) (side-by-side diff)
treed5d622e8e5abd5326edc426398faef24ae52985c
parent33bc865668aef76416b45e365ba5825315d90564 (diff)
downloadkdepimpi-81158fa914f6d0f3aeb049d28d2ecfb5f5c0e261.zip
kdepimpi-81158fa914f6d0f3aeb049d28d2ecfb5f5c0e261.tar.gz
kdepimpi-81158fa914f6d0f3aeb049d28d2ecfb5f5c0e261.tar.bz2
fixes
Diffstat (more/less context) (ignore whitespace changes)
-rw-r--r--korganizer/kodaymatrix.cpp57
-rw-r--r--korganizer/kodaymatrix.h1
2 files changed, 46 insertions, 12 deletions
diff --git a/korganizer/kodaymatrix.cpp b/korganizer/kodaymatrix.cpp
index 53ebdb2..4366265 100644
--- a/korganizer/kodaymatrix.cpp
+++ b/korganizer/kodaymatrix.cpp
@@ -155,113 +155,146 @@ QString KODayMatrix::getWhatsThisText( QPoint p )
Event *event;
QStringList mToolTip;
for(event=eventlist.first();event != 0;event=eventlist.next()) {
QString mToolTipText;
QString text;
int multiday = 0;// 1 = start, 2 = midddle, 3 = end day
if (event->isMultiDay()) {
QString prefix = "<->";multiday = 2;
QString time;
if ( event->doesRecur() ) {
if ( event->recursOn( mDate) ) {
prefix ="->" ;multiday = 1;
}
else {
int days = event->dtStart().date().daysTo ( event->dtEnd().date() );
if ( event->recursOn( mDate.addDays( -days)) ) {
prefix ="<-" ;multiday = 3;
}
}
} else {
if (mDate == event->dtStart().date()) {
prefix ="->" ;multiday = 1;
} else if (mDate == event->dtEnd().date()) {
prefix ="<-" ;multiday = 3;
}
}
if ( !event->doesFloat() ) {
if ( mDate == event->dtStart().date () )
time = KGlobal::locale()->formatTime(event->dtStart().time())+" ";
else if ( mDate == event->dtEnd().date () )
time = KGlobal::locale()->formatTime(event->dtEnd().time())+" ";
}
text = time + event->summary();
mToolTipText += prefix + text;
} else {
if (event->doesFloat()) {
text = event->summary();
mToolTipText += text;
}
else {
text = KGlobal::locale()->formatTime(event->dtStart().time());
text += " " + event->summary();
mToolTipText += KGlobal::locale()->formatTime(event->dtStart().time()) +"-"+KGlobal::locale()->formatTime(event->dtEnd().time())+" " + event->summary();
}
}
if ( !event->location().isEmpty() )
mToolTipText += " (" + event->location() + ")";
-#if QT_VERSION >= 0x030000
- mToolTipText.replace( '<' , "&lt;" );
- mToolTipText.replace( '>' , "&gt;" );
-#else
- if ( mToolTipText.find ('<') >= 0 ) {
- mToolTipText.replace( QRegExp("<") , "&lt;" );
- }
- if ( mToolTipText.find ('>') >= 0 ) {
- mToolTipText.replace( QRegExp(">") , "&gt;" );
- }
-#endif
//qDebug("TTT: %s ", mToolTipText.latin1());
- mToolTip.append( mToolTipText );
+ mToolTip.append( deTag( mToolTipText ) );
+ }
+ if ( KOPrefs::instance()->mCurrentDisplayedView == VIEW_T_VIEW ) {
+ QPtrList<Todo> todolist = mCalendar->todos(mDate);
+ Todo *todo;
+ for(todo=todolist.first();todo != 0;todo=todolist.next()) {
+ QString mToolTipText;
+ if ( !todo->doesFloat() )
+ mToolTipText += KGlobal::locale()->formatTime(todo->dtDue().time())+" ";
+ mToolTipText += todo->summary();
+ if ( !todo->location().isEmpty() )
+ mToolTipText += " (" + todo->location() + ")";
+ mToolTipText = deTag( mToolTipText);
+ mToolTipText = "<b>" + i18n("Todo: ") + "</b>"+ mToolTipText;
+ mToolTip.append( mToolTipText );
+ }
}
mToolTip.sort();
+ if (KOPrefs::instance()->mCurrentDisplayedView == VIEW_J_VIEW ) {
+ Journal *j = mCalendar->journal( mDate );
+ if ( j ) {
+ QString mToolTipText = j->description().left(100);
+ if ( j->description().length() > 100 )
+ mToolTipText += " ...";
+ mToolTipText = deTag( mToolTipText);
+ mToolTipText = "<b>" + i18n("Journal: ") + "</b>"+ mToolTipText;
+ mToolTip.append( mToolTipText );
+ }
+ }
return "<b>"+KGlobal::locale()->formatDate(days[tmp]) + "</b><br>" + mToolTip.join("<br>");
}
+
+
+QString KODayMatrix::deTag( QString mToolTipText )
+{
+
+#if QT_VERSION >= 0x030000
+ mToolTipText.replace( '<' , "&lt;" );
+ mToolTipText.replace( '>' , "&gt;" );
+#else
+ if ( mToolTipText.find ('<') >= 0 ) {
+ mToolTipText.replace( QRegExp("<") , "&lt;" );
+ }
+ if ( mToolTipText.find ('>') >= 0 ) {
+ mToolTipText.replace( QRegExp(">") , "&gt;" );
+ }
+#endif
+ return mToolTipText;
+}
void KODayMatrix::setCalendar( Calendar *cal )
{
mCalendar = cal;
setAcceptDrops( mCalendar );
updateEvents();
}
QColor KODayMatrix::getShadedColor(QColor color)
{
QColor shaded;
int h=0;
int s=0;
int v=0;
color.hsv(&h,&s,&v);
s = s/4;
v = 192+v/4;
shaded.setHsv(h,s,v);
return shaded;
}
KODayMatrix::~KODayMatrix()
{
#if QT_VERSION >= 0x030000
#else
delete mKODaymatrixWhatsThis;
#endif
// delete mKODaymatrixWhatsThis;
delete [] days;
delete [] daylbls;
//delete [] events;
delete mToolTip;
}
/*
void KODayMatrix::setStartDate(QDate start)
{
updateView(start);
}
*/
void KODayMatrix::addSelectedDaysTo(DateList& selDays)
{
diff --git a/korganizer/kodaymatrix.h b/korganizer/kodaymatrix.h
index a3216d6..b96e08f 100644
--- a/korganizer/kodaymatrix.h
+++ b/korganizer/kodaymatrix.h
@@ -162,96 +162,97 @@ public:
*/
bool isTodayVisible() const { return today>=0; } ;
/** If today is visible, then we can find out if today is
* near the beginning or the end of the month.
* This is dependent on today remaining the index
* in the array of visible dates and going from
* top left (0) to bottom right (41).
*/
bool isBeginningOfMonth() const { return today<=8; } ;
bool isEndOfMonth() const { return today>=27; } ;
QString getWhatsThisText( QPoint ) ;
QSize sizeHint() const;
QRect frameRect () const { int wid = frameWidth(); return QRect(0+wid,0+wid,width()-wid-wid,height()-wid-wid);}
public slots:
/** Recalculates all the flags of the days in the matrix like holidays or events
* on a day (Actually calls above method with the actual startdate).
*/
void updateView();
void updateViewTimed();
void repaintViewTimed();
/**
* Calculate which square in the matrix should be
* hilighted to indicate it's today.
*/
void recalculateToday();
/*
void setStartDate(QDate);
*/
signals:
/** emitted if the user selects a block of days with the mouse by dragging a rectangle
* inside the matrix
*
* @param daylist list of days that have been selected by the user
*/
void selected( const KCal::DateList &daylist );
/** emitted if the user has dropped an event inside the matrix
*
* @param event the dropped calendar event
*/
void eventDropped(Event *event);
protected:
+ QString deTag( QString mToolTipText );
void paintEvent(QPaintEvent *ev);
void mousePressEvent (QMouseEvent* e);
void mouseReleaseEvent (QMouseEvent* e);
void mouseMoveEvent (QMouseEvent* e);
void dragEnterEvent(QDragEnterEvent *);
void dragMoveEvent(QDragMoveEvent *);
void dragLeaveEvent(QDragLeaveEvent *);
void dropEvent(QDropEvent *);
void resizeEvent(QResizeEvent *);
private:
int mLastView;
void computeEvent(Event *even, int dayindex );
int oldW, oldH;
bool mRedrawNeeded;
KODaymatrixWhatsThis* mKODaymatrixWhatsThis;
bool mouseDown;
QBitArray bDays;
QBitArray hDays;
QBitArray eDays;
QBitArray pDays;
QPixmap myPix;
QTimer* mUpdateTimer;
QTimer* mRepaintTimer;
bool mDayChanged;
bool mPendingUpdateBeforeRepaint;
/** returns the index of the day located at the matrix's widget (x,y) position.
*
* @param x horizontal coordinate
* @param y vertical coordinate
*/
int getDayIndexFrom(int x, int y);
/** calculates a "shaded" color from the supplied color object.
* (Copied from Cornelius's kdpdatebutton.cpp)
*
* @param color source based on which a shaded color should be calculated.
*/