summaryrefslogtreecommitdiffabout
path: root/korganizer/koagendaitem.cpp
authorzautrix <zautrix>2005-01-31 18:42:30 (UTC)
committer zautrix <zautrix>2005-01-31 18:42:30 (UTC)
commit949ead6797c44f632a4addd2e6aae1fb88f37816 (patch) (side-by-side diff)
tree4c2d4020333d94d8c03153f8e1e9ac5a33801c68 /korganizer/koagendaitem.cpp
parent8e627854bec00289be27915b81458cf22bbb000f (diff)
downloadkdepimpi-949ead6797c44f632a4addd2e6aae1fb88f37816.zip
kdepimpi-949ead6797c44f632a4addd2e6aae1fb88f37816.tar.gz
kdepimpi-949ead6797c44f632a4addd2e6aae1fb88f37816.tar.bz2
fix
Diffstat (limited to 'korganizer/koagendaitem.cpp') (more/less context) (ignore whitespace changes)
-rw-r--r--korganizer/koagendaitem.cpp10
1 files changed, 6 insertions, 4 deletions
diff --git a/korganizer/koagendaitem.cpp b/korganizer/koagendaitem.cpp
index a05c60e..5f9ed92 100644
--- a/korganizer/koagendaitem.cpp
+++ b/korganizer/koagendaitem.cpp
@@ -425,199 +425,201 @@ QPixmap * KOAgendaItem::paintPixAllday()
}
QPixmap * KOAgendaItem::paintPixSel()
{
static QPixmap* mPaintPixSel = 0;
if ( ! mPaintPixSel )
mPaintPixSel = new QPixmap(1,1);
return mPaintPixSel ;
}
void KOAgendaItem::paintEvent ( QPaintEvent *e )
{
if ( globalFlagBlockAgendaItemPaint )
return;
if ( globalFlagBlockAgenda > 0 && globalFlagBlockAgenda < 5 )
return;
int yy;
if ( mAllDay )
yy = y();
else
yy = mCellYTop * ( height() / cellHeight() );
int xx = x();
if ( xPaintCoord != xx || yPaintCoord != yy ||
wPaintCoord != width() || hPaintCoord != height()) {
xPaintCoord= xx;
yPaintCoord = yy;
wPaintCoord = width();
hPaintCoord = height();
globalFlagBlockAgendaItemUpdate = 0;
paintMe( mSelected );
//qDebug("calling paintMe ");
globalFlagBlockAgendaItemUpdate = 1;
}
int rx, ry, rw, rh;
rx = e->rect().x();
ry = e->rect().y();
rw = e->rect().width();
rh = e->rect().height();
//qDebug(" paintevent %s %d %d %d %d", mIncidence->summary().latin1(), x(), yy, width(), height());
QPixmap* paintFrom ;
if ( mSelected ) {
paintFrom = paintPixSel();
} else {
if ( mAllDay )
paintFrom = paintPixAllday();
else
paintFrom = paintPix();
}
bitBlt (this, rx, ry, paintFrom, x()+rx ,yPaintCoord+ry, rw, rh ,CopyROP);
}
void KOAgendaItem::computeText()
{
mDisplayedText = mIncidence->summary();
if ( (mIncidence->type() == "Todo") ) {
if ( static_cast<Todo*>(mIncidence)->hasDueDate() ) {
if ( static_cast<Todo*>(mIncidence)->dtDue().date() < QDate::currentDate() )
mDisplayedText += i18n(" (") +KGlobal::locale()->formatDate((static_cast<Todo*>(mIncidence))->dtDue().date(), true)+")";
else if ( !(mIncidence->doesFloat()))
mDisplayedText += i18n(" (") +KGlobal::locale()->formatTime((static_cast<Todo*>(mIncidence))->dtDue().time())+")";
}
} else {
if ( !(mIncidence->doesFloat()) && KOPrefs::instance()->mShowTimeInAgenda)
mDisplayedText += ": " +KGlobal::locale()->formatTime((static_cast<Event*>(mIncidence))->dtStart().time()) + "-" + KGlobal::locale()->formatTime((static_cast<Event*>(mIncidence))->dtEnd().time()) ;
if ( mAllDay ) {
if ( mIncidence->dtStart().date().addDays(3) < mIncidence->dtEnd().date() ) {
mDisplayedText += ": " +KGlobal::locale()->formatDate((static_cast<Event*>(mIncidence))->dtStart().date(), true) + " - " + KGlobal::locale()->formatDate((static_cast<Event*>(mIncidence))->dtEnd().date(), true) ;
}
}
}
if ( !mIncidence->location().isEmpty() ) {
if ( mAllDay )
mDisplayedText += " (";
else
mDisplayedText += "\n(";
mDisplayedText += mIncidence->location() +")";
}
QString tipText = mIncidence->summary();
QWhatsThis::add(this,KIncidenceFormatter::instance()->getFormattedText( mIncidence ));
if ( !mIncidence->doesFloat() ) {
if ( mIncidence->type() == "Event" ) {
if ( (static_cast<Event*>(mIncidence))->isMultiDay() ) {
tipText += "\n"+i18n("From: ")+mIncidence->dtStartStr();
tipText += "\n"+i18n("To: ")+(static_cast<Event*>(mIncidence))->dtEndStr();
}
else {
tipText += "\n"+i18n("Time: ")+mIncidence->dtStartTimeStr();
tipText += " - "+(static_cast<Event*>(mIncidence))->dtEndTimeStr();
}
}
else if ( mIncidence->type() == "Todo" ) {
if (mIncidence->hasStartDate())
- tipText += "\n"+i18n("Start: ")+ (static_cast<Todo*>(mIncidence))->dtStartStr();
- tipText += "\n"+i18n("Due: ")+ (static_cast<Todo*>(mIncidence))->dtDueStr();
+ tipText += "\n"+i18n("Start: ")+ (static_cast<Todo*>(mIncidence))->dtStartStr();
+ if (((Todo*)mIncidence)->hasDueDate())
+ tipText += "\n"+i18n("Due: ")+ (static_cast<Todo*>(mIncidence))->dtDueStr();
}
} else if ( mIncidence->type() == "Todo" ) {
if (mIncidence->hasStartDate())
- tipText += "\n"+i18n("Start: ")+ (static_cast<Todo*>(mIncidence))->dtStartDateStr();
- tipText += "\n"+i18n("Due: ")+ (static_cast<Todo*>(mIncidence))->dtDueDateStr();
+ tipText += "\n"+i18n("Start: ")+ (static_cast<Todo*>(mIncidence))->dtStartDateStr();
+ if (((Todo*)mIncidence)->hasDueDate())
+ tipText += "\n"+i18n("Due: ")+ (static_cast<Todo*>(mIncidence))->dtDueDateStr();
}
if (!mIncidence->location().isEmpty()) {
tipText += "\n"+i18n("Location: ")+mIncidence->location();
}
QToolTip::add(this,tipText,toolTipGroup(),"");
}
void KOAgendaItem::updateItem()
{
computeText();
//qDebug("KOAgendaItem:: updateItem() %s %d %d ",incidence()->summary().latin1(), x(), y());
paintMe( mSelected );
repaint( false);
}
void KOAgendaItem::resizeEvent ( QResizeEvent *ev )
{
//qDebug("KOAgendaItem::resizeEvent %s ", mIncidence->summary().latin1());
paintMe( mSelected );
repaint( false );
}
/*
Return height of item in units of agenda cells
*/
int KOAgendaItem::cellHeight()
{
int ret = mCellYBottom - mCellYTop + 1;
if ( ret <= 0 ) {
ret = 1;
mCellYBottom = 0;
mCellYTop = 0;
}
return ret;
}
/*
Return height of item in units of agenda cells
*/
int KOAgendaItem::cellWidth()
{
return mCellXWidth - mCellX + 1;
}
void KOAgendaItem::setItemDate(QDate qd)
{
mDate = qd;
}
void KOAgendaItem::setCellXY(int X, int YTop, int YBottom)
{
mCellX = X;
mCellYTop = YTop;
mCellYBottom = YBottom;
}
void KOAgendaItem::setCellXWidth(int xwidth)
{
mCellXWidth = xwidth;
}
void KOAgendaItem::setCellX(int XLeft, int XRight)
{
mCellX = XLeft;
mCellXWidth = XRight;
}
void KOAgendaItem::setCellY(int YTop, int YBottom)
{
mCellYTop = YTop;
mCellYBottom = YBottom;
}
void KOAgendaItem::setSubCell(int subCell)
{
mSubCell = subCell;
}
void KOAgendaItem::setSubCells(int subCells)
{
mSubCells = subCells;
}
void KOAgendaItem::setMultiItem(KOAgendaItem *first,KOAgendaItem *next,
KOAgendaItem *last)
{
mFirstMultiItem = first;
mNextMultiItem = next;
mLastMultiItem = last;
}
void KOAgendaItem::startMove()
{
mStartCellX = mCellX;