summaryrefslogtreecommitdiffabout
Unidiff
Diffstat (more/less context) (ignore whitespace changes)
-rw-r--r--bin/kdepim/korganizer/germantranslation.txt12
-rw-r--r--korganizer/koprefs.cpp7
-rw-r--r--korganizer/koprefs.h1
-rw-r--r--korganizer/koprefsdialog.cpp14
-rw-r--r--korganizer/kotodoview.cpp30
-rw-r--r--korganizer/kotodoview.h1
-rw-r--r--korganizer/kotodoviewitem.cpp62
-rw-r--r--libkcal/todo.cpp44
-rw-r--r--libkcal/todo.h16
9 files changed, 156 insertions, 31 deletions
diff --git a/bin/kdepim/korganizer/germantranslation.txt b/bin/kdepim/korganizer/germantranslation.txt
index b4e26c2..5257bff 100644
--- a/bin/kdepim/korganizer/germantranslation.txt
+++ b/bin/kdepim/korganizer/germantranslation.txt
@@ -1326,15 +1326,27 @@
1326{ "%1h","%1std" }, 1326{ "%1h","%1std" },
1327{ "%1min","%1min" }, 1327{ "%1min","%1min" },
1328{ "( %1 before )","( %1 vorher )" }, 1328{ "( %1 before )","( %1 vorher )" },
1329{ "The next alarm is in\nless than one minute!","Der nächste Alarm kommt in\nweniger als einer Minute!" }, 1329{ "The next alarm is in\nless than one minute!","Der nächste Alarm kommt in\nweniger als einer Minute!" },
1330{ "\nThe internal alarm notification is disabled!\n","\nDie interne Alarmbenachrichtigung ist ausgeschaltet!\n" }, 1330{ "\nThe internal alarm notification is disabled!\n","\nDie interne Alarmbenachrichtigung ist ausgeschaltet!\n" },
1331{ "Enable it in the settings menu, TAB alarm.","Schalten Sie sie an im Menu Einstellungen, TAB Alarm." }, 1331{ "Enable it in the settings menu, TAB alarm.","Schalten Sie sie an im Menu Einstellungen, TAB Alarm." },
1332{ "Show Sync Events in WN+Agenda","Zeige Sync-Ereignisse in WN+Agenda" }, 1332{ "Show Sync Events in WN+Agenda","Zeige Sync-Ereignisse in WN+Agenda" },
1333{ "Use short date in WN+Event view","Zeige Kurzdatum in WN+Terminanzeige" }, 1333{ "Use short date in WN+Event view","Zeige Kurzdatum in WN+Terminanzeige" },
1334{ "Number of max.displayed todo prios:","Anzahl max.angezeigter Todo-Prios:" }, 1334{ "Number of max.displayed todo prios:","Anzahl max.angezeigter Todo-Prios:" },
1335{ " on "," am " }, 1335{ " on "," am " },
1336{ "On: ","Am: " }, 1336{ "On: ","Am: " },
1337{ "<i>The recurrence is computed from the start datetime!</i>","<i>Die Wiederholung wird vom Startwert aus berechnet!</i>" }, 1337{ "<i>The recurrence is computed from the start datetime!</i>","<i>Die Wiederholung wird vom Startwert aus berechnet!</i>" },
1338{ "Start/Stop todo...","Starte/Stoppe Todo..." },
1339{ "Color for running todos:","Farbe für laufende Todos:" },
1340{ "The todo\n%1\nis started.\nDo you want to set\nthe state to stopped?","Das Todo\n%1\nist gestartet.\nWollen Sie es\nauf gestoppt setzen?" },
1341{ "Todo is started","Todo is gestarted" },
1342{ "Stop todo","Stoppe Todo" },
1343{ "Todo is stopped","Todo ist gestoppt" },
1344{ "Start todo","Starte Todo" },
1345{ "The todo\n%1\nis stopped.\nDo you want to set\nthe state to started?","Das Todo\n%1\nist gestoppt.\nWollen Sie es auf\ngestartet setzen?" },
1346{ "","" },
1347{ "","" },
1348{ "","" },
1349{ "","" },
1338{ "","" }, 1350{ "","" },
1339{ "","" }, 1351{ "","" },
1340{ "","" }, 1352{ "","" },
diff --git a/korganizer/koprefs.cpp b/korganizer/koprefs.cpp
index 5879a2d..e8c7c76 100644
--- a/korganizer/koprefs.cpp
+++ b/korganizer/koprefs.cpp
@@ -53,31 +53,27 @@ static KStaticDeleter<KOPrefs> insd;
53KOPrefs::KOPrefs() : 53KOPrefs::KOPrefs() :
54 KPimPrefs("korganizerrc") 54 KPimPrefs("korganizerrc")
55{ 55{
56 mCategoryColors.setAutoDelete(true); 56 mCategoryColors.setAutoDelete(true);
57 fillMailDefaults(); 57 fillMailDefaults();
58 mDefaultCategoryColor = QColor(175,210,255);//196,196,196); 58 mDefaultCategoryColor = QColor(175,210,255);//196,196,196);
59 QColor defaultHolidayColor = QColor(255,0,0); 59 QColor defaultHolidayColor = QColor(255,0,0);
60 QColor defaultHighlightColor = QColor(129,112,255);//64,64,255); 60 QColor defaultHighlightColor = QColor(129,112,255);//64,64,255);
61 QColor defaultAgendaBgColor = QColor(239,241,169);//128,128,128); 61 QColor defaultAgendaBgColor = QColor(239,241,169);//128,128,128);
62 QColor defaultWorkingHoursColor = QColor(170,223,150);//160,160,160); 62 QColor defaultWorkingHoursColor = QColor(170,223,150);//160,160,160);
63 QColor defaultTodoDueTodayColor = QColor(255,220,100); 63 QColor defaultTodoDueTodayColor = QColor(255,220,100);
64 QColor defaultTodoOverdueColor = QColor(255,153,125); 64 QColor defaultTodoOverdueColor = QColor(255,153,125);
65 65 QColor defaultTodoRunColor = QColor(99,194,30);
66
67 KPrefs::setCurrentGroup("General"); 66 KPrefs::setCurrentGroup("General");
68
69
70 addItemBool("Enable Group Scheduling",&mEnableGroupScheduling,false); 67 addItemBool("Enable Group Scheduling",&mEnableGroupScheduling,false);
71
72 addItemBool("ShowIconNewTodo",&mShowIconNewTodo,true); 68 addItemBool("ShowIconNewTodo",&mShowIconNewTodo,true);
73 addItemBool("ShowIconNewEvent",&mShowIconNewEvent,true); 69 addItemBool("ShowIconNewEvent",&mShowIconNewEvent,true);
74 addItemBool("ShowIconSearch",&mShowIconSearch,true); 70 addItemBool("ShowIconSearch",&mShowIconSearch,true);
75 addItemBool("ShowIconList",&mShowIconList,true); 71 addItemBool("ShowIconList",&mShowIconList,true);
76 addItemBool("ShowIconDay1",&mShowIconDay1,true); 72 addItemBool("ShowIconDay1",&mShowIconDay1,true);
77 addItemBool("ShowIconDay5",&mShowIconDay5,true); 73 addItemBool("ShowIconDay5",&mShowIconDay5,true);
78 addItemBool("ShowIconDay6",&mShowIconDay6,true); 74 addItemBool("ShowIconDay6",&mShowIconDay6,true);
79 addItemBool("ShowIconDay7",&mShowIconDay7,true); 75 addItemBool("ShowIconDay7",&mShowIconDay7,true);
80 addItemBool("ShowIconMonth",&mShowIconMonth,true); 76 addItemBool("ShowIconMonth",&mShowIconMonth,true);
81 addItemBool("ShowIconTodoview",&mShowIconTodoview,true); 77 addItemBool("ShowIconTodoview",&mShowIconTodoview,true);
82 addItemBool("ShowIconBackFast",&mShowIconBackFast,true); 78 addItemBool("ShowIconBackFast",&mShowIconBackFast,true);
83 addItemBool("ShowIconBack",&mShowIconBack,true); 79 addItemBool("ShowIconBack",&mShowIconBack,true);
@@ -208,24 +204,25 @@ KOPrefs::KOPrefs() :
208 addItemBool("ShortDateInViewer",&mShortDateInViewer,false); 204 addItemBool("ShortDateInViewer",&mShortDateInViewer,false);
209 205
210 206
211 KPrefs::setCurrentGroup("Colors"); 207 KPrefs::setCurrentGroup("Colors");
212 addItemColor("Holiday Color",&mHolidayColor,defaultHolidayColor); 208 addItemColor("Holiday Color",&mHolidayColor,defaultHolidayColor);
213 addItemColor("Highlight Color",&mHighlightColor,defaultHighlightColor); 209 addItemColor("Highlight Color",&mHighlightColor,defaultHighlightColor);
214 addItemColor("Event Color",&mEventColor,mDefaultCategoryColor); 210 addItemColor("Event Color",&mEventColor,mDefaultCategoryColor);
215 addItemColor("Todo done Color",&mTodoDoneColor,QColor(111,255,115) ); 211 addItemColor("Todo done Color",&mTodoDoneColor,QColor(111,255,115) );
216 addItemColor("Agenda Background Color",&mAgendaBgColor,defaultAgendaBgColor); 212 addItemColor("Agenda Background Color",&mAgendaBgColor,defaultAgendaBgColor);
217 addItemColor("WorkingHours Color",&mWorkingHoursColor,defaultWorkingHoursColor); 213 addItemColor("WorkingHours Color",&mWorkingHoursColor,defaultWorkingHoursColor);
218 addItemColor("Todo due today Color",&mTodoDueTodayColor,defaultTodoDueTodayColor); 214 addItemColor("Todo due today Color",&mTodoDueTodayColor,defaultTodoDueTodayColor);
219 addItemColor("Todo overdue Color",&mTodoOverdueColor,defaultTodoOverdueColor); 215 addItemColor("Todo overdue Color",&mTodoOverdueColor,defaultTodoOverdueColor);
216 addItemColor("Todo running Color",&mTodoRunColor,defaultTodoRunColor);
220 addItemColor("MonthViewEvenColor",&mMonthViewEvenColor,QColor( 160,160,255 )); 217 addItemColor("MonthViewEvenColor",&mMonthViewEvenColor,QColor( 160,160,255 ));
221 addItemColor("MonthViewOddColor",&mMonthViewOddColor,QColor( 160,255,160 )); 218 addItemColor("MonthViewOddColor",&mMonthViewOddColor,QColor( 160,255,160 ));
222 addItemColor("MonthViewHolidayColor",&mMonthViewHolidayColor,QColor( 255,160,160 )); 219 addItemColor("MonthViewHolidayColor",&mMonthViewHolidayColor,QColor( 255,160,160 ));
223 addItemBool("MonthViewUsesDayColors",&mMonthViewUsesDayColors,true); 220 addItemBool("MonthViewUsesDayColors",&mMonthViewUsesDayColors,true);
224 addItemBool("MonthViewSatSunTog",&mMonthViewSatSunTog,true); 221 addItemBool("MonthViewSatSunTog",&mMonthViewSatSunTog,true);
225 addItemBool("MonthViewWeek",&mMonthViewWeek,false); 222 addItemBool("MonthViewWeek",&mMonthViewWeek,false);
226 addItemBool("HightlightDateTimeEdit",&mHightlightDateTimeEdit,false); 223 addItemBool("HightlightDateTimeEdit",&mHightlightDateTimeEdit,false);
227 addItemColor("AppColor1",&mAppColor1,QColor( 130,170,255 )); 224 addItemColor("AppColor1",&mAppColor1,QColor( 130,170,255 ));
228 addItemColor("AppColor2",&mAppColor2,QColor( 174,216,255 )); 225 addItemColor("AppColor2",&mAppColor2,QColor( 174,216,255 ));
229 addItemBool("UseAppColors",&mUseAppColors,false); 226 addItemBool("UseAppColors",&mUseAppColors,false);
230 227
231 228
diff --git a/korganizer/koprefs.h b/korganizer/koprefs.h
index cf8dae6..d511faa 100644
--- a/korganizer/koprefs.h
+++ b/korganizer/koprefs.h
@@ -130,24 +130,25 @@ class KOPrefs : public KPimPrefs
130 130
131 131
132 132
133 133
134 QColor mHolidayColor; 134 QColor mHolidayColor;
135 QColor mHighlightColor; 135 QColor mHighlightColor;
136 QColor mEventColor; 136 QColor mEventColor;
137 QColor mTodoDoneColor; 137 QColor mTodoDoneColor;
138 QColor mAgendaBgColor; 138 QColor mAgendaBgColor;
139 QColor mWorkingHoursColor; 139 QColor mWorkingHoursColor;
140 QColor mTodoDueTodayColor; 140 QColor mTodoDueTodayColor;
141 QColor mTodoOverdueColor; 141 QColor mTodoOverdueColor;
142 QColor mTodoRunColor;
142 QColor mMonthViewEvenColor; 143 QColor mMonthViewEvenColor;
143 QColor mMonthViewOddColor; 144 QColor mMonthViewOddColor;
144 QColor mMonthViewHolidayColor; 145 QColor mMonthViewHolidayColor;
145 bool mMonthViewUsesDayColors; 146 bool mMonthViewUsesDayColors;
146 bool mMonthViewSatSunTog; 147 bool mMonthViewSatSunTog;
147 bool mMonthViewWeek; 148 bool mMonthViewWeek;
148 QColor mAppColor1; 149 QColor mAppColor1;
149 QColor mAppColor2; 150 QColor mAppColor2;
150 bool mUseAppColors; 151 bool mUseAppColors;
151 152
152 int mDayBegins; 153 int mDayBegins;
153 int mHourSize; 154 int mHourSize;
diff --git a/korganizer/koprefsdialog.cpp b/korganizer/koprefsdialog.cpp
index 0bbb3bf..a8943de 100644
--- a/korganizer/koprefsdialog.cpp
+++ b/korganizer/koprefsdialog.cpp
@@ -886,30 +886,40 @@ dummy =
886 addWidBool(i18n("Small To-do view uses smaller font"), 886 addWidBool(i18n("Small To-do view uses smaller font"),
887 &(KOPrefs::instance()->mTodoViewUsesSmallFont),topFrame); 887 &(KOPrefs::instance()->mTodoViewUsesSmallFont),topFrame);
888 topLayout->addWidget(dummy->checkBox(),ii++,0); 888 topLayout->addWidget(dummy->checkBox(),ii++,0);
889 889
890 890
891 891
892 dummy = 892 dummy =
893 addWidBool(i18n("Todo view uses category colors"), 893 addWidBool(i18n("Todo view uses category colors"),
894 &(KOPrefs::instance()->mTodoViewUsesCatColors),topFrame); 894 &(KOPrefs::instance()->mTodoViewUsesCatColors),topFrame);
895 topLayout->addWidget(dummy->checkBox(),ii++,0); 895 topLayout->addWidget(dummy->checkBox(),ii++,0);
896 896
897 897
898 QWidget* wid = new QWidget( topFrame ); 898 QWidget* wid = new QWidget( topFrame );
899 // Todo run today color
900 KPrefsDialogWidColor *todoRunColor =
901 addWidColor(i18n("Color for running todos:"),
902 &(KOPrefs::instance()->mTodoRunColor),wid);
903 QHBoxLayout *widLayout = new QHBoxLayout(wid);
904 widLayout->addWidget( todoRunColor->label() );
905 widLayout->addWidget( todoRunColor->button() );
906 topLayout->addWidget(wid,ii++,0);
907
908 wid = new QWidget( topFrame );
899 // Todo due today color 909 // Todo due today color
900 KPrefsDialogWidColor *todoDueTodayColor = 910 KPrefsDialogWidColor *todoDueTodayColor =
901 addWidColor(i18n("Todo due today color:"), 911 addWidColor(i18n("Todo due today color:"),
902 &(KOPrefs::instance()->mTodoDueTodayColor),wid); 912 &(KOPrefs::instance()->mTodoDueTodayColor),wid);
903 QHBoxLayout *widLayout = new QHBoxLayout(wid); 913 widLayout = new QHBoxLayout(wid);
904 widLayout->addWidget( todoDueTodayColor->label() ); 914 widLayout->addWidget( todoDueTodayColor->label() );
905 widLayout->addWidget( todoDueTodayColor->button() ); 915 widLayout->addWidget( todoDueTodayColor->button() );
906 topLayout->addWidget(wid,ii++,0); 916 topLayout->addWidget(wid,ii++,0);
907 //topLayout->addWidget(todoDueTodayColor->button(),ii++,1); 917 //topLayout->addWidget(todoDueTodayColor->button(),ii++,1);
908 918
909 // Todo overdue color 919 // Todo overdue color
910 wid = new QWidget( topFrame ); 920 wid = new QWidget( topFrame );
911 widLayout = new QHBoxLayout(wid); 921 widLayout = new QHBoxLayout(wid);
912 KPrefsDialogWidColor *todoOverdueColor = 922 KPrefsDialogWidColor *todoOverdueColor =
913 addWidColor(i18n("Todo overdue color:"), 923 addWidColor(i18n("Todo overdue color:"),
914 &(KOPrefs::instance()->mTodoOverdueColor),wid); 924 &(KOPrefs::instance()->mTodoOverdueColor),wid);
915 widLayout->addWidget(todoOverdueColor->label()); 925 widLayout->addWidget(todoOverdueColor->label());
diff --git a/korganizer/kotodoview.cpp b/korganizer/kotodoview.cpp
index 935a5f5..7ee1eef 100644
--- a/korganizer/kotodoview.cpp
+++ b/korganizer/kotodoview.cpp
@@ -472,24 +472,26 @@ KOTodoView::KOTodoView(Calendar *calendar,QWidget* parent,const char* name) :
472 mItemPopupMenu->insertItem( i18n("Delete"), this, 472 mItemPopupMenu->insertItem( i18n("Delete"), this,
473 SLOT (deleteTodo())); 473 SLOT (deleteTodo()));
474 mItemPopupMenu->insertItem( i18n("Clone..."), this, 474 mItemPopupMenu->insertItem( i18n("Clone..."), this,
475 SLOT (cloneTodo())); 475 SLOT (cloneTodo()));
476 mItemPopupMenu->insertItem( i18n("Move..."), this, 476 mItemPopupMenu->insertItem( i18n("Move..."), this,
477 SLOT (moveTodo())); 477 SLOT (moveTodo()));
478 mItemPopupMenu->insertItem( i18n("Beam..."), this, 478 mItemPopupMenu->insertItem( i18n("Beam..."), this,
479 SLOT (beamTodo())); 479 SLOT (beamTodo()));
480 mItemPopupMenu->insertItem( i18n("Toggle Cancel"), this, 480 mItemPopupMenu->insertItem( i18n("Toggle Cancel"), this,
481 SLOT (cancelTodo())); 481 SLOT (cancelTodo()));
482 mItemPopupMenu->insertSeparator(); 482 mItemPopupMenu->insertSeparator();
483 483
484 mItemPopupMenu->insertItem( i18n("Start/Stop todo..."), this,
485 SLOT (toggleRunningItem()));
484 mItemPopupMenu->insertItem( i18n("New Todo..."), this, 486 mItemPopupMenu->insertItem( i18n("New Todo..."), this,
485 SLOT (newTodo())); 487 SLOT (newTodo()));
486 mItemPopupMenu->insertItem(i18n("New Sub-Todo..."), this, 488 mItemPopupMenu->insertItem(i18n("New Sub-Todo..."), this,
487 SLOT (newSubTodo())); 489 SLOT (newSubTodo()));
488 mItemPopupMenu->insertItem(i18n("Unparent Todo"), this, 490 mItemPopupMenu->insertItem(i18n("Unparent Todo"), this,
489 SLOT (unparentTodo()),0,21); 491 SLOT (unparentTodo()),0,21);
490 mItemPopupMenu->insertItem(i18n("Reparent Todo"), this, 492 mItemPopupMenu->insertItem(i18n("Reparent Todo"), this,
491 SLOT (reparentTodo()),0,22); 493 SLOT (reparentTodo()),0,22);
492 mItemPopupMenu->insertSeparator(); 494 mItemPopupMenu->insertSeparator();
493#if 0 495#if 0
494 mItemPopupMenu->insertItem(i18n("Delete completed To-Dos","Purge Completed"), 496 mItemPopupMenu->insertItem(i18n("Delete completed To-Dos","Purge Completed"),
495 this, SLOT( purgeCompleted() ) ); 497 this, SLOT( purgeCompleted() ) );
@@ -1090,35 +1092,61 @@ void KOTodoView::changedCategories(int index)
1090void KOTodoView::itemDoubleClicked(QListViewItem *item) 1092void KOTodoView::itemDoubleClicked(QListViewItem *item)
1091{ 1093{
1092 if ( pendingSubtodo != 0 ) { 1094 if ( pendingSubtodo != 0 ) {
1093 topLevelWidget()->setCaption(i18n("Reparenting aborted!")); 1095 topLevelWidget()->setCaption(i18n("Reparenting aborted!"));
1094 } 1096 }
1095 pendingSubtodo = 0; 1097 pendingSubtodo = 0;
1096 int row = mTodoListView->header()->sectionAt ( mTodoListView->header()->mapFromGlobal( QCursor::pos()).x() ); 1098 int row = mTodoListView->header()->sectionAt ( mTodoListView->header()->mapFromGlobal( QCursor::pos()).x() );
1097 //qDebug("ROW %d ", row); 1099 //qDebug("ROW %d ", row);
1098 if (!item) { 1100 if (!item) {
1099 newTodo(); 1101 newTodo();
1100 return; 1102 return;
1101 } else { 1103 } else {
1102 if ( row == 1 || row == 2 ) { 1104 if ( row == 2 ) {
1103 mActiveItem = (KOTodoViewItem *) item; 1105 mActiveItem = (KOTodoViewItem *) item;
1104 newSubTodo(); 1106 newSubTodo();
1105 return; 1107 return;
1106 } 1108 }
1109 if ( row == 1 ) {
1110 mActiveItem = (KOTodoViewItem *) item;
1111 toggleRunningItem();
1112 return;
1113 }
1107 } 1114 }
1108 if ( KOPrefs::instance()->mEditOnDoubleClick ) 1115 if ( KOPrefs::instance()->mEditOnDoubleClick )
1109 editItem( item ); 1116 editItem( item );
1110 else 1117 else
1111 showItem( item , QPoint(), 0 ); 1118 showItem( item , QPoint(), 0 );
1112} 1119}
1120void KOTodoView::toggleRunningItem()
1121{
1122 qDebug("KOTodoView::toggleRunning() ");
1123 if ( ! mActiveItem )
1124 return;
1125 Todo * t = mActiveItem->todo();
1126 if ( t->isRunning() ) {
1127 int result = KMessageBox::warningContinueCancel(this,
1128 i18n("The todo\n%1\nis started.\nDo you want to set\nthe state to stopped?").arg(mActiveItem->text(0).left( 20 ) ),i18n("Todo is started"),i18n("Stop todo"),i18n("Cancel"), true);
1129 if (result != KMessageBox::Continue) return;
1130 t->setRunning( false );
1131 mActiveItem->construct();
1132 } else {
1133 int result = KMessageBox::warningContinueCancel(this,
1134 i18n("The todo\n%1\nis stopped.\nDo you want to set\nthe state to started?").arg(mActiveItem->text(0).left( 20 ) ),i18n("Todo is stopped"),i18n("Start todo"),i18n("Cancel"), true);
1135 if (result != KMessageBox::Continue) return;
1136 t->setRunning( true );
1137 mActiveItem->construct();
1138 }
1139}
1140
1113void KOTodoView::itemClicked(QListViewItem *item) 1141void KOTodoView::itemClicked(QListViewItem *item)
1114{ 1142{
1115 //qDebug("KOTodoView::itemClicked %d", item); 1143 //qDebug("KOTodoView::itemClicked %d", item);
1116 if (!item) { 1144 if (!item) {
1117 if ( pendingSubtodo != 0 ) { 1145 if ( pendingSubtodo != 0 ) {
1118 topLevelWidget()->setCaption(i18n("Reparenting aborted!")); 1146 topLevelWidget()->setCaption(i18n("Reparenting aborted!"));
1119 } 1147 }
1120 pendingSubtodo = 0; 1148 pendingSubtodo = 0;
1121 return; 1149 return;
1122 } 1150 }
1123 KOTodoViewItem *todoItem = (KOTodoViewItem *)item; 1151 KOTodoViewItem *todoItem = (KOTodoViewItem *)item;
1124 if ( pendingSubtodo != 0 ) { 1152 if ( pendingSubtodo != 0 ) {
diff --git a/korganizer/kotodoview.h b/korganizer/kotodoview.h
index d0788a9..d368513 100644
--- a/korganizer/kotodoview.h
+++ b/korganizer/kotodoview.h
@@ -197,24 +197,25 @@ class KOTodoView : public KOrg::BaseView
197 void editTodoSignal(Todo *); 197 void editTodoSignal(Todo *);
198 void deleteTodoSignal(Todo *); 198 void deleteTodoSignal(Todo *);
199 void todoModifiedSignal (Todo *, int); 199 void todoModifiedSignal (Todo *, int);
200 200
201 void isModified(bool); 201 void isModified(bool);
202 void cloneTodoSignal( Incidence * ); 202 void cloneTodoSignal( Incidence * );
203 void cancelTodoSignal( Incidence * ); 203 void cancelTodoSignal( Incidence * );
204 void moveTodoSignal( Incidence * ); 204 void moveTodoSignal( Incidence * );
205 void beamTodoSignal( Incidence * ); 205 void beamTodoSignal( Incidence * );
206 void purgeCompletedSignal(); 206 void purgeCompletedSignal();
207 207
208 protected slots: 208 protected slots:
209 void toggleRunningItem();
209 void paintNeeded(); 210 void paintNeeded();
210 void processSelectionChange(); 211 void processSelectionChange();
211 void addQuickTodo(); 212 void addQuickTodo();
212 void setTodoModified( Todo* ); 213 void setTodoModified( Todo* );
213 void todoModified(Todo *, int ); 214 void todoModified(Todo *, int );
214 215
215 private: 216 private:
216 /* 217 /*
217 * the TodoEditor approach is rather unscaling in the long 218 * the TodoEditor approach is rather unscaling in the long
218 * run. 219 * run.
219 * Korganizer keeps it in memory and we need to update 220 * Korganizer keeps it in memory and we need to update
220 * 1. make KOTodoViewItem a QObject again? 221 * 1. make KOTodoViewItem a QObject again?
diff --git a/korganizer/kotodoviewitem.cpp b/korganizer/kotodoviewitem.cpp
index 6559119..66f8d06 100644
--- a/korganizer/kotodoviewitem.cpp
+++ b/korganizer/kotodoviewitem.cpp
@@ -11,24 +11,25 @@
11 but WITHOUT ANY WARRANTY; without even the implied warranty of 11 but WITHOUT ANY WARRANTY; without even the implied warranty of
12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 GNU General Public License for more details. 13 GNU General Public License for more details.
14 14
15 You should have received a copy of the GNU General Public License 15 You should have received a copy of the GNU General Public License
16 along with this program; if not, write to the Free Software 16 along with this program; if not, write to the Free Software
17 Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. 17 Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
18*/ 18*/
19 19
20#include <klocale.h> 20#include <klocale.h>
21#include <kdebug.h> 21#include <kdebug.h>
22#include <qapp.h> 22#include <qapp.h>
23#include <kglobal.h>
23 24
24#include <kiconloader.h> 25#include <kiconloader.h>
25#include "kotodoviewitem.h" 26#include "kotodoviewitem.h"
26#include "kotodoview.h" 27#include "kotodoview.h"
27#include "koprefs.h" 28#include "koprefs.h"
28 29
29KOTodoViewItem::KOTodoViewItem( QListView *parent, Todo *todo, KOTodoView *kotodo) 30KOTodoViewItem::KOTodoViewItem( QListView *parent, Todo *todo, KOTodoView *kotodo)
30 : QCheckListItem( parent , "", CheckBox ), mTodo( todo ), mTodoView( kotodo ) 31 : QCheckListItem( parent , "", CheckBox ), mTodo( todo ), mTodoView( kotodo )
31{ 32{
32 construct(); 33 construct();
33} 34}
34 35
@@ -111,42 +112,53 @@ void KOTodoViewItem::construct()
111 } else { 112 } else {
112 setText(3,""); 113 setText(3,"");
113 setText(4,""); 114 setText(4,"");
114 } 115 }
115 setSortKey(3,keyd); 116 setSortKey(3,keyd);
116 setSortKey(4,keyt); 117 setSortKey(4,keyt);
117 118
118 if (mTodo->isCompleted()) setSortKey(1,"6" + QString::number(mTodo->priority())+keyd+keyt); 119 if (mTodo->isCompleted()) setSortKey(1,"6" + QString::number(mTodo->priority())+keyd+keyt);
119 else setSortKey(1,QString::number(mTodo->priority())+keyd+keyt); 120 else setSortKey(1,QString::number(mTodo->priority())+keyd+keyt);
120 121
121 122
122 123
123 if (mTodo->hasStartDate()) { 124 keyd = "";
124 setText(5, mTodo->dtStartDateStr()); 125 keyt = "";
125 QDate d = mTodo->dtStart().date(); 126
126 skeyd.sprintf("%04d%02d%02d",d.year(),d.month(),d.day()); 127 if (mTodo->isRunning() ) {
127 128 QDate d = mTodo->runStart().date();
128 if (mTodo->doesFloat()) { 129 QTime t = mTodo->runStart().time();
129 setText(6,"");
130 }
131 else {
132 setText(6,mTodo->dtStartTimeStr());
133 QTime t = mTodo->dtStart().time();
134 skeyt.sprintf("%02d%02d",t.hour(),t.minute()); 130 skeyt.sprintf("%02d%02d",t.hour(),t.minute());
135 131 skeyd.sprintf("%04d%02d%02d",d.year(),d.month(),d.day());
136 } 132 keyd = KGlobal::locale()->formatDate( d );
133 keyt = KGlobal::locale()->formatTime( t );
134
137 } else { 135 } else {
138 setText(5,""); 136
139 setText(6,""); 137 if (mTodo->hasStartDate()) {
138 keyd = mTodo->dtStartDateStr();
139 QDate d = mTodo->dtStart().date();
140 skeyd.sprintf("%04d%02d%02d",d.year(),d.month(),d.day());
141
142 if ( !mTodo->doesFloat()) {
143 keyt = mTodo->dtStartTimeStr();
144 QTime t = mTodo->dtStart().time();
145 skeyt.sprintf("%02d%02d",t.hour(),t.minute());
146
147 }
148
149 }
140 } 150 }
151 setText(5,keyd);
152 setText(6,keyt);
141 setSortKey(5,skeyd); 153 setSortKey(5,skeyd);
142 setSortKey(6,skeyt); 154 setSortKey(6,skeyt);
143 155
144 setText(7,mTodo->cancelled() ? i18n("Yes") : i18n("No")); 156 setText(7,mTodo->cancelled() ? i18n("Yes") : i18n("No"));
145 setText(8,mTodo->categoriesStr()); 157 setText(8,mTodo->categoriesStr());
146 158
147#if 0 159#if 0
148 // Find sort id in description. It's the text behind the last '#' character 160 // Find sort id in description. It's the text behind the last '#' character
149 // found in the description. White spaces are removed from beginning and end 161 // found in the description. White spaces are removed from beginning and end
150 // of sort id. 162 // of sort id.
151 int pos = mTodo->description().findRev('#'); 163 int pos = mTodo->description().findRev('#');
152 if (pos < 0) { 164 if (pos < 0) {
@@ -359,31 +371,39 @@ void KOTodoViewItem::paintCell(QPainter *p, const QColorGroup &cg, int column, i
359 if ( setColor ) { 371 if ( setColor ) {
360 QStringList categories = mTodo->categories(); 372 QStringList categories = mTodo->categories();
361 QString cat = categories.first(); 373 QString cat = categories.first();
362 if ( !cat.isEmpty()) { 374 if ( !cat.isEmpty()) {
363 colorToSet = *(KOPrefs::instance()->categoryColor(cat) ); 375 colorToSet = *(KOPrefs::instance()->categoryColor(cat) );
364 } else 376 } else
365 setColor = false; 377 setColor = false;
366 } 378 }
367 bool openMode = !isOpen(); 379 bool openMode = !isOpen();
368 // maybe we are in flat-display-mode 380 // maybe we are in flat-display-mode
369 if ( !firstChild() ) 381 if ( !firstChild() )
370 openMode = false; 382 openMode = false;
371 int odue = mTodo->hasDueSubTodo( openMode ); 383 bool colorRunning = mTodo->isRunning();
372 if (odue == 2) { 384 if ( ! colorRunning && openMode )
373 colorToSet = KOPrefs::instance()->mTodoOverdueColor; 385 colorRunning = mTodo->hasRunningSub();
374 setColor = true; 386 if ( colorRunning ) {
375 } else if ( odue == 1 ) {
376 colorToSet = KOPrefs::instance()->mTodoDueTodayColor;
377 setColor = true; 387 setColor = true;
388 colorToSet = KOPrefs::instance()->mTodoRunColor;
389 } else {
390 int odue = mTodo->hasDueSubTodo( openMode );
391 if (odue == 2) {
392 colorToSet = KOPrefs::instance()->mTodoOverdueColor;
393 setColor = true;
394 } else if ( odue == 1 ) {
395 colorToSet = KOPrefs::instance()->mTodoDueTodayColor;
396 setColor = true;
397 }
378 } 398 }
379 399
380 400
381 if ( setColor ) { 401 if ( setColor ) {
382 _cg.setColor(role,colorToSet ); 402 _cg.setColor(role,colorToSet );
383 if ( role == QColorGroup::Base) { 403 if ( role == QColorGroup::Base) {
384 int rgb = colorToSet.red(); 404 int rgb = colorToSet.red();
385 rgb += colorToSet.blue()/2; 405 rgb += colorToSet.blue()/2;
386 rgb += colorToSet.green(); 406 rgb += colorToSet.green();
387 if ( rgb < 200 ) 407 if ( rgb < 200 )
388 _cg.setColor(QColorGroup::Text,Qt::white ); 408 _cg.setColor(QColorGroup::Text,Qt::white );
389 } 409 }
diff --git a/libkcal/todo.cpp b/libkcal/todo.cpp
index a496404..7dee4cd 100644
--- a/libkcal/todo.cpp
+++ b/libkcal/todo.cpp
@@ -26,40 +26,84 @@
26 26
27using namespace KCal; 27using namespace KCal;
28 28
29Todo::Todo(): Incidence() 29Todo::Todo(): Incidence()
30{ 30{
31// mStatus = TENTATIVE; 31// mStatus = TENTATIVE;
32 32
33 mHasDueDate = false; 33 mHasDueDate = false;
34 setHasStartDate( false ); 34 setHasStartDate( false );
35 mCompleted = getEvenTime(QDateTime::currentDateTime()); 35 mCompleted = getEvenTime(QDateTime::currentDateTime());
36 mHasCompletedDate = false; 36 mHasCompletedDate = false;
37 mPercentComplete = 0; 37 mPercentComplete = 0;
38 mRunning = false;
39 mRunSaveTimer = 0;
38} 40}
39 41
40Todo::Todo(const Todo &t) : Incidence(t) 42Todo::Todo(const Todo &t) : Incidence(t)
41{ 43{
42 mDtDue = t.mDtDue; 44 mDtDue = t.mDtDue;
43 mHasDueDate = t.mHasDueDate; 45 mHasDueDate = t.mHasDueDate;
44 mCompleted = t.mCompleted; 46 mCompleted = t.mCompleted;
45 mHasCompletedDate = t.mHasCompletedDate; 47 mHasCompletedDate = t.mHasCompletedDate;
46 mPercentComplete = t.mPercentComplete; 48 mPercentComplete = t.mPercentComplete;
49 mRunning = false;
50 mRunSaveTimer = 0;
47} 51}
48 52
49Todo::~Todo() 53Todo::~Todo()
50{ 54{
55 setRunning( false );
56}
57
58void Todo::setRunning( bool run )
59{
60 if ( run == mRunning )
61 return;
62 if ( !mRunSaveTimer ) {
63 mRunSaveTimer = new QTimer ( this );
64 connect ( mRunSaveTimer, SIGNAL( timeout() ), this , SLOT ( saveRunningInfoToFile() ) );
65 }
66 mRunning = run;
67 if ( mRunning ) {
68 mRunSaveTimer->start( 1000 * 60 * 5 ); // 5 min
69 mRunStart = QDateTime::currentDateTime();
70 } else {
71 mRunSaveTimer->stop();
72 saveRunningInfoToFile();
73 }
74}
51 75
76void Todo::saveRunningInfoToFile()
77{
78 qDebug("Todo::saveRunningInfoToFile() ");
52} 79}
53 80
81int Todo::runTime()
82{
83 if ( !mRunning )
84 return 0;
85 return mRunStart.secsTo( QDateTime::currentDateTime() );
86}
87bool Todo::hasRunningSub()
88{
89 if ( mRunning )
90 return true;
91 Incidence *aTodo;
92 for (aTodo = mRelations.first(); aTodo; aTodo = mRelations.next()) {
93 if ( ((Todo*)aTodo)->hasRunningSub() )
94 return true;
95 }
96 return false;
97}
54Incidence *Todo::clone() 98Incidence *Todo::clone()
55{ 99{
56 return new Todo(*this); 100 return new Todo(*this);
57} 101}
58 102
59bool Todo::contains ( Todo* from ) 103bool Todo::contains ( Todo* from )
60{ 104{
61 105
62 if ( !from->summary().isEmpty() ) 106 if ( !from->summary().isEmpty() )
63 if ( !summary().startsWith( from->summary() )) 107 if ( !summary().startsWith( from->summary() ))
64 return false; 108 return false;
65 if ( from->hasStartDate() ) { 109 if ( from->hasStartDate() ) {
diff --git a/libkcal/todo.h b/libkcal/todo.h
index a22d4b7..fe43357 100644
--- a/libkcal/todo.h
+++ b/libkcal/todo.h
@@ -16,31 +16,34 @@
16 along with this library; see the file COPYING.LIB. If not, write to 16 along with this library; see the file COPYING.LIB. If not, write to
17 the Free Software Foundation, Inc., 59 Temple Place - Suite 330, 17 the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
18 Boston, MA 02111-1307, USA. 18 Boston, MA 02111-1307, USA.
19*/ 19*/
20#ifndef TODO_H 20#ifndef TODO_H
21#define TODO_H 21#define TODO_H
22// 22//
23// Todo component, representing a VTODO object 23// Todo component, representing a VTODO object
24// 24//
25 25
26#include "incidence.h" 26#include "incidence.h"
27 27
28#include <qtimer.h>
29
28namespace KCal { 30namespace KCal {
29 31
30/** 32/**
31 This class provides a Todo in the sense of RFC2445. 33 This class provides a Todo in the sense of RFC2445.
32*/ 34*/
33class Todo : public Incidence 35 class Todo : public QObject,public Incidence
34{ 36{
37 Q_OBJECT
35 public: 38 public:
36 Todo(); 39 Todo();
37 Todo(const Todo &); 40 Todo(const Todo &);
38 ~Todo(); 41 ~Todo();
39 typedef ListBase<Todo> List; 42 typedef ListBase<Todo> List;
40 QCString type() const { return "Todo"; } 43 QCString type() const { return "Todo"; }
41 44
42 /** Return an exact copy of this todo. */ 45 /** Return an exact copy of this todo. */
43 Incidence *clone(); 46 Incidence *clone();
44 QDateTime getNextAlarmDateTime( bool * ok, int * offset ) const; 47 QDateTime getNextAlarmDateTime( bool * ok, int * offset ) const;
45 48
46 /** for setting the todo's due date/time with a QDateTime. */ 49 /** for setting the todo's due date/time with a QDateTime. */
@@ -105,26 +108,35 @@ class Todo : public Incidence
105 108
106 /** return date and time when todo was completed */ 109 /** return date and time when todo was completed */
107 QDateTime completed() const; 110 QDateTime completed() const;
108 QString completedStr(bool shortF = true) const; 111 QString completedStr(bool shortF = true) const;
109 /** set date and time of completion */ 112 /** set date and time of completion */
110 void setCompleted(const QDateTime &completed); 113 void setCompleted(const QDateTime &completed);
111 114
112 /** Return true, if todo has a date associated with completion */ 115 /** Return true, if todo has a date associated with completion */
113 bool hasCompletedDate() const; 116 bool hasCompletedDate() const;
114 bool contains ( Todo*); 117 bool contains ( Todo*);
115 void checkSetCompletedFalse(); 118 void checkSetCompletedFalse();
116 bool setRecurDates(); 119 bool setRecurDates();
117 120 bool isRunning() {return mRunning;}
121 bool hasRunningSub();
122 void setRunning( bool );
123 int runTime();
124 QDateTime runStart () const { return mRunStart;}
125 public slots:
126 void saveRunningInfoToFile();
118 private: 127 private:
128 bool mRunning;
129 QTimer * mRunSaveTimer;
130 QDateTime mRunStart;
119 bool accept(Visitor &v) { return v.visit(this); } 131 bool accept(Visitor &v) { return v.visit(this); }
120 132
121 QDateTime mDtDue; // due date of todo 133 QDateTime mDtDue; // due date of todo
122 134
123 bool mHasDueDate; // if todo has associated due date 135 bool mHasDueDate; // if todo has associated due date
124 136
125// int mStatus; // confirmed/delegated/tentative/etc 137// int mStatus; // confirmed/delegated/tentative/etc
126 138
127 QDateTime mCompleted; 139 QDateTime mCompleted;
128 bool mHasCompletedDate; 140 bool mHasCompletedDate;
129 141
130 int mPercentComplete; 142 int mPercentComplete;