-rw-r--r-- | korganizer/kolistview.cpp | 11 | ||||
-rw-r--r-- | korganizer/kolistview.h | 2 | ||||
-rw-r--r-- | korganizer/searchdialog.cpp | 1 |
3 files changed, 14 insertions, 0 deletions
diff --git a/korganizer/kolistview.cpp b/korganizer/kolistview.cpp index 0b2f9a4..22d9ac0 100644 --- a/korganizer/kolistview.cpp +++ b/korganizer/kolistview.cpp | |||
@@ -186,128 +186,129 @@ bool ListItemVisitor::visit(Todo *t) | |||
186 | if (t->doesFloat()) { | 186 | if (t->doesFloat()) { |
187 | mItem->setText(8,"---"); | 187 | mItem->setText(8,"---"); |
188 | } else { | 188 | } else { |
189 | mItem->setText(8,t->dtDueTimeStr()); | 189 | mItem->setText(8,t->dtDueTimeStr()); |
190 | } | 190 | } |
191 | } else { | 191 | } else { |
192 | mItem->setText(7,"---"); | 192 | mItem->setText(7,"---"); |
193 | mItem->setText(8,"---"); | 193 | mItem->setText(8,"---"); |
194 | } | 194 | } |
195 | mItem->setText(9, t->cancelled() ? i18n("Yes") : i18n("No")); | 195 | mItem->setText(9, t->cancelled() ? i18n("Yes") : i18n("No")); |
196 | mItem->setText(10,t->categoriesStr()); | 196 | mItem->setText(10,t->categoriesStr()); |
197 | mItem->setText(11, KOPrefs::instance()->calName( t->calID() )); | 197 | mItem->setText(11, KOPrefs::instance()->calName( t->calID() )); |
198 | 198 | ||
199 | QString key; | 199 | QString key; |
200 | QDate d; | 200 | QDate d; |
201 | if (t->hasDueDate()) { | 201 | if (t->hasDueDate()) { |
202 | d = t->dtDue().date(); | 202 | d = t->dtDue().date(); |
203 | QTime tm = t->doesFloat() ? QTime(0,0) : t->dtDue().time(); | 203 | QTime tm = t->doesFloat() ? QTime(0,0) : t->dtDue().time(); |
204 | key.sprintf("%04d%02d%02d%02d%02d",d.year(),d.month(),d.day(),tm.hour(),tm.minute()); | 204 | key.sprintf("%04d%02d%02d%02d%02d",d.year(),d.month(),d.day(),tm.hour(),tm.minute()); |
205 | mItem->setSortKey(7,key); | 205 | mItem->setSortKey(7,key); |
206 | } | 206 | } |
207 | if ( t->hasStartDate() ) { | 207 | if ( t->hasStartDate() ) { |
208 | d = t->dtStart().date(); | 208 | d = t->dtStart().date(); |
209 | QTime tm = t->doesFloat() ? QTime(0,0) : t->dtStart().time(); | 209 | QTime tm = t->doesFloat() ? QTime(0,0) : t->dtStart().time(); |
210 | key.sprintf("%04d%02d%02d%02d%02d",d.year(),d.month(),d.day(),tm.hour(),tm.minute()); | 210 | key.sprintf("%04d%02d%02d%02d%02d",d.year(),d.month(),d.day(),tm.hour(),tm.minute()); |
211 | mItem->setSortKey(1,key); | 211 | mItem->setSortKey(1,key); |
212 | } | 212 | } |
213 | return true; | 213 | return true; |
214 | } | 214 | } |
215 | 215 | ||
216 | bool ListItemVisitor::visit(Journal * j) | 216 | bool ListItemVisitor::visit(Journal * j) |
217 | { | 217 | { |
218 | QString des = j->description().left(30); | 218 | QString des = j->description().left(30); |
219 | des = des.simplifyWhiteSpace (); | 219 | des = des.simplifyWhiteSpace (); |
220 | des.replace (QRegExp ("\\n"),"" ); | 220 | des.replace (QRegExp ("\\n"),"" ); |
221 | des.replace (QRegExp ("\\r"),"" ); | 221 | des.replace (QRegExp ("\\r"),"" ); |
222 | mItem->setText(0,i18n("Journal: ")+des.left(25)); | 222 | mItem->setText(0,i18n("Journal: ")+des.left(25)); |
223 | mItem->setText(1,j->dtStartDateStr()); | 223 | mItem->setText(1,j->dtStartDateStr()); |
224 | mItem->setText(2,"---"); | 224 | mItem->setText(2,"---"); |
225 | mItem->setText(3,"---"); | 225 | mItem->setText(3,"---"); |
226 | mItem->setText(4,"---"); | 226 | mItem->setText(4,"---"); |
227 | mItem->setText(5,"---"); | 227 | mItem->setText(5,"---"); |
228 | mItem->setText(6,"---"); | 228 | mItem->setText(6,"---"); |
229 | mItem->setText(7,j->dtStartDateStr()); | 229 | mItem->setText(7,j->dtStartDateStr()); |
230 | mItem->setText(8,"---"); | 230 | mItem->setText(8,"---"); |
231 | mItem->setText(9,"---"); | 231 | mItem->setText(9,"---"); |
232 | mItem->setText(10,i18n("Last Modified: ")+ KGlobal::locale()->formatDateTime( j->lastModified() , true) ); | 232 | mItem->setText(10,i18n("Last Modified: ")+ KGlobal::locale()->formatDateTime( j->lastModified() , true) ); |
233 | mItem->setText(11, KOPrefs::instance()->calName( j->calID() )); | 233 | mItem->setText(11, KOPrefs::instance()->calName( j->calID() )); |
234 | 234 | ||
235 | QString key; | 235 | QString key; |
236 | QDate d = j->dtStart().date(); | 236 | QDate d = j->dtStart().date(); |
237 | key.sprintf("%04d%02d%02d",d.year(),d.month(),d.day()); | 237 | key.sprintf("%04d%02d%02d",d.year(),d.month(),d.day()); |
238 | mItem->setSortKey(1,key); | 238 | mItem->setSortKey(1,key); |
239 | mItem->setSortKey(7,key); | 239 | mItem->setSortKey(7,key); |
240 | 240 | ||
241 | return true; | 241 | return true; |
242 | } | 242 | } |
243 | 243 | ||
244 | KOListView::KOListView(Calendar *calendar, QWidget *parent, | 244 | KOListView::KOListView(Calendar *calendar, QWidget *parent, |
245 | const char *name) | 245 | const char *name) |
246 | : KOEventView(calendar, parent, name) | 246 | : KOEventView(calendar, parent, name) |
247 | { | 247 | { |
248 | 248 | ||
249 | mActiveItem = 0; | 249 | mActiveItem = 0; |
250 | mForceShowCompletedTodos = false; | ||
250 | mListView = new KOListViewListView(this); | 251 | mListView = new KOListViewListView(this); |
251 | mListView->addColumn(i18n("Summary")); | 252 | mListView->addColumn(i18n("Summary")); |
252 | mListView->addColumn(i18n("Start Date")); | 253 | mListView->addColumn(i18n("Start Date")); |
253 | mListView->addColumn(i18n("Start Time")); | 254 | mListView->addColumn(i18n("Start Time")); |
254 | mListView->addColumn(i18n("End Date")); | 255 | mListView->addColumn(i18n("End Date")); |
255 | mListView->addColumn(i18n("End Time")); | 256 | mListView->addColumn(i18n("End Time")); |
256 | mListView->addColumn(i18n("Alarm")); // alarm set? | 257 | mListView->addColumn(i18n("Alarm")); // alarm set? |
257 | mListView->addColumn(i18n("Recurs")); // recurs? | 258 | mListView->addColumn(i18n("Recurs")); // recurs? |
258 | mListView->addColumn(i18n("Due Date")); | 259 | mListView->addColumn(i18n("Due Date")); |
259 | mListView->addColumn(i18n("Due Time")); | 260 | mListView->addColumn(i18n("Due Time")); |
260 | mListView->addColumn(i18n("Cancelled")); | 261 | mListView->addColumn(i18n("Cancelled")); |
261 | mListView->addColumn(i18n("Categories")); | 262 | mListView->addColumn(i18n("Categories")); |
262 | mListView->addColumn(i18n("Calendar")); | 263 | mListView->addColumn(i18n("Calendar")); |
263 | 264 | ||
264 | mListView->setColumnAlignment(0,AlignLeft); | 265 | mListView->setColumnAlignment(0,AlignLeft); |
265 | mListView->setColumnAlignment(1,AlignLeft); | 266 | mListView->setColumnAlignment(1,AlignLeft); |
266 | mListView->setColumnAlignment(2,AlignHCenter); | 267 | mListView->setColumnAlignment(2,AlignHCenter); |
267 | mListView->setColumnAlignment(3,AlignLeft); | 268 | mListView->setColumnAlignment(3,AlignLeft); |
268 | mListView->setColumnAlignment(4,AlignHCenter); | 269 | mListView->setColumnAlignment(4,AlignHCenter); |
269 | mListView->setColumnAlignment(5,AlignLeft); | 270 | mListView->setColumnAlignment(5,AlignLeft); |
270 | mListView->setColumnAlignment(6,AlignLeft); | 271 | mListView->setColumnAlignment(6,AlignLeft); |
271 | mListView->setColumnAlignment(7,AlignLeft); | 272 | mListView->setColumnAlignment(7,AlignLeft); |
272 | mListView->setColumnAlignment(8,AlignLeft); | 273 | mListView->setColumnAlignment(8,AlignLeft); |
273 | mListView->setColumnAlignment(9,AlignLeft); | 274 | mListView->setColumnAlignment(9,AlignLeft); |
274 | mListView->setColumnAlignment(10,AlignLeft); | 275 | mListView->setColumnAlignment(10,AlignLeft); |
275 | mListView->setColumnAlignment(11,AlignLeft); | 276 | mListView->setColumnAlignment(11,AlignLeft); |
276 | mKOListViewWhatsThis = new KOListViewWhatsThis(mListView->viewport(),this); | 277 | mKOListViewWhatsThis = new KOListViewWhatsThis(mListView->viewport(),this); |
277 | 278 | ||
278 | int iii = 0; | 279 | int iii = 0; |
279 | for ( iii = 0; iii< 12 ; ++iii ) | 280 | for ( iii = 0; iii< 12 ; ++iii ) |
280 | mListView->setColumnWidthMode( iii, QListView::Manual ); | 281 | mListView->setColumnWidthMode( iii, QListView::Manual ); |
281 | 282 | ||
282 | QBoxLayout *layoutTop = new QVBoxLayout(this); | 283 | QBoxLayout *layoutTop = new QVBoxLayout(this); |
283 | layoutTop->addWidget(mListView); | 284 | layoutTop->addWidget(mListView); |
284 | mListView->setFont ( KOPrefs::instance()->mListViewFont ); | 285 | mListView->setFont ( KOPrefs::instance()->mListViewFont ); |
285 | mPopupMenu = eventPopup(); | 286 | mPopupMenu = eventPopup(); |
286 | mPopupMenu->addAdditionalItem(QIconSet(QPixmap()), | 287 | mPopupMenu->addAdditionalItem(QIconSet(QPixmap()), |
287 | i18n("Select all"),this, | 288 | i18n("Select all"),this, |
288 | SLOT(allSelection()),true); | 289 | SLOT(allSelection()),true); |
289 | mPopupMenu->addAdditionalItem(QIconSet(QPixmap()), | 290 | mPopupMenu->addAdditionalItem(QIconSet(QPixmap()), |
290 | i18n("Deselect all"),this, | 291 | i18n("Deselect all"),this, |
291 | SLOT(clearSelection()),true); | 292 | SLOT(clearSelection()),true); |
292 | mPopupMenu->addAdditionalItem(QIconSet(QPixmap()), | 293 | mPopupMenu->addAdditionalItem(QIconSet(QPixmap()), |
293 | i18n("Delete all selected"),this, | 294 | i18n("Delete all selected"),this, |
294 | SLOT(deleteAll()),true); | 295 | SLOT(deleteAll()),true); |
295 | 296 | ||
296 | mPopupMenu->addAdditionalItem(QIconSet(QPixmap()), | 297 | mPopupMenu->addAdditionalItem(QIconSet(QPixmap()), |
297 | i18n("Hide all selected"),this, | 298 | i18n("Hide all selected"),this, |
298 | SLOT(hideAll()),true); | 299 | SLOT(hideAll()),true); |
299 | 300 | ||
300 | mPopupMenu->insertSeparator(); | 301 | mPopupMenu->insertSeparator(); |
301 | #ifdef DESKTOP_VERSION | 302 | #ifdef DESKTOP_VERSION |
302 | mPopupMenu->addAdditionalItem(QIconSet(QPixmap()), | 303 | mPopupMenu->addAdditionalItem(QIconSet(QPixmap()), |
303 | i18n("Print complete list"),this, | 304 | i18n("Print complete list"),this, |
304 | SLOT(printList()),true); | 305 | SLOT(printList()),true); |
305 | mPopupMenu->insertSeparator(); | 306 | mPopupMenu->insertSeparator(); |
306 | #endif | 307 | #endif |
307 | mCalPopup = new QPopupMenu ( this ); | 308 | mCalPopup = new QPopupMenu ( this ); |
308 | mPopupMenu->insertItem( i18n("Set Calendar"), mCalPopup ); | 309 | mPopupMenu->insertItem( i18n("Set Calendar"), mCalPopup ); |
309 | 310 | ||
310 | QObject::connect(mCalPopup,SIGNAL(aboutToShow()),this, | 311 | QObject::connect(mCalPopup,SIGNAL(aboutToShow()),this, |
311 | SLOT( populateCalPopup() )); | 312 | SLOT( populateCalPopup() )); |
312 | QObject::connect(mCalPopup,SIGNAL(activated( int )),this, | 313 | QObject::connect(mCalPopup,SIGNAL(activated( int )),this, |
313 | SLOT( setCalendar( int ) )); | 314 | SLOT( setCalendar( int ) )); |
@@ -986,133 +987,143 @@ void KOListView::updateConfig() | |||
986 | { | 987 | { |
987 | 988 | ||
988 | mListView->setFont ( KOPrefs::instance()->mListViewFont ); | 989 | mListView->setFont ( KOPrefs::instance()->mListViewFont ); |
989 | updateView(); | 990 | updateView(); |
990 | 991 | ||
991 | } | 992 | } |
992 | void KOListView::setStartDate(const QDate &start) | 993 | void KOListView::setStartDate(const QDate &start) |
993 | { | 994 | { |
994 | mStartDate = start; | 995 | mStartDate = start; |
995 | } | 996 | } |
996 | 997 | ||
997 | void KOListView::showDates(const QDate &start, const QDate &end) | 998 | void KOListView::showDates(const QDate &start, const QDate &end) |
998 | { | 999 | { |
999 | clear(); | 1000 | clear(); |
1000 | mStartDate = start; | 1001 | mStartDate = start; |
1001 | QDate date = start; | 1002 | QDate date = start; |
1002 | QPtrList<Journal> j_list; | 1003 | QPtrList<Journal> j_list; |
1003 | while( date <= end ) { | 1004 | while( date <= end ) { |
1004 | addEvents(calendar()->events(date)); | 1005 | addEvents(calendar()->events(date)); |
1005 | addTodos(calendar()->todos(date)); | 1006 | addTodos(calendar()->todos(date)); |
1006 | Journal* jo = calendar()->journal(date); | 1007 | Journal* jo = calendar()->journal(date); |
1007 | if ( jo ) | 1008 | if ( jo ) |
1008 | j_list.append( jo ); | 1009 | j_list.append( jo ); |
1009 | date = date.addDays( 1 ); | 1010 | date = date.addDays( 1 ); |
1010 | } | 1011 | } |
1011 | addJournals(j_list); | 1012 | addJournals(j_list); |
1012 | emit incidenceSelected( 0 ); | 1013 | emit incidenceSelected( 0 ); |
1013 | updateView(); | 1014 | updateView(); |
1014 | 1015 | ||
1015 | } | 1016 | } |
1016 | 1017 | ||
1017 | void KOListView::addEvents(QPtrList<Event> eventList) | 1018 | void KOListView::addEvents(QPtrList<Event> eventList) |
1018 | { | 1019 | { |
1019 | 1020 | ||
1020 | Event *ev; | 1021 | Event *ev; |
1021 | for(ev = eventList.first(); ev; ev = eventList.next()) { | 1022 | for(ev = eventList.first(); ev; ev = eventList.next()) { |
1022 | addIncidence(ev); | 1023 | addIncidence(ev); |
1023 | } | 1024 | } |
1024 | if ( !mListView->currentItem() ){ | 1025 | if ( !mListView->currentItem() ){ |
1025 | updateView(); | 1026 | updateView(); |
1026 | } | 1027 | } |
1027 | } | 1028 | } |
1028 | 1029 | ||
1029 | void KOListView::addTodos(QPtrList<Todo> eventList) | 1030 | void KOListView::addTodos(QPtrList<Todo> eventList) |
1030 | { | 1031 | { |
1031 | Todo *ev; | 1032 | Todo *ev; |
1032 | for(ev = eventList.first(); ev; ev = eventList.next()) { | 1033 | for(ev = eventList.first(); ev; ev = eventList.next()) { |
1033 | addIncidence(ev); | 1034 | addIncidence(ev); |
1034 | } | 1035 | } |
1035 | if ( !mListView->currentItem() ){ | 1036 | if ( !mListView->currentItem() ){ |
1036 | updateView(); | 1037 | updateView(); |
1037 | } | 1038 | } |
1038 | } | 1039 | } |
1039 | void KOListView::addJournals(QPtrList<Journal> eventList) | 1040 | void KOListView::addJournals(QPtrList<Journal> eventList) |
1040 | { | 1041 | { |
1041 | Journal *ev; | 1042 | Journal *ev; |
1042 | for(ev = eventList.first(); ev; ev = eventList.next()) { | 1043 | for(ev = eventList.first(); ev; ev = eventList.next()) { |
1043 | addIncidence(ev); | 1044 | addIncidence(ev); |
1044 | } | 1045 | } |
1045 | if ( !mListView->currentItem() ){ | 1046 | if ( !mListView->currentItem() ){ |
1046 | updateView(); | 1047 | updateView(); |
1047 | } | 1048 | } |
1048 | } | 1049 | } |
1049 | 1050 | ||
1051 | void KOListView::showCompletedTodos() | ||
1052 | { | ||
1053 | mForceShowCompletedTodos = true; | ||
1054 | } | ||
1050 | void KOListView::addIncidence(Incidence *incidence) | 1055 | void KOListView::addIncidence(Incidence *incidence) |
1051 | { | 1056 | { |
1052 | if ( mUidDict.find( incidence->uid() ) ) return; | 1057 | if ( mUidDict.find( incidence->uid() ) ) return; |
1053 | 1058 | ||
1054 | // mListView->setFont ( KOPrefs::instance()->mListViewFont ); | 1059 | // mListView->setFont ( KOPrefs::instance()->mListViewFont ); |
1060 | if ( incidence->typeID() == todoID ) { | ||
1061 | if ( ! mForceShowCompletedTodos ) { | ||
1062 | if ( !KOPrefs::instance()->mShowCompletedTodo && ((Todo*)incidence)->isCompleted() ) | ||
1063 | return; | ||
1064 | } | ||
1065 | } | ||
1055 | mUidDict.insert( incidence->uid(), incidence ); | 1066 | mUidDict.insert( incidence->uid(), incidence ); |
1056 | KOListViewItem *item = new KOListViewItem( incidence, mListView ); | 1067 | KOListViewItem *item = new KOListViewItem( incidence, mListView ); |
1057 | ListItemVisitor v(item, mStartDate ); | 1068 | ListItemVisitor v(item, mStartDate ); |
1058 | if (incidence->accept(v)) { | 1069 | if (incidence->accept(v)) { |
1059 | return; | 1070 | return; |
1060 | } | 1071 | } |
1061 | else delete item; | 1072 | else delete item; |
1062 | } | 1073 | } |
1063 | 1074 | ||
1064 | void KOListView::showEvents(QPtrList<Event> eventList) | 1075 | void KOListView::showEvents(QPtrList<Event> eventList) |
1065 | { | 1076 | { |
1066 | clear(); | 1077 | clear(); |
1067 | 1078 | ||
1068 | addEvents(eventList); | 1079 | addEvents(eventList); |
1069 | 1080 | ||
1070 | // After new creation of list view no events are selected. | 1081 | // After new creation of list view no events are selected. |
1071 | emit incidenceSelected( 0 ); | 1082 | emit incidenceSelected( 0 ); |
1072 | } | 1083 | } |
1073 | int KOListView::count() | 1084 | int KOListView::count() |
1074 | { | 1085 | { |
1075 | return mListView->childCount(); | 1086 | return mListView->childCount(); |
1076 | } | 1087 | } |
1077 | 1088 | ||
1078 | void KOListView::changeEventDisplay(Event *event, int action) | 1089 | void KOListView::changeEventDisplay(Event *event, int action) |
1079 | { | 1090 | { |
1080 | KOListViewItem *item; | 1091 | KOListViewItem *item; |
1081 | 1092 | ||
1082 | switch(action) { | 1093 | switch(action) { |
1083 | case KOGlobals::EVENTADDED: | 1094 | case KOGlobals::EVENTADDED: |
1084 | addIncidence( event ); | 1095 | addIncidence( event ); |
1085 | break; | 1096 | break; |
1086 | case KOGlobals::EVENTEDITED: | 1097 | case KOGlobals::EVENTEDITED: |
1087 | item = getItemForEvent(event); | 1098 | item = getItemForEvent(event); |
1088 | if (item) { | 1099 | if (item) { |
1089 | mUidDict.remove( event->uid() ); | 1100 | mUidDict.remove( event->uid() ); |
1090 | delete item; | 1101 | delete item; |
1091 | addIncidence( event ); | 1102 | addIncidence( event ); |
1092 | } | 1103 | } |
1093 | break; | 1104 | break; |
1094 | case KOGlobals::EVENTDELETED: | 1105 | case KOGlobals::EVENTDELETED: |
1095 | item = getItemForEvent(event); | 1106 | item = getItemForEvent(event); |
1096 | if (item) { | 1107 | if (item) { |
1097 | mUidDict.remove( event->uid() ); | 1108 | mUidDict.remove( event->uid() ); |
1098 | delete item; | 1109 | delete item; |
1099 | } | 1110 | } |
1100 | break; | 1111 | break; |
1101 | default: | 1112 | default: |
1102 | ; | 1113 | ; |
1103 | } | 1114 | } |
1104 | } | 1115 | } |
1105 | 1116 | ||
1106 | KOListViewItem *KOListView::getItemForEvent(Incidence *event) | 1117 | KOListViewItem *KOListView::getItemForEvent(Incidence *event) |
1107 | { | 1118 | { |
1108 | KOListViewItem *item = (KOListViewItem *)mListView->firstChild(); | 1119 | KOListViewItem *item = (KOListViewItem *)mListView->firstChild(); |
1109 | while (item) { | 1120 | while (item) { |
1110 | if (item->data() == event) return item; | 1121 | if (item->data() == event) return item; |
1111 | item = (KOListViewItem *)item->nextSibling(); | 1122 | item = (KOListViewItem *)item->nextSibling(); |
1112 | } | 1123 | } |
1113 | return 0; | 1124 | return 0; |
1114 | } | 1125 | } |
1115 | 1126 | ||
1116 | void KOListView::defaultItemAction(QListViewItem *i) | 1127 | void KOListView::defaultItemAction(QListViewItem *i) |
1117 | { | 1128 | { |
1118 | KOListViewItem *item = static_cast<KOListViewItem *>( i ); | 1129 | KOListViewItem *item = static_cast<KOListViewItem *>( i ); |
diff --git a/korganizer/kolistview.h b/korganizer/kolistview.h index d384af0..bcef0f0 100644 --- a/korganizer/kolistview.h +++ b/korganizer/kolistview.h | |||
@@ -202,120 +202,122 @@ class ListItemVisitor : public Incidence::Visitor | |||
202 | This class provides a multi-column list view of events. It can | 202 | This class provides a multi-column list view of events. It can |
203 | display events from one particular day or several days, it doesn't | 203 | display events from one particular day or several days, it doesn't |
204 | matter. To use a view that only handles one day at a time, use | 204 | matter. To use a view that only handles one day at a time, use |
205 | KODayListView. | 205 | KODayListView. |
206 | 206 | ||
207 | @short multi-column list view of various events. | 207 | @short multi-column list view of various events. |
208 | @author Preston Brown <pbrown@kde.org> | 208 | @author Preston Brown <pbrown@kde.org> |
209 | @see KOBaseView, KODayListView | 209 | @see KOBaseView, KODayListView |
210 | */ | 210 | */ |
211 | class KOListView; | 211 | class KOListView; |
212 | 212 | ||
213 | class KOListViewListView : public KListView | 213 | class KOListViewListView : public KListView |
214 | { | 214 | { |
215 | Q_OBJECT | 215 | Q_OBJECT |
216 | public: | 216 | public: |
217 | KOListViewListView(KOListView * lv ); | 217 | KOListViewListView(KOListView * lv ); |
218 | bool hasMultiSelection(QListViewItem*); | 218 | bool hasMultiSelection(QListViewItem*); |
219 | void printList(); | 219 | void printList(); |
220 | signals: | 220 | signals: |
221 | void newEvent(); | 221 | void newEvent(); |
222 | void showIncidence( Incidence* ); | 222 | void showIncidence( Incidence* ); |
223 | public slots: | 223 | public slots: |
224 | void popupMenu(); | 224 | void popupMenu(); |
225 | private: | 225 | private: |
226 | QPoint mEventPos; | 226 | QPoint mEventPos; |
227 | QPoint mEventGlobalPos; | 227 | QPoint mEventGlobalPos; |
228 | QTimer* mPopupTimer; | 228 | QTimer* mPopupTimer; |
229 | int mYMousePos; | 229 | int mYMousePos; |
230 | void keyPressEvent ( QKeyEvent * ) ; | 230 | void keyPressEvent ( QKeyEvent * ) ; |
231 | void contentsMouseDoubleClickEvent(QMouseEvent *e); | 231 | void contentsMouseDoubleClickEvent(QMouseEvent *e); |
232 | void contentsMousePressEvent(QMouseEvent *e); | 232 | void contentsMousePressEvent(QMouseEvent *e); |
233 | void contentsMouseReleaseEvent(QMouseEvent *e); | 233 | void contentsMouseReleaseEvent(QMouseEvent *e); |
234 | void contentsMouseMoveEvent(QMouseEvent *e); | 234 | void contentsMouseMoveEvent(QMouseEvent *e); |
235 | bool mMouseDown; | 235 | bool mMouseDown; |
236 | }; | 236 | }; |
237 | 237 | ||
238 | class KOListView : public KOEventView | 238 | class KOListView : public KOEventView |
239 | { | 239 | { |
240 | Q_OBJECT | 240 | Q_OBJECT |
241 | public: | 241 | public: |
242 | KOListView(Calendar *calendar, QWidget *parent = 0, | 242 | KOListView(Calendar *calendar, QWidget *parent = 0, |
243 | const char *name = 0); | 243 | const char *name = 0); |
244 | ~KOListView(); | 244 | ~KOListView(); |
245 | 245 | ||
246 | virtual int maxDatesHint(); | 246 | virtual int maxDatesHint(); |
247 | virtual int currentDateCount(); | 247 | virtual int currentDateCount(); |
248 | virtual QPtrList<Incidence> selectedIncidences(); | 248 | virtual QPtrList<Incidence> selectedIncidences(); |
249 | virtual DateList selectedDates(); | 249 | virtual DateList selectedDates(); |
250 | 250 | ||
251 | void showDates(bool show); | 251 | void showDates(bool show); |
252 | Incidence* currentItem(); | 252 | Incidence* currentItem(); |
253 | void addTodos(QPtrList<Todo> eventList); | 253 | void addTodos(QPtrList<Todo> eventList); |
254 | void addJournals(QPtrList<Journal> eventList); | 254 | void addJournals(QPtrList<Journal> eventList); |
255 | virtual void printPreview(CalPrinter *calPrinter, | 255 | virtual void printPreview(CalPrinter *calPrinter, |
256 | const QDate &, const QDate &); | 256 | const QDate &, const QDate &); |
257 | 257 | ||
258 | void readSettings(KConfig *config, QString setting = "KOListView Layout"); | 258 | void readSettings(KConfig *config, QString setting = "KOListView Layout"); |
259 | void writeSettings(KConfig *config, QString setting = "KOListView Layout"); | 259 | void writeSettings(KConfig *config, QString setting = "KOListView Layout"); |
260 | void updateList(); | 260 | void updateList(); |
261 | void clearList(); | 261 | void clearList(); |
262 | void setStartDate(const QDate &start); | 262 | void setStartDate(const QDate &start); |
263 | int count(); | 263 | int count(); |
264 | QString getWhatsThisText(QPoint p); | 264 | QString getWhatsThisText(QPoint p); |
265 | QPtrList<Incidence> KOListView::getSelectedIncidences( bool includeEvents = true, bool includeTodos = true , bool includeJournals = true, bool onlyDueTodos = false ); | 265 | QPtrList<Incidence> KOListView::getSelectedIncidences( bool includeEvents = true, bool includeTodos = true , bool includeJournals = true, bool onlyDueTodos = false ); |
266 | void showCompletedTodos(); | ||
266 | signals: | 267 | signals: |
267 | void signalNewEvent(); | 268 | void signalNewEvent(); |
268 | void beamIncidenceList(QPtrList<Incidence>); | 269 | void beamIncidenceList(QPtrList<Incidence>); |
269 | 270 | ||
270 | public slots: | 271 | public slots: |
271 | void hideAll(); | 272 | void hideAll(); |
272 | void printList(); | 273 | void printList(); |
273 | void resetFocus(); | 274 | void resetFocus(); |
274 | virtual void updateView(); | 275 | virtual void updateView(); |
275 | virtual void showDates(const QDate &start, const QDate &end); | 276 | virtual void showDates(const QDate &start, const QDate &end); |
276 | virtual void showEvents(QPtrList<Event> eventList); | 277 | virtual void showEvents(QPtrList<Event> eventList); |
277 | void clearSelection(); | 278 | void clearSelection(); |
278 | void allSelection(); | 279 | void allSelection(); |
279 | 280 | ||
280 | void clear(); | 281 | void clear(); |
281 | void beamDone( Ir *ir ); | 282 | void beamDone( Ir *ir ); |
282 | void showDates(); | 283 | void showDates(); |
283 | void hideDates(); | 284 | void hideDates(); |
284 | void deleteAll(); | 285 | void deleteAll(); |
285 | void saveToFile(); | 286 | void saveToFile(); |
286 | void saveToFileVCS(); | 287 | void saveToFileVCS(); |
287 | void saveDescriptionToFile(); | 288 | void saveDescriptionToFile(); |
288 | void beamSelected(); | 289 | void beamSelected(); |
289 | void updateConfig(); | 290 | void updateConfig(); |
290 | void addCat(); | 291 | void addCat(); |
291 | void setCat(); | 292 | void setCat(); |
292 | void setAlarm(); | 293 | void setAlarm(); |
293 | void setCategories( bool removeOld ); | 294 | void setCategories( bool removeOld ); |
294 | void changeEventDisplay(Event *, int); | 295 | void changeEventDisplay(Event *, int); |
295 | 296 | ||
296 | void defaultItemAction(QListViewItem *item); | 297 | void defaultItemAction(QListViewItem *item); |
297 | void popupMenu(QListViewItem *item,const QPoint &,int); | 298 | void popupMenu(QListViewItem *item,const QPoint &,int); |
298 | void setCalendar( int c ); | 299 | void setCalendar( int c ); |
299 | void populateCalPopup(); | 300 | void populateCalPopup(); |
300 | 301 | ||
301 | protected slots: | 302 | protected slots: |
302 | void processSelectionChange(QListViewItem *); | 303 | void processSelectionChange(QListViewItem *); |
303 | 304 | ||
304 | protected: | 305 | protected: |
305 | void writeToFile( bool iCal ); | 306 | void writeToFile( bool iCal ); |
306 | void addEvents(QPtrList<Event> eventList); | 307 | void addEvents(QPtrList<Event> eventList); |
307 | void addIncidence(Incidence *); | 308 | void addIncidence(Incidence *); |
308 | KOListViewItem *getItemForEvent(Incidence *event); | 309 | KOListViewItem *getItemForEvent(Incidence *event); |
309 | 310 | ||
310 | private: | 311 | private: |
312 | bool mForceShowCompletedTodos; | ||
311 | QPopupMenu* mCalPopup; | 313 | QPopupMenu* mCalPopup; |
312 | KOListViewWhatsThis *mKOListViewWhatsThis; | 314 | KOListViewWhatsThis *mKOListViewWhatsThis; |
313 | KOListViewListView *mListView; | 315 | KOListViewListView *mListView; |
314 | KOEventPopupMenu *mPopupMenu; | 316 | KOEventPopupMenu *mPopupMenu; |
315 | KOListViewItem *mActiveItem; | 317 | KOListViewItem *mActiveItem; |
316 | QDict<Incidence> mUidDict; | 318 | QDict<Incidence> mUidDict; |
317 | QDate mStartDate; | 319 | QDate mStartDate; |
318 | void keyPressEvent ( QKeyEvent * ) ; | 320 | void keyPressEvent ( QKeyEvent * ) ; |
319 | }; | 321 | }; |
320 | 322 | ||
321 | #endif | 323 | #endif |
diff --git a/korganizer/searchdialog.cpp b/korganizer/searchdialog.cpp index bba49f0..a8de297 100644 --- a/korganizer/searchdialog.cpp +++ b/korganizer/searchdialog.cpp | |||
@@ -77,128 +77,129 @@ SearchDialog::SearchDialog(Calendar *calendar,CalendarView *parent) | |||
77 | fo.setBold( true ); | 77 | fo.setBold( true ); |
78 | fo.setPointSize( fo.pointSize() + 2 ); | 78 | fo.setPointSize( fo.pointSize() + 2 ); |
79 | mAddItems->setFont( fo ); | 79 | mAddItems->setFont( fo ); |
80 | mSubItems->setFont( fo ); | 80 | mSubItems->setFont( fo ); |
81 | mRefineItems->setFont( fo ); | 81 | mRefineItems->setFont( fo ); |
82 | connect( mAddItems , SIGNAL( toggled ( bool ) ),this,SLOT(slot_add( bool ))); | 82 | connect( mAddItems , SIGNAL( toggled ( bool ) ),this,SLOT(slot_add( bool ))); |
83 | connect( mSubItems , SIGNAL( toggled ( bool ) ),this,SLOT(slot_sub( bool ))); | 83 | connect( mSubItems , SIGNAL( toggled ( bool ) ),this,SLOT(slot_sub( bool ))); |
84 | connect( mRefineItems , SIGNAL( toggled ( bool ) ),this,SLOT(slot_refine( bool ))); | 84 | connect( mRefineItems , SIGNAL( toggled ( bool ) ),this,SLOT(slot_refine( bool ))); |
85 | 85 | ||
86 | QPushButton *togButton = new QPushButton( "", topFrame ); | 86 | QPushButton *togButton = new QPushButton( "", topFrame ); |
87 | subLayout->addWidget(togButton); | 87 | subLayout->addWidget(togButton); |
88 | connect(togButton,SIGNAL(clicked()),SLOT(toggleCheckboxes())); | 88 | connect(togButton,SIGNAL(clicked()),SLOT(toggleCheckboxes())); |
89 | togButton->setPixmap(SmallIcon("1updownarrow")); | 89 | togButton->setPixmap(SmallIcon("1updownarrow")); |
90 | togButton->setMinimumWidth( togButton->sizeHint().height() ); | 90 | togButton->setMinimumWidth( togButton->sizeHint().height() ); |
91 | 91 | ||
92 | searchEdit->setText("*"); // Find all events by default | 92 | searchEdit->setText("*"); // Find all events by default |
93 | searchEdit->setFocus(); | 93 | searchEdit->setFocus(); |
94 | connect(searchEdit, SIGNAL(textChanged ( const QString & )),this,SLOT(searchTextChanged( const QString & ))); | 94 | connect(searchEdit, SIGNAL(textChanged ( const QString & )),this,SLOT(searchTextChanged( const QString & ))); |
95 | connect(searchEdit, SIGNAL( returnPressed () ),this,SLOT(doSearch())); | 95 | connect(searchEdit, SIGNAL( returnPressed () ),this,SLOT(doSearch())); |
96 | // Subjects to search | 96 | // Subjects to search |
97 | // QGroupBox *subjectGroup = new QGroupBox(1,Vertical,i18n("Search In"), | 97 | // QGroupBox *subjectGroup = new QGroupBox(1,Vertical,i18n("Search In"), |
98 | // topFrame); | 98 | // topFrame); |
99 | 99 | ||
100 | incidenceGroup = new QHBox( topFrame ); | 100 | incidenceGroup = new QHBox( topFrame ); |
101 | layout->addWidget(incidenceGroup); | 101 | layout->addWidget(incidenceGroup); |
102 | 102 | ||
103 | mSearchEvent = new QCheckBox(i18n("Events"),incidenceGroup); | 103 | mSearchEvent = new QCheckBox(i18n("Events"),incidenceGroup); |
104 | //mSearchEvent->setChecked(true); | 104 | //mSearchEvent->setChecked(true); |
105 | mSearchTodo = new QCheckBox(i18n("Todos"),incidenceGroup); | 105 | mSearchTodo = new QCheckBox(i18n("Todos"),incidenceGroup); |
106 | mSearchJournal = new QCheckBox(i18n("Journals"),incidenceGroup); | 106 | mSearchJournal = new QCheckBox(i18n("Journals"),incidenceGroup); |
107 | 107 | ||
108 | subjectGroup = new QHBox( topFrame ); | 108 | subjectGroup = new QHBox( topFrame ); |
109 | layout->addWidget(subjectGroup); | 109 | layout->addWidget(subjectGroup); |
110 | 110 | ||
111 | mSummaryCheck = new QCheckBox(i18n("Summary/Loc."),subjectGroup); | 111 | mSummaryCheck = new QCheckBox(i18n("Summary/Loc."),subjectGroup); |
112 | mSummaryCheck->setChecked(true); | 112 | mSummaryCheck->setChecked(true); |
113 | mDescriptionCheck = new QCheckBox(i18n("Details"),subjectGroup); | 113 | mDescriptionCheck = new QCheckBox(i18n("Details"),subjectGroup); |
114 | mCategoryCheck = new QCheckBox(i18n("Categories"),subjectGroup); | 114 | mCategoryCheck = new QCheckBox(i18n("Categories"),subjectGroup); |
115 | 115 | ||
116 | attendeeGroup = new QHBox( topFrame ); | 116 | attendeeGroup = new QHBox( topFrame ); |
117 | layout->addWidget(attendeeGroup ); | 117 | layout->addWidget(attendeeGroup ); |
118 | new QLabel( i18n("Attendee:"),attendeeGroup ); | 118 | new QLabel( i18n("Attendee:"),attendeeGroup ); |
119 | mSearchAName = new QCheckBox(i18n("Name"),attendeeGroup ); | 119 | mSearchAName = new QCheckBox(i18n("Name"),attendeeGroup ); |
120 | mSearchAEmail = new QCheckBox(i18n("Email"), attendeeGroup ); | 120 | mSearchAEmail = new QCheckBox(i18n("Email"), attendeeGroup ); |
121 | // Date range | 121 | // Date range |
122 | // QGroupBox *rangeGroup = new QGroupBox(1,Horizontal,i18n("Date Range"), | 122 | // QGroupBox *rangeGroup = new QGroupBox(1,Horizontal,i18n("Date Range"), |
123 | // topFrame); | 123 | // topFrame); |
124 | // layout->addWidget(rangeGroup); | 124 | // layout->addWidget(rangeGroup); |
125 | 125 | ||
126 | QWidget *rangeWidget = new QWidget(topFrame); | 126 | QWidget *rangeWidget = new QWidget(topFrame); |
127 | QHBoxLayout *rangeLayout = new QHBoxLayout(rangeWidget,0,KDialog::spacingHint()); | 127 | QHBoxLayout *rangeLayout = new QHBoxLayout(rangeWidget,0,KDialog::spacingHint()); |
128 | rangeLayout->addWidget(new QLabel(i18n("From:"),rangeWidget)); | 128 | rangeLayout->addWidget(new QLabel(i18n("From:"),rangeWidget)); |
129 | mStartDate = new KDateEdit(rangeWidget); | 129 | mStartDate = new KDateEdit(rangeWidget); |
130 | rangeLayout->addWidget(mStartDate); | 130 | rangeLayout->addWidget(mStartDate); |
131 | rangeLayout->addWidget(new QLabel(i18n("To:"),rangeWidget)); | 131 | rangeLayout->addWidget(new QLabel(i18n("To:"),rangeWidget)); |
132 | mEndDate = new KDateEdit(rangeWidget); | 132 | mEndDate = new KDateEdit(rangeWidget); |
133 | mEndDate->setDate(QDate::currentDate().addDays(365)); | 133 | mEndDate->setDate(QDate::currentDate().addDays(365)); |
134 | rangeLayout->addWidget(mEndDate); | 134 | rangeLayout->addWidget(mEndDate); |
135 | QToolButton *wt = QWhatsThis::whatsThisButton ( rangeWidget ); | 135 | QToolButton *wt = QWhatsThis::whatsThisButton ( rangeWidget ); |
136 | rangeLayout->addWidget( (QWidget*)wt ); | 136 | rangeLayout->addWidget( (QWidget*)wt ); |
137 | layout->addWidget(rangeWidget); | 137 | layout->addWidget(rangeWidget); |
138 | // Results list view | 138 | // Results list view |
139 | listView = new KOListView(mCalendar,topFrame); | 139 | listView = new KOListView(mCalendar,topFrame); |
140 | layout->addWidget(listView); | 140 | layout->addWidget(listView); |
141 | listView->showCompletedTodos(); | ||
141 | //layout->setStretchFactor( listView, 333 ); | 142 | //layout->setStretchFactor( listView, 333 ); |
142 | //listView->setSizePolicy( QSizePolicy( QSizePolicy::Preferred ,QSizePolicy::Expanding) ); | 143 | //listView->setSizePolicy( QSizePolicy( QSizePolicy::Preferred ,QSizePolicy::Expanding) ); |
143 | //listView->setMaximumHeight( 50 ); | 144 | //listView->setMaximumHeight( 50 ); |
144 | listView->readSettings(KOGlobals::config(),"SearchListView Layout"); | 145 | listView->readSettings(KOGlobals::config(),"SearchListView Layout"); |
145 | connect(searchEdit,SIGNAL(scrollDOWN()),SLOT(setFocusToList())); | 146 | connect(searchEdit,SIGNAL(scrollDOWN()),SLOT(setFocusToList())); |
146 | 147 | ||
147 | setCaption( i18n("KO/Pi Find: ")); | 148 | setCaption( i18n("KO/Pi Find: ")); |
148 | #ifdef DESKTOP_VERSION | 149 | #ifdef DESKTOP_VERSION |
149 | OkButton = new QPushButton( i18n("Close"), this ); | 150 | OkButton = new QPushButton( i18n("Close"), this ); |
150 | connect(OkButton,SIGNAL(clicked()),SLOT(hide())); | 151 | connect(OkButton,SIGNAL(clicked()),SLOT(hide())); |
151 | #endif | 152 | #endif |
152 | } | 153 | } |
153 | 154 | ||
154 | SearchDialog::~SearchDialog() | 155 | SearchDialog::~SearchDialog() |
155 | { | 156 | { |
156 | 157 | ||
157 | } | 158 | } |
158 | void SearchDialog::slot_add( bool b ) | 159 | void SearchDialog::slot_add( bool b ) |
159 | { | 160 | { |
160 | if ( b ) { | 161 | if ( b ) { |
161 | if ( mSubItems->isOn() ) mSubItems->toggle(); | 162 | if ( mSubItems->isOn() ) mSubItems->toggle(); |
162 | if ( mRefineItems->isOn() ) mRefineItems->toggle(); | 163 | if ( mRefineItems->isOn() ) mRefineItems->toggle(); |
163 | setCaption( i18n("Matching items will be added to list")); | 164 | setCaption( i18n("Matching items will be added to list")); |
164 | } else | 165 | } else |
165 | setCaption( i18n("List will be cleared before search")); | 166 | setCaption( i18n("List will be cleared before search")); |
166 | } | 167 | } |
167 | void SearchDialog::slot_sub( bool b) | 168 | void SearchDialog::slot_sub( bool b) |
168 | { | 169 | { |
169 | if ( b ) { | 170 | if ( b ) { |
170 | if ( mRefineItems->isOn() ) mRefineItems->toggle(); | 171 | if ( mRefineItems->isOn() ) mRefineItems->toggle(); |
171 | if ( mAddItems->isOn() ) mAddItems->toggle(); | 172 | if ( mAddItems->isOn() ) mAddItems->toggle(); |
172 | setCaption( i18n("Matching items will be removed from list")); | 173 | setCaption( i18n("Matching items will be removed from list")); |
173 | } else | 174 | } else |
174 | setCaption( i18n("List will be cleared before search")); | 175 | setCaption( i18n("List will be cleared before search")); |
175 | } | 176 | } |
176 | void SearchDialog::slot_refine( bool b) | 177 | void SearchDialog::slot_refine( bool b) |
177 | { | 178 | { |
178 | if ( b ) { | 179 | if ( b ) { |
179 | if ( mSubItems->isOn() ) mSubItems->toggle(); | 180 | if ( mSubItems->isOn() ) mSubItems->toggle(); |
180 | if ( mAddItems->isOn() ) mAddItems->toggle(); | 181 | if ( mAddItems->isOn() ) mAddItems->toggle(); |
181 | setCaption( i18n("Search on displayed list only")); | 182 | setCaption( i18n("Search on displayed list only")); |
182 | } else | 183 | } else |
183 | setCaption( i18n("List will be cleared before search")); | 184 | setCaption( i18n("List will be cleared before search")); |
184 | } | 185 | } |
185 | void SearchDialog::toggleCheckboxes() | 186 | void SearchDialog::toggleCheckboxes() |
186 | { | 187 | { |
187 | if ( incidenceGroup->isVisible() ) { | 188 | if ( incidenceGroup->isVisible() ) { |
188 | incidenceGroup->hide() ; | 189 | incidenceGroup->hide() ; |
189 | subjectGroup->hide() ; | 190 | subjectGroup->hide() ; |
190 | attendeeGroup->hide() ; | 191 | attendeeGroup->hide() ; |
191 | } else { | 192 | } else { |
192 | incidenceGroup->show() ; | 193 | incidenceGroup->show() ; |
193 | subjectGroup->show() ; | 194 | subjectGroup->show() ; |
194 | attendeeGroup->show() ; | 195 | attendeeGroup->show() ; |
195 | } | 196 | } |
196 | } | 197 | } |
197 | void SearchDialog::raiseAndSelect() | 198 | void SearchDialog::raiseAndSelect() |
198 | { | 199 | { |
199 | 200 | ||
200 | static int currentState = 0; | 201 | static int currentState = 0; |
201 | 202 | ||
202 | if ( !mSearchJournal->isChecked() && !mSearchTodo->isChecked() && !mSearchEvent->isChecked() ) | 203 | if ( !mSearchJournal->isChecked() && !mSearchTodo->isChecked() && !mSearchEvent->isChecked() ) |
203 | currentState = 0; | 204 | currentState = 0; |
204 | int newState = 0; | 205 | int newState = 0; |