-rw-r--r-- | noncore/tools/clock/clock.cpp | 13 | ||||
-rw-r--r-- | noncore/tools/clock/setAlarm.cpp | 35 | ||||
-rw-r--r-- | noncore/tools/clock/setAlarm.h | 4 |
3 files changed, 46 insertions, 6 deletions
diff --git a/noncore/tools/clock/clock.cpp b/noncore/tools/clock/clock.cpp index a47793b..69d8214 100644 --- a/noncore/tools/clock/clock.cpp +++ b/noncore/tools/clock/clock.cpp @@ -306,6 +306,6 @@ void Clock::slotSetAlarm() snoozeTime=setAlarmDlg->SnoozeSlider->value(); if(ampm) { - if ( hour == 12 ) - hour = 0; + if ( hour == 12 ) + hour = 0; if(setAlarmDlg->Pm_RadioButton->isChecked() && hour < 12 ) @@ -388,6 +388,15 @@ void Clock::appMessage(const QCString& msg, const QByteArray& data) qDebug("Message received in clock"); if ( msg == "alarm(QDateTime,int)" ) { + Config config( "qpe" ); + config.setGroup("Time"); + if(config.readBoolEntry("mp3Alarm",0)){ + + QCopEnvelope e("QPE/Application/opieplayer","setDocument(QString)"); + e<<config.readEntry("mp3File",""); + } else { + Sound::soundAlarm(); stopTimer = startTimer( timerStay); + } } show(); diff --git a/noncore/tools/clock/setAlarm.cpp b/noncore/tools/clock/setAlarm.cpp index 990ff81..38de396 100644 --- a/noncore/tools/clock/setAlarm.cpp +++ b/noncore/tools/clock/setAlarm.cpp @@ -15,6 +15,8 @@ #include "setAlarm.h" -#include <qpe/config.h> +#include <opie/ofileselector.h> +#include <opie/ofiledialog.h> +#include <qpe/config.h> #include <qpe/qpeapplication.h> #include <qstring.h> @@ -29,4 +31,5 @@ #include <qwhatsthis.h> #include <qbuttongroup.h> +#include <qcheckbox.h> Set_Alarm::Set_Alarm( QWidget* parent, const char* name, bool modal, WFlags fl ) @@ -37,5 +40,5 @@ Set_Alarm::Set_Alarm( QWidget* parent, const char* name, bool modal, WFlags fl resize( 240, 101 ); setMaximumSize( QSize( 240, 320 ) ); - move(0,48); + move(0,45); setCaption( tr( "Set Alarm" ) ); connect( qApp,SIGNAL( aboutToQuit()),SLOT( cleanUp()) ); @@ -98,4 +101,10 @@ Set_Alarm::Set_Alarm( QWidget* parent, const char* name, bool modal, WFlags fl Set_AlarmLayout->addMultiCellWidget(Pm_RadioButton, 1, 2, 3, 4 ); + useMp3Check = new QCheckBox ( tr( "mp3 alarm" ), this ); + useMp3Check-> setFocusPolicy ( QWidget::NoFocus ); + Set_AlarmLayout->addMultiCellWidget( useMp3Check, 2, 3, 3, 4 ); + + + TextLabel3 = new QLabel( this, "TextLabel3" ); TextLabel3->setText( tr( "Snooze Delay\n(minutes)" ) ); @@ -115,5 +124,5 @@ Set_Alarm::Set_Alarm( QWidget* parent, const char* name, bool modal, WFlags fl connect(SnoozeSlider, SIGNAL( valueChanged(int)),this,SLOT(slotChangeSnooze(int))); - Set_AlarmLayout->addMultiCellWidget( SnoozeSlider, 3, 3, 3, 4 ); + Set_AlarmLayout->addMultiCellWidget( SnoozeSlider, 4, 4, 1, 2 ); Config config( "qpe" ); @@ -149,5 +158,9 @@ Set_Alarm::Set_Alarm( QWidget* parent, const char* name, bool modal, WFlags fl Pm_RadioButton->hide(); } + if( config.readBoolEntry("mp3Alarm") ) + useMp3Check->setChecked(true); + // signals and slots connections + connect(useMp3Check,SIGNAL(toggled(bool)),this,SLOT(slotChangemp3CkeckBox(bool))); } @@ -187,2 +200,18 @@ void Set_Alarm::cleanUp() { } + +void Set_Alarm::slotChangemp3CkeckBox(bool b) { + Config config( "qpe" ); + config.setGroup("Time"); + if(b) { + QString str = OFileDialog::getOpenFileName( 2,"/");//,"", "*", this ); + if(!str.isEmpty() ) { + qDebug(str); + config.writeEntry("mp3Alarm",1); + config.writeEntry("mp3File",str); + } + } else { + config.writeEntry("mp3Alarm",0); + config.writeEntry("mp3File",""); + } +} diff --git a/noncore/tools/clock/setAlarm.h b/noncore/tools/clock/setAlarm.h index 7d63237..a21af05 100644 --- a/noncore/tools/clock/setAlarm.h +++ b/noncore/tools/clock/setAlarm.h @@ -27,5 +27,5 @@ class QRadioButton; class QSlider; class QButtonGroup; - +class QCheckBox; class Set_Alarm : public QDialog { @@ -44,5 +44,7 @@ public: QRadioButton* Pm_RadioButton; QButtonGroup *ButtonGroup1; + QCheckBox *useMp3Check; protected slots: + void slotChangemp3CkeckBox(bool); void slotChangeHour(int); void slotChangeMinute(int); |