summaryrefslogtreecommitdiffabout
path: root/korganizer
authorMichael Krelin <hacker@klever.net>2008-01-28 23:33:00 (UTC)
committer Michael Krelin <hacker@klever.net>2008-01-28 23:33:00 (UTC)
commit64a94e6b6ee261c21c68709134631a16b39a0256 (patch) (side-by-side diff)
tree12e7693f1b665711c3487ae2779b2469ea8e1499 /korganizer
parent1c5369f3785b118ff4d18c4940913b800dd201fb (diff)
downloadkdepimpi-master.zip
kdepimpi-master.tar.gz
kdepimpi-master.tar.bz2
fixed segfault when trying to display uncategorized eventHEADmaster
Signed-off-by: Michael Krelin <hacker@klever.net>
Diffstat (limited to 'korganizer') (more/less context) (ignore whitespace changes)
-rw-r--r--korganizer/koagendaitem.cpp3
1 files changed, 2 insertions, 1 deletions
diff --git a/korganizer/koagendaitem.cpp b/korganizer/koagendaitem.cpp
index 0f9a38f..d38cb00 100644
--- a/korganizer/koagendaitem.cpp
+++ b/korganizer/koagendaitem.cpp
@@ -75,97 +75,98 @@ public:
protected:
virtual QString text( const QPoint& )
{
return _view->getWhatsThisText() ;
}
private:
KOAgendaItem * _view;
};
KOAgendaItem::KOAgendaItem(Incidence *incidence, QDate qd, QWidget *parent,bool allday,
const char *name,Qt::WFlags) :
QWidget(parent, name), mIncidence(incidence), mDate(qd)
{
#ifndef DESKTOP_VERSION
//QPEApplication::setStylusOperation( this, QPEApplication::RightOnHold );
#endif
mKOAgendaItemWhatsThis = new KOAgendaItemWhatsThis(this);
Qt::WindowFlags wflags = windowFlags() |Qt::WRepaintNoErase;// WResizeNoErase
setWindowFlags ( wflags);
mAllDay = allday;
init ( incidence, qd );
//setMouseTracking(true);
//setAcceptDrops(true);
xPaintCoord = -1;
yPaintCoord = -1;
}
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::initColor ()
{
if ( (mIncidence->typeID() == todoID ) &&
( !((static_cast<Todo*>(mIncidence))->isCompleted()) &&
((static_cast<Todo*>(mIncidence))->dtDue().date() <= QDate::currentDate()) ) ) {
if ( (static_cast<Todo*>(mIncidence))->dtDue() < (QDateTime)QDateTime::currentDateTime().date())
mBackgroundColor = KOPrefs::instance()->mTodoOverdueColor ;
else
mBackgroundColor = KOPrefs::instance()->mTodoDueTodayColor;
}
else {
QStringList categories = mIncidence->categories();
- QString cat = categories.first();
+ QString cat;
+ if(!categories.isEmpty()) cat = categories.first();
if (cat.isEmpty()) {
if ( (mIncidence->typeID() == todoID ) &&((static_cast<Todo*>(mIncidence))->isCompleted()) )
mBackgroundColor =KOPrefs::instance()->mTodoDoneColor;
else
mBackgroundColor =KOPrefs::instance()->defaultColor( mIncidence->calID() );
} else {
mBackgroundColor = *KOPrefs::instance()->categoryColor(cat);
if ( (mIncidence->typeID() == todoID ) &&((static_cast<Todo*>(mIncidence))->isCompleted()) ) {
if ( mBackgroundColor == KOPrefs::instance()->mEventColor )
mBackgroundColor = KOPrefs::instance()->mTodoDoneColor;
}
}
}
QColor BackgroundColor ( mBackgroundColor );
if ( mIncidence->calID() > 1 ) {
//BackgroundColor = KOPrefs::instance()->defaultColor( mIncidence->calID() );
}
mColorGroup = QColorGroup( BackgroundColor.light(),
BackgroundColor.dark(),BackgroundColor.light(),
BackgroundColor.dark(),BackgroundColor, Qt::black, BackgroundColor) ;
setBackgroundColor( mBackgroundColor );
mWhiteText = (mBackgroundColor.red() + mBackgroundColor.green() + mBackgroundColor.blue() < 250);
}
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;