-rw-r--r-- | korganizer/calendarview.cpp | 30 |
1 files changed, 30 insertions, 0 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 ¬i ) | |||
1248 | //qDebug("+++++addSUSPENDAlarm %s %s ", qdt.toString().latin1() , noti.latin1() ); | 1248 | //qDebug("+++++addSUSPENDAlarm %s %s ", qdt.toString().latin1() , noti.latin1() ); |
1249 | 1249 | ||
1250 | mSuspendAlarmNotification = noti; | 1250 | mSuspendAlarmNotification = noti; |
1251 | int ms = QDateTime::currentDateTime().secsTo( qdt )*1000; | 1251 | int ms = QDateTime::currentDateTime().secsTo( qdt )*1000; |
1252 | //qDebug("Suspend Alarm timer started with secs: %d ", ms/1000); | 1252 | //qDebug("Suspend Alarm timer started with secs: %d ", ms/1000); |
1253 | mSuspendTimer->start( ms , true ); | 1253 | mSuspendTimer->start( ms , true ); |
1254 | #ifdef DESKTOP_VERSION | ||
1255 | if ( QApplication::desktop()->width() < 1024 ) { | ||
1256 | QString mess = qdt.toString( "yyyy-MM-dd hh:mm:ss" ) + "\n" + noti; | ||
1257 | //qDebug("nextsuspendalarm = \n%s ",mess.latin1() ); | ||
1258 | QString fn = QDir::homeDirPath() + "/.kopi_suspend_alarm"; | ||
1259 | QFile file( fn ); | ||
1260 | if (!file.open( IO_WriteOnly ) ) { | ||
1261 | qDebug("KO: Error writing next suspend alarm file %s\nContent: \n%s ", fn.latin1(), mess.latin1()); | ||
1262 | } else { | ||
1263 | QTextStream ts( &file ); | ||
1264 | ts << mess; | ||
1265 | file.close(); | ||
1266 | } | ||
1267 | } | ||
1268 | #endif | ||
1254 | 1269 | ||
1255 | } | 1270 | } |
1256 | 1271 | ||
1257 | void CalendarView::addAlarm(const QDateTime &qdt, const QString ¬i ) | 1272 | void CalendarView::addAlarm(const QDateTime &qdt, const QString ¬i ) |
1258 | { | 1273 | { |
1259 | mNextAlarmDateTime = qdt; | 1274 | mNextAlarmDateTime = qdt; |
@@ -1261,12 +1276,27 @@ void CalendarView::addAlarm(const QDateTime &qdt, const QString ¬i ) | |||
1261 | if ( ! KOPrefs::instance()->mUseInternalAlarmNotification ) { | 1276 | if ( ! KOPrefs::instance()->mUseInternalAlarmNotification ) { |
1262 | #ifndef DESKTOP_VERSION | 1277 | #ifndef DESKTOP_VERSION |
1263 | AlarmServer::addAlarm ( qdt,"koalarm", noti.utf8() ); | 1278 | AlarmServer::addAlarm ( qdt,"koalarm", noti.utf8() ); |
1264 | #endif | 1279 | #endif |
1265 | return; | 1280 | return; |
1266 | } | 1281 | } |
1282 | #ifdef DESKTOP_VERSION | ||
1283 | if ( QApplication::desktop()->width() < 1024 ) { | ||
1284 | QString mess = qdt.toString( "yyyy-MM-dd hh:mm:ss" ) + "\n" + noti; | ||
1285 | //qDebug("nextalarm = \n%s ",mess.latin1() ); | ||
1286 | QString fn = QDir::homeDirPath() + "/.kopi_next_alarm"; | ||
1287 | QFile file( fn ); | ||
1288 | if (!file.open( IO_WriteOnly ) ) { | ||
1289 | qDebug("KO: Error writing next alarm file %s\nContent: \n%s ", fn.latin1(), mess.latin1()); | ||
1290 | } else { | ||
1291 | QTextStream ts( &file ); | ||
1292 | ts << mess; | ||
1293 | file.close(); | ||
1294 | } | ||
1295 | } | ||
1296 | #endif | ||
1267 | int maxSec; | 1297 | int maxSec; |
1268 | //maxSec = 5; //testing only | 1298 | //maxSec = 5; //testing only |
1269 | maxSec = 86400+3600; // one day+1hour | 1299 | maxSec = 86400+3600; // one day+1hour |
1270 | mAlarmNotification = noti; | 1300 | mAlarmNotification = noti; |
1271 | int sec = QDateTime::currentDateTime().secsTo( qdt ); | 1301 | int sec = QDateTime::currentDateTime().secsTo( qdt ); |
1272 | if ( sec > maxSec ) { | 1302 | if ( sec > maxSec ) { |