author | zautrix <zautrix> | 2005-04-09 20:21:58 (UTC) |
---|---|---|
committer | zautrix <zautrix> | 2005-04-09 20:21:58 (UTC) |
commit | 9e43ebbe5867b2da957bb17c35bd357715424cba (patch) (unidiff) | |
tree | b506ba029b50fc46a33d35a39e6f1c768c995f22 /korganizer | |
parent | 2c39ac46121e8796e780a5321ab777f08792e5ba (diff) | |
download | kdepimpi-9e43ebbe5867b2da957bb17c35bd357715424cba.zip kdepimpi-9e43ebbe5867b2da957bb17c35bd357715424cba.tar.gz kdepimpi-9e43ebbe5867b2da957bb17c35bd357715424cba.tar.bz2 |
todo tt
-rw-r--r-- | korganizer/koprefs.cpp | 7 | ||||
-rw-r--r-- | korganizer/koprefs.h | 1 | ||||
-rw-r--r-- | korganizer/koprefsdialog.cpp | 14 | ||||
-rw-r--r-- | korganizer/kotodoview.cpp | 30 | ||||
-rw-r--r-- | korganizer/kotodoview.h | 1 | ||||
-rw-r--r-- | korganizer/kotodoviewitem.cpp | 62 |
6 files changed, 86 insertions, 29 deletions
diff --git a/korganizer/koprefs.cpp b/korganizer/koprefs.cpp index 5879a2d..e8c7c76 100644 --- a/korganizer/koprefs.cpp +++ b/korganizer/koprefs.cpp | |||
@@ -1,411 +1,408 @@ | |||
1 | /* | 1 | /* |
2 | This file is part of KOrganizer. | 2 | This file is part of KOrganizer. |
3 | Copyright (c) 2001 Cornelius Schumacher <schumacher@kde.org> | 3 | Copyright (c) 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 | As a special exception, permission is given to link this program | 19 | As a special exception, permission is given to link this program |
20 | with any edition of Qt, and distribute the resulting executable, | 20 | with any edition of Qt, and distribute the resulting executable, |
21 | without including the source code for Qt in the source distribution. | 21 | without including the source code for Qt in the source distribution. |
22 | */ | 22 | */ |
23 | 23 | ||
24 | #include <time.h> | 24 | #include <time.h> |
25 | #ifndef _WIN32_ | 25 | #ifndef _WIN32_ |
26 | #include <unistd.h> | 26 | #include <unistd.h> |
27 | #endif | 27 | #endif |
28 | #include <qdir.h> | 28 | #include <qdir.h> |
29 | #include <qtextstream.h> | 29 | #include <qtextstream.h> |
30 | #include <qtextcodec.h> | 30 | #include <qtextcodec.h> |
31 | #include <qstring.h> | 31 | #include <qstring.h> |
32 | #include <qregexp.h> | 32 | #include <qregexp.h> |
33 | #include <qfont.h> | 33 | #include <qfont.h> |
34 | #include <qcolor.h> | 34 | #include <qcolor.h> |
35 | #include <qstringlist.h> | 35 | #include <qstringlist.h> |
36 | #include <stdlib.h> | 36 | #include <stdlib.h> |
37 | 37 | ||
38 | #include <kglobal.h> | 38 | #include <kglobal.h> |
39 | #include <kglobalsettings.h> | 39 | #include <kglobalsettings.h> |
40 | #include <kconfig.h> | 40 | #include <kconfig.h> |
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 | ||
96 | bool addIcons = false; | 92 | bool addIcons = false; |
97 | #ifdef DESKTOP_VERSION | 93 | #ifdef DESKTOP_VERSION |
98 | addIcons = true; | 94 | addIcons = true; |
99 | #endif | 95 | #endif |
100 | addItemBool("ShowIconNavigator",&mShowIconNavigator,addIcons); | 96 | addItemBool("ShowIconNavigator",&mShowIconNavigator,addIcons); |
101 | addItemBool("ShowIconAllday",&mShowIconAllday,addIcons); | 97 | addItemBool("ShowIconAllday",&mShowIconAllday,addIcons); |
102 | addItemBool("ShowIconFilterview",&mShowIconFilterview,addIcons); | 98 | addItemBool("ShowIconFilterview",&mShowIconFilterview,addIcons); |
103 | addItemBool("ShowIconToggleFull",&mShowIconToggleFull,addIcons); | 99 | addItemBool("ShowIconToggleFull",&mShowIconToggleFull,addIcons); |
104 | 100 | ||
105 | addItemInt("LastLoadedLanguage",&mOldLanguage,0); | 101 | addItemInt("LastLoadedLanguage",&mOldLanguage,0); |
106 | 102 | ||
107 | addItemBool("AskForQuit",&mAskForQuit,false); | 103 | addItemBool("AskForQuit",&mAskForQuit,false); |
108 | 104 | ||
109 | #ifndef DESKTOP_VERSION | 105 | #ifndef DESKTOP_VERSION |
110 | addItemBool("ShowFullMenu",&mShowFullMenu,false); | 106 | addItemBool("ShowFullMenu",&mShowFullMenu,false); |
111 | #else | 107 | #else |
112 | addItemBool("ShowFullMenu",&mShowFullMenu,true); | 108 | addItemBool("ShowFullMenu",&mShowFullMenu,true); |
113 | #endif | 109 | #endif |
114 | addItemBool("ToolBarHor",&mToolBarHor, true ); | 110 | addItemBool("ToolBarHor",&mToolBarHor, true ); |
115 | addItemBool("ToolBarUp",&mToolBarUp, false ); | 111 | addItemBool("ToolBarUp",&mToolBarUp, false ); |
116 | addItemBool("ToolBarHorV",&mToolBarHorV, true ); | 112 | addItemBool("ToolBarHorV",&mToolBarHorV, true ); |
117 | addItemBool("ToolBarUpV",&mToolBarUpV, false ); | 113 | addItemBool("ToolBarUpV",&mToolBarUpV, false ); |
118 | addItemBool("ToolBarHorN",&mToolBarHorN, true ); | 114 | addItemBool("ToolBarHorN",&mToolBarHorN, true ); |
119 | addItemBool("ToolBarUpN",&mToolBarUpN, false ); | 115 | addItemBool("ToolBarUpN",&mToolBarUpN, false ); |
120 | addItemBool("ToolBarHorF",&mToolBarHorF, true ); | 116 | addItemBool("ToolBarHorF",&mToolBarHorF, true ); |
121 | addItemBool("ToolBarUpF",&mToolBarUpF, false ); | 117 | addItemBool("ToolBarUpF",&mToolBarUpF, false ); |
122 | addItemBool("ToolBarMiniIcons",&mToolBarMiniIcons, false ); | 118 | addItemBool("ToolBarMiniIcons",&mToolBarMiniIcons, false ); |
123 | addItemInt("Whats Next Days",&mWhatsNextDays,3); | 119 | addItemInt("Whats Next Days",&mWhatsNextDays,3); |
124 | addItemInt("Whats Next Prios",&mWhatsNextPrios,1); | 120 | addItemInt("Whats Next Prios",&mWhatsNextPrios,1); |
125 | 121 | ||
126 | addItemBool("ShowTodoInAgenda",&mShowTodoInAgenda,true); | 122 | addItemBool("ShowTodoInAgenda",&mShowTodoInAgenda,true); |
127 | addItemBool("ShowTimeInAgenda",&mShowTimeInAgenda,true); | 123 | addItemBool("ShowTimeInAgenda",&mShowTimeInAgenda,true); |
128 | addItemBool("HideNonStartedTodos",&mHideNonStartedTodos,false); | 124 | addItemBool("HideNonStartedTodos",&mHideNonStartedTodos,false); |
129 | addItemBool("ShowCompletedTodo",&mShowCompletedTodo,true); | 125 | addItemBool("ShowCompletedTodo",&mShowCompletedTodo,true); |
130 | addItemInt("AllDay Size",&mAllDaySize,28); | 126 | addItemInt("AllDay Size",&mAllDaySize,28); |
131 | QString defAlarm = KGlobal::iconLoader()->iconPath()+"koalarm.wav"; | 127 | QString defAlarm = KGlobal::iconLoader()->iconPath()+"koalarm.wav"; |
132 | addItemString("DefaultAlarmFile",&mDefaultAlarmFile,defAlarm ); | 128 | addItemString("DefaultAlarmFile",&mDefaultAlarmFile,defAlarm ); |
133 | 129 | ||
134 | addItemStringList("LocationDefaults",&mLocationDefaults ); | 130 | addItemStringList("LocationDefaults",&mLocationDefaults ); |
135 | addItemStringList("EventSummary User",&mEventSummaryUser); | 131 | addItemStringList("EventSummary User",&mEventSummaryUser); |
136 | addItemStringList("TodoSummary User",&mTodoSummaryUser); | 132 | addItemStringList("TodoSummary User",&mTodoSummaryUser); |
137 | 133 | ||
138 | addItemBool("Enable Group Scheduling",&mEnableGroupScheduling,false); | 134 | addItemBool("Enable Group Scheduling",&mEnableGroupScheduling,false); |
139 | addItemBool("Enable Project View",&mEnableProjectView,false); | 135 | addItemBool("Enable Project View",&mEnableProjectView,false); |
140 | addItemBool("Auto Save",&mAutoSave,false); | 136 | addItemBool("Auto Save",&mAutoSave,false); |
141 | addItemInt("Auto Save Interval",&mAutoSaveInterval,3); | 137 | addItemInt("Auto Save Interval",&mAutoSaveInterval,3); |
142 | addItemBool("Confirm Deletes",&mConfirm,true); | 138 | addItemBool("Confirm Deletes",&mConfirm,true); |
143 | addItemString("Archive File",&mArchiveFile); | 139 | addItemString("Archive File",&mArchiveFile); |
144 | addItemString("Html Export File",&mHtmlExportFile, | 140 | addItemString("Html Export File",&mHtmlExportFile, |
145 | QDir::homeDirPath() + "/" + i18n("Default export file", "calendar.html")); | 141 | QDir::homeDirPath() + "/" + i18n("Default export file", "calendar.html")); |
146 | addItemBool("Html With Save",&mHtmlWithSave,false); | 142 | addItemBool("Html With Save",&mHtmlWithSave,false); |
147 | 143 | ||
148 | KPrefs::setCurrentGroup("Personal Settings"); | 144 | KPrefs::setCurrentGroup("Personal Settings"); |
149 | 145 | ||
150 | addItemInt("Mail Client",&mMailClient,MailClientKMail); | 146 | addItemInt("Mail Client",&mMailClient,MailClientKMail); |
151 | addItemBool("Use Control Center Email",&mEmailControlCenter,false); | 147 | addItemBool("Use Control Center Email",&mEmailControlCenter,false); |
152 | addItemBool("Bcc",&mBcc,false); | 148 | addItemBool("Bcc",&mBcc,false); |
153 | 149 | ||
154 | KPrefs::setCurrentGroup("Time & Date"); | 150 | KPrefs::setCurrentGroup("Time & Date"); |
155 | 151 | ||
156 | 152 | ||
157 | addItemInt("Default Start Time",&mStartTime,10); | 153 | addItemInt("Default Start Time",&mStartTime,10); |
158 | addItemInt("Default Duration",&mDefaultDuration,2); | 154 | addItemInt("Default Duration",&mDefaultDuration,2); |
159 | addItemInt("Default Alarm Time",&mAlarmTime,3); | 155 | addItemInt("Default Alarm Time",&mAlarmTime,3); |
160 | KPrefs::setCurrentGroup("AlarmSettings"); | 156 | KPrefs::setCurrentGroup("AlarmSettings"); |
161 | addItemInt("AlarmPlayBeeps",&mAlarmPlayBeeps,20); | 157 | addItemInt("AlarmPlayBeeps",&mAlarmPlayBeeps,20); |
162 | addItemInt("AlarmSuspendTime",&mAlarmSuspendTime,7); | 158 | addItemInt("AlarmSuspendTime",&mAlarmSuspendTime,7); |
163 | addItemInt("AlarmSuspendCount",&mAlarmSuspendCount,5); | 159 | addItemInt("AlarmSuspendCount",&mAlarmSuspendCount,5); |
164 | addItemInt("AlarmBeepInterval",&mAlarmBeepInterval,3); | 160 | addItemInt("AlarmBeepInterval",&mAlarmBeepInterval,3); |
165 | 161 | ||
166 | 162 | ||
167 | KPrefs::setCurrentGroup("Calendar"); | 163 | KPrefs::setCurrentGroup("Calendar"); |
168 | 164 | ||
169 | addItemInt("Default Calendar Format",&mDefaultFormat,FormatICalendar); | 165 | addItemInt("Default Calendar Format",&mDefaultFormat,FormatICalendar); |
170 | 166 | ||
171 | KPrefs::setCurrentGroup("Fonts"); | 167 | KPrefs::setCurrentGroup("Fonts"); |
172 | // qDebug(" KPrefs::setCurrentGroup(Fonts); "); | 168 | // qDebug(" KPrefs::setCurrentGroup(Fonts); "); |
173 | QFont fon = KGlobalSettings::generalFont(); | 169 | QFont fon = KGlobalSettings::generalFont(); |
174 | addItemFont("TimeBar Font",&mTimeBarFont,fon ); | 170 | addItemFont("TimeBar Font",&mTimeBarFont,fon ); |
175 | addItemFont("MonthView Font",&mMonthViewFont,fon); | 171 | addItemFont("MonthView Font",&mMonthViewFont,fon); |
176 | addItemFont("AgendaView Font",&mAgendaViewFont,fon); | 172 | addItemFont("AgendaView Font",&mAgendaViewFont,fon); |
177 | addItemFont("MarcusBains Font",&mMarcusBainsFont,fon); | 173 | addItemFont("MarcusBains Font",&mMarcusBainsFont,fon); |
178 | addItemFont("TimeLabels Font",&mTimeLabelsFont,fon); | 174 | addItemFont("TimeLabels Font",&mTimeLabelsFont,fon); |
179 | addItemFont("TodoView Font",&mTodoViewFont,fon); | 175 | addItemFont("TodoView Font",&mTodoViewFont,fon); |
180 | addItemFont("ListView Font",&mListViewFont,fon); | 176 | addItemFont("ListView Font",&mListViewFont,fon); |
181 | addItemFont("DateNavigator Font",&mDateNavigatorFont,fon); | 177 | addItemFont("DateNavigator Font",&mDateNavigatorFont,fon); |
182 | addItemFont("EditBox Font",&mEditBoxFont,fon); | 178 | addItemFont("EditBox Font",&mEditBoxFont,fon); |
183 | addItemFont("JournalView Font",&mJornalViewFont,fon); | 179 | addItemFont("JournalView Font",&mJornalViewFont,fon); |
184 | addItemFont("WhatsNextView Font",&mWhatsNextFont,fon); | 180 | addItemFont("WhatsNextView Font",&mWhatsNextFont,fon); |
185 | addItemFont("EventView Font",&mEventViewFont,fon); | 181 | addItemFont("EventView Font",&mEventViewFont,fon); |
186 | 182 | ||
187 | KPrefs::setCurrentGroup("RemoteSyncing"); | 183 | KPrefs::setCurrentGroup("RemoteSyncing"); |
188 | addItemString("ActiveSyncPort",&mActiveSyncPort,"9197" ); | 184 | addItemString("ActiveSyncPort",&mActiveSyncPort,"9197" ); |
189 | addItemString("ActiveSyncIP",&mActiveSyncIP,"192.168.0.40" ); | 185 | addItemString("ActiveSyncIP",&mActiveSyncIP,"192.168.0.40" ); |
190 | addItemBool("ShowSyncEvents",&mShowSyncEvents,false); | 186 | addItemBool("ShowSyncEvents",&mShowSyncEvents,false); |
191 | addItemInt("LastSyncTime",&mLastSyncTime,0); | 187 | addItemInt("LastSyncTime",&mLastSyncTime,0); |
192 | 188 | ||
193 | #ifdef _WIN32_ | 189 | #ifdef _WIN32_ |
194 | QString hdp= locateLocal("data","korganizer")+"\\\\"; | 190 | QString hdp= locateLocal("data","korganizer")+"\\\\"; |
195 | #else | 191 | #else |
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); |
244 | #else | 241 | #else |
245 | addItemBool("Enable ToolTips",&mEnableToolTips,false); | 242 | addItemBool("Enable ToolTips",&mEnableToolTips,false); |
246 | #endif | 243 | #endif |
247 | addItemBool("Enable MonthView ScrollBars",&mEnableMonthScroll,false); | 244 | addItemBool("Enable MonthView ScrollBars",&mEnableMonthScroll,false); |
248 | addItemBool("Marcus Bains shows seconds",&mMarcusBainsShowSeconds,false); | 245 | addItemBool("Marcus Bains shows seconds",&mMarcusBainsShowSeconds,false); |
249 | addItemBool("Show Marcus Bains",&mMarcusBainsEnabled,true); | 246 | addItemBool("Show Marcus Bains",&mMarcusBainsEnabled,true); |
250 | addItemBool("EditOnDoubleClick",&mEditOnDoubleClick,true); | 247 | addItemBool("EditOnDoubleClick",&mEditOnDoubleClick,true); |
251 | addItemBool("ViewChangeHoldFullscreen",&mViewChangeHoldFullscreen,true); | 248 | addItemBool("ViewChangeHoldFullscreen",&mViewChangeHoldFullscreen,true); |
252 | addItemBool("ViewChangeHoldNonFullscreen",&mViewChangeHoldNonFullscreen,false); | 249 | addItemBool("ViewChangeHoldNonFullscreen",&mViewChangeHoldNonFullscreen,false); |
253 | addItemBool("CenterOnCurrentTime",&mCenterOnCurrentTime,false); | 250 | addItemBool("CenterOnCurrentTime",&mCenterOnCurrentTime,false); |
254 | addItemBool("SetTimeToDayStartAt",&mSetTimeToDayStartAt,true); | 251 | addItemBool("SetTimeToDayStartAt",&mSetTimeToDayStartAt,true); |
255 | addItemBool("HighlightCurrentDay",&mHighlightCurrentDay,true); | 252 | addItemBool("HighlightCurrentDay",&mHighlightCurrentDay,true); |
256 | addItemBool("WNViewShowsParents",&mWNViewShowsParents,true);; | 253 | addItemBool("WNViewShowsParents",&mWNViewShowsParents,true);; |
257 | addItemBool("WNViewShowsPast",&mWNViewShowsPast,true); | 254 | addItemBool("WNViewShowsPast",&mWNViewShowsPast,true); |
258 | addItemBool("WNViewShowLocation",&mWNViewShowLocation,false); | 255 | addItemBool("WNViewShowLocation",&mWNViewShowLocation,false); |
259 | addItemBool("UseHighlightLightColor",&mUseHighlightLightColor,false); | 256 | addItemBool("UseHighlightLightColor",&mUseHighlightLightColor,false); |
260 | addItemBool("ListViewMonthTimespan",&mListViewMonthTimespan,true); | 257 | addItemBool("ListViewMonthTimespan",&mListViewMonthTimespan,true); |
261 | addItemBool("TodoViewUsesCatColors",&mTodoViewUsesCatColors,false); | 258 | addItemBool("TodoViewUsesCatColors",&mTodoViewUsesCatColors,false); |
262 | addItemBool("TodoViewShowsPercentage",&mTodoViewShowsPercentage,false); | 259 | addItemBool("TodoViewShowsPercentage",&mTodoViewShowsPercentage,false); |
263 | addItemBool("TodoViewUsesSmallFont",&mTodoViewUsesSmallFont,true); | 260 | addItemBool("TodoViewUsesSmallFont",&mTodoViewUsesSmallFont,true); |
264 | addItemBool("MonthViewUsesBigFont",&mMonthViewUsesBigFont,true); | 261 | addItemBool("MonthViewUsesBigFont",&mMonthViewUsesBigFont,true); |
265 | addItemBool("TodoViewUsesForegroundColor",&mTodoViewUsesForegroundColor,false); | 262 | addItemBool("TodoViewUsesForegroundColor",&mTodoViewUsesForegroundColor,false); |
266 | addItemBool("MonthViewUsesForegroundColor",&mMonthViewUsesForegroundColor,false); | 263 | addItemBool("MonthViewUsesForegroundColor",&mMonthViewUsesForegroundColor,false); |
267 | #ifdef DESKTOP_VERSION | 264 | #ifdef DESKTOP_VERSION |
268 | addItemBool("UseInternalAlarmNotification",&mUseInternalAlarmNotification,true); | 265 | addItemBool("UseInternalAlarmNotification",&mUseInternalAlarmNotification,true); |
269 | #else | 266 | #else |
270 | addItemBool("UseInternalAlarmNotification",&mUseInternalAlarmNotification,false); | 267 | addItemBool("UseInternalAlarmNotification",&mUseInternalAlarmNotification,false); |
271 | #endif | 268 | #endif |
272 | addItemInt("Day Begins",&mDayBegins,7); | 269 | addItemInt("Day Begins",&mDayBegins,7); |
273 | addItemInt("Working Hours Start",&mWorkingHoursStart,8); | 270 | addItemInt("Working Hours Start",&mWorkingHoursStart,8); |
274 | addItemInt("Working Hours End",&mWorkingHoursEnd,17); | 271 | addItemInt("Working Hours End",&mWorkingHoursEnd,17); |
275 | addItemBool("Exclude Holidays",&mExcludeHolidays,true); | 272 | addItemBool("Exclude Holidays",&mExcludeHolidays,true); |
276 | addItemBool("Exclude Saturdays",&mExcludeSaturdays,true); | 273 | addItemBool("Exclude Saturdays",&mExcludeSaturdays,true); |
277 | 274 | ||
278 | addItemBool("Month View Uses Category Color",&mMonthViewUsesCategoryColor,false); | 275 | addItemBool("Month View Uses Category Color",&mMonthViewUsesCategoryColor,false); |
279 | addItemBool("Full View Month",&mFullViewMonth,true); | 276 | addItemBool("Full View Month",&mFullViewMonth,true); |
280 | addItemBool("Full View Todo",&mFullViewTodo,true); | 277 | addItemBool("Full View Todo",&mFullViewTodo,true); |
281 | addItemBool("Quick Todo",&mEnableQuickTodo,false); | 278 | addItemBool("Quick Todo",&mEnableQuickTodo,false); |
282 | 279 | ||
283 | addItemInt("Next X Days",&mNextXDays,3); | 280 | addItemInt("Next X Days",&mNextXDays,3); |
284 | 281 | ||
285 | KPrefs::setCurrentGroup("Printer"); | 282 | KPrefs::setCurrentGroup("Printer"); |
286 | 283 | ||
287 | KPrefs::setCurrentGroup("Layout"); | 284 | KPrefs::setCurrentGroup("Layout"); |
288 | 285 | ||
289 | addItemBool("CompactDialogs",&mCompactDialogs,false); | 286 | addItemBool("CompactDialogs",&mCompactDialogs,false); |
290 | addItemBool("VerticalScreen",&mVerticalScreen,true); | 287 | addItemBool("VerticalScreen",&mVerticalScreen,true); |
291 | 288 | ||
292 | KPrefs::setCurrentGroup("KOrganizer Plugins"); | 289 | KPrefs::setCurrentGroup("KOrganizer Plugins"); |
293 | 290 | ||
294 | addItemStringList("SelectedPlugins",&mSelectedPlugins,"holidays"); | 291 | addItemStringList("SelectedPlugins",&mSelectedPlugins,"holidays"); |
295 | 292 | ||
296 | KPrefs::setCurrentGroup("Group Scheduling"); | 293 | KPrefs::setCurrentGroup("Group Scheduling"); |
297 | 294 | ||
298 | addItemInt("IMIPScheduler",&mIMIPScheduler,IMIPKMail); | 295 | addItemInt("IMIPScheduler",&mIMIPScheduler,IMIPKMail); |
299 | addItemInt("IMIPSend",&mIMIPSend,IMIPdirectsend); | 296 | addItemInt("IMIPSend",&mIMIPSend,IMIPdirectsend); |
300 | addItemStringList("AdditionalMails",&mAdditionalMails,""); | 297 | addItemStringList("AdditionalMails",&mAdditionalMails,""); |
301 | addItemInt("IMIP auto refresh",&mIMIPAutoRefresh,neverAuto); | 298 | addItemInt("IMIP auto refresh",&mIMIPAutoRefresh,neverAuto); |
302 | addItemInt("IMIP auto insert request",&mIMIPAutoInsertRequest,neverAuto); | 299 | addItemInt("IMIP auto insert request",&mIMIPAutoInsertRequest,neverAuto); |
303 | addItemInt("IMIP auto insert reply",&mIMIPAutoInsertReply,neverAuto); | 300 | addItemInt("IMIP auto insert reply",&mIMIPAutoInsertReply,neverAuto); |
304 | addItemInt("IMIP auto FreeBusy",&mIMIPAutoFreeBusy,neverAuto); | 301 | addItemInt("IMIP auto FreeBusy",&mIMIPAutoFreeBusy,neverAuto); |
305 | addItemInt("IMIP auto save FreeBusy",&mIMIPAutoFreeBusyReply,neverAuto); | 302 | addItemInt("IMIP auto save FreeBusy",&mIMIPAutoFreeBusyReply,neverAuto); |
306 | 303 | ||
307 | KPrefs::setCurrentGroup( "Editors" ); | 304 | KPrefs::setCurrentGroup( "Editors" ); |
308 | 305 | ||
309 | addItemStringList( "EventTemplates", &mEventTemplates ); | 306 | addItemStringList( "EventTemplates", &mEventTemplates ); |
310 | addItemStringList( "TodoTemplates", &mTodoTemplates ); | 307 | addItemStringList( "TodoTemplates", &mTodoTemplates ); |
311 | 308 | ||
312 | addItemInt("DestinationPolicy",&mDestination,standardDestination); | 309 | addItemInt("DestinationPolicy",&mDestination,standardDestination); |
313 | 310 | ||
314 | KPrefs::setCurrentGroup( "ViewOptions" ); | 311 | KPrefs::setCurrentGroup( "ViewOptions" ); |
315 | addItemBool("EVshowDetails",&mEVshowDetails,true); | 312 | addItemBool("EVshowDetails",&mEVshowDetails,true); |
316 | addItemBool("EVshowCreated",&mEVshowCreated,true); | 313 | addItemBool("EVshowCreated",&mEVshowCreated,true); |
317 | addItemBool("EVshowChanged",&mEVshowChanged,true); | 314 | addItemBool("EVshowChanged",&mEVshowChanged,true); |
318 | addItemBool("WTshowDetails",&mWTshowDetails,false); | 315 | addItemBool("WTshowDetails",&mWTshowDetails,false); |
319 | addItemBool("WTshowCreated",&mWTshowCreated,false); | 316 | addItemBool("WTshowCreated",&mWTshowCreated,false); |
320 | addItemBool("WTshowChanged",&mWTshowChanged,false); | 317 | addItemBool("WTshowChanged",&mWTshowChanged,false); |
321 | 318 | ||
322 | } | 319 | } |
323 | 320 | ||
324 | 321 | ||
325 | KOPrefs::~KOPrefs() | 322 | KOPrefs::~KOPrefs() |
326 | { | 323 | { |
327 | if (mInstance == this) | 324 | if (mInstance == this) |
328 | mInstance = insd.setObject(0); | 325 | mInstance = insd.setObject(0); |
329 | 326 | ||
330 | //qDebug("KOPrefs::~KOPrefs() "); | 327 | //qDebug("KOPrefs::~KOPrefs() "); |
331 | } | 328 | } |
332 | 329 | ||
333 | 330 | ||
334 | KOPrefs *KOPrefs::instance() | 331 | KOPrefs *KOPrefs::instance() |
335 | { | 332 | { |
336 | if (!mInstance) { | 333 | if (!mInstance) { |
337 | mInstance = insd.setObject(new KOPrefs()); | 334 | mInstance = insd.setObject(new KOPrefs()); |
338 | mInstance->readConfig(); | 335 | mInstance->readConfig(); |
339 | } | 336 | } |
340 | 337 | ||
341 | return mInstance; | 338 | return mInstance; |
342 | } | 339 | } |
343 | 340 | ||
344 | void KOPrefs::usrSetDefaults() | 341 | void KOPrefs::usrSetDefaults() |
345 | { | 342 | { |
346 | 343 | ||
347 | } | 344 | } |
348 | 345 | ||
349 | void KOPrefs::fillMailDefaults() | 346 | void KOPrefs::fillMailDefaults() |
350 | { | 347 | { |
351 | if (mName.isEmpty()) mName = i18n("Anonymous"); | 348 | if (mName.isEmpty()) mName = i18n("Anonymous"); |
352 | if (mEmail.isEmpty()) mEmail = i18n("nobody@nowhere"); | 349 | if (mEmail.isEmpty()) mEmail = i18n("nobody@nowhere"); |
353 | } | 350 | } |
354 | 351 | ||
355 | void KOPrefs::setTimeZoneIdDefault() | 352 | void KOPrefs::setTimeZoneIdDefault() |
356 | { | 353 | { |
357 | ; | 354 | ; |
358 | } | 355 | } |
359 | 356 | ||
360 | void KOPrefs::setAllDefaults() | 357 | void KOPrefs::setAllDefaults() |
361 | { | 358 | { |
362 | setCategoryDefaults(); | 359 | setCategoryDefaults(); |
363 | mEventSummaryUser = getDefaultList() ; | 360 | mEventSummaryUser = getDefaultList() ; |
364 | mTodoSummaryUser = getDefaultList() ; | 361 | mTodoSummaryUser = getDefaultList() ; |
365 | mLocationDefaults = getLocationDefaultList(); | 362 | mLocationDefaults = getLocationDefaultList(); |
366 | } | 363 | } |
367 | 364 | ||
368 | void KOPrefs::setCategoryDefaults() | 365 | void KOPrefs::setCategoryDefaults() |
369 | { | 366 | { |
370 | mCustomCategories.clear(); | 367 | mCustomCategories.clear(); |
371 | mCustomCategories = getDefaultList(); | 368 | mCustomCategories = getDefaultList(); |
372 | 369 | ||
373 | QStringList::Iterator it; | 370 | QStringList::Iterator it; |
374 | for (it = mCustomCategories.begin();it != mCustomCategories.end();++it ) { | 371 | for (it = mCustomCategories.begin();it != mCustomCategories.end();++it ) { |
375 | setCategoryColor(*it,mDefaultCategoryColor); | 372 | setCategoryColor(*it,mDefaultCategoryColor); |
376 | } | 373 | } |
377 | } | 374 | } |
378 | QStringList KOPrefs::getLocationDefaultList() | 375 | QStringList KOPrefs::getLocationDefaultList() |
379 | { | 376 | { |
380 | QStringList retval ; | 377 | QStringList retval ; |
381 | retval << i18n("Home") << i18n("Office") << i18n("Library") << i18n("School") << i18n("Doctor") << i18n("Beach") | 378 | retval << i18n("Home") << i18n("Office") << i18n("Library") << i18n("School") << i18n("Doctor") << i18n("Beach") |
382 | << i18n("University") << i18n("Restaurant") << i18n("Bar") << i18n("Conference room") | 379 | << i18n("University") << i18n("Restaurant") << i18n("Bar") << i18n("Conference room") |
383 | << i18n("Cinema") << i18n("Lake") << i18n("Kindergarten") | 380 | << i18n("Cinema") << i18n("Lake") << i18n("Kindergarten") |
384 | << i18n("Germany") << i18n("Sweden") << i18n("Forest") << i18n("Desert") << i18n("Kitchen") ; | 381 | << i18n("Germany") << i18n("Sweden") << i18n("Forest") << i18n("Desert") << i18n("Kitchen") ; |
385 | // << i18n("") << i18n("") << i18n("") << i18n("") << i18n("") << i18n("") << i18n("") << i18n("") | 382 | // << i18n("") << i18n("") << i18n("") << i18n("") << i18n("") << i18n("") << i18n("") << i18n("") |
386 | 383 | ||
387 | retval.sort(); | 384 | retval.sort(); |
388 | return retval; | 385 | return retval; |
389 | } | 386 | } |
390 | QStringList KOPrefs::getDefaultList() | 387 | QStringList KOPrefs::getDefaultList() |
391 | { | 388 | { |
392 | QStringList retval ; | 389 | QStringList retval ; |
393 | retval << i18n("Anniversary") << i18n("Appointment") << i18n("Birthday") << i18n("Business") << i18n("Business Travel") << i18n("Cinema") << i18n("Customer") | 390 | retval << i18n("Anniversary") << i18n("Appointment") << i18n("Birthday") << i18n("Business") << i18n("Business Travel") << i18n("Cinema") << i18n("Customer") |
394 | << i18n("Break")<< i18n("Breakfast")<< i18n("Competition")<< i18n("Dinner") | 391 | << i18n("Break")<< i18n("Breakfast")<< i18n("Competition")<< i18n("Dinner") |
395 | << i18n("Education")<< i18n("Family") << i18n("Favorites") << i18n("Festival")<< i18n("Fishing")<< i18n("Flight") << i18n("Gifts") | 392 | << i18n("Education")<< i18n("Family") << i18n("Favorites") << i18n("Festival")<< i18n("Fishing")<< i18n("Flight") << i18n("Gifts") |
396 | << i18n("Holiday") << i18n("Holiday Cards")<< i18n("Hot Contacts") << i18n("Hiking") << i18n("Hunting") << i18n("Key Customer") << i18n("Kids") | 393 | << i18n("Holiday") << i18n("Holiday Cards")<< i18n("Hot Contacts") << i18n("Hiking") << i18n("Hunting") << i18n("Key Customer") << i18n("Kids") |
397 | << i18n("Lunch") << i18n("Meeting") << i18n("Miscellaneous") << i18n("Partner")<< i18n("Party") << i18n("Personal") << i18n("Personal Travel") | 394 | << i18n("Lunch") << i18n("Meeting") << i18n("Miscellaneous") << i18n("Partner")<< i18n("Party") << i18n("Personal") << i18n("Personal Travel") |
398 | << i18n("PHB") << i18n("Phone Calls") << i18n("Projects") << i18n("Recurring") << i18n("School") << i18n("Shopping") | 395 | << i18n("PHB") << i18n("Phone Calls") << i18n("Projects") << i18n("Recurring") << i18n("School") << i18n("Shopping") |
399 | << i18n("Speach") << i18n("Special Occasion") << i18n("Sports") << i18n("Talk") << i18n("Travel") << i18n("TV")<< i18n("University") | 396 | << i18n("Speach") << i18n("Special Occasion") << i18n("Sports") << i18n("Talk") << i18n("Travel") << i18n("TV")<< i18n("University") |
400 | << i18n("Vacation") << i18n("VIP") << i18n("SyncEvent") ; | 397 | << i18n("Vacation") << i18n("VIP") << i18n("SyncEvent") ; |
401 | retval.sort(); | 398 | retval.sort(); |
402 | //qDebug("cat %s ", retval.join("-").latin1()); | 399 | //qDebug("cat %s ", retval.join("-").latin1()); |
403 | return retval; | 400 | return retval; |
404 | } | 401 | } |
405 | 402 | ||
406 | void KOPrefs::usrReadConfig() | 403 | void KOPrefs::usrReadConfig() |
407 | { | 404 | { |
408 | config()->setGroup("General"); | 405 | config()->setGroup("General"); |
409 | 406 | ||
410 | //qDebug("KOPrefs::usrReadConfig() "); | 407 | //qDebug("KOPrefs::usrReadConfig() "); |
411 | mCustomCategories = config()->readListEntry("Custom Categories"); | 408 | mCustomCategories = config()->readListEntry("Custom Categories"); |
diff --git a/korganizer/koprefs.h b/korganizer/koprefs.h index cf8dae6..d511faa 100644 --- a/korganizer/koprefs.h +++ b/korganizer/koprefs.h | |||
@@ -1,316 +1,317 @@ | |||
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 | As a special exception, permission is given to link this program | 19 | As a special exception, permission is given to link this program |
20 | with any edition of Qt, and distribute the resulting executable, | 20 | with any edition of Qt, and distribute the resulting executable, |
21 | without including the source code for Qt in the source distribution. | 21 | without including the source code for Qt in the source distribution. |
22 | */ | 22 | */ |
23 | #ifndef KOPREFS_H | 23 | #ifndef KOPREFS_H |
24 | #define KOPREFS_H | 24 | #define KOPREFS_H |
25 | 25 | ||
26 | 26 | ||
27 | #include <libkdepim/kpimprefs.h> | 27 | #include <libkdepim/kpimprefs.h> |
28 | #include <qdict.h> | 28 | #include <qdict.h> |
29 | 29 | ||
30 | class KConfig; | 30 | class KConfig; |
31 | class QFont; | 31 | class QFont; |
32 | class QColor; | 32 | class QColor; |
33 | class QStringList; | 33 | class QStringList; |
34 | 34 | ||
35 | #define VIEW_WN_VIEW 1 | 35 | #define VIEW_WN_VIEW 1 |
36 | #define VIEW_NX_VIEW 2 | 36 | #define VIEW_NX_VIEW 2 |
37 | #define VIEW_J_VIEW 3 | 37 | #define VIEW_J_VIEW 3 |
38 | #define VIEW_A_VIEW 4 | 38 | #define VIEW_A_VIEW 4 |
39 | #define VIEW_ML_VIEW 5 | 39 | #define VIEW_ML_VIEW 5 |
40 | #define VIEW_M_VIEW 6 | 40 | #define VIEW_M_VIEW 6 |
41 | #define VIEW_L_VIEW 7 | 41 | #define VIEW_L_VIEW 7 |
42 | #define VIEW_T_VIEW 8 | 42 | #define VIEW_T_VIEW 8 |
43 | 43 | ||
44 | class KOPrefs : public KPimPrefs | 44 | class KOPrefs : public KPimPrefs |
45 | { | 45 | { |
46 | public: | 46 | public: |
47 | enum { FormatVCalendar, FormatICalendar }; | 47 | enum { FormatVCalendar, FormatICalendar }; |
48 | enum { MailClientKMail, MailClientSendmail }; | 48 | enum { MailClientKMail, MailClientSendmail }; |
49 | enum { IMIPDummy, IMIPKMail }; | 49 | enum { IMIPDummy, IMIPKMail }; |
50 | enum { IMIPOutbox, IMIPdirectsend }; | 50 | enum { IMIPOutbox, IMIPdirectsend }; |
51 | enum { neverAuto, addressbookAuto, selectedAuto }; | 51 | enum { neverAuto, addressbookAuto, selectedAuto }; |
52 | enum { standardDestination, askDestination }; | 52 | enum { standardDestination, askDestination }; |
53 | 53 | ||
54 | virtual ~KOPrefs(); | 54 | virtual ~KOPrefs(); |
55 | 55 | ||
56 | /** Get instance of KOPrefs. It is made sure that there is only one | 56 | /** Get instance of KOPrefs. It is made sure that there is only one |
57 | instance. */ | 57 | instance. */ |
58 | static KOPrefs *instance(); | 58 | static KOPrefs *instance(); |
59 | 59 | ||
60 | /** Set preferences to default values */ | 60 | /** Set preferences to default values */ |
61 | void usrSetDefaults(); | 61 | void usrSetDefaults(); |
62 | 62 | ||
63 | /** Read preferences from config file */ | 63 | /** Read preferences from config file */ |
64 | void usrReadConfig(); | 64 | void usrReadConfig(); |
65 | 65 | ||
66 | /** Write preferences to config file */ | 66 | /** Write preferences to config file */ |
67 | void usrWriteConfig(); | 67 | void usrWriteConfig(); |
68 | void setCategoryDefaults(); | 68 | void setCategoryDefaults(); |
69 | void setAllDefaults(); | 69 | void setAllDefaults(); |
70 | 70 | ||
71 | protected: | 71 | protected: |
72 | void setTimeZoneIdDefault(); | 72 | void setTimeZoneIdDefault(); |
73 | 73 | ||
74 | /** Fill empty mail fields with default values. */ | 74 | /** Fill empty mail fields with default values. */ |
75 | void fillMailDefaults(); | 75 | void fillMailDefaults(); |
76 | 76 | ||
77 | private: | 77 | private: |
78 | /** Constructor disabled for public. Use instance() to create a KOPrefs | 78 | /** Constructor disabled for public. Use instance() to create a KOPrefs |
79 | object. */ | 79 | object. */ |
80 | KOPrefs(); | 80 | KOPrefs(); |
81 | 81 | ||
82 | static KOPrefs *mInstance; | 82 | static KOPrefs *mInstance; |
83 | QStringList getDefaultList(); | 83 | QStringList getDefaultList(); |
84 | QStringList getLocationDefaultList(); | 84 | QStringList getLocationDefaultList(); |
85 | public: | 85 | public: |
86 | // preferences data | 86 | // preferences data |
87 | KConfig* getConfig(); | 87 | KConfig* getConfig(); |
88 | void setFullName(const QString &); | 88 | void setFullName(const QString &); |
89 | QString fullName(); | 89 | QString fullName(); |
90 | void setEmail(const QString &); | 90 | void setEmail(const QString &); |
91 | QString email(); | 91 | QString email(); |
92 | 92 | ||
93 | QString mAdditional; | 93 | QString mAdditional; |
94 | 94 | ||
95 | bool mEmailControlCenter; | 95 | bool mEmailControlCenter; |
96 | 96 | ||
97 | bool mBcc; | 97 | bool mBcc; |
98 | bool mAutoSave; | 98 | bool mAutoSave; |
99 | int mAutoSaveInterval; | 99 | int mAutoSaveInterval; |
100 | bool mConfirm; | 100 | bool mConfirm; |
101 | 101 | ||
102 | bool mEnableGroupScheduling; | 102 | bool mEnableGroupScheduling; |
103 | bool mEnableProjectView; | 103 | bool mEnableProjectView; |
104 | 104 | ||
105 | int mDefaultFormat; | 105 | int mDefaultFormat; |
106 | int mMailClient; | 106 | int mMailClient; |
107 | 107 | ||
108 | int mStartTime; | 108 | int mStartTime; |
109 | int mDefaultDuration; | 109 | int mDefaultDuration; |
110 | int mAlarmTime; | 110 | int mAlarmTime; |
111 | 111 | ||
112 | int mWorkingHoursStart; | 112 | int mWorkingHoursStart; |
113 | int mWorkingHoursEnd; | 113 | int mWorkingHoursEnd; |
114 | bool mExcludeHolidays; | 114 | bool mExcludeHolidays; |
115 | bool mExcludeSaturdays; | 115 | bool mExcludeSaturdays; |
116 | bool mMarcusBainsShowSeconds; | 116 | bool mMarcusBainsShowSeconds; |
117 | 117 | ||
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; |
166 | bool mFullViewTodo; | 167 | bool mFullViewTodo; |
167 | bool mShowCompletedTodo; | 168 | bool mShowCompletedTodo; |
168 | bool mMarcusBainsEnabled; | 169 | bool mMarcusBainsEnabled; |
169 | int mNextXDays; | 170 | int mNextXDays; |
170 | int mWhatsNextDays; | 171 | int mWhatsNextDays; |
171 | int mWhatsNextPrios; | 172 | int mWhatsNextPrios; |
172 | bool mEnableQuickTodo; | 173 | bool mEnableQuickTodo; |
173 | 174 | ||
174 | bool mCompactDialogs; | 175 | bool mCompactDialogs; |
175 | bool mVerticalScreen; | 176 | bool mVerticalScreen; |
176 | 177 | ||
177 | bool mShowIconNewTodo; | 178 | bool mShowIconNewTodo; |
178 | bool mShowIconNewEvent; | 179 | bool mShowIconNewEvent; |
179 | bool mShowIconSearch; | 180 | bool mShowIconSearch; |
180 | bool mShowIconList; | 181 | bool mShowIconList; |
181 | bool mShowIconDay1; | 182 | bool mShowIconDay1; |
182 | bool mShowIconDay5; | 183 | bool mShowIconDay5; |
183 | bool mShowIconDay6; | 184 | bool mShowIconDay6; |
184 | bool mShowIconDay7; | 185 | bool mShowIconDay7; |
185 | bool mShowIconMonth; | 186 | bool mShowIconMonth; |
186 | bool mShowIconTodoview; | 187 | bool mShowIconTodoview; |
187 | bool mShowIconBackFast; | 188 | bool mShowIconBackFast; |
188 | bool mShowIconBack; | 189 | bool mShowIconBack; |
189 | bool mShowIconToday; | 190 | bool mShowIconToday; |
190 | bool mShowIconForward; | 191 | bool mShowIconForward; |
191 | bool mShowIconForwardFast; | 192 | bool mShowIconForwardFast; |
192 | bool mShowIconWhatsThis; | 193 | bool mShowIconWhatsThis; |
193 | bool mShowIconWeekNum; | 194 | bool mShowIconWeekNum; |
194 | bool mShowIconNextDays; | 195 | bool mShowIconNextDays; |
195 | bool mShowIconNext; | 196 | bool mShowIconNext; |
196 | bool mShowIconJournal; | 197 | bool mShowIconJournal; |
197 | bool mShowIconFilter; | 198 | bool mShowIconFilter; |
198 | bool mShowIconOnetoolbar; | 199 | bool mShowIconOnetoolbar; |
199 | bool mShowIconNavigator; | 200 | bool mShowIconNavigator; |
200 | bool mShowIconAllday; | 201 | bool mShowIconAllday; |
201 | bool mShowIconFilterview; | 202 | bool mShowIconFilterview; |
202 | bool mShowIconToggleFull; | 203 | bool mShowIconToggleFull; |
203 | 204 | ||
204 | bool mShowIconStretch; | 205 | bool mShowIconStretch; |
205 | 206 | ||
206 | bool mToolBarHor; | 207 | bool mToolBarHor; |
207 | bool mToolBarUp; | 208 | bool mToolBarUp; |
208 | bool mToolBarHorV; | 209 | bool mToolBarHorV; |
209 | bool mToolBarUpV; | 210 | bool mToolBarUpV; |
210 | bool mToolBarHorN; | 211 | bool mToolBarHorN; |
211 | bool mToolBarUpN; | 212 | bool mToolBarUpN; |
212 | bool mToolBarHorF; | 213 | bool mToolBarHorF; |
213 | bool mToolBarUpF; | 214 | bool mToolBarUpF; |
214 | bool mToolBarMiniIcons; | 215 | bool mToolBarMiniIcons; |
215 | 216 | ||
216 | bool mAskForQuit; | 217 | bool mAskForQuit; |
217 | bool mUsePassWd; | 218 | bool mUsePassWd; |
218 | bool mShowSyncEvents; | 219 | bool mShowSyncEvents; |
219 | bool mShowTodoInAgenda; | 220 | bool mShowTodoInAgenda; |
220 | bool mShowTimeInAgenda; | 221 | bool mShowTimeInAgenda; |
221 | bool mHideNonStartedTodos; | 222 | bool mHideNonStartedTodos; |
222 | 223 | ||
223 | int mLastSyncTime; | 224 | int mLastSyncTime; |
224 | void setCategoryColor(QString cat,const QColor & color); | 225 | void setCategoryColor(QString cat,const QColor & color); |
225 | QColor *categoryColor(QString cat); | 226 | QColor *categoryColor(QString cat); |
226 | 227 | ||
227 | QString mArchiveFile; | 228 | QString mArchiveFile; |
228 | QString mHtmlExportFile; | 229 | QString mHtmlExportFile; |
229 | bool mHtmlWithSave; | 230 | bool mHtmlWithSave; |
230 | 231 | ||
231 | QStringList mSelectedPlugins; | 232 | QStringList mSelectedPlugins; |
232 | 233 | ||
233 | QString mLastImportFile; | 234 | QString mLastImportFile; |
234 | QString mLastVcalFile; | 235 | QString mLastVcalFile; |
235 | QString mLastSaveFile; | 236 | QString mLastSaveFile; |
236 | QString mLastLoadFile; | 237 | QString mLastLoadFile; |
237 | 238 | ||
238 | 239 | ||
239 | QString mDefaultAlarmFile; | 240 | QString mDefaultAlarmFile; |
240 | int mIMIPScheduler; | 241 | int mIMIPScheduler; |
241 | int mIMIPSend; | 242 | int mIMIPSend; |
242 | QStringList mAdditionalMails; | 243 | QStringList mAdditionalMails; |
243 | int mIMIPAutoRefresh; | 244 | int mIMIPAutoRefresh; |
244 | int mIMIPAutoInsertReply; | 245 | int mIMIPAutoInsertReply; |
245 | int mIMIPAutoInsertRequest; | 246 | int mIMIPAutoInsertRequest; |
246 | int mIMIPAutoFreeBusy; | 247 | int mIMIPAutoFreeBusy; |
247 | int mIMIPAutoFreeBusyReply; | 248 | int mIMIPAutoFreeBusyReply; |
248 | 249 | ||
249 | QStringList mTodoTemplates; | 250 | QStringList mTodoTemplates; |
250 | QStringList mEventTemplates; | 251 | QStringList mEventTemplates; |
251 | 252 | ||
252 | int mDestination; | 253 | int mDestination; |
253 | 254 | ||
254 | 255 | ||
255 | bool mEditOnDoubleClick; | 256 | bool mEditOnDoubleClick; |
256 | bool mViewChangeHoldFullscreen; | 257 | bool mViewChangeHoldFullscreen; |
257 | bool mViewChangeHoldNonFullscreen; | 258 | bool mViewChangeHoldNonFullscreen; |
258 | bool mCenterOnCurrentTime; | 259 | bool mCenterOnCurrentTime; |
259 | bool mSetTimeToDayStartAt; | 260 | bool mSetTimeToDayStartAt; |
260 | bool mHighlightCurrentDay; | 261 | bool mHighlightCurrentDay; |
261 | bool mUseHighlightLightColor; | 262 | bool mUseHighlightLightColor; |
262 | bool mListViewMonthTimespan; | 263 | bool mListViewMonthTimespan; |
263 | bool mWNViewShowsParents; | 264 | bool mWNViewShowsParents; |
264 | bool mWNViewShowsPast; | 265 | bool mWNViewShowsPast; |
265 | bool mWNViewShowLocation; | 266 | bool mWNViewShowLocation; |
266 | bool mTodoViewShowsPercentage; | 267 | bool mTodoViewShowsPercentage; |
267 | bool mTodoViewUsesCatColors; | 268 | bool mTodoViewUsesCatColors; |
268 | bool mMonthViewUsesBigFont; | 269 | bool mMonthViewUsesBigFont; |
269 | bool mTodoViewUsesSmallFont; | 270 | bool mTodoViewUsesSmallFont; |
270 | bool mTodoViewUsesForegroundColor; | 271 | bool mTodoViewUsesForegroundColor; |
271 | bool mMonthViewUsesForegroundColor; | 272 | bool mMonthViewUsesForegroundColor; |
272 | 273 | ||
273 | bool mHightlightDateTimeEdit; | 274 | bool mHightlightDateTimeEdit; |
274 | bool mShortDateInViewer; | 275 | bool mShortDateInViewer; |
275 | 276 | ||
276 | bool mShowDateNavigator; | 277 | bool mShowDateNavigator; |
277 | 278 | ||
278 | QStringList mLocationDefaults; | 279 | QStringList mLocationDefaults; |
279 | QStringList mEventSummaryUser; | 280 | QStringList mEventSummaryUser; |
280 | QStringList mTodoSummaryUser; | 281 | QStringList mTodoSummaryUser; |
281 | 282 | ||
282 | bool mUseInternalAlarmNotification; | 283 | bool mUseInternalAlarmNotification; |
283 | int mAlarmPlayBeeps; | 284 | int mAlarmPlayBeeps; |
284 | int mAlarmSuspendTime; | 285 | int mAlarmSuspendTime; |
285 | int mAlarmSuspendCount; | 286 | int mAlarmSuspendCount; |
286 | int mAlarmBeepInterval; | 287 | int mAlarmBeepInterval; |
287 | int mOldLanguage; | 288 | int mOldLanguage; |
288 | int mOldLoadedLanguage; | 289 | int mOldLoadedLanguage; |
289 | 290 | ||
290 | 291 | ||
291 | QString mActiveSyncPort; | 292 | QString mActiveSyncPort; |
292 | QString mActiveSyncIP; | 293 | QString mActiveSyncIP; |
293 | 294 | ||
294 | // settings for eventviewer | 295 | // settings for eventviewer |
295 | bool mEVshowDetails; | 296 | bool mEVshowDetails; |
296 | bool mEVshowCreated; | 297 | bool mEVshowCreated; |
297 | bool mEVshowChanged; | 298 | bool mEVshowChanged; |
298 | bool mWTshowDetails; | 299 | bool mWTshowDetails; |
299 | bool mWTshowCreated; | 300 | bool mWTshowCreated; |
300 | bool mWTshowChanged; | 301 | bool mWTshowChanged; |
301 | 302 | ||
302 | int mCurrentDisplayedView; | 303 | int mCurrentDisplayedView; |
303 | 304 | ||
304 | private: | 305 | private: |
305 | QDict<QColor> mCategoryColors; | 306 | QDict<QColor> mCategoryColors; |
306 | QColor mDefaultCategoryColor; | 307 | QColor mDefaultCategoryColor; |
307 | 308 | ||
308 | QFont mDefaultTimeBarFont; | 309 | QFont mDefaultTimeBarFont; |
309 | QFont mDefaultViewFont; | 310 | QFont mDefaultViewFont; |
310 | QFont mDefaultMonthViewFont; | 311 | QFont mDefaultMonthViewFont; |
311 | 312 | ||
312 | QString mName; | 313 | QString mName; |
313 | QString mEmail; | 314 | QString mEmail; |
314 | }; | 315 | }; |
315 | 316 | ||
316 | #endif | 317 | #endif |
diff --git a/korganizer/koprefsdialog.cpp b/korganizer/koprefsdialog.cpp index 0bbb3bf..a8943de 100644 --- a/korganizer/koprefsdialog.cpp +++ b/korganizer/koprefsdialog.cpp | |||
@@ -706,390 +706,400 @@ void KOPrefsDialog::setupViewsTab() | |||
706 | addWidBool(i18n("Set agenda to current time on change"), | 706 | addWidBool(i18n("Set agenda to current time on change"), |
707 | &(KOPrefs::instance()->mCenterOnCurrentTime),topFrame); | 707 | &(KOPrefs::instance()->mCenterOnCurrentTime),topFrame); |
708 | topLayout->addWidget(dummy->checkBox(),ii++,0); | 708 | topLayout->addWidget(dummy->checkBox(),ii++,0); |
709 | 709 | ||
710 | 710 | ||
711 | 711 | ||
712 | 712 | ||
713 | 713 | ||
714 | 714 | ||
715 | 715 | ||
716 | topFrame = addPage(i18n("Month View"),0,0); | 716 | topFrame = addPage(i18n("Month View"),0,0); |
717 | // DesktopIcon("viewmag",KIcon::SizeMedium)); | 717 | // DesktopIcon("viewmag",KIcon::SizeMedium)); |
718 | 718 | ||
719 | topLayout = new QGridLayout(topFrame,5,1); | 719 | topLayout = new QGridLayout(topFrame,5,1); |
720 | topLayout->setSpacing(mSpacingHint); | 720 | topLayout->setSpacing(mSpacingHint); |
721 | topLayout->setMargin(mMarginHint); | 721 | topLayout->setMargin(mMarginHint); |
722 | ii = 0; | 722 | ii = 0; |
723 | QLabel *lab; | 723 | QLabel *lab; |
724 | QHBox *habo = new QHBox( topFrame ); | 724 | QHBox *habo = new QHBox( topFrame ); |
725 | if ( QApplication::desktop()->width() <= 480 ) { | 725 | if ( QApplication::desktop()->width() <= 480 ) { |
726 | lab = new QLabel ( i18n("Show events that recur "), topFrame ); | 726 | lab = new QLabel ( i18n("Show events that recur "), topFrame ); |
727 | topLayout->addMultiCellWidget(lab,ii, ii,0,1); | 727 | topLayout->addMultiCellWidget(lab,ii, ii,0,1); |
728 | ii++; | 728 | ii++; |
729 | } else { | 729 | } else { |
730 | new QLabel ( i18n("Show events that recur "), habo ); | 730 | new QLabel ( i18n("Show events that recur "), habo ); |
731 | } | 731 | } |
732 | dailyRecur = | 732 | dailyRecur = |
733 | addWidBool(i18n("daily"), | 733 | addWidBool(i18n("daily"), |
734 | &(KOPrefs::instance()->mMonthDailyRecur),habo); | 734 | &(KOPrefs::instance()->mMonthDailyRecur),habo); |
735 | // topLayout->addWidget(dailyRecur->checkBox(),ii++,0); | 735 | // topLayout->addWidget(dailyRecur->checkBox(),ii++,0); |
736 | 736 | ||
737 | weeklyRecur = | 737 | weeklyRecur = |
738 | addWidBool(i18n("weekly"), | 738 | addWidBool(i18n("weekly"), |
739 | &(KOPrefs::instance()->mMonthWeeklyRecur),habo); | 739 | &(KOPrefs::instance()->mMonthWeeklyRecur),habo); |
740 | topLayout->addMultiCellWidget(habo,ii, ii,0,1); | 740 | topLayout->addMultiCellWidget(habo,ii, ii,0,1); |
741 | ii++; | 741 | ii++; |
742 | 742 | ||
743 | 743 | ||
744 | habo = new QHBox( topFrame ); | 744 | habo = new QHBox( topFrame ); |
745 | if ( QApplication::desktop()->width() <= 480 ) { | 745 | if ( QApplication::desktop()->width() <= 480 ) { |
746 | lab = new QLabel (i18n("Show in every cell ") , topFrame ); | 746 | lab = new QLabel (i18n("Show in every cell ") , topFrame ); |
747 | topLayout->addMultiCellWidget(lab,ii, ii,0,1); | 747 | topLayout->addMultiCellWidget(lab,ii, ii,0,1); |
748 | ii++; | 748 | ii++; |
749 | 749 | ||
750 | } else { | 750 | } else { |
751 | new QLabel ( i18n("Show in every cell "), habo ); | 751 | new QLabel ( i18n("Show in every cell "), habo ); |
752 | } | 752 | } |
753 | weeklyRecur = | 753 | weeklyRecur = |
754 | addWidBool(i18n("short month"), | 754 | addWidBool(i18n("short month"), |
755 | &(KOPrefs::instance()->mMonthShowShort),habo); | 755 | &(KOPrefs::instance()->mMonthShowShort),habo); |
756 | weeklyRecur = | 756 | weeklyRecur = |
757 | addWidBool(i18n("icons"), | 757 | addWidBool(i18n("icons"), |
758 | &(KOPrefs::instance()->mMonthShowIcons),habo); | 758 | &(KOPrefs::instance()->mMonthShowIcons),habo); |
759 | 759 | ||
760 | topLayout->addMultiCellWidget(habo,ii, ii,0,1); | 760 | topLayout->addMultiCellWidget(habo,ii, ii,0,1); |
761 | ii++; | 761 | ii++; |
762 | #ifdef DESKTOP_VERSION | 762 | #ifdef DESKTOP_VERSION |
763 | KPrefsDialogWidBool *enableMonthScroll = | 763 | KPrefsDialogWidBool *enableMonthScroll = |
764 | addWidBool(i18n("Enable scrollbars in month view cells"), | 764 | addWidBool(i18n("Enable scrollbars in month view cells"), |
765 | &(KOPrefs::instance()->mEnableMonthScroll),topFrame); | 765 | &(KOPrefs::instance()->mEnableMonthScroll),topFrame); |
766 | topLayout->addWidget(enableMonthScroll->checkBox(),ii++,0); | 766 | topLayout->addWidget(enableMonthScroll->checkBox(),ii++,0); |
767 | #endif | 767 | #endif |
768 | dummy = | 768 | dummy = |
769 | addWidBool(i18n("Week view mode uses bigger font"), | 769 | addWidBool(i18n("Week view mode uses bigger font"), |
770 | &(KOPrefs::instance()->mMonthViewUsesBigFont),topFrame); | 770 | &(KOPrefs::instance()->mMonthViewUsesBigFont),topFrame); |
771 | topLayout->addWidget(dummy->checkBox(),ii++,0); | 771 | topLayout->addWidget(dummy->checkBox(),ii++,0); |
772 | dummy = | 772 | dummy = |
773 | addWidBool(i18n("Show Sat/Sun together"), | 773 | addWidBool(i18n("Show Sat/Sun together"), |
774 | &(KOPrefs::instance()->mMonthViewSatSunTog),topFrame); | 774 | &(KOPrefs::instance()->mMonthViewSatSunTog),topFrame); |
775 | topLayout->addWidget(dummy->checkBox(),ii++,0); | 775 | topLayout->addWidget(dummy->checkBox(),ii++,0); |
776 | 776 | ||
777 | KPrefsDialogWidBool *coloredCategoriesInMonthView = | 777 | KPrefsDialogWidBool *coloredCategoriesInMonthView = |
778 | addWidBool(i18n("Month view uses category colors"), | 778 | addWidBool(i18n("Month view uses category colors"), |
779 | &(KOPrefs::instance()->mMonthViewUsesCategoryColor),topFrame); | 779 | &(KOPrefs::instance()->mMonthViewUsesCategoryColor),topFrame); |
780 | topLayout->addWidget(coloredCategoriesInMonthView->checkBox(),ii++,0); | 780 | topLayout->addWidget(coloredCategoriesInMonthView->checkBox(),ii++,0); |
781 | 781 | ||
782 | dummy = | 782 | dummy = |
783 | addWidBool(i18n("Categorie colors are applied to text"), | 783 | addWidBool(i18n("Categorie colors are applied to text"), |
784 | &(KOPrefs::instance()->mMonthViewUsesForegroundColor),topFrame); | 784 | &(KOPrefs::instance()->mMonthViewUsesForegroundColor),topFrame); |
785 | topLayout->addWidget(dummy->checkBox(),ii++,0); | 785 | topLayout->addWidget(dummy->checkBox(),ii++,0); |
786 | coloredCategoriesInMonthView = | 786 | coloredCategoriesInMonthView = |
787 | addWidBool(i18n("Month view uses day colors"), | 787 | addWidBool(i18n("Month view uses day colors"), |
788 | &(KOPrefs::instance()->mMonthViewUsesDayColors),topFrame); | 788 | &(KOPrefs::instance()->mMonthViewUsesDayColors),topFrame); |
789 | topLayout->addWidget(coloredCategoriesInMonthView->checkBox(),ii++,0); | 789 | topLayout->addWidget(coloredCategoriesInMonthView->checkBox(),ii++,0); |
790 | 790 | ||
791 | KPrefsDialogWidColor *holidayColor = | 791 | KPrefsDialogWidColor *holidayColor = |
792 | addWidColor(i18n("Day color odd months"), | 792 | addWidColor(i18n("Day color odd months"), |
793 | &(KOPrefs::instance()->mMonthViewOddColor),topFrame); | 793 | &(KOPrefs::instance()->mMonthViewOddColor),topFrame); |
794 | topLayout->addWidget(holidayColor->label(),ii,0); | 794 | topLayout->addWidget(holidayColor->label(),ii,0); |
795 | topLayout->addWidget(holidayColor->button(),ii++,1); | 795 | topLayout->addWidget(holidayColor->button(),ii++,1); |
796 | 796 | ||
797 | holidayColor = | 797 | holidayColor = |
798 | addWidColor(i18n("Day color even months"), | 798 | addWidColor(i18n("Day color even months"), |
799 | &(KOPrefs::instance()->mMonthViewEvenColor),topFrame); | 799 | &(KOPrefs::instance()->mMonthViewEvenColor),topFrame); |
800 | topLayout->addWidget(holidayColor->label(),ii,0); | 800 | topLayout->addWidget(holidayColor->label(),ii,0); |
801 | topLayout->addWidget(holidayColor->button(),ii++,1); | 801 | topLayout->addWidget(holidayColor->button(),ii++,1); |
802 | 802 | ||
803 | 803 | ||
804 | holidayColor = | 804 | holidayColor = |
805 | addWidColor(i18n("Color for Sundays + category \"Holiday\""), | 805 | addWidColor(i18n("Color for Sundays + category \"Holiday\""), |
806 | &(KOPrefs::instance()->mMonthViewHolidayColor),topFrame); | 806 | &(KOPrefs::instance()->mMonthViewHolidayColor),topFrame); |
807 | topLayout->addWidget(holidayColor->label(),ii,0); | 807 | topLayout->addWidget(holidayColor->label(),ii,0); |
808 | topLayout->addWidget(holidayColor->button(),ii++,1); | 808 | topLayout->addWidget(holidayColor->button(),ii++,1); |
809 | // *********************** What'sNext View | 809 | // *********************** What'sNext View |
810 | topFrame = addPage(i18n("What's Next View"),0,0); | 810 | topFrame = addPage(i18n("What's Next View"),0,0); |
811 | // DesktopIcon("viewmag",KIcon::SizeMedium)); | 811 | // DesktopIcon("viewmag",KIcon::SizeMedium)); |
812 | 812 | ||
813 | topLayout = new QGridLayout(topFrame,4,1); | 813 | topLayout = new QGridLayout(topFrame,4,1); |
814 | topLayout->setSpacing(mSpacingHint); | 814 | topLayout->setSpacing(mSpacingHint); |
815 | topLayout->setMargin(mMarginHint); | 815 | topLayout->setMargin(mMarginHint); |
816 | ii = 0; | 816 | ii = 0; |
817 | 817 | ||
818 | 818 | ||
819 | QHBox* hdummy = new QHBox(topFrame); | 819 | QHBox* hdummy = new QHBox(topFrame); |
820 | new QLabel(i18n("Days in What's Next:"),hdummy); | 820 | new QLabel(i18n("Days in What's Next:"),hdummy); |
821 | mWhatsNextSpin = new QSpinBox(1,14,1,hdummy); | 821 | mWhatsNextSpin = new QSpinBox(1,14,1,hdummy); |
822 | 822 | ||
823 | topLayout->addWidget(hdummy,ii++,0); | 823 | topLayout->addWidget(hdummy,ii++,0); |
824 | 824 | ||
825 | QHBox *prioBox = new QHBox(topFrame); | 825 | QHBox *prioBox = new QHBox(topFrame); |
826 | // intervalBox->setSpacing(mSpacingHint); | 826 | // intervalBox->setSpacing(mSpacingHint); |
827 | topLayout->addWidget(prioBox,ii++,0); | 827 | topLayout->addWidget(prioBox,ii++,0); |
828 | 828 | ||
829 | QLabel *prioLabel = new QLabel(i18n("Number of max.displayed todo prios:"), prioBox); | 829 | QLabel *prioLabel = new QLabel(i18n("Number of max.displayed todo prios:"), prioBox); |
830 | mPrioSpin = new QSpinBox(0,5,1,prioBox); | 830 | mPrioSpin = new QSpinBox(0,5,1,prioBox); |
831 | if ( QApplication::desktop()->width() < 300 ) | 831 | if ( QApplication::desktop()->width() < 300 ) |
832 | mPrioSpin->setFixedWidth( 40 ); | 832 | mPrioSpin->setFixedWidth( 40 ); |
833 | 833 | ||
834 | KPrefsDialogWidBool *passwdk = | 834 | KPrefsDialogWidBool *passwdk = |
835 | 835 | ||
836 | addWidBool(i18n("Show events, that are done"), | 836 | addWidBool(i18n("Show events, that are done"), |
837 | &(KOPrefs::instance()->mWNViewShowsPast),topFrame); | 837 | &(KOPrefs::instance()->mWNViewShowsPast),topFrame); |
838 | topLayout->addWidget(passwdk->checkBox(), ii++,0); | 838 | topLayout->addWidget(passwdk->checkBox(), ii++,0); |
839 | passwdk = | 839 | passwdk = |
840 | addWidBool(i18n("Show parent To-Do's"), | 840 | addWidBool(i18n("Show parent To-Do's"), |
841 | &(KOPrefs::instance()->mWNViewShowsParents),topFrame); | 841 | &(KOPrefs::instance()->mWNViewShowsParents),topFrame); |
842 | topLayout->addWidget(passwdk->checkBox(), ii++,0); | 842 | topLayout->addWidget(passwdk->checkBox(), ii++,0); |
843 | 843 | ||
844 | passwdk = | 844 | passwdk = |
845 | addWidBool(i18n("Show location"), | 845 | addWidBool(i18n("Show location"), |
846 | &(KOPrefs::instance()->mWNViewShowLocation),topFrame); | 846 | &(KOPrefs::instance()->mWNViewShowLocation),topFrame); |
847 | topLayout->addWidget(passwdk->checkBox(), ii++,0); | 847 | topLayout->addWidget(passwdk->checkBox(), ii++,0); |
848 | 848 | ||
849 | passwdk = | 849 | passwdk = |
850 | addWidBool(i18n("Show Sync Events in WN+Agenda"), | 850 | addWidBool(i18n("Show Sync Events in WN+Agenda"), |
851 | &(KOPrefs::instance()->mShowSyncEvents),topFrame); | 851 | &(KOPrefs::instance()->mShowSyncEvents),topFrame); |
852 | topLayout->addWidget(passwdk->checkBox(), ii++,0); | 852 | topLayout->addWidget(passwdk->checkBox(), ii++,0); |
853 | passwdk = | 853 | passwdk = |
854 | addWidBool(i18n("Use short date in WN+Event view"), | 854 | addWidBool(i18n("Use short date in WN+Event view"), |
855 | &(KOPrefs::instance()->mShortDateInViewer),topFrame); | 855 | &(KOPrefs::instance()->mShortDateInViewer),topFrame); |
856 | topLayout->addWidget(passwdk->checkBox(), ii++,0); | 856 | topLayout->addWidget(passwdk->checkBox(), ii++,0); |
857 | 857 | ||
858 | 858 | ||
859 | 859 | ||
860 | 860 | ||
861 | // *********************** Todo View | 861 | // *********************** Todo View |
862 | 862 | ||
863 | topFrame = addPage(i18n("Todo View"),0,0); | 863 | topFrame = addPage(i18n("Todo View"),0,0); |
864 | // DesktopIcon("viewmag",KIcon::SizeMedium)); | 864 | // DesktopIcon("viewmag",KIcon::SizeMedium)); |
865 | 865 | ||
866 | topLayout = new QGridLayout(topFrame,4,1); | 866 | topLayout = new QGridLayout(topFrame,4,1); |
867 | topLayout->setSpacing(mSpacingHint); | 867 | topLayout->setSpacing(mSpacingHint); |
868 | topLayout->setMargin(mMarginHint); | 868 | topLayout->setMargin(mMarginHint); |
869 | ii = 0; | 869 | ii = 0; |
870 | dummy = | 870 | dummy = |
871 | addWidBool(i18n("Hide not running Todos in To-do view"), | 871 | addWidBool(i18n("Hide not running Todos in To-do view"), |
872 | &(KOPrefs::instance()->mHideNonStartedTodos),topFrame); | 872 | &(KOPrefs::instance()->mHideNonStartedTodos),topFrame); |
873 | topLayout->addWidget(dummy->checkBox(),ii++,0); | 873 | topLayout->addWidget(dummy->checkBox(),ii++,0); |
874 | 874 | ||
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); |
928 | 938 | ||
929 | 939 | ||
930 | topFrame = addPage(i18n("View Options"),0,0); | 940 | topFrame = addPage(i18n("View Options"),0,0); |
931 | 941 | ||
932 | topLayout = new QGridLayout(topFrame,4,1); | 942 | topLayout = new QGridLayout(topFrame,4,1); |
933 | topLayout->setSpacing(mSpacingHint); | 943 | topLayout->setSpacing(mSpacingHint); |
934 | topLayout->setMargin(mMarginHint); | 944 | topLayout->setMargin(mMarginHint); |
935 | ii = 0; | 945 | ii = 0; |
936 | lab = new QLabel( i18n("Show in todo/event viewer:"), topFrame); | 946 | lab = new QLabel( i18n("Show in todo/event viewer:"), topFrame); |
937 | topLayout->addWidget(lab ,ii++,0); | 947 | topLayout->addWidget(lab ,ii++,0); |
938 | 948 | ||
939 | dummy = addWidBool(i18n("Details"), | 949 | dummy = addWidBool(i18n("Details"), |
940 | &(KOPrefs::instance()->mEVshowDetails),topFrame); | 950 | &(KOPrefs::instance()->mEVshowDetails),topFrame); |
941 | topLayout->addWidget(dummy->checkBox(),ii++,0); | 951 | topLayout->addWidget(dummy->checkBox(),ii++,0); |
942 | dummy = addWidBool(i18n("Created time"), | 952 | dummy = addWidBool(i18n("Created time"), |
943 | &(KOPrefs::instance()->mEVshowCreated),topFrame); | 953 | &(KOPrefs::instance()->mEVshowCreated),topFrame); |
944 | topLayout->addWidget(dummy->checkBox(),ii++,0); | 954 | topLayout->addWidget(dummy->checkBox(),ii++,0); |
945 | dummy = addWidBool(i18n("Last modified time"), | 955 | dummy = addWidBool(i18n("Last modified time"), |
946 | &(KOPrefs::instance()->mEVshowChanged),topFrame); | 956 | &(KOPrefs::instance()->mEVshowChanged),topFrame); |
947 | topLayout->addWidget(dummy->checkBox(),ii++,0); | 957 | topLayout->addWidget(dummy->checkBox(),ii++,0); |
948 | 958 | ||
949 | 959 | ||
950 | lab = new QLabel( i18n("Show in What'sThis quick overview:"), topFrame); | 960 | lab = new QLabel( i18n("Show in What'sThis quick overview:"), topFrame); |
951 | topLayout->addWidget(lab ,ii++,0); | 961 | topLayout->addWidget(lab ,ii++,0); |
952 | 962 | ||
953 | dummy = addWidBool(i18n("Details"), | 963 | dummy = addWidBool(i18n("Details"), |
954 | &(KOPrefs::instance()->mWTshowDetails),topFrame); | 964 | &(KOPrefs::instance()->mWTshowDetails),topFrame); |
955 | topLayout->addWidget(dummy->checkBox(),ii++,0); | 965 | topLayout->addWidget(dummy->checkBox(),ii++,0); |
956 | dummy = addWidBool(i18n("Created time"), | 966 | dummy = addWidBool(i18n("Created time"), |
957 | &(KOPrefs::instance()->mWTshowCreated),topFrame); | 967 | &(KOPrefs::instance()->mWTshowCreated),topFrame); |
958 | topLayout->addWidget(dummy->checkBox(),ii++,0); | 968 | topLayout->addWidget(dummy->checkBox(),ii++,0); |
959 | dummy = addWidBool(i18n("Last modified time"), | 969 | dummy = addWidBool(i18n("Last modified time"), |
960 | &(KOPrefs::instance()->mWTshowChanged),topFrame); | 970 | &(KOPrefs::instance()->mWTshowChanged),topFrame); |
961 | topLayout->addWidget(dummy->checkBox(),ii++,0); | 971 | topLayout->addWidget(dummy->checkBox(),ii++,0); |
962 | 972 | ||
963 | 973 | ||
964 | topFrame = addPage(i18n("Alarm"),0,0); | 974 | topFrame = addPage(i18n("Alarm"),0,0); |
965 | // DesktopIcon("viewmag",KIcon::SizeMedium)); | 975 | // DesktopIcon("viewmag",KIcon::SizeMedium)); |
966 | 976 | ||
967 | topLayout = new QGridLayout(topFrame,2,1); | 977 | topLayout = new QGridLayout(topFrame,2,1); |
968 | topLayout->setSpacing(mSpacingHint); | 978 | topLayout->setSpacing(mSpacingHint); |
969 | topLayout->setMargin(mMarginHint); | 979 | topLayout->setMargin(mMarginHint); |
970 | int iii = 0; | 980 | int iii = 0; |
971 | 981 | ||
972 | dummy = | 982 | dummy = |
973 | addWidBool(i18n("Use internal alarm notification"), | 983 | addWidBool(i18n("Use internal alarm notification"), |
974 | &(KOPrefs::instance()->mUseInternalAlarmNotification),topFrame); | 984 | &(KOPrefs::instance()->mUseInternalAlarmNotification),topFrame); |
975 | topLayout->addWidget(dummy->checkBox(),iii++,0); | 985 | topLayout->addWidget(dummy->checkBox(),iii++,0); |
976 | lab = new QLabel( i18n("Note: KO/Pi must be running to notify you about an alarm. Recommended for use on Zaurus: Disable this option and install KO/Pi alarm applet.\n"), topFrame); | 986 | lab = new QLabel( i18n("Note: KO/Pi must be running to notify you about an alarm. Recommended for use on Zaurus: Disable this option and install KO/Pi alarm applet.\n"), topFrame); |
977 | 987 | ||
978 | topLayout->addWidget(lab ,iii++,0); | 988 | topLayout->addWidget(lab ,iii++,0); |
979 | #ifndef DESKTOP_VERSION | 989 | #ifndef DESKTOP_VERSION |
980 | lab->setAlignment( AlignLeft|WordBreak|AlignTop); | 990 | lab->setAlignment( AlignLeft|WordBreak|AlignTop); |
981 | #else | 991 | #else |
982 | lab->setAlignment( AlignLeft|BreakAnywhere|WordBreak|AlignTop); | 992 | lab->setAlignment( AlignLeft|BreakAnywhere|WordBreak|AlignTop); |
983 | lab->setSizePolicy( QSizePolicy( QSizePolicy::Ignored , QSizePolicy::Ignored,true) ); | 993 | lab->setSizePolicy( QSizePolicy( QSizePolicy::Ignored , QSizePolicy::Ignored,true) ); |
984 | #endif | 994 | #endif |
985 | 995 | ||
986 | QHBox* dummyBox = new QHBox(topFrame); | 996 | QHBox* dummyBox = new QHBox(topFrame); |
987 | new QLabel(i18n("Play beeps count:"),dummyBox); | 997 | new QLabel(i18n("Play beeps count:"),dummyBox); |
988 | mAlarmPlayBeeps = new QSpinBox(0,500,1,dummyBox); | 998 | mAlarmPlayBeeps = new QSpinBox(0,500,1,dummyBox); |
989 | topLayout->addWidget(dummyBox,iii++,0); | 999 | topLayout->addWidget(dummyBox,iii++,0); |
990 | 1000 | ||
991 | dummyBox = new QHBox(topFrame); | 1001 | dummyBox = new QHBox(topFrame); |
992 | new QLabel(i18n("Beeps interval in sec:"),dummyBox); | 1002 | new QLabel(i18n("Beeps interval in sec:"),dummyBox); |
993 | mAlarmBeepInterval = new QSpinBox(1,600,1,dummyBox); | 1003 | mAlarmBeepInterval = new QSpinBox(1,600,1,dummyBox); |
994 | topLayout->addWidget(dummyBox,iii++,0); | 1004 | topLayout->addWidget(dummyBox,iii++,0); |
995 | 1005 | ||
996 | dummyBox = new QHBox(topFrame); | 1006 | dummyBox = new QHBox(topFrame); |
997 | new QLabel(i18n("Default suspend time in min:"),dummyBox); | 1007 | new QLabel(i18n("Default suspend time in min:"),dummyBox); |
998 | mAlarmSuspendTime = new QSpinBox(1,600,1,dummyBox); | 1008 | mAlarmSuspendTime = new QSpinBox(1,600,1,dummyBox); |
999 | topLayout->addWidget(dummyBox,iii++,0); | 1009 | topLayout->addWidget(dummyBox,iii++,0); |
1000 | 1010 | ||
1001 | dummyBox = new QHBox(topFrame); | 1011 | dummyBox = new QHBox(topFrame); |
1002 | new QLabel(i18n("Auto suspend count:"),dummyBox); | 1012 | new QLabel(i18n("Auto suspend count:"),dummyBox); |
1003 | mAlarmSuspendCount = new QSpinBox(0,60,1,dummyBox); | 1013 | mAlarmSuspendCount = new QSpinBox(0,60,1,dummyBox); |
1004 | topLayout->addWidget(dummyBox,iii++,0); | 1014 | topLayout->addWidget(dummyBox,iii++,0); |
1005 | 1015 | ||
1006 | 1016 | ||
1007 | 1017 | ||
1008 | 1018 | ||
1009 | 1019 | ||
1010 | 1020 | ||
1011 | 1021 | ||
1012 | QHBox* hbo = new QHBox ( topFrame ); | 1022 | QHBox* hbo = new QHBox ( topFrame ); |
1013 | mDefaultAlarmFile = new QLineEdit(hbo); | 1023 | mDefaultAlarmFile = new QLineEdit(hbo); |
1014 | QPushButton * loadTemplate = new QPushButton(hbo); | 1024 | QPushButton * loadTemplate = new QPushButton(hbo); |
1015 | QPixmap icon; | 1025 | QPixmap icon; |
1016 | if ( QApplication::desktop()->width() < 321 ) | 1026 | if ( QApplication::desktop()->width() < 321 ) |
1017 | icon = SmallIcon("fileimport16"); | 1027 | icon = SmallIcon("fileimport16"); |
1018 | else | 1028 | else |
1019 | icon = SmallIcon("fileimport"); | 1029 | icon = SmallIcon("fileimport"); |
1020 | loadTemplate->setIconSet (icon ) ; | 1030 | loadTemplate->setIconSet (icon ) ; |
1021 | connect( loadTemplate, SIGNAL( clicked() ), this , SLOT( selectSoundFile() ) ); | 1031 | connect( loadTemplate, SIGNAL( clicked() ), this , SLOT( selectSoundFile() ) ); |
1022 | int size = loadTemplate->sizeHint().height(); | 1032 | int size = loadTemplate->sizeHint().height(); |
1023 | loadTemplate->setFixedSize( size, size ); | 1033 | loadTemplate->setFixedSize( size, size ); |
1024 | //lab = new QLabel( i18n("This setting is useless for 5500 user!"), topFrame); | 1034 | //lab = new QLabel( i18n("This setting is useless for 5500 user!"), topFrame); |
1025 | // topLayout->addWidget(lab ,iii++,0); | 1035 | // topLayout->addWidget(lab ,iii++,0); |
1026 | lab = new QLabel( i18n("Alarm *.wav file for newly created alarm:"), topFrame); | 1036 | lab = new QLabel( i18n("Alarm *.wav file for newly created alarm:"), topFrame); |
1027 | topLayout->addWidget(lab ,iii++,0); | 1037 | topLayout->addWidget(lab ,iii++,0); |
1028 | topLayout->addWidget(hbo,iii++,0); | 1038 | topLayout->addWidget(hbo,iii++,0); |
1029 | // lab = new QLabel( i18n("Note: This does not mean, that for every alarm this file is replayed. This file here is associated with a newly created alarm."), topFrame); | 1039 | // lab = new QLabel( i18n("Note: This does not mean, that for every alarm this file is replayed. This file here is associated with a newly created alarm."), topFrame); |
1030 | 1040 | ||
1031 | // topLayout->addWidget(lab ,iii++,0); | 1041 | // topLayout->addWidget(lab ,iii++,0); |
1032 | // #ifndef DESKTOP_VERSION | 1042 | // #ifndef DESKTOP_VERSION |
1033 | // lab->setAlignment( AlignLeft|WordBreak|AlignTop); | 1043 | // lab->setAlignment( AlignLeft|WordBreak|AlignTop); |
1034 | // #else | 1044 | // #else |
1035 | // lab->setAlignment( AlignLeft|BreakAnywhere|WordBreak|AlignTop); | 1045 | // lab->setAlignment( AlignLeft|BreakAnywhere|WordBreak|AlignTop); |
1036 | // lab->setSizePolicy( QSizePolicy( QSizePolicy::Ignored , QSizePolicy::Ignored,true) ); | 1046 | // lab->setSizePolicy( QSizePolicy( QSizePolicy::Ignored , QSizePolicy::Ignored,true) ); |
1037 | // #endif | 1047 | // #endif |
1038 | 1048 | ||
1039 | 1049 | ||
1040 | } | 1050 | } |
1041 | 1051 | ||
1042 | void KOPrefsDialog::selectSoundFile() | 1052 | void KOPrefsDialog::selectSoundFile() |
1043 | { | 1053 | { |
1044 | QString fileName = mDefaultAlarmFile->text(); | 1054 | QString fileName = mDefaultAlarmFile->text(); |
1045 | fileName = KFileDialog::getSaveFileName( mDefaultAlarmFile->text() , "Choose default alarm file", this ); | 1055 | fileName = KFileDialog::getSaveFileName( mDefaultAlarmFile->text() , "Choose default alarm file", this ); |
1046 | if ( fileName.length() > 0 ) | 1056 | if ( fileName.length() > 0 ) |
1047 | mDefaultAlarmFile->setText( fileName ); | 1057 | mDefaultAlarmFile->setText( fileName ); |
1048 | } | 1058 | } |
1049 | void KOPrefsDialog::setupFontsTab() | 1059 | void KOPrefsDialog::setupFontsTab() |
1050 | { | 1060 | { |
1051 | 1061 | ||
1052 | QFrame *topFrame = addPage(i18n("Fonts"),0,0); | 1062 | QFrame *topFrame = addPage(i18n("Fonts"),0,0); |
1053 | // DesktopIcon("fonts",KIcon::SizeMedium)); | 1063 | // DesktopIcon("fonts",KIcon::SizeMedium)); |
1054 | 1064 | ||
1055 | QGridLayout *topLayout = new QGridLayout(topFrame,7,3); | 1065 | QGridLayout *topLayout = new QGridLayout(topFrame,7,3); |
1056 | topLayout->setSpacing(1); | 1066 | topLayout->setSpacing(1); |
1057 | topLayout->setMargin(3); | 1067 | topLayout->setMargin(3); |
1058 | KPrefsDialogWidFont * tVFont; | 1068 | KPrefsDialogWidFont * tVFont; |
1059 | int i = 0; | 1069 | int i = 0; |
1060 | KPrefsDialogWidFont *timeLabelsFont = | 1070 | KPrefsDialogWidFont *timeLabelsFont = |
1061 | addWidFont(i18n("23"),i18n("DateNavigator:(nr)"), | 1071 | addWidFont(i18n("23"),i18n("DateNavigator:(nr)"), |
1062 | &(KOPrefs::instance()->mDateNavigatorFont),topFrame); | 1072 | &(KOPrefs::instance()->mDateNavigatorFont),topFrame); |
1063 | topLayout->addWidget(timeLabelsFont->label(),i,0); | 1073 | topLayout->addWidget(timeLabelsFont->label(),i,0); |
1064 | topLayout->addWidget(timeLabelsFont->preview(),i,1); | 1074 | topLayout->addWidget(timeLabelsFont->preview(),i,1); |
1065 | topLayout->addWidget(timeLabelsFont->button(),i,2); | 1075 | topLayout->addWidget(timeLabelsFont->button(),i,2); |
1066 | ++i; | 1076 | ++i; |
1067 | 1077 | ||
1068 | 1078 | ||
1069 | timeLabelsFont = | 1079 | timeLabelsFont = |
1070 | addWidFont(i18n("Mon 15"),i18n("Date Labels:"), | 1080 | addWidFont(i18n("Mon 15"),i18n("Date Labels:"), |
1071 | &(KOPrefs::instance()->mTimeLabelsFont),topFrame); | 1081 | &(KOPrefs::instance()->mTimeLabelsFont),topFrame); |
1072 | topLayout->addWidget(timeLabelsFont->label(),i,0); | 1082 | topLayout->addWidget(timeLabelsFont->label(),i,0); |
1073 | topLayout->addWidget(timeLabelsFont->preview(),i,1); | 1083 | topLayout->addWidget(timeLabelsFont->preview(),i,1); |
1074 | topLayout->addWidget(timeLabelsFont->button(),i,2); | 1084 | topLayout->addWidget(timeLabelsFont->button(),i,2); |
1075 | ++i; | 1085 | ++i; |
1076 | 1086 | ||
1077 | KPrefsDialogWidFont *timeBarFont = | 1087 | KPrefsDialogWidFont *timeBarFont = |
1078 | addWidFont(KGlobal::locale()->formatTime(QTime(12,34)),i18n("Time bar:"), | 1088 | addWidFont(KGlobal::locale()->formatTime(QTime(12,34)),i18n("Time bar:"), |
1079 | &(KOPrefs::instance()->mTimeBarFont),topFrame); | 1089 | &(KOPrefs::instance()->mTimeBarFont),topFrame); |
1080 | topLayout->addWidget(timeBarFont->label(),i,0); | 1090 | topLayout->addWidget(timeBarFont->label(),i,0); |
1081 | topLayout->addWidget(timeBarFont->preview(),i,1); | 1091 | topLayout->addWidget(timeBarFont->preview(),i,1); |
1082 | topLayout->addWidget(timeBarFont->button(),i,2); | 1092 | topLayout->addWidget(timeBarFont->button(),i,2); |
1083 | ++i; | 1093 | ++i; |
1084 | 1094 | ||
1085 | 1095 | ||
1086 | KPrefsDialogWidFont *marcusBainsFont = | 1096 | KPrefsDialogWidFont *marcusBainsFont = |
1087 | addWidFont(KGlobal::locale()->formatTime(QTime(12,34,23)),i18n("M. Bains line:"), | 1097 | addWidFont(KGlobal::locale()->formatTime(QTime(12,34,23)),i18n("M. Bains line:"), |
1088 | &(KOPrefs::instance()->mMarcusBainsFont),topFrame); | 1098 | &(KOPrefs::instance()->mMarcusBainsFont),topFrame); |
1089 | topLayout->addWidget(marcusBainsFont->label(),i,0); | 1099 | topLayout->addWidget(marcusBainsFont->label(),i,0); |
1090 | topLayout->addWidget(marcusBainsFont->preview(),i,1); | 1100 | topLayout->addWidget(marcusBainsFont->preview(),i,1); |
1091 | topLayout->addWidget(marcusBainsFont->button(),i,2); | 1101 | topLayout->addWidget(marcusBainsFont->button(),i,2); |
1092 | ++i; | 1102 | ++i; |
1093 | 1103 | ||
1094 | tVFont = | 1104 | tVFont = |
1095 | addWidFont(i18n("Summary"),i18n("Event Viewer:"), | 1105 | addWidFont(i18n("Summary"),i18n("Event Viewer:"), |
diff --git a/korganizer/kotodoview.cpp b/korganizer/kotodoview.cpp index 935a5f5..7ee1eef 100644 --- a/korganizer/kotodoview.cpp +++ b/korganizer/kotodoview.cpp | |||
@@ -292,384 +292,386 @@ void KOTodoListView::keyReleaseEvent ( QKeyEvent *e ) | |||
292 | 292 | ||
293 | 293 | ||
294 | void KOTodoListView::keyPressEvent ( QKeyEvent * e ) | 294 | void KOTodoListView::keyPressEvent ( QKeyEvent * e ) |
295 | { | 295 | { |
296 | qApp->processEvents(); | 296 | qApp->processEvents(); |
297 | if ( e->isAutoRepeat() && !mFlagKeyPressed ) { | 297 | if ( e->isAutoRepeat() && !mFlagKeyPressed ) { |
298 | e->ignore(); | 298 | e->ignore(); |
299 | // qDebug(" ignore %d",e->isAutoRepeat() ); | 299 | // qDebug(" ignore %d",e->isAutoRepeat() ); |
300 | return; | 300 | return; |
301 | } | 301 | } |
302 | if (! e->isAutoRepeat() ) | 302 | if (! e->isAutoRepeat() ) |
303 | mFlagKeyPressed = true; | 303 | mFlagKeyPressed = true; |
304 | QListViewItem* cn; | 304 | QListViewItem* cn; |
305 | if ( e->key() == Qt::Key_Return || e->key() == Qt::Key_Enter ) { | 305 | if ( e->key() == Qt::Key_Return || e->key() == Qt::Key_Enter ) { |
306 | cn = currentItem(); | 306 | cn = currentItem(); |
307 | if ( cn ) { | 307 | if ( cn ) { |
308 | KOTodoViewItem* ci = (KOTodoViewItem*)( cn ); | 308 | KOTodoViewItem* ci = (KOTodoViewItem*)( cn ); |
309 | if ( ci ){ | 309 | if ( ci ){ |
310 | if ( e->state() == ShiftButton ) | 310 | if ( e->state() == ShiftButton ) |
311 | ci->setOn( false ); | 311 | ci->setOn( false ); |
312 | else | 312 | else |
313 | ci->setOn( true ); | 313 | ci->setOn( true ); |
314 | cn = cn->itemBelow(); | 314 | cn = cn->itemBelow(); |
315 | if ( cn ) { | 315 | if ( cn ) { |
316 | setCurrentItem ( cn ); | 316 | setCurrentItem ( cn ); |
317 | ensureItemVisible ( cn ); | 317 | ensureItemVisible ( cn ); |
318 | } | 318 | } |
319 | 319 | ||
320 | } | 320 | } |
321 | } | 321 | } |
322 | 322 | ||
323 | return; | 323 | return; |
324 | } | 324 | } |
325 | 325 | ||
326 | if ( e->state() == Qt::ControlButton || e->state() == Qt::ShiftButton || mName != "todolistsmall" ) { | 326 | if ( e->state() == Qt::ControlButton || e->state() == Qt::ShiftButton || mName != "todolistsmall" ) { |
327 | switch ( e->key() ) { | 327 | switch ( e->key() ) { |
328 | case Qt::Key_Down: | 328 | case Qt::Key_Down: |
329 | case Qt::Key_Up: | 329 | case Qt::Key_Up: |
330 | QListView::keyPressEvent ( e ); | 330 | QListView::keyPressEvent ( e ); |
331 | break; | 331 | break; |
332 | case Qt::Key_Left: | 332 | case Qt::Key_Left: |
333 | case Qt::Key_Right: | 333 | case Qt::Key_Right: |
334 | QListView::keyPressEvent ( e ); | 334 | QListView::keyPressEvent ( e ); |
335 | e->accept(); | 335 | e->accept(); |
336 | return; | 336 | return; |
337 | break; | 337 | break; |
338 | default: | 338 | default: |
339 | e->ignore(); | 339 | e->ignore(); |
340 | break; | 340 | break; |
341 | } | 341 | } |
342 | return; | 342 | return; |
343 | } | 343 | } |
344 | e->ignore(); | 344 | e->ignore(); |
345 | } | 345 | } |
346 | void KOTodoListView::contentsMouseReleaseEvent(QMouseEvent *e) | 346 | void KOTodoListView::contentsMouseReleaseEvent(QMouseEvent *e) |
347 | { | 347 | { |
348 | QListView::contentsMouseReleaseEvent(e); | 348 | QListView::contentsMouseReleaseEvent(e); |
349 | mMousePressed = false; | 349 | mMousePressed = false; |
350 | } | 350 | } |
351 | 351 | ||
352 | void KOTodoListView::contentsMouseDoubleClickEvent(QMouseEvent *e) | 352 | void KOTodoListView::contentsMouseDoubleClickEvent(QMouseEvent *e) |
353 | { | 353 | { |
354 | if (!e) return; | 354 | if (!e) return; |
355 | 355 | ||
356 | QPoint vp = contentsToViewport(e->pos()); | 356 | QPoint vp = contentsToViewport(e->pos()); |
357 | 357 | ||
358 | QListViewItem *item = itemAt(vp); | 358 | QListViewItem *item = itemAt(vp); |
359 | 359 | ||
360 | emit double_Clicked(item); | 360 | emit double_Clicked(item); |
361 | if (!item) return; | 361 | if (!item) return; |
362 | 362 | ||
363 | emit doubleClicked(item,vp,0); | 363 | emit doubleClicked(item,vp,0); |
364 | } | 364 | } |
365 | 365 | ||
366 | ///////////////////////////////////////////////////////////////////////////// | 366 | ///////////////////////////////////////////////////////////////////////////// |
367 | 367 | ||
368 | KOQuickTodo::KOQuickTodo(QWidget *parent) : | 368 | KOQuickTodo::KOQuickTodo(QWidget *parent) : |
369 | QLineEdit(parent) | 369 | QLineEdit(parent) |
370 | { | 370 | { |
371 | setText(i18n("Click to add a new Todo")); | 371 | setText(i18n("Click to add a new Todo")); |
372 | } | 372 | } |
373 | 373 | ||
374 | void KOQuickTodo::focusInEvent(QFocusEvent *ev) | 374 | void KOQuickTodo::focusInEvent(QFocusEvent *ev) |
375 | { | 375 | { |
376 | if ( text()==i18n("Click to add a new Todo") ) | 376 | if ( text()==i18n("Click to add a new Todo") ) |
377 | setText(""); | 377 | setText(""); |
378 | QLineEdit::focusInEvent(ev); | 378 | QLineEdit::focusInEvent(ev); |
379 | } | 379 | } |
380 | 380 | ||
381 | void KOQuickTodo::focusOutEvent(QFocusEvent *ev) | 381 | void KOQuickTodo::focusOutEvent(QFocusEvent *ev) |
382 | { | 382 | { |
383 | setText(i18n("Click to add a new Todo")); | 383 | setText(i18n("Click to add a new Todo")); |
384 | QLineEdit::focusOutEvent(ev); | 384 | QLineEdit::focusOutEvent(ev); |
385 | } | 385 | } |
386 | 386 | ||
387 | ///////////////////////////////////////////////////////////////////////////// | 387 | ///////////////////////////////////////////////////////////////////////////// |
388 | 388 | ||
389 | KOTodoView::KOTodoView(Calendar *calendar,QWidget* parent,const char* name) : | 389 | KOTodoView::KOTodoView(Calendar *calendar,QWidget* parent,const char* name) : |
390 | KOrg::BaseView(calendar,parent,name) | 390 | KOrg::BaseView(calendar,parent,name) |
391 | { | 391 | { |
392 | mPendingUpdateBeforeRepaint = false; | 392 | mPendingUpdateBeforeRepaint = false; |
393 | isFlatDisplay = false; | 393 | isFlatDisplay = false; |
394 | mNavigator = 0; | 394 | mNavigator = 0; |
395 | QBoxLayout *topLayout = new QVBoxLayout(this); | 395 | QBoxLayout *topLayout = new QVBoxLayout(this); |
396 | mName = QString ( name ); | 396 | mName = QString ( name ); |
397 | mBlockUpdate = false; | 397 | mBlockUpdate = false; |
398 | mQuickAdd = new KOQuickTodo(this); | 398 | mQuickAdd = new KOQuickTodo(this); |
399 | topLayout->addWidget(mQuickAdd); | 399 | topLayout->addWidget(mQuickAdd); |
400 | 400 | ||
401 | if ( !KOPrefs::instance()->mEnableQuickTodo ) mQuickAdd->hide(); | 401 | if ( !KOPrefs::instance()->mEnableQuickTodo ) mQuickAdd->hide(); |
402 | 402 | ||
403 | mTodoListView = new KOTodoListView(calendar,this, name ); | 403 | mTodoListView = new KOTodoListView(calendar,this, name ); |
404 | topLayout->addWidget(mTodoListView); | 404 | topLayout->addWidget(mTodoListView); |
405 | //mTodoListView->header()->setMaximumHeight(30); | 405 | //mTodoListView->header()->setMaximumHeight(30); |
406 | mTodoListView->setRootIsDecorated(true); | 406 | mTodoListView->setRootIsDecorated(true); |
407 | mTodoListView->setAllColumnsShowFocus(true); | 407 | mTodoListView->setAllColumnsShowFocus(true); |
408 | 408 | ||
409 | mTodoListView->setShowSortIndicator(true); | 409 | mTodoListView->setShowSortIndicator(true); |
410 | 410 | ||
411 | mTodoListView->addColumn(i18n("Todo")); | 411 | mTodoListView->addColumn(i18n("Todo")); |
412 | mTodoListView->addColumn(i18n("Prio")); | 412 | mTodoListView->addColumn(i18n("Prio")); |
413 | mTodoListView->setColumnAlignment(1,AlignHCenter); | 413 | mTodoListView->setColumnAlignment(1,AlignHCenter); |
414 | mTodoListView->addColumn(i18n("Complete")); | 414 | mTodoListView->addColumn(i18n("Complete")); |
415 | mTodoListView->setColumnAlignment(2,AlignCenter); | 415 | mTodoListView->setColumnAlignment(2,AlignCenter); |
416 | 416 | ||
417 | mTodoListView->addColumn(i18n("Due Date")); | 417 | mTodoListView->addColumn(i18n("Due Date")); |
418 | mTodoListView->setColumnAlignment(3,AlignLeft); | 418 | mTodoListView->setColumnAlignment(3,AlignLeft); |
419 | mTodoListView->addColumn(i18n("Due Time")); | 419 | mTodoListView->addColumn(i18n("Due Time")); |
420 | mTodoListView->setColumnAlignment(4,AlignHCenter); | 420 | mTodoListView->setColumnAlignment(4,AlignHCenter); |
421 | 421 | ||
422 | mTodoListView->addColumn(i18n("Start Date")); | 422 | mTodoListView->addColumn(i18n("Start Date")); |
423 | mTodoListView->setColumnAlignment(5,AlignLeft); | 423 | mTodoListView->setColumnAlignment(5,AlignLeft); |
424 | mTodoListView->addColumn(i18n("Start Time")); | 424 | mTodoListView->addColumn(i18n("Start Time")); |
425 | mTodoListView->setColumnAlignment(6,AlignHCenter); | 425 | mTodoListView->setColumnAlignment(6,AlignHCenter); |
426 | 426 | ||
427 | mTodoListView->addColumn(i18n("Cancelled")); | 427 | mTodoListView->addColumn(i18n("Cancelled")); |
428 | mTodoListView->addColumn(i18n("Categories")); | 428 | mTodoListView->addColumn(i18n("Categories")); |
429 | #if 0 | 429 | #if 0 |
430 | mTodoListView->addColumn(i18n("Sort Id")); | 430 | mTodoListView->addColumn(i18n("Sort Id")); |
431 | mTodoListView->setColumnAlignment(4,AlignHCenter); | 431 | mTodoListView->setColumnAlignment(4,AlignHCenter); |
432 | #endif | 432 | #endif |
433 | 433 | ||
434 | mTodoListView->setMinimumHeight( 60 ); | 434 | mTodoListView->setMinimumHeight( 60 ); |
435 | mTodoListView->setItemsRenameable( true ); | 435 | mTodoListView->setItemsRenameable( true ); |
436 | mTodoListView->setRenameable( 0 ); | 436 | mTodoListView->setRenameable( 0 ); |
437 | mTodoListView->setColumnWidth( 0, 120 ); | 437 | mTodoListView->setColumnWidth( 0, 120 ); |
438 | mTodoListView->setColumnWidthMode(0, QListView::Manual); | 438 | mTodoListView->setColumnWidthMode(0, QListView::Manual); |
439 | mTodoListView->setColumnWidthMode(1, QListView::Manual); | 439 | mTodoListView->setColumnWidthMode(1, QListView::Manual); |
440 | mTodoListView->setColumnWidthMode(2, QListView::Manual); | 440 | mTodoListView->setColumnWidthMode(2, QListView::Manual); |
441 | mTodoListView->setColumnWidthMode(3, QListView::Manual); | 441 | mTodoListView->setColumnWidthMode(3, QListView::Manual); |
442 | mTodoListView->setColumnWidthMode(4, QListView::Manual); | 442 | mTodoListView->setColumnWidthMode(4, QListView::Manual); |
443 | mTodoListView->setColumnWidthMode(5, QListView::Manual); | 443 | mTodoListView->setColumnWidthMode(5, QListView::Manual); |
444 | mTodoListView->setColumnWidthMode(6, QListView::Manual); | 444 | mTodoListView->setColumnWidthMode(6, QListView::Manual); |
445 | mTodoListView->setColumnWidthMode(7, QListView::Manual); | 445 | mTodoListView->setColumnWidthMode(7, QListView::Manual); |
446 | mTodoListView->setColumnWidthMode(8, QListView::Manual); | 446 | mTodoListView->setColumnWidthMode(8, QListView::Manual); |
447 | 447 | ||
448 | 448 | ||
449 | mKOTodoViewWhatsThis = new KOTodoViewWhatsThis(mTodoListView->viewport(),this); | 449 | mKOTodoViewWhatsThis = new KOTodoViewWhatsThis(mTodoListView->viewport(),this); |
450 | 450 | ||
451 | mPriorityPopupMenu = new QPopupMenu(this); | 451 | mPriorityPopupMenu = new QPopupMenu(this); |
452 | for (int i = 1; i <= 5; i++) { | 452 | for (int i = 1; i <= 5; i++) { |
453 | QString label = QString ("%1").arg (i); | 453 | QString label = QString ("%1").arg (i); |
454 | mPriority[mPriorityPopupMenu->insertItem (label)] = i; | 454 | mPriority[mPriorityPopupMenu->insertItem (label)] = i; |
455 | } | 455 | } |
456 | connect (mPriorityPopupMenu, SIGNAL(activated (int)), SLOT (setNewPriority(int))); | 456 | connect (mPriorityPopupMenu, SIGNAL(activated (int)), SLOT (setNewPriority(int))); |
457 | 457 | ||
458 | mPercentageCompletedPopupMenu = new QPopupMenu(this); | 458 | mPercentageCompletedPopupMenu = new QPopupMenu(this); |
459 | for (int i = 0; i <= 100; i+=20) { | 459 | for (int i = 0; i <= 100; i+=20) { |
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"), |
508 | this, SLOT(purgeCompleted()),0,2); | 510 | this, SLOT(purgeCompleted()),0,2); |
509 | mPopupMenu->insertItem(i18n("Show Completed"), | 511 | mPopupMenu->insertItem(i18n("Show Completed"), |
510 | this, SLOT( toggleCompleted() ),0,3 ); | 512 | this, SLOT( toggleCompleted() ),0,3 ); |
511 | mPopupMenu->insertItem(i18n("toggle quick todo","Show Quick Todo"), | 513 | mPopupMenu->insertItem(i18n("toggle quick todo","Show Quick Todo"), |
512 | this, SLOT( toggleQuickTodo() ),0,4 ); | 514 | this, SLOT( toggleQuickTodo() ),0,4 ); |
513 | mPopupMenu->insertItem(i18n("toggle running todo","Hide not Running"), | 515 | mPopupMenu->insertItem(i18n("toggle running todo","Hide not Running"), |
514 | this, SLOT( toggleRunning() ),0,5 ); | 516 | this, SLOT( toggleRunning() ),0,5 ); |
515 | mPopupMenu->insertItem(i18n(" set all open","Display all opened"), | 517 | mPopupMenu->insertItem(i18n(" set all open","Display all opened"), |
516 | this, SLOT( setAllOpen() ),0,6 ); | 518 | this, SLOT( setAllOpen() ),0,6 ); |
517 | mPopupMenu->insertItem(i18n(" set all close","Display all closed"), | 519 | mPopupMenu->insertItem(i18n(" set all close","Display all closed"), |
518 | this, SLOT( setAllClose() ),0,7 ); | 520 | this, SLOT( setAllClose() ),0,7 ); |
519 | mPopupMenu->insertItem(i18n(" set all flat","Display all flat"), | 521 | mPopupMenu->insertItem(i18n(" set all flat","Display all flat"), |
520 | this, SLOT( setAllFlat() ),0,8 ); | 522 | this, SLOT( setAllFlat() ),0,8 ); |
521 | mDocPrefs = new DocPrefs( name ); | 523 | mDocPrefs = new DocPrefs( name ); |
522 | 524 | ||
523 | mItemPopupMenu->insertItem(i18n("Todo View"),mPopupMenu ); | 525 | mItemPopupMenu->insertItem(i18n("Todo View"),mPopupMenu ); |
524 | mPopupMenu->setCheckable( true ); | 526 | mPopupMenu->setCheckable( true ); |
525 | mItemPopupMenu->setCheckable( true ); | 527 | mItemPopupMenu->setCheckable( true ); |
526 | 528 | ||
527 | 529 | ||
528 | mPopupMenu->setItemChecked( 3,KOPrefs::instance()->mShowCompletedTodo ); | 530 | mPopupMenu->setItemChecked( 3,KOPrefs::instance()->mShowCompletedTodo ); |
529 | mItemPopupMenu->setItemChecked( 33 , KOPrefs::instance()->mShowCompletedTodo ); | 531 | mItemPopupMenu->setItemChecked( 33 , KOPrefs::instance()->mShowCompletedTodo ); |
530 | 532 | ||
531 | mPopupMenu->setItemChecked(4,KOPrefs::instance()->mEnableQuickTodo); | 533 | mPopupMenu->setItemChecked(4,KOPrefs::instance()->mEnableQuickTodo); |
532 | mItemPopupMenu->setItemChecked( 34 , KOPrefs::instance()->mEnableQuickTodo ); | 534 | mItemPopupMenu->setItemChecked( 34 , KOPrefs::instance()->mEnableQuickTodo ); |
533 | 535 | ||
534 | mPopupMenu->setItemChecked(5,KOPrefs::instance()->mHideNonStartedTodos); | 536 | mPopupMenu->setItemChecked(5,KOPrefs::instance()->mHideNonStartedTodos); |
535 | mItemPopupMenu->setItemChecked( 35 , KOPrefs::instance()->mHideNonStartedTodos ); | 537 | mItemPopupMenu->setItemChecked( 35 , KOPrefs::instance()->mHideNonStartedTodos ); |
536 | 538 | ||
537 | 539 | ||
538 | // Double clicking conflicts with opening/closing the subtree | 540 | // Double clicking conflicts with opening/closing the subtree |
539 | connect( mTodoListView, SIGNAL( doubleClicked( QListViewItem *) ), | 541 | connect( mTodoListView, SIGNAL( doubleClicked( QListViewItem *) ), |
540 | SLOT( editItem( QListViewItem *) ) ); | 542 | SLOT( editItem( QListViewItem *) ) ); |
541 | /* | 543 | /* |
542 | connect( mTodoListView, SIGNAL( rightButtonClicked ( QListViewItem *, | 544 | connect( mTodoListView, SIGNAL( rightButtonClicked ( QListViewItem *, |
543 | const QPoint &,int ) ), | 545 | const QPoint &,int ) ), |
544 | SLOT( popupMenu( QListViewItem *, const QPoint & ,int) ) ); | 546 | SLOT( popupMenu( QListViewItem *, const QPoint & ,int) ) ); |
545 | */ | 547 | */ |
546 | connect( mTodoListView, SIGNAL( contextRequest ( QListViewItem *, | 548 | connect( mTodoListView, SIGNAL( contextRequest ( QListViewItem *, |
547 | const QPoint &,int ) ), | 549 | const QPoint &,int ) ), |
548 | SLOT( popupMenu( QListViewItem *, const QPoint & ,int) ) ); | 550 | SLOT( popupMenu( QListViewItem *, const QPoint & ,int) ) ); |
549 | connect( mTodoListView, SIGNAL( clicked( QListViewItem * ) ), | 551 | connect( mTodoListView, SIGNAL( clicked( QListViewItem * ) ), |
550 | SLOT( itemClicked( QListViewItem * ) ) ); | 552 | SLOT( itemClicked( QListViewItem * ) ) ); |
551 | connect( mTodoListView, SIGNAL( double_Clicked( QListViewItem * ) ), | 553 | connect( mTodoListView, SIGNAL( double_Clicked( QListViewItem * ) ), |
552 | SLOT( itemDoubleClicked( QListViewItem * ) ) ); | 554 | SLOT( itemDoubleClicked( QListViewItem * ) ) ); |
553 | connect( mTodoListView, SIGNAL( todoDropped( Todo *, int ) ), | 555 | connect( mTodoListView, SIGNAL( todoDropped( Todo *, int ) ), |
554 | SLOT( updateView() ) ); | 556 | SLOT( updateView() ) ); |
555 | connect( mTodoListView, SIGNAL( todoDropped( Todo *, int ) ), | 557 | connect( mTodoListView, SIGNAL( todoDropped( Todo *, int ) ), |
556 | SLOT( todoModified(Todo *, int) ) ); | 558 | SLOT( todoModified(Todo *, int) ) ); |
557 | connect( mTodoListView, SIGNAL( expanded( QListViewItem * ) ), | 559 | connect( mTodoListView, SIGNAL( expanded( QListViewItem * ) ), |
558 | SLOT( itemStateChanged( QListViewItem * ) ) ); | 560 | SLOT( itemStateChanged( QListViewItem * ) ) ); |
559 | connect( mTodoListView, SIGNAL( collapsed( QListViewItem * ) ), | 561 | connect( mTodoListView, SIGNAL( collapsed( QListViewItem * ) ), |
560 | SLOT( itemStateChanged( QListViewItem * ) ) ); | 562 | SLOT( itemStateChanged( QListViewItem * ) ) ); |
561 | connect( mTodoListView, SIGNAL( paintNeeded() ), | 563 | connect( mTodoListView, SIGNAL( paintNeeded() ), |
562 | SLOT( paintNeeded()) ); | 564 | SLOT( paintNeeded()) ); |
563 | 565 | ||
564 | #if 0 | 566 | #if 0 |
565 | connect(mTodoListView,SIGNAL(selectionChanged(QListViewItem *)), | 567 | connect(mTodoListView,SIGNAL(selectionChanged(QListViewItem *)), |
566 | SLOT(selectionChanged(QListViewItem *))); | 568 | SLOT(selectionChanged(QListViewItem *))); |
567 | connect(mTodoListView,SIGNAL(clicked(QListViewItem *)), | 569 | connect(mTodoListView,SIGNAL(clicked(QListViewItem *)), |
568 | SLOT(selectionChanged(QListViewItem *))); | 570 | SLOT(selectionChanged(QListViewItem *))); |
569 | connect(mTodoListView,SIGNAL(pressed(QListViewItem *)), | 571 | connect(mTodoListView,SIGNAL(pressed(QListViewItem *)), |
570 | SLOT(selectionChanged(QListViewItem *))); | 572 | SLOT(selectionChanged(QListViewItem *))); |
571 | #endif | 573 | #endif |
572 | 574 | ||
573 | connect( mTodoListView, SIGNAL(reparentTodoSignal( Todo *,Todo * ) ), SIGNAL(reparentTodoSignal( Todo *,Todo * ) )); | 575 | connect( mTodoListView, SIGNAL(reparentTodoSignal( Todo *,Todo * ) ), SIGNAL(reparentTodoSignal( Todo *,Todo * ) )); |
574 | connect( mTodoListView, SIGNAL(unparentTodoSignal(Todo *) ), SIGNAL(unparentTodoSignal(Todo *) )); | 576 | connect( mTodoListView, SIGNAL(unparentTodoSignal(Todo *) ), SIGNAL(unparentTodoSignal(Todo *) )); |
575 | connect( mTodoListView, SIGNAL( deleteTodo(Todo *) ), SIGNAL(deleteTodoSignal(Todo *) )); | 577 | connect( mTodoListView, SIGNAL( deleteTodo(Todo *) ), SIGNAL(deleteTodoSignal(Todo *) )); |
576 | 578 | ||
577 | connect( mTodoListView, SIGNAL(selectionChanged() ), | 579 | connect( mTodoListView, SIGNAL(selectionChanged() ), |
578 | SLOT( processSelectionChange() ) ); | 580 | SLOT( processSelectionChange() ) ); |
579 | connect( mQuickAdd, SIGNAL( returnPressed () ), | 581 | connect( mQuickAdd, SIGNAL( returnPressed () ), |
580 | SLOT( addQuickTodo() ) ); | 582 | SLOT( addQuickTodo() ) ); |
581 | 583 | ||
582 | } | 584 | } |
583 | 585 | ||
584 | KOTodoView::~KOTodoView() | 586 | KOTodoView::~KOTodoView() |
585 | { | 587 | { |
586 | // delete mKOTodoViewWhatsThis; | 588 | // delete mKOTodoViewWhatsThis; |
587 | delete mDocPrefs; | 589 | delete mDocPrefs; |
588 | } | 590 | } |
589 | QString KOTodoView::getWhatsThisText(QPoint p) | 591 | QString KOTodoView::getWhatsThisText(QPoint p) |
590 | { | 592 | { |
591 | KOTodoViewItem* item = ( KOTodoViewItem* ) mTodoListView->itemAt( p ); | 593 | KOTodoViewItem* item = ( KOTodoViewItem* ) mTodoListView->itemAt( p ); |
592 | if ( item ) | 594 | if ( item ) |
593 | return KIncidenceFormatter::instance()->getFormattedText( item->todo(), | 595 | return KIncidenceFormatter::instance()->getFormattedText( item->todo(), |
594 | KOPrefs::instance()->mWTshowDetails, | 596 | KOPrefs::instance()->mWTshowDetails, |
595 | KOPrefs::instance()->mWTshowCreated, | 597 | KOPrefs::instance()->mWTshowCreated, |
596 | KOPrefs::instance()->mWTshowChanged); | 598 | KOPrefs::instance()->mWTshowChanged); |
597 | return i18n("That is the todo view" ); | 599 | return i18n("That is the todo view" ); |
598 | 600 | ||
599 | } | 601 | } |
600 | 602 | ||
601 | void KOTodoView::jumpToDate () | 603 | void KOTodoView::jumpToDate () |
602 | { | 604 | { |
603 | // if (mActiveItem) { | 605 | // if (mActiveItem) { |
604 | // mActiveItem->todo()); | 606 | // mActiveItem->todo()); |
605 | // if ( mActiveItem->todo()->hasDueDate() ) | 607 | // if ( mActiveItem->todo()->hasDueDate() ) |
606 | // emit mActiveItem->todo()jumpToTime( mTodo->dtDue().date() ); | 608 | // emit mActiveItem->todo()jumpToTime( mTodo->dtDue().date() ); |
607 | } | 609 | } |
608 | void KOTodoView::paintNeeded() | 610 | void KOTodoView::paintNeeded() |
609 | { | 611 | { |
610 | if ( mPendingUpdateBeforeRepaint ) { | 612 | if ( mPendingUpdateBeforeRepaint ) { |
611 | updateView(); | 613 | updateView(); |
612 | mPendingUpdateBeforeRepaint = false; | 614 | mPendingUpdateBeforeRepaint = false; |
613 | } | 615 | } |
614 | } | 616 | } |
615 | void KOTodoView::paintEvent(QPaintEvent * pevent) | 617 | void KOTodoView::paintEvent(QPaintEvent * pevent) |
616 | { | 618 | { |
617 | if ( mPendingUpdateBeforeRepaint ) { | 619 | if ( mPendingUpdateBeforeRepaint ) { |
618 | updateView(); | 620 | updateView(); |
619 | mPendingUpdateBeforeRepaint = false; | 621 | mPendingUpdateBeforeRepaint = false; |
620 | } | 622 | } |
621 | KOrg::BaseView::paintEvent( pevent); | 623 | KOrg::BaseView::paintEvent( pevent); |
622 | } | 624 | } |
623 | 625 | ||
624 | void KOTodoView::updateView() | 626 | void KOTodoView::updateView() |
625 | { | 627 | { |
626 | pendingSubtodo = 0; | 628 | pendingSubtodo = 0; |
627 | if ( mBlockUpdate ) { | 629 | if ( mBlockUpdate ) { |
628 | return; | 630 | return; |
629 | } | 631 | } |
630 | if ( !isVisible() ) { | 632 | if ( !isVisible() ) { |
631 | mPendingUpdateBeforeRepaint = true; | 633 | mPendingUpdateBeforeRepaint = true; |
632 | return; | 634 | return; |
633 | } | 635 | } |
634 | storeCurrentItem(); | 636 | storeCurrentItem(); |
635 | //qDebug("KOTodoView::updateView() %x", this); | 637 | //qDebug("KOTodoView::updateView() %x", this); |
636 | if ( isFlatDisplay ) { | 638 | if ( isFlatDisplay ) { |
637 | displayAllFlat(); | 639 | displayAllFlat(); |
638 | resetCurrentItem(); | 640 | resetCurrentItem(); |
639 | return; | 641 | return; |
640 | } | 642 | } |
641 | //qDebug("update "); | 643 | //qDebug("update "); |
642 | // kdDebug() << "KOTodoView::updateView()" << endl; | 644 | // kdDebug() << "KOTodoView::updateView()" << endl; |
643 | QFont fo = KOPrefs::instance()->mTodoViewFont; | 645 | QFont fo = KOPrefs::instance()->mTodoViewFont; |
644 | 646 | ||
645 | 647 | ||
646 | mTodoListView->clear(); | 648 | mTodoListView->clear(); |
647 | if ( mName == "todolistsmall" ) { | 649 | if ( mName == "todolistsmall" ) { |
648 | if ( KOPrefs::instance()->mTodoViewUsesSmallFont ) { | 650 | if ( KOPrefs::instance()->mTodoViewUsesSmallFont ) { |
649 | int ps = fo.pointSize() -2; | 651 | int ps = fo.pointSize() -2; |
650 | if ( ps > 12 ) | 652 | if ( ps > 12 ) |
651 | ps -= 2; | 653 | ps -= 2; |
652 | fo.setPointSize( ps ); | 654 | fo.setPointSize( ps ); |
653 | } | 655 | } |
654 | } | 656 | } |
655 | 657 | ||
656 | mTodoListView->setFont( fo ); | 658 | mTodoListView->setFont( fo ); |
657 | // QFontMetrics fm ( KOPrefs::instance()->mTodoViewFont ); | 659 | // QFontMetrics fm ( KOPrefs::instance()->mTodoViewFont ); |
658 | //mTodoListView->header()->setMaximumHeight(fm.height()); | 660 | //mTodoListView->header()->setMaximumHeight(fm.height()); |
659 | QPtrList<Todo> todoList = calendar()->todos(); | 661 | QPtrList<Todo> todoList = calendar()->todos(); |
660 | 662 | ||
661 | /* | 663 | /* |
662 | kdDebug() << "KOTodoView::updateView(): Todo List:" << endl; | 664 | kdDebug() << "KOTodoView::updateView(): Todo List:" << endl; |
663 | Event *t; | 665 | Event *t; |
664 | for(t = todoList.first(); t; t = todoList.next()) { | 666 | for(t = todoList.first(); t; t = todoList.next()) { |
665 | kdDebug() << " " << t->getSummary() << endl; | 667 | kdDebug() << " " << t->getSummary() << endl; |
666 | 668 | ||
667 | if (t->getRelatedTo()) { | 669 | if (t->getRelatedTo()) { |
668 | kdDebug() << " (related to " << t->getRelatedTo()->getSummary() << ")" << endl; | 670 | kdDebug() << " (related to " << t->getRelatedTo()->getSummary() << ")" << endl; |
669 | } | 671 | } |
670 | 672 | ||
671 | QPtrList<Event> l = t->getRelations(); | 673 | QPtrList<Event> l = t->getRelations(); |
672 | Event *c; | 674 | Event *c; |
673 | for(c=l.first();c;c=l.next()) { | 675 | for(c=l.first();c;c=l.next()) { |
674 | kdDebug() << " - relation: " << c->getSummary() << endl; | 676 | kdDebug() << " - relation: " << c->getSummary() << endl; |
675 | } | 677 | } |
@@ -910,395 +912,421 @@ void KOTodoView::printPreview(CalPrinter *calPrinter, const QDate &fd, | |||
910 | 912 | ||
911 | void KOTodoView::editItem(QListViewItem *item ) | 913 | void KOTodoView::editItem(QListViewItem *item ) |
912 | { | 914 | { |
913 | // qDebug("editItem(QListViewItem *item ) "); | 915 | // qDebug("editItem(QListViewItem *item ) "); |
914 | emit editTodoSignal(((KOTodoViewItem *)item)->todo()); | 916 | emit editTodoSignal(((KOTodoViewItem *)item)->todo()); |
915 | } | 917 | } |
916 | 918 | ||
917 | void KOTodoView::showItem(QListViewItem *item,const QPoint &,int) | 919 | void KOTodoView::showItem(QListViewItem *item,const QPoint &,int) |
918 | { | 920 | { |
919 | emit showTodoSignal(((KOTodoViewItem *)item)->todo()); | 921 | emit showTodoSignal(((KOTodoViewItem *)item)->todo()); |
920 | } | 922 | } |
921 | 923 | ||
922 | void KOTodoView::popupMenu(QListViewItem *item,const QPoint &p,int column) | 924 | void KOTodoView::popupMenu(QListViewItem *item,const QPoint &p,int column) |
923 | { | 925 | { |
924 | pendingSubtodo = 0; | 926 | pendingSubtodo = 0; |
925 | mActiveItem = (KOTodoViewItem *)item; | 927 | mActiveItem = (KOTodoViewItem *)item; |
926 | if (item) { | 928 | if (item) { |
927 | switch (column){ | 929 | switch (column){ |
928 | case 1: | 930 | case 1: |
929 | mPriorityPopupMenu->popup(QCursor::pos ()); break; | 931 | mPriorityPopupMenu->popup(QCursor::pos ()); break; |
930 | case 2: | 932 | case 2: |
931 | mPercentageCompletedPopupMenu->popup(QCursor::pos ()); break; | 933 | mPercentageCompletedPopupMenu->popup(QCursor::pos ()); break; |
932 | case 3: | 934 | case 3: |
933 | moveTodo(); | 935 | moveTodo(); |
934 | break; | 936 | break; |
935 | case 8: | 937 | case 8: |
936 | getCategoryPopupMenu((KOTodoViewItem *)item)->popup(QCursor::pos ()); break; | 938 | getCategoryPopupMenu((KOTodoViewItem *)item)->popup(QCursor::pos ()); break; |
937 | default: | 939 | default: |
938 | mItemPopupMenu->popup(QCursor::pos()); | 940 | mItemPopupMenu->popup(QCursor::pos()); |
939 | } | 941 | } |
940 | } else mPopupMenu->popup(QCursor::pos()); | 942 | } else mPopupMenu->popup(QCursor::pos()); |
941 | } | 943 | } |
942 | void KOTodoView::newTodo() | 944 | void KOTodoView::newTodo() |
943 | { | 945 | { |
944 | emit newTodoSignal(); | 946 | emit newTodoSignal(); |
945 | } | 947 | } |
946 | 948 | ||
947 | void KOTodoView::newSubTodo() | 949 | void KOTodoView::newSubTodo() |
948 | { | 950 | { |
949 | if (mActiveItem) { | 951 | if (mActiveItem) { |
950 | emit newSubTodoSignal(mActiveItem->todo()); | 952 | emit newSubTodoSignal(mActiveItem->todo()); |
951 | } | 953 | } |
952 | } | 954 | } |
953 | void KOTodoView::unparentTodo() | 955 | void KOTodoView::unparentTodo() |
954 | { | 956 | { |
955 | if (mActiveItem) { | 957 | if (mActiveItem) { |
956 | emit unparentTodoSignal(mActiveItem->todo()); | 958 | emit unparentTodoSignal(mActiveItem->todo()); |
957 | } | 959 | } |
958 | } | 960 | } |
959 | 961 | ||
960 | void KOTodoView::reparentTodo() | 962 | void KOTodoView::reparentTodo() |
961 | { | 963 | { |
962 | if (mActiveItem) { | 964 | if (mActiveItem) { |
963 | qDebug("KOTodoView::reparentTodo() "); | 965 | qDebug("KOTodoView::reparentTodo() "); |
964 | topLevelWidget()->setCaption(i18n("Click on new parent item")); | 966 | topLevelWidget()->setCaption(i18n("Click on new parent item")); |
965 | pendingSubtodo = mActiveItem; | 967 | pendingSubtodo = mActiveItem; |
966 | } | 968 | } |
967 | } | 969 | } |
968 | void KOTodoView::editTodo() | 970 | void KOTodoView::editTodo() |
969 | { | 971 | { |
970 | if (mActiveItem) { | 972 | if (mActiveItem) { |
971 | emit editTodoSignal(mActiveItem->todo()); | 973 | emit editTodoSignal(mActiveItem->todo()); |
972 | } | 974 | } |
973 | } | 975 | } |
974 | void KOTodoView::cloneTodo() | 976 | void KOTodoView::cloneTodo() |
975 | { | 977 | { |
976 | if (mActiveItem) { | 978 | if (mActiveItem) { |
977 | emit cloneTodoSignal((Incidence*)mActiveItem->todo()); | 979 | emit cloneTodoSignal((Incidence*)mActiveItem->todo()); |
978 | } | 980 | } |
979 | } | 981 | } |
980 | void KOTodoView::cancelTodo() | 982 | void KOTodoView::cancelTodo() |
981 | { | 983 | { |
982 | if (mActiveItem) { | 984 | if (mActiveItem) { |
983 | emit cancelTodoSignal((Incidence*)mActiveItem->todo()); | 985 | emit cancelTodoSignal((Incidence*)mActiveItem->todo()); |
984 | } | 986 | } |
985 | } | 987 | } |
986 | void KOTodoView::moveTodo() | 988 | void KOTodoView::moveTodo() |
987 | { | 989 | { |
988 | if (mActiveItem) { | 990 | if (mActiveItem) { |
989 | emit moveTodoSignal((Incidence*)mActiveItem->todo()); | 991 | emit moveTodoSignal((Incidence*)mActiveItem->todo()); |
990 | } | 992 | } |
991 | } | 993 | } |
992 | void KOTodoView::beamTodo() | 994 | void KOTodoView::beamTodo() |
993 | { | 995 | { |
994 | if (mActiveItem) { | 996 | if (mActiveItem) { |
995 | emit beamTodoSignal((Incidence*)mActiveItem->todo()); | 997 | emit beamTodoSignal((Incidence*)mActiveItem->todo()); |
996 | } | 998 | } |
997 | } | 999 | } |
998 | 1000 | ||
999 | 1001 | ||
1000 | void KOTodoView::showTodo() | 1002 | void KOTodoView::showTodo() |
1001 | { | 1003 | { |
1002 | if (mActiveItem) { | 1004 | if (mActiveItem) { |
1003 | emit showTodoSignal(mActiveItem->todo()); | 1005 | emit showTodoSignal(mActiveItem->todo()); |
1004 | } | 1006 | } |
1005 | } | 1007 | } |
1006 | 1008 | ||
1007 | void KOTodoView::deleteTodo() | 1009 | void KOTodoView::deleteTodo() |
1008 | { | 1010 | { |
1009 | if (mActiveItem) { | 1011 | if (mActiveItem) { |
1010 | emit deleteTodoSignal(mActiveItem->todo()); | 1012 | emit deleteTodoSignal(mActiveItem->todo()); |
1011 | } | 1013 | } |
1012 | } | 1014 | } |
1013 | 1015 | ||
1014 | void KOTodoView::setNewPriority(int index) | 1016 | void KOTodoView::setNewPriority(int index) |
1015 | { | 1017 | { |
1016 | if (mActiveItem && !mActiveItem->todo()->isReadOnly ()) { | 1018 | if (mActiveItem && !mActiveItem->todo()->isReadOnly ()) { |
1017 | mActiveItem->todo()->setPriority(mPriority[index]); | 1019 | mActiveItem->todo()->setPriority(mPriority[index]); |
1018 | mActiveItem->construct(); | 1020 | mActiveItem->construct(); |
1019 | todoModified (mActiveItem->todo(), KOGlobals::PRIORITY_MODIFIED); | 1021 | todoModified (mActiveItem->todo(), KOGlobals::PRIORITY_MODIFIED); |
1020 | mActiveItem->todo()->setRevision( mActiveItem->todo()->revision()+1 ); | 1022 | mActiveItem->todo()->setRevision( mActiveItem->todo()->revision()+1 ); |
1021 | } | 1023 | } |
1022 | } | 1024 | } |
1023 | 1025 | ||
1024 | void KOTodoView::setNewPercentage(int index) | 1026 | void KOTodoView::setNewPercentage(int index) |
1025 | { | 1027 | { |
1026 | if (mActiveItem && !mActiveItem->todo()->isReadOnly ()) { | 1028 | if (mActiveItem && !mActiveItem->todo()->isReadOnly ()) { |
1027 | 1029 | ||
1028 | if ( mPercentage[index] == 100 && !mActiveItem->isOn() ) { | 1030 | if ( mPercentage[index] == 100 && !mActiveItem->isOn() ) { |
1029 | mActiveItem->setOn( true ); | 1031 | mActiveItem->setOn( true ); |
1030 | return; | 1032 | return; |
1031 | } else if ( mPercentage[index] != 100 && mActiveItem->isOn() ) { | 1033 | } else if ( mPercentage[index] != 100 && mActiveItem->isOn() ) { |
1032 | KOTodoViewItem* par = (static_cast<KOTodoViewItem*>(mActiveItem->parent())); | 1034 | KOTodoViewItem* par = (static_cast<KOTodoViewItem*>(mActiveItem->parent())); |
1033 | if ( par && par->isOn() ) | 1035 | if ( par && par->isOn() ) |
1034 | par->setOn( false ); | 1036 | par->setOn( false ); |
1035 | } | 1037 | } |
1036 | if (mPercentage[index] == 100) { | 1038 | if (mPercentage[index] == 100) { |
1037 | mActiveItem->todo()->setCompleted(QDateTime::currentDateTime()); | 1039 | mActiveItem->todo()->setCompleted(QDateTime::currentDateTime()); |
1038 | } else { | 1040 | } else { |
1039 | mActiveItem->todo()->setCompleted(false); | 1041 | mActiveItem->todo()->setCompleted(false); |
1040 | } | 1042 | } |
1041 | mActiveItem->todo()->setPercentComplete(mPercentage[index]); | 1043 | mActiveItem->todo()->setPercentComplete(mPercentage[index]); |
1042 | mActiveItem->construct(); | 1044 | mActiveItem->construct(); |
1043 | todoModified (mActiveItem->todo (), KOGlobals::COMPLETION_MODIFIED); | 1045 | todoModified (mActiveItem->todo (), KOGlobals::COMPLETION_MODIFIED); |
1044 | mActiveItem->todo()->setRevision( mActiveItem->todo()->revision()+1 ); | 1046 | mActiveItem->todo()->setRevision( mActiveItem->todo()->revision()+1 ); |
1045 | } | 1047 | } |
1046 | } | 1048 | } |
1047 | 1049 | ||
1048 | 1050 | ||
1049 | QPopupMenu * KOTodoView::getCategoryPopupMenu (KOTodoViewItem *todoItem) | 1051 | QPopupMenu * KOTodoView::getCategoryPopupMenu (KOTodoViewItem *todoItem) |
1050 | { | 1052 | { |
1051 | QPopupMenu* tempMenu = new QPopupMenu (this); | 1053 | QPopupMenu* tempMenu = new QPopupMenu (this); |
1052 | QStringList checkedCategories = todoItem->todo()->categories (); | 1054 | QStringList checkedCategories = todoItem->todo()->categories (); |
1053 | 1055 | ||
1054 | tempMenu->setCheckable (true); | 1056 | tempMenu->setCheckable (true); |
1055 | for (QStringList::Iterator it = KOPrefs::instance()->mCustomCategories.begin (); | 1057 | for (QStringList::Iterator it = KOPrefs::instance()->mCustomCategories.begin (); |
1056 | it != KOPrefs::instance()->mCustomCategories.end (); | 1058 | it != KOPrefs::instance()->mCustomCategories.end (); |
1057 | ++it) { | 1059 | ++it) { |
1058 | int index = tempMenu->insertItem (*it); | 1060 | int index = tempMenu->insertItem (*it); |
1059 | mCategory[index] = *it; | 1061 | mCategory[index] = *it; |
1060 | if (checkedCategories.find (*it) != checkedCategories.end ()) tempMenu->setItemChecked (index, true); | 1062 | if (checkedCategories.find (*it) != checkedCategories.end ()) tempMenu->setItemChecked (index, true); |
1061 | } | 1063 | } |
1062 | 1064 | ||
1063 | connect (tempMenu, SIGNAL (activated (int)), SLOT (changedCategories (int))); | 1065 | connect (tempMenu, SIGNAL (activated (int)), SLOT (changedCategories (int))); |
1064 | return tempMenu; | 1066 | return tempMenu; |
1065 | 1067 | ||
1066 | 1068 | ||
1067 | } | 1069 | } |
1068 | void KOTodoView::changedCategories(int index) | 1070 | void KOTodoView::changedCategories(int index) |
1069 | { | 1071 | { |
1070 | if (mActiveItem && !mActiveItem->todo()->isReadOnly ()) { | 1072 | if (mActiveItem && !mActiveItem->todo()->isReadOnly ()) { |
1071 | QStringList categories = mActiveItem->todo()->categories (); | 1073 | QStringList categories = mActiveItem->todo()->categories (); |
1072 | QString colcat = categories.first(); | 1074 | QString colcat = categories.first(); |
1073 | if (categories.find (mCategory[index]) != categories.end ()) | 1075 | if (categories.find (mCategory[index]) != categories.end ()) |
1074 | categories.remove (mCategory[index]); | 1076 | categories.remove (mCategory[index]); |
1075 | else | 1077 | else |
1076 | categories.insert (categories.end(), mCategory[index]); | 1078 | categories.insert (categories.end(), mCategory[index]); |
1077 | categories.sort (); | 1079 | categories.sort (); |
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 "); |
1137 | pendingSubtodo = 0; | 1165 | pendingSubtodo = 0; |
1138 | } else { | 1166 | } else { |
1139 | Todo* newParent = todoItem->todo(); | 1167 | Todo* newParent = todoItem->todo(); |
1140 | Todo* newSub = pendingSubtodo->todo(); | 1168 | Todo* newSub = pendingSubtodo->todo(); |
1141 | pendingSubtodo = 0; | 1169 | pendingSubtodo = 0; |
1142 | emit reparentTodoSignal( newParent,newSub ); | 1170 | emit reparentTodoSignal( newParent,newSub ); |
1143 | return; | 1171 | return; |
1144 | } | 1172 | } |
1145 | } | 1173 | } |
1146 | #if 0 | 1174 | #if 0 |
1147 | // handled by the item itself | 1175 | // handled by the item itself |
1148 | bool completed = todoItem->todo()->isCompleted(); // Completed or not? | 1176 | bool completed = todoItem->todo()->isCompleted(); // Completed or not? |
1149 | qDebug("com %d ",completed ); | 1177 | qDebug("com %d ",completed ); |
1150 | qDebug("itemclicked "); | 1178 | qDebug("itemclicked "); |
1151 | if (todoItem->isOn()) { | 1179 | if (todoItem->isOn()) { |
1152 | qDebug("on "); | 1180 | qDebug("on "); |
1153 | if (!completed) { | 1181 | if (!completed) { |
1154 | qDebug("set true "); | 1182 | qDebug("set true "); |
1155 | todoItem->todo()->setCompleted(QDateTime::currentDateTime()); | 1183 | todoItem->todo()->setCompleted(QDateTime::currentDateTime()); |
1156 | } | 1184 | } |
1157 | } else { | 1185 | } else { |
1158 | qDebug("not on "); | 1186 | qDebug("not on "); |
1159 | if (completed) { | 1187 | if (completed) { |
1160 | qDebug("set false "); | 1188 | qDebug("set false "); |
1161 | todoItem->todo()->setCompleted(false); | 1189 | todoItem->todo()->setCompleted(false); |
1162 | } | 1190 | } |
1163 | } | 1191 | } |
1164 | #endif | 1192 | #endif |
1165 | } | 1193 | } |
1166 | 1194 | ||
1167 | void KOTodoView::setDocumentId( const QString &id ) | 1195 | void KOTodoView::setDocumentId( const QString &id ) |
1168 | { | 1196 | { |
1169 | kdDebug() << "KOTodoView::setDocumentId()" << endl; | 1197 | kdDebug() << "KOTodoView::setDocumentId()" << endl; |
1170 | 1198 | ||
1171 | mDocPrefs->setDoc( id ); | 1199 | mDocPrefs->setDoc( id ); |
1172 | } | 1200 | } |
1173 | 1201 | ||
1174 | void KOTodoView::itemStateChanged( QListViewItem *item ) | 1202 | void KOTodoView::itemStateChanged( QListViewItem *item ) |
1175 | { | 1203 | { |
1176 | if (!item) return; | 1204 | if (!item) return; |
1177 | 1205 | ||
1178 | KOTodoViewItem *todoItem = (KOTodoViewItem *)item; | 1206 | KOTodoViewItem *todoItem = (KOTodoViewItem *)item; |
1179 | 1207 | ||
1180 | // kdDebug() << "KOTodoView::itemStateChanged(): " << todoItem->todo()->summary() << endl; | 1208 | // kdDebug() << "KOTodoView::itemStateChanged(): " << todoItem->todo()->summary() << endl; |
1181 | 1209 | ||
1182 | if( mDocPrefs ) mDocPrefs->writeEntry( todoItem->todo()->uid(), todoItem->isOpen() ); | 1210 | if( mDocPrefs ) mDocPrefs->writeEntry( todoItem->todo()->uid(), todoItem->isOpen() ); |
1183 | } | 1211 | } |
1184 | 1212 | ||
1185 | void KOTodoView::saveLayout(KConfig *config, const QString &group) const | 1213 | void KOTodoView::saveLayout(KConfig *config, const QString &group) const |
1186 | { | 1214 | { |
1187 | mTodoListView->saveLayout(config,group); | 1215 | mTodoListView->saveLayout(config,group); |
1188 | } | 1216 | } |
1189 | 1217 | ||
1190 | void KOTodoView::restoreLayout(KConfig *config, const QString &group) | 1218 | void KOTodoView::restoreLayout(KConfig *config, const QString &group) |
1191 | { | 1219 | { |
1192 | mTodoListView->restoreLayout(config,group); | 1220 | mTodoListView->restoreLayout(config,group); |
1193 | } | 1221 | } |
1194 | 1222 | ||
1195 | void KOTodoView::processSelectionChange() | 1223 | void KOTodoView::processSelectionChange() |
1196 | { | 1224 | { |
1197 | // kdDebug() << "KOTodoView::processSelectionChange()" << endl; | 1225 | // kdDebug() << "KOTodoView::processSelectionChange()" << endl; |
1198 | 1226 | ||
1199 | KOTodoViewItem *item = | 1227 | KOTodoViewItem *item = |
1200 | static_cast<KOTodoViewItem *>( mTodoListView->selectedItem() ); | 1228 | static_cast<KOTodoViewItem *>( mTodoListView->selectedItem() ); |
1201 | 1229 | ||
1202 | if ( !item ) { | 1230 | if ( !item ) { |
1203 | emit incidenceSelected( 0 ); | 1231 | emit incidenceSelected( 0 ); |
1204 | } else { | 1232 | } else { |
1205 | emit incidenceSelected( item->todo() ); | 1233 | emit incidenceSelected( item->todo() ); |
1206 | } | 1234 | } |
1207 | } | 1235 | } |
1208 | 1236 | ||
1209 | void KOTodoView::modified(bool b) | 1237 | void KOTodoView::modified(bool b) |
1210 | { | 1238 | { |
1211 | emit isModified(b); | 1239 | emit isModified(b); |
1212 | } | 1240 | } |
1213 | void KOTodoView::setTodoModified( Todo* todo ) | 1241 | void KOTodoView::setTodoModified( Todo* todo ) |
1214 | { | 1242 | { |
1215 | todoModified( todo, KOGlobals::UNKNOWN_MODIFIED ); | 1243 | todoModified( todo, KOGlobals::UNKNOWN_MODIFIED ); |
1216 | } | 1244 | } |
1217 | void KOTodoView::clearSelection() | 1245 | void KOTodoView::clearSelection() |
1218 | { | 1246 | { |
1219 | mTodoListView->selectAll( false ); | 1247 | mTodoListView->selectAll( false ); |
1220 | } | 1248 | } |
1221 | void KOTodoView::setAllOpen() | 1249 | void KOTodoView::setAllOpen() |
1222 | { | 1250 | { |
1223 | if ( isFlatDisplay ) { | 1251 | if ( isFlatDisplay ) { |
1224 | isFlatDisplay = false; | 1252 | isFlatDisplay = false; |
1225 | mPopupMenu->setItemChecked( 8,false ); | 1253 | mPopupMenu->setItemChecked( 8,false ); |
1226 | updateView(); | 1254 | updateView(); |
1227 | } else { | 1255 | } else { |
1228 | storeCurrentItem(); | 1256 | storeCurrentItem(); |
1229 | } | 1257 | } |
1230 | setOpen(mTodoListView->firstChild(), true); | 1258 | setOpen(mTodoListView->firstChild(), true); |
1231 | resetCurrentItem(); | 1259 | resetCurrentItem(); |
1232 | } | 1260 | } |
1233 | void KOTodoView::setAllClose() | 1261 | void KOTodoView::setAllClose() |
1234 | { | 1262 | { |
1235 | if ( isFlatDisplay ) { | 1263 | if ( isFlatDisplay ) { |
1236 | isFlatDisplay = false; | 1264 | isFlatDisplay = false; |
1237 | mPopupMenu->setItemChecked( 8,false ); | 1265 | mPopupMenu->setItemChecked( 8,false ); |
1238 | updateView(); | 1266 | updateView(); |
1239 | } else { | 1267 | } else { |
1240 | storeCurrentItem(); | 1268 | storeCurrentItem(); |
1241 | } | 1269 | } |
1242 | setOpen(mTodoListView->firstChild(), false); | 1270 | setOpen(mTodoListView->firstChild(), false); |
1243 | resetCurrentItem(); | 1271 | resetCurrentItem(); |
1244 | } | 1272 | } |
1245 | void KOTodoView::setOpen( QListViewItem* item, bool setOpenI) | 1273 | void KOTodoView::setOpen( QListViewItem* item, bool setOpenI) |
1246 | { | 1274 | { |
1247 | 1275 | ||
1248 | while ( item ) { | 1276 | while ( item ) { |
1249 | setOpen( item->firstChild(), setOpenI ); | 1277 | setOpen( item->firstChild(), setOpenI ); |
1250 | item->setOpen( setOpenI ); | 1278 | item->setOpen( setOpenI ); |
1251 | item = item->nextSibling(); | 1279 | item = item->nextSibling(); |
1252 | } | 1280 | } |
1253 | } | 1281 | } |
1254 | 1282 | ||
1255 | void KOTodoView::displayAllFlat() | 1283 | void KOTodoView::displayAllFlat() |
1256 | { | 1284 | { |
1257 | pendingSubtodo = 0; | 1285 | pendingSubtodo = 0; |
1258 | if ( mBlockUpdate ) { | 1286 | if ( mBlockUpdate ) { |
1259 | return; | 1287 | return; |
1260 | } | 1288 | } |
1261 | mPopupMenu->setItemChecked( 8,true ); | 1289 | mPopupMenu->setItemChecked( 8,true ); |
1262 | isFlatDisplay = true; | 1290 | isFlatDisplay = true; |
1263 | QPtrList<Todo> todoList = calendar()->todos(); | 1291 | QPtrList<Todo> todoList = calendar()->todos(); |
1264 | mTodoMap.clear(); | 1292 | mTodoMap.clear(); |
1265 | mTodoListView->clear(); | 1293 | mTodoListView->clear(); |
1266 | Todo *todo; | 1294 | Todo *todo; |
1267 | for(todo = todoList.first(); todo; todo = todoList.next()) { | 1295 | for(todo = todoList.first(); todo; todo = todoList.next()) { |
1268 | KOTodoViewItem *todoItem = new KOTodoViewItem(mTodoListView,todo,this); | 1296 | KOTodoViewItem *todoItem = new KOTodoViewItem(mTodoListView,todo,this); |
1269 | mTodoMap.insert(todo,todoItem); | 1297 | mTodoMap.insert(todo,todoItem); |
1270 | } | 1298 | } |
1271 | mTodoListView->setFocus(); | 1299 | mTodoListView->setFocus(); |
1272 | processSelectionChange(); | 1300 | processSelectionChange(); |
1273 | } | 1301 | } |
1274 | 1302 | ||
1275 | void KOTodoView::setAllFlat() | 1303 | void KOTodoView::setAllFlat() |
1276 | { | 1304 | { |
1277 | if ( isFlatDisplay ) { | 1305 | if ( isFlatDisplay ) { |
1278 | isFlatDisplay = false; | 1306 | isFlatDisplay = false; |
1279 | mPopupMenu->setItemChecked( 8,false ); | 1307 | mPopupMenu->setItemChecked( 8,false ); |
1280 | updateView(); | 1308 | updateView(); |
1281 | return; | 1309 | return; |
1282 | } | 1310 | } |
1283 | storeCurrentItem(); | 1311 | storeCurrentItem(); |
1284 | displayAllFlat(); | 1312 | displayAllFlat(); |
1285 | resetCurrentItem(); | 1313 | resetCurrentItem(); |
1286 | } | 1314 | } |
1287 | 1315 | ||
1288 | void KOTodoView::purgeCompleted() | 1316 | void KOTodoView::purgeCompleted() |
1289 | { | 1317 | { |
1290 | emit purgeCompletedSignal(); | 1318 | emit purgeCompletedSignal(); |
1291 | 1319 | ||
1292 | } | 1320 | } |
1293 | void KOTodoView::toggleQuickTodo() | 1321 | void KOTodoView::toggleQuickTodo() |
1294 | { | 1322 | { |
1295 | if ( mQuickAdd->isVisible() ) { | 1323 | if ( mQuickAdd->isVisible() ) { |
1296 | mQuickAdd->hide(); | 1324 | mQuickAdd->hide(); |
1297 | KOPrefs::instance()->mEnableQuickTodo = false; | 1325 | KOPrefs::instance()->mEnableQuickTodo = false; |
1298 | } | 1326 | } |
1299 | else { | 1327 | else { |
1300 | mQuickAdd->show(); | 1328 | mQuickAdd->show(); |
1301 | KOPrefs::instance()->mEnableQuickTodo = true; | 1329 | KOPrefs::instance()->mEnableQuickTodo = true; |
1302 | } | 1330 | } |
1303 | mPopupMenu->setItemChecked(4,KOPrefs::instance()->mEnableQuickTodo); | 1331 | mPopupMenu->setItemChecked(4,KOPrefs::instance()->mEnableQuickTodo); |
1304 | mItemPopupMenu->setItemChecked( 34 , KOPrefs::instance()->mEnableQuickTodo ); | 1332 | mItemPopupMenu->setItemChecked( 34 , KOPrefs::instance()->mEnableQuickTodo ); |
diff --git a/korganizer/kotodoview.h b/korganizer/kotodoview.h index d0788a9..d368513 100644 --- a/korganizer/kotodoview.h +++ b/korganizer/kotodoview.h | |||
@@ -17,247 +17,248 @@ | |||
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 | As a special exception, permission is given to link this program | 19 | As a special exception, permission is given to link this program |
20 | with any edition of Qt, and distribute the resulting executable, | 20 | with any edition of Qt, and distribute the resulting executable, |
21 | without including the source code for Qt in the source distribution. | 21 | without including the source code for Qt in the source distribution. |
22 | */ | 22 | */ |
23 | #ifndef KOTODOVIEW_H | 23 | #ifndef KOTODOVIEW_H |
24 | #define KOTODOVIEW_H | 24 | #define KOTODOVIEW_H |
25 | 25 | ||
26 | #include <qfont.h> | 26 | #include <qfont.h> |
27 | #include <qfontmetrics.h> | 27 | #include <qfontmetrics.h> |
28 | #include <qlineedit.h> | 28 | #include <qlineedit.h> |
29 | #include <qptrlist.h> | 29 | #include <qptrlist.h> |
30 | #include <qstrlist.h> | 30 | #include <qstrlist.h> |
31 | #include <qlistbox.h> | 31 | #include <qlistbox.h> |
32 | #include <qpopupmenu.h> | 32 | #include <qpopupmenu.h> |
33 | #include <qlabel.h> | 33 | #include <qlabel.h> |
34 | #include <qmap.h> | 34 | #include <qmap.h> |
35 | #include <qlistview.h> | 35 | #include <qlistview.h> |
36 | #include <klistview.h> | 36 | #include <klistview.h> |
37 | 37 | ||
38 | #include <libkcal/calendar.h> | 38 | #include <libkcal/calendar.h> |
39 | #include <libkcal/todo.h> | 39 | #include <libkcal/todo.h> |
40 | 40 | ||
41 | #include <korganizer/baseview.h> | 41 | #include <korganizer/baseview.h> |
42 | 42 | ||
43 | #include "kotodoviewitem.h" | 43 | #include "kotodoviewitem.h" |
44 | #include "koprefs.h" | 44 | #include "koprefs.h" |
45 | #include "koglobals.h" | 45 | #include "koglobals.h" |
46 | #include "datenavigator.h" | 46 | #include "datenavigator.h" |
47 | 47 | ||
48 | class QDragEnterEvent; | 48 | class QDragEnterEvent; |
49 | class QDragMoveEvent; | 49 | class QDragMoveEvent; |
50 | class QDragLeaveEvent; | 50 | class QDragLeaveEvent; |
51 | class QDropEvent; | 51 | class QDropEvent; |
52 | class KOTodoViewWhatsThis; | 52 | class KOTodoViewWhatsThis; |
53 | 53 | ||
54 | class DocPrefs; | 54 | class DocPrefs; |
55 | 55 | ||
56 | class KOTodoListView : public KListView | 56 | class KOTodoListView : public KListView |
57 | { | 57 | { |
58 | Q_OBJECT | 58 | Q_OBJECT |
59 | public: | 59 | public: |
60 | KOTodoListView(Calendar *,QWidget *parent=0,const char *name=0); | 60 | KOTodoListView(Calendar *,QWidget *parent=0,const char *name=0); |
61 | virtual ~KOTodoListView() {} | 61 | virtual ~KOTodoListView() {} |
62 | 62 | ||
63 | signals: | 63 | signals: |
64 | void paintNeeded(); | 64 | void paintNeeded(); |
65 | void todoDropped(Todo *, int); | 65 | void todoDropped(Todo *, int); |
66 | void double_Clicked(QListViewItem *item); | 66 | void double_Clicked(QListViewItem *item); |
67 | void reparentTodoSignal( Todo *,Todo * ); | 67 | void reparentTodoSignal( Todo *,Todo * ); |
68 | void unparentTodoSignal(Todo *); | 68 | void unparentTodoSignal(Todo *); |
69 | void deleteTodo( Todo * ); | 69 | void deleteTodo( Todo * ); |
70 | protected: | 70 | protected: |
71 | void wheelEvent (QWheelEvent *e); | 71 | void wheelEvent (QWheelEvent *e); |
72 | void contentsDragEnterEvent(QDragEnterEvent *); | 72 | void contentsDragEnterEvent(QDragEnterEvent *); |
73 | void contentsDragMoveEvent(QDragMoveEvent *); | 73 | void contentsDragMoveEvent(QDragMoveEvent *); |
74 | void contentsDragLeaveEvent(QDragLeaveEvent *); | 74 | void contentsDragLeaveEvent(QDragLeaveEvent *); |
75 | void contentsDropEvent(QDropEvent *); | 75 | void contentsDropEvent(QDropEvent *); |
76 | 76 | ||
77 | void contentsMousePressEvent(QMouseEvent *); | 77 | void contentsMousePressEvent(QMouseEvent *); |
78 | void contentsMouseMoveEvent(QMouseEvent *); | 78 | void contentsMouseMoveEvent(QMouseEvent *); |
79 | void contentsMouseReleaseEvent(QMouseEvent *); | 79 | void contentsMouseReleaseEvent(QMouseEvent *); |
80 | void contentsMouseDoubleClickEvent(QMouseEvent *); | 80 | void contentsMouseDoubleClickEvent(QMouseEvent *); |
81 | 81 | ||
82 | private: | 82 | private: |
83 | void paintEvent(QPaintEvent * pevent); | 83 | void paintEvent(QPaintEvent * pevent); |
84 | bool internalDrop; | 84 | bool internalDrop; |
85 | QString mName; | 85 | QString mName; |
86 | Calendar *mCalendar; | 86 | Calendar *mCalendar; |
87 | QPoint mPressPos; | 87 | QPoint mPressPos; |
88 | bool mMousePressed; | 88 | bool mMousePressed; |
89 | QListViewItem *mOldCurrent; | 89 | QListViewItem *mOldCurrent; |
90 | bool mFlagKeyPressed; | 90 | bool mFlagKeyPressed; |
91 | void keyPressEvent ( QKeyEvent * ) ; | 91 | void keyPressEvent ( QKeyEvent * ) ; |
92 | void keyReleaseEvent ( QKeyEvent * ) ; | 92 | void keyReleaseEvent ( QKeyEvent * ) ; |
93 | }; | 93 | }; |
94 | 94 | ||
95 | 95 | ||
96 | /** | 96 | /** |
97 | This is the line-edit on top of the todoview for fast addition of new todos | 97 | This is the line-edit on top of the todoview for fast addition of new todos |
98 | */ | 98 | */ |
99 | class KOQuickTodo : public QLineEdit | 99 | class KOQuickTodo : public QLineEdit |
100 | { | 100 | { |
101 | public: | 101 | public: |
102 | KOQuickTodo(QWidget *parent=0); | 102 | KOQuickTodo(QWidget *parent=0); |
103 | protected: | 103 | protected: |
104 | void focusInEvent(QFocusEvent *ev); | 104 | void focusInEvent(QFocusEvent *ev); |
105 | void focusOutEvent(QFocusEvent *ev); | 105 | void focusOutEvent(QFocusEvent *ev); |
106 | }; | 106 | }; |
107 | 107 | ||
108 | 108 | ||
109 | /** | 109 | /** |
110 | This class provides a multi-column list view of todo events. | 110 | This class provides a multi-column list view of todo events. |
111 | 111 | ||
112 | @short multi-column list view of todo events. | 112 | @short multi-column list view of todo events. |
113 | @author Cornelius Schumacher <schumacher@kde.org> | 113 | @author Cornelius Schumacher <schumacher@kde.org> |
114 | */ | 114 | */ |
115 | class KOTodoView : public KOrg::BaseView | 115 | class KOTodoView : public KOrg::BaseView |
116 | { | 116 | { |
117 | Q_OBJECT | 117 | Q_OBJECT |
118 | public: | 118 | public: |
119 | KOTodoView(Calendar *, QWidget* parent=0, const char* name=0 ); | 119 | KOTodoView(Calendar *, QWidget* parent=0, const char* name=0 ); |
120 | ~KOTodoView(); | 120 | ~KOTodoView(); |
121 | 121 | ||
122 | QPtrList<Incidence> selectedIncidences(); | 122 | QPtrList<Incidence> selectedIncidences(); |
123 | QPtrList<Todo> selectedTodos(); | 123 | QPtrList<Todo> selectedTodos(); |
124 | 124 | ||
125 | DateList selectedDates() | 125 | DateList selectedDates() |
126 | {DateList q; | 126 | {DateList q; |
127 | return q;} | 127 | return q;} |
128 | 128 | ||
129 | /** Return number of shown dates. TodoView does not show dates, */ | 129 | /** Return number of shown dates. TodoView does not show dates, */ |
130 | int currentDateCount() { return 0; } | 130 | int currentDateCount() { return 0; } |
131 | 131 | ||
132 | void printPreview(CalPrinter *calPrinter, const QDate &fd, const QDate &td); | 132 | void printPreview(CalPrinter *calPrinter, const QDate &fd, const QDate &td); |
133 | 133 | ||
134 | void setDocumentId( const QString & ); | 134 | void setDocumentId( const QString & ); |
135 | 135 | ||
136 | void saveLayout(KConfig *config, const QString &group) const; | 136 | void saveLayout(KConfig *config, const QString &group) const; |
137 | void restoreLayout(KConfig *config, const QString &group); | 137 | void restoreLayout(KConfig *config, const QString &group); |
138 | /** Create a popup menu to set categories */ | 138 | /** Create a popup menu to set categories */ |
139 | QPopupMenu *getCategoryPopupMenu (KOTodoViewItem *todoItem); | 139 | QPopupMenu *getCategoryPopupMenu (KOTodoViewItem *todoItem); |
140 | void setNavigator( DateNavigator* nav ) {mNavigator = nav;} | 140 | void setNavigator( DateNavigator* nav ) {mNavigator = nav;} |
141 | QString getWhatsThisText(QPoint p); | 141 | QString getWhatsThisText(QPoint p); |
142 | 142 | ||
143 | public slots: | 143 | public slots: |
144 | void updateView(); | 144 | void updateView(); |
145 | void updateConfig(); | 145 | void updateConfig(); |
146 | 146 | ||
147 | void changeEventDisplay(Event *, int); | 147 | void changeEventDisplay(Event *, int); |
148 | 148 | ||
149 | void showDates(const QDate &start, const QDate &end); | 149 | void showDates(const QDate &start, const QDate &end); |
150 | void showEvents(QPtrList<Event> eventList); | 150 | void showEvents(QPtrList<Event> eventList); |
151 | 151 | ||
152 | void clearSelection(); | 152 | void clearSelection(); |
153 | void jumpToDate (); | 153 | void jumpToDate (); |
154 | 154 | ||
155 | void editItem(QListViewItem *item); | 155 | void editItem(QListViewItem *item); |
156 | void showItem(QListViewItem *item,const QPoint &,int); | 156 | void showItem(QListViewItem *item,const QPoint &,int); |
157 | void popupMenu(QListViewItem *item,const QPoint &,int); | 157 | void popupMenu(QListViewItem *item,const QPoint &,int); |
158 | void newTodo(); | 158 | void newTodo(); |
159 | void newSubTodo(); | 159 | void newSubTodo(); |
160 | void unparentTodo(); | 160 | void unparentTodo(); |
161 | void reparentTodo(); | 161 | void reparentTodo(); |
162 | void showTodo(); | 162 | void showTodo(); |
163 | void editTodo(); | 163 | void editTodo(); |
164 | void cloneTodo(); | 164 | void cloneTodo(); |
165 | void cancelTodo(); | 165 | void cancelTodo(); |
166 | void moveTodo(); | 166 | void moveTodo(); |
167 | void beamTodo(); | 167 | void beamTodo(); |
168 | void deleteTodo(); | 168 | void deleteTodo(); |
169 | 169 | ||
170 | void setNewPriority(int); | 170 | void setNewPriority(int); |
171 | void setNewPercentage(int); | 171 | void setNewPercentage(int); |
172 | void changedCategories(int); | 172 | void changedCategories(int); |
173 | 173 | ||
174 | void setAllOpen(); | 174 | void setAllOpen(); |
175 | void setAllClose(); | 175 | void setAllClose(); |
176 | void setAllFlat(); | 176 | void setAllFlat(); |
177 | void displayAllFlat(); | 177 | void displayAllFlat(); |
178 | 178 | ||
179 | void purgeCompleted(); | 179 | void purgeCompleted(); |
180 | void toggleCompleted(); | 180 | void toggleCompleted(); |
181 | void toggleRunning(); | 181 | void toggleRunning(); |
182 | void toggleQuickTodo(); | 182 | void toggleQuickTodo(); |
183 | void updateTodo( Todo *, int ); | 183 | void updateTodo( Todo *, int ); |
184 | 184 | ||
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 | ||
233 | bool checkTodo( Todo * ); | 234 | bool checkTodo( Todo * ); |
234 | bool isFlatDisplay; | 235 | bool isFlatDisplay; |
235 | void setOpen( QListViewItem*, bool setOpen); | 236 | void setOpen( QListViewItem*, bool setOpen); |
236 | KOTodoListView *mTodoListView; | 237 | KOTodoListView *mTodoListView; |
237 | QPopupMenu *mItemPopupMenu; | 238 | QPopupMenu *mItemPopupMenu; |
238 | QPopupMenu *mPopupMenu; | 239 | QPopupMenu *mPopupMenu; |
239 | QPopupMenu *mPriorityPopupMenu; | 240 | QPopupMenu *mPriorityPopupMenu; |
240 | QPopupMenu *mPercentageCompletedPopupMenu; | 241 | QPopupMenu *mPercentageCompletedPopupMenu; |
241 | QPopupMenu *mCategoryPopupMenu; | 242 | QPopupMenu *mCategoryPopupMenu; |
242 | 243 | ||
243 | QMap<int, int> mPercentage; | 244 | QMap<int, int> mPercentage; |
244 | QMap<int, int> mPriority; | 245 | QMap<int, int> mPriority; |
245 | QMap<int, QString> mCategory; | 246 | QMap<int, QString> mCategory; |
246 | KOTodoViewItem *mActiveItem; | 247 | KOTodoViewItem *mActiveItem; |
247 | 248 | ||
248 | QMap<Todo *,KOTodoViewItem *> mTodoMap; | 249 | QMap<Todo *,KOTodoViewItem *> mTodoMap; |
249 | QString mName; | 250 | QString mName; |
250 | 251 | ||
251 | DocPrefs *mDocPrefs; | 252 | DocPrefs *mDocPrefs; |
252 | QString mCurrentDoc; | 253 | QString mCurrentDoc; |
253 | KOQuickTodo *mQuickAdd; | 254 | KOQuickTodo *mQuickAdd; |
254 | bool mBlockUpdate; | 255 | bool mBlockUpdate; |
255 | void keyPressEvent ( QKeyEvent * ) ; | 256 | void keyPressEvent ( QKeyEvent * ) ; |
256 | KOTodoViewItem * pendingSubtodo; | 257 | KOTodoViewItem * pendingSubtodo; |
257 | DateNavigator* mNavigator; | 258 | DateNavigator* mNavigator; |
258 | void storeCurrentItem(); | 259 | void storeCurrentItem(); |
259 | void resetCurrentItem(); | 260 | void resetCurrentItem(); |
260 | Incidence * mCurItem, *mCurItemRootParent, *mCurItemParent,*mCurItemAbove; | 261 | Incidence * mCurItem, *mCurItemRootParent, *mCurItemParent,*mCurItemAbove; |
261 | }; | 262 | }; |
262 | 263 | ||
263 | #endif | 264 | #endif |
diff --git a/korganizer/kotodoviewitem.cpp b/korganizer/kotodoviewitem.cpp index 6559119..66f8d06 100644 --- a/korganizer/kotodoviewitem.cpp +++ b/korganizer/kotodoviewitem.cpp | |||
@@ -1,502 +1,522 @@ | |||
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 { |
47 | return *it; | 48 | return *it; |
48 | } | 49 | } |
49 | } | 50 | } |
50 | 51 | ||
51 | void KOTodoViewItem:: setup() | 52 | void KOTodoViewItem:: setup() |
52 | { | 53 | { |
53 | 54 | ||
54 | int h = 20; | 55 | int h = 20; |
55 | if ( listView () ) { | 56 | if ( listView () ) { |
56 | QFontMetrics fm ( listView ()->font () ); | 57 | QFontMetrics fm ( listView ()->font () ); |
57 | h = fm.height(); | 58 | h = fm.height(); |
58 | } | 59 | } |
59 | setHeight( h ); | 60 | setHeight( h ); |
60 | 61 | ||
61 | } | 62 | } |
62 | void KOTodoViewItem::setSortKey(int column,const QString &key) | 63 | void KOTodoViewItem::setSortKey(int column,const QString &key) |
63 | { | 64 | { |
64 | mKeyMap.insert(column,key); | 65 | mKeyMap.insert(column,key); |
65 | } | 66 | } |
66 | 67 | ||
67 | #if QT_VERSION >= 0x030000 | 68 | #if QT_VERSION >= 0x030000 |
68 | void KOTodoViewItem::paintBranches(QPainter *p,const QColorGroup & cg,int w, | 69 | void KOTodoViewItem::paintBranches(QPainter *p,const QColorGroup & cg,int w, |
69 | int y,int h) | 70 | int y,int h) |
70 | { | 71 | { |
71 | QListViewItem::paintBranches(p,cg,w,y,h); | 72 | QListViewItem::paintBranches(p,cg,w,y,h); |
72 | } | 73 | } |
73 | #else | 74 | #else |
74 | #endif | 75 | #endif |
75 | 76 | ||
76 | void KOTodoViewItem::construct() | 77 | void KOTodoViewItem::construct() |
77 | { | 78 | { |
78 | // qDebug("KOTodoViewItem::construct() "); | 79 | // qDebug("KOTodoViewItem::construct() "); |
79 | m_init = true; | 80 | m_init = true; |
80 | QString keyd = "=="; | 81 | QString keyd = "=="; |
81 | QString keyt = "=="; | 82 | QString keyt = "=="; |
82 | QString skeyd = "=="; | 83 | QString skeyd = "=="; |
83 | QString skeyt = "=="; | 84 | QString skeyt = "=="; |
84 | 85 | ||
85 | setOn(mTodo->isCompleted()); | 86 | setOn(mTodo->isCompleted()); |
86 | setText(0,mTodo->summary()); | 87 | setText(0,mTodo->summary()); |
87 | setText(1,QString::number(mTodo->priority())); | 88 | setText(1,QString::number(mTodo->priority())); |
88 | setText(2,i18n("%1 %").arg(QString::number(mTodo->percentComplete()))); | 89 | setText(2,i18n("%1 %").arg(QString::number(mTodo->percentComplete()))); |
89 | if (mTodo->percentComplete()<100) { | 90 | if (mTodo->percentComplete()<100) { |
90 | if (mTodo->isCompleted()) setSortKey(2,QString::number(999)); | 91 | if (mTodo->isCompleted()) setSortKey(2,QString::number(999)); |
91 | else setSortKey(2,QString::number(mTodo->percentComplete())); | 92 | else setSortKey(2,QString::number(mTodo->percentComplete())); |
92 | } | 93 | } |
93 | else { | 94 | else { |
94 | if (mTodo->isCompleted()) setSortKey(2,QString::number(999)); | 95 | if (mTodo->isCompleted()) setSortKey(2,QString::number(999)); |
95 | else setSortKey(2,QString::number(99)); | 96 | else setSortKey(2,QString::number(99)); |
96 | } | 97 | } |
97 | if (mTodo->hasDueDate()) { | 98 | if (mTodo->hasDueDate()) { |
98 | setText(3, mTodo->dtDueDateStr()); | 99 | setText(3, mTodo->dtDueDateStr()); |
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 | ||
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) { |
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(); |
165 | 177 | ||
166 | } | 178 | } |
167 | void KOTodoViewItem::setMyPixmap() | 179 | void KOTodoViewItem::setMyPixmap() |
168 | { | 180 | { |
169 | int size = 5; | 181 | int size = 5; |
170 | QPixmap pixi = QPixmap( 1, 1 ); | 182 | QPixmap pixi = QPixmap( 1, 1 ); |
171 | // if ( !mTodo->isCompleted() && mTodo->hasDueDate() && mTodo->dtDue() < QDateTime::currentDateTime() ) { | 183 | // if ( !mTodo->isCompleted() && mTodo->hasDueDate() && mTodo->dtDue() < QDateTime::currentDateTime() ) { |
172 | // pixi = SmallIcon("redcross16"); | 184 | // pixi = SmallIcon("redcross16"); |
173 | // } else { | 185 | // } else { |
174 | QPainter p; | 186 | QPainter p; |
175 | 187 | ||
176 | int pixSize = 0; | 188 | int pixSize = 0; |
177 | QPixmap pPix = QPixmap( size, size ); | 189 | QPixmap pPix = QPixmap( size, size ); |
178 | if ( mTodo->description().length() > 0 ) { | 190 | if ( mTodo->description().length() > 0 ) { |
179 | pixi.resize(size, pixSize+size); | 191 | pixi.resize(size, pixSize+size); |
180 | pPix.fill( Qt::darkGreen ); | 192 | pPix.fill( Qt::darkGreen ); |
181 | p.begin( &pixi ); | 193 | p.begin( &pixi ); |
182 | p. drawPixmap ( 0, pixSize, pPix); | 194 | p. drawPixmap ( 0, pixSize, pPix); |
183 | p.end(); | 195 | p.end(); |
184 | pixSize += size; | 196 | pixSize += size; |
185 | } | 197 | } |
186 | if ( mTodo->isAlarmEnabled() ) { | 198 | if ( mTodo->isAlarmEnabled() ) { |
187 | pixi.resize(size, pixSize+size); | 199 | pixi.resize(size, pixSize+size); |
188 | pPix.fill( Qt::red ); | 200 | pPix.fill( Qt::red ); |
189 | p.begin( &pixi ); | 201 | p.begin( &pixi ); |
190 | p. drawPixmap ( 0, pixSize, pPix); | 202 | p. drawPixmap ( 0, pixSize, pPix); |
191 | p.end(); | 203 | p.end(); |
192 | pixSize += size; | 204 | pixSize += size; |
193 | } | 205 | } |
194 | if ( mTodo->doesRecur() ) { | 206 | if ( mTodo->doesRecur() ) { |
195 | pixi.resize(size, pixSize+size); | 207 | pixi.resize(size, pixSize+size); |
196 | pPix.fill( Qt::blue ); | 208 | pPix.fill( Qt::blue ); |
197 | p.begin( &pixi ); | 209 | p.begin( &pixi ); |
198 | p. drawPixmap ( 0, pixSize, pPix); | 210 | p. drawPixmap ( 0, pixSize, pPix); |
199 | p.end(); | 211 | p.end(); |
200 | pixSize += size; | 212 | pixSize += size; |
201 | } | 213 | } |
202 | // } | 214 | // } |
203 | if ( pixi.width() > 1 ) { | 215 | if ( pixi.width() > 1 ) { |
204 | setPixmap ( 0,pixi ) ; | 216 | setPixmap ( 0,pixi ) ; |
205 | } else { | 217 | } else { |
206 | setPixmap ( 0,QPixmap() ) ; | 218 | setPixmap ( 0,QPixmap() ) ; |
207 | } | 219 | } |
208 | } | 220 | } |
209 | void KOTodoViewItem::stateChange(bool state) | 221 | void KOTodoViewItem::stateChange(bool state) |
210 | { | 222 | { |
211 | // qDebug("KOTodoViewItem::stateChange %d ", state); | 223 | // qDebug("KOTodoViewItem::stateChange %d ", state); |
212 | // do not change setting on startup | 224 | // do not change setting on startup |
213 | if ( m_init ) return; | 225 | if ( m_init ) return; |
214 | if (isOn()!=state) { | 226 | if (isOn()!=state) { |
215 | setOn(state); | 227 | setOn(state); |
216 | //qDebug("SETON "); | 228 | //qDebug("SETON "); |
217 | return; | 229 | return; |
218 | } | 230 | } |
219 | if ( mTodo->isCompleted() == state ) { | 231 | if ( mTodo->isCompleted() == state ) { |
220 | //qDebug("STATECHANGE:nothing to do "); | 232 | //qDebug("STATECHANGE:nothing to do "); |
221 | return; | 233 | return; |
222 | } | 234 | } |
223 | QString keyd = "=="; | 235 | QString keyd = "=="; |
224 | QString keyt = "=="; | 236 | QString keyt = "=="; |
225 | //qDebug("KOTodoViewItem::stateChange %s ", text(0).latin1()); | 237 | //qDebug("KOTodoViewItem::stateChange %s ", text(0).latin1()); |
226 | if ( mTodo->doesRecur() ){ | 238 | if ( mTodo->doesRecur() ){ |
227 | QDateTime start = mTodo->dtStart(); | 239 | QDateTime start = mTodo->dtStart(); |
228 | mTodo->setCompleted(state); | 240 | mTodo->setCompleted(state); |
229 | if ( start != mTodo->dtStart() ) { | 241 | if ( start != mTodo->dtStart() ) { |
230 | if ( state && !mTodo->isCompleted() ) { | 242 | if ( state && !mTodo->isCompleted() ) { |
231 | setOn( false ); | 243 | setOn( false ); |
232 | state = false; | 244 | state = false; |
233 | } | 245 | } |
234 | } | 246 | } |
235 | } else | 247 | } else |
236 | mTodo->setCompleted(state); | 248 | mTodo->setCompleted(state); |
237 | 249 | ||
238 | if (state) mTodo->setCompleted(QDateTime::currentDateTime()); | 250 | if (state) mTodo->setCompleted(QDateTime::currentDateTime()); |
239 | 251 | ||
240 | if (mTodo->hasDueDate()) { | 252 | if (mTodo->hasDueDate()) { |
241 | setText(3, mTodo->dtDueDateStr()); | 253 | setText(3, mTodo->dtDueDateStr()); |
242 | QDate d = mTodo->dtDue().date(); | 254 | QDate d = mTodo->dtDue().date(); |
243 | keyd.sprintf("%04d%02d%02d",d.year(),d.month(),d.day()); | 255 | keyd.sprintf("%04d%02d%02d",d.year(),d.month(),d.day()); |
244 | setSortKey(3,keyd); | 256 | setSortKey(3,keyd); |
245 | if (mTodo->doesFloat()) { | 257 | if (mTodo->doesFloat()) { |
246 | setText(4,""); | 258 | setText(4,""); |
247 | } | 259 | } |
248 | else { | 260 | else { |
249 | setText(4,mTodo->dtDueTimeStr()); | 261 | setText(4,mTodo->dtDueTimeStr()); |
250 | QTime t = mTodo->dtDue().time(); | 262 | QTime t = mTodo->dtDue().time(); |
251 | keyt.sprintf("%02d%02d",t.hour(),t.minute()); | 263 | keyt.sprintf("%02d%02d",t.hour(),t.minute()); |
252 | setSortKey(4,keyt); | 264 | setSortKey(4,keyt); |
253 | } | 265 | } |
254 | } | 266 | } |
255 | if (mTodo->hasStartDate()) { | 267 | if (mTodo->hasStartDate()) { |
256 | QString skeyt = "=="; | 268 | QString skeyt = "=="; |
257 | QString skeyd = "=="; | 269 | QString skeyd = "=="; |
258 | setText(5, mTodo->dtStartDateStr()); | 270 | setText(5, mTodo->dtStartDateStr()); |
259 | QDate d = mTodo->dtStart().date(); | 271 | QDate d = mTodo->dtStart().date(); |
260 | skeyd.sprintf("%04d%02d%02d",d.year(),d.month(),d.day()); | 272 | skeyd.sprintf("%04d%02d%02d",d.year(),d.month(),d.day()); |
261 | 273 | ||
262 | if (mTodo->doesFloat()) { | 274 | if (mTodo->doesFloat()) { |
263 | setText(6,""); | 275 | setText(6,""); |
264 | } | 276 | } |
265 | else { | 277 | else { |
266 | setText(6,mTodo->dtStartTimeStr()); | 278 | setText(6,mTodo->dtStartTimeStr()); |
267 | QTime t = mTodo->dtStart().time(); | 279 | QTime t = mTodo->dtStart().time(); |
268 | skeyt.sprintf("%02d%02d",t.hour(),t.minute()); | 280 | skeyt.sprintf("%02d%02d",t.hour(),t.minute()); |
269 | 281 | ||
270 | } | 282 | } |
271 | setSortKey(5,skeyd); | 283 | setSortKey(5,skeyd); |
272 | setSortKey(6,skeyt); | 284 | setSortKey(6,skeyt); |
273 | } | 285 | } |
274 | if (mTodo->isCompleted()) setSortKey(1,QString::number(9)+keyd+keyt); | 286 | if (mTodo->isCompleted()) setSortKey(1,QString::number(9)+keyd+keyt); |
275 | else setSortKey(1,QString::number(mTodo->priority())+keyd+keyt); | 287 | else setSortKey(1,QString::number(mTodo->priority())+keyd+keyt); |
276 | 288 | ||
277 | setText(2,i18n("%1 %").arg(QString::number(mTodo->percentComplete()))); | 289 | setText(2,i18n("%1 %").arg(QString::number(mTodo->percentComplete()))); |
278 | if (mTodo->percentComplete()<100) { | 290 | if (mTodo->percentComplete()<100) { |
279 | if (mTodo->isCompleted()) setSortKey(2,QString::number(999)); | 291 | if (mTodo->isCompleted()) setSortKey(2,QString::number(999)); |
280 | else setSortKey(2,QString::number(mTodo->percentComplete())); | 292 | else setSortKey(2,QString::number(mTodo->percentComplete())); |
281 | } | 293 | } |
282 | else { | 294 | else { |
283 | if (mTodo->isCompleted()) setSortKey(2,QString::number(999)); | 295 | if (mTodo->isCompleted()) setSortKey(2,QString::number(999)); |
284 | else setSortKey(2,QString::number(99)); | 296 | else setSortKey(2,QString::number(99)); |
285 | } | 297 | } |
286 | if ( state ) { | 298 | if ( state ) { |
287 | QListViewItem * myChild = firstChild(); | 299 | QListViewItem * myChild = firstChild(); |
288 | KOTodoViewItem *item; | 300 | KOTodoViewItem *item; |
289 | while( myChild ) { | 301 | while( myChild ) { |
290 | //qDebug("stateCH "); | 302 | //qDebug("stateCH "); |
291 | item = static_cast<KOTodoViewItem*>(myChild); | 303 | item = static_cast<KOTodoViewItem*>(myChild); |
292 | item->stateChange(state); | 304 | item->stateChange(state); |
293 | myChild = myChild->nextSibling(); | 305 | myChild = myChild->nextSibling(); |
294 | } | 306 | } |
295 | } else { | 307 | } else { |
296 | QListViewItem * myChild = parent(); | 308 | QListViewItem * myChild = parent(); |
297 | if ( myChild ) | 309 | if ( myChild ) |
298 | (static_cast<KOTodoViewItem*>(myChild))->stateChange(state); | 310 | (static_cast<KOTodoViewItem*>(myChild))->stateChange(state); |
299 | } | 311 | } |
300 | mTodoView->modified(true); | 312 | mTodoView->modified(true); |
301 | setMyPixmap(); | 313 | setMyPixmap(); |
302 | mTodoView->setTodoModified( mTodo ); | 314 | mTodoView->setTodoModified( mTodo ); |
303 | } | 315 | } |
304 | 316 | ||
305 | bool KOTodoViewItem::isAlternate() | 317 | bool KOTodoViewItem::isAlternate() |
306 | { | 318 | { |
307 | 319 | ||
308 | KOTodoListView *lv = static_cast<KOTodoListView *>(listView()); | 320 | KOTodoListView *lv = static_cast<KOTodoListView *>(listView()); |
309 | if (lv && lv->alternateBackground().isValid()) | 321 | if (lv && lv->alternateBackground().isValid()) |
310 | { | 322 | { |
311 | KOTodoViewItem *above = 0; | 323 | KOTodoViewItem *above = 0; |
312 | above = static_cast<KOTodoViewItem *>(itemAbove()); | 324 | above = static_cast<KOTodoViewItem *>(itemAbove()); |
313 | m_known = above ? above->m_known : true; | 325 | m_known = above ? above->m_known : true; |
314 | if (m_known) | 326 | if (m_known) |
315 | { | 327 | { |
316 | m_odd = above ? !above->m_odd : false; | 328 | m_odd = above ? !above->m_odd : false; |
317 | } | 329 | } |
318 | else | 330 | else |
319 | { | 331 | { |
320 | KOTodoViewItem *item; | 332 | KOTodoViewItem *item; |
321 | bool previous = true; | 333 | bool previous = true; |
322 | if (QListViewItem::parent()) | 334 | if (QListViewItem::parent()) |
323 | { | 335 | { |
324 | item = static_cast<KOTodoViewItem *>(QListViewItem::parent()); | 336 | item = static_cast<KOTodoViewItem *>(QListViewItem::parent()); |
325 | if (item) | 337 | if (item) |
326 | previous = item->m_odd; | 338 | previous = item->m_odd; |
327 | item = static_cast<KOTodoViewItem *>(QListViewItem::parent()->firstChild()); | 339 | item = static_cast<KOTodoViewItem *>(QListViewItem::parent()->firstChild()); |
328 | } | 340 | } |
329 | else | 341 | else |
330 | { | 342 | { |
331 | item = static_cast<KOTodoViewItem *>(lv->firstChild()); | 343 | item = static_cast<KOTodoViewItem *>(lv->firstChild()); |
332 | } | 344 | } |
333 | 345 | ||
334 | while(item) | 346 | while(item) |
335 | { | 347 | { |
336 | item->m_odd = previous = !previous; | 348 | item->m_odd = previous = !previous; |
337 | item->m_known = true; | 349 | item->m_known = true; |
338 | item = static_cast<KOTodoViewItem *>(item->nextSibling()); | 350 | item = static_cast<KOTodoViewItem *>(item->nextSibling()); |
339 | } | 351 | } |
340 | } | 352 | } |
341 | return m_odd; | 353 | return m_odd; |
342 | } | 354 | } |
343 | return false; | 355 | return false; |
344 | } | 356 | } |
345 | 357 | ||
346 | void KOTodoViewItem::paintCell(QPainter *p, const QColorGroup &cg, int column, int width, int alignment) | 358 | void KOTodoViewItem::paintCell(QPainter *p, const QColorGroup &cg, int column, int width, int alignment) |
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; |
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 | } |
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; |
403 | p->drawRect( 2, 2, width-4, height()-4); | 423 | p->drawRect( 2, 2, width-4, height()-4); |
404 | p->fillRect( 3, 3, progress, height()-6, | 424 | p->fillRect( 3, 3, progress, height()-6, |
405 | fc ); | 425 | fc ); |
406 | p->restore(); | 426 | p->restore(); |
407 | } else { | 427 | } else { |
408 | QCheckListItem::paintCell(p, _cg, column, width, alignment); | 428 | QCheckListItem::paintCell(p, _cg, column, width, alignment); |
409 | } | 429 | } |
410 | return; | 430 | return; |
411 | } | 431 | } |
412 | 432 | ||
413 | int align = alignment; | 433 | int align = alignment; |
414 | 434 | ||
415 | if ( !p ) | 435 | if ( !p ) |
416 | return; | 436 | return; |
417 | 437 | ||
418 | p->fillRect( 0, 0, width, height(), _cg.brush( QColorGroup::Base ) ); | 438 | p->fillRect( 0, 0, width, height(), _cg.brush( QColorGroup::Base ) ); |
419 | 439 | ||
420 | QListView *lv = listView(); | 440 | QListView *lv = listView(); |
421 | if ( !lv ) | 441 | if ( !lv ) |
422 | return; | 442 | return; |
423 | int marg = 2;//lv->itemMargin(); | 443 | int marg = 2;//lv->itemMargin(); |
424 | int r = 0; | 444 | int r = 0; |
425 | QCheckListItem::Type myType = QCheckListItem::CheckBox; | 445 | QCheckListItem::Type myType = QCheckListItem::CheckBox; |
426 | int BoxSize = 20; | 446 | int BoxSize = 20; |
427 | int boxOffset = 2; | 447 | int boxOffset = 2; |
428 | int xOffset = 2; | 448 | int xOffset = 2; |
429 | if (qApp->desktop()->width() < 300 ) { | 449 | if (qApp->desktop()->width() < 300 ) { |
430 | BoxSize = 14; | 450 | BoxSize = 14; |
431 | boxOffset = -1; | 451 | boxOffset = -1; |
432 | xOffset = 1; | 452 | xOffset = 1; |
433 | // marg = 0; | 453 | // marg = 0; |
434 | } | 454 | } |
435 | if ( height() < BoxSize ) { | 455 | if ( height() < BoxSize ) { |
436 | boxOffset = boxOffset - ((BoxSize - height())/2) ; | 456 | boxOffset = boxOffset - ((BoxSize - height())/2) ; |
437 | // qDebug("boxOffset %d height %d", boxOffset, height() ); | 457 | // qDebug("boxOffset %d height %d", boxOffset, height() ); |
438 | BoxSize = height(); | 458 | BoxSize = height(); |
439 | 459 | ||
440 | } | 460 | } |
441 | //bool winStyle = lv->style() == WindowsStyle; | 461 | //bool winStyle = lv->style() == WindowsStyle; |
442 | 462 | ||
443 | int lineStart = 5; | 463 | int lineStart = 5; |
444 | if ( myType == Controller ) { | 464 | if ( myType == Controller ) { |
445 | if ( !pixmap( 0 ) ) | 465 | if ( !pixmap( 0 ) ) |
446 | r += BoxSize + 4; | 466 | r += BoxSize + 4; |
447 | } else { | 467 | } else { |
448 | ASSERT( lv ); //### | 468 | ASSERT( lv ); //### |
449 | //QFontMetrics fm( lv->font() ); | 469 | //QFontMetrics fm( lv->font() ); |
450 | //int d = fm.height(); | 470 | //int d = fm.height(); |
451 | int x = 0; | 471 | int x = 0; |
452 | int y = (height() - BoxSize) / 2; | 472 | int y = (height() - BoxSize) / 2; |
453 | //p->setPen( QPen( _cg.text(), winStyle ? 2 : 1 ) ); | 473 | //p->setPen( QPen( _cg.text(), winStyle ? 2 : 1 ) ); |
454 | if ( myType == CheckBox ) { | 474 | if ( myType == CheckBox ) { |
455 | if ( isEnabled() ) | 475 | if ( isEnabled() ) |
456 | p->setPen( QPen( _cg.text(), 1 ) ); | 476 | p->setPen( QPen( _cg.text(), 1 ) ); |
457 | else | 477 | else |
458 | p->setPen( QPen( listView()->palette().color( QPalette::Disabled, QColorGroup::Text ), 1 ) ); | 478 | p->setPen( QPen( listView()->palette().color( QPalette::Disabled, QColorGroup::Text ), 1 ) ); |
459 | p->drawRect( x+marg, y+2, BoxSize-4, BoxSize-4 ); | 479 | p->drawRect( x+marg, y+2, BoxSize-4, BoxSize-4 ); |
460 | lineStart = x+marg; | 480 | lineStart = x+marg; |
461 | ///////////////////// | 481 | ///////////////////// |
462 | x++; | 482 | x++; |
463 | y++; | 483 | y++; |
464 | if ( isOn() ) { | 484 | if ( isOn() ) { |
465 | QPointArray a( 7*2 ); | 485 | QPointArray a( 7*2 ); |
466 | int i, xx, yy; | 486 | int i, xx, yy; |
467 | xx = x+xOffset+marg+(boxOffset/2); | 487 | xx = x+xOffset+marg+(boxOffset/2); |
468 | yy = y+5+boxOffset; | 488 | yy = y+5+boxOffset; |
469 | for ( i=0; i<3; i++ ) { | 489 | for ( i=0; i<3; i++ ) { |
470 | a.setPoint( 2*i, xx, yy ); | 490 | a.setPoint( 2*i, xx, yy ); |
471 | a.setPoint( 2*i+1, xx, yy+2 ); | 491 | a.setPoint( 2*i+1, xx, yy+2 ); |
472 | // qDebug(" "); | 492 | // qDebug(" "); |
473 | xx++; yy++; | 493 | xx++; yy++; |
474 | } | 494 | } |
475 | yy -= 2; | 495 | yy -= 2; |
476 | for ( i=3; i<7; i++ ) { | 496 | for ( i=3; i<7; i++ ) { |
477 | a.setPoint( 2*i, xx, yy ); | 497 | a.setPoint( 2*i, xx, yy ); |
478 | a.setPoint( 2*i+1, xx, yy+2 ); | 498 | a.setPoint( 2*i+1, xx, yy+2 ); |
479 | xx++; yy--; | 499 | xx++; yy--; |
480 | } | 500 | } |
481 | p->setPen( darkGreen ); | 501 | p->setPen( darkGreen ); |
482 | p->drawLineSegments( a ); | 502 | p->drawLineSegments( a ); |
483 | } | 503 | } |
484 | //////////////////////// | 504 | //////////////////////// |
485 | } | 505 | } |
486 | r += BoxSize + 4; | 506 | r += BoxSize + 4; |
487 | } | 507 | } |
488 | 508 | ||
489 | p->translate( r, 0 ); | 509 | p->translate( r, 0 ); |
490 | p->setPen( QPen( _cg.text() ) ); | 510 | p->setPen( QPen( _cg.text() ) ); |
491 | QListViewItem::paintCell( p, _cg, column, width - r, align ); | 511 | QListViewItem::paintCell( p, _cg, column, width - r, align ); |
492 | if ( mTodo->cancelled () ) { | 512 | if ( mTodo->cancelled () ) { |
493 | p->setPen( black ); | 513 | p->setPen( black ); |
494 | QRect br = p->boundingRect( 1,1,1,1,0,mTodo->summary() ); | 514 | QRect br = p->boundingRect( 1,1,1,1,0,mTodo->summary() ); |
495 | int wid = br.width() +lineStart; | 515 | int wid = br.width() +lineStart; |
496 | if ( wid > width-3 ) | 516 | if ( wid > width-3 ) |
497 | wid = width-3; | 517 | wid = width-3; |
498 | p->drawLine( lineStart, height()/2+1, wid, height()/2+1 ); | 518 | p->drawLine( lineStart, height()/2+1, wid, height()/2+1 ); |
499 | 519 | ||
500 | } | 520 | } |
501 | 521 | ||
502 | } | 522 | } |