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
@@ -455,6 +455,8 @@ 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() ) );
mAlarmDialog = new AlarmDialog( this );
@@ -491,9 +493,14 @@ void CalendarView::suspendAlarm()
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 )
{
@@ -604,12 +611,30 @@ void CalendarView::addAlarm(const QDateTime &qdt, const QString &noti )
#endif
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 )
{
//qDebug("-----removeAlarm %s %s ", qdt.toString().latin1() , noti.latin1() );
diff --git a/korganizer/calendarview.h b/korganizer/calendarview.h
index e7aa351..fda02f7 100644
--- a/korganizer/calendarview.h
+++ b/korganizer/calendarview.h
@@ -171,7 +171,8 @@ 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 );
void removeAlarm(const QDateTime &qdt, const QString &noti );
@@ -474,6 +475,7 @@ class CalendarView : public KOrg::CalendarViewBase, public KCal::Calendar::Obser
QString mSuspendAlarmNotification;
QTimer* mSuspendTimer;
QTimer* mAlarmTimer;
+ QTimer* mRecheckAlarmTimer;
void computeAlarm( QString );
void startAlarm( QString, QString );
void setSyncEventsReadOnly();
diff --git a/korganizer/koeventviewer.cpp b/korganizer/koeventviewer.cpp
index bac66d3..1f69700 100644
--- a/korganizer/koeventviewer.cpp
+++ b/korganizer/koeventviewer.cpp
@@ -50,6 +50,10 @@
#include <kabc/stdaddressbook.h>
#define size count
#endif
+#ifndef DESKTOP_VERSION
+#include <qtopia/qcopenvelope_qws.h>
+#endif
+
KOEventViewer::KOEventViewer(QWidget *parent,const char *name)
: QTextBrowser(parent,name)
{
@@ -63,6 +67,8 @@ KOEventViewer::~KOEventViewer()
void KOEventViewer::setSource(const QString& n)
{
+
+ if ( n.left(3) == "uid" ) {
KABC::StdAddressBook* AddressBook = KABC::StdAddressBook::self( true );
KABC::AddressBook::Iterator it;
for( it = AddressBook->begin(); it != AddressBook->end(); ++it ) {
@@ -91,6 +97,16 @@ void KOEventViewer::setSource(const QString& n)
break;
}
}
+ 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
+
+ }
#ifndef KORG_NODCOP
@@ -170,6 +186,7 @@ void KOEventViewer::setColorMode( int m )
}
void KOEventViewer::appendEvent(Event *event, int mode )
{
+ mMailSubject = "";
mCurrentIncidence = event;
bool shortDate = KOPrefs::instance()->mShortDateInViewer;
topLevelWidget()->setCaption(i18n("Event Viewer"));
@@ -193,15 +210,18 @@ void KOEventViewer::appendEvent(Event *event, int mode )
if ( mColorMode )
mText += "</font>";
}
+ mMailSubject += i18n( "Meeting " )+ event->summary();
if (event->cancelled ()) {
mText +="<font color=\"#B00000\">";
addTag("i",i18n("This event has been cancelled!"));
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()) {
if (event->isMultiDay()) {
@@ -238,10 +258,16 @@ void KOEventViewer::appendEvent(Event *event, int mode )
next = event->recurrence()->getNextDate( start.addDays( - 1 ) );
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 );
+
}
@@ -274,6 +300,7 @@ void KOEventViewer::appendEvent(Event *event, int mode )
void KOEventViewer::appendTodo(Todo *event, int mode )
{
+ mMailSubject = "";
mCurrentIncidence = event;
topLevelWidget()->setCaption(i18n("Todo Viewer"));
bool shortDate = KOPrefs::instance()->mShortDateInViewer;
@@ -295,19 +322,23 @@ void KOEventViewer::appendTodo(Todo *event, int mode )
if ( mColorMode )
mText += "</font>";
}
+ mMailSubject += i18n( "Todo " )+ event->summary();
if (event->cancelled ()) {
mText +="<font color=\"#B00000\">";
addTag("i",i18n("This todo has been cancelled!"));
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->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: "));
mText.append(event->secrecyStr()+"<br>");
@@ -405,9 +436,10 @@ void KOEventViewer::formatAttendees(Incidence *event)
mText += "</a>\n";
#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
@@ -65,6 +65,7 @@ class KOEventViewer : public QTextBrowser {
bool mSyncMode;
QString mText;
+ QString mMailSubject;
Incidence* mCurrentIncidence;
signals:
void launchaddressbook(QString uid);
diff --git a/korganizer/main.cpp b/korganizer/main.cpp
index a357988..69ef294 100644
--- a/korganizer/main.cpp
+++ b/korganizer/main.cpp
@@ -53,37 +53,15 @@ 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
QObject::connect( &a, SIGNAL (appMessage ( const QCString &, const QByteArray & )),&m, SLOT(recieve( const QCString&, const QByteArray& )));