-rw-r--r-- | korganizer/calendarview.cpp | 31 | ||||
-rw-r--r-- | korganizer/calendarview.h | 4 | ||||
-rw-r--r-- | korganizer/koeventviewer.cpp | 34 | ||||
-rw-r--r-- | korganizer/koeventviewer.h | 1 | ||||
-rw-r--r-- | korganizer/main.cpp | 26 |
5 files changed, 67 insertions, 29 deletions
diff --git a/korganizer/calendarview.cpp b/korganizer/calendarview.cpp index bf98ad4..c3c3d47 100644 --- a/korganizer/calendarview.cpp +++ b/korganizer/calendarview.cpp @@ -457,2 +457,4 @@ void CalendarView::init() mAlarmTimer = new QTimer( this ); + mRecheckAlarmTimer = new QTimer( this ); + connect( mRecheckAlarmTimer, SIGNAL( timeout () ), SLOT( recheckTimerAlarm() ) ); connect( mSuspendTimer, SIGNAL( timeout () ), SLOT( suspendAlarm() ) ); @@ -493,2 +495,3 @@ void CalendarView::startAlarm( QString mess , QString filename) mAlarmDialog->eventNotification( mess, KOPrefs::instance()->mAlarmPlayBeeps, filename, true,KOPrefs::instance()->mAlarmBeepInterval ,KOPrefs::instance()->mAlarmSuspendCount ); + QTimer::singleShot( 3000, this, SLOT( checkNextTimerAlarm() ) ); @@ -496,2 +499,6 @@ void CalendarView::startAlarm( QString mess , QString filename) +void CalendarView::checkNextTimerAlarm() +{ + mCalendar->checkAlarmForIncidence( 0, true ); +} @@ -606,8 +613,26 @@ void CalendarView::addAlarm(const QDateTime &qdt, const QString ¬i ) } + int maxSec; + //maxSec = 5; //testing only + maxSec = 86400+3600; // one day+1hour mAlarmNotification = noti; - int ms = QDateTime::currentDateTime().secsTo( qdt )*1000; - //qDebug("Alarm timer started with secs: %d ", ms/1000); - mAlarmTimer->start( ms , true ); + int sec = QDateTime::currentDateTime().secsTo( qdt ); + if ( sec > maxSec ) { + mRecheckAlarmTimer->start( maxSec * 1000 ); + // qDebug("recheck Alarm timer started with secs: %d next alarm in sec:%d", maxSec,sec ); + return; + } else { + mRecheckAlarmTimer->stop(); + } + //qDebug("Alarm timer started with secs: %d ", sec); + mAlarmTimer->start( sec *1000 , true ); } +// called by mRecheckAlarmTimer to get next alarm +// we need this, because a QTimer has only a max range of 25 days +void CalendarView::recheckTimerAlarm() +{ + mAlarmTimer->stop(); + mRecheckAlarmTimer->stop(); + mCalendar->checkAlarmForIncidence( 0, true ); +} void CalendarView::removeAlarm(const QDateTime &qdt, const QString ¬i ) diff --git a/korganizer/calendarview.h b/korganizer/calendarview.h index e7aa351..fda02f7 100644 --- a/korganizer/calendarview.h +++ b/korganizer/calendarview.h @@ -173,3 +173,4 @@ class CalendarView : public KOrg::CalendarViewBase, public KCal::Calendar::Obser public slots: - + void recheckTimerAlarm(); + void checkNextTimerAlarm(); void addAlarm(const QDateTime &qdt, const QString ¬i ); @@ -476,2 +477,3 @@ class CalendarView : public KOrg::CalendarViewBase, public KCal::Calendar::Obser QTimer* mAlarmTimer; + QTimer* mRecheckAlarmTimer; void computeAlarm( QString ); diff --git a/korganizer/koeventviewer.cpp b/korganizer/koeventviewer.cpp index bac66d3..1f69700 100644 --- a/korganizer/koeventviewer.cpp +++ b/korganizer/koeventviewer.cpp @@ -52,2 +52,6 @@ #endif +#ifndef DESKTOP_VERSION +#include <qtopia/qcopenvelope_qws.h> +#endif + KOEventViewer::KOEventViewer(QWidget *parent,const char *name) @@ -65,2 +69,4 @@ void KOEventViewer::setSource(const QString& n) { + + if ( n.left(3) == "uid" ) { KABC::StdAddressBook* AddressBook = KABC::StdAddressBook::self( true ); @@ -93,2 +99,12 @@ void KOEventViewer::setSource(const QString& n) } + return; + } + if ( n.left(6) == "mailto" ) { + // qDebug("KOEventViewer::setSource %s ", n.mid(7).latin1()); +#ifndef DESKTOP_VERSION + QCopEnvelope e("QPE/Application/kmpi", "newMail(QString)" ); + e << n.mid(7); +#endif + + } @@ -172,2 +188,3 @@ void KOEventViewer::appendEvent(Event *event, int mode ) { + mMailSubject = ""; mCurrentIncidence = event; @@ -195,2 +212,3 @@ void KOEventViewer::appendEvent(Event *event, int mode ) } + mMailSubject += i18n( "Meeting " )+ event->summary(); if (event->cancelled ()) { @@ -200,2 +218,3 @@ void KOEventViewer::appendEvent(Event *event, int mode ) mText += "</font>"; + mMailSubject += i18n("(cancelled)"); } @@ -204,2 +223,3 @@ void KOEventViewer::appendEvent(Event *event, int mode ) mText.append(event->location()+"<br>"); + mMailSubject += i18n(" at ") + event->location(); } @@ -240,2 +260,5 @@ void KOEventViewer::appendEvent(Event *event, int mode ) addTag("p", KGlobal::locale()->formatDate( next, shortDate )); + QDateTime nextdt = QDateTime( next, event->dtStart().time()); + mMailSubject += i18n(" - " )+ KGlobal::locale()->formatDateTime( nextdt, true ); + } else { @@ -244,2 +267,5 @@ void KOEventViewer::appendEvent(Event *event, int mode ) } + } else { + mMailSubject += i18n(" - " )+event->dtStartStr( true ); + } @@ -276,2 +302,3 @@ void KOEventViewer::appendTodo(Todo *event, int mode ) { + mMailSubject = ""; mCurrentIncidence = event; @@ -297,2 +324,3 @@ void KOEventViewer::appendTodo(Todo *event, int mode ) } + mMailSubject += i18n( "Todo " )+ event->summary(); if (event->cancelled ()) { @@ -302,2 +330,3 @@ void KOEventViewer::appendTodo(Todo *event, int mode ) mText += "</font>"; + mMailSubject += i18n("(cancelled)"); } @@ -307,2 +336,3 @@ void KOEventViewer::appendTodo(Todo *event, int mode ) mText.append(event->location()+"<br>"); + mMailSubject += i18n(" at ") + event->location(); } @@ -310,2 +340,3 @@ void KOEventViewer::appendTodo(Todo *event, int mode ) mText.append(i18n("<p><b>Due on:</b> %1</p>").arg(event->dtDueStr(KOPrefs::instance()->mShortDateInViewer))); + mMailSubject += i18n(" - " )+event->dtDueStr( true ); } @@ -407,5 +438,6 @@ void KOEventViewer::formatAttendees(Incidence *event) + if (!a->email().isEmpty()) { if (iconPath) { - mText += "<a href=\"mailto:" + a->name() +" "+ "<" + a->email() + ">" + "\">"; + mText += "<a href=\"mailto:" + a->name() +" <" + a->email() + ">:" + mMailSubject + "\">"; mText += "<IMG src=\"" + iconPath + "\">"; diff --git a/korganizer/koeventviewer.h b/korganizer/koeventviewer.h index 74f1135..0cd3f33 100644 --- a/korganizer/koeventviewer.h +++ b/korganizer/koeventviewer.h @@ -67,2 +67,3 @@ class KOEventViewer : public QTextBrowser { QString mText; + QString mMailSubject; Incidence* mCurrentIncidence; diff --git a/korganizer/main.cpp b/korganizer/main.cpp index a357988..69ef294 100644 --- a/korganizer/main.cpp +++ b/korganizer/main.cpp @@ -55,9 +55,4 @@ int main( int argc, char **argv ) KGlobal::setAppName( "korganizer" ); - - QString fileName ; #ifndef DESKTOP_VERSION - QString appdir = QDir::homeDirPath() + "/kdepim/apps/" + KGlobal::getAppName(); - KStandardDirs::setAppDir( appdir ); - fileName = getenv("QPEDIR"); @@ -65,23 +60,6 @@ int main( int argc, char **argv ) #else - -#ifndef _WIN32_ fileName = qApp->applicationDirPath () + "/kdepim/korganizer/"; -#else - fileName = qApp->applicationDirPath () + "\\kdepim\\korganizer\\"; -#endif - - KGlobal::iconLoader()->setIconPath(fileName); - - QString appdir = QDir::homeDirPath(); - //appdir = "C:\\"; - if ( appdir.right(1) == "\\" || appdir.right(1) == "/" ) - appdir += "korganizer"; - else - appdir += "/korganizer"; - KStandardDirs::setAppDir( QDir::convertSeparators( appdir )); - // qDebug(" %s ",KStandardDirs::appDir().latin1() ); + KGlobal::iconLoader()->setIconPath(QDir::convertSeparators(fileName)); #endif - QDir app_dir; - if ( !app_dir.exists(KStandardDirs::appDir()) ) - app_dir.mkdir (KStandardDirs::appDir()); + KStandardDirs::setAppDir( QDir::convertSeparators(locateLocal("data", "korganizer"))); MainWindow m; |