summaryrefslogtreecommitdiffabout
Unidiff
Diffstat (more/less context) (ignore 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
@@ -1371,6 +1371,6 @@
1371{ "Stop+note","Stop+Notiz" }, 1371{ "Stop+note","Stop+Notiz" },
1372{ "Agenda view shows completed todos","Agenda Ansicht zeigt erledigte Todos" }, 1372{ "Agenda view shows completed todos","Agenda Ansicht zeigt erledigte Todos" },
1373{ "","" }, 1373{ "KO/Pi: Missing alarm notification!","KO/Pi: Benachrichtigung über verpasste Alarme!" },
1374{ "","" }, 1374{ "You missed the alarms for the following events or todos:","Sie verpassten die Alarme für folgende Termine oder Todos:" },
1375{ "","" }, 1375{ "","" },
1376{ "","" }, 1376{ "","" },
diff --git a/korganizer/calendarview.cpp b/korganizer/calendarview.cpp
index 503ef12..36db9c4 100644
--- a/korganizer/calendarview.cpp
+++ b/korganizer/calendarview.cpp
@@ -139,4 +139,122 @@ extern int globalFlagBlockStartup;
139 139
140 140
141MissedAlarmTextBrowser::MissedAlarmTextBrowser(QWidget *parent, QPtrList<Incidence> alarms,QDateTime start ) : QTextBrowser(parent)
142
143{
144 mAlarms = alarms;
145 setBackgroundColor( QColor( 86, 153, 205 ) );
146 QString mText = "<table width=\"100%\">\n";
147 //mText += "<tr bgcolor=\"#3679AD\"><td><h2>";
148#ifdef DESKTOP_VERSION
149 mText += "<tr bgcolor=\"#5699CD\"><td align=\"center\"><h1>";
150#else
151 mText += "<tr bgcolor=\"#5699CD\"><td align=\"center\"><h2>";
152#endif
153 // mText += "<img src=\"";
154 // mText += ipath;
155 // mText += "\">";
156 //mEventDate = QDate::currentDate();
157#ifdef DESKTOP_VERSION
158 mText += "<font color=\"#FFFFFF\"> <em>" + i18n("You missed the alarms for the following events or todos:")+"</em></font></h1>";
159#else
160 mText += "<font color=\"#FFFFFF\"> <em>" + i18n("You missed the alarms for the following events or todos:")+"</em></font></h2>";
161#endif
162 mText += "</td></tr>\n<tr bgcolor=\"#FF997D\"><td>";
163
164 Incidence * inc = getNextInc( start );
165 int time = 0;
166 mText += "<table>";
167 while ( inc ) {
168 QDateTime dt ;
169 QString tempText = "<a ";
170 bool ok;
171 dt = inc->getNextOccurence( start, &ok );
172 if ( !ok ) continue;
173 if ( inc->type() == "Event" ) {
174 tempText += "href=\"event:";
175 } else if ( inc->type() == "Todo" ) {
176 tempText += "href=\"todo:";
177 }
178 tempText += inc->uid() + "\">";
179 if ( inc->type() == "Todo" )
180 tempText += i18n("Todo: ");
181 if ( inc->summary().length() > 0 )
182 tempText += inc->summary();
183 else
184 tempText += i18n("-no summary-");
185 QString timestr;
186 if (!inc->doesFloat())
187 timestr = KGlobal::locale()->formatDateTime( dt, KOPrefs::instance()->mShortDateInViewer) +": ";
188 else
189 timestr = KGlobal::locale()->formatDate( dt.date() , KOPrefs::instance()->mShortDateInViewer) +": ";
190 if ( dt.date() == QDate::currentDate() && time == 0 ) {
191 time = 1;
192 mText +="</table>";
193 mText += "</td></tr>\n<tr bgcolor=\"#FFDC64\"><td>";
194 mText += "<table>";
195
196 }
197 if ( dt.date() > QDate::currentDate() && time != 2 ) {
198 time = 2;
199 mText +="</table>";
200 mText += "</td></tr>\n<tr bgcolor=\"#6AFF6A\"><td>";
201 mText += "<table>";
202 }
203 mText +="<tr><td><b>";
204 mText += timestr;
205 mText += "</b></td><td>";
206 mText += tempText;
207 mText += "</td></tr>\n";
208 inc = getNextInc( start );
209 }
210 mText +="</table>";
211 setText( mText );
212}
213
214Incidence * MissedAlarmTextBrowser::getNextInc( QDateTime start )
215{
216 QDateTime dt ;
217 Incidence * retInc;
218 Incidence * inc = mAlarms.first();
219 if ( inc == 0 )
220 return 0;
221 bool ok;
222 dt = inc->getNextOccurence( start, &ok );
223 if ( ! ok ) return 0;
224 QDateTime dtn ;
225 retInc = inc;
226 inc = mAlarms.next();
227 while ( inc ) {
228 dtn = inc->getNextOccurence( start, &ok );
229 if ( ! ok ) return 0;
230 if ( dtn < dt ) {
231 dt = dtn;
232 retInc = inc;
233 }
234 inc = mAlarms.next();
235 }
236 mAlarms.remove( retInc );
237 return retInc;
238
239}
240void MissedAlarmTextBrowser::setSource(const QString & n)
241{
242 if (n.startsWith("event:")) {
243#ifdef DESKTOP_VERSION
244 emit showIncidence(n.mid(8));
245#else
246 emit showIncidence(n.mid(6));
247#endif
248 return;
249 } else if (n.startsWith("todo:")) {
250#ifdef DESKTOP_VERSION
251 emit showIncidence(n.mid(7));
252#else
253 emit showIncidence(n.mid(5));
254#endif
255 return;
256 }
257}
258
141 259
142class KOBeamPrefs : public QDialog 260class KOBeamPrefs : public QDialog
@@ -507,5 +625,43 @@ CalendarView::~CalendarView()
507 //kdDebug() << "~CalendarView() done" << endl; 625 //kdDebug() << "~CalendarView() done" << endl;
508} 626}
627void CalendarView::checkAlarms()
628{
629 KConfig *config = KOGlobals::config();
630 config->setGroup( "AppRun" );
631 QDateTime dt ( QDate (2005,1,1), QTime( 0,0,0 ) );
632 int secs = config->readNumEntry( "LatestProgramStop" ) - 30;
633 //secs -= ( 3600 * 24*3 ); // debug only
634 QDateTime latest = dt.addSecs ( secs );
635 qDebug("KO: Last termination on %s ", latest.toString().latin1());
636 QPtrList<Incidence> el = mCalendar->rawIncidences();
637 QPtrList<Incidence> al;
638 Incidence* inL = el.first();
639 while ( inL ) {
640 bool ok = false;
641 int offset = 0;
642 QDateTime next = inL->getNextAlarmDateTime(& ok, &offset, latest ) ;
643 if ( ok ) {
644 //qDebug("OK %s",next.toString().latin1());
645 if ( next < QDateTime::currentDateTime() ) {
646 al.append( inL );
647 qDebug("found missed alarm: %s ", inL->summary().latin1() );
648 }
649 }
650 inL = el.next();
651 }
652 if ( al.count() ) {
653 QDialog dia ( this, "huhu", true );
654 dia.setCaption( i18n("KO/Pi: Missing alarm notification!") );
655 QVBoxLayout* lay = new QVBoxLayout( &dia );
656 lay->setSpacing( 3 );
657 lay->setMargin( 3 );
658 MissedAlarmTextBrowser* matb = new MissedAlarmTextBrowser ( &dia, al, latest );
659 connect( matb, SIGNAL( showIncidence( QString ) ),SLOT( showIncidence( QString ) ));
660 lay->addWidget( matb );
661 dia.resize(240,240);
662 dia.exec();
509 663
664 }
665}
510void CalendarView::showDay( QDate d ) 666void CalendarView::showDay( QDate d )
511{ 667{
@@ -1970,5 +2126,7 @@ void CalendarView::writeSettings()
1970 2126
1971 writeFilterSettings(config); 2127 writeFilterSettings(config);
1972 2128 config->setGroup( "AppRun" );
2129 QDateTime dt ( QDate (2005,1,1), QTime( 0,0,0 ) );
2130 config->writeEntry( "LatestProgramStop", dt.secsTo( QDateTime::currentDateTime() ) );
1973 config->setGroup( "Views" ); 2131 config->setGroup( "Views" );
1974 config->writeEntry( "ShownDatesCount", mNavigator->selectedDates().count() ); 2132 config->writeEntry( "ShownDatesCount", mNavigator->selectedDates().count() );
@@ -3922,5 +4080,10 @@ void CalendarView::deleteIncidence()
3922 } 4080 }
3923} 4081}
3924 4082void CalendarView::showIncidence(QString uid)
4083{
4084 Incidence *inc = mCalendar->incidence( uid );
4085 if ( inc )
4086 showIncidence( inc );
4087}
3925void CalendarView::showIncidence(Incidence *incidence) 4088void CalendarView::showIncidence(Incidence *incidence)
3926{ 4089{
diff --git a/korganizer/calendarview.h b/korganizer/calendarview.h
index 05a34b4..1eca905 100644
--- a/korganizer/calendarview.h
+++ b/korganizer/calendarview.h
@@ -81,4 +81,22 @@ using namespace KCal;
81 @author Cornelius Schumacher 81 @author Cornelius Schumacher
82*/ 82*/
83
84#include <qtextbrowser.h>
85#include <qtextcodec.h>
86
87class MissedAlarmTextBrowser : public QTextBrowser {
88 Q_OBJECT
89 public:
90 MissedAlarmTextBrowser(QWidget *parent, QPtrList<Incidence> alarms ,QDateTime start);
91 void setSource(const QString & n);
92
93 private:
94 Incidence * getNextInc(QDateTime start );
95 QPtrList<Incidence> mAlarms;
96 signals:
97 void showIncidence( QString uid);
98};
99
100
83class CalendarView : public KOrg::CalendarViewBase, public KCal::Calendar::Observer, public KSyncInterface 101class CalendarView : public KOrg::CalendarViewBase, public KCal::Calendar::Observer, public KSyncInterface
84{ 102{
@@ -177,4 +195,5 @@ class CalendarView : public KOrg::CalendarViewBase, public KCal::Calendar::Obser
177 195
178 public slots: 196 public slots:
197 void checkAlarms();
179 void slotprintSelInc(); 198 void slotprintSelInc();
180 void showNextAlarms(); 199 void showNextAlarms();
@@ -241,4 +260,5 @@ class CalendarView : public KOrg::CalendarViewBase, public KCal::Calendar::Obser
241 /** Create a read-only viewer dialog for the supplied incidence. It calls the correct showXXX method*/ 260 /** Create a read-only viewer dialog for the supplied incidence. It calls the correct showXXX method*/
242 void showIncidence(Incidence *); 261 void showIncidence(Incidence *);
262 void showIncidence(QString uid);
243 /** Create an editor for the supplied incidence. It calls the correct editXXX method*/ 263 /** Create an editor for the supplied incidence. It calls the correct editXXX method*/
244 void editIncidence(Incidence *); 264 void editIncidence(Incidence *);
diff --git a/korganizer/kotodoview.cpp b/korganizer/kotodoview.cpp
index 8fe9999..5aaf360 100644
--- a/korganizer/kotodoview.cpp
+++ b/korganizer/kotodoview.cpp
@@ -478,6 +478,8 @@ KOTodoView::KOTodoView(Calendar *calendar,QWidget* parent,const char* name) :
478 mItemPopupMenu->insertItem( i18n("Move..."), this, 478 mItemPopupMenu->insertItem( i18n("Move..."), this,
479 SLOT (moveTodo())); 479 SLOT (moveTodo()));
480#ifndef DESKTOP_VERSION
480 mItemPopupMenu->insertItem( i18n("Beam..."), this, 481 mItemPopupMenu->insertItem( i18n("Beam..."), this,
481 SLOT (beamTodo())); 482 SLOT (beamTodo()));
483#endif
482 mItemPopupMenu->insertItem( i18n("Toggle Cancel"), this, 484 mItemPopupMenu->insertItem( i18n("Toggle Cancel"), this,
483 SLOT (cancelTodo())); 485 SLOT (cancelTodo()));
diff --git a/korganizer/mainwindow.cpp b/korganizer/mainwindow.cpp
index 94d7293..1320231 100644
--- a/korganizer/mainwindow.cpp
+++ b/korganizer/mainwindow.cpp
@@ -373,4 +373,6 @@ MainWindow::MainWindow( QWidget *parent, const char *name, QString msg) :
373 mBRdisabled = false; 373 mBRdisabled = false;
374 //toggleBeamReceive(); 374 //toggleBeamReceive();
375
376 QTimer::singleShot( 1000, mView, SLOT ( checkAlarms() ));
375} 377}
376MainWindow::~MainWindow() 378MainWindow::~MainWindow()
@@ -798,4 +800,6 @@ void MainWindow::initActions()
798 connect( mView->viewManager(), SIGNAL( signalAgendaView( bool ) ), 800 connect( mView->viewManager(), SIGNAL( signalAgendaView( bool ) ),
799 mToggleAllday, SLOT( setEnabled ( bool ) ) ); 801 mToggleAllday, SLOT( setEnabled ( bool ) ) );
802 // connect( mView->viewManager(), SIGNAL( signalAgendaView( bool ) ),
803 // configureAgendaMenu, SLOT( setEnabled ( bool ) ) );
800 804
801 viewMenu->insertSeparator(); 805 viewMenu->insertSeparator();
diff --git a/libkcal/calendarlocal.cpp b/libkcal/calendarlocal.cpp
index e75df70..bc76c0b 100644
--- a/libkcal/calendarlocal.cpp
+++ b/libkcal/calendarlocal.cpp
@@ -307,5 +307,5 @@ void CalendarLocal::checkAlarmForIncidence( Incidence * incidence, bool deleted
307 } else { 307 } else {
308 if ( ! deleted ) { 308 if ( ! deleted ) {
309 nextA = incidence->getNextAlarmDateTime(& ok, &offset ) ; 309 nextA = incidence->getNextAlarmDateTime(& ok, &offset, QDateTime::currentDateTime() ) ;
310 if ( ok ) { 310 if ( ok ) {
311 if ( nextA < mNextAlarmDateTime ) { 311 if ( nextA < mNextAlarmDateTime ) {
@@ -422,5 +422,5 @@ QDateTime CalendarLocal::nextAlarm( int daysTo )
422 mNextAlarmIncidence = 0; 422 mNextAlarmIncidence = 0;
423 for( e = mEventList.first(); e; e = mEventList.next() ) { 423 for( e = mEventList.first(); e; e = mEventList.next() ) {
424 next = e->getNextAlarmDateTime(& ok, &offset ) ; 424 next = e->getNextAlarmDateTime(& ok, &offset, QDateTime::currentDateTime() ) ;
425 if ( ok ) { 425 if ( ok ) {
426 if ( next < nextA ) { 426 if ( next < nextA ) {
@@ -435,5 +435,5 @@ QDateTime CalendarLocal::nextAlarm( int daysTo )
435 Todo *t; 435 Todo *t;
436 for( t = mTodoList.first(); t; t = mTodoList.next() ) { 436 for( t = mTodoList.first(); t; t = mTodoList.next() ) {
437 next = t->getNextAlarmDateTime(& ok, &offset ) ; 437 next = t->getNextAlarmDateTime(& ok, &offset, QDateTime::currentDateTime() ) ;
438 if ( ok ) { 438 if ( ok ) {
439 if ( next < nextA ) { 439 if ( next < nextA ) {
diff --git a/libkcal/event.cpp b/libkcal/event.cpp
index de8dceb..9b99855 100644
--- a/libkcal/event.cpp
+++ b/libkcal/event.cpp
@@ -172,9 +172,9 @@ void Event::setDuration(int seconds)
172 Incidence::setDuration(seconds); 172 Incidence::setDuration(seconds);
173} 173}
174QDateTime Event::getNextAlarmDateTime( bool * ok, int * offset ) const 174QDateTime Event::getNextAlarmDateTime( bool * ok, int * offset, QDateTime start_dt ) const
175{ 175{
176 176
177 bool yes; 177 bool yes;
178 QDateTime incidenceStart = getNextOccurence( QDateTime::currentDateTime(), &yes ); 178 QDateTime incidenceStart = getNextOccurence( start_dt, &yes );
179 if ( ! yes || cancelled() ) { 179 if ( ! yes || cancelled() ) {
180 *ok = false; 180 *ok = false;
@@ -210,5 +210,5 @@ QDateTime Event::getNextAlarmDateTime( bool * ok, int * offset ) const
210 } 210 }
211 if ( enabled ) { 211 if ( enabled ) {
212 if ( alarmStart > QDateTime::currentDateTime() ) { 212 if ( alarmStart > start_dt ) {
213 *ok = true; 213 *ok = true;
214 * offset = off; 214 * offset = off;
diff --git a/libkcal/event.h b/libkcal/event.h
index 3bc8adc..8729956 100644
--- a/libkcal/event.h
+++ b/libkcal/event.h
@@ -43,5 +43,5 @@ class Event : public Incidence
43 43
44 Incidence *clone(); 44 Incidence *clone();
45 QDateTime getNextAlarmDateTime( bool * ok, int * offset ) const; 45 QDateTime getNextAlarmDateTime( bool * ok, int * offset ,QDateTime start_dt ) const;
46 46
47 /** for setting an event's ending date/time with a QDateTime. */ 47 /** for setting an event's ending date/time with a QDateTime. */
diff --git a/libkcal/incidence.h b/libkcal/incidence.h
index ebd50d0..aa51e84 100644
--- a/libkcal/incidence.h
+++ b/libkcal/incidence.h
@@ -115,5 +115,5 @@ class Incidence : public IncidenceBase
115 virtual void cloneRelations( Incidence * ); 115 virtual void cloneRelations( Incidence * );
116 116
117 virtual QDateTime getNextAlarmDateTime( bool * ok, int * offset ) const = 0; 117 virtual QDateTime getNextAlarmDateTime( bool * ok, int * offset, QDateTime start_dt ) const = 0;
118 void setReadOnly( bool ); 118 void setReadOnly( bool );
119 119
diff --git a/libkcal/journal.cpp b/libkcal/journal.cpp
index 351fb32..859161f 100644
--- a/libkcal/journal.cpp
+++ b/libkcal/journal.cpp
@@ -43,5 +43,5 @@ bool KCal::operator==( const Journal& j1, const Journal& j2 )
43 43
44 44
45QDateTime Journal::getNextAlarmDateTime( bool * ok, int * offset ) const 45QDateTime Journal::getNextAlarmDateTime( bool * ok, int * offset, QDateTime start_dt ) const
46{ 46{
47 *ok = false; 47 *ok = false;
diff --git a/libkcal/journal.h b/libkcal/journal.h
index cb90c7a..2c1d7ea 100644
--- a/libkcal/journal.h
+++ b/libkcal/journal.h
@@ -40,5 +40,5 @@ class Journal : public Incidence
40 40
41 Incidence *clone(); 41 Incidence *clone();
42 QDateTime getNextAlarmDateTime( bool * ok, int * offset ) const; 42 QDateTime getNextAlarmDateTime( bool * ok, int * offset ,QDateTime start_dt ) const;
43private: 43private:
44 bool accept(Visitor &v) { return v.visit(this); } 44 bool accept(Visitor &v) { return v.visit(this); }
diff --git a/libkcal/todo.cpp b/libkcal/todo.cpp
index d7431c7..473247a 100644
--- a/libkcal/todo.cpp
+++ b/libkcal/todo.cpp
@@ -516,5 +516,5 @@ void Todo::setPercentComplete(int v)
516 updated(); 516 updated();
517} 517}
518QDateTime Todo::getNextAlarmDateTime( bool * ok, int * offset ) const 518QDateTime Todo::getNextAlarmDateTime( bool * ok, int * offset, QDateTime start_dt ) const
519{ 519{
520 if ( isCompleted() || ! hasDueDate() || cancelled() ) { 520 if ( isCompleted() || ! hasDueDate() || cancelled() ) {
@@ -552,5 +552,5 @@ QDateTime Todo::getNextAlarmDateTime( bool * ok, int * offset ) const
552 } 552 }
553 if ( enabled ) { 553 if ( enabled ) {
554 if ( alarmStart > QDateTime::currentDateTime() ) { 554 if ( alarmStart > start_dt ) {
555 *ok = true; 555 *ok = true;
556 * offset = off; 556 * offset = off;
diff --git a/libkcal/todo.h b/libkcal/todo.h
index a5354ce..ab8fdf1 100644
--- a/libkcal/todo.h
+++ b/libkcal/todo.h
@@ -45,5 +45,5 @@ namespace KCal {
45 /** Return an exact copy of this todo. */ 45 /** Return an exact copy of this todo. */
46 Incidence *clone(); 46 Incidence *clone();
47 QDateTime getNextAlarmDateTime( bool * ok, int * offset ) const; 47 QDateTime getNextAlarmDateTime( bool * ok, int * offset, QDateTime start_dt ) const;
48 48
49 /** for setting the todo's due date/time with a QDateTime. */ 49 /** for setting the todo's due date/time with a QDateTime. */