summaryrefslogtreecommitdiffabout
Side-by-side diff
Diffstat (more/less context) (show whitespace changes)
-rw-r--r--korganizer/calendarview.cpp31
-rw-r--r--korganizer/calendarview.h4
-rw-r--r--korganizer/koeventviewer.cpp34
-rw-r--r--korganizer/koeventviewer.h1
-rw-r--r--korganizer/main.cpp26
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
@@ -456,4 +456,6 @@ void CalendarView::init()
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() ) );
@@ -492,7 +494,12 @@ 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() ) );
}
+void CalendarView::checkNextTimerAlarm()
+{
+ mCalendar->checkAlarmForIncidence( 0, true );
+}
void CalendarView::computeAlarm( QString msg )
@@ -605,10 +612,28 @@ void CalendarView::addAlarm(const QDateTime &qdt, const QString &noti )
return;
}
+ 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 &noti )
{
diff --git a/korganizer/calendarview.h b/korganizer/calendarview.h
index e7aa351..fda02f7 100644
--- a/korganizer/calendarview.h
+++ b/korganizer/calendarview.h
@@ -172,5 +172,6 @@ class CalendarView : public KOrg::CalendarViewBase, public KCal::Calendar::Obser
public slots:
-
+ void recheckTimerAlarm();
+ void checkNextTimerAlarm();
void addAlarm(const QDateTime &qdt, const QString &noti );
void addSuspendAlarm(const QDateTime &qdt, const QString &noti );
@@ -475,4 +476,5 @@ class CalendarView : public KOrg::CalendarViewBase, public KCal::Calendar::Obser
QTimer* mSuspendTimer;
QTimer* mAlarmTimer;
+ QTimer* mRecheckAlarmTimer;
void computeAlarm( QString );
void startAlarm( QString, QString );
diff --git a/korganizer/koeventviewer.cpp b/korganizer/koeventviewer.cpp
index bac66d3..1f69700 100644
--- a/korganizer/koeventviewer.cpp
+++ b/korganizer/koeventviewer.cpp
@@ -51,4 +51,8 @@
#define size count
#endif
+#ifndef DESKTOP_VERSION
+#include <qtopia/qcopenvelope_qws.h>
+#endif
+
KOEventViewer::KOEventViewer(QWidget *parent,const char *name)
: QTextBrowser(parent,name)
@@ -64,4 +68,6 @@ KOEventViewer::~KOEventViewer()
void KOEventViewer::setSource(const QString& n)
{
+
+ if ( n.left(3) == "uid" ) {
KABC::StdAddressBook* AddressBook = KABC::StdAddressBook::self( true );
KABC::AddressBook::Iterator it;
@@ -92,4 +98,14 @@ 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
+
+ }
@@ -171,4 +187,5 @@ void KOEventViewer::setColorMode( int m )
void KOEventViewer::appendEvent(Event *event, int mode )
{
+ mMailSubject = "";
mCurrentIncidence = event;
bool shortDate = KOPrefs::instance()->mShortDateInViewer;
@@ -194,4 +211,5 @@ void KOEventViewer::appendEvent(Event *event, int mode )
mText += "</font>";
}
+ mMailSubject += i18n( "Meeting " )+ event->summary();
if (event->cancelled ()) {
mText +="<font color=\"#B00000\">";
@@ -199,8 +217,10 @@ void KOEventViewer::appendEvent(Event *event, int mode )
mText.append("<br>");
mText += "</font>";
+ mMailSubject += i18n("(cancelled)");
}
if (!event->location().isEmpty()) {
addTag("b",i18n("Location: "));
mText.append(event->location()+"<br>");
+ mMailSubject += i18n(" at ") + event->location();
}
if (event->doesFloat()) {
@@ -239,8 +259,14 @@ void KOEventViewer::appendEvent(Event *event, int mode )
addTag("p",i18n("<b>Next recurrence is on:</b>") );
addTag("p", KGlobal::locale()->formatDate( next, shortDate ));
+ QDateTime nextdt = QDateTime( next, event->dtStart().time());
+ mMailSubject += i18n(" - " )+ KGlobal::locale()->formatDateTime( nextdt, true );
+
} else {
addTag("p",i18n("<b>Last recurrence was on:</b>") );
addTag("p", KGlobal::locale()->formatDate( next, shortDate ));
}
+ } else {
+ mMailSubject += i18n(" - " )+event->dtStartStr( true );
+
}
@@ -275,4 +301,5 @@ void KOEventViewer::appendEvent(Event *event, int mode )
void KOEventViewer::appendTodo(Todo *event, int mode )
{
+ mMailSubject = "";
mCurrentIncidence = event;
topLevelWidget()->setCaption(i18n("Todo Viewer"));
@@ -296,4 +323,5 @@ void KOEventViewer::appendTodo(Todo *event, int mode )
mText += "</font>";
}
+ mMailSubject += i18n( "Todo " )+ event->summary();
if (event->cancelled ()) {
mText +="<font color=\"#B00000\">";
@@ -301,4 +329,5 @@ void KOEventViewer::appendTodo(Todo *event, int mode )
mText.append("<br>");
mText += "</font>";
+ mMailSubject += i18n("(cancelled)");
}
@@ -306,7 +335,9 @@ void KOEventViewer::appendTodo(Todo *event, int mode )
addTag("b",i18n("Location: "));
mText.append(event->location()+"<br>");
+ mMailSubject += i18n(" at ") + event->location();
}
if (event->hasDueDate()) {
mText.append(i18n("<p><b>Due on:</b> %1</p>").arg(event->dtDueStr(KOPrefs::instance()->mShortDateInViewer)));
+ mMailSubject += i18n(" - " )+event->dtDueStr( true );
}
addTag("b",i18n("Access: "));
@@ -406,7 +437,8 @@ void KOEventViewer::formatAttendees(Incidence *event)
#endif
+
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 + "\">";
mText += "</a>\n";
diff --git a/korganizer/koeventviewer.h b/korganizer/koeventviewer.h
index 74f1135..0cd3f33 100644
--- a/korganizer/koeventviewer.h
+++ b/korganizer/koeventviewer.h
@@ -66,4 +66,5 @@ class KOEventViewer : public QTextBrowser {
QString mText;
+ QString mMailSubject;
Incidence* mCurrentIncidence;
signals:
diff --git a/korganizer/main.cpp b/korganizer/main.cpp
index a357988..69ef294 100644
--- a/korganizer/main.cpp
+++ b/korganizer/main.cpp
@@ -54,35 +54,13 @@ int main( int argc, char **argv )
if ( ! exitHelp ) {
KGlobal::setAppName( "korganizer" );
-
-
QString fileName ;
#ifndef DESKTOP_VERSION
- QString appdir = QDir::homeDirPath() + "/kdepim/apps/" + KGlobal::getAppName();
- KStandardDirs::setAppDir( appdir );
-
fileName = getenv("QPEDIR");
KGlobal::iconLoader()->setIconPath( fileName +"/pics/kdepim/korganizer/");
#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;
#ifndef DESKTOP_VERSION