[prev in list] [next in list] [prev in thread] [next in thread]
List: kde-pim
Subject: [Kde-pim] [PATCH] KAgenda L&F changes
From: Tim Jansen <ml () tjansen ! de>
Date: 2003-07-21 0:12:42
[Download RAW message or body]
Hi...
I'd like to commit the attached patch.
It does the following:
- complete redesign of the agenda item look with custom renderer
- changes the colors (and renames the color groups in the preferences because
the old colors look quite sub-optimal). Feel free to suggest better colors if
you don't like them :)
- uses lighter grid lines (#25261)
- adds a pixel of spacing between items (otherwise it looks quite ugly with
the new design)
To make it short, here's a screenshot:
http://www.tjansen.de/blog/pics/after2.png
For reference, here is the old renderer:
http://www.tjansen.de/blog/pics/before.png
This shows item changes only, with old colors and without other KOAgenda
changes:
http://www.tjansen.de/blog/pics/after1.png
bye...
["korganizer-agenda.patch" (text/x-diff)]
Index: koagenda.cpp
===================================================================
RCS file: /home/kde/kdepim/korganizer/koagenda.cpp,v
retrieving revision 1.65
diff -u -3 -p -r1.65 koagenda.cpp
--- koagenda.cpp 9 Apr 2003 18:57:50 -0000 1.65
+++ koagenda.cpp 20 Jul 2003 23:56:53 -0000
@@ -832,9 +832,9 @@ void KOAgenda::placeSubCells(KOAgendaIte
// kdDebug(5850) << "---Placing item: " << item->itemEvent()->getSummary() << endl;
item->setSubCells(maxSubCells);
if (mAllDayMode) {
- item->resize(item->cellWidth() * mGridSpacingX, newSubCellWidth);
+ item->resize(item->cellWidth() * mGridSpacingX - 1, newSubCellWidth);
} else {
- item->resize(newSubCellWidth, item->cellHeight() * mGridSpacingY);
+ item->resize(newSubCellWidth - 1, item->cellHeight() * mGridSpacingY);
}
int x,y;
gridToContents(item->cellX(),item->cellYTop(),x,y);
@@ -848,13 +848,14 @@ void KOAgenda::placeSubCells(KOAgendaIte
} else {
placeItem->setSubCell(0);
placeItem->setSubCells(1);
- if (mAllDayMode) placeItem->resize(placeItem->width(),mGridSpacingY);
- else placeItem->resize(mGridSpacingX,placeItem->height());
+ if (mAllDayMode) placeItem->resize(placeItem->width()-1,mGridSpacingY);
+ else placeItem->resize(mGridSpacingX-1,placeItem->height());
int x,y;
gridToContents(placeItem->cellX(),placeItem->cellYTop(),x,y);
moveChild(placeItem,x,y);
}
placeItem->setConflictItems(conflictItems);
+ placeItem->update();
}
/*
@@ -916,6 +917,8 @@ void KOAgenda::drawContents(QPainter* p,
mSelectionHeight, KOPrefs::instance()->mHighlightColor );
}
+ dbp.setPen( KOPrefs::instance()->mAgendaBgColor.dark(150) );
+
// Draw vertical lines of grid
// kdDebug(5850) << "drawContents cx: " << cx << " cy: " << cy << " cw: " << cw << " ch: " << ch << endl;
int x = ((int)(cx/mGridSpacingX))*mGridSpacingX;
@@ -1015,7 +1018,7 @@ KOAgendaItem *KOAgenda::insertItem (Inci
}
KOAgendaItem *agendaItem = new KOAgendaItem (event,qd,viewport());
- agendaItem->setFrameStyle(WinPanel|Raised);
+// agendaItem->setFrameStyle(WinPanel|Raised);
int YSize = YBottom - YTop + 1;
if (YSize < 0) {
@@ -1053,7 +1056,7 @@ KOAgendaItem *KOAgenda::insertAllDayItem
}
KOAgendaItem *agendaItem = new KOAgendaItem (event,qd,viewport());
- agendaItem->setFrameStyle(WinPanel|Raised);
+// agendaItem->setFrameStyle(WinPanel|Raised);
agendaItem->setCellXY(XBegin,0,0);
agendaItem->setCellXWidth(XEnd);
Index: koagenda.h
===================================================================
RCS file: /home/kde/kdepim/korganizer/koagenda.h,v
retrieving revision 1.32
diff -u -3 -p -r1.32 koagenda.h
--- koagenda.h 7 Apr 2003 21:43:06 -0000 1.32
+++ koagenda.h 20 Jul 2003 23:56:53 -0000
@@ -24,6 +24,7 @@
#define KOAGENDA_H
#include <qscrollview.h>
+#include <qlabel.h>
#include <qtimer.h>
#include <qmemarray.h>
#include <qguardedptr.h>
Index: koagendaitem.cpp
===================================================================
RCS file: /home/kde/kdepim/korganizer/koagendaitem.cpp,v
retrieving revision 1.37
diff -u -3 -p -r1.37 koagendaitem.cpp
--- koagendaitem.cpp 9 Apr 2003 18:57:50 -0000 1.37
+++ koagendaitem.cpp 20 Jul 2003 23:56:53 -0000
@@ -17,15 +17,14 @@
Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*/
-#include <qlabel.h>
-#include <qlayout.h>
-#include <qhbox.h>
#include <qtooltip.h>
#include <qdragobject.h>
+#include <qpainter.h>
#include <kiconloader.h>
#include <kdebug.h>
#include <klocale.h>
+#include <kwordwrap.h>
#include <libkcal/icaldrag.h>
#include <libkcal/vcaldrag.h>
@@ -43,61 +42,16 @@ QToolTipGroup *KOAgendaItem::mToolTipGro
KOAgendaItem::KOAgendaItem(Incidence *incidence, QDate qd, QWidget *parent,
const char *name,WFlags) :
- QFrame(parent, name), mIncidence(incidence), mDate(qd)
+ QWidget(parent, name), mIncidence(incidence), mDate(qd),
+ mLabelText(mIncidence->summary()), mIconAlarm(false),
+ mIconRecur(false), mIconReadonly(false), mIconReply(false),
+ mIconGroup(false), mIconOrganizer(false)
{
+ setBackgroundMode(Qt::NoBackground);
mFirstMultiItem = 0;
mNextMultiItem = 0;
mLastMultiItem = 0;
- QHBox *box = 0;
-
- if ( incidence->type() == "Todo" )
- {
- static const QPixmap todoPxmp = SmallIcon("todo");
- static const QPixmap completedPxmp = SmallIcon("checkedbox");
-
- box = new QHBox(this);
- QLabel *todoIcon = new QLabel(box);
-
- if ( (static_cast<Todo*>(incidence))->isCompleted() )
- todoIcon->setPixmap(completedPxmp);
- else
- todoIcon->setPixmap(todoPxmp);
-
- todoIcon->setAlignment(AlignLeft|AlignTop);
-
- mItemLabel = new QLabel(mIncidence->summary(),box,"KOAgendaItem::itemLabel");
- }
- else
- mItemLabel = new QLabel(mIncidence->summary(),this,"KOAgendaItem::itemLabel");
-
- // if a Todo item is overdue and not completed, always show it in overdue color
- if ( (incidence->type() == "Todo") &&
- ( !((static_cast<Todo*>(incidence))->isCompleted()) &&
- ((static_cast<Todo*>(incidence))->dtDue() < QDate::currentDate()) ) )
- setPalette(QPalette(KOPrefs::instance()->mTodoOverdueColor,
- KOPrefs::instance()->mTodoOverdueColor));
- else {
- QStringList categories = mIncidence->categories();
- QString cat = categories.first();
- if (cat.isEmpty()) {
- setPalette(QPalette(KOPrefs::instance()->mEventColor,
- KOPrefs::instance()->mEventColor));
- } else {
- setPalette(QPalette(*(KOPrefs::instance()->categoryColor(cat)),
- *(KOPrefs::instance()->categoryColor(cat))));
- }
- }
-
- mItemLabel->setAlignment(AlignCenter|WordBreak);
- mItemLabel->setMouseTracking(true);
-
- mItemLabel->installEventFilter(this);
-
- mItemLabel->setFrameStyle(Panel|Sunken);
-
- mItemLabel->setFont(KOPrefs::instance()->mAgendaViewFont);
-
setCellXY(0,0,1);
setCellXWidth(0);
setSubCell(0);
@@ -106,59 +60,6 @@ KOAgendaItem::KOAgendaItem(Incidence *in
setMultiItem(0,0,0);
startMove();
-
- mIconAlarm = new QLabel(this,"KOAgendaItem::IconAlarmLabel");
- mIconRecur = new QLabel(this,"KOAgendaItem::IconRecurLabel");
- mIconReadonly = new QLabel(this,"KOAgendaItem::IconReadonlyLabel");
- mIconReply = new QLabel(this,"KOAgendaItem::IconReplyLabel");
- mIconGroup = new QLabel(this,"KOAgendaItem::IconGroupLabel");
- mIconOrganizer = new QLabel(this,"KOAgendaItem::IconOrganizerLabel");
-
- mIconAlarm->installEventFilter(this);
- mIconRecur->installEventFilter(this);
- mIconReadonly->installEventFilter(this);
- mIconReply->installEventFilter(this);
- mIconGroup->installEventFilter(this);
- mIconOrganizer->installEventFilter(this);
-
- mIconAlarm->setMouseTracking(true);
- mIconRecur->setMouseTracking(true);
- mIconReadonly->setMouseTracking(true);
- mIconReply->setMouseTracking(true);
- mIconGroup->setMouseTracking(true);
- mIconOrganizer->setMouseTracking(true);
-
- static const QPixmap alarmPxmp = SmallIcon("bell");
- static const QPixmap recurPxmp = SmallIcon("recur");
- static const QPixmap readonlyPxmp = SmallIcon("readonlyevent");
- static const QPixmap replyPxmp = SmallIcon("mail_reply");
- static const QPixmap groupPxmp = SmallIcon("groupevent");
- static const QPixmap organizerPxmp = SmallIcon("organizer");
-
- mIconAlarm->setPixmap(alarmPxmp);
- mIconRecur->setPixmap(recurPxmp);
- mIconReadonly->setPixmap(readonlyPxmp);
- mIconReply->setPixmap(replyPxmp);
- mIconGroup->setPixmap(groupPxmp);
- mIconOrganizer->setPixmap(organizerPxmp);
-
- QVBoxLayout *topLayout = new QVBoxLayout(this,margin()+3);
- if ( incidence->type() == "Todo" )
- topLayout->addWidget(box, 1);
- else
- topLayout->addWidget(mItemLabel,1);
-
- QBoxLayout *iconLayout = new QHBoxLayout;
- topLayout->addLayout(iconLayout);
-
- iconLayout->addWidget(mIconAlarm);
- iconLayout->addWidget(mIconRecur);
- iconLayout->addWidget(mIconReadonly);
- iconLayout->addWidget(mIconReply);
- iconLayout->addWidget(mIconGroup);
- iconLayout->addWidget(mIconOrganizer);
- iconLayout->addStretch(1);
-
updateIcons();
// select() does nothing, if state hasn't change, so preset mSelected.
@@ -195,47 +96,43 @@ KOAgendaItem::KOAgendaItem(Incidence *in
void KOAgendaItem::updateIcons()
{
- if (mIncidence->isReadOnly()) mIconReadonly->show();
- else mIconReadonly->hide();
+ if (mIncidence->isReadOnly()) mIconReadonly = true;
+ else mIconReadonly = false;
- if (mIncidence->recurrence()->doesRecur()) mIconRecur->show();
- else mIconRecur->hide();
+ if (mIncidence->recurrence()->doesRecur()) mIconRecur = true;
+ else mIconRecur = false;
- if (mIncidence->isAlarmEnabled()) mIconAlarm->show();
- else mIconAlarm->hide();
+ if (mIncidence->isAlarmEnabled()) mIconAlarm = true;
+ else mIconAlarm = false;
if (mIncidence->attendeeCount()>0) {
if (mIncidence->organizer() == KOPrefs::instance()->email()) {
- mIconReply->hide();
- mIconGroup->hide();
- mIconOrganizer->show();
+ mIconReply = false;
+ mIconGroup = false;
+ mIconOrganizer = true;
}
else {
Attendee *me = mIncidence->attendeeByMails(KOPrefs::instance()->mAdditionalMails,KOPrefs::instance()->email());
if (me!=0) {
if (me->status()==Attendee::NeedsAction && me->RSVP()) {
- mIconReply->show();
- mIconGroup->hide();
- mIconOrganizer->hide();
+ mIconReply = true;
+ mIconGroup = false;
+ mIconOrganizer = false;
}
else {
- mIconReply->hide();
- mIconGroup->show();
- mIconOrganizer->hide();
+ mIconReply = false;
+ mIconGroup = true;
+ mIconOrganizer = false;
}
}
else {
- mIconReply->hide();
- mIconGroup->show();
- mIconOrganizer->hide();
+ mIconReply = false;
+ mIconGroup = true;
+ mIconOrganizer = false;
}
}
}
- else {
- mIconReply->hide();
- mIconGroup->hide();
- mIconOrganizer->hide();
- }
+ update();
}
@@ -243,36 +140,8 @@ void KOAgendaItem::select(bool selected)
{
if (mSelected == selected) return;
mSelected = selected;
- if (mSelected) {
- mItemLabel->setFrameStyle(Panel|Sunken);
- mItemLabel->setLineWidth(1);
- } else {
- mItemLabel->setFrameStyle(Panel|Plain);
- mItemLabel->setLineWidth(0);
- }
-}
-
-/*
- The eventFilter has to filter the mouse events of the agenda item childs. The
- events are fed into the event handling method of KOAgendaItem. This allows the
- KOAgenda to handle the KOAgendaItems by using an eventFilter.
-*/
-bool KOAgendaItem::eventFilter ( QObject *object, QEvent *e )
-{
-// kdDebug(5850) << "KOAgendaItem::eventFilter" << endl;
- if (e->type() == QEvent::MouseButtonPress ||
- e->type() == QEvent::MouseButtonDblClick ||
- e->type() == QEvent::MouseButtonRelease ||
- e->type() == QEvent::MouseMove) {
- QMouseEvent *me = (QMouseEvent *)e;
- QPoint itemPos = this->mapFromGlobal(((QWidget *)object)->
- mapToGlobal(me->pos()));
- QMouseEvent returnEvent (e->type(),itemPos,me->button(),me->state());
- return event(&returnEvent);
- } else {
- return false;
- }
+ update();
}
@@ -457,3 +326,195 @@ void KOAgendaItem::addConflictItem(KOAge
if (mConflictItems.find(ci)<0)
mConflictItems.append(ci);
}
+
+void KOAgendaItem::paintFrame(QPainter *p,
+ const QColor &color)
+{
+ p->setPen( color );
+ p->drawRect( 0, 0, width(), height() );
+ p->drawRect( 1, 1, width()-2, height()-2 );
+}
+
+static void conditionalPaint(QPainter *p, bool cond, int &x, int ft,
+ const QPixmap &pxmp) {
+ if (!cond)
+ return;
+ p->drawPixmap( x, ft, pxmp);
+ x += pxmp.width() + ft;
+}
+
+void KOAgendaItem::paintTodoIcon(QPainter *p, int &x, int ft) {
+ static const QPixmap todoPxmp = SmallIcon("todo");
+ static const QPixmap completedPxmp = SmallIcon("checkedbox");
+ if ( mIncidence->type() != "Todo" )
+ return;
+ bool b = (static_cast<Todo*>(mIncidence))->isCompleted();
+ conditionalPaint(p, b, x, ft, todoPxmp);
+ conditionalPaint(p, !b, x, ft, completedPxmp);
+}
+
+
+void KOAgendaItem::paintEvent(QPaintEvent *) {
+ QPainter p(this);
+ const int ft = 2; // frame thickness for layout, see paintFrame()
+ const int margin = 1 + ft; // frame + space between frame and content
+
+ static const QPixmap alarmPxmp = SmallIcon("bell");
+ static const QPixmap recurPxmp = SmallIcon("recur");
+ static const QPixmap readonlyPxmp = SmallIcon("readonlyevent");
+ static const QPixmap replyPxmp = SmallIcon("mail_reply");
+ static const QPixmap groupPxmp = SmallIcon("groupevent");
+ static const QPixmap organizerPxmp = SmallIcon("organizer");
+
+ QColor bgColor;
+ if ( mSelected )
+ bgColor = KOPrefs::instance()->mHighlightColor;
+ else if ( (mIncidence->type() == "Todo") &&
+ ( !((static_cast<Todo*>(mIncidence))->isCompleted()) &&
+ ((static_cast<Todo*>(mIncidence))->dtDue() < QDate::currentDate()) ) )
+ bgColor = KOPrefs::instance()->mTodoOverdueColor;
+ else {
+ QStringList categories = mIncidence->categories();
+ QString cat = categories.first();
+ if (cat.isEmpty())
+ bgColor = KOPrefs::instance()->mEventColor;
+ else
+ bgColor = *(KOPrefs::instance()->categoryColor(cat));
+ }
+
+ QColor frameColor = bgColor.dark(115);
+ QColor textColor = palette().color( QPalette::Normal, mSelected ? \
+ QColorGroup::HighlightedText : QColorGroup::Foreground );
+ p.setPen( textColor );
+ p.setBackgroundColor( bgColor );
+ p.setFont(KOPrefs::instance()->mAgendaViewFont);
+ QFontMetrics fm = p.fontMetrics();
+
+ int singleLineHeight = fm.boundingRect( mLabelText ).height();
+
+ // case 1: do not draw text when not even a single line fits
+ if ( ( singleLineHeight > height() ) || // ignore margin, be gentle..
+ ( width() < 16 ) ) {
+ p.eraseRect( 0, 0, width(), height() );
+ int x = margin;
+ paintTodoIcon( &p, x, ft );
+ paintFrame( &p, frameColor );
+ return;
+ }
+
+ // case 2: draw a single line when no more space
+ if ( (2 * singleLineHeight) > (height() - 2 * margin) ) {
+ p.eraseRect( 0, 0, width(), height() );
+ int x = margin;
+ paintTodoIcon( &p, x, ft );
+ int y = ((height() - 2 * ft - singleLineHeight) / 2) + fm.ascent();
+ KWordWrap::drawFadeoutText( &p, x, y,
+ width() - margin - x, mLabelText );
+ paintFrame( &p, frameColor );
+ return;
+ }
+
+ KWordWrap *ww = KWordWrap::formatText( fm,
+ QRect(0, 0,
+ width() - (2 * margin), 0),
+ 0,
+ mLabelText );
+ int th = ww->boundingRect().height();
+ delete ww;
+
+ // calculate the height of the full version (case 4) to test whether it is
+ // possible
+ QString shortH;
+ QString longH;
+ if ( (!mFirstMultiItem) && (!mNextMultiItem) ) {
+ shortH = KGlobal::locale()->formatTime(mIncidence->dtStart().time());
+ longH = i18n("%1 - %2").arg(shortH)
+ .arg(KGlobal::locale()->formatTime(mIncidence->dtEnd().time()));
+ }
+ else if ( !mFirstMultiItem ) {
+ shortH = KGlobal::locale()->formatTime(mIncidence->dtStart().time());
+ longH = shortH;
+ }
+ else {
+ Q_ASSERT( !mLastMultiItem );
+ shortH = KGlobal::locale()->formatTime(mIncidence->dtEnd().time());
+ longH = i18n("- %1").arg(shortH);
+ }
+ int hlHeight = QMAX(fm.boundingRect(longH).height(),
+ QMAX(alarmPxmp.height(), QMAX(recurPxmp.height(),
+ QMAX(readonlyPxmp.height(), QMAX(replyPxmp.height(),
+ QMAX(groupPxmp.height(), organizerPxmp.height()))))));
+ bool completelyRenderable =
+ th <= (height() - 2 * ft - hlHeight);
+
+ // case 3: enough for 2-5 lines, but not for the header.
+ // Also used for the middle days in multi-events
+ if ( ((!completelyRenderable) &&
+ ((height() - (2 * margin)) <= (5 * singleLineHeight)) ) ||
+ (mNextMultiItem && mFirstMultiItem) ) {
+ int x = margin;
+ ww = KWordWrap::formatText( fm,
+ QRect(0, 0, width() - margin - x,
+ height() - (2 * margin)),
+ 0,
+ mLabelText );
+ p.eraseRect( 0, 0, width(), height() );
+ paintTodoIcon( &p, x, ft );
+ ww->drawText( &p, x, margin, Qt::AlignAuto | KWordWrap::FadeOut );
+ delete ww;
+ paintFrame( &p, frameColor );
+ return;
+ }
+
+ // case 4: paint everything, with header:
+ // consists of (vertically) ft + headline&icons + ft + text + margin
+ int y = 2 * ft + hlHeight;
+ if ( completelyRenderable )
+ y += (height() - (2 * ft) - margin - hlHeight - th) / 2;
+ ww = KWordWrap::formatText( fm,
+ QRect(0, 0, width() - (2 * margin),
+ height() - margin - y),
+ 0,
+ mLabelText );
+
+ p.eraseRect( 0, 0, width(), height() );
+
+ // paint headline
+ p.fillRect( 0, 0, width(), (ft/2) + margin + hlHeight,
+ QBrush( frameColor ) );
+
+ int x = margin;
+ paintTodoIcon( &p, x, ft );
+ conditionalPaint( &p, mIconAlarm, x, ft, alarmPxmp );
+ conditionalPaint( &p, mIconRecur, x, ft, recurPxmp );
+ conditionalPaint( &p, mIconReadonly, x, ft, readonlyPxmp );
+ conditionalPaint( &p, mIconReply, x, ft, replyPxmp );
+ conditionalPaint( &p, mIconGroup, x, ft, groupPxmp );
+ conditionalPaint( &p, mIconOrganizer, x, ft, organizerPxmp );
+
+ QString headline;
+ int hw = fm.boundingRect( longH ).width();
+ if ( hw > (width() - x - margin) ) {
+ headline = shortH;
+ hw = fm.boundingRect( shortH ).width();
+ if ( hw < (width() - x - margin) )
+ x += (width() - x - margin - hw) / 2;
+ else
+ headline = "";
+ }
+ else {
+ headline = longH;
+ x += (width() - x - margin - hw) / 2;
+ }
+ p.setBackgroundColor( frameColor );
+ p.setPen( textColor );
+ KWordWrap::drawFadeoutText( &p, x, ft + fm.ascent(),
+ width() - margin - x, headline );
+
+ // draw event text
+ p.setBackgroundColor( bgColor );
+ ww->drawText( &p, margin, y, Qt::AlignAuto | KWordWrap::FadeOut );
+ delete ww;
+ paintFrame( &p, frameColor );
+}
+
Index: koagendaitem.h
===================================================================
RCS file: /home/kde/kdepim/korganizer/koagendaitem.h,v
retrieving revision 1.20
diff -u -3 -p -r1.20 koagendaitem.h
--- koagendaitem.h 26 Jun 2003 15:00:52 -0000 1.20
+++ koagendaitem.h 20 Jul 2003 23:56:53 -0000
@@ -20,7 +20,6 @@
#define KOAGENDAITEM_H
#include <qframe.h>
-#include <qlabel.h>
#include <qdatetime.h>
#include <libkcal/incidence.h>
@@ -37,7 +36,7 @@ using namespace KCal;
eventfiler for its children, if it has children, and it has to pass mouse
events from the cildren to itself. See eventFilter().
*/
-class KOAgendaItem : public QFrame
+class KOAgendaItem : public QWidget
{
Q_OBJECT
public:
@@ -79,17 +78,15 @@ class KOAgendaItem : public QFrame
Incidence *incidence() const { return mIncidence; }
QDate itemDate() { return mDate; }
-
- /** Update the date of this item's occurrence (not in the event) */
+
+ /** Update the date of this item's occurrence (not in the event) */
void setItemDate(QDate qd);
-
- void setText ( const QString & text ) { mItemLabel->setText(text); }
- QString text () { return mItemLabel->text(); }
- virtual bool eventFilter ( QObject *, QEvent * );
+ void setText ( const QString & text ) { mLabelText = text; }
+ QString text () { return mLabelText; }
static QToolTipGroup *toolTipGroup();
-
+
QPtrList<KOAgendaItem> conflictItems();
void setConflictItems(QPtrList<KOAgendaItem>);
void addConflictItem(KOAgendaItem *ci);
@@ -101,6 +98,9 @@ class KOAgendaItem : public QFrame
protected:
void dragEnterEvent(QDragEnterEvent *e);
void dropEvent(QDropEvent *e);
+ void paintEvent(QPaintEvent *e);
+ void paintFrame(QPainter *p, const QColor &color);
+ void paintTodoIcon(QPainter *p, int &x, int ft);
private:
int mCellX;
@@ -121,10 +121,9 @@ class KOAgendaItem : public QFrame
Incidence *mIncidence; // corresponding event or todo
QDate mDate; //date this events occurs (for recurrence)
-
- QLabel *mItemLabel;
- QLabel *mIconAlarm,*mIconRecur,*mIconReadonly;
- QLabel *mIconReply,*mIconGroup,*mIconOrganizer;
+ QString mLabelText;
+ bool mIconAlarm, mIconRecur, mIconReadonly;
+ bool mIconReply, mIconGroup, mIconOrganizer;
static QToolTipGroup *mToolTipGroup;
Index: koagendaview.cpp
===================================================================
RCS file: /home/kde/kdepim/korganizer/koagendaview.cpp,v
retrieving revision 1.98
diff -u -3 -p -r1.98 koagendaview.cpp
--- koagendaview.cpp 3 Jul 2003 11:57:52 -0000 1.98
+++ koagendaview.cpp 20 Jul 2003 23:56:54 -0000
@@ -976,7 +976,7 @@ void KOAgendaView::newTimeSpanSelected(i
mTimeSpanBegin = dtStart;
mTimeSpanEnd = dtEnd;
}
-
+
void KOAgendaView::deleteSelectedDateTime()
{
mTimeSpanBegin.setDate(QDate());
Index: komonthview.cpp
===================================================================
RCS file: /home/kde/kdepim/korganizer/komonthview.cpp,v
retrieving revision 1.70
diff -u -3 -p -r1.70 komonthview.cpp
--- komonthview.cpp 14 Jul 2003 23:13:45 -0000 1.70
+++ komonthview.cpp 20 Jul 2003 23:56:54 -0000
@@ -32,6 +32,7 @@
#include <kglobal.h>
#include <kconfig.h>
#include <kiconloader.h>
+#include <kwordwrap.h>
#include <kcalendarsystem.h>
@@ -47,6 +48,7 @@
#include "komonthview.h"
#include "komonthview.moc"
+
KNoScrollListBox::KNoScrollListBox(QWidget *parent,const char *name)
: QListBox(parent, name),
mSqueezing(false)
@@ -138,12 +140,6 @@ MonthViewItem::MonthViewItem( Incidence
mReply = false;
}
-static QColor mixColors(double p1, QColor c1, QColor c2) {
- return QColor(int(c1.red() * p1 + c2.red() * (1.0-p1)),
- int(c1.green() * p1 + c2.green() * (1.0-p1)),
- int(c1.blue() * p1 + c2.blue() * (1.0-p1)));
-}
-
void MonthViewItem::paint(QPainter *p)
{
#if QT_VERSION >= 0x030000
@@ -184,33 +180,7 @@ void MonthViewItem::paint(QPainter *p)
QColorGroup::HighlightedText : QColorGroup::Foreground );
p->setPen( textColor );
- // try to fade out the text if it does not fit
- QString t = text();
- int maxW = listBox()->width() - x;
- if ( ( fm.boundingRect( t ).width() > maxW ) && ( t.length() > 1 ) ) {
- int tl = 0;
- int w = 0;
- while ( tl < t.length() ) {
- w += fm.charWidth( t, tl );
- if ( w >= maxW )
- break;
- tl++;
- }
-
- if (tl > 3) {
- p->drawText( x, yPos, t.left( tl - 3 ) );
- x += fm.width( t.left( tl - 3 ) );
- }
- int n = QMIN( tl, 3);
- for (int i = 0; i < n; i++) {
- p->setPen( mixColors( 0.70 - i * 0.25, textColor, bgColor ) );
- QString s( t.at( tl - n + i ) );
- p->drawText( x, yPos, s );
- x += fm.width( s );
- }
- }
- else
- p->drawText( x, yPos, t );
+ KWordWrap::drawFadeoutText(p, x, yPos, listBox()->width() - x, text());
}
int MonthViewItem::height(const QListBox *lb) const
Index: koprefs.cpp
===================================================================
RCS file: /home/kde/kdepim/korganizer/koprefs.cpp,v
retrieving revision 1.70
diff -u -3 -p -r1.70 koprefs.cpp
--- koprefs.cpp 28 Jun 2003 18:12:41 -0000 1.70
+++ koprefs.cpp 20 Jul 2003 23:56:54 -0000
@@ -48,13 +48,13 @@ KOPrefs::KOPrefs() :
{
mCategoryColors.setAutoDelete(true);
- mDefaultCategoryColor = QColor(196,196,196);
- QColor defaultHolidayColor = QColor("red");
- QColor defaultHighlightColor = KGlobalSettings::highlightColor();
- QColor defaultAgendaBgColor = QColor(128,128,128);
- QColor defaultWorkingHoursColor = QColor(160,160,160);
- QColor defaultTodoDueTodayColor = QColor("orange");
- QColor defaultTodoOverdueColor = QColor("red");
+ mDefaultCategoryColor = QColor(151, 235, 121);
+ QColor defaultHolidayColor = QColor(255, 100, 100);
+ QColor defaultHighlightColor = QColor(100, 100, 255);
+ QColor defaultAgendaBgColor = QColor(255, 255, 255);
+ QColor defaultWorkingHoursColor = QColor(225, 225, 255);
+ QColor defaultTodoDueTodayColor = QColor(255, 200, 50);
+ QColor defaultTodoOverdueColor = QColor(255, 100, 100);
mDefaultTimeBarFont = KGlobalSettings::generalFont();
mDefaultViewFont = KGlobalSettings::generalFont();
@@ -100,7 +100,7 @@ KOPrefs::KOPrefs() :
addItemFont("AgendaView Font",mAgendaViewFont, mDefaultViewFont);
addItemFont("MarcusBains Font",mMarcusBainsFont, mDefaultViewFont);
- KPrefs::setCurrentGroup("Colors");
+ KPrefs::setCurrentGroup("Colors2");
addItemColor("Holiday Color",mHolidayColor,defaultHolidayColor);
addItemColor("Highlight Color",mHighlightColor,defaultHighlightColor);
@@ -258,7 +258,7 @@ void KOPrefs::usrReadConfig()
mEmail = config()->readEntry("user_email");
fillMailDefaults();
- config()->setGroup("Category Colors");
+ config()->setGroup("Category Colors2");
QStringList::Iterator it;
for (it = mCustomCategories.begin();it != mCustomCategories.end();++it ) {
setCategoryColor(*it,config()->readColorEntry(*it,&mDefaultCategoryColor));
@@ -281,7 +281,7 @@ void KOPrefs::usrWriteConfig()
config()->writeEntry("user_name",mName);
config()->writeEntry("user_email",mEmail);
- config()->setGroup("Category Colors");
+ config()->setGroup("Category Colors2");
QDictIterator<QColor> it(mCategoryColors);
while (it.current()) {
config()->writeEntry(it.currentKey(),*(it.current()));
_______________________________________________
kde-pim mailing list
kde-pim@mail.kde.org
http://mail.kde.org/mailman/listinfo/kde-pim
kde-pim home page at http://pim.kde.org/
[prev in list] [next in list] [prev in thread] [next in thread]
Configure |
About |
News |
Add a list |
Sponsored by KoreLogic