author | zautrix <zautrix> | 2005-08-10 17:39:44 (UTC) |
---|---|---|
committer | zautrix <zautrix> | 2005-08-10 17:39:44 (UTC) |
commit | 1a13e55dd4726cc03c756412fe27b3144a43fc4c (patch) (side-by-side diff) | |
tree | e41b3f85d0a011b1416c4ea50a9348ee3863a4df | |
parent | 1af305e995d99549091c5b1e167b6101a3910f0d (diff) | |
download | kdepimpi-1a13e55dd4726cc03c756412fe27b3144a43fc4c.zip kdepimpi-1a13e55dd4726cc03c756412fe27b3144a43fc4c.tar.gz kdepimpi-1a13e55dd4726cc03c756412fe27b3144a43fc4c.tar.bz2 |
alarm save as file
-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 @@ -1190,141 +1190,171 @@ void CalendarView::computeAlarm( QString msg ) int len = mess.mid( 10 ).find("+++"); if ( len < 2 ) error = true; else { tempfilename = mess.mid( 10, len ); if ( !QFile::exists( tempfilename ) ) error = true; } if ( error ) { mAlarmMessage = "Procedure Alarm\nError - File not found\n"; mAlarmMessage += mess.mid( 10+len+3+9 ); } else { //QCopEnvelope e("QPE/Application/kopi", "-writeFileSilent"); //qDebug("-----system command %s ",tempfilename.latin1() ); #ifndef _WIN32_ if ( vfork () == 0 ) { execl ( tempfilename.latin1(), 0 ); return; } #else QProcess* p = new QProcess(); p->addArgument( tempfilename.latin1() ); p->start(); return; #endif return; } //qDebug("+++++++system command %s ",tempfilename.latin1() ); } if ( mess.left( 11 ) == "audio_alarm") { bool error = false; int len = mess.mid( 11 ).find("+++"); if ( len < 2 ) error = true; else { tempfilename = mess.mid( 11, len ); if ( !QFile::exists( tempfilename ) ) error = true; } if ( ! error ) { filename = tempfilename; } mAlarmMessage = mess.mid( 11+len+3+9 ); //qDebug("audio file command %s ",tempfilename.latin1() ); } if ( mess.left( 9 ) == "cal_alarm") { mAlarmMessage = mess.mid( 9 ) ; } startAlarm( mAlarmMessage, filename ); } void CalendarView::addSuspendAlarm(const QDateTime &qdt, const QString ¬i ) { //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 ¬i ) { mNextAlarmDateTime = qdt; //qDebug("+++++addAlarm %s %s ", qdt.toString().latin1() , noti.latin1() ); 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 ) { 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 ); } #ifndef DESKTOP_VERSION void CalendarView::removeAlarm(const QDateTime &qdt, const QString ¬i ) #else void CalendarView::removeAlarm(const QDateTime &, const QString & ) #endif { //qDebug("-----removeAlarm %s %s ", qdt.toString().latin1() , noti.latin1() ); if ( ! KOPrefs::instance()->mUseInternalAlarmNotification ) { #ifndef DESKTOP_VERSION AlarmServer::deleteAlarm (qdt ,"koalarm" ,noti.utf8() ); #endif return; } mAlarmTimer->stop(); } void CalendarView::selectWeekNum ( int num ) { dateNavigator()->blockSignals( true ); dateNavigator()->selectWeek( num ); dateNavigator()->blockSignals( false ); mViewManager->showWeekView(); } KOViewManager *CalendarView::viewManager() { return mViewManager; } KODialogManager *CalendarView::dialogManager() { return mDialogManager; } QDate CalendarView::startDate() { DateList dates = mNavigator->selectedDates(); return dates.first(); } QDate CalendarView::endDate() |