summaryrefslogtreecommitdiffabout
authorzautrix <zautrix>2005-06-03 23:10:45 (UTC)
committer zautrix <zautrix>2005-06-03 23:10:45 (UTC)
commit858b047efb5627824438cb3877e7bec0cebb3751 (patch) (side-by-side diff)
tree7b36963344d4f5019f3a1ecb5eb9290f27c3b3c7
parent0207d193bdb6c66201562a17e68872e018ec223c (diff)
downloadkdepimpi-858b047efb5627824438cb3877e7bec0cebb3751.zip
kdepimpi-858b047efb5627824438cb3877e7bec0cebb3751.tar.gz
kdepimpi-858b047efb5627824438cb3877e7bec0cebb3751.tar.bz2
fixxx
Diffstat (more/less context) (show whitespace changes)
-rw-r--r--bin/kdepim/korganizer/germantranslation.txt4
-rw-r--r--korganizer/calendarview.cpp167
-rw-r--r--korganizer/calendarview.h20
-rw-r--r--korganizer/kotodoview.cpp2
-rw-r--r--korganizer/mainwindow.cpp4
-rw-r--r--libkcal/calendarlocal.cpp6
-rw-r--r--libkcal/event.cpp6
-rw-r--r--libkcal/event.h2
-rw-r--r--libkcal/incidence.h2
-rw-r--r--libkcal/journal.cpp2
-rw-r--r--libkcal/journal.h2
-rw-r--r--libkcal/todo.cpp4
-rw-r--r--libkcal/todo.h2
13 files changed, 206 insertions, 17 deletions
diff --git a/bin/kdepim/korganizer/germantranslation.txt b/bin/kdepim/korganizer/germantranslation.txt
index 41868d9..cc8102c 100644
--- a/bin/kdepim/korganizer/germantranslation.txt
+++ b/bin/kdepim/korganizer/germantranslation.txt
@@ -1365,17 +1365,17 @@
{ "Try again tomorrow","Versuche morgen nochmal" },
{ "Disable backup","Schalte Backup ab" },
{ "<b>Backup directory does not exist: </b>","<b>Backup Verzeichnis existiert nicht: </b>" },
{ "<b>The backup copy command failed!</b>","<b>Das Backup Kopierkommando is fehlgeschlagen!</b>" },
{ "Choose action","Wähle Aktion" },
{ "Comment for todo:","Kommentar zum Todo:" },
{ "Stop+note","Stop+Notiz" },
{ "Agenda view shows completed todos","Agenda Ansicht zeigt erledigte Todos" },
-{ "","" },
-{ "","" },
+{ "KO/Pi: Missing alarm notification!","KO/Pi: Benachrichtigung über verpasste Alarme!" },
+{ "You missed the alarms for the following events or todos:","Sie verpassten die Alarme für folgende Termine oder Todos:" },
{ "","" },
{ "","" },
{ "","" },
{ "","" },
{ "","" },
{ "","" },
{ "","" }, \ No newline at end of file
diff --git a/korganizer/calendarview.cpp b/korganizer/calendarview.cpp
index 503ef12..36db9c4 100644
--- a/korganizer/calendarview.cpp
+++ b/korganizer/calendarview.cpp
@@ -133,16 +133,134 @@
#include <kabc/stdaddressbook.h>
#endif
using namespace KOrg;
using namespace KCal;
extern int globalFlagBlockAgenda;
extern int globalFlagBlockStartup;
+MissedAlarmTextBrowser::MissedAlarmTextBrowser(QWidget *parent, QPtrList<Incidence> alarms,QDateTime start ) : QTextBrowser(parent)
+
+{
+ mAlarms = alarms;
+ setBackgroundColor( QColor( 86, 153, 205 ) );
+ QString mText = "<table width=\"100%\">\n";
+ //mText += "<tr bgcolor=\"#3679AD\"><td><h2>";
+#ifdef DESKTOP_VERSION
+ mText += "<tr bgcolor=\"#5699CD\"><td align=\"center\"><h1>";
+#else
+ mText += "<tr bgcolor=\"#5699CD\"><td align=\"center\"><h2>";
+#endif
+ // mText += "<img src=\"";
+ // mText += ipath;
+ // mText += "\">";
+ //mEventDate = QDate::currentDate();
+#ifdef DESKTOP_VERSION
+ mText += "<font color=\"#FFFFFF\"> <em>" + i18n("You missed the alarms for the following events or todos:")+"</em></font></h1>";
+#else
+ mText += "<font color=\"#FFFFFF\"> <em>" + i18n("You missed the alarms for the following events or todos:")+"</em></font></h2>";
+#endif
+ mText += "</td></tr>\n<tr bgcolor=\"#FF997D\"><td>";
+
+ Incidence * inc = getNextInc( start );
+ int time = 0;
+ mText += "<table>";
+ while ( inc ) {
+ QDateTime dt ;
+ QString tempText = "<a ";
+ bool ok;
+ dt = inc->getNextOccurence( start, &ok );
+ if ( !ok ) continue;
+ if ( inc->type() == "Event" ) {
+ tempText += "href=\"event:";
+ } else if ( inc->type() == "Todo" ) {
+ tempText += "href=\"todo:";
+ }
+ tempText += inc->uid() + "\">";
+ if ( inc->type() == "Todo" )
+ tempText += i18n("Todo: ");
+ if ( inc->summary().length() > 0 )
+ tempText += inc->summary();
+ else
+ tempText += i18n("-no summary-");
+ QString timestr;
+ if (!inc->doesFloat())
+ timestr = KGlobal::locale()->formatDateTime( dt, KOPrefs::instance()->mShortDateInViewer) +": ";
+ else
+ timestr = KGlobal::locale()->formatDate( dt.date() , KOPrefs::instance()->mShortDateInViewer) +": ";
+ if ( dt.date() == QDate::currentDate() && time == 0 ) {
+ time = 1;
+ mText +="</table>";
+ mText += "</td></tr>\n<tr bgcolor=\"#FFDC64\"><td>";
+ mText += "<table>";
+
+ }
+ if ( dt.date() > QDate::currentDate() && time != 2 ) {
+ time = 2;
+ mText +="</table>";
+ mText += "</td></tr>\n<tr bgcolor=\"#6AFF6A\"><td>";
+ mText += "<table>";
+ }
+ mText +="<tr><td><b>";
+ mText += timestr;
+ mText += "</b></td><td>";
+ mText += tempText;
+ mText += "</td></tr>\n";
+ inc = getNextInc( start );
+ }
+ mText +="</table>";
+ setText( mText );
+}
+
+Incidence * MissedAlarmTextBrowser::getNextInc( QDateTime start )
+{
+ QDateTime dt ;
+ Incidence * retInc;
+ Incidence * inc = mAlarms.first();
+ if ( inc == 0 )
+ return 0;
+ bool ok;
+ dt = inc->getNextOccurence( start, &ok );
+ if ( ! ok ) return 0;
+ QDateTime dtn ;
+ retInc = inc;
+ inc = mAlarms.next();
+ while ( inc ) {
+ dtn = inc->getNextOccurence( start, &ok );
+ if ( ! ok ) return 0;
+ if ( dtn < dt ) {
+ dt = dtn;
+ retInc = inc;
+ }
+ inc = mAlarms.next();
+ }
+ mAlarms.remove( retInc );
+ return retInc;
+
+}
+void MissedAlarmTextBrowser::setSource(const QString & n)
+{
+ if (n.startsWith("event:")) {
+#ifdef DESKTOP_VERSION
+ emit showIncidence(n.mid(8));
+#else
+ emit showIncidence(n.mid(6));
+#endif
+ return;
+ } else if (n.startsWith("todo:")) {
+#ifdef DESKTOP_VERSION
+ emit showIncidence(n.mid(7));
+#else
+ emit showIncidence(n.mid(5));
+#endif
+ return;
+ }
+}
+
class KOBeamPrefs : public QDialog
{
public:
KOBeamPrefs( QWidget *parent=0, const char *name=0 ) :
QDialog( parent, name, true )
{
setCaption( i18n("Beam Options") );
@@ -501,17 +619,55 @@ CalendarView::~CalendarView()
delete mDialogManager;
delete mViewManager;
delete mStorage;
delete mDateFrame ;
delete beamDialog;
delete mEventViewerDialog;
//kdDebug() << "~CalendarView() done" << endl;
}
+void CalendarView::checkAlarms()
+{
+ KConfig *config = KOGlobals::config();
+ config->setGroup( "AppRun" );
+ QDateTime dt ( QDate (2005,1,1), QTime( 0,0,0 ) );
+ int secs = config->readNumEntry( "LatestProgramStop" ) - 30;
+ //secs -= ( 3600 * 24*3 ); // debug only
+ QDateTime latest = dt.addSecs ( secs );
+ qDebug("KO: Last termination on %s ", latest.toString().latin1());
+ QPtrList<Incidence> el = mCalendar->rawIncidences();
+ QPtrList<Incidence> al;
+ Incidence* inL = el.first();
+ while ( inL ) {
+ bool ok = false;
+ int offset = 0;
+ QDateTime next = inL->getNextAlarmDateTime(& ok, &offset, latest ) ;
+ if ( ok ) {
+ //qDebug("OK %s",next.toString().latin1());
+ if ( next < QDateTime::currentDateTime() ) {
+ al.append( inL );
+ qDebug("found missed alarm: %s ", inL->summary().latin1() );
+ }
+ }
+ inL = el.next();
+ }
+ if ( al.count() ) {
+ QDialog dia ( this, "huhu", true );
+ dia.setCaption( i18n("KO/Pi: Missing alarm notification!") );
+ QVBoxLayout* lay = new QVBoxLayout( &dia );
+ lay->setSpacing( 3 );
+ lay->setMargin( 3 );
+ MissedAlarmTextBrowser* matb = new MissedAlarmTextBrowser ( &dia, al, latest );
+ connect( matb, SIGNAL( showIncidence( QString ) ),SLOT( showIncidence( QString ) ));
+ lay->addWidget( matb );
+ dia.resize(240,240);
+ dia.exec();
+ }
+}
void CalendarView::showDay( QDate d )
{
dateNavigator()->blockSignals( true );
dateNavigator()->selectDate( d );
dateNavigator()->blockSignals( false );
mViewManager->showDayView();
//dateNavigator()->selectDate( d );
}
@@ -1964,17 +2120,19 @@ void CalendarView::writeSettings()
mViewManager->writeSettings( config );
mTodoList->saveLayout(config,QString("Todo Layout"));
mDialogManager->writeSettings( config );
//KOPrefs::instance()->usrWriteConfig();
KOPrefs::instance()->writeConfig();
writeFilterSettings(config);
-
+ config->setGroup( "AppRun" );
+ QDateTime dt ( QDate (2005,1,1), QTime( 0,0,0 ) );
+ config->writeEntry( "LatestProgramStop", dt.secsTo( QDateTime::currentDateTime() ) );
config->setGroup( "Views" );
config->writeEntry( "ShownDatesCount", mNavigator->selectedDates().count() );
QValueList<int> listINT = mLeftFrame->sizes();
config->writeEntry("Left Splitter Frame",listINT);
QValueList<int> listINT2 = mMainFrame->sizes();
config->writeEntry("Main Splitter Frame",listINT2);
#ifdef DESKTOP_VERSION
@@ -3916,17 +4074,22 @@ void CalendarView::editIncidence()
void CalendarView::deleteIncidence()
{
Incidence *incidence = currentSelection();
if ( !incidence ) incidence = mTodoList->selectedIncidences().first();
if ( incidence ) {
deleteIncidence(incidence);
}
}
-
+void CalendarView::showIncidence(QString uid)
+{
+ Incidence *inc = mCalendar->incidence( uid );
+ if ( inc )
+ showIncidence( inc );
+}
void CalendarView::showIncidence(Incidence *incidence)
{
mViewerCallerIsSearchDialog = false;
//qDebug("%x %x ",sender (), mDialogManager->getSearchDialog() );
if ( sender() && mDialogManager->getSearchDialog() ) {
if ( sender () == mDialogManager->getSearchDialog()->listview() ) {
mViewerCallerIsSearchDialog = true;
}
diff --git a/korganizer/calendarview.h b/korganizer/calendarview.h
index 05a34b4..1eca905 100644
--- a/korganizer/calendarview.h
+++ b/korganizer/calendarview.h
@@ -75,16 +75,34 @@ using namespace KCal;
This is the main calendar widget. It provides the different vies on t he
calendar data as well as the date navigator. It also handles synchronisation
of the different views and controls the different dialogs like preferences,
event editor, search dialog etc.
@short main calendar view widget
@author Cornelius Schumacher
*/
+
+#include <qtextbrowser.h>
+#include <qtextcodec.h>
+
+class MissedAlarmTextBrowser : public QTextBrowser {
+ Q_OBJECT
+ public:
+ MissedAlarmTextBrowser(QWidget *parent, QPtrList<Incidence> alarms ,QDateTime start);
+ void setSource(const QString & n);
+
+ private:
+ Incidence * getNextInc(QDateTime start );
+ QPtrList<Incidence> mAlarms;
+ signals:
+ void showIncidence( QString uid);
+};
+
+
class CalendarView : public KOrg::CalendarViewBase, public KCal::Calendar::Observer, public KSyncInterface
{
Q_OBJECT
public:
/**
Constructs a new calendar view widget.
@param calendar calendar document
@@ -171,16 +189,17 @@ class CalendarView : public KOrg::CalendarViewBase, public KCal::Calendar::Obser
/** Send status message, which can e.g. be displayed in the status bar. */
void statusMessage(const QString &);
void calendarViewExpanded( bool );
void updateSearchDialog();
public slots:
+ void checkAlarms();
void slotprintSelInc();
void showNextAlarms();
void showOpenError();
void watchSavedFile();
void recheckTimerAlarm();
void checkNextTimerAlarm();
void addAlarm(const QDateTime &qdt, const QString &noti );
void addSuspendAlarm(const QDateTime &qdt, const QString &noti );
@@ -235,16 +254,17 @@ class CalendarView : public KOrg::CalendarViewBase, public KCal::Calendar::Obser
void newEvent(QDate dt);
/** create new event without having a date hint. Takes current date as
default hint. */
void newEvent();
void newFloatingEvent();
/** Create a read-only viewer dialog for the supplied incidence. It calls the correct showXXX method*/
void showIncidence(Incidence *);
+ void showIncidence(QString uid);
/** Create an editor for the supplied incidence. It calls the correct editXXX method*/
void editIncidence(Incidence *);
/** Delete the supplied incidence. It calls the correct deleteXXX method*/
void deleteIncidence(Incidence *);
void cloneIncidence(Incidence *);
void cancelIncidence(Incidence *);
/** Create an editor for the supplied event. */
void editEvent(Event *);
diff --git a/korganizer/kotodoview.cpp b/korganizer/kotodoview.cpp
index 8fe9999..5aaf360 100644
--- a/korganizer/kotodoview.cpp
+++ b/korganizer/kotodoview.cpp
@@ -472,18 +472,20 @@ KOTodoView::KOTodoView(Calendar *calendar,QWidget* parent,const char* name) :
mItemPopupMenu->insertItem(i18n("Edit..."), this,
SLOT (editTodo()));
mItemPopupMenu->insertItem( i18n("Delete"), this,
SLOT (deleteTodo()));
mItemPopupMenu->insertItem( i18n("Clone..."), this,
SLOT (cloneTodo()));
mItemPopupMenu->insertItem( i18n("Move..."), this,
SLOT (moveTodo()));
+#ifndef DESKTOP_VERSION
mItemPopupMenu->insertItem( i18n("Beam..."), this,
SLOT (beamTodo()));
+#endif
mItemPopupMenu->insertItem( i18n("Toggle Cancel"), this,
SLOT (cancelTodo()));
mItemPopupMenu->insertSeparator();
mItemPopupMenu->insertItem( i18n("Start/Stop todo..."), this,
SLOT (toggleRunningItem()));
mItemPopupMenu->insertSeparator();
/*
mItemPopupMenu->insertItem( i18n("New Todo..."), this,
diff --git a/korganizer/mainwindow.cpp b/korganizer/mainwindow.cpp
index 94d7293..1320231 100644
--- a/korganizer/mainwindow.cpp
+++ b/korganizer/mainwindow.cpp
@@ -367,16 +367,18 @@ MainWindow::MainWindow( QWidget *parent, const char *name, QString msg) :
infrared = 0;
#endif
updateFilterToolbar();
updateWeek( mView->startDate() );
connect( mView->dateNavigator(), SIGNAL( datesSelected( const KCal::DateList & ) ),
SLOT( updateWeekNum( const KCal::DateList & ) ) );
mBRdisabled = false;
//toggleBeamReceive();
+
+ QTimer::singleShot( 1000, mView, SLOT ( checkAlarms() ));
}
MainWindow::~MainWindow()
{
//qDebug("MainWindow::~MainWindow() ");
//save toolbar location
delete mCalendar;
delete mSyncManager;
#ifndef DESKTOP_VERSION
@@ -792,16 +794,18 @@ void MainWindow::initActions()
connect( mView->viewManager(), SIGNAL( signalFullScreen( bool ) ),
mToggleNav, SLOT( setEnabled ( bool ) ) );
connect( mView->viewManager(), SIGNAL( signalFullScreen( bool ) ),
mToggleFilter, SLOT( setEnabled ( bool ) ) );
connect( mView->viewManager(), SIGNAL( signalAgendaView( bool ) ),
mToggleAllday, SLOT( setEnabled ( bool ) ) );
+ // connect( mView->viewManager(), SIGNAL( signalAgendaView( bool ) ),
+ // configureAgendaMenu, SLOT( setEnabled ( bool ) ) );
viewMenu->insertSeparator();
icon = loadPixmap( pathString + "picker" );
action = new QAction( i18n("Date Picker"), icon, i18n("Date Picker"), 0, this );
action->addTo( viewMenu );
connect( action, SIGNAL( activated() ),
mView, SLOT( showDatePicker() ) );
action->addTo( iconToolBar );
diff --git a/libkcal/calendarlocal.cpp b/libkcal/calendarlocal.cpp
index e75df70..bc76c0b 100644
--- a/libkcal/calendarlocal.cpp
+++ b/libkcal/calendarlocal.cpp
@@ -301,17 +301,17 @@ void CalendarLocal::checkAlarmForIncidence( Incidence * incidence, bool deleted
int offset;
QDateTime nextA;
// QString nextSum;
//QDateTime nextEvent;
if ( mNextAlarmIncidence == 0 || incidence == 0 ) {
computeNextAlarm = true;
} else {
if ( ! deleted ) {
- nextA = incidence->getNextAlarmDateTime(& ok, &offset ) ;
+ nextA = incidence->getNextAlarmDateTime(& ok, &offset, QDateTime::currentDateTime() ) ;
if ( ok ) {
if ( nextA < mNextAlarmDateTime ) {
deRegisterAlarm();
mNextAlarmDateTime = nextA;
mNextSummary = incidence->summary();
mNextAlarmEventDateTime = nextA.addSecs(offset ) ;
mNextAlarmEventDateTimeString = KGlobal::locale()->formatDateTime(mNextAlarmEventDateTime);
newNextAlarm = true;
@@ -416,30 +416,30 @@ QDateTime CalendarLocal::nextAlarm( int daysTo )
QDateTime start = QDateTime::currentDateTime().addSecs( 30 );
QDateTime next;
Event *e;
bool ok;
bool found = false;
int offset;
mNextAlarmIncidence = 0;
for( e = mEventList.first(); e; e = mEventList.next() ) {
- next = e->getNextAlarmDateTime(& ok, &offset ) ;
+ next = e->getNextAlarmDateTime(& ok, &offset, QDateTime::currentDateTime() ) ;
if ( ok ) {
if ( next < nextA ) {
nextA = next;
found = true;
mNextSummary = e->summary();
mNextAlarmEventDateTime = next.addSecs(offset ) ;
mNextAlarmIncidence = (Incidence *) e;
}
}
}
Todo *t;
for( t = mTodoList.first(); t; t = mTodoList.next() ) {
- next = t->getNextAlarmDateTime(& ok, &offset ) ;
+ next = t->getNextAlarmDateTime(& ok, &offset, QDateTime::currentDateTime() ) ;
if ( ok ) {
if ( next < nextA ) {
nextA = next;
found = true;
mNextSummary = t->summary();
mNextAlarmEventDateTime = next.addSecs(offset );
mNextAlarmIncidence = (Incidence *) t;
}
diff --git a/libkcal/event.cpp b/libkcal/event.cpp
index de8dceb..9b99855 100644
--- a/libkcal/event.cpp
+++ b/libkcal/event.cpp
@@ -166,21 +166,21 @@ Event::Transparency Event::transparency() const
return mTransparency;
}
void Event::setDuration(int seconds)
{
setHasEndDate(false);
Incidence::setDuration(seconds);
}
-QDateTime Event::getNextAlarmDateTime( bool * ok, int * offset ) const
+QDateTime Event::getNextAlarmDateTime( bool * ok, int * offset, QDateTime start_dt ) const
{
bool yes;
- QDateTime incidenceStart = getNextOccurence( QDateTime::currentDateTime(), &yes );
+ QDateTime incidenceStart = getNextOccurence( start_dt, &yes );
if ( ! yes || cancelled() ) {
*ok = false;
return QDateTime ();
}
bool enabled = false;
Alarm* alarm;
int off = 0;
@@ -204,17 +204,17 @@ QDateTime Event::getNextAlarmDateTime( bool * ok, int * offset ) const
alarmStart = incidenceStart.addSecs( secs );
enabled = true;
off = -secs;
}
}
}
}
if ( enabled ) {
- if ( alarmStart > QDateTime::currentDateTime() ) {
+ if ( alarmStart > start_dt ) {
*ok = true;
* offset = off;
return alarmStart;
}
}
*ok = false;
return QDateTime ();
diff --git a/libkcal/event.h b/libkcal/event.h
index 3bc8adc..8729956 100644
--- a/libkcal/event.h
+++ b/libkcal/event.h
@@ -37,17 +37,17 @@ class Event : public Incidence
typedef ListBase<Event> List;
Event();
Event(const Event &);
~Event();
QCString type() const { return "Event"; }
Incidence *clone();
- QDateTime getNextAlarmDateTime( bool * ok, int * offset ) const;
+ QDateTime getNextAlarmDateTime( bool * ok, int * offset ,QDateTime start_dt ) const;
/** for setting an event's ending date/time with a QDateTime. */
void setDtEnd(const QDateTime &dtEnd);
/** Return the event's ending date/time as a QDateTime. */
virtual QDateTime dtEnd() const;
/** returns an event's end time as a string formatted according to the
users locale settings */
QString dtEndTimeStr() const;
diff --git a/libkcal/incidence.h b/libkcal/incidence.h
index ebd50d0..aa51e84 100644
--- a/libkcal/incidence.h
+++ b/libkcal/incidence.h
@@ -109,17 +109,17 @@ class Incidence : public IncidenceBase
bool accept(Visitor &v) { return v.visit(this); }
</pre>
*/
virtual bool accept(Visitor &) { return false; }
virtual Incidence *clone() = 0;
virtual void cloneRelations( Incidence * );
- virtual QDateTime getNextAlarmDateTime( bool * ok, int * offset ) const = 0;
+ virtual QDateTime getNextAlarmDateTime( bool * ok, int * offset, QDateTime start_dt ) const = 0;
void setReadOnly( bool );
/**
Recreate event. The event is made a new unique event, but already stored
event information is preserved. Sets uniquie id, creation date, last
modification date and revision number.
*/
void recreate();
diff --git a/libkcal/journal.cpp b/libkcal/journal.cpp
index 351fb32..859161f 100644
--- a/libkcal/journal.cpp
+++ b/libkcal/journal.cpp
@@ -37,13 +37,13 @@ Incidence *Journal::clone()
bool KCal::operator==( const Journal& j1, const Journal& j2 )
{
return operator==( (const Incidence&)j1, (const Incidence&)j2 );
}
-QDateTime Journal::getNextAlarmDateTime( bool * ok, int * offset ) const
+QDateTime Journal::getNextAlarmDateTime( bool * ok, int * offset, QDateTime start_dt ) const
{
*ok = false;
return QDateTime ();
}
diff --git a/libkcal/journal.h b/libkcal/journal.h
index cb90c7a..2c1d7ea 100644
--- a/libkcal/journal.h
+++ b/libkcal/journal.h
@@ -34,17 +34,17 @@ class Journal : public Incidence
{
public:
Journal();
~Journal();
QCString type() const { return "Journal"; }
Incidence *clone();
- QDateTime getNextAlarmDateTime( bool * ok, int * offset ) const;
+ QDateTime getNextAlarmDateTime( bool * ok, int * offset ,QDateTime start_dt ) const;
private:
bool accept(Visitor &v) { return v.visit(this); }
};
bool operator==( const Journal&, const Journal& );
}
#endif
diff --git a/libkcal/todo.cpp b/libkcal/todo.cpp
index d7431c7..473247a 100644
--- a/libkcal/todo.cpp
+++ b/libkcal/todo.cpp
@@ -510,17 +510,17 @@ void Todo::setPercentComplete(int v)
if ( !setRecurDates() )
v = 0;
}
mPercentComplete = v;
if ( v != 100 )
mHasCompletedDate = false;
updated();
}
-QDateTime Todo::getNextAlarmDateTime( bool * ok, int * offset ) const
+QDateTime Todo::getNextAlarmDateTime( bool * ok, int * offset, QDateTime start_dt ) const
{
if ( isCompleted() || ! hasDueDate() || cancelled() ) {
*ok = false;
return QDateTime ();
}
QDateTime incidenceStart;
incidenceStart = dtDue();
bool enabled = false;
@@ -546,17 +546,17 @@ QDateTime Todo::getNextAlarmDateTime( bool * ok, int * offset ) const
alarmStart = incidenceStart.addSecs( secs );
enabled = true;
off = -secs;
}
}
}
}
if ( enabled ) {
- if ( alarmStart > QDateTime::currentDateTime() ) {
+ if ( alarmStart > start_dt ) {
*ok = true;
* offset = off;
return alarmStart;
}
}
*ok = false;
return QDateTime ();
diff --git a/libkcal/todo.h b/libkcal/todo.h
index a5354ce..ab8fdf1 100644
--- a/libkcal/todo.h
+++ b/libkcal/todo.h
@@ -39,17 +39,17 @@ namespace KCal {
Todo();
Todo(const Todo &);
~Todo();
typedef ListBase<Todo> List;
QCString type() const { return "Todo"; }
/** Return an exact copy of this todo. */
Incidence *clone();
- QDateTime getNextAlarmDateTime( bool * ok, int * offset ) const;
+ QDateTime getNextAlarmDateTime( bool * ok, int * offset, QDateTime start_dt ) const;
/** for setting the todo's due date/time with a QDateTime. */
void setDtDue(const QDateTime &dtDue);
/** returns an event's Due date/time as a QDateTime. */
QDateTime dtDue() const;
/** returns an event's due time as a string formatted according to the
users locale settings */
QString dtDueTimeStr() const;