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
@@ -1327,17 +1327,17 @@
{ "Printout Mode","Druck Modus" },
{ "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 )" },
{ "","" },
{ "","" },
{ "","" },
{ "","" },
{ "","" },
{ "","" },
{ "","" },
{ "","" },
-{ "","" },
-{ "","" },
-{ "","" },
-{ "","" },
-{ "","" }, \ 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
@@ -369,10 +369,9 @@ 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);
}
@@ -468,8 +467,19 @@ void KOEventViewer::appendTodo(Todo *event, int mode )
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()) {
diff --git a/korganizer/kolistview.cpp b/korganizer/kolistview.cpp
index 15e094d..e0e138e 100644
--- a/korganizer/kolistview.cpp
+++ b/korganizer/kolistview.cpp
@@ -119,9 +119,13 @@ bool ListItemVisitor::visit(Event *e)
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"));
@@ -153,10 +157,14 @@ bool ListItemVisitor::visit(Todo *t)
mItem->setText(1,"---");
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());
if (t->doesFloat()) {
diff --git a/korganizer/kotodoview.cpp b/korganizer/kotodoview.cpp
index 0a315cb..01cf0ff 100644
--- a/korganizer/kotodoview.cpp
+++ b/korganizer/kotodoview.cpp
@@ -217,12 +217,14 @@ void KOTodoListView::contentsMousePressEvent(QMouseEvent* e)
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 ) {
@@ -729,11 +731,11 @@ void KOTodoView::storeCurrentItem()
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;
}
@@ -758,12 +760,12 @@ void KOTodoView::resetCurrentItem()
}
item = (KOTodoViewItem*)item->itemBelow();
}
if ( ! foundItem ) {
- if ( foundItemAbove )
- foundItem = foundItemAbove;
- else
+ if ( foundItemRoot )
foundItem = foundItemRoot;
+ else
+ foundItem = foundItemAbove;
}
}
if ( foundItem ) {
mTodoListView->setCurrentItem( foundItem );
@@ -1204,19 +1206,25 @@ 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)
{
@@ -1253,10 +1261,12 @@ void KOTodoView::setAllFlat()
isFlatDisplay = false;
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
@@ -19,8 +19,9 @@
Boston, MA 02111-1307, USA.
*/
#include <kdebug.h>
+#include <klocale.h>
#include "incidence.h"
#include "todo.h"
@@ -348,8 +349,31 @@ int Alarm::offset()
return mOffset.asSeconds();
}
}
+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
@@ -58,8 +58,9 @@ class Alarm : public CustomProperties
void setType(Type type);
/** 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.
*/
void setDisplayAlarm(const QString &text);
diff --git a/libkcal/kincidenceformatter.cpp b/libkcal/kincidenceformatter.cpp
index e506a96..d67ad52 100644
--- a/libkcal/kincidenceformatter.cpp
+++ b/libkcal/kincidenceformatter.cpp
@@ -130,15 +130,16 @@ 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);
if ( mDetails ) {
@@ -223,8 +224,17 @@ 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 ) {
if (!event->description().isEmpty()) {