summaryrefslogtreecommitdiffabout
path: root/korganizer/calendarview.cpp
Side-by-side diff
Diffstat (limited to 'korganizer/calendarview.cpp') (more/less context) (ignore whitespace changes)
-rw-r--r--korganizer/calendarview.cpp32
1 files changed, 31 insertions, 1 deletions
diff --git a/korganizer/calendarview.cpp b/korganizer/calendarview.cpp
index d51187a..316826a 100644
--- a/korganizer/calendarview.cpp
+++ b/korganizer/calendarview.cpp
@@ -1248,12 +1248,27 @@ void CalendarView::addSuspendAlarm(const QDateTime &qdt, const QString &noti )
//qDebug("+++++addSUSPENDAlarm %s %s ", qdt.toString().latin1() , noti.latin1() );
mSuspendAlarmNotification = noti;
int ms = QDateTime::currentDateTime().secsTo( qdt )*1000;
//qDebug("Suspend Alarm timer started with secs: %d ", ms/1000);
mSuspendTimer->start( ms , true );
+#ifdef DESKTOP_VERSION
+ if ( QApplication::desktop()->width() < 1024 ) {
+ QString mess = qdt.toString( "yyyy-MM-dd hh:mm:ss" ) + "\n" + noti;
+ //qDebug("nextsuspendalarm = \n%s ",mess.latin1() );
+ QString fn = QDir::homeDirPath() + "/.kopi_suspend_alarm";
+ QFile file( fn );
+ if (!file.open( IO_WriteOnly ) ) {
+ qDebug("KO: Error writing next suspend alarm file %s\nContent: \n%s ", fn.latin1(), mess.latin1());
+ } else {
+ QTextStream ts( &file );
+ ts << mess;
+ file.close();
+ }
+ }
+#endif
}
void CalendarView::addAlarm(const QDateTime &qdt, const QString &noti )
{
mNextAlarmDateTime = qdt;
@@ -1261,12 +1276,27 @@ void CalendarView::addAlarm(const QDateTime &qdt, const QString &noti )
if ( ! KOPrefs::instance()->mUseInternalAlarmNotification ) {
#ifndef DESKTOP_VERSION
AlarmServer::addAlarm ( qdt,"koalarm", noti.utf8() );
#endif
return;
}
+#ifdef DESKTOP_VERSION
+ if ( QApplication::desktop()->width() < 1024 ) {
+ QString mess = qdt.toString( "yyyy-MM-dd hh:mm:ss" ) + "\n" + noti;
+ //qDebug("nextalarm = \n%s ",mess.latin1() );
+ QString fn = QDir::homeDirPath() + "/.kopi_next_alarm";
+ QFile file( fn );
+ if (!file.open( IO_WriteOnly ) ) {
+ qDebug("KO: Error writing next alarm file %s\nContent: \n%s ", fn.latin1(), mess.latin1());
+ } else {
+ QTextStream ts( &file );
+ ts << mess;
+ file.close();
+ }
+ }
+#endif
int maxSec;
//maxSec = 5; //testing only
maxSec = 86400+3600; // one day+1hour
mAlarmNotification = noti;
int sec = QDateTime::currentDateTime().secsTo( qdt );
if ( sec > maxSec ) {
@@ -1274,13 +1304,13 @@ void CalendarView::addAlarm(const QDateTime &qdt, const QString &noti )
// 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 );
+ 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()
{