summaryrefslogtreecommitdiffabout
path: root/korganizer/kotodoview.cpp
Unidiff
Diffstat (limited to 'korganizer/kotodoview.cpp') (more/less context) (ignore whitespace changes)
-rw-r--r--korganizer/kotodoview.cpp29
1 files changed, 19 insertions, 10 deletions
diff --git a/korganizer/kotodoview.cpp b/korganizer/kotodoview.cpp
index 14e8b5c..902f3f4 100644
--- a/korganizer/kotodoview.cpp
+++ b/korganizer/kotodoview.cpp
@@ -848,35 +848,44 @@ void KOTodoView::deleteTodo()
848void KOTodoView::setNewPriority(int index) 848void KOTodoView::setNewPriority(int index)
849{ 849{
850 if (mActiveItem && !mActiveItem->todo()->isReadOnly ()) { 850 if (mActiveItem && !mActiveItem->todo()->isReadOnly ()) {
851 mActiveItem->todo()->setPriority(mPriority[index]); 851 mActiveItem->todo()->setPriority(mPriority[index]);
852 mActiveItem->construct(); 852 mActiveItem->construct();
853 todoModified (mActiveItem->todo(), KOGlobals::PRIORITY_MODIFIED); 853 todoModified (mActiveItem->todo(), KOGlobals::PRIORITY_MODIFIED);
854 mActiveItem->todo()->setRevision( mActiveItem->todo()->revision()+1 ); 854 mActiveItem->todo()->setRevision( mActiveItem->todo()->revision()+1 );
855 } 855 }
856} 856}
857 857
858void KOTodoView::setNewPercentage(int index) 858void KOTodoView::setNewPercentage(int index)
859{ 859{
860 if (mActiveItem && !mActiveItem->todo()->isReadOnly ()) { 860 if (mActiveItem && !mActiveItem->todo()->isReadOnly ()) {
861 if (mPercentage[index] == 100) { 861
862 mActiveItem->todo()->setCompleted(QDateTime::currentDateTime()); 862 if ( mPercentage[index] == 100 && !mActiveItem->isOn() ) {
863 } else { 863 mActiveItem->setOn( true );
864 mActiveItem->todo()->setCompleted(false); 864 return;
865 } else if ( mPercentage[index] != 100 && mActiveItem->isOn() ) {
866 KOTodoViewItem* par = (static_cast<KOTodoViewItem*>(mActiveItem->parent()));
867 if ( par && par->isOn() )
868 par->setOn( false );
869 }
870 if (mPercentage[index] == 100) {
871 mActiveItem->todo()->setCompleted(QDateTime::currentDateTime());
872 } else {
873 mActiveItem->todo()->setCompleted(false);
874 }
875 mActiveItem->todo()->setPercentComplete(mPercentage[index]);
876 mActiveItem->construct();
877 todoModified (mActiveItem->todo (), KOGlobals::COMPLETION_MODIFIED);
878 mActiveItem->todo()->setRevision( mActiveItem->todo()->revision()+1 );
865 } 879 }
866 mActiveItem->todo()->setPercentComplete(mPercentage[index]);
867 mActiveItem->construct();
868 todoModified (mActiveItem->todo (), KOGlobals::COMPLETION_MODIFIED);
869 mActiveItem->todo()->setRevision( mActiveItem->todo()->revision()+1 );
870 }
871} 880}
872 881
873 882
874QPopupMenu * KOTodoView::getCategoryPopupMenu (KOTodoViewItem *todoItem) 883QPopupMenu * KOTodoView::getCategoryPopupMenu (KOTodoViewItem *todoItem)
875{ 884{
876 QPopupMenu* tempMenu = new QPopupMenu (this); 885 QPopupMenu* tempMenu = new QPopupMenu (this);
877 QStringList checkedCategories = todoItem->todo()->categories (); 886 QStringList checkedCategories = todoItem->todo()->categories ();
878 887
879 tempMenu->setCheckable (true); 888 tempMenu->setCheckable (true);
880 for (QStringList::Iterator it = KOPrefs::instance()->mCustomCategories.begin (); 889 for (QStringList::Iterator it = KOPrefs::instance()->mCustomCategories.begin ();
881 it != KOPrefs::instance()->mCustomCategories.end (); 890 it != KOPrefs::instance()->mCustomCategories.end ();
882 ++it) { 891 ++it) {