summaryrefslogtreecommitdiffabout
authorzautrix <zautrix>2005-01-30 10:57:34 (UTC)
committer zautrix <zautrix>2005-01-30 10:57:34 (UTC)
commit446ea98a9f6550c4a3e64bcfc6aab8e8b58776e8 (patch) (side-by-side diff)
tree26260551e87a4074651a5cdceee5e788f743a02d
parent949c6e28c83668176fd9c29e12668322c6ae627f (diff)
downloadkdepimpi-446ea98a9f6550c4a3e64bcfc6aab8e8b58776e8.zip
kdepimpi-446ea98a9f6550c4a3e64bcfc6aab8e8b58776e8.tar.gz
kdepimpi-446ea98a9f6550c4a3e64bcfc6aab8e8b58776e8.tar.bz2
bugs from last commit fixed
Diffstat (more/less context) (show whitespace changes)
-rw-r--r--korganizer/koagenda.cpp11
-rw-r--r--korganizer/koagendaview.cpp31
-rw-r--r--korganizer/koeventviewer.cpp18
-rw-r--r--korganizer/kotodoview.cpp13
-rw-r--r--korganizer/kotodoviewitem.cpp7
-rw-r--r--libkcal/kincidenceformatter.cpp16
-rw-r--r--libkcal/todo.cpp5
-rw-r--r--libkcal/todo.h2
8 files changed, 65 insertions, 38 deletions
diff --git a/korganizer/koagenda.cpp b/korganizer/koagenda.cpp
index 002234d..7c41cab 100644
--- a/korganizer/koagenda.cpp
+++ b/korganizer/koagenda.cpp
@@ -1420,3 +1420,3 @@ void KOAgenda::updateTodo( Todo * todo, int days, bool remove)
{
-
+ // ( todo->hasCompletedDate() && todo->completed().date() == currentDate )||
KOAgendaItem *item;
@@ -1459,2 +1459,7 @@ void KOAgenda::updateTodo( Todo * todo, int days, bool remove)
QDate currentDate;
+ QDateTime dt;
+ if ( todo->hasCompletedDate() )
+ dt = todo->completed();
+ else
+ dt = todo->dtDue();
if ( overdue ) {
@@ -1464,3 +1469,3 @@ void KOAgenda::updateTodo( Todo * todo, int days, bool remove)
else
- currentDate = todo->dtDue().date();
+ currentDate = dt.date();
@@ -1478,3 +1483,3 @@ void KOAgenda::updateTodo( Todo * todo, int days, bool remove)
globalFlagBlockAgendaItemPaint = 1;
- int endY = timeToY(todo->dtDue().time()) - 1;
+ int endY = timeToY(dt.time()) - 1;
int hi = 12/KOPrefs::instance()->mHourSize;
diff --git a/korganizer/koagendaview.cpp b/korganizer/koagendaview.cpp
index 1864e22..bbc43e4 100644
--- a/korganizer/koagendaview.cpp
+++ b/korganizer/koagendaview.cpp
@@ -952,2 +952,3 @@ void KOAgendaView::updateEventDates(KOAgendaItem *item, int type)
// todo
+ qDebug("tooooodoooooo ");
if (item->lastMultiItem()) {
@@ -967,3 +968,3 @@ void KOAgendaView::updateEventDates(KOAgendaItem *item, int type)
-
+ qDebug("to888");
if ( item->incidence()->type() == "Event" ) {
@@ -1057,3 +1058,3 @@ void KOAgendaView::fillAgenda()
// ToDo items shall be displayed for the day they are due, but only showed today if they are already overdue.
- // Therefore, get all of them.
+ // Therefore, gtodoset all of them.
QPtrList<Todo> todos = calendar()->todos();
@@ -1157,5 +1158,9 @@ void KOAgendaView::fillAgenda()
bool overdue = (!todo->isCompleted()) && (todo->dtDue() < today) && KOPrefs::instance()->mShowTodoInAgenda;
-
- if ( ((todo->dtDue().date() == currentDate) && !overdue) || ( todo->hasCompletedDate() && todo->completed().date() == currentDate )||
- ((currentDate == today) && overdue) ) {
+ bool fillIn = false;
+ if ( todo->hasCompletedDate() && todo->completed().date() == currentDate )
+ fillIn = true;
+ if ( ! fillIn && !todo->hasCompletedDate() )
+ fillIn = ((todo->dtDue().date() == currentDate) && !overdue) || ((currentDate == today) && overdue);
+ qDebug("refill todo ");
+ if ( fillIn ) {
if ( (todo->doesFloat() || overdue ) && !todo->hasCompletedDate() ) { // Todo has no due-time set or is already overdue
@@ -1508,3 +1513,8 @@ void KOAgendaView::updateTodo( Todo * t, int )
bool removeAD = false;
- if ( ! t->hasDueDate() ) {
+ QDate da;
+ if ( t->hasCompletedDate() )
+ da = t->completed().date();
+ else
+ da = t->dtDue().date();
+ if ( ! t->hasDueDate() && !t->hasCompletedDate() ) {
remove = true;
@@ -1521,4 +1531,5 @@ void KOAgendaView::updateTodo( Todo * t, int )
else {
- if ( t->dtDue().date() < mSelectedDates.first() ||
- t->dtDue().date() > mSelectedDates.last() ) {
+
+ if ( da < mSelectedDates.first() ||
+ da > mSelectedDates.last() ) {
remove = true;
@@ -1526,3 +1537,3 @@ void KOAgendaView::updateTodo( Todo * t, int )
} else {
- remove = t->doesFloat();
+ remove = t->doesFloat() && !t->hasCompletedDate();
removeAD = !remove;
@@ -1531,3 +1542,3 @@ void KOAgendaView::updateTodo( Todo * t, int )
}
- int days = mSelectedDates.first().daysTo( t->dtDue().date() );
+ int days = mSelectedDates.first().daysTo( da );
// qDebug("daysto %d ", days );
diff --git a/korganizer/koeventviewer.cpp b/korganizer/koeventviewer.cpp
index 36a2947..7dc1880 100644
--- a/korganizer/koeventviewer.cpp
+++ b/korganizer/koeventviewer.cpp
@@ -349,2 +349,12 @@ void KOEventViewer::appendTodo(Todo *event, int mode )
mMailSubject += i18n( "Todo " )+ event->summary();
+
+ if ( event->percentComplete() == 100 && event->hasCompletedDate() ) {
+ mText +="<font color=\"#B00000\">";
+ addTag("i", i18n("<p><i>Completed on %1</i></p>").arg( event->completedStr(KOPrefs::instance()->mShortDateInViewer) ) );
+ mText += "</font>";
+ } else {
+ mText.append(i18n("<p><i>%1 % completed</i></p>")
+ .arg(event->percentComplete()));
+ }
+
if (event->cancelled ()) {
@@ -381,10 +391,2 @@ void KOEventViewer::appendTodo(Todo *event, int mode )
- 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()));
- }
-
formatReadOnly(event);
diff --git a/korganizer/kotodoview.cpp b/korganizer/kotodoview.cpp
index 8c1953d..14e8b5c 100644
--- a/korganizer/kotodoview.cpp
+++ b/korganizer/kotodoview.cpp
@@ -336,2 +336,3 @@ KOTodoView::KOTodoView(Calendar *calendar,QWidget* parent,const char* name) :
{
+ isFlatDisplay = false;
mNavigator = 0;
@@ -954,6 +955,11 @@ void KOTodoView::itemClicked(QListViewItem *item)
}
- int completed = todoItem->todo()->isCompleted(); // Completed or not?
-
+#if 0
+ // handled by the item itself
+ bool completed = todoItem->todo()->isCompleted(); // Completed or not?
+ qDebug("com %d ",completed );
+ qDebug("itemclicked ");
if (todoItem->isOn()) {
+ qDebug("on ");
if (!completed) {
+ qDebug("set true ");
todoItem->todo()->setCompleted(QDateTime::currentDateTime());
@@ -961,3 +967,5 @@ void KOTodoView::itemClicked(QListViewItem *item)
} else {
+ qDebug("not on ");
if (completed) {
+ qDebug("set false ");
todoItem->todo()->setCompleted(false);
@@ -965,2 +973,3 @@ void KOTodoView::itemClicked(QListViewItem *item)
}
+#endif
}
diff --git a/korganizer/kotodoviewitem.cpp b/korganizer/kotodoviewitem.cpp
index 21ecb73..2822237 100644
--- a/korganizer/kotodoviewitem.cpp
+++ b/korganizer/kotodoviewitem.cpp
@@ -205,4 +205,3 @@ void KOTodoViewItem::stateChange(bool state)
if ( m_init ) return;
-
- kdDebug() << "State changed, modified " << state << endl;
+ qDebug("KOTodoViewItem::stateChange ");
QString keyd = "==";
@@ -210,4 +209,4 @@ void KOTodoViewItem::stateChange(bool state)
- if (state) mTodo->setCompleted(state);
- else mTodo->setPercentComplete(0);
+ mTodo->setCompleted(state);
+ if (state) mTodo->setCompleted(QDateTime::currentDateTime());
if (isOn()!=state) {
diff --git a/libkcal/kincidenceformatter.cpp b/libkcal/kincidenceformatter.cpp
index c52f2b3..6d07d4c 100644
--- a/libkcal/kincidenceformatter.cpp
+++ b/libkcal/kincidenceformatter.cpp
@@ -169,2 +169,10 @@ void KIncidenceFormatter::setTodo(Todo *event )
}
+ 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 ()) {
@@ -186,10 +194,2 @@ void KIncidenceFormatter::setTodo(Todo *event )
- 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() );
diff --git a/libkcal/todo.cpp b/libkcal/todo.cpp
index 7362bdf..7d04793 100644
--- a/libkcal/todo.cpp
+++ b/libkcal/todo.cpp
@@ -302,5 +302,5 @@ QDateTime Todo::completed() const
-QString Todo::completedStr() const
+QString Todo::completedStr( bool shortF ) const
{
- return KGlobal::locale()->formatDateTime(mCompleted);
+ return KGlobal::locale()->formatDateTime(mCompleted, shortF);
}
@@ -309,2 +309,3 @@ void Todo::setCompleted(const QDateTime &completed)
{
+ qDebug("Todo::setCompleted ");
mHasCompletedDate = true;
diff --git a/libkcal/todo.h b/libkcal/todo.h
index 0f22c59..41f5841 100644
--- a/libkcal/todo.h
+++ b/libkcal/todo.h
@@ -95,3 +95,3 @@ class Todo : public Incidence
QDateTime completed() const;
- QString completedStr() const;
+ QString completedStr(bool shortF = true) const;
/** set date and time of completion */