summaryrefslogtreecommitdiffabout
path: root/korganizer
authorzautrix <zautrix>2005-06-15 09:19:15 (UTC)
committer zautrix <zautrix>2005-06-15 09:19:15 (UTC)
commit37175a31a8fa8772403e9588ff3f8bd7de3979cc (patch) (side-by-side diff)
treed5e7210eaf5c0700e4957b898e01fb0f6dd73711 /korganizer
parent820a1285559d0bb5859f634ebc6865f3a85a93ab (diff)
downloadkdepimpi-37175a31a8fa8772403e9588ff3f8bd7de3979cc.zip
kdepimpi-37175a31a8fa8772403e9588ff3f8bd7de3979cc.tar.gz
kdepimpi-37175a31a8fa8772403e9588ff3f8bd7de3979cc.tar.bz2
fix
Diffstat (limited to 'korganizer') (more/less context) (ignore whitespace changes)
-rw-r--r--korganizer/koagendaitem.cpp5
-rw-r--r--korganizer/koagendaitem.h1
2 files changed, 3 insertions, 3 deletions
diff --git a/korganizer/koagendaitem.cpp b/korganizer/koagendaitem.cpp
index 1be0aca..e660c32 100644
--- a/korganizer/koagendaitem.cpp
+++ b/korganizer/koagendaitem.cpp
@@ -90,97 +90,97 @@ KOAgendaItem::KOAgendaItem(Incidence *incidence, QDate qd, QWidget *parent,bool
}
QString KOAgendaItem::getWhatsThisText()
{
if ( mIncidence )
return KIncidenceFormatter::instance()->getFormattedText( mIncidence,
KOPrefs::instance()->mWTshowDetails,
KOPrefs::instance()->mWTshowCreated,
KOPrefs::instance()->mWTshowChanged);
return "KOAgendaItem::getWhatsThisText()::internal error";
}
void KOAgendaItem::init ( Incidence *incidence, QDate qd )
{
mIncidence = incidence;
mDate = qd;
mFirstMultiItem = 0;
mNextMultiItem = 0;
mLastMultiItem = 0;
computeText();
if ( (incidence->typeID() == todoID ) &&
( !((static_cast<Todo*>(incidence))->isCompleted()) &&
((static_cast<Todo*>(incidence))->dtDue().date() <= QDate::currentDate()) ) ) {
if ( (static_cast<Todo*>(incidence))->dtDue() < QDateTime::currentDateTime().date())
mBackgroundColor = KOPrefs::instance()->mTodoOverdueColor ;
else
mBackgroundColor = KOPrefs::instance()->mTodoDueTodayColor;
}
else {
QStringList categories = mIncidence->categories();
QString cat = categories.first();
if (cat.isEmpty()) {
if ( (incidence->typeID() == todoID ) &&((static_cast<Todo*>(incidence))->isCompleted()) )
mBackgroundColor =KOPrefs::instance()->mTodoDoneColor;
else
mBackgroundColor =KOPrefs::instance()->defaultColor( incidence->calID() );
} else {
mBackgroundColor = *KOPrefs::instance()->categoryColor(cat);
if ( (incidence->typeID() == todoID ) &&((static_cast<Todo*>(incidence))->isCompleted()) ) {
if ( mBackgroundColor == KOPrefs::instance()->mEventColor )
mBackgroundColor = KOPrefs::instance()->mTodoDoneColor;
}
}
}
mColorGroup = QColorGroup( mBackgroundColor.light(),
mBackgroundColor.dark(),mBackgroundColor.light(),
mBackgroundColor.dark(),mBackgroundColor, black, mBackgroundColor) ;
setBackgroundColor( mBackgroundColor );
-
+ mWhiteText = (mBackgroundColor.red() + mBackgroundColor.green() + mBackgroundColor.blue() < 250);
mConflictItems.clear();
setCellXY(0,0,1);
setCellXWidth(0);
setSubCell(0);
setSubCells(1);
setMultiItem(0,0,0);
startMove();
mSelected = true;
select(false);
QFontMetrics fontinf(KOPrefs::instance()->mAgendaViewFont);
mFontPixelSize = fontinf.height();;
hide();
xPaintCoord = -1;
yPaintCoord = -1;
}
KOAgendaItem::~KOAgendaItem()
{
#if QT_VERSION >= 0x030000
#else
delete mKOAgendaItemWhatsThis;
#endif
}
void KOAgendaItem::recreateIncidence()
{
#if 0
Incidence* newInc = mIncidence->clone();
newInc->recreate();
if ( mIncidence->doesRecur() ) {
mIncidence->addExDate( mDate );
newInc->recurrence()->unsetRecurs();
int len = mIncidence->dtStart().secsTo( ((Event*)mIncidence)->dtEnd());
QTime tim = mIncidence->dtStart().time();
newInc->setDtStart( QDateTime(mDate, tim) );
((Event*)newInc)->setDtEnd( newInc->dtStart().addSecs( len ) );
}
#endif
mIncidence = mIncidence->recreateCloneException( mDate );
}
bool KOAgendaItem::updateIcons(QPainter * p, bool horLayout)
{
int size = AGENDA_ICON_SIZE;
int yOff = 0;
@@ -360,98 +360,97 @@ void KOAgendaItem::paintMe( bool selected, QPainter* paint )
static const QPixmap completedPxmp = SmallIcon("greenhook16");
static const QPixmap overduePxmp = SmallIcon("redcross16");
if ( mIncidence->typeID() == todoID ) {
Todo* tempTodo = static_cast<Todo*>(mIncidence);
int xx = pos().x()+(width()-completedPxmp.width()-3 );
int yyy = yy+3;
if ( tempTodo->isCompleted() )
paint->drawPixmap ( xx, yyy, completedPxmp );
else {
paint->drawPixmap ( xx, yyy, overduePxmp );
}
}
bool addIcon = false;
if ( ! small || w > 3 * h || h > 3* w )
addIcon = updateIcons( paint, horLayout );
//qDrawShadePanel (paint, x, yy, w, h, mColorGroup, selected , 2, 0);
qDrawWinPanel (paint, x, yy, w, h, mColorGroup, selected ,0);
//qDebug("draw rect %d %d %d %d ",x, yy, w, h );
if ( ! small ) {
x += 3; yy += 3;w -= 6; h-= 5;
} else {
x += 2; yy += 1;w -= 4; h-= 4;
if ( nfh < 6.01 ) {
yy -= 2;
h += 4;
}
else
if ( nfh < h -2 )
++yy;
}
int align;
#ifndef DESKTOP_VERSION
align = ( AlignLeft|WordBreak|AlignTop);
#else
align = ( AlignLeft|BreakAnywhere|WordBreak|AlignTop);
#endif
if ( addIcon ) {
if ( ! horLayout ) {
x += AGENDA_ICON_SIZE+3;
w -= (AGENDA_ICON_SIZE+3);
}
else {
yy+= AGENDA_ICON_SIZE+2;
h -=(AGENDA_ICON_SIZE+3);
}
}
- int colsum = mBackgroundColor.red() + mBackgroundColor.green() + mBackgroundColor.blue();
- if ( colsum < 250 )
+ if ( mWhiteText )
paint->setPen ( white);
if ( x < 0 ) {
w = w+x-3;
x = 3;
if ( w > parentWidget()->width() ){
w = parentWidget()->width() - 6;
#ifndef DESKTOP_VERSION
align = ( AlignHCenter|WordBreak|AlignTop);
#else
align = ( AlignHCenter|BreakAnywhere|WordBreak|AlignTop);
#endif
}
}
QRect dr;
if ( w + x > parentWidget()->width() )
w = parentWidget()->width()-x;
paint->drawText ( x, yy, w, h, align, mDisplayedText, -1, &dr );
//qDebug("%d %d %d %d ", x, yy, w, h );
if ( mIncidence->cancelled() ){
small = ( height() < 20 );
if ( ! small ) {
QFontMetrics fm ( paint->font() );
paint->drawLine(dr.left(), yy+fm.height()/2, dr.right()-2, yy+fm.height()/2);
}
}
pa.end();
}
void KOAgendaItem::resizePixmap( int w , int h )
{
paintPix()->resize( w, h );
paintPixSel()->resize( w, h );
}
QPixmap * KOAgendaItem::paintPix()
{
static QPixmap* mPaintPix = 0;
if ( ! mPaintPix ) {
int w = QApplication::desktop()->width();
int h = QApplication::desktop()->height();
mPaintPix = new QPixmap(w,h);
}
return mPaintPix ;
diff --git a/korganizer/koagendaitem.h b/korganizer/koagendaitem.h
index 53658c0..d1b1940 100644
--- a/korganizer/koagendaitem.h
+++ b/korganizer/koagendaitem.h
@@ -77,88 +77,89 @@ class KOAgendaItem : public QWidget
void expandRight(int dx);
int mLastMoveXPos;
void setMultiItem(KOAgendaItem *first,KOAgendaItem *next,
KOAgendaItem *last);
KOAgendaItem *firstMultiItem() { return mFirstMultiItem; }
KOAgendaItem *nextMultiItem() { return mNextMultiItem; }
KOAgendaItem *lastMultiItem() { return mLastMultiItem; }
Incidence *incidence() const { return mIncidence; }
QDate itemDate() { return mDate; }
/** Update the date of this item's occurence (not in the event) */
void setItemDate(QDate qd);
void setText ( const QString & text ) { mDisplayedText = text; }
QString text () { return mDisplayedText; }
virtual bool eventFilter ( QObject *, QEvent * );
static QToolTipGroup *toolTipGroup();
QPtrList<KOAgendaItem> conflictItems();
void setConflictItems(QPtrList<KOAgendaItem>);
void addConflictItem(KOAgendaItem *ci);
void paintMe( bool, QPainter* painter = 0 );
void repaintMe();
static void resizePixmap( int, int );
static QPixmap * paintPix();
static QPixmap * paintPixSel();
static QPixmap * paintPixAllday();
void updateItem();
void computeText();
void recreateIncidence();
bool checkLayout();
public slots:
bool updateIcons( QPainter *, bool );
void select(bool=true);
protected:
void dragEnterEvent(QDragEnterEvent *e);
void dropEvent(QDropEvent *e);
void paintEvent ( QPaintEvent * );
void resizeEvent ( QResizeEvent *ev );
private:
KOAgendaItemWhatsThis* mKOAgendaItemWhatsThis;
bool mAllDay;
+ bool mWhiteText;
int mCellX;
int mCellXWidth;
int mCellYTop,mCellYBottom;
int mSubCell; // subcell number of this item
int mSubCells; // Total number of subcells in cell of this item
int xPaintCoord;
int yPaintCoord;
int wPaintCoord;
int hPaintCoord;
// Variables to remember start position
int mStartCellX;
int mStartCellXWidth;
int mStartCellYTop,mStartCellYBottom;
int mLastMovePos;
// Multi item pointers
KOAgendaItem *mFirstMultiItem;
KOAgendaItem *mNextMultiItem;
KOAgendaItem *mLastMultiItem;
int mFontPixelSize;
Incidence *mIncidence; // corresponding event or todo
QDate mDate; //date this events occurs (for recurrence)
//void showIcon( QLabel*, int );
//QLabel *mTodoIconLabel;
//QLabel *mItemLabel;
//QWidget *mIconBox;
//QLabel *mIconAlarm,*mIconRecur,*mIconReadonly;
//QLabel *mIconReply,*mIconGroup,*mIconOrganizer;
//QLabel *mIconMoreInfo;
static QToolTipGroup *mToolTipGroup;
QColor mBackgroundColor;
QColorGroup mColorGroup;
QString mDisplayedText;
bool mSelected;
QPtrList<KOAgendaItem> mConflictItems;
};
#endif // KOAGENDAITEM_H