-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() | |||
457 | mAlarmTimer = new QTimer( this ); | 457 | mAlarmTimer = new QTimer( this ); |
458 | mRecheckAlarmTimer = new QTimer( this ); | ||
459 | connect( mRecheckAlarmTimer, SIGNAL( timeout () ), SLOT( recheckTimerAlarm() ) ); | ||
458 | connect( mSuspendTimer, SIGNAL( timeout () ), SLOT( suspendAlarm() ) ); | 460 | connect( mSuspendTimer, SIGNAL( timeout () ), SLOT( suspendAlarm() ) ); |
@@ -493,2 +495,3 @@ void CalendarView::startAlarm( QString mess , QString filename) | |||
493 | mAlarmDialog->eventNotification( mess, KOPrefs::instance()->mAlarmPlayBeeps, filename, true,KOPrefs::instance()->mAlarmBeepInterval ,KOPrefs::instance()->mAlarmSuspendCount ); | 495 | mAlarmDialog->eventNotification( mess, KOPrefs::instance()->mAlarmPlayBeeps, filename, true,KOPrefs::instance()->mAlarmBeepInterval ,KOPrefs::instance()->mAlarmSuspendCount ); |
496 | QTimer::singleShot( 3000, this, SLOT( checkNextTimerAlarm() ) ); | ||
494 | 497 | ||
@@ -496,2 +499,6 @@ void CalendarView::startAlarm( QString mess , QString filename) | |||
496 | 499 | ||
500 | void CalendarView::checkNextTimerAlarm() | ||
501 | { | ||
502 | mCalendar->checkAlarmForIncidence( 0, true ); | ||
503 | } | ||
497 | 504 | ||
@@ -606,8 +613,26 @@ void CalendarView::addAlarm(const QDateTime &qdt, const QString ¬i ) | |||
606 | } | 613 | } |
614 | int maxSec; | ||
615 | //maxSec = 5; //testing only | ||
616 | maxSec = 86400+3600; // one day+1hour | ||
607 | mAlarmNotification = noti; | 617 | mAlarmNotification = noti; |
608 | int ms = QDateTime::currentDateTime().secsTo( qdt )*1000; | 618 | int sec = QDateTime::currentDateTime().secsTo( qdt ); |
609 | //qDebug("Alarm timer started with secs: %d ", ms/1000); | 619 | if ( sec > maxSec ) { |
610 | mAlarmTimer->start( ms , true ); | 620 | mRecheckAlarmTimer->start( maxSec * 1000 ); |
621 | // qDebug("recheck Alarm timer started with secs: %d next alarm in sec:%d", maxSec,sec ); | ||
622 | return; | ||
623 | } else { | ||
624 | mRecheckAlarmTimer->stop(); | ||
625 | } | ||
626 | //qDebug("Alarm timer started with secs: %d ", sec); | ||
627 | mAlarmTimer->start( sec *1000 , true ); | ||
611 | 628 | ||
612 | } | 629 | } |
630 | // called by mRecheckAlarmTimer to get next alarm | ||
631 | // we need this, because a QTimer has only a max range of 25 days | ||
632 | void CalendarView::recheckTimerAlarm() | ||
633 | { | ||
634 | mAlarmTimer->stop(); | ||
635 | mRecheckAlarmTimer->stop(); | ||
636 | mCalendar->checkAlarmForIncidence( 0, true ); | ||
637 | } | ||
613 | void CalendarView::removeAlarm(const QDateTime &qdt, const QString ¬i ) | 638 | 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 | |||
173 | public slots: | 173 | public slots: |
174 | 174 | void recheckTimerAlarm(); | |
175 | void checkNextTimerAlarm(); | ||
175 | void addAlarm(const QDateTime &qdt, const QString ¬i ); | 176 | void addAlarm(const QDateTime &qdt, const QString ¬i ); |
@@ -476,2 +477,3 @@ class CalendarView : public KOrg::CalendarViewBase, public KCal::Calendar::Obser | |||
476 | QTimer* mAlarmTimer; | 477 | QTimer* mAlarmTimer; |
478 | QTimer* mRecheckAlarmTimer; | ||
477 | void computeAlarm( QString ); | 479 | 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 @@ | |||
52 | #endif | 52 | #endif |
53 | #ifndef DESKTOP_VERSION | ||
54 | #include <qtopia/qcopenvelope_qws.h> | ||
55 | #endif | ||
56 | |||
53 | KOEventViewer::KOEventViewer(QWidget *parent,const char *name) | 57 | KOEventViewer::KOEventViewer(QWidget *parent,const char *name) |
@@ -65,2 +69,4 @@ void KOEventViewer::setSource(const QString& n) | |||
65 | { | 69 | { |
70 | |||
71 | if ( n.left(3) == "uid" ) { | ||
66 | KABC::StdAddressBook* AddressBook = KABC::StdAddressBook::self( true ); | 72 | KABC::StdAddressBook* AddressBook = KABC::StdAddressBook::self( true ); |
@@ -93,2 +99,12 @@ void KOEventViewer::setSource(const QString& n) | |||
93 | } | 99 | } |
100 | return; | ||
101 | } | ||
102 | if ( n.left(6) == "mailto" ) { | ||
103 | // qDebug("KOEventViewer::setSource %s ", n.mid(7).latin1()); | ||
104 | #ifndef DESKTOP_VERSION | ||
105 | QCopEnvelope e("QPE/Application/kmpi", "newMail(QString)" ); | ||
106 | e << n.mid(7); | ||
107 | #endif | ||
108 | |||
109 | } | ||
94 | 110 | ||
@@ -172,2 +188,3 @@ void KOEventViewer::appendEvent(Event *event, int mode ) | |||
172 | { | 188 | { |
189 | mMailSubject = ""; | ||
173 | mCurrentIncidence = event; | 190 | mCurrentIncidence = event; |
@@ -195,2 +212,3 @@ void KOEventViewer::appendEvent(Event *event, int mode ) | |||
195 | } | 212 | } |
213 | mMailSubject += i18n( "Meeting " )+ event->summary(); | ||
196 | if (event->cancelled ()) { | 214 | if (event->cancelled ()) { |
@@ -200,2 +218,3 @@ void KOEventViewer::appendEvent(Event *event, int mode ) | |||
200 | mText += "</font>"; | 218 | mText += "</font>"; |
219 | mMailSubject += i18n("(cancelled)"); | ||
201 | } | 220 | } |
@@ -204,2 +223,3 @@ void KOEventViewer::appendEvent(Event *event, int mode ) | |||
204 | mText.append(event->location()+"<br>"); | 223 | mText.append(event->location()+"<br>"); |
224 | mMailSubject += i18n(" at ") + event->location(); | ||
205 | } | 225 | } |
@@ -240,2 +260,5 @@ void KOEventViewer::appendEvent(Event *event, int mode ) | |||
240 | addTag("p", KGlobal::locale()->formatDate( next, shortDate )); | 260 | addTag("p", KGlobal::locale()->formatDate( next, shortDate )); |
261 | QDateTime nextdt = QDateTime( next, event->dtStart().time()); | ||
262 | mMailSubject += i18n(" - " )+ KGlobal::locale()->formatDateTime( nextdt, true ); | ||
263 | |||
241 | } else { | 264 | } else { |
@@ -244,2 +267,5 @@ void KOEventViewer::appendEvent(Event *event, int mode ) | |||
244 | } | 267 | } |
268 | } else { | ||
269 | mMailSubject += i18n(" - " )+event->dtStartStr( true ); | ||
270 | |||
245 | } | 271 | } |
@@ -276,2 +302,3 @@ void KOEventViewer::appendTodo(Todo *event, int mode ) | |||
276 | { | 302 | { |
303 | mMailSubject = ""; | ||
277 | mCurrentIncidence = event; | 304 | mCurrentIncidence = event; |
@@ -297,2 +324,3 @@ void KOEventViewer::appendTodo(Todo *event, int mode ) | |||
297 | } | 324 | } |
325 | mMailSubject += i18n( "Todo " )+ event->summary(); | ||
298 | if (event->cancelled ()) { | 326 | if (event->cancelled ()) { |
@@ -302,2 +330,3 @@ void KOEventViewer::appendTodo(Todo *event, int mode ) | |||
302 | mText += "</font>"; | 330 | mText += "</font>"; |
331 | mMailSubject += i18n("(cancelled)"); | ||
303 | } | 332 | } |
@@ -307,2 +336,3 @@ void KOEventViewer::appendTodo(Todo *event, int mode ) | |||
307 | mText.append(event->location()+"<br>"); | 336 | mText.append(event->location()+"<br>"); |
337 | mMailSubject += i18n(" at ") + event->location(); | ||
308 | } | 338 | } |
@@ -310,2 +340,3 @@ void KOEventViewer::appendTodo(Todo *event, int mode ) | |||
310 | mText.append(i18n("<p><b>Due on:</b> %1</p>").arg(event->dtDueStr(KOPrefs::instance()->mShortDateInViewer))); | 340 | mText.append(i18n("<p><b>Due on:</b> %1</p>").arg(event->dtDueStr(KOPrefs::instance()->mShortDateInViewer))); |
341 | mMailSubject += i18n(" - " )+event->dtDueStr( true ); | ||
311 | } | 342 | } |
@@ -407,5 +438,6 @@ void KOEventViewer::formatAttendees(Incidence *event) | |||
407 | 438 | ||
439 | |||
408 | if (!a->email().isEmpty()) { | 440 | if (!a->email().isEmpty()) { |
409 | if (iconPath) { | 441 | if (iconPath) { |
410 | mText += "<a href=\"mailto:" + a->name() +" "+ "<" + a->email() + ">" + "\">"; | 442 | mText += "<a href=\"mailto:" + a->name() +" <" + a->email() + ">:" + mMailSubject + "\">"; |
411 | mText += "<IMG src=\"" + iconPath + "\">"; | 443 | 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 { | |||
67 | QString mText; | 67 | QString mText; |
68 | QString mMailSubject; | ||
68 | Incidence* mCurrentIncidence; | 69 | 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 ) | |||
55 | KGlobal::setAppName( "korganizer" ); | 55 | KGlobal::setAppName( "korganizer" ); |
56 | |||
57 | |||
58 | QString fileName ; | 56 | QString fileName ; |
59 | #ifndef DESKTOP_VERSION | 57 | #ifndef DESKTOP_VERSION |
60 | QString appdir = QDir::homeDirPath() + "/kdepim/apps/" + KGlobal::getAppName(); | ||
61 | KStandardDirs::setAppDir( appdir ); | ||
62 | |||
63 | fileName = getenv("QPEDIR"); | 58 | fileName = getenv("QPEDIR"); |
@@ -65,23 +60,6 @@ int main( int argc, char **argv ) | |||
65 | #else | 60 | #else |
66 | |||
67 | #ifndef _WIN32_ | ||
68 | fileName = qApp->applicationDirPath () + "/kdepim/korganizer/"; | 61 | fileName = qApp->applicationDirPath () + "/kdepim/korganizer/"; |
69 | #else | 62 | KGlobal::iconLoader()->setIconPath(QDir::convertSeparators(fileName)); |
70 | fileName = qApp->applicationDirPath () + "\\kdepim\\korganizer\\"; | ||
71 | #endif | ||
72 | |||
73 | KGlobal::iconLoader()->setIconPath(fileName); | ||
74 | |||
75 | QString appdir = QDir::homeDirPath(); | ||
76 | //appdir = "C:\\"; | ||
77 | if ( appdir.right(1) == "\\" || appdir.right(1) == "/" ) | ||
78 | appdir += "korganizer"; | ||
79 | else | ||
80 | appdir += "/korganizer"; | ||
81 | KStandardDirs::setAppDir( QDir::convertSeparators( appdir )); | ||
82 | // qDebug(" %s ",KStandardDirs::appDir().latin1() ); | ||
83 | #endif | 63 | #endif |
84 | QDir app_dir; | 64 | KStandardDirs::setAppDir( QDir::convertSeparators(locateLocal("data", "korganizer"))); |
85 | if ( !app_dir.exists(KStandardDirs::appDir()) ) | ||
86 | app_dir.mkdir (KStandardDirs::appDir()); | ||
87 | MainWindow m; | 65 | MainWindow m; |