summaryrefslogtreecommitdiffabout
path: root/libkcal
Side-by-side diff
Diffstat (limited to 'libkcal') (more/less context) (ignore whitespace changes)
-rw-r--r--libkcal/kincidenceformatter.cpp18
-rw-r--r--libkcal/todo.cpp5
-rw-r--r--libkcal/todo.h2
3 files changed, 13 insertions, 12 deletions
diff --git a/libkcal/kincidenceformatter.cpp b/libkcal/kincidenceformatter.cpp
index c52f2b3..6d07d4c 100644
--- a/libkcal/kincidenceformatter.cpp
+++ b/libkcal/kincidenceformatter.cpp
@@ -146,74 +146,74 @@ void KIncidenceFormatter::setEvent(Event *event)
void KIncidenceFormatter::setTodo(Todo *event )
{
int mode = 0;
mCurrentIncidence = event;
bool shortDate = true;
if (mode == 0 )
addTag("h3",event->summary());
else {
if ( mColorMode == 1 ) {
mText +="<font color=\"#00A000\">";
}
if ( mColorMode == 2 ) {
mText +="<font color=\"#B00000\">";
}
if ( mode == 1 ) {
addTag("h2",i18n( "Local: " ) +event->summary());
} else {
addTag("h2",i18n( "Remote: " ) +event->summary());
}
addTag("h3",i18n( "Last modified: " ) + KGlobal::locale()->formatDateTime(event->lastModified(),shortDate, true ) );
if ( mColorMode )
mText += "</font>";
}
+ if ( event->percentComplete() == 100 && event->hasCompletedDate() ) {
+ mText +="<font color=\"#B00000\">";
+ addTag("i", i18n("<p><i>Completed on %1</i></p>").arg( event->completedStr(shortDate) ) );
+ mText += "</font>";
+ } else {
+ mText.append(i18n("<p><i>%1 % completed</i></p>")
+ .arg(event->percentComplete()));
+ }
if (event->cancelled ()) {
mText +="<font color=\"#B00000\">";
addTag("i",i18n("This todo has been cancelled!"));
mText.append("<br>");
mText += "</font>";
}
if (!event->location().isEmpty()) {
addTag("b",i18n("Location: "));
mText.append(event->location()+"<br>");
}
if (event->hasDueDate()) {
mText.append(i18n("<p><b>Due on:</b> %1</p>").arg(event->dtDueStr(shortDate)));
}
mText.append(i18n("<p><b>Priority:</b> %2</p>")
.arg(QString::number(event->priority())));
- if ( event->percentComplete() == 100 && event->hasCompletedDate() ) {
- mText.append(i18n("<p><i>Completed on %1</i></p>")
- .arg( event->completedStr() ));
- } else {
- mText.append(i18n("<p><i>%1 % completed</i></p>")
- .arg(event->percentComplete()));
- }
-
- addTag("p",i18n("<b>Access: </b>") +event->secrecyStr() );
+ addTag("p",i18n("<b>Access: </b>") +event->secrecyStr() );
formatCategories(event);
if (!event->description().isEmpty()) {
addTag("p",i18n("<b>Details: </b>"));
addTag("p",event->description());
}
formatReadOnly(event);
formatAttendees(event);
}
void KIncidenceFormatter::setJournal(Journal* )
{
}
void KIncidenceFormatter::formatCategories(Incidence *event)
{
if (!event->categoriesStr().isEmpty()) {
addTag("p",i18n("<b>Categories: </b>")+event->categoriesStr() );
//mText.append(event->categoriesStr());
}
diff --git a/libkcal/todo.cpp b/libkcal/todo.cpp
index 7362bdf..7d04793 100644
--- a/libkcal/todo.cpp
+++ b/libkcal/todo.cpp
@@ -279,55 +279,56 @@ QString Todo::statusStr() const
}
#endif
bool Todo::isCompleted() const
{
if (mPercentComplete == 100) return true;
else return false;
}
void Todo::setCompleted(bool completed)
{
if (completed) mPercentComplete = 100;
else {
mPercentComplete = 0;
mHasCompletedDate = false;
}
updated();
}
QDateTime Todo::completed() const
{
return mCompleted;
}
-QString Todo::completedStr() const
+QString Todo::completedStr( bool shortF ) const
{
- return KGlobal::locale()->formatDateTime(mCompleted);
+ return KGlobal::locale()->formatDateTime(mCompleted, shortF);
}
void Todo::setCompleted(const QDateTime &completed)
{
+ qDebug("Todo::setCompleted ");
mHasCompletedDate = true;
mPercentComplete = 100;
mCompleted = getEvenTime(completed);
updated();
}
bool Todo::hasCompletedDate() const
{
return mHasCompletedDate;
}
int Todo::percentComplete() const
{
return mPercentComplete;
}
void Todo::setPercentComplete(int v)
{
mPercentComplete = v;
if ( v != 100 )
mHasCompletedDate = false;
updated();
}
QDateTime Todo::getNextAlarmDateTime( bool * ok, int * offset ) const
diff --git a/libkcal/todo.h b/libkcal/todo.h
index 0f22c59..41f5841 100644
--- a/libkcal/todo.h
+++ b/libkcal/todo.h
@@ -72,49 +72,49 @@ class Todo : public Incidence
// void setStatus(int);
/** return the event's status. */
// int status() const;
/** return the event's status in string format. */
// QString statusStr() const;
/** return, if this todo is completed */
bool isCompleted() const;
/** set completed state of this todo */
void setCompleted(bool);
/**
Return how many percent of the task are completed. Returns a value
between 0 and 100.
*/
int percentComplete() const;
/**
Set how many percent of the task are completed. Valid values are in the
range from 0 to 100.
*/
void setPercentComplete(int);
/** return date and time when todo was completed */
QDateTime completed() const;
- QString completedStr() const;
+ QString completedStr(bool shortF = true) const;
/** set date and time of completion */
void setCompleted(const QDateTime &completed);
/** Return true, if todo has a date associated with completion */
bool hasCompletedDate() const;
bool contains ( Todo*);
private:
bool accept(Visitor &v) { return v.visit(this); }
QDateTime mDtDue; // due date of todo
bool mHasDueDate; // if todo has associated due date
// int mStatus; // confirmed/delegated/tentative/etc
QDateTime mCompleted;
bool mHasCompletedDate;
int mPercentComplete;
};
bool operator==( const Todo&, const Todo& );
}