-rw-r--r-- | korganizer/koeventviewer.cpp | 14 | ||||
-rw-r--r-- | korganizer/kolistview.cpp | 14 | ||||
-rw-r--r-- | korganizer/kotodoview.cpp | 26 |
3 files changed, 41 insertions, 13 deletions
diff --git a/korganizer/koeventviewer.cpp b/korganizer/koeventviewer.cpp index dbe0668..bdad248 100644 --- a/korganizer/koeventviewer.cpp +++ b/korganizer/koeventviewer.cpp | |||
@@ -361,26 +361,25 @@ void KOEventViewer::appendEvent(Event *event, int mode ) | |||
361 | addTag("p", KGlobal::locale()->formatDate( nextd, shortDate )); | 361 | addTag("p", KGlobal::locale()->formatDate( nextd, shortDate )); |
362 | } | 362 | } |
363 | } | 363 | } |
364 | } else { | 364 | } else { |
365 | mMailSubject += i18n(" - " )+event->dtStartStr( true ); | 365 | mMailSubject += i18n(" - " )+event->dtStartStr( true ); |
366 | 366 | ||
367 | } | 367 | } |
368 | 368 | ||
369 | 369 | ||
370 | if (event->isAlarmEnabled()) { | 370 | if (event->isAlarmEnabled()) { |
371 | Alarm *alarm =event->alarms().first() ; | 371 | Alarm *alarm =event->alarms().first() ; |
372 | QDateTime t = alarm->time(); | 372 | QDateTime t = alarm->time(); |
373 | int min = t.secsTo( event->dtStart() )/60; | 373 | QString s =i18n("( %1 before )").arg( alarm->offsetText() ); |
374 | QString s =i18n("( %1 min before )").arg( min ); | ||
375 | addTag("p",i18n("<b>Alarm on: ") + s +" </b>"); | 374 | addTag("p",i18n("<b>Alarm on: ") + s +" </b>"); |
376 | addTag("p", KGlobal::locale()->formatDateTime( t, shortDate )); | 375 | addTag("p", KGlobal::locale()->formatDateTime( t, shortDate )); |
377 | //addTag("p",s); | 376 | //addTag("p",s); |
378 | } | 377 | } |
379 | 378 | ||
380 | addTag("b",i18n("Access: ")); | 379 | addTag("b",i18n("Access: ")); |
381 | mText.append(event->secrecyStr()+"<br>"); | 380 | mText.append(event->secrecyStr()+"<br>"); |
382 | 381 | ||
383 | 382 | ||
384 | if ( KOPrefs::instance()->mEVshowDetails ) { | 383 | if ( KOPrefs::instance()->mEVshowDetails ) { |
385 | if (!event->description().isEmpty()) { | 384 | if (!event->description().isEmpty()) { |
386 | addTag("p",i18n("<b>Details: </b>")); | 385 | addTag("p",i18n("<b>Details: </b>")); |
@@ -460,24 +459,35 @@ void KOEventViewer::appendTodo(Todo *event, int mode ) | |||
460 | 459 | ||
461 | QString recurText = event->recurrence()->recurrenceText(); | 460 | QString recurText = event->recurrence()->recurrenceText(); |
462 | addTag("p","<em>" + i18n("This is a %1 recurring todo.").arg(recurText ) + "</em>"); | 461 | addTag("p","<em>" + i18n("This is a %1 recurring todo.").arg(recurText ) + "</em>"); |
463 | 462 | ||
464 | } | 463 | } |
465 | if (event->hasStartDate()) { | 464 | if (event->hasStartDate()) { |
466 | mText.append(i18n("<p><b>Start on:</b> %1</p>").arg(event->dtStartStr(KOPrefs::instance()->mShortDateInViewer))); | 465 | mText.append(i18n("<p><b>Start on:</b> %1</p>").arg(event->dtStartStr(KOPrefs::instance()->mShortDateInViewer))); |
467 | } | 466 | } |
468 | if (event->hasDueDate()) { | 467 | if (event->hasDueDate()) { |
469 | mText.append(i18n("<p><b>Due on:</b> %1</p>").arg(event->dtDueStr(KOPrefs::instance()->mShortDateInViewer))); | 468 | mText.append(i18n("<p><b>Due on:</b> %1</p>").arg(event->dtDueStr(KOPrefs::instance()->mShortDateInViewer))); |
470 | mMailSubject += i18n(" - " )+event->dtDueStr( true ); | 469 | mMailSubject += i18n(" - " )+event->dtDueStr( true ); |
471 | } | 470 | } |
471 | |||
472 | |||
473 | if (event->isAlarmEnabled()) { | ||
474 | Alarm *alarm =event->alarms().first() ; | ||
475 | QDateTime t = alarm->time(); | ||
476 | QString s =i18n("( %1 before )").arg( alarm->offsetText() ); | ||
477 | addTag("p",i18n("<b>Alarm on: ") + s +" </b>"); | ||
478 | addTag("p", KGlobal::locale()->formatDateTime( t, shortDate )); | ||
479 | //addTag("p",s); | ||
480 | } | ||
481 | |||
472 | addTag("b",i18n("Access: ")); | 482 | addTag("b",i18n("Access: ")); |
473 | mText.append(event->secrecyStr()+"<br>"); | 483 | mText.append(event->secrecyStr()+"<br>"); |
474 | if ( KOPrefs::instance()->mEVshowDetails ) { | 484 | if ( KOPrefs::instance()->mEVshowDetails ) { |
475 | if (!event->description().isEmpty()) { | 485 | if (!event->description().isEmpty()) { |
476 | addTag("p",i18n("<b>Details: </b>")); | 486 | addTag("p",i18n("<b>Details: </b>")); |
477 | addTag("p",deTag(event->description())); | 487 | addTag("p",deTag(event->description())); |
478 | } | 488 | } |
479 | } | 489 | } |
480 | 490 | ||
481 | formatCategories(event); | 491 | formatCategories(event); |
482 | 492 | ||
483 | mText.append(i18n("<p><b>Priority:</b> %2</p>") | 493 | mText.append(i18n("<p><b>Priority:</b> %2</p>") |
diff --git a/korganizer/kolistview.cpp b/korganizer/kolistview.cpp index 15e094d..e0e138e 100644 --- a/korganizer/kolistview.cpp +++ b/korganizer/kolistview.cpp | |||
@@ -111,25 +111,29 @@ bool ListItemVisitor::visit(Event *e) | |||
111 | } | 111 | } |
112 | if ( ! ok ) { | 112 | if ( ! ok ) { |
113 | start =e->dtStartDateStr(); | 113 | start =e->dtStartDateStr(); |
114 | end = e->dtEndDateStr(); | 114 | end = e->dtEndDateStr(); |
115 | ds = e->dtStart().date(); | 115 | ds = e->dtStart().date(); |
116 | de = e->dtEnd().date(); | 116 | de = e->dtEnd().date(); |
117 | } | 117 | } |
118 | mItem->setText(0,e->summary()); | 118 | mItem->setText(0,e->summary()); |
119 | mItem->setText(1,start); | 119 | mItem->setText(1,start); |
120 | mItem->setText(2,e->dtStartTimeStr()); | 120 | mItem->setText(2,e->dtStartTimeStr()); |
121 | mItem->setText(3,end); | 121 | mItem->setText(3,end); |
122 | mItem->setText(4,e->dtEndTimeStr()); | 122 | mItem->setText(4,e->dtEndTimeStr()); |
123 | mItem->setText(5,e->isAlarmEnabled() ? i18n("Yes") : i18n("No")); | 123 | if ( e->isAlarmEnabled() ) { |
124 | mItem->setText(5,e->alarms().first()->offsetText() ); | ||
125 | } else { | ||
126 | mItem->setText(5, i18n("No")); | ||
127 | } | ||
124 | mItem->setText(6, e->recurrence()->recurrenceText()); | 128 | mItem->setText(6, e->recurrence()->recurrenceText()); |
125 | mItem->setText(7,"---"); | 129 | mItem->setText(7,"---"); |
126 | mItem->setText(8,"---"); | 130 | mItem->setText(8,"---"); |
127 | mItem->setText(9, e->cancelled() ? i18n("Yes") : i18n("No")); | 131 | mItem->setText(9, e->cancelled() ? i18n("Yes") : i18n("No")); |
128 | mItem->setText(10,e->categoriesStr()); | 132 | mItem->setText(10,e->categoriesStr()); |
129 | 133 | ||
130 | QString key; | 134 | QString key; |
131 | QTime t = e->doesFloat() ? QTime(0,0) : e->dtStart().time(); | 135 | QTime t = e->doesFloat() ? QTime(0,0) : e->dtStart().time(); |
132 | key.sprintf("%04d%02d%02d%02d%02d",ds.year(),ds.month(),ds.day(),t.hour(),t.minute()); | 136 | key.sprintf("%04d%02d%02d%02d%02d",ds.year(),ds.month(),ds.day(),t.hour(),t.minute()); |
133 | mItem->setSortKey(1,key); | 137 | mItem->setSortKey(1,key); |
134 | 138 | ||
135 | t = e->doesFloat() ? QTime(0,0) : e->dtEnd().time(); | 139 | t = e->doesFloat() ? QTime(0,0) : e->dtEnd().time(); |
@@ -145,26 +149,30 @@ bool ListItemVisitor::visit(Todo *t) | |||
145 | if (t->hasStartDate()) { | 149 | if (t->hasStartDate()) { |
146 | mItem->setText(1,t->dtStartDateStr()); | 150 | mItem->setText(1,t->dtStartDateStr()); |
147 | if (t->doesFloat()) { | 151 | if (t->doesFloat()) { |
148 | mItem->setText(2,"---"); | 152 | mItem->setText(2,"---"); |
149 | } else { | 153 | } else { |
150 | mItem->setText(2,t->dtStartTimeStr()); | 154 | mItem->setText(2,t->dtStartTimeStr()); |
151 | } | 155 | } |
152 | } else { | 156 | } else { |
153 | mItem->setText(1,"---"); | 157 | mItem->setText(1,"---"); |
154 | mItem->setText(2,"---"); | 158 | mItem->setText(2,"---"); |
155 | } | 159 | } |
156 | mItem->setText(3,"---"); | 160 | mItem->setText(3,"---"); |
157 | mItem->setText(4,"---"); | 161 | mItem->setText(4,"---"); |
158 | mItem->setText(5,t->isAlarmEnabled() ? i18n("Yes") : i18n("No")); | 162 | if ( t->isAlarmEnabled() ) { |
163 | mItem->setText(5,t->alarms().first()->offsetText() ); | ||
164 | } else { | ||
165 | mItem->setText(5, i18n("No")); | ||
166 | } | ||
159 | mItem->setText(6, t->recurrence()->recurrenceText()); | 167 | mItem->setText(6, t->recurrence()->recurrenceText()); |
160 | if (t->hasDueDate()) { | 168 | if (t->hasDueDate()) { |
161 | mItem->setText(7,t->dtDueDateStr()); | 169 | mItem->setText(7,t->dtDueDateStr()); |
162 | if (t->doesFloat()) { | 170 | if (t->doesFloat()) { |
163 | mItem->setText(8,"---"); | 171 | mItem->setText(8,"---"); |
164 | } else { | 172 | } else { |
165 | mItem->setText(8,t->dtDueTimeStr()); | 173 | mItem->setText(8,t->dtDueTimeStr()); |
166 | } | 174 | } |
167 | } else { | 175 | } else { |
168 | mItem->setText(7,"---"); | 176 | mItem->setText(7,"---"); |
169 | mItem->setText(8,"---"); | 177 | mItem->setText(8,"---"); |
170 | } | 178 | } |
diff --git a/korganizer/kotodoview.cpp b/korganizer/kotodoview.cpp index 0a315cb..01cf0ff 100644 --- a/korganizer/kotodoview.cpp +++ b/korganizer/kotodoview.cpp | |||
@@ -209,28 +209,30 @@ void KOTodoListView::contentsMousePressEvent(QMouseEvent* e) | |||
209 | { | 209 | { |
210 | 210 | ||
211 | QPoint p(contentsToViewport(e->pos())); | 211 | QPoint p(contentsToViewport(e->pos())); |
212 | QListViewItem *i = itemAt(p); | 212 | QListViewItem *i = itemAt(p); |
213 | bool rootClicked = true; | 213 | bool rootClicked = true; |
214 | if (i) { | 214 | if (i) { |
215 | // if the user clicked into the root decoration of the item, don't | 215 | // if the user clicked into the root decoration of the item, don't |
216 | // try to start a drag! | 216 | // try to start a drag! |
217 | int X = p.x(); | 217 | int X = p.x(); |
218 | //qDebug("%d %d %d", X, header()->sectionPos(0), treeStepSize() ); | 218 | //qDebug("%d %d %d", X, header()->sectionPos(0), treeStepSize() ); |
219 | if (X > header()->sectionPos(0) + | 219 | if (X > header()->sectionPos(0) + |
220 | treeStepSize() * (i->depth() + (rootIsDecorated() ? 1 : 0)) + | 220 | treeStepSize() * (i->depth() + (rootIsDecorated() ? 1 : 0)) + |
221 | itemMargin() || | 221 | itemMargin() +i->height()|| |
222 | X < header()->sectionPos(0)) { | 222 | X < header()->sectionPos(0)) { |
223 | rootClicked = false; | 223 | rootClicked = false; |
224 | } | 224 | } |
225 | } else { | ||
226 | rootClicked = false; | ||
225 | } | 227 | } |
226 | #ifndef KORG_NODND | 228 | #ifndef KORG_NODND |
227 | mMousePressed = false; | 229 | mMousePressed = false; |
228 | if (! rootClicked ) { | 230 | if (! rootClicked ) { |
229 | mPressPos = e->pos(); | 231 | mPressPos = e->pos(); |
230 | mMousePressed = true; | 232 | mMousePressed = true; |
231 | } | 233 | } |
232 | #endif | 234 | #endif |
233 | //qDebug("KOTodoListView::contentsMousePressEvent %d", rootClicked); | 235 | //qDebug("KOTodoListView::contentsMousePressEvent %d", rootClicked); |
234 | #ifndef DESKTOP_VERSION | 236 | #ifndef DESKTOP_VERSION |
235 | if (!( e->button() == RightButton && rootClicked) ) | 237 | if (!( e->button() == RightButton && rootClicked) ) |
236 | QListView::contentsMousePressEvent(e); | 238 | QListView::contentsMousePressEvent(e); |
@@ -721,27 +723,27 @@ void KOTodoView::updateView() | |||
721 | 723 | ||
722 | void KOTodoView::storeCurrentItem() | 724 | void KOTodoView::storeCurrentItem() |
723 | { | 725 | { |
724 | mCurItem = 0; | 726 | mCurItem = 0; |
725 | mCurItemRootParent = 0; | 727 | mCurItemRootParent = 0; |
726 | mCurItemAbove = 0; | 728 | mCurItemAbove = 0; |
727 | mActiveItem = (KOTodoViewItem*)mTodoListView->currentItem(); | 729 | mActiveItem = (KOTodoViewItem*)mTodoListView->currentItem(); |
728 | if (mActiveItem) { | 730 | if (mActiveItem) { |
729 | mCurItem = mActiveItem->todo(); | 731 | mCurItem = mActiveItem->todo(); |
730 | KOTodoViewItem* activeItemAbove = (KOTodoViewItem*)mActiveItem->itemAbove (); | 732 | KOTodoViewItem* activeItemAbove = (KOTodoViewItem*)mActiveItem->itemAbove (); |
731 | if ( activeItemAbove ) | 733 | if ( activeItemAbove ) |
732 | mCurItemAbove = activeItemAbove->todo(); | 734 | mCurItemAbove = activeItemAbove->todo(); |
733 | while ( mActiveItem->parent() != 0 ) | 735 | mCurItemRootParent = mCurItem; |
734 | mActiveItem = (KOTodoViewItem*)mActiveItem->parent(); | 736 | while ( mCurItemRootParent->relatedTo() != 0 ) |
735 | mCurItemRootParent = mActiveItem->todo(); | 737 | mCurItemRootParent = mCurItemRootParent->relatedTo(); |
736 | } | 738 | } |
737 | mActiveItem = 0; | 739 | mActiveItem = 0; |
738 | } | 740 | } |
739 | 741 | ||
740 | void KOTodoView::resetCurrentItem() | 742 | void KOTodoView::resetCurrentItem() |
741 | { | 743 | { |
742 | mTodoListView->setFocus(); | 744 | mTodoListView->setFocus(); |
743 | KOTodoViewItem* foundItem = 0; | 745 | KOTodoViewItem* foundItem = 0; |
744 | KOTodoViewItem* foundItemRoot = 0; | 746 | KOTodoViewItem* foundItemRoot = 0; |
745 | KOTodoViewItem* foundItemAbove = 0; | 747 | KOTodoViewItem* foundItemAbove = 0; |
746 | if ( mTodoListView->firstChild () ) { | 748 | if ( mTodoListView->firstChild () ) { |
747 | if ( mCurItem ) { | 749 | if ( mCurItem ) { |
@@ -750,28 +752,28 @@ void KOTodoView::resetCurrentItem() | |||
750 | if ( item->todo() == mCurItem ) { | 752 | if ( item->todo() == mCurItem ) { |
751 | foundItem = item; | 753 | foundItem = item; |
752 | break; | 754 | break; |
753 | } else if ( item->todo() == mCurItemAbove ) { | 755 | } else if ( item->todo() == mCurItemAbove ) { |
754 | foundItemAbove = item; | 756 | foundItemAbove = item; |
755 | 757 | ||
756 | } else if ( item->todo() == mCurItemRootParent ) { | 758 | } else if ( item->todo() == mCurItemRootParent ) { |
757 | foundItemRoot = item; | 759 | foundItemRoot = item; |
758 | } | 760 | } |
759 | item = (KOTodoViewItem*)item->itemBelow(); | 761 | item = (KOTodoViewItem*)item->itemBelow(); |
760 | } | 762 | } |
761 | if ( ! foundItem ) { | 763 | if ( ! foundItem ) { |
762 | if ( foundItemAbove ) | 764 | if ( foundItemRoot ) |
763 | foundItem = foundItemAbove; | ||
764 | else | ||
765 | foundItem = foundItemRoot; | 765 | foundItem = foundItemRoot; |
766 | else | ||
767 | foundItem = foundItemAbove; | ||
766 | } | 768 | } |
767 | } | 769 | } |
768 | if ( foundItem ) { | 770 | if ( foundItem ) { |
769 | mTodoListView->setCurrentItem( foundItem ); | 771 | mTodoListView->setCurrentItem( foundItem ); |
770 | mTodoListView->ensureItemVisible( foundItem ); | 772 | mTodoListView->ensureItemVisible( foundItem ); |
771 | } else { | 773 | } else { |
772 | mTodoListView->setCurrentItem( mTodoListView->firstChild () ); | 774 | mTodoListView->setCurrentItem( mTodoListView->firstChild () ); |
773 | } | 775 | } |
774 | } | 776 | } |
775 | mTodoListView->setFocus(); | 777 | mTodoListView->setFocus(); |
776 | } | 778 | } |
777 | //Incidence * mCurItem, *mCurItemRootParent,*mCurItemAbove; | 779 | //Incidence * mCurItem, *mCurItemRootParent,*mCurItemAbove; |
@@ -1196,35 +1198,41 @@ void KOTodoView::setTodoModified( Todo* todo ) | |||
1196 | todoModified( todo, KOGlobals::UNKNOWN_MODIFIED ); | 1198 | todoModified( todo, KOGlobals::UNKNOWN_MODIFIED ); |
1197 | } | 1199 | } |
1198 | void KOTodoView::clearSelection() | 1200 | void KOTodoView::clearSelection() |
1199 | { | 1201 | { |
1200 | mTodoListView->selectAll( false ); | 1202 | mTodoListView->selectAll( false ); |
1201 | } | 1203 | } |
1202 | void KOTodoView::setAllOpen() | 1204 | void KOTodoView::setAllOpen() |
1203 | { | 1205 | { |
1204 | if ( isFlatDisplay ) { | 1206 | if ( isFlatDisplay ) { |
1205 | isFlatDisplay = false; | 1207 | isFlatDisplay = false; |
1206 | mPopupMenu->setItemChecked( 8,false ); | 1208 | mPopupMenu->setItemChecked( 8,false ); |
1207 | updateView(); | 1209 | updateView(); |
1210 | } else { | ||
1211 | storeCurrentItem(); | ||
1208 | } | 1212 | } |
1209 | setOpen(mTodoListView->firstChild(), true); | 1213 | setOpen(mTodoListView->firstChild(), true); |
1214 | resetCurrentItem(); | ||
1210 | } | 1215 | } |
1211 | void KOTodoView::setAllClose() | 1216 | void KOTodoView::setAllClose() |
1212 | { | 1217 | { |
1213 | if ( isFlatDisplay ) { | 1218 | if ( isFlatDisplay ) { |
1214 | isFlatDisplay = false; | 1219 | isFlatDisplay = false; |
1215 | mPopupMenu->setItemChecked( 8,false ); | 1220 | mPopupMenu->setItemChecked( 8,false ); |
1216 | updateView(); | 1221 | updateView(); |
1222 | } else { | ||
1223 | storeCurrentItem(); | ||
1217 | } | 1224 | } |
1218 | setOpen(mTodoListView->firstChild(), false); | 1225 | setOpen(mTodoListView->firstChild(), false); |
1226 | resetCurrentItem(); | ||
1219 | } | 1227 | } |
1220 | void KOTodoView::setOpen( QListViewItem* item, bool setOpenI) | 1228 | void KOTodoView::setOpen( QListViewItem* item, bool setOpenI) |
1221 | { | 1229 | { |
1222 | 1230 | ||
1223 | while ( item ) { | 1231 | while ( item ) { |
1224 | setOpen( item->firstChild(), setOpenI ); | 1232 | setOpen( item->firstChild(), setOpenI ); |
1225 | item->setOpen( setOpenI ); | 1233 | item->setOpen( setOpenI ); |
1226 | item = item->nextSibling(); | 1234 | item = item->nextSibling(); |
1227 | } | 1235 | } |
1228 | } | 1236 | } |
1229 | 1237 | ||
1230 | void KOTodoView::displayAllFlat() | 1238 | void KOTodoView::displayAllFlat() |
@@ -1245,26 +1253,28 @@ void KOTodoView::displayAllFlat() | |||
1245 | } | 1253 | } |
1246 | mTodoListView->setFocus(); | 1254 | mTodoListView->setFocus(); |
1247 | processSelectionChange(); | 1255 | processSelectionChange(); |
1248 | } | 1256 | } |
1249 | 1257 | ||
1250 | void KOTodoView::setAllFlat() | 1258 | void KOTodoView::setAllFlat() |
1251 | { | 1259 | { |
1252 | if ( isFlatDisplay ) { | 1260 | if ( isFlatDisplay ) { |
1253 | isFlatDisplay = false; | 1261 | isFlatDisplay = false; |
1254 | mPopupMenu->setItemChecked( 8,false ); | 1262 | mPopupMenu->setItemChecked( 8,false ); |
1255 | updateView(); | 1263 | updateView(); |
1256 | return; | 1264 | return; |
1257 | } | 1265 | } |
1266 | storeCurrentItem(); | ||
1258 | displayAllFlat(); | 1267 | displayAllFlat(); |
1268 | resetCurrentItem(); | ||
1259 | } | 1269 | } |
1260 | 1270 | ||
1261 | void KOTodoView::purgeCompleted() | 1271 | void KOTodoView::purgeCompleted() |
1262 | { | 1272 | { |
1263 | emit purgeCompletedSignal(); | 1273 | emit purgeCompletedSignal(); |
1264 | } | 1274 | } |
1265 | void KOTodoView::toggleQuickTodo() | 1275 | void KOTodoView::toggleQuickTodo() |
1266 | { | 1276 | { |
1267 | if ( mQuickAdd->isVisible() ) { | 1277 | if ( mQuickAdd->isVisible() ) { |
1268 | mQuickAdd->hide(); | 1278 | mQuickAdd->hide(); |
1269 | KOPrefs::instance()->mEnableQuickTodo = false; | 1279 | KOPrefs::instance()->mEnableQuickTodo = false; |
1270 | } | 1280 | } |