summaryrefslogtreecommitdiff
path: root/noncore/tools/clock/clock.cpp
Unidiff
Diffstat (limited to 'noncore/tools/clock/clock.cpp') (more/less context) (ignore whitespace changes)
-rw-r--r--noncore/tools/clock/clock.cpp29
1 files changed, 17 insertions, 12 deletions
diff --git a/noncore/tools/clock/clock.cpp b/noncore/tools/clock/clock.cpp
index e681650..0ad69d9 100644
--- a/noncore/tools/clock/clock.cpp
+++ b/noncore/tools/clock/clock.cpp
@@ -63,4 +63,6 @@ static const int magic_countdown = 2292923;
63static const int magic_snooze = 2292924; 63static const int magic_snooze = 2292924;
64static const int magic_playmp = 2292925; 64static const int magic_playmp = 2292925;
65static const char ALARM_CLOCK_CHANNEL [] = "QPE/Application/clock";
66static const char ALARM_CLOCK_MESSAGE [] = "alarm(QDateTime,int)";
65 67
66#include <math.h> 68#include <math.h>
@@ -128,6 +130,6 @@ AlarmDlg::checkSnooze(void)
128 // Ensure we have only one snooze alarm. 130 // Ensure we have only one snooze alarm.
129 // 131 //
130 AlarmServer::deleteAlarm(QDateTime(), "QPE/Application/clock", 132 AlarmServer::deleteAlarm(QDateTime(), ALARM_CLOCK_CHANNEL,
131 "alarm(QDateTime,int)", magic_snooze); 133 ALARM_CLOCK_MESSAGE, magic_snooze);
132 134
133 if (snoozeTime->value() > 0) { 135 if (snoozeTime->value() > 0) {
@@ -135,6 +137,6 @@ AlarmDlg::checkSnooze(void)
135 wake = wake.addSecs(snoozeTime->value() * 60); // snoozeTime in minutes 137 wake = wake.addSecs(snoozeTime->value() * 60); // snoozeTime in minutes
136 138
137 AlarmServer::addAlarm(wake, "QPE/Application/clock", 139 AlarmServer::addAlarm(wake, ALARM_CLOCK_CHANNEL,
138 "alarm(QDateTime,int)", magic_snooze); 140 ALARM_CLOCK_MESSAGE, magic_snooze);
139 } 141 }
140 accept(); 142 accept();
@@ -572,5 +574,5 @@ void Clock::enableDaily( bool )
572void Clock::appMessage( const QCString &msg, const QByteArray &data ) 574void Clock::appMessage( const QCString &msg, const QByteArray &data )
573{ 575{
574 if ( msg == "alarm(QDateTime,int)" ) { 576 if ( msg == ALARM_CLOCK_MESSAGE ) {
575 QDataStream ds(data,IO_ReadOnly); 577 QDataStream ds(data,IO_ReadOnly);
576 QDateTime when; 578 QDateTime when;
@@ -717,7 +719,5 @@ void Clock::applyDailyAlarm()
717 719
718 bool enableDaily = dailyEnabled->isChecked(); 720 bool enableDaily = dailyEnabled->isChecked();
719 bool wasSound = config.readEntry( "SoundEnabled" );
720 bool isSound = sndCheck->isChecked(); 721 bool isSound = sndCheck->isChecked();
721 int oldMagic = wasSound ? magic_playmp : magic_daily;
722 int isMagic = isSound ? magic_playmp : magic_daily; 722 int isMagic = isSound ? magic_playmp : magic_daily;
723 config.writeEntry( "Enabled", enableDaily ); 723 config.writeEntry( "Enabled", enableDaily );
@@ -736,11 +736,16 @@ void Clock::applyDailyAlarm()
736 config.writeEntry( "ExcludeDays", exclDays ); 736 config.writeEntry( "ExcludeDays", exclDays );
737 737
738 /* try to delete both */ 738 /* try to delete all */
739 AlarmServer::deleteAlarm(QDateTime(), "QPE/Application/clock", 739 AlarmServer::deleteAlarm(QDateTime(), ALARM_CLOCK_CHANNEL,
740 "alarm(QDateTime,int)", oldMagic); 740 ALARM_CLOCK_MESSAGE, magic_daily);
741 AlarmServer::deleteAlarm(QDateTime(), ALARM_CLOCK_CHANNEL,
742 ALARM_CLOCK_MESSAGE, magic_playmp );
743 AlarmServer::deleteAlarm(QDateTime(), ALARM_CLOCK_CHANNEL,
744 ALARM_CLOCK_MESSAGE, magic_snooze);
745
741 if ( enableDaily && exclCount < 7 ) { 746 if ( enableDaily && exclCount < 7 ) {
742 QDateTime when = nextAlarm( hour, minute ); 747 QDateTime when = nextAlarm( hour, minute );
743 AlarmServer::addAlarm(when, "QPE/Application/clock", 748 AlarmServer::addAlarm(when, ALARM_CLOCK_CHANNEL,
744 "alarm(QDateTime,int)", isMagic); 749 ALARM_CLOCK_MESSAGE, isMagic);
745 } 750 }
746} 751}