rem: QDateTime dateTime = event.nextDateTime();
add: QDateTime dateTime = event.expired() ? event.startDateTime() : event.nextDateTime();
context: AlarmListViewItem::AlarmListViewItem(QListView* parent, const KAlarmEvent& event)	: QListViewItem(parent),	  mEvent(event){	if (!iconWidth)	{		// Find the width of the widest icon so that the display can be lined up		textIcon    = new QPixmap(SmallIcon("message"));		fileIcon    = new QPixmap(SmallIcon("file"));		commandIcon = new QPixmap(SmallIcon("exec"));		emailIcon   = new QPixmap(SmallIcon("mail_generic"));		if (textIcon)			iconWidth = textIcon->width();		if (fileIcon  &&  fileIcon->width() > iconWidth)			iconWidth = fileIcon->width();		if (commandIcon  &&  commandIcon->width() > iconWidth)			iconWidth = commandIcon->width();		if (emailIcon  &&  emailIcon->width() > iconWidth)			iconWidth = emailIcon->width();	}	QString messageText = (event.action() == KAlarmEvent::EMAIL) ? event.emailSubject() : event.cleanText();	int newline = messageText.find('\n');	if (newline >= 0)		messageText = messageText.left(newline) + QString::fromLatin1("...");	setText(AlarmListView::MESSAGE_COLUMN, messageText);	mMessageWidth = width(parent->fontMetrics(), parent, AlarmListView::MESSAGE_COLUMN);	QDateTime dateTime = event.nextDateTime();	QString dateTimeText = KGlobal::locale()->formatDate(dateTime.date(), true);	if (!event.anyTime())	{		dateTimeText += ' ';		dateTimeText += KGlobal::locale()->formatTime(dateTime.time()) + ' ';	}	setText(AlarmListView::TIME_COLUMN, dateTimeText);	mDateTimeOrder.sprintf("%04d%03d%02d%02d", dateTime.date().year(), dateTime.date().dayOfYear(),	                                           dateTime.time().hour(), dateTime.time().minute());	int repeatOrder = 0;	int repeatInterval = 0;	QString repeatText;        // text displayed in Repeat column	if (event.repeatAtLogin())	{		repeatOrder = 1;		repeatText = i18n("Login");	}	else	{		repeatInterval = event.recurInterval();		switch (event.recurType())		{			case KAlarmEvent::MINUTELY:				repeatOrder = 2;				if (repeatInterval < 60)					repeatText = i18n("1 Minute", "%n Minutes", repeatInterval);				else if (repeatInterval % 60 == 0)					repeatText = i18n("1 Hour", "%n Hours", repeatInterval/60);				else				{					QString mins;					repeatText = i18n("Hours and Minutes", "%1H %2M").arg(QString::number(repeatInterval/60)).arg(mins.sprintf("%02d", repeatInterval%60));				}				break;			case KAlarmEvent::DAILY:				repeatOrder = 3;				repeatText = i18n("1 Day", "%n Days", repeatInterval);				break;			case KAlarmEvent::WEEKLY:				repeatOrder = 4;				repeatText = i18n("1 Week", "%n Weeks", repeatInterval);				break;			case KAlarmEvent::MONTHLY_DAY:			case KAlarmEvent::MONTHLY_POS:				repeatOrder = 5;				repeatText = i18n("1 Month", "%n Months", repeatInterval);				break;			case KAlarmEvent::ANNUAL_DATE:			case KAlarmEvent::ANNUAL_POS:			case KAlarmEvent::ANNUAL_DAY:				repeatOrder = 6;				repeatText = i18n("1 Year", "%n Years", repeatInterval);				break;			case KAlarmEvent::NO_RECUR:			default:				break;		}	}	setText(AlarmListView::REPEAT_COLUMN, repeatText);	mRepeatOrder.sprintf("%c%08d", '0' + repeatOrder, repeatInterval);	bool showColour = (event.action() == KAlarmEvent::MESSAGE || event.action() == KAlarmEvent::FILE);	mColourOrder.sprintf("%06u", (showColour ? event.colour().rgb() : 0));}