-rw-r--r-- | korganizer/koprefs.cpp | 7 | ||||
-rw-r--r-- | korganizer/koprefs.h | 1 | ||||
-rw-r--r-- | korganizer/koprefsdialog.cpp | 12 | ||||
-rw-r--r-- | korganizer/kotodoview.cpp | 30 | ||||
-rw-r--r-- | korganizer/kotodoview.h | 1 | ||||
-rw-r--r-- | korganizer/kotodoviewitem.cpp | 38 |
6 files changed, 73 insertions, 16 deletions
diff --git a/korganizer/koprefs.cpp b/korganizer/koprefs.cpp index 5879a2d..e8c7c76 100644 --- a/korganizer/koprefs.cpp +++ b/korganizer/koprefs.cpp | |||
@@ -41,55 +41,51 @@ | |||
41 | #include <klocale.h> | 41 | #include <klocale.h> |
42 | #include <kdebug.h> | 42 | #include <kdebug.h> |
43 | #include <kemailsettings.h> | 43 | #include <kemailsettings.h> |
44 | #include <kstaticdeleter.h> | 44 | #include <kstaticdeleter.h> |
45 | #include <libkdepim/kpimglobalprefs.h> | 45 | #include <libkdepim/kpimglobalprefs.h> |
46 | 46 | ||
47 | #include "koprefs.h" | 47 | #include "koprefs.h" |
48 | #include "mainwindow.h" | 48 | #include "mainwindow.h" |
49 | 49 | ||
50 | KOPrefs *KOPrefs::mInstance = 0; | 50 | KOPrefs *KOPrefs::mInstance = 0; |
51 | static KStaticDeleter<KOPrefs> insd; | 51 | static KStaticDeleter<KOPrefs> insd; |
52 | 52 | ||
53 | KOPrefs::KOPrefs() : | 53 | KOPrefs::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); |
84 | addItemBool("ShowIconToday",&mShowIconToday,true); | 80 | addItemBool("ShowIconToday",&mShowIconToday,true); |
85 | addItemBool("ShowIconForward",&mShowIconForward,true); | 81 | addItemBool("ShowIconForward",&mShowIconForward,true); |
86 | addItemBool("ShowIconForwardFast",&mShowIconForwardFast,true); | 82 | addItemBool("ShowIconForwardFast",&mShowIconForwardFast,true); |
87 | addItemBool("ShowIconWhatsThis",&mShowIconWhatsThis,true); | 83 | addItemBool("ShowIconWhatsThis",&mShowIconWhatsThis,true); |
88 | addItemBool("ShowIconWeekNum",&mShowIconWeekNum,true); | 84 | addItemBool("ShowIconWeekNum",&mShowIconWeekNum,true); |
89 | addItemBool("ShowIconNextDays",&mShowIconNextDays,true); | 85 | addItemBool("ShowIconNextDays",&mShowIconNextDays,true); |
90 | addItemBool("ShowIconNext",&mShowIconNext,true); | 86 | addItemBool("ShowIconNext",&mShowIconNext,true); |
91 | addItemBool("ShowIconJournal",&mShowIconJournal,true); | 87 | addItemBool("ShowIconJournal",&mShowIconJournal,true); |
92 | addItemBool("ShowIconStretch",&mShowIconStretch,true); | 88 | addItemBool("ShowIconStretch",&mShowIconStretch,true); |
93 | addItemBool("ShowIconFilter",&mShowIconFilter,false); | 89 | addItemBool("ShowIconFilter",&mShowIconFilter,false); |
94 | addItemBool("ShowIconOnetoolbar",&mShowIconOnetoolbar,true); | 90 | addItemBool("ShowIconOnetoolbar",&mShowIconOnetoolbar,true); |
95 | 91 | ||
@@ -196,48 +192,49 @@ KOPrefs::KOPrefs() : | |||
196 | QString hdp= locateLocal("data","korganizer")+"/"; | 192 | QString hdp= locateLocal("data","korganizer")+"/"; |
197 | #endif | 193 | #endif |
198 | 194 | ||
199 | KPrefs::setCurrentGroup("LoadSaveFileNames"); | 195 | KPrefs::setCurrentGroup("LoadSaveFileNames"); |
200 | 196 | ||
201 | addItemString("LastImportFile", &mLastImportFile ,hdp +"import.ics" ); | 197 | addItemString("LastImportFile", &mLastImportFile ,hdp +"import.ics" ); |
202 | addItemString("LastVcalFile", &mLastVcalFile ,hdp +"export.vcs" ); | 198 | addItemString("LastVcalFile", &mLastVcalFile ,hdp +"export.vcs" ); |
203 | addItemString("LastSaveFile", &mLastSaveFile ,hdp +"mybackup.ics" ); | 199 | addItemString("LastSaveFile", &mLastSaveFile ,hdp +"mybackup.ics" ); |
204 | addItemString("LastLoadFile", &mLastLoadFile ,hdp +"mybackup.ics" ); | 200 | addItemString("LastLoadFile", &mLastLoadFile ,hdp +"mybackup.ics" ); |
205 | 201 | ||
206 | 202 | ||
207 | KPrefs::setCurrentGroup("Locale"); | 203 | KPrefs::setCurrentGroup("Locale"); |
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 | ||
232 | 229 | ||
233 | KPrefs::setCurrentGroup("Views"); | 230 | KPrefs::setCurrentGroup("Views"); |
234 | addItemBool("Show Date Navigator",&mShowDateNavigator,true); | 231 | addItemBool("Show Date Navigator",&mShowDateNavigator,true); |
235 | addItemInt("Hour Size",&mHourSize,8); | 232 | addItemInt("Hour Size",&mHourSize,8); |
236 | addItemBool("Show Daily Recurrences",&mDailyRecur,true); | 233 | addItemBool("Show Daily Recurrences",&mDailyRecur,true); |
237 | addItemBool("Show Weekly Recurrences",&mWeeklyRecur,true); | 234 | addItemBool("Show Weekly Recurrences",&mWeeklyRecur,true); |
238 | addItemBool("Show Month Daily Recurrences",&mMonthDailyRecur,true); | 235 | addItemBool("Show Month Daily Recurrences",&mMonthDailyRecur,true); |
239 | addItemBool("Show Month Weekly Recurrences",&mMonthWeeklyRecur,true); | 236 | addItemBool("Show Month Weekly Recurrences",&mMonthWeeklyRecur,true); |
240 | addItemBool("ShowShortMonthName",&mMonthShowShort,false); | 237 | addItemBool("ShowShortMonthName",&mMonthShowShort,false); |
241 | addItemBool("ShowIconsInMonthCell",&mMonthShowIcons,true); | 238 | addItemBool("ShowIconsInMonthCell",&mMonthShowIcons,true); |
242 | #ifdef DESKTOP_VERION | 239 | #ifdef DESKTOP_VERION |
243 | addItemBool("Enable ToolTips",&mEnableToolTips,true); | 240 | addItemBool("Enable ToolTips",&mEnableToolTips,true); |
diff --git a/korganizer/koprefs.h b/korganizer/koprefs.h index cf8dae6..d511faa 100644 --- a/korganizer/koprefs.h +++ b/korganizer/koprefs.h | |||
@@ -118,48 +118,49 @@ class KOPrefs : public KPimPrefs | |||
118 | QFont mTimeBarFont; | 118 | QFont mTimeBarFont; |
119 | QFont mMonthViewFont; | 119 | QFont mMonthViewFont; |
120 | QFont mAgendaViewFont; | 120 | QFont mAgendaViewFont; |
121 | QFont mMarcusBainsFont; | 121 | QFont mMarcusBainsFont; |
122 | QFont mTimeLabelsFont; | 122 | QFont mTimeLabelsFont; |
123 | QFont mTodoViewFont; | 123 | QFont mTodoViewFont; |
124 | QFont mListViewFont; | 124 | QFont mListViewFont; |
125 | QFont mDateNavigatorFont; | 125 | QFont mDateNavigatorFont; |
126 | QFont mEditBoxFont; | 126 | QFont mEditBoxFont; |
127 | QFont mJornalViewFont; | 127 | QFont mJornalViewFont; |
128 | QFont mWhatsNextFont; | 128 | QFont mWhatsNextFont; |
129 | QFont mEventViewFont; | 129 | QFont mEventViewFont; |
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; |
154 | int mAllDaySize; | 155 | int mAllDaySize; |
155 | bool mShowFullMenu; | 156 | bool mShowFullMenu; |
156 | bool mDailyRecur; | 157 | bool mDailyRecur; |
157 | bool mWeeklyRecur; | 158 | bool mWeeklyRecur; |
158 | bool mMonthDailyRecur; | 159 | bool mMonthDailyRecur; |
159 | bool mMonthWeeklyRecur; | 160 | bool mMonthWeeklyRecur; |
160 | bool mMonthShowIcons; | 161 | bool mMonthShowIcons; |
161 | bool mMonthShowShort; | 162 | bool mMonthShowShort; |
162 | bool mEnableToolTips; | 163 | bool mEnableToolTips; |
163 | bool mEnableMonthScroll; | 164 | bool mEnableMonthScroll; |
164 | bool mFullViewMonth; | 165 | bool mFullViewMonth; |
165 | bool mMonthViewUsesCategoryColor; | 166 | bool mMonthViewUsesCategoryColor; |
diff --git a/korganizer/koprefsdialog.cpp b/korganizer/koprefsdialog.cpp index 0bbb3bf..a8943de 100644 --- a/korganizer/koprefsdialog.cpp +++ b/korganizer/koprefsdialog.cpp | |||
@@ -875,53 +875,63 @@ dummy = | |||
875 | 875 | ||
876 | KPrefsDialogWidBool *showCompletedTodo = | 876 | KPrefsDialogWidBool *showCompletedTodo = |
877 | addWidBool(i18n("To-do view shows completed Todos"), | 877 | addWidBool(i18n("To-do view shows completed Todos"), |
878 | &(KOPrefs::instance()->mShowCompletedTodo),topFrame); | 878 | &(KOPrefs::instance()->mShowCompletedTodo),topFrame); |
879 | topLayout->addWidget(showCompletedTodo->checkBox(),ii++,0); | 879 | topLayout->addWidget(showCompletedTodo->checkBox(),ii++,0); |
880 | dummy = | 880 | dummy = |
881 | addWidBool(i18n("To-do view shows complete as 'xx %'"), | 881 | addWidBool(i18n("To-do view shows complete as 'xx %'"), |
882 | &(KOPrefs::instance()->mTodoViewShowsPercentage),topFrame); | 882 | &(KOPrefs::instance()->mTodoViewShowsPercentage),topFrame); |
883 | topLayout->addWidget(dummy->checkBox(),ii++,0); | 883 | topLayout->addWidget(dummy->checkBox(),ii++,0); |
884 | 884 | ||
885 | dummy = | 885 | 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()); |
916 | widLayout->addWidget(todoOverdueColor->button()); | 926 | widLayout->addWidget(todoOverdueColor->button()); |
917 | topLayout->addWidget(wid,ii++,0); | 927 | topLayout->addWidget(wid,ii++,0); |
918 | 928 | ||
919 | dummy = | 929 | dummy = |
920 | addWidBool(i18n("Colors are applied to text"), | 930 | addWidBool(i18n("Colors are applied to text"), |
921 | &(KOPrefs::instance()->mTodoViewUsesForegroundColor),topFrame); | 931 | &(KOPrefs::instance()->mTodoViewUsesForegroundColor),topFrame); |
922 | topLayout->addWidget(dummy->checkBox(),ii++,0); | 932 | topLayout->addWidget(dummy->checkBox(),ii++,0); |
923 | 933 | ||
924 | dummy = | 934 | dummy = |
925 | addWidBool(i18n("Allday Agenda view shows todos"), | 935 | addWidBool(i18n("Allday Agenda view shows todos"), |
926 | &(KOPrefs::instance()->mShowTodoInAgenda),topFrame); | 936 | &(KOPrefs::instance()->mShowTodoInAgenda),topFrame); |
927 | topLayout->addWidget(dummy->checkBox(),ii++,0); | 937 | topLayout->addWidget(dummy->checkBox(),ii++,0); |
diff --git a/korganizer/kotodoview.cpp b/korganizer/kotodoview.cpp index 935a5f5..7ee1eef 100644 --- a/korganizer/kotodoview.cpp +++ b/korganizer/kotodoview.cpp | |||
@@ -460,48 +460,50 @@ KOTodoView::KOTodoView(Calendar *calendar,QWidget* parent,const char* name) : | |||
460 | QString label = QString ("%1 %").arg (i); | 460 | QString label = QString ("%1 %").arg (i); |
461 | mPercentage[mPercentageCompletedPopupMenu->insertItem (label)] = i; | 461 | mPercentage[mPercentageCompletedPopupMenu->insertItem (label)] = i; |
462 | } | 462 | } |
463 | connect (mPercentageCompletedPopupMenu, SIGNAL (activated (int)), SLOT (setNewPercentage (int))); | 463 | connect (mPercentageCompletedPopupMenu, SIGNAL (activated (int)), SLOT (setNewPercentage (int))); |
464 | 464 | ||
465 | 465 | ||
466 | 466 | ||
467 | mItemPopupMenu = new QPopupMenu(this); | 467 | mItemPopupMenu = new QPopupMenu(this); |
468 | mItemPopupMenu->insertItem(i18n("Show..."), this, | 468 | mItemPopupMenu->insertItem(i18n("Show..."), this, |
469 | SLOT (showTodo())); | 469 | SLOT (showTodo())); |
470 | mItemPopupMenu->insertItem(i18n("Edit..."), this, | 470 | mItemPopupMenu->insertItem(i18n("Edit..."), this, |
471 | SLOT (editTodo())); | 471 | SLOT (editTodo())); |
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() ) ); |
496 | mItemPopupMenu->insertItem(i18n("toggle completed To-Dos","Show Completed"), | 498 | mItemPopupMenu->insertItem(i18n("toggle completed To-Dos","Show Completed"), |
497 | this, SLOT( toggleCompleted() ),0, 33 ); | 499 | this, SLOT( toggleCompleted() ),0, 33 ); |
498 | mItemPopupMenu->insertItem(i18n("toggle quick todo","Show Quick Todo"), | 500 | mItemPopupMenu->insertItem(i18n("toggle quick todo","Show Quick Todo"), |
499 | this, SLOT( toggleQuickTodo() ),0, 34 ); | 501 | this, SLOT( toggleQuickTodo() ),0, 34 ); |
500 | mItemPopupMenu->insertItem(i18n("toggle running todo","Hide not Running"), | 502 | mItemPopupMenu->insertItem(i18n("toggle running todo","Hide not Running"), |
501 | this, SLOT( toggleRunning() ),0, 35 ); | 503 | this, SLOT( toggleRunning() ),0, 35 ); |
502 | 504 | ||
503 | #endif | 505 | #endif |
504 | mPopupMenu = new QPopupMenu(this); | 506 | mPopupMenu = new QPopupMenu(this); |
505 | mPopupMenu->insertItem(SmallIconSet("todo"), i18n("New Todo..."), this, | 507 | mPopupMenu->insertItem(SmallIconSet("todo"), i18n("New Todo..."), this, |
506 | SLOT (newTodo()),0,1); | 508 | SLOT (newTodo()),0,1); |
507 | mPopupMenu->insertItem(i18n("delete completed To-Dos","Purge Completed"), | 509 | mPopupMenu->insertItem(i18n("delete completed To-Dos","Purge Completed"), |
@@ -1078,59 +1080,85 @@ void KOTodoView::changedCategories(int index) | |||
1078 | if ( !colcat.isEmpty() ) { | 1080 | if ( !colcat.isEmpty() ) { |
1079 | if ( categories.find ( colcat ) != categories.end () ) { | 1081 | if ( categories.find ( colcat ) != categories.end () ) { |
1080 | categories.remove( colcat ); | 1082 | categories.remove( colcat ); |
1081 | categories.prepend( colcat ); | 1083 | categories.prepend( colcat ); |
1082 | } | 1084 | } |
1083 | } | 1085 | } |
1084 | mActiveItem->todo()->setCategories (categories); | 1086 | mActiveItem->todo()->setCategories (categories); |
1085 | mActiveItem->construct(); | 1087 | mActiveItem->construct(); |
1086 | mActiveItem->todo()->setRevision( mActiveItem->todo()->revision()+1 ); | 1088 | mActiveItem->todo()->setRevision( mActiveItem->todo()->revision()+1 ); |
1087 | todoModified (mActiveItem->todo (), KOGlobals::CATEGORY_MODIFIED); | 1089 | todoModified (mActiveItem->todo (), KOGlobals::CATEGORY_MODIFIED); |
1088 | } | 1090 | } |
1089 | } | 1091 | } |
1090 | void KOTodoView::itemDoubleClicked(QListViewItem *item) | 1092 | void 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 | } |
1120 | void 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 | |||
1113 | void KOTodoView::itemClicked(QListViewItem *item) | 1141 | void 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 ) { |
1125 | bool allowReparent = true; | 1153 | bool allowReparent = true; |
1126 | QListViewItem *par = item; | 1154 | QListViewItem *par = item; |
1127 | while ( par ) { | 1155 | while ( par ) { |
1128 | if ( par == pendingSubtodo ) { | 1156 | if ( par == pendingSubtodo ) { |
1129 | allowReparent = false; | 1157 | allowReparent = false; |
1130 | break; | 1158 | break; |
1131 | } | 1159 | } |
1132 | par = par->parent(); | 1160 | par = par->parent(); |
1133 | } | 1161 | } |
1134 | if ( !allowReparent ) { | 1162 | if ( !allowReparent ) { |
1135 | topLevelWidget()->setCaption(i18n("Recursive reparenting not possible!")); | 1163 | topLevelWidget()->setCaption(i18n("Recursive reparenting not possible!")); |
1136 | qDebug("Recursive reparenting not possible "); | 1164 | qDebug("Recursive reparenting not possible "); |
diff --git a/korganizer/kotodoview.h b/korganizer/kotodoview.h index d0788a9..d368513 100644 --- a/korganizer/kotodoview.h +++ b/korganizer/kotodoview.h | |||
@@ -185,48 +185,49 @@ class KOTodoView : public KOrg::BaseView | |||
185 | void itemClicked(QListViewItem *); | 185 | void itemClicked(QListViewItem *); |
186 | void itemStateChanged(QListViewItem *); | 186 | void itemStateChanged(QListViewItem *); |
187 | void modified(bool); | 187 | void modified(bool); |
188 | void itemDoubleClicked(QListViewItem *item); | 188 | void itemDoubleClicked(QListViewItem *item); |
189 | 189 | ||
190 | signals: | 190 | signals: |
191 | void newTodoSignal(); | 191 | void newTodoSignal(); |
192 | void newSubTodoSignal(Todo *); | 192 | void newSubTodoSignal(Todo *); |
193 | void unparentTodoSignal(Todo *); | 193 | void unparentTodoSignal(Todo *); |
194 | void reparentTodoSignal( Todo *,Todo * ); | 194 | void reparentTodoSignal( Todo *,Todo * ); |
195 | void showTodoSignal(Todo *); | 195 | void showTodoSignal(Todo *); |
196 | 196 | ||
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? |
221 | * 2. add a public method for setting one todo modified? | 222 | * 2. add a public method for setting one todo modified? |
222 | * 3. add a private method for setting a todo modified + friend here? | 223 | * 3. add a private method for setting a todo modified + friend here? |
223 | * -- zecke 2002-07-08 | 224 | * -- zecke 2002-07-08 |
224 | */ | 225 | */ |
225 | KOTodoViewWhatsThis* mKOTodoViewWhatsThis; | 226 | KOTodoViewWhatsThis* mKOTodoViewWhatsThis; |
226 | friend class KOTodoListView; | 227 | friend class KOTodoListView; |
227 | void paintEvent(QPaintEvent * pevent); | 228 | void paintEvent(QPaintEvent * pevent); |
228 | bool mPendingUpdateBeforeRepaint; | 229 | bool mPendingUpdateBeforeRepaint; |
229 | friend class KOTodoViewItem; | 230 | friend class KOTodoViewItem; |
230 | QMap<Todo *,KOTodoViewItem *>::ConstIterator insertTodoItem(Todo *todo); | 231 | QMap<Todo *,KOTodoViewItem *>::ConstIterator insertTodoItem(Todo *todo); |
231 | void restoreItemState( QListViewItem * ); | 232 | void restoreItemState( QListViewItem * ); |
232 | 233 | ||
diff --git a/korganizer/kotodoviewitem.cpp b/korganizer/kotodoviewitem.cpp index 6559119..66f8d06 100644 --- a/korganizer/kotodoviewitem.cpp +++ b/korganizer/kotodoviewitem.cpp | |||
@@ -1,46 +1,47 @@ | |||
1 | /* | 1 | /* |
2 | This file is part of KOrganizer. | 2 | This file is part of KOrganizer. |
3 | Copyright (c) 2000,2001 Cornelius Schumacher <schumacher@kde.org> | 3 | Copyright (c) 2000,2001 Cornelius Schumacher <schumacher@kde.org> |
4 | 4 | ||
5 | This program is free software; you can redistribute it and/or modify | 5 | This program is free software; you can redistribute it and/or modify |
6 | it under the terms of the GNU General Public License as published by | 6 | it under the terms of the GNU General Public License as published by |
7 | the Free Software Foundation; either version 2 of the License, or | 7 | the Free Software Foundation; either version 2 of the License, or |
8 | (at your option) any later version. | 8 | (at your option) any later version. |
9 | 9 | ||
10 | This program is distributed in the hope that it will be useful, | 10 | This program is distributed in the hope that it will be useful, |
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 | ||
29 | KOTodoViewItem::KOTodoViewItem( QListView *parent, Todo *todo, KOTodoView *kotodo) | 30 | KOTodoViewItem::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 | ||
35 | KOTodoViewItem::KOTodoViewItem( KOTodoViewItem *parent, Todo *todo, KOTodoView *kotodo ) | 36 | KOTodoViewItem::KOTodoViewItem( KOTodoViewItem *parent, Todo *todo, KOTodoView *kotodo ) |
36 | : QCheckListItem( parent, "", CheckBox ), mTodo( todo ), mTodoView( kotodo ) | 37 | : QCheckListItem( parent, "", CheckBox ), mTodo( todo ), mTodoView( kotodo ) |
37 | { | 38 | { |
38 | construct(); | 39 | construct(); |
39 | } | 40 | } |
40 | 41 | ||
41 | QString KOTodoViewItem::key(int column,bool) const | 42 | QString KOTodoViewItem::key(int column,bool) const |
42 | { | 43 | { |
43 | QMap<int,QString>::ConstIterator it = mKeyMap.find(column); | 44 | QMap<int,QString>::ConstIterator it = mKeyMap.find(column); |
44 | if (it == mKeyMap.end()) { | 45 | if (it == mKeyMap.end()) { |
45 | return text(column).lower(); | 46 | return text(column).lower(); |
46 | } else { | 47 | } else { |
@@ -99,66 +100,77 @@ void KOTodoViewItem::construct() | |||
99 | QDate d = mTodo->dtDue().date(); | 100 | QDate d = mTodo->dtDue().date(); |
100 | keyd.sprintf("%04d%02d%02d",d.year(),d.month(),d.day()); | 101 | keyd.sprintf("%04d%02d%02d",d.year(),d.month(),d.day()); |
101 | // setSortKey(3,keyd); | 102 | // setSortKey(3,keyd); |
102 | if (mTodo->doesFloat()) { | 103 | if (mTodo->doesFloat()) { |
103 | setText(4,""); | 104 | setText(4,""); |
104 | } | 105 | } |
105 | else { | 106 | else { |
106 | setText(4,mTodo->dtDueTimeStr()); | 107 | setText(4,mTodo->dtDueTimeStr()); |
107 | QTime t = mTodo->dtDue().time(); | 108 | QTime t = mTodo->dtDue().time(); |
108 | keyt.sprintf("%02d%02d",t.hour(),t.minute()); | 109 | keyt.sprintf("%02d%02d",t.hour(),t.minute()); |
109 | //setSortKey(4,keyt); | 110 | //setSortKey(4,keyt); |
110 | } | 111 | } |
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 | ||
124 | keyd = ""; | ||
125 | keyt = ""; | ||
126 | |||
127 | if (mTodo->isRunning() ) { | ||
128 | QDate d = mTodo->runStart().date(); | ||
129 | QTime t = mTodo->runStart().time(); | ||
130 | skeyt.sprintf("%02d%02d",t.hour(),t.minute()); | ||
131 | skeyd.sprintf("%04d%02d%02d",d.year(),d.month(),d.day()); | ||
132 | keyd = KGlobal::locale()->formatDate( d ); | ||
133 | keyt = KGlobal::locale()->formatTime( t ); | ||
134 | |||
135 | } else { | ||
136 | |||
123 | if (mTodo->hasStartDate()) { | 137 | if (mTodo->hasStartDate()) { |
124 | setText(5, mTodo->dtStartDateStr()); | 138 | keyd = mTodo->dtStartDateStr(); |
125 | QDate d = mTodo->dtStart().date(); | 139 | QDate d = mTodo->dtStart().date(); |
126 | skeyd.sprintf("%04d%02d%02d",d.year(),d.month(),d.day()); | 140 | skeyd.sprintf("%04d%02d%02d",d.year(),d.month(),d.day()); |
127 | 141 | ||
128 | if (mTodo->doesFloat()) { | 142 | if ( !mTodo->doesFloat()) { |
129 | setText(6,""); | 143 | keyt = mTodo->dtStartTimeStr(); |
130 | } | ||
131 | else { | ||
132 | setText(6,mTodo->dtStartTimeStr()); | ||
133 | QTime t = mTodo->dtStart().time(); | 144 | QTime t = mTodo->dtStart().time(); |
134 | skeyt.sprintf("%02d%02d",t.hour(),t.minute()); | 145 | skeyt.sprintf("%02d%02d",t.hour(),t.minute()); |
135 | 146 | ||
136 | } | 147 | } |
137 | } else { | 148 | |
138 | setText(5,""); | ||
139 | setText(6,""); | ||
140 | } | 149 | } |
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) { |
153 | setText(6,""); | 165 | setText(6,""); |
154 | } else { | 166 | } else { |
155 | QString str = mTodo->description().mid(pos+1); | 167 | QString str = mTodo->description().mid(pos+1); |
156 | str.stripWhiteSpace(); | 168 | str.stripWhiteSpace(); |
157 | setText(6,str); | 169 | setText(6,str); |
158 | } | 170 | } |
159 | #endif | 171 | #endif |
160 | 172 | ||
161 | m_known = false; | 173 | m_known = false; |
162 | m_init = false; | 174 | m_init = false; |
163 | 175 | ||
164 | setMyPixmap(); | 176 | setMyPixmap(); |
@@ -347,56 +359,64 @@ void KOTodoViewItem::paintCell(QPainter *p, const QColorGroup &cg, int column, i | |||
347 | { | 359 | { |
348 | QColorGroup _cg = cg; | 360 | QColorGroup _cg = cg; |
349 | QColorGroup::ColorRole role; | 361 | QColorGroup::ColorRole role; |
350 | if ( KOPrefs::instance()->mTodoViewUsesForegroundColor ) | 362 | if ( KOPrefs::instance()->mTodoViewUsesForegroundColor ) |
351 | role = QColorGroup::Text; | 363 | role = QColorGroup::Text; |
352 | else | 364 | else |
353 | role = QColorGroup::Base; | 365 | role = QColorGroup::Base; |
354 | //#ifndef KORG_NOLVALTERNATION | 366 | //#ifndef KORG_NOLVALTERNATION |
355 | if (isAlternate()) | 367 | if (isAlternate()) |
356 | _cg.setColor(QColorGroup::Base, static_cast< KOTodoListView* >(listView())->alternateBackground()); | 368 | _cg.setColor(QColorGroup::Base, static_cast< KOTodoListView* >(listView())->alternateBackground()); |
357 | bool setColor = KOPrefs::instance()->mTodoViewUsesCatColors; | 369 | bool setColor = KOPrefs::instance()->mTodoViewUsesCatColors; |
358 | QColor colorToSet; | 370 | QColor colorToSet; |
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; |
383 | bool colorRunning = mTodo->isRunning(); | ||
384 | if ( ! colorRunning && openMode ) | ||
385 | colorRunning = mTodo->hasRunningSub(); | ||
386 | if ( colorRunning ) { | ||
387 | setColor = true; | ||
388 | colorToSet = KOPrefs::instance()->mTodoRunColor; | ||
389 | } else { | ||
371 | int odue = mTodo->hasDueSubTodo( openMode ); | 390 | int odue = mTodo->hasDueSubTodo( openMode ); |
372 | if (odue == 2) { | 391 | if (odue == 2) { |
373 | colorToSet = KOPrefs::instance()->mTodoOverdueColor; | 392 | colorToSet = KOPrefs::instance()->mTodoOverdueColor; |
374 | setColor = true; | 393 | setColor = true; |
375 | } else if ( odue == 1 ) { | 394 | } else if ( odue == 1 ) { |
376 | colorToSet = KOPrefs::instance()->mTodoDueTodayColor; | 395 | colorToSet = KOPrefs::instance()->mTodoDueTodayColor; |
377 | setColor = true; | 396 | setColor = true; |
378 | } | 397 | } |
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 | } |
390 | } | 410 | } |
391 | //#endif | 411 | //#endif |
392 | if ( column > 0 ){ | 412 | if ( column > 0 ){ |
393 | if ( column == 2 && !KOPrefs::instance()->mTodoViewShowsPercentage ) { | 413 | if ( column == 2 && !KOPrefs::instance()->mTodoViewShowsPercentage ) { |
394 | p->save(); | 414 | p->save(); |
395 | int progress = (int)(( (width-6)*mTodo->percentComplete())/100.0 + 0.5); | 415 | int progress = (int)(( (width-6)*mTodo->percentComplete())/100.0 + 0.5); |
396 | 416 | ||
397 | p->fillRect( 0, 0, width, height(), _cg.base() ); // background | 417 | p->fillRect( 0, 0, width, height(), _cg.base() ); // background |
398 | // p->setPen(Qt::black ); //border | 418 | // p->setPen(Qt::black ); //border |
399 | // p->setBrush( KOPrefs::instance()->mHighlightColorKGlobalSettings::baseColor() ); //filling | 419 | // p->setBrush( KOPrefs::instance()->mHighlightColorKGlobalSettings::baseColor() ); //filling |
400 | QColor fc = KOPrefs::instance()->mHighlightColor; | 420 | QColor fc = KOPrefs::instance()->mHighlightColor; |
401 | if ( mTodo->percentComplete() == 100 ) | 421 | if ( mTodo->percentComplete() == 100 ) |
402 | fc = darkGreen; | 422 | fc = darkGreen; |