-rw-r--r-- | bin/kdepim/korganizer/germantranslation.txt | 10 | ||||
-rw-r--r-- | korganizer/koeventviewer.cpp | 14 | ||||
-rw-r--r-- | korganizer/kolistview.cpp | 14 | ||||
-rw-r--r-- | korganizer/kotodoview.cpp | 26 | ||||
-rw-r--r-- | libkcal/alarm.cpp | 24 | ||||
-rw-r--r-- | libkcal/alarm.h | 1 | ||||
-rw-r--r-- | libkcal/kincidenceformatter.cpp | 14 |
7 files changed, 83 insertions, 20 deletions
diff --git a/bin/kdepim/korganizer/germantranslation.txt b/bin/kdepim/korganizer/germantranslation.txt index fbab7dd..6b739ba 100644 --- a/bin/kdepim/korganizer/germantranslation.txt +++ b/bin/kdepim/korganizer/germantranslation.txt @@ -1330,2 +1330,6 @@ { "<p><b>N</b>: Switch to next view which has a toolbar icon</p>\n","<p><b>N</b>: Wechsle zur nächsten Ansicht, die ein Icon in der Toolbar hat</p>\n" }, +{ "%1d","%1t" }, +{ "%1h","%1std" }, +{ "%1min","%1min" }, +{ "( %1 before )","( %1 vorher )" }, { "","" }, @@ -1338,6 +1342,2 @@ { "","" }, -{ "","" }, -{ "","" }, -{ "","" }, -{ "","" }, -{ "","" },
\ No newline at end of file +{ "","" }
\ No newline at end of file diff --git a/korganizer/koeventviewer.cpp b/korganizer/koeventviewer.cpp index dbe0668..bdad248 100644 --- a/korganizer/koeventviewer.cpp +++ b/korganizer/koeventviewer.cpp @@ -372,4 +372,3 @@ void KOEventViewer::appendEvent(Event *event, int mode ) 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>"); @@ -471,2 +470,13 @@ void KOEventViewer::appendTodo(Todo *event, int mode ) } + + + 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: ")); diff --git a/korganizer/kolistview.cpp b/korganizer/kolistview.cpp index 15e094d..e0e138e 100644 --- a/korganizer/kolistview.cpp +++ b/korganizer/kolistview.cpp @@ -122,3 +122,7 @@ bool ListItemVisitor::visit(Event *e) 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()); @@ -156,4 +160,8 @@ bool ListItemVisitor::visit(Todo *t) mItem->setText(3,"---"); - mItem->setText(4,"---"); - mItem->setText(5,t->isAlarmEnabled() ? i18n("Yes") : i18n("No")); + mItem->setText(4,"---"); + if ( t->isAlarmEnabled() ) { + mItem->setText(5,t->alarms().first()->offsetText() ); + } else { + mItem->setText(5, i18n("No")); + } mItem->setText(6, t->recurrence()->recurrenceText()); diff --git a/korganizer/kotodoview.cpp b/korganizer/kotodoview.cpp index 0a315cb..01cf0ff 100644 --- a/korganizer/kotodoview.cpp +++ b/korganizer/kotodoview.cpp @@ -220,3 +220,3 @@ void KOTodoListView::contentsMousePressEvent(QMouseEvent* e) treeStepSize() * (i->depth() + (rootIsDecorated() ? 1 : 0)) + - itemMargin() || + itemMargin() +i->height()|| X < header()->sectionPos(0)) { @@ -224,2 +224,4 @@ void KOTodoListView::contentsMousePressEvent(QMouseEvent* e) } + } else { + rootClicked = false; } @@ -732,5 +734,5 @@ void KOTodoView::storeCurrentItem() mCurItemAbove = activeItemAbove->todo(); - while ( mActiveItem->parent() != 0 ) - mActiveItem = (KOTodoViewItem*)mActiveItem->parent(); - mCurItemRootParent = mActiveItem->todo(); + mCurItemRootParent = mCurItem; + while ( mCurItemRootParent->relatedTo() != 0 ) + mCurItemRootParent = mCurItemRootParent->relatedTo(); } @@ -761,6 +763,6 @@ void KOTodoView::resetCurrentItem() if ( ! foundItem ) { - if ( foundItemAbove ) - foundItem = foundItemAbove; - else + if ( foundItemRoot ) foundItem = foundItemRoot; + else + foundItem = foundItemAbove; } @@ -1207,4 +1209,7 @@ void KOTodoView::setAllOpen() updateView(); + } else { + storeCurrentItem(); } setOpen(mTodoListView->firstChild(), true); + resetCurrentItem(); } @@ -1216,4 +1221,7 @@ void KOTodoView::setAllClose() updateView(); + } else { + storeCurrentItem(); } setOpen(mTodoListView->firstChild(), false); + resetCurrentItem(); } @@ -1256,4 +1264,6 @@ void KOTodoView::setAllFlat() return; - } + } + storeCurrentItem(); displayAllFlat(); + resetCurrentItem(); } diff --git a/libkcal/alarm.cpp b/libkcal/alarm.cpp index 1fc7169..d8f15b5 100644 --- a/libkcal/alarm.cpp +++ b/libkcal/alarm.cpp @@ -22,2 +22,3 @@ #include <kdebug.h> +#include <klocale.h> @@ -351,2 +352,25 @@ int Alarm::offset() } +QString Alarm::offsetText() +{ + int min = -offset()/60; + int hours = min /60; + min = min % 60; + int days = hours /24; + hours = hours % 24; + QString message; + qDebug("%d %d %d ", days, hours, min ); + if ( days > 0 ) + message += i18n("%1d").arg( days ); + if ( hours > 0 ) { + if ( !message.isEmpty() ) message += "/"; + message += i18n("%1h").arg( hours ); + } + if ( min > 0 ) { + if ( !message.isEmpty() ) message += "/"; + message += i18n("%1min").arg( min ); + } + if ( message.isEmpty() ) + message = i18n("%1min").arg( 0 ); + return message; +} diff --git a/libkcal/alarm.h b/libkcal/alarm.h index 682b626..ac6ea0d 100644 --- a/libkcal/alarm.h +++ b/libkcal/alarm.h @@ -61,2 +61,3 @@ class Alarm : public CustomProperties int offset(); + QString offsetText(); /** Set the alarm to be a display alarm. diff --git a/libkcal/kincidenceformatter.cpp b/libkcal/kincidenceformatter.cpp index e506a96..d67ad52 100644 --- a/libkcal/kincidenceformatter.cpp +++ b/libkcal/kincidenceformatter.cpp @@ -133,4 +133,3 @@ void KIncidenceFormatter::setEvent(Event *event) 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: </b>") + s + ": "+KGlobal::locale()->formatDateTime( t, shortDate )); @@ -140,2 +139,4 @@ void KIncidenceFormatter::setEvent(Event *event) + + addTag("p",i18n("<b>Access: </b>") +event->secrecyStr() ); @@ -226,2 +227,11 @@ void KIncidenceFormatter::setTodo(Todo *event ) + 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("p",i18n("<b>Access: </b>") +event->secrecyStr() ); |