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
@@ -1329,4 +1329,8 @@
{ "<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 )" },
{ "","" },
{ "","" },
@@ -1337,7 +1341,3 @@
{ "","" },
{ "","" },
-{ "","" },
-{ "","" },
-{ "","" },
-{ "","" },
-{ "","" }, \ 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
@@ -371,6 +371,5 @@ void KOEventViewer::appendEvent(Event *event, int mode )
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 ));
@@ -470,4 +469,15 @@ void KOEventViewer::appendTodo(Todo *event, int mode )
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>");
diff --git a/korganizer/kolistview.cpp b/korganizer/kolistview.cpp
index 15e094d..e0e138e 100644
--- a/korganizer/kolistview.cpp
+++ b/korganizer/kolistview.cpp
@@ -121,5 +121,9 @@ bool ListItemVisitor::visit(Event *e)
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,"---");
@@ -155,6 +159,10 @@ 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());
if (t->hasDueDate()) {
diff --git a/korganizer/kotodoview.cpp b/korganizer/kotodoview.cpp
index 0a315cb..01cf0ff 100644
--- a/korganizer/kotodoview.cpp
+++ b/korganizer/kotodoview.cpp
@@ -219,8 +219,10 @@ void KOTodoListView::contentsMousePressEvent(QMouseEvent* e)
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
@@ -731,7 +733,7 @@ void KOTodoView::storeCurrentItem()
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;
@@ -760,8 +762,8 @@ void KOTodoView::resetCurrentItem()
}
if ( ! foundItem ) {
- if ( foundItemAbove )
- foundItem = foundItemAbove;
- else
+ if ( foundItemRoot )
foundItem = foundItemRoot;
+ else
+ foundItem = foundItemAbove;
}
}
@@ -1206,6 +1208,9 @@ void KOTodoView::setAllOpen()
mPopupMenu->setItemChecked( 8,false );
updateView();
+ } else {
+ storeCurrentItem();
}
setOpen(mTodoListView->firstChild(), true);
+ resetCurrentItem();
}
void KOTodoView::setAllClose()
@@ -1215,6 +1220,9 @@ void KOTodoView::setAllClose()
mPopupMenu->setItemChecked( 8,false );
updateView();
+ } else {
+ storeCurrentItem();
}
setOpen(mTodoListView->firstChild(), false);
+ resetCurrentItem();
}
void KOTodoView::setOpen( QListViewItem* item, bool setOpenI)
@@ -1255,6 +1263,8 @@ void KOTodoView::setAllFlat()
updateView();
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
@@ -21,4 +21,5 @@
#include <kdebug.h>
+#include <klocale.h>
#include "incidence.h"
@@ -350,4 +351,27 @@ 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
@@ -60,4 +60,5 @@ class Alarm : public CustomProperties
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
@@ -132,6 +132,5 @@ void KIncidenceFormatter::setEvent(Event *event)
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 ));
@@ -139,4 +138,6 @@ void KIncidenceFormatter::setEvent(Event *event)
}
+
+
addTag("p",i18n("<b>Access: </b>") +event->secrecyStr() );
// mText.append(event->secrecyStr()+"<br>");
@@ -225,4 +226,13 @@ void KIncidenceFormatter::setTodo(Todo *event )
.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);