summaryrefslogtreecommitdiffabout
Side-by-side diff
Diffstat (more/less context) (ignore whitespace changes)
-rw-r--r--bin/kdepim/korganizer/germantranslation.txt10
-rw-r--r--korganizer/koeventviewer.cpp14
-rw-r--r--korganizer/kolistview.cpp14
-rw-r--r--korganizer/kotodoview.cpp26
-rw-r--r--libkcal/alarm.cpp24
-rw-r--r--libkcal/alarm.h1
-rw-r--r--libkcal/kincidenceformatter.cpp14
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
@@ -1328,6 +1328,10 @@
{ "Filter menu icon","Filtermenu Icon" },
{ "<p><b>A+(shift or ctrl)</b>: Show occurence of next alarm</p>\n","<p><b>A+(shift oder ctrl)</b>: Zeige Zeit bis zum nächsten Alarm</p>\n" },
{ "<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 )" },
{ "","" },
{ "","" },
{ "","" },
@@ -1336,8 +1340,4 @@
{ "","" },
{ "","" },
{ "","" },
-{ "","" },
-{ "","" },
-{ "","" },
-{ "","" },
-{ "","" }, \ 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
@@ -370,8 +370,7 @@ 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);
@@ -469,6 +468,17 @@ void KOEventViewer::appendTodo(Todo *event, int mode )
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 ) {
diff --git a/korganizer/kolistview.cpp b/korganizer/kolistview.cpp
index 15e094d..e0e138e 100644
--- a/korganizer/kolistview.cpp
+++ b/korganizer/kolistview.cpp
@@ -120,7 +120,11 @@ bool ListItemVisitor::visit(Event *e)
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,"---");
@@ -154,8 +158,12 @@ bool ListItemVisitor::visit(Todo *t)
mItem->setText(2,"---");
}
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());
if (t->hasDueDate()) {
mItem->setText(7,t->dtDueDateStr());
diff --git a/korganizer/kotodoview.cpp b/korganizer/kotodoview.cpp
index 0a315cb..01cf0ff 100644
--- a/korganizer/kotodoview.cpp
+++ b/korganizer/kotodoview.cpp
@@ -218,10 +218,12 @@ void KOTodoListView::contentsMousePressEvent(QMouseEvent* e)
//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;
@@ -730,9 +732,9 @@ void KOTodoView::storeCurrentItem()
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;
}
@@ -759,10 +761,10 @@ void KOTodoView::resetCurrentItem()
item = (KOTodoViewItem*)item->itemBelow();
}
if ( ! foundItem ) {
- if ( foundItemAbove )
- foundItem = foundItemAbove;
- else
+ if ( foundItemRoot )
foundItem = foundItemRoot;
+ else
+ foundItem = foundItemAbove;
}
}
if ( foundItem ) {
@@ -1205,8 +1207,11 @@ void KOTodoView::setAllOpen()
isFlatDisplay = false;
mPopupMenu->setItemChecked( 8,false );
updateView();
+ } else {
+ storeCurrentItem();
}
setOpen(mTodoListView->firstChild(), true);
+ resetCurrentItem();
}
void KOTodoView::setAllClose()
{
@@ -1214,8 +1219,11 @@ void KOTodoView::setAllClose()
isFlatDisplay = false;
mPopupMenu->setItemChecked( 8,false );
updateView();
+ } else {
+ storeCurrentItem();
}
setOpen(mTodoListView->firstChild(), false);
+ resetCurrentItem();
}
void KOTodoView::setOpen( QListViewItem* item, bool setOpenI)
{
@@ -1254,8 +1262,10 @@ void KOTodoView::setAllFlat()
mPopupMenu->setItemChecked( 8,false );
updateView();
return;
- }
+ }
+ storeCurrentItem();
displayAllFlat();
+ resetCurrentItem();
}
void KOTodoView::purgeCompleted()
diff --git a/libkcal/alarm.cpp b/libkcal/alarm.cpp
index 1fc7169..d8f15b5 100644
--- a/libkcal/alarm.cpp
+++ b/libkcal/alarm.cpp
@@ -20,6 +20,7 @@
*/
#include <kdebug.h>
+#include <klocale.h>
#include "incidence.h"
#include "todo.h"
@@ -349,6 +350,29 @@ 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;
+}
QDateTime Alarm::time() const
diff --git a/libkcal/alarm.h b/libkcal/alarm.h
index 682b626..ac6ea0d 100644
--- a/libkcal/alarm.h
+++ b/libkcal/alarm.h
@@ -59,6 +59,7 @@ class Alarm : public CustomProperties
/** Return the type of the alarm */
Type type() const;
int offset();
+ QString offsetText();
/** Set the alarm to be a display alarm.
@param text text to display when the alarm is triggered.
*/
diff --git a/libkcal/kincidenceformatter.cpp b/libkcal/kincidenceformatter.cpp
index e506a96..d67ad52 100644
--- a/libkcal/kincidenceformatter.cpp
+++ b/libkcal/kincidenceformatter.cpp
@@ -131,13 +131,14 @@ void KIncidenceFormatter::setEvent(Event *event)
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: </b>") + s + ": "+KGlobal::locale()->formatDateTime( t, shortDate ));
//addTag("p", KGlobal::locale()->formatDateTime( t, shortDate ));
//addTag("p",s);
}
+
+
addTag("p",i18n("<b>Access: </b>") +event->secrecyStr() );
// mText.append(event->secrecyStr()+"<br>");
formatCategories(event);
@@ -224,6 +225,15 @@ void KIncidenceFormatter::setTodo(Todo *event )
mText.append(i18n("<p><b>Priority:</b> %2</p>")
.arg(QString::number(event->priority())));
+ 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() );
formatCategories(event);
if ( mDetails ) {