summaryrefslogtreecommitdiffabout
Side-by-side diff
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
@@ -1325,57 +1325,57 @@
{ "%1min","%1min" },
{ "( %1 before )","( %1 vorher )" },
{ "The next alarm is in\nless than one minute!","Der nächste Alarm kommt in\nweniger als einer Minute!" },
{ "\nThe internal alarm notification is disabled!\n","\nDie interne Alarmbenachrichtigung ist ausgeschaltet!\n" },
{ "Enable it in the settings menu, TAB alarm.","Schalten Sie sie an im Menu Einstellungen, TAB Alarm." },
{ "Show Sync Events","Zeige Sync-Ereignisse" },
{ "Use short date in WN+Event view","Zeige Kurzdatum in WN+Terminanzeige" },
{ "Number of max.displayed todo prios:","Anzahl max.angezeigter Todo-Prios:" },
{ " on "," am " },
{ "On: ","Am: " },
{ "<i>The recurrence is computed from the start datetime!</i>","<i>Die Wiederholung wird vom Startwert aus berechnet!</i>" },
{ "Start/Stop todo...","Starte/Stoppe Todo..." },
{ "Color for running todos:","Farbe für laufende Todos:" },
{ "The todo\n%1\nis started.\nDo you want to set\nthe state to stopped?","Das Todo\n%1\nist gestartet.\nWollen Sie es\nauf gestoppt setzen?" },
{ "Todo is started","Todo ist gestartet" },
{ "Stop todo","Stoppe Todo" },
{ "Todo is stopped","Todo ist gestoppt" },
{ "Start todo","Starte Todo" },
{ "The todo\n%1\nis stopped.\nDo you want to set\nthe state to started?","Das Todo\n%1\nist gestoppt.\nWollen Sie es auf\ngestartet setzen?" },
{ "The todo\n%1\nwill be cloned!\nIt has subtodos!\nDo you want to clone\nall subtodos as well?","Das Todo\n%1\nwird geklont!\nEs hat Untertodos!\nMöchten Sie alle\nUntertodos auch klonen?" },
{ "Todo has subtodos","Todo hat Untertodos" },
{ "Block popup until mouse button release","Sperre Popup bis Mausknopf losgelassen" },
{ "Colors","Farben" },
{ "Click on new parent item","Klicke auf neues Übertodo" },
{ "Reparenting aborted!","Übertodo setzen abgebrochen" },
{ "Cannot move Todo to itself\nor a child of itself","Kann nicht Todo auf\nsich selbst oder\nein Untertodo verschieben" },
{ "Recursive reparenting not possible!","Rekursives Verschieben nicht möglich" },
{ "Delete all completed todos?\n(Completed recurring todos\nwill not be deleted!)","Entferne alle erledigten Todos?\n(Erledigte wiederholende Todos\nwerden nicht gelöscht!)" },
{ "Alternating background of list views","Abwechselnder Hintergrund für Listen" },
{ "times","Zeiten" },
{ "The todo\n%1\nhas subtodos!\nDo you want to set\nthe categories for\nall subtodos as well?","Das Todo\n%1\nhat Untertodos!\nMöchten Sie die Kategorien\nauch für alle Untertodos setzen?" },
{ "Backup enabled","Backup angeschaltet" },
{ "Use standard backup dir","Standard Backupverzeichnis" },
{ "Number of Backups:","Anzahl der Backups" },
{ "Make backup every ","Mache ein Backup alle " },
{ " days"," Tage" },
{ "Creating backup ... please wait ...","Erzeuge Backup ... bitte warten ..." },
{ "Backup Failed!","Backup Problem!" },
{ "Try again now","Versuche jetzt nochmal" },
{ "Try again later","Versuche später nochmal" },
{ "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
@@ -93,96 +93,214 @@
#include "calprinter.h"
#endif
#ifndef KORG_NOPLUGINS
#include "kocore.h"
#endif
#include "koeventeditor.h"
#include "kotodoeditor.h"
#include "koprefs.h"
#include "koeventviewerdialog.h"
#include "publishdialog.h"
#include "kofilterview.h"
#include "koglobals.h"
#include "koviewmanager.h"
#include "koagendaview.h"
#include "kodialogmanager.h"
#include "outgoingdialog.h"
#include "incomingdialog.h"
#include "datenavigatorcontainer.h"
#include "statusdialog.h"
#include "kdatenavigator.h"
#include "kotodoview.h"
#include "datenavigator.h"
#include "resourceview.h"
#include "navigatorbar.h"
#include "searchdialog.h"
#include "mainwindow.h"
#include "calendarview.h"
#ifndef DESKTOP_VERSION
#include <qtopia/alarmserver.h>
#endif
#ifndef _WIN32_
#include <stdlib.h>
#include <stdio.h>
#include <unistd.h>
#else
#include <qprocess.h>
#endif
#ifdef DESKTOP_VERSION
#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") );
QVBoxLayout* lay = new QVBoxLayout( this );
lay->setSpacing( 3 );
lay->setMargin( 3 );
QButtonGroup* format = new QButtonGroup( 1, Horizontal, i18n("File format"), this );
lay->addWidget( format );
format->setExclusive ( true ) ;
QButtonGroup* time = new QButtonGroup(1, Horizontal, i18n("Time format"), this );
lay->addWidget( time ); time->setExclusive ( true ) ;
vcal = new QRadioButton(" vCalendar ", format );
ical = new QRadioButton(" iCalendar ", format );
vcal->setChecked( true );
tz = new QRadioButton(i18n(" With timezone "), time );
local = new QRadioButton(i18n(" Local time "), time );
tz->setChecked( true );
QPushButton * ok = new QPushButton( i18n("Beam via IR!"), this );
lay->addWidget( ok );
QPushButton * cancel = new QPushButton( i18n("Cancel"), this );
lay->addWidget( cancel );
connect ( ok,SIGNAL(clicked() ),this , SLOT ( accept() ) );
connect (cancel, SIGNAL(clicked() ), this, SLOT ( reject()) );
resize( 200, 200 );
}
bool beamVcal() { return vcal->isChecked(); }
bool beamLocal() { return local->isChecked(); }
private:
QRadioButton* vcal, *ical, *local, *tz;
};
class KOCatPrefs : public QDialog
{
public:
KOCatPrefs( QWidget *parent=0, const char *name=0 ) :
QDialog( parent, name, true )
{
setCaption( i18n("Manage new Categories") );
QVBoxLayout* lay = new QVBoxLayout( this );
lay->setSpacing( 3 );
lay->setMargin( 3 );
QLabel * lab = new QLabel( i18n("After importing/loading/syncing\nthere may be new categories in\nevents or todos\nwhich are not in the category list.\nPlease choose what to do:\n "), this );
lay->addWidget( lab );
@@ -461,97 +579,135 @@ void CalendarView::init()
mDateFrame = new QVBox(0,0,WType_Popup);
//mDateFrame->setFrameStyle(QFrame::PopupPanel | QFrame::Raised);
mDateFrame->setFrameStyle( QFrame::WinPanel |QFrame::Raised );
mDateFrame->setLineWidth(3);
mDateFrame->hide();
mDateFrame->setCaption( i18n( "Pick a date to display"));
mDatePicker = new KDatePicker ( mDateFrame , QDate::currentDate() );
connect(mDatePicker,SIGNAL(dateSelected(QDate)),SLOT(slotSelectPickerDate(QDate)));
mEventEditor = mDialogManager->getEventEditor();
mTodoEditor = mDialogManager->getTodoEditor();
mFlagEditDescription = false;
mSuspendTimer = new QTimer( this );
mAlarmTimer = new QTimer( this );
mRecheckAlarmTimer = new QTimer( this );
connect( mRecheckAlarmTimer, SIGNAL( timeout () ), SLOT( recheckTimerAlarm() ) );
connect( mSuspendTimer, SIGNAL( timeout () ), SLOT( suspendAlarm() ) );
connect( mAlarmTimer, SIGNAL( timeout () ), SLOT( timerAlarm() ) );
mAlarmDialog = new AlarmDialog( this );
connect( mAlarmDialog, SIGNAL( addAlarm(const QDateTime &, const QString & ) ), SLOT( addSuspendAlarm(const QDateTime &, const QString & ) ) );
mAlarmDialog->setServerNotification( false );
mAlarmDialog->setSuspendTime( KOPrefs::instance()->mAlarmSuspendTime );
#ifndef DESKTOP_VERSION
//US listen for arriving address resultsets
connect(ExternalAppHandler::instance(), SIGNAL(receivedBirthdayListEvent(const QString&, const QStringList&, const QStringList&, const QStringList&, const QStringList&, const QStringList&, const QStringList&)),
this, SLOT(insertBirthdays(const QString&, const QStringList&, const QStringList&, const QStringList&, const QStringList&, const QStringList&, const QStringList&)));
#endif
mDateNavigator->setCalendar( mCalendar );
}
CalendarView::~CalendarView()
{
// kdDebug() << "~CalendarView()" << endl;
//qDebug("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 );
}
void CalendarView::timerAlarm()
{
//qDebug("CalendarView::timerAlarm() ");
computeAlarm(mAlarmNotification );
}
void CalendarView::suspendAlarm()
{
//qDebug(" CalendarView::suspendAlarm() ");
computeAlarm(mSuspendAlarmNotification );
}
void CalendarView::startAlarm( QString mess , QString filename)
{
topLevelWidget()->showNormal();
topLevelWidget()->setActiveWindow();
topLevelWidget()->raise();
mAlarmDialog->eventNotification( mess, KOPrefs::instance()->mAlarmPlayBeeps, filename, true,KOPrefs::instance()->mAlarmBeepInterval ,KOPrefs::instance()->mAlarmSuspendCount );
QTimer::singleShot( 3000, this, SLOT( checkNextTimerAlarm() ) );
}
void CalendarView::checkNextTimerAlarm()
{
mCalendar->checkAlarmForIncidence( 0, true );
}
void CalendarView::computeAlarm( QString msg )
{
QString mess = msg;
QString mAlarmMessage = mess.mid( 9 );
QString filename = MainWindow::resourcePath();
filename += "koalarm.wav";
QString tempfilename;
if ( mess.left( 13 ) == "suspend_alarm") {
bool error = false;
@@ -1924,97 +2080,99 @@ void CalendarView::readSettings()
mLeftFrame->setSizes(sizes);
sizes = config->readIntListEntry("Main Splitter Frame");
resetval = 0;
maxVal = 0;
if (sizes.count() != 2) {
if ( !KOPrefs::instance()->mVerticalScreen ) {
resetval = mDateNavigator->sizeHint().width()+2;
} else {
resetval = mDateNavigator->sizeHint().height()+2;
}
}
if ( resetval ) {
sizes.clear();
if ( !KOPrefs::instance()->mVerticalScreen ) {
maxVal = QApplication::desktop()->width() -10;
} else {
maxVal = QApplication::desktop()->height()-10;
}
sizes << resetval;
if ( maxVal < resetval + resetval)
resetval = maxVal - resetval;
sizes << resetval;
}
mMainFrame->setSizes(sizes);
if ( dateCount == 5 ) mNavigator->selectWorkWeek();
else if ( dateCount == 7 ) mNavigator->selectWeek();
else mNavigator->selectDates( dateCount );
// mViewManager->readSettings( config );
updateConfig();
globalFlagBlockAgenda = 2;
mViewManager->readSettings( config );
QTimer::singleShot( 1, mDateNavigator, SLOT ( setResizeEnabled() ) );
}
void CalendarView::writeSettings()
{
// kdDebug() << "CalendarView::writeSettings" << endl;
KConfig *config = KOGlobals::config();
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
config->setGroup("WidgetLayout");
QStringList list ;//= config->readListEntry("MainLayout");
int x,y,w,h;
QWidget* wid;
wid = topLevelWidget();
x = wid->geometry().x();
y = wid->geometry().y();
w = wid->width();
h = wid->height();
list.clear();
list << QString::number( x );
list << QString::number( y );
list << QString::number( w );
list << QString::number( h );
config->writeEntry("MainLayout",list );
wid = mEventEditor;
x = wid->geometry().x();
y = wid->geometry().y();
w = wid->width();
h = wid->height();
list.clear();
list << QString::number( x );
list << QString::number( y );
list << QString::number( w );
list << QString::number( h );
config->writeEntry("EditEventLayout",list );
wid = mTodoEditor;
x = wid->geometry().x();
y = wid->geometry().y();
w = wid->width();
h = wid->height();
list.clear();
list << QString::number( x );
list << QString::number( y );
list << QString::number( w );
list << QString::number( h );
config->writeEntry("EditTodoLayout",list );
wid = getEventViewerDialog();
@@ -3876,97 +4034,102 @@ Todo *CalendarView::selectedTodo()
incidence = mTodoList->selectedIncidences().first();
if ( incidence && incidence->type() == "Todo" ) {
return static_cast<Todo *>( incidence );
}
return 0;
}
void CalendarView::dialogClosing(Incidence *in)
{
// mDialogList.remove(in);
}
void CalendarView::showIncidence()
{
mViewerCallerIsSearchDialog = false;
Incidence *incidence = currentSelection();
if ( !incidence ) incidence = mTodoList->selectedIncidences().first();
if ( incidence ) {
ShowIncidenceVisitor v;
v.act( incidence, this );
}
}
void CalendarView::editIncidenceDescription()
{
mFlagEditDescription = true;
editIncidence();
mFlagEditDescription = false;
}
void CalendarView::editIncidence()
{
// qDebug("editIncidence() ");
Incidence *incidence = currentSelection();
if ( !incidence ) incidence = mTodoList->selectedIncidences().first();
if ( incidence ) {
EditIncidenceVisitor v;
v.act( incidence, this );
}
}
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;
}
}
if ( incidence ) {
ShowIncidenceVisitor v;
v.act( incidence, this );
}
}
void CalendarView::editIncidence(Incidence *incidence)
{
if ( incidence ) {
EditIncidenceVisitor v;
v.act( incidence, this );
}
}
void CalendarView::deleteIncidence(Incidence *incidence)
{
//qDebug(" CalendarView::deleteIncidence ");
if ( incidence ) {
DeleteIncidenceVisitor v;
v.act( incidence, this );
}
}
void CalendarView::lookForOutgoingMessages()
{
OutgoingDialog *ogd = mDialogManager->outgoingDialog();
ogd->loadMessages();
}
void CalendarView::lookForIncomingMessages()
{
IncomingDialog *icd = mDialogManager->incomingDialog();
icd->retrieve();
}
bool CalendarView::removeCompletedSubTodos( Todo* t )
diff --git a/korganizer/calendarview.h b/korganizer/calendarview.h
index 05a34b4..1eca905 100644
--- a/korganizer/calendarview.h
+++ b/korganizer/calendarview.h
@@ -35,256 +35,276 @@
#else
#define Ir char
#endif
#include <libkcal/calendar.h>
#include <libkcal/scheduler.h>
#include <libkcal/calendarresources.h>
#include <libkcal/resourcecalendar.h>
#include <KDGanttMinimizeSplitter.h>
#include <korganizer/calendarviewbase.h>
#include <ksyncmanager.h>
class QWidgetStack;
class QSplitter;
class CalPrinter;
class KOFilterView;
class KOViewManager;
class KODialogManager;
class KOTodoView;
class KDateNavigator;
class DateNavigatorContainer;
class DateNavigator;
class KOIncidenceEditor;
class KDatePicker;
class ResourceView;
class KOEventEditor;
class KOTodoEditor ;
class KOEventViewerDialog;
class KOBeamPrefs;
class KSyncProfile;
class AlarmDialog;
class KCal::Attendee;
namespace KCal { class FileStorage; }
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
@param parent parent window
@param name Qt internal widget object name
*/
CalendarView( CalendarResources *calendar, QWidget *parent = 0,
const char *name = 0 );
CalendarView( Calendar *calendar, QWidget *parent = 0,
const char *name = 0 );
virtual ~CalendarView();
Calendar *calendar() { return mCalendar; }
KOViewManager *viewManager();
KODialogManager *dialogManager();
QDate startDate();
QDate endDate();
QWidgetStack *viewStack();
QWidget *leftFrame();
DateNavigator *dateNavigator();
KDateNavigator *dateNavigatorWidget();
void addView(KOrg::BaseView *);
void showView(KOrg::BaseView *);
KOEventViewerDialog* getEventViewerDialog();
Incidence *currentSelection();
signals:
void save ();
void saveStopTimer ();
void tempDisableBR(bool);
/** This todo has been modified */
void todoModified(Todo *, int);
/** when change is made to options dialog, the topwidget will catch this
* and emit this signal which notifies all widgets which have registered
* for notification to update their settings. */
void configChanged();
/** emitted when the topwidget is closing down, so that any attached
child windows can also close. */
void closingDown();
/** emitted right before we die */
void closed(QWidget *);
/** Emitted when state of modified flag changes */
void modifiedChanged(bool);
void signalmodified();
/** Emitted when state of read-only flag changes */
void readOnlyChanged(bool);
/** Emitted when the unit of navigation changes */
void changeNavStringPrev(const QString &);
void changeNavStringNext(const QString &);
/** Emitted when state of events selection has changed and user is organizer*/
void organizerEventsSelected(bool);
/** Emitted when state of events selection has changed and user is attendee*/
void groupEventsSelected(bool);
/**
Emitted when an incidence gets selected. If the selection is cleared the
signal is emitted with 0 as argument.
*/
void incidenceSelected( Incidence * );
/** Emitted, when a todoitem is selected or deselected. */
void todoSelected( bool );
/**
Emitted, when clipboard content changes. Parameter indicates if paste
is possible or not.
*/
void pasteEnabled(bool);
/** Emitted, when the number of incoming messages has changed. */
void numIncomingChanged(int);
/** Emitted, when the number of outgoing messages has changed. */
void numOutgoingChanged(int);
/** 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 );
void removeAlarm(const QDateTime &qdt, const QString &noti );
/** options dialog made a changed to the configuration. we catch this
* and notify all widgets which need to update their configuration. */
void updateConfig();
void insertBirthdays(const QString& uid, const QStringList& birthdayList,
const QStringList& anniversaryList, const QStringList& realNameList,
const QStringList& emailList, const QStringList& assembledNameList,
const QStringList& uidList);
/**
Load calendar from file \a filename. If \a merge is true, load
calendar into existing one, if it is false, clear calendar, before
loading. Return true, if calendar could be successfully loaded.
*/
bool openCalendar(QString filename, bool merge=false);
bool syncCalendar(QString filename,int mode = 0 );
/**
Save calendar data to file. Return true if calendar could be
successfully saved.
*/
bool saveCalendar(QString filename);
/**
Close calendar. Clear calendar data and reset views to display an empty
calendar.
*/
void closeCalendar();
/** Archive old events of calendar */
void archiveCalendar();
void showIncidence();
void editIncidence();
void editIncidenceDescription();
void deleteIncidence();
void cloneIncidence();
void moveIncidence();
void beamIncidence();
void toggleCancelIncidence();
/** create an editeventwin with supplied date/time, and if bool is true,
* make the event take all day. */
void newEvent(QDateTime, QDateTime, bool allDay );
void newEvent(QDateTime, QDateTime);
void newEvent(QDateTime fh);
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 *);
/** Delete the supplied event. */
void deleteEvent(Event *);
/** Delete the event with the given unique ID. Returns false, if event wasn't
found. */
bool deleteEvent(const QString &uid);
/** Create a read-only viewer dialog for the supplied event. */
void showEvent(Event *);
void editJournal(Journal *);
void showJournal(Journal *);
void deleteJournal(Journal *);
/** Create an editor dialog for a todo */
void editTodo(Todo *);
/** Create a read-only viewer dialog for the supplied todo */
void showTodo(Todo *);
/** create new todo */
void newTodo();
void newTodoDateTime(QDateTime, bool allday);
/** create new todo with a parent todo */
void newSubTodo();
/** create new todo with a parent todo */
void newSubTodo(Todo *);
/** Delete todo */
void deleteTodo(Todo *);
/** Check if clipboard contains vCalendar event. The signal pasteEnabled() is
* emitted as result. */
void checkClipboard();
/** using the KConfig associated with the kapp variable, read in the
* settings from the config file.
*/
void readSettings();
/** write current state to config file. */
void writeSettings();
/** read settings for calendar filters */
void readFilterSettings(KConfig *config);
diff --git a/korganizer/kotodoview.cpp b/korganizer/kotodoview.cpp
index 8fe9999..5aaf360 100644
--- a/korganizer/kotodoview.cpp
+++ b/korganizer/kotodoview.cpp
@@ -432,98 +432,100 @@ KOTodoView::KOTodoView(Calendar *calendar,QWidget* parent,const char* name) :
mTodoListView->addColumn(i18n("Sort Id"));
mTodoListView->setColumnAlignment(4,AlignHCenter);
#endif
mTodoListView->setMinimumHeight( 60 );
mTodoListView->setItemsRenameable( true );
mTodoListView->setRenameable( 0 );
mTodoListView->setColumnWidth( 0, 120 );
mTodoListView->setColumnWidthMode(0, QListView::Manual);
mTodoListView->setColumnWidthMode(1, QListView::Manual);
mTodoListView->setColumnWidthMode(2, QListView::Manual);
mTodoListView->setColumnWidthMode(3, QListView::Manual);
mTodoListView->setColumnWidthMode(4, QListView::Manual);
mTodoListView->setColumnWidthMode(5, QListView::Manual);
mTodoListView->setColumnWidthMode(6, QListView::Manual);
mTodoListView->setColumnWidthMode(7, QListView::Manual);
mTodoListView->setColumnWidthMode(8, QListView::Manual);
mKOTodoViewWhatsThis = new KOTodoViewWhatsThis(mTodoListView->viewport(),this);
mPriorityPopupMenu = new QPopupMenu(this);
for (int i = 1; i <= 5; i++) {
QString label = QString ("%1").arg (i);
mPriority[mPriorityPopupMenu->insertItem (label)] = i;
}
connect (mPriorityPopupMenu, SIGNAL(activated (int)), SLOT (setNewPriority(int)));
mPercentageCompletedPopupMenu = new QPopupMenu(this);
for (int i = 0; i <= 100; i+=20) {
QString label = QString ("%1 %").arg (i);
mPercentage[mPercentageCompletedPopupMenu->insertItem (label)] = i;
}
connect (mPercentageCompletedPopupMenu, SIGNAL (activated (int)), SLOT (setNewPercentage (int)));
mItemPopupMenu = new QPopupMenu(this);
mItemPopupMenu->insertItem(i18n("Show..."), this,
SLOT (showTodo()));
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,
SLOT (newTodo()));
*/
mItemPopupMenu->insertItem(i18n("New Sub-Todo..."), this,
SLOT (newSubTodo()));
mItemPopupMenu->insertItem(i18n("Unparent Todo"), this,
SLOT (unparentTodo()),0,21);
mItemPopupMenu->insertItem(i18n("Reparent Todo"), this,
SLOT (reparentTodo()),0,22);
mItemPopupMenu->insertSeparator();
#if 0
mItemPopupMenu->insertItem(i18n("Delete completed To-Dos","Purge Completed"),
this, SLOT( purgeCompleted() ) );
mItemPopupMenu->insertItem(i18n("toggle completed To-Dos","Show Completed"),
this, SLOT( toggleCompleted() ),0, 33 );
mItemPopupMenu->insertItem(i18n("toggle quick todo","Show Quick Todo"),
this, SLOT( toggleQuickTodo() ),0, 34 );
mItemPopupMenu->insertItem(i18n("toggle running todo","Hide not Running"),
this, SLOT( toggleRunning() ),0, 35 );
#endif
mPopupMenu = new QPopupMenu(this);
mPopupMenu->insertItem(SmallIconSet("todo"), i18n("New Todo..."), this,
SLOT (newTodo()),0,1);
mPopupMenu->insertItem(i18n("delete completed To-Dos","Purge Completed"),
this, SLOT(purgeCompleted()),0,2);
mPopupMenu->insertItem(i18n("Show Completed"),
this, SLOT( toggleCompleted() ),0,3 );
mPopupMenu->insertItem(i18n("toggle running todo","Hide not Running"),
this, SLOT( toggleRunning() ),0,5 );
mPopupMenu->insertItem(i18n(" set all open","Display all opened"),
this, SLOT( setAllOpen() ),0,6 );
mPopupMenu->insertItem(i18n(" set all close","Display all closed"),
this, SLOT( setAllClose() ),0,7 );
mPopupMenu->insertItem(i18n(" set all flat","Display all flat"),
this, SLOT( setAllFlat() ),0,8 );
mPopupMenu->insertSeparator();
mPopupMenu->insertItem(i18n("toggle quick todo","Show Quick Todo"),
this, SLOT( toggleQuickTodo() ),0,4 );
mDocPrefs = new DocPrefs( name );
diff --git a/korganizer/mainwindow.cpp b/korganizer/mainwindow.cpp
index 94d7293..1320231 100644
--- a/korganizer/mainwindow.cpp
+++ b/korganizer/mainwindow.cpp
@@ -327,96 +327,98 @@ MainWindow::MainWindow( QWidget *parent, const char *name, QString msg) :
SLOT( disableBR(bool) ) );
connect( &mSaveTimer, SIGNAL( timeout() ), SLOT( save() ) );
mView->setModified( false );
mBlockAtStartup = false;
mView->setModified( false );
setCentralWidget( mView );
globalFlagBlockStartup = 0;
mView->show();
delete splash;
if ( newFile )
mView->updateConfig();
// qApp->processEvents();
//qDebug("MainView x %d y %d w %d h %d", mView->x(),mView-> y(), mView->width(), mView->height ());
//fillSyncMenu();
connect(mSyncManager , SIGNAL( save() ), this, SLOT( save() ) );
connect(mView , SIGNAL( save() ), this, SLOT( save() ) );
connect(mView , SIGNAL( saveStopTimer() ), this, SLOT( saveStopTimer() ) );
connect(mSyncManager , SIGNAL( request_file() ), this, SLOT( syncFileRequest() ) );
connect(mSyncManager , SIGNAL( getFile( bool )), this, SLOT(getFile( bool ) ) );
mSyncManager->setDefaultFileName( sentSyncFile());
connect ( syncMenu, SIGNAL( activated ( int ) ), mSyncManager, SLOT (slotSyncMenu( int ) ) );
mSyncManager->fillSyncMenu();
mView->viewManager()->agendaView()->setStartHour( KOPrefs::instance()->mDayBegins );
if ( showWarning ) {
KMessageBox::information( this,
"You are starting KO/Pi for the first time.\nPlease read menu: Help-What's New,\nif you did an update!\nPlease choose your timezone in the \nConfigure Dialog TAB Time Zone!\nPlease choose your language\nin the TAB Locale!\nYou get the Configure Dialog\nvia Menu: Actions - Configure....\nClick OK to show the Configure Dialog!\n", "KO/Pi information");
qApp->processEvents();
mView->dialogManager()->showSyncOptions();
}
//US listen for result adressed from Ka/Pi
#ifndef DESKTOP_VERSION
connect(qApp, SIGNAL (appMessage ( const QCString &, const QByteArray & )), ExternalAppHandler::instance(), SLOT (appMessage ( const QCString &, const QByteArray & )));
#endif
#ifndef DESKTOP_VERSION
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
if ( infrared )
delete infrared;
#endif
}
void MainWindow::disableBR(bool b)
{
#ifndef DESKTOP_VERSION
if ( b ) {
if ( infrared ) {
toggleBeamReceive();
mBRdisabled = true;
}
mBRdisabled = true;
} else {
if ( mBRdisabled ) {
mBRdisabled = false;
//makes no sense,because other cal ap is probably running
// toggleBeamReceive();
}
}
#endif
}
bool MainWindow::beamReceiveEnabled()
{
#ifndef DESKTOP_VERSION
return ( infrared != 0 );
#endif
return false;
}
void MainWindow::toggleBeamReceive()
{
if ( mBRdisabled )
return;
#ifndef DESKTOP_VERSION
if ( infrared ) {
@@ -752,96 +754,98 @@ void MainWindow::initActions()
icon = loadPixmap( pathString + "today" );
QAction* today_action = new QAction( i18n("Go to Today"), icon, i18n("Go to Today"), 0, this );
today_action->addTo( viewMenu );
connect( today_action, SIGNAL( activated() ),
mView, SLOT( goToday() ) );
viewMenu->insertSeparator();
// ***********************
if ( KOPrefs::instance()->mVerticalScreen ) {
icon = SmallIcon( "1updownarrow" );
} else {
icon = SmallIcon("1leftrightarrow" );
}
configureToolBarMenu->insertItem(icon, i18n("Toggle Fullscreen"), 28 );
QAction* FSaction = new QAction( i18n("Toggle Fullscreen"), icon, i18n("Toggle Fullscreen"), 0, this );
FSaction->addTo( viewMenu );
connect( FSaction, SIGNAL( activated() ), mView, SLOT( toggleExpand() ));
icon = loadPixmap( pathString + "navi" );
configureToolBarMenu->insertItem(icon, i18n("Toggle DateNavigator"), 22 );
action = new QAction( i18n("Toggle DateNavigator"), icon, i18n("Toggle DateNavigator"), 0, this );
action->addTo( viewMenu );
connect( action, SIGNAL( activated() ),
mView, SLOT( toggleDateNavigatorWidget() ) );
mToggleNav = action ;
icon = loadPixmap( pathString + "filter" );
configureToolBarMenu->insertItem(icon, i18n("Filter menu icon"), 26 );
action = new QAction( i18n("Toggle FilterView"), icon, i18n("Toggle FilterView"), 0, this );
action->addTo( viewMenu );
connect( action, SIGNAL( activated() ),
mView, SLOT( toggleFilter() ) );
mToggleFilter = action;
icon = loadPixmap( pathString + "allday" );
configureToolBarMenu->insertItem(icon, i18n("Toggle Allday"), 24 );
action = new QAction( i18n("Toggle Allday"), icon,i18n("Toggle Allday"), 0, this );
action->addTo( viewMenu );
connect( action, SIGNAL( activated() ),
mView, SLOT( toggleAllDaySize() ) );
mToggleAllday = action;
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 );
viewMenu->insertSeparator();
if ( p-> mShowIconToggleFull )
FSaction->addTo( iconToolBar );
if ( p->mShowIconNavigator ) mToggleNav ->addTo( iconToolBar );
//********************
if ( p->mShowIconAllday ) mToggleAllday->addTo( iconToolBar );
icon = loadPixmap( pathString + "whatsnext" );
configureToolBarMenu->insertItem(icon, i18n("What's Next"), 110 );
QAction* whatsnext_action = new QAction( i18n("What's Next"), icon, i18n("What's Next"), 0, this );
whatsnext_action->addTo( viewMenu );
connect( whatsnext_action, SIGNAL( activated() ),
mView->viewManager(), SLOT( showWhatsNextView() ) );
icon = loadPixmap( pathString + "xdays" );
configureToolBarMenu->insertItem(icon, i18n("Next days"), 100 );
QAction* xdays_action = new QAction( i18n("Next days"), icon, i18n("Next days"), 0, this );
xdays_action->addTo( viewMenu );
connect( xdays_action, SIGNAL( activated() ),
mView->viewManager(), SLOT( showNextXView() ) );
icon = loadPixmap( pathString + "journal" );
configureToolBarMenu->insertItem(icon, i18n("Journal"), 90 );
QAction* viewjournal_action = new QAction( i18n("Journal"), icon, i18n("Journal"), 0, this );
viewjournal_action->addTo( viewMenu );
connect( viewjournal_action, SIGNAL( activated() ),
mView->viewManager(), SLOT( showJournalView() ) );
icon = loadPixmap( pathString + "day" );
configureToolBarMenu->insertItem(icon, i18n("Day View"), 40 );
QAction* day1_action = new QAction( i18n("Day View"), icon, i18n("Day View"), 0, this );
day1_action->addTo( viewMenu );
// action->addTo( toolBar );
connect( day1_action, SIGNAL( activated() ),
mView->viewManager(), SLOT( showDayView() ) );
diff --git a/libkcal/calendarlocal.cpp b/libkcal/calendarlocal.cpp
index e75df70..bc76c0b 100644
--- a/libkcal/calendarlocal.cpp
+++ b/libkcal/calendarlocal.cpp
@@ -261,97 +261,97 @@ QPtrList<Event> CalendarLocal::getExternLastSyncEvents()
}
return el;
}
Event *CalendarLocal::event( QString syncProf, QString id )
{
Event *todo;
for ( todo = mEventList.first(); todo; todo = mEventList.next() ) {
if ( todo->getID( syncProf ) == id ) return todo;
}
return 0;
}
Todo *CalendarLocal::todo( const QString &uid )
{
Todo *todo;
for ( todo = mTodoList.first(); todo; todo = mTodoList.next() ) {
if ( todo->uid() == uid ) return todo;
}
return 0;
}
QString CalendarLocal::nextSummary() const
{
return mNextSummary;
}
QDateTime CalendarLocal::nextAlarmEventDateTime() const
{
return mNextAlarmEventDateTime;
}
void CalendarLocal::checkAlarmForIncidence( Incidence * incidence, bool deleted)
{
//mNextAlarmIncidence
//mNextAlarmDateTime
//return mNextSummary;
//return mNextAlarmEventDateTime;
bool newNextAlarm = false;
bool computeNextAlarm = false;
bool ok;
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;
mNextAlarmIncidence = incidence;
} else {
if ( incidence == mNextAlarmIncidence ) {
computeNextAlarm = true;
}
}
} else {
if ( mNextAlarmIncidence == incidence ) {
computeNextAlarm = true;
}
}
} else { // deleted
if ( incidence == mNextAlarmIncidence ) {
computeNextAlarm = true;
}
}
}
if ( computeNextAlarm ) {
deRegisterAlarm();
nextA = nextAlarm( 1000 );
if (! mNextAlarmIncidence ) {
return;
}
newNextAlarm = true;
}
if ( newNextAlarm )
registerAlarm();
}
QString CalendarLocal:: getAlarmNotification()
{
QString ret;
// this should not happen
if (! mNextAlarmIncidence )
return "cal_alarm"+ mNextSummary.left( 25 )+"\n"+mNextAlarmEventDateTimeString;
Alarm* alarm = mNextAlarmIncidence->alarms().first();
if ( alarm->type() == Alarm::Procedure ) {
ret = "proc_alarm" + alarm->programFile()+"+++";
} else {
ret = "audio_alarm" +alarm->audioFile() +"+++";
}
@@ -376,110 +376,110 @@ void CalendarLocal::deRegisterAlarm()
return;
//qDebug("-- deregister Alarm %s ", mLastAlarmNotificationString.latin1() );
emit removeAlarm ( mNextAlarmDateTime, mLastAlarmNotificationString );
mNextAlarmEventDateTime = QDateTime();
// #ifndef DESKTOP_VERSION
// AlarmServer::deleteAlarm (mNextAlarmDateTime ,"koalarm" ,mLastAlarmNotificationString.latin1() );
// #endif
}
QPtrList<Todo> CalendarLocal::todos( const QDate &date )
{
QPtrList<Todo> todos;
Todo *todo;
for ( todo = mTodoList.first(); todo; todo = mTodoList.next() ) {
if ( todo->hasDueDate() && todo->dtDue().date() == date ) {
todos.append( todo );
}
}
filter()->apply( &todos );
return todos;
}
void CalendarLocal::reInitAlarmSettings()
{
if ( !mNextAlarmIncidence ) {
nextAlarm( 1000 );
}
deRegisterAlarm();
mNextAlarmIncidence = 0;
checkAlarmForIncidence( 0, false );
}
QDateTime CalendarLocal::nextAlarm( int daysTo )
{
QDateTime nextA = QDateTime::currentDateTime().addDays( 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;
}
}
}
if ( mNextAlarmIncidence ) {
mNextAlarmEventDateTimeString = KGlobal::locale()->formatDateTime(mNextAlarmEventDateTime);
mNextAlarmDateTime = nextA;
}
return nextA;
}
Alarm::List CalendarLocal::alarmsTo( const QDateTime &to )
{
return alarms( QDateTime( QDate( 1900, 1, 1 ) ), to );
}
Alarm::List CalendarLocal::alarms( const QDateTime &from, const QDateTime &to )
{
kdDebug(5800) << "CalendarLocal::alarms(" << from.toString() << " - "
<< to.toString() << ")\n";
Alarm::List alarms;
Event *e;
for( e = mEventList.first(); e; e = mEventList.next() ) {
if ( e->doesRecur() ) appendRecurringAlarms( alarms, e, from, to );
else appendAlarms( alarms, e, from, to );
}
Todo *t;
for( t = mTodoList.first(); t; t = mTodoList.next() ) {
appendAlarms( alarms, t, from, to );
}
return alarms;
}
void CalendarLocal::appendAlarms( Alarm::List &alarms, Incidence *incidence,
const QDateTime &from, const QDateTime &to )
{
QPtrList<Alarm> alarmList = incidence->alarms();
Alarm *alarm;
diff --git a/libkcal/event.cpp b/libkcal/event.cpp
index de8dceb..9b99855 100644
--- a/libkcal/event.cpp
+++ b/libkcal/event.cpp
@@ -126,96 +126,96 @@ QDateTime Event::dtEnd() const
QString Event::dtEndTimeStr() const
{
return KGlobal::locale()->formatTime(mDtEnd.time());
}
QString Event::dtEndDateStr(bool shortfmt) const
{
return KGlobal::locale()->formatDate(mDtEnd.date(),shortfmt);
}
QString Event::dtEndStr(bool shortfmt) const
{
return KGlobal::locale()->formatDateTime(mDtEnd, shortfmt);
}
void Event::setHasEndDate(bool b)
{
mHasEndDate = b;
}
bool Event::hasEndDate() const
{
return mHasEndDate;
}
bool Event::isMultiDay() const
{
bool multi = !(dtStart().date() == dtEnd().date());
return multi;
}
void Event::setTransparency(Event::Transparency transparency)
{
if (mReadOnly) return;
mTransparency = transparency;
updated();
}
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;
QDateTime alarmStart = QDateTime::currentDateTime().addDays( 3650 );;
// if ( QDateTime::currentDateTime() > incidenceStart ){
// *ok = false;
// return incidenceStart;
// }
for (QPtrListIterator<Alarm> it(mAlarms); (alarm = it.current()) != 0; ++it) {
if (alarm->enabled()) {
if ( alarm->hasTime () ) {
if ( alarm->time() < alarmStart ) {
alarmStart = alarm->time();
enabled = true;
off = alarmStart.secsTo( incidenceStart );
}
} else {
int secs = alarm->startOffset().asSeconds();
if ( incidenceStart.addSecs( secs ) < alarmStart ) {
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
@@ -1,90 +1,90 @@
/*
This file is part of libkcal.
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.
*/
#ifndef EVENT_H
#define EVENT_H
//
// Event component, representing a VEVENT object
//
#include "incidence.h"
namespace KCal {
/**
This class provides an Event in the sense of RFC2445.
*/
class Event : public Incidence
{
public:
enum Transparency { Opaque, Transparent };
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;
/** returns an event's end date as a string formatted according to the
users locale settings */
QString dtEndDateStr(bool shortfmt=true) const;
/** returns an event's end date and time as a string formatted according
to the users locale settings */
QString dtEndStr(bool shortfmt=true) const;
void setHasEndDate(bool);
/** Return whether the event has an end date/time. */
bool hasEndDate() const;
/** Return true if the event spans multiple days, otherwise return false. */
bool isMultiDay() const;
/** set the event's time transparency level. */
void setTransparency(Transparency transparency);
/** get the event's time transparency level. */
Transparency transparency() const;
void setDuration(int seconds);
bool contains ( Event*);
private:
bool accept(Visitor &v) { return v.visit(this); }
QDateTime mDtEnd;
bool mHasEndDate;
Transparency mTransparency;
};
bool operator==( const Event&, const Event& );
}
#endif
diff --git a/libkcal/incidence.h b/libkcal/incidence.h
index ebd50d0..aa51e84 100644
--- a/libkcal/incidence.h
+++ b/libkcal/incidence.h
@@ -69,97 +69,97 @@ class Incidence : public IncidenceBase
virtual bool visit(Todo *) { return false; }
/**
Reimplement this function in your concrete subclass of IncidenceVisitor to perform actions
on an Journal object.
*/
virtual bool visit(Journal *) { return false; }
protected:
/** Constructor is protected to prevent direct creation of visitor base class. */
Visitor() {}
};
/**
This class implements a visitor for adding an Incidence to a resource
supporting addEvent(), addTodo() and addJournal() calls.
*/
template<class T>
class AddVisitor : public Visitor
{
public:
AddVisitor( T *r ) : mResource( r ) {}
bool visit( Event *e ) { return mResource->addEvent( e ); }
bool visit( Todo *t ) { return mResource->addTodo( t ); }
bool visit( Journal *j ) { return mResource->addJournal( j ); }
private:
T *mResource;
};
/** enumeration for describing an event's secrecy. */
enum { SecrecyPublic = 0, SecrecyPrivate = 1, SecrecyConfidential = 2 };
typedef ListBase<Incidence> List;
Incidence();
Incidence(const Incidence &);
~Incidence();
/**
Accept IncidenceVisitor. A class taking part in the visitor mechanism has to
provide this implementation:
<pre>
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();
Incidence* recreateCloneException(QDate);
/** set creation date */
void setCreated(QDateTime);
/** return time and date of creation. */
QDateTime created() const;
/** set the number of revisions this event has seen */
void setRevision(int rev);
/** return the number of revisions this event has seen */
int revision() const;
/** Set starting date/time. */
virtual void setDtStart(const QDateTime &dtStart);
/** Return the incidence's ending date/time as a QDateTime. */
virtual QDateTime dtEnd() const { return QDateTime(); }
/** sets the event's lengthy description. */
void setDescription(const QString &description);
/** returns a reference to the event's description. */
QString description() const;
/** sets the event's short summary. */
void setSummary(const QString &summary);
/** returns a reference to the event's summary. */
QString summary() const;
/** set event's applicable categories */
void setCategories(const QStringList &categories, bool setForRelations = false);
void addCategories(const QStringList &categories, bool addToRelations = false);
/** set event's categories based on a comma delimited string */
void setCategories(const QString &catStr);
/** return categories in a list */
QStringList categories() const;
/** return categories as a comma separated string */
QString categoriesStr();
QString categoriesStrWithSpace();
/** point at some other event to which the event relates. This function should
* only be used when constructing a calendar before the related Event
diff --git a/libkcal/journal.cpp b/libkcal/journal.cpp
index 351fb32..859161f 100644
--- a/libkcal/journal.cpp
+++ b/libkcal/journal.cpp
@@ -1,49 +1,49 @@
/*
This file is part of libkcal.
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 "journal.h"
using namespace KCal;
Journal::Journal()
{
}
Journal::~Journal()
{
}
Incidence *Journal::clone()
{
return new Journal(*this);
}
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
@@ -1,50 +1,50 @@
/*
This file is part of libkcal.
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.
*/
#ifndef JOURNAL_H
#define JOURNAL_H
//
// Journal component, representing a VJOURNAL object
//
#include "incidence.h"
namespace KCal {
/**
This class provides a Journal in the sense of RFC2445.
*/
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
@@ -470,108 +470,108 @@ void Todo::setCompleted(const QDateTime &completed)
}
mHasCompletedDate = true;
mPercentComplete = 100;
mCompleted = getEvenTime(completed);
updated();
}
bool Todo::hasCompletedDate() const
{
return mHasCompletedDate;
}
int Todo::percentComplete() const
{
return mPercentComplete;
}
bool Todo::setRecurDates()
{
if ( !mHasRecurrenceID )
return true;
int secs = mDtStart.secsTo( dtDue() );
bool ok;
qDebug("T:setRecurDates() ");
//qDebug("%s %s %s ",mDtStart.toString().latin1(), dtDue().toString().latin1(),mRecurrenceID.toString().latin1() );
QDateTime next = getNextOccurence( mRecurrenceID, &ok );
if ( ok ) {
mRecurrenceID = next;
mDtStart = next;
setDtDue( next.addSecs( secs ) );
if ( QDateTime::currentDateTime() > next)
return false;
} else {
setHasRecurrenceID( false );
recurrence()->unsetRecurs();
}
return true;
}
void Todo::setPercentComplete(int v)
{
if ( mHasRecurrenceID && v == 100 && mPercentComplete != 100 ) {
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;
Alarm* alarm;
int off = 0;
QDateTime alarmStart = QDateTime::currentDateTime().addDays( 3650 );;
// if ( QDateTime::currentDateTime() > incidenceStart ){
// *ok = false;
// return incidenceStart;
// }
for (QPtrListIterator<Alarm> it(mAlarms); (alarm = it.current()) != 0; ++it) {
if (alarm->enabled()) {
if ( alarm->hasTime () ) {
if ( alarm->time() < alarmStart ) {
alarmStart = alarm->time();
enabled = true;
off = alarmStart.secsTo( incidenceStart );
}
} else {
int secs = alarm->startOffset().asSeconds();
if ( incidenceStart.addSecs( secs ) < alarmStart ) {
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 ();
}
void Todo::checkSetCompletedFalse()
{
if ( !hasRecurrenceID() ) {
qDebug("ERROR 1 in Todo::checkSetCompletedFalse");
}
// qDebug("Todo::checkSetCompletedFalse()");
//qDebug("%s %s %s ",mDtStart.toString().latin1(), dtDue().toString().latin1(),mRecurrenceID.toString().latin1() );
if ( mPercentComplete == 100 && mDtStart == mRecurrenceID && QDateTime::currentDateTime() > mDtStart) {
qDebug("%s %s %s ",mDtStart.toString().latin1(), dtDue().toString().latin1(),mRecurrenceID.toString().latin1() );
setCompleted( false );
qDebug("Todo::checkSetCompletedFalse ");
}
}
diff --git a/libkcal/todo.h b/libkcal/todo.h
index a5354ce..ab8fdf1 100644
--- a/libkcal/todo.h
+++ b/libkcal/todo.h
@@ -1,95 +1,95 @@
/*
This file is part of libkcal.
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.
*/
#ifndef TODO_H
#define TODO_H
//
// Todo component, representing a VTODO object
//
#include "incidence.h"
#include <qtimer.h>
namespace KCal {
/**
This class provides a Todo in the sense of RFC2445.
*/
class Todo : public QObject,public Incidence
{
Q_OBJECT
public:
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;
/** returns an event's due date as a string formatted according to the
users locale settings */
QString dtDueDateStr(bool shortfmt=true) const;
/** returns an event's due date and time as a string formatted according
to the users locale settings */
QString dtDueStr(bool shortfmt=true) const;
/** returns TRUE or FALSE depending on whether the todo has a due date */
bool hasDueDate() const;
/** sets the event's hasDueDate value. */
void setHasDueDate(bool f);
/*
Looks for a subtodo (including itself ) which is not complete and is
- overdue, or
- due today.
It returns 0 for nothing found,
1 for found a todo which is due today and no overdue found
2 for found a overdue todo
*/
int hasDueSubTodo( bool checkSubtodos = true );
/* same as above, but a specific date can be specified*/
int hasDueSubTodoForDate( const QDate & date, bool checkSubtodos );
/** sets the event's status to the string specified. The string
* must be a recognized value for the status field, i.e. a string
* equivalent of the possible status enumerations previously described. */
// void setStatus(const QString &statStr);
/** sets the event's status to the value specified. See the enumeration
* above for possible values. */
// void setStatus(int);
/** return the event's status. */
// int status() const;
/** return the event's status in string format. */
// QString statusStr() const;
/** return, if this todo is completed */
bool isCompleted() const;
/** set completed state of this todo */