-rw-r--r-- | korganizer/koeventviewer.cpp | 14 | ||||
-rw-r--r-- | korganizer/kolistview.cpp | 12 | ||||
-rw-r--r-- | korganizer/kotodoview.cpp | 24 |
3 files changed, 39 insertions, 11 deletions
diff --git a/korganizer/koeventviewer.cpp b/korganizer/koeventviewer.cpp index dbe0668..bdad248 100644 --- a/korganizer/koeventviewer.cpp +++ b/korganizer/koeventviewer.cpp @@ -367,14 +367,13 @@ void KOEventViewer::appendEvent(Event *event, int mode ) } if (event->isAlarmEnabled()) { Alarm *alarm =event->alarms().first() ; QDateTime t = alarm->time(); - int min = t.secsTo( event->dtStart() )/60; - QString s =i18n("( %1 min before )").arg( min ); + QString s =i18n("( %1 before )").arg( alarm->offsetText() ); addTag("p",i18n("<b>Alarm on: ") + s +" </b>"); addTag("p", KGlobal::locale()->formatDateTime( t, shortDate )); //addTag("p",s); } addTag("b",i18n("Access: ")); @@ -466,12 +465,23 @@ void KOEventViewer::appendTodo(Todo *event, int mode ) mText.append(i18n("<p><b>Start on:</b> %1</p>").arg(event->dtStartStr(KOPrefs::instance()->mShortDateInViewer))); } if (event->hasDueDate()) { mText.append(i18n("<p><b>Due on:</b> %1</p>").arg(event->dtDueStr(KOPrefs::instance()->mShortDateInViewer))); mMailSubject += i18n(" - " )+event->dtDueStr( true ); } + + + if (event->isAlarmEnabled()) { + Alarm *alarm =event->alarms().first() ; + QDateTime t = alarm->time(); + QString s =i18n("( %1 before )").arg( alarm->offsetText() ); + addTag("p",i18n("<b>Alarm on: ") + s +" </b>"); + addTag("p", KGlobal::locale()->formatDateTime( t, shortDate )); + //addTag("p",s); + } + addTag("b",i18n("Access: ")); mText.append(event->secrecyStr()+"<br>"); if ( KOPrefs::instance()->mEVshowDetails ) { if (!event->description().isEmpty()) { addTag("p",i18n("<b>Details: </b>")); addTag("p",deTag(event->description())); diff --git a/korganizer/kolistview.cpp b/korganizer/kolistview.cpp index 15e094d..e0e138e 100644 --- a/korganizer/kolistview.cpp +++ b/korganizer/kolistview.cpp @@ -117,13 +117,17 @@ bool ListItemVisitor::visit(Event *e) } mItem->setText(0,e->summary()); mItem->setText(1,start); mItem->setText(2,e->dtStartTimeStr()); mItem->setText(3,end); mItem->setText(4,e->dtEndTimeStr()); - mItem->setText(5,e->isAlarmEnabled() ? i18n("Yes") : i18n("No")); + if ( e->isAlarmEnabled() ) { + mItem->setText(5,e->alarms().first()->offsetText() ); + } else { + mItem->setText(5, i18n("No")); + } mItem->setText(6, e->recurrence()->recurrenceText()); mItem->setText(7,"---"); mItem->setText(8,"---"); mItem->setText(9, e->cancelled() ? i18n("Yes") : i18n("No")); mItem->setText(10,e->categoriesStr()); @@ -152,13 +156,17 @@ bool ListItemVisitor::visit(Todo *t) } else { mItem->setText(1,"---"); mItem->setText(2,"---"); } mItem->setText(3,"---"); mItem->setText(4,"---"); - mItem->setText(5,t->isAlarmEnabled() ? i18n("Yes") : i18n("No")); + if ( t->isAlarmEnabled() ) { + mItem->setText(5,t->alarms().first()->offsetText() ); + } else { + mItem->setText(5, i18n("No")); + } mItem->setText(6, t->recurrence()->recurrenceText()); if (t->hasDueDate()) { mItem->setText(7,t->dtDueDateStr()); if (t->doesFloat()) { mItem->setText(8,"---"); } else { diff --git a/korganizer/kotodoview.cpp b/korganizer/kotodoview.cpp index 0a315cb..01cf0ff 100644 --- a/korganizer/kotodoview.cpp +++ b/korganizer/kotodoview.cpp @@ -215,16 +215,18 @@ void KOTodoListView::contentsMousePressEvent(QMouseEvent* e) // if the user clicked into the root decoration of the item, don't // try to start a drag! int X = p.x(); //qDebug("%d %d %d", X, header()->sectionPos(0), treeStepSize() ); if (X > header()->sectionPos(0) + treeStepSize() * (i->depth() + (rootIsDecorated() ? 1 : 0)) + - itemMargin() || + itemMargin() +i->height()|| X < header()->sectionPos(0)) { rootClicked = false; } + } else { + rootClicked = false; } #ifndef KORG_NODND mMousePressed = false; if (! rootClicked ) { mPressPos = e->pos(); mMousePressed = true; @@ -727,15 +729,15 @@ void KOTodoView::storeCurrentItem() mActiveItem = (KOTodoViewItem*)mTodoListView->currentItem(); if (mActiveItem) { mCurItem = mActiveItem->todo(); KOTodoViewItem* activeItemAbove = (KOTodoViewItem*)mActiveItem->itemAbove (); if ( activeItemAbove ) mCurItemAbove = activeItemAbove->todo(); - while ( mActiveItem->parent() != 0 ) - mActiveItem = (KOTodoViewItem*)mActiveItem->parent(); - mCurItemRootParent = mActiveItem->todo(); + mCurItemRootParent = mCurItem; + while ( mCurItemRootParent->relatedTo() != 0 ) + mCurItemRootParent = mCurItemRootParent->relatedTo(); } mActiveItem = 0; } void KOTodoView::resetCurrentItem() { @@ -756,16 +758,16 @@ void KOTodoView::resetCurrentItem() } else if ( item->todo() == mCurItemRootParent ) { foundItemRoot = item; } item = (KOTodoViewItem*)item->itemBelow(); } if ( ! foundItem ) { - if ( foundItemAbove ) - foundItem = foundItemAbove; - else + if ( foundItemRoot ) foundItem = foundItemRoot; + else + foundItem = foundItemAbove; } } if ( foundItem ) { mTodoListView->setCurrentItem( foundItem ); mTodoListView->ensureItemVisible( foundItem ); } else { @@ -1202,23 +1204,29 @@ void KOTodoView::clearSelection() void KOTodoView::setAllOpen() { if ( isFlatDisplay ) { isFlatDisplay = false; mPopupMenu->setItemChecked( 8,false ); updateView(); + } else { + storeCurrentItem(); } setOpen(mTodoListView->firstChild(), true); + resetCurrentItem(); } void KOTodoView::setAllClose() { if ( isFlatDisplay ) { isFlatDisplay = false; mPopupMenu->setItemChecked( 8,false ); updateView(); + } else { + storeCurrentItem(); } setOpen(mTodoListView->firstChild(), false); + resetCurrentItem(); } void KOTodoView::setOpen( QListViewItem* item, bool setOpenI) { while ( item ) { setOpen( item->firstChild(), setOpenI ); @@ -1252,13 +1260,15 @@ void KOTodoView::setAllFlat() if ( isFlatDisplay ) { isFlatDisplay = false; mPopupMenu->setItemChecked( 8,false ); updateView(); return; } + storeCurrentItem(); displayAllFlat(); + resetCurrentItem(); } void KOTodoView::purgeCompleted() { emit purgeCompletedSignal(); } |