summaryrefslogtreecommitdiffabout
path: root/korganizer/koagendaitem.cpp
Side-by-side diff
Diffstat (limited to 'korganizer/koagendaitem.cpp') (more/less context) (show whitespace changes)
-rw-r--r--korganizer/koagendaitem.cpp2
1 files changed, 1 insertions, 1 deletions
diff --git a/korganizer/koagendaitem.cpp b/korganizer/koagendaitem.cpp
index 303a92a..49ad9b8 100644
--- a/korganizer/koagendaitem.cpp
+++ b/korganizer/koagendaitem.cpp
@@ -141,193 +141,193 @@ void KOAgendaItem::init ( Incidence *incidence, QDate qd )
mIncidence = incidence;
mDate = qd;
mFirstMultiItem = 0;
mNextMultiItem = 0;
mLastMultiItem = 0;
computeText();
initColor();
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;
int xOff = 0;
int x = pos().x();
if ( x < 0 ) x = 0;
x += 3;
int y;
if ( mAllDay )
y = pos().y()+3;
else
y = mCellYTop * ( height() / cellHeight() ) +3;
if ( mIncidence->calID() > 1 ) {
p->fillRect ( xOff*( 1 +AGENDA_ICON_SIZE )+x, yOff*( 1 +AGENDA_ICON_SIZE)+y, AGENDA_ICON_SIZE, AGENDA_ICON_SIZE, KOPrefs::instance()->defaultColor( mIncidence->calID() ) );
p->drawRect ( xOff*( 1 +AGENDA_ICON_SIZE )+x-1, yOff*( 1 +AGENDA_ICON_SIZE)+y-1, AGENDA_ICON_SIZE+2, AGENDA_ICON_SIZE+2 );
if ( horLayout ){
++xOff;
++x;
}
else {
++yOff;
++y;
}
}
if (mIncidence->cancelled() && height() < 20 ) {
int xpos = xOff*( 1 +AGENDA_ICON_SIZE )+x;
int ypos = yOff*( 1 +AGENDA_ICON_SIZE)+y;
p->drawLine( xpos, ypos, xpos+AGENDA_ICON_SIZE-1, ypos+AGENDA_ICON_SIZE-1 );
p->drawLine( xpos, ypos+AGENDA_ICON_SIZE-1, xpos+AGENDA_ICON_SIZE-1, ypos );
if ( horLayout )
++xOff;
else
++yOff;
}
if (mIncidence->isAlarmEnabled() && mIncidence->alarmEnabled()) {
p->fillRect ( xOff*( 1 +AGENDA_ICON_SIZE )+x, yOff*( 1 +AGENDA_ICON_SIZE)+y, AGENDA_ICON_SIZE, AGENDA_ICON_SIZE, red );
if ( horLayout )
++xOff;
else
++yOff;
}
- if (mIncidence->recurrence()->doesRecur()) {
+ if (mIncidence->doesRecur()) {
p->fillRect ( xOff*( 1 +AGENDA_ICON_SIZE )+x, yOff*( 1 +AGENDA_ICON_SIZE)+y, AGENDA_ICON_SIZE, AGENDA_ICON_SIZE, blue );
if ( horLayout )
++xOff;
else
++yOff;
}
if (mIncidence->description().length() > 0) {
p->fillRect ( xOff*( 1 +AGENDA_ICON_SIZE )+x, yOff*( 1 +AGENDA_ICON_SIZE)+y, AGENDA_ICON_SIZE, AGENDA_ICON_SIZE, darkGreen );
if ( horLayout )
++xOff;
else
++yOff;
}
if (mIncidence->isReadOnly()) {
p->fillRect ( xOff*( 1 +AGENDA_ICON_SIZE )+x, yOff*( 1 +AGENDA_ICON_SIZE)+y, AGENDA_ICON_SIZE, AGENDA_ICON_SIZE, white );
if ( horLayout )
++xOff;
else
++yOff;
}
if (mIncidence->attendeeCount()>0) {
if (mIncidence->organizer() == KOPrefs::instance()->email()) {
p->fillRect ( xOff*( 1 +AGENDA_ICON_SIZE )+x, yOff*( 1 +AGENDA_ICON_SIZE)+y, AGENDA_ICON_SIZE, AGENDA_ICON_SIZE, black );
if ( horLayout )
++xOff;
else
++yOff;
} else {
Attendee *me = mIncidence->attendeeByMails(KOPrefs::instance()->mAdditionalMails,KOPrefs::instance()->email());
if (me!=0) {
} else {
p->fillRect ( xOff*( 1 +AGENDA_ICON_SIZE )+x, yOff*( 1 +AGENDA_ICON_SIZE)+y, AGENDA_ICON_SIZE, AGENDA_ICON_SIZE, yellow );
if ( horLayout )
++xOff;
else
++yOff;
}
p->fillRect ( xOff*( 1 +AGENDA_ICON_SIZE )+x, yOff*( 1 +AGENDA_ICON_SIZE)+y, AGENDA_ICON_SIZE, AGENDA_ICON_SIZE, darkYellow );
if ( horLayout )
++xOff;
else
++yOff;
}
}
return ( yOff || xOff );
}
void KOAgendaItem::select(bool selected)
{
//qDebug("select %d %d",firstMultiItem(), nextMultiItem() );
if (mSelected == selected) return;
mSelected = selected;
if ( ! isVisible() )
return;
if ( firstMultiItem() )
firstMultiItem()->select( selected );
if ( !firstMultiItem() && nextMultiItem() ) {
KOAgendaItem * placeItem = nextMultiItem();
while ( placeItem ) {
placeItem->select( selected );
placeItem = placeItem->nextMultiItem();
}
}
globalFlagBlockAgendaItemUpdate = 0;
paintMe( selected );
globalFlagBlockAgendaItemUpdate = 1;
repaint( false );
}
/*
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 )
{
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;