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
@@ -1307,37 +1307,37 @@
{ "There is no next alarm.","Es gibt keinen nächsten Alarm." },
{ "%1 %2 - %3 (next event/todo with alarm)","%1 %2 - %3 (nächster Termin/Todo mit Alarm)" },
{ "The next alarm is in:\n","Der nächste Alarm ist in:\n" },
{ "%1 days\n","%1 Tagen\n" },
{ "1 day\n","1 Tag\n" },
{ "%1 hours\n","%1 Stunden\n" },
{ "1 hour\n","1 Stunde\n" },
{ "%1 minutes\n","%1 Minuten\n" },
{ "1 minute\n","1 Minute\n" },
{ "Only one toolbar","Nur eine Toolbar" },
{ "Print","Drucke" },
{ "Print selected event / todo...","Drucke ausgewählten Termin / Todo..." },
{ "There is nothing selected!","Es ist nichts ausgewählt!" },
{ "\n\nDo you really want to print this item?","\n\nMöchten Sie wirklich diesen Eintrag ausdrucken? " },
{ "KO/Pi Print Confirmation","KO/Pi Druckbestätigung" },
{ "This prints the view as you see it.\n(With the complete content, of course.)\nYou may change the print layout by resizing the view.\nPrint unscaled may print several pages\ndepending on the amount of data.\nPrint scaled down will print all on one page.\nPrint scaled up/down will print all on one page,\nbut will scale up the text to page boundaries,\nif the text is smaller than the page.\nYou can select page geometry setup in the next dialog.\n","Dies druckt die Ansicht wie man sie sieht.\n(Mit dem kompletten Inhalt natürlich.)\nMan kann das Layout ändern durch ändern der Fenstergröße.\nDrucke unskaliert druckt ggf. mehrere Seiten\nabhängig von der Menge der Daten.\nDrucke runterskaliert um auf eine Seite zu passen\ndruckt alles auf eine Seite.\nDrucke hoch/runterskaliert um genau auf eine Seite zu passen\nvergrößert den Text gegebenenfalls.\nDas Seitenlayout kann im nächsten Dialog gewählt werden.\n" },
{ "KO/Pi Printout","KO/Pi Ausdruck" },
{ "Print unscaled","Drucke unskaliert" },
{ "Print scaled down to fit one page","Drucke runterskaliert um auf eine Seite zu passen." },
{ "Print scaled up/down to fit one page","Drucke hoch/runterskaliert um genau auf eine Seite zu passen." },
{ "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
@@ -349,50 +349,49 @@ void KOEventViewer::appendEvent(Event *event, int mode )
next = event->getNextOccurence( QDateTime::currentDateTime() , &ok );
if ( ok ) {
addTag("p",i18n("<b>Next recurrence is on:</b>") );
addTag("p", KGlobal::locale()->formatDate( next.date(), shortDate ));
mMailSubject += i18n(" - " )+ KGlobal::locale()->formatDateTime( next, true );
} else {
bool last;
QDate nextd;
nextd = event->recurrence()->getPreviousDate( QDate::currentDate() , &last );
if ( last ) {
addTag("p",i18n("<b>Last recurrence was on:</b>") );
addTag("p", KGlobal::locale()->formatDate( nextd, shortDate ));
}
}
} else {
mMailSubject += i18n(" - " )+event->dtStartStr( true );
}
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: "));
mText.append(event->secrecyStr()+"<br>");
if ( KOPrefs::instance()->mEVshowDetails ) {
if (!event->description().isEmpty()) {
addTag("p",i18n("<b>Details: </b>"));
addTag("p",deTag(event->description()));
}
}
formatCategories(event);
formatReadOnly(event);
formatAttendees(event);
if ( KOPrefs::instance()->mEVshowCreated ) {
addTag("p",i18n("<b>Created: ") +" </b>");
addTag("p", KGlobal::locale()->formatDateTime( event->created(), shortDate ));
@@ -448,48 +447,59 @@ void KOEventViewer::appendTodo(Todo *event, int mode )
mText.append("<br>");
mText += "</font>";
mMailSubject += i18n("(cancelled)");
}
if (!event->location().isEmpty()) {
addTag("b",i18n("Location: "));
mText.append(deTag(event->location())+"<br>");
mMailSubject += i18n(" at ") + event->location();
}
if (event->recurrence()->doesRecur()) {
QString recurText = event->recurrence()->recurrenceText();
addTag("p","<em>" + i18n("This is a %1 recurring todo.").arg(recurText ) + "</em>");
}
if (event->hasStartDate()) {
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()));
}
}
formatCategories(event);
mText.append(i18n("<p><b>Priority:</b> %2</p>")
.arg(QString::number(event->priority())));
formatReadOnly(event);
formatAttendees(event);
if ( event->relatedTo() ) {
addTag("b",i18n("Parent todo:<br>"));
mText.append(deTag(event->relatedTo()->summary())+" [" +QString::number(event->relatedTo()->priority()) + "/" + QString::number(((Todo*)event->relatedTo())->percentComplete())+"%] <br>");
}
QPtrList<Incidence> Relations = event->relations();
Incidence *to;
if ( Relations.first() )
addTag("b",i18n("Sub todos:<br>"));
diff --git a/korganizer/kolistview.cpp b/korganizer/kolistview.cpp
index 15e094d..e0e138e 100644
--- a/korganizer/kolistview.cpp
+++ b/korganizer/kolistview.cpp
@@ -99,84 +99,92 @@ bool ListItemVisitor::visit(Event *e)
bool ok = false;
QString start, end;
QDate ds, de;
if ( e->doesRecur() ) {
ds = e->getNextOccurence( QDateTime( mDate, QTime(0,0,0)), &ok ).date();
if ( ok ) {
int days = e->dtStart().date().daysTo(e->dtEnd().date() );
start = KGlobal::locale()->formatDate(ds,true);
de = ds.addDays( days);
end = KGlobal::locale()->formatDate(de,true);
}
}
if ( ! ok ) {
start =e->dtStartDateStr();
end = e->dtEndDateStr();
ds = e->dtStart().date();
de = e->dtEnd().date();
}
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());
QString key;
QTime t = e->doesFloat() ? QTime(0,0) : e->dtStart().time();
key.sprintf("%04d%02d%02d%02d%02d",ds.year(),ds.month(),ds.day(),t.hour(),t.minute());
mItem->setSortKey(1,key);
t = e->doesFloat() ? QTime(0,0) : e->dtEnd().time();
key.sprintf("%04d%02d%02d%02d%02d",de.year(),de.month(),de.day(),t.hour(),t.minute());
mItem->setSortKey(3,key);
return true;
}
bool ListItemVisitor::visit(Todo *t)
{
mItem->setText(0,i18n("Todo: %1").arg(t->summary()));
if (t->hasStartDate()) {
mItem->setText(1,t->dtStartDateStr());
if (t->doesFloat()) {
mItem->setText(2,"---");
} else {
mItem->setText(2,t->dtStartTimeStr());
}
} else {
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()) {
mItem->setText(8,"---");
} else {
mItem->setText(8,t->dtDueTimeStr());
}
} else {
mItem->setText(7,"---");
mItem->setText(8,"---");
}
mItem->setText(9, t->cancelled() ? i18n("Yes") : i18n("No"));
mItem->setText(10,t->categoriesStr());
QString key;
QDate d;
if (t->hasDueDate()) {
d = t->dtDue().date();
QTime tm = t->doesFloat() ? QTime(0,0) : t->dtDue().time();
key.sprintf("%04d%02d%02d%02d%02d",d.year(),d.month(),d.day(),tm.hour(),tm.minute());
mItem->setSortKey(7,key);
}
if ( t->hasStartDate() ) {
diff --git a/korganizer/kotodoview.cpp b/korganizer/kotodoview.cpp
index 0a315cb..01cf0ff 100644
--- a/korganizer/kotodoview.cpp
+++ b/korganizer/kotodoview.cpp
@@ -197,52 +197,54 @@ void KOTodoListView::contentsDropEvent(QDropEvent *e)
}
}
}
else {
qDebug("KOTodoListView::contentsDropEvent(): Todo from drop not decodable ");
e->ignore();
}
}
#endif
}
void KOTodoListView::contentsMousePressEvent(QMouseEvent* e)
{
QPoint p(contentsToViewport(e->pos()));
QListViewItem *i = itemAt(p);
bool rootClicked = true;
if (i) {
// 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;
}
#endif
//qDebug("KOTodoListView::contentsMousePressEvent %d", rootClicked);
#ifndef DESKTOP_VERSION
if (!( e->button() == RightButton && rootClicked) )
QListView::contentsMousePressEvent(e);
#else
QListView::contentsMousePressEvent(e);
#endif
}
void KOTodoListView::paintEvent(QPaintEvent* e)
{
emit paintNeeded();
QListView::paintEvent( e);
}
void KOTodoListView::contentsMouseMoveEvent(QMouseEvent* e)
{
@@ -709,81 +711,81 @@ void KOTodoView::updateView()
{
insertTodoItem(todo);
}
}
//qDebug("for end ");
// Restore opened/closed state
mTodoListView->blockSignals( true );
if( mDocPrefs ) restoreItemState( mTodoListView->firstChild() );
mTodoListView->blockSignals( false );
resetCurrentItem();
processSelectionChange();
}
void KOTodoView::storeCurrentItem()
{
mCurItem = 0;
mCurItemRootParent = 0;
mCurItemAbove = 0;
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()
{
mTodoListView->setFocus();
KOTodoViewItem* foundItem = 0;
KOTodoViewItem* foundItemRoot = 0;
KOTodoViewItem* foundItemAbove = 0;
if ( mTodoListView->firstChild () ) {
if ( mCurItem ) {
KOTodoViewItem* item = (KOTodoViewItem*)mTodoListView->firstChild ();
while ( item ) {
if ( item->todo() == mCurItem ) {
foundItem = item;
break;
} else if ( item->todo() == mCurItemAbove ) {
foundItemAbove = item;
} 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 {
mTodoListView->setCurrentItem( mTodoListView->firstChild () );
}
}
mTodoListView->setFocus();
}
//Incidence * mCurItem, *mCurItemRootParent,*mCurItemAbove;
bool KOTodoView::checkTodo( Todo * todo )
{
if ( !KOPrefs::instance()->mShowCompletedTodo && todo->isCompleted() )
return false;
if ( !todo->isCompleted() ) {
if ( todo->hasDueDate() && todo->dtDue().date() <= QDate::currentDate() )
return true;
}
if ( KOPrefs::instance()->mHideNonStartedTodos && mNavigator ) {
if ( todo->hasStartDate() )
if ( mNavigator->selectedDates().last() < todo->dtStart().date() )
@@ -1184,99 +1186,107 @@ void KOTodoView::processSelectionChange()
emit incidenceSelected( 0 );
} else {
emit incidenceSelected( item->todo() );
}
}
void KOTodoView::modified(bool b)
{
emit isModified(b);
}
void KOTodoView::setTodoModified( Todo* todo )
{
todoModified( todo, KOGlobals::UNKNOWN_MODIFIED );
}
void KOTodoView::clearSelection()
{
mTodoListView->selectAll( false );
}
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 );
item->setOpen( setOpenI );
item = item->nextSibling();
}
}
void KOTodoView::displayAllFlat()
{
pendingSubtodo = 0;
if ( mBlockUpdate ) {
return;
}
mPopupMenu->setItemChecked( 8,true );
isFlatDisplay = true;
QPtrList<Todo> todoList = calendar()->todos();
mTodoMap.clear();
mTodoListView->clear();
Todo *todo;
for(todo = todoList.first(); todo; todo = todoList.next()) {
KOTodoViewItem *todoItem = new KOTodoViewItem(mTodoListView,todo,this);
mTodoMap.insert(todo,todoItem);
}
mTodoListView->setFocus();
processSelectionChange();
}
void KOTodoView::setAllFlat()
{
if ( isFlatDisplay ) {
isFlatDisplay = false;
mPopupMenu->setItemChecked( 8,false );
updateView();
return;
- }
+ }
+ storeCurrentItem();
displayAllFlat();
+ resetCurrentItem();
}
void KOTodoView::purgeCompleted()
{
emit purgeCompletedSignal();
}
void KOTodoView::toggleQuickTodo()
{
if ( mQuickAdd->isVisible() ) {
mQuickAdd->hide();
KOPrefs::instance()->mEnableQuickTodo = false;
}
else {
mQuickAdd->show();
KOPrefs::instance()->mEnableQuickTodo = true;
}
mPopupMenu->setItemChecked(4,KOPrefs::instance()->mEnableQuickTodo);
mItemPopupMenu->setItemChecked( 34 , KOPrefs::instance()->mEnableQuickTodo );
}
void KOTodoView::toggleRunning()
{
KOPrefs::instance()->mHideNonStartedTodos = !KOPrefs::instance()->mHideNonStartedTodos;
mPopupMenu->setItemChecked(5,KOPrefs::instance()->mHideNonStartedTodos);
diff --git a/libkcal/alarm.cpp b/libkcal/alarm.cpp
index 1fc7169..d8f15b5 100644
--- a/libkcal/alarm.cpp
+++ b/libkcal/alarm.cpp
@@ -1,46 +1,47 @@
/*
This file is part of libkcal.
Copyright (c) 1998 Preston Brown
Copyright (c) 2001 Cornelius Schumacher <schumacher@kde.org>
This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Library General Public
License as published by the Free Software Foundation; either
version 2 of the License, or (at your option) any later version.
This library is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
Library General Public License for more details.
You should have received a copy of the GNU Library General Public License
along with this library; see the file COPYING.LIB. If not, write to
the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
Boston, MA 02111-1307, USA.
*/
#include <kdebug.h>
+#include <klocale.h>
#include "incidence.h"
#include "todo.h"
#include "alarm.h"
using namespace KCal;
#include <qwidget.h>
Alarm::Alarm(Incidence *parent)
: mParent(parent),
mType(Audio),
mDescription(""), // to make operator==() not fail
mFile(""), // to make operator==() not fail
mMailSubject(""), // to make operator==() not fail
mAlarmSnoozeTime(5),
mAlarmRepeatCount(0),
mEndOffset(false),
mHasTime(false),
mAlarmEnabled(false)
{
}
Alarm::~Alarm()
@@ -328,48 +329,71 @@ QString Alarm::text() const
}
void Alarm::setTime(const QDateTime &alarmTime)
{
mAlarmTime = alarmTime;
mHasTime = true;
mParent->updated();
}
int Alarm::offset()
{
if ( hasTime() ) {
if (mParent->type()=="Todo") {
Todo *t = static_cast<Todo*>(mParent);
return t->dtDue().secsTo( mAlarmTime ) ;
} else
return mParent->dtStart().secsTo( mAlarmTime ) ;
}
else
{
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
{
if ( hasTime() )
return mAlarmTime;
else
{
if (mParent->type()=="Todo") {
Todo *t = static_cast<Todo*>(mParent);
return mOffset.end( t->dtDue() );
} else if (mEndOffset) {
return mOffset.end( mParent->dtEnd() );
} else {
return mOffset.end( mParent->dtStart() );
}
}
}
bool Alarm::hasTime() const
{
return mHasTime;
}
diff --git a/libkcal/alarm.h b/libkcal/alarm.h
index 682b626..ac6ea0d 100644
--- a/libkcal/alarm.h
+++ b/libkcal/alarm.h
@@ -38,48 +38,49 @@ class Incidence;
class Alarm : public CustomProperties
{
public:
enum Type { Invalid, Display, Procedure, Email, Audio };
typedef QValueList<Alarm *> List;
/** Construct a new alarm with variables initialized to "sane" values. */
explicit Alarm(Incidence *parent);
/** Destruct Alarm object. */
~Alarm();
/** Compare this alarm with another one. */
bool operator==(const Alarm &) const;
bool operator!=(const Alarm &a) const { return !operator==(a); }
/** Set the type of the alarm.
If the specified type is different from the current type of the alarm,
the alarm's type-specific properties are initialised to null.
@param type type of alarm.
*/
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);
/** Set the text to be displayed when the alarm is triggered.
Ignored if the alarm is not a display alarm.
*/
void setText(const QString &text);
/** Return the text string that displays when the alarm is triggered. */
QString text() const;
/** Set the alarm to be an audio alarm.
@param audioFile optional file to play when the alarm is triggered.
*/
void setAudioAlarm(const QString &audioFile = QString::null);
/** Set the file to play when the audio alarm is triggered.
Ignored if the alarm is not an audio alarm.
*/
void setAudioFile(const QString &audioFile);
/** Return the name of the audio file for the alarm.
@return The audio file for the alarm, or QString::null if not an audio alarm.
*/
QString audioFile() const;
diff --git a/libkcal/kincidenceformatter.cpp b/libkcal/kincidenceformatter.cpp
index e506a96..d67ad52 100644
--- a/libkcal/kincidenceformatter.cpp
+++ b/libkcal/kincidenceformatter.cpp
@@ -110,55 +110,56 @@ void KIncidenceFormatter::setEvent(Event *event)
bool ok;
QDate start = QDate::currentDate();
QDateTime next;
next = event->getNextOccurence( QDateTime::currentDateTime() , &ok );
if ( ok ) {
addTag("p",i18n("<b>Next recurrence is on:</b>") );
addTag("p", KGlobal::locale()->formatDate( next.date(), shortDate ));
} else {
bool last;
QDate nextd;
nextd = event->recurrence()->getPreviousDate( QDate::currentDate() , &last );
if ( last ) {
addTag("p",i18n("<b>Last recurrence was on:</b>") );
addTag("p", KGlobal::locale()->formatDate( nextd, shortDate ));
}
}
}
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 ) {
if (!event->description().isEmpty()) {
addTag("p",i18n("<b>Details: </b>"));
addTag("p",deTag(event->description()));
}
}
formatReadOnly(event);
formatAttendees(event);
if ( mCreated ) {
addTag("p",i18n("<b>Created: ") +" </b>");
addTag("p", KGlobal::locale()->formatDateTime( event->created(), shortDate ));
}
if ( mModified ) {
addTag("p",i18n("<b>Last modified: ") +" </b>");
addTag("p", KGlobal::locale()->formatDateTime( event->lastModified(), shortDate ));
}
@@ -203,48 +204,57 @@ void KIncidenceFormatter::setTodo(Todo *event )
}
if (!event->location().isEmpty()) {
addTag("b",i18n("Location: "));
mText.append(deTag(event->location())+"<br>");
}
if (event->recurrence()->doesRecur()) {
QString recurText = event->recurrence()->recurrenceText();
addTag("p","<em>" + i18n("This is a %1 recurring todo.").arg(recurText ) + "</em>");
}
if (event->hasStartDate()) {
mText.append(i18n("<p><b>Start on:</b> %1</p>").arg(event->dtStartStr(shortDate)));
}
if (event->hasDueDate()) {
mText.append(i18n("<p><b>Due on:</b> %1</p>").arg(event->dtDueStr(shortDate)));
}
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()) {
addTag("p",i18n("<b>Details: </b>"));
addTag("p",deTag(event->description()));
}
}
formatReadOnly(event);
formatAttendees(event);
if ( mCreated ) {
addTag("p",i18n("<b>Created: ") +" </b>");
addTag("p", KGlobal::locale()->formatDateTime( event->created(), shortDate ));
}
if ( mModified ) {
addTag("p",i18n("<b>Last modified: ") +" </b>");
addTag("p", KGlobal::locale()->formatDateTime( event->lastModified(), shortDate ));
}
}
void KIncidenceFormatter::setJournal(Journal* )
{