summaryrefslogtreecommitdiffabout
authorzautrix <zautrix>2005-01-30 12:08:19 (UTC)
committer zautrix <zautrix>2005-01-30 12:08:19 (UTC)
commit1bcef8b3f53419e7155e0862ad61e3e419763d70 (patch) (side-by-side diff)
tree166b82db7bc30b7d55b042bd37bb92facea6cdf2
parent446ea98a9f6550c4a3e64bcfc6aab8e8b58776e8 (diff)
downloadkdepimpi-1bcef8b3f53419e7155e0862ad61e3e419763d70.zip
kdepimpi-1bcef8b3f53419e7155e0862ad61e3e419763d70.tar.gz
kdepimpi-1bcef8b3f53419e7155e0862ad61e3e419763d70.tar.bz2
fixes
Diffstat (more/less context) (ignore whitespace changes)
-rw-r--r--korganizer/koagendaview.cpp3
-rw-r--r--korganizer/kotodoview.cpp29
-rw-r--r--korganizer/kotodoviewitem.cpp30
-rw-r--r--libkcal/todo.cpp6
4 files changed, 44 insertions, 24 deletions
diff --git a/korganizer/koagendaview.cpp b/korganizer/koagendaview.cpp
index bbc43e4..42a6f7c 100644
--- a/korganizer/koagendaview.cpp
+++ b/korganizer/koagendaview.cpp
@@ -1160,9 +1160,8 @@ void KOAgendaView::fillAgenda()
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
if ( KOPrefs::instance()->mShowTodoInAgenda )
mAllDayAgenda->insertAllDayItem(todo, currentDate, curCol, curCol);
@@ -1507,9 +1506,9 @@ void KOAgendaView::setStartHour( int h )
}
void KOAgendaView::updateTodo( Todo * t, int )
{
-
+
bool remove = false;
bool removeAD = false;
QDate da;
if ( t->hasCompletedDate() )
diff --git a/korganizer/kotodoview.cpp b/korganizer/kotodoview.cpp
index 14e8b5c..902f3f4 100644
--- a/korganizer/kotodoview.cpp
+++ b/korganizer/kotodoview.cpp
@@ -856,19 +856,28 @@ void KOTodoView::setNewPriority(int index)
}
void KOTodoView::setNewPercentage(int index)
{
- if (mActiveItem && !mActiveItem->todo()->isReadOnly ()) {
- if (mPercentage[index] == 100) {
- mActiveItem->todo()->setCompleted(QDateTime::currentDateTime());
- } else {
- mActiveItem->todo()->setCompleted(false);
+ if (mActiveItem && !mActiveItem->todo()->isReadOnly ()) {
+
+ if ( mPercentage[index] == 100 && !mActiveItem->isOn() ) {
+ mActiveItem->setOn( true );
+ return;
+ } else if ( mPercentage[index] != 100 && mActiveItem->isOn() ) {
+ KOTodoViewItem* par = (static_cast<KOTodoViewItem*>(mActiveItem->parent()));
+ if ( par && par->isOn() )
+ par->setOn( false );
+ }
+ if (mPercentage[index] == 100) {
+ mActiveItem->todo()->setCompleted(QDateTime::currentDateTime());
+ } else {
+ mActiveItem->todo()->setCompleted(false);
+ }
+ mActiveItem->todo()->setPercentComplete(mPercentage[index]);
+ mActiveItem->construct();
+ todoModified (mActiveItem->todo (), KOGlobals::COMPLETION_MODIFIED);
+ mActiveItem->todo()->setRevision( mActiveItem->todo()->revision()+1 );
}
- mActiveItem->todo()->setPercentComplete(mPercentage[index]);
- mActiveItem->construct();
- todoModified (mActiveItem->todo (), KOGlobals::COMPLETION_MODIFIED);
- mActiveItem->todo()->setRevision( mActiveItem->todo()->revision()+1 );
- }
}
QPopupMenu * KOTodoView::getCategoryPopupMenu (KOTodoViewItem *todoItem)
diff --git a/korganizer/kotodoviewitem.cpp b/korganizer/kotodoviewitem.cpp
index 2822237..1edddac 100644
--- a/korganizer/kotodoviewitem.cpp
+++ b/korganizer/kotodoviewitem.cpp
@@ -202,17 +202,18 @@ void KOTodoViewItem::stateChange(bool state)
{
// qDebug("KOTodoViewItem::stateChange ");
// do not change setting on startup
if ( m_init ) return;
- qDebug("KOTodoViewItem::stateChange ");
+ if (isOn()!=state) {
+ setOn(state);
+ //qDebug("SETON ");
+ return;
+ }
QString keyd = "==";
QString keyt = "==";
-
+ //qDebug("KOTodoViewItem::stateChange %s ", text(0).latin1());
mTodo->setCompleted(state);
if (state) mTodo->setCompleted(QDateTime::currentDateTime());
- if (isOn()!=state) {
- setOn(state);
- }
if (mTodo->hasDueDate()) {
setText(3, mTodo->dtDueDateStr());
QDate d = mTodo->dtDue().date();
@@ -239,14 +240,21 @@ void KOTodoViewItem::stateChange(bool state)
else {
if (mTodo->isCompleted()) setSortKey(2,QString::number(999));
else setSortKey(2,QString::number(99));
}
- QListViewItem * myChild = firstChild();
- KOTodoViewItem *item;
- while( myChild ) {
- item = static_cast<KOTodoViewItem*>(myChild);
- item->stateChange(state);
- myChild = myChild->nextSibling();
+ if ( state ) {
+ QListViewItem * myChild = firstChild();
+ KOTodoViewItem *item;
+ while( myChild ) {
+ //qDebug("stateCH ");
+ item = static_cast<KOTodoViewItem*>(myChild);
+ item->stateChange(state);
+ myChild = myChild->nextSibling();
+ }
+ } else {
+ QListViewItem * myChild = parent();
+ if ( myChild )
+ (static_cast<KOTodoViewItem*>(myChild))->stateChange(state);
}
mTodoView->modified(true);
setMyPixmap();
mTodoView->setTodoModified( mTodo );
diff --git a/libkcal/todo.cpp b/libkcal/todo.cpp
index 7d04793..7f1de78 100644
--- a/libkcal/todo.cpp
+++ b/libkcal/todo.cpp
@@ -306,9 +306,13 @@ QString Todo::completedStr( bool shortF ) const
}
void Todo::setCompleted(const QDateTime &completed)
{
- qDebug("Todo::setCompleted ");
+ //qDebug("Todo::setCompleted ");
+ if ( mHasCompletedDate ) {
+ // qDebug("has completed data - return ");
+ return;
+ }
mHasCompletedDate = true;
mPercentComplete = 100;
mCompleted = getEvenTime(completed);
updated();