summaryrefslogtreecommitdiff
Side-by-side diff
Diffstat (more/less context) (show whitespace changes)
-rw-r--r--noncore/tools/clock/clock.cpp9
-rw-r--r--noncore/tools/clock/setAlarm.cpp35
-rw-r--r--noncore/tools/clock/setAlarm.h4
3 files changed, 44 insertions, 4 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
@@ -386,11 +386,20 @@ void Clock::appMessage(const QCString& msg, const QByteArray& data)
int timerStay = 5000;
bSound=TRUE;
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();
raise();
QPEApplication::setKeepRunning();
setActiveWindow();
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
@@ -13,10 +13,12 @@
***************************************************************************/
#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>
#include <qlabel.h>
#include <qlcdnumber.h>
@@ -27,17 +29,18 @@
#include <qvariant.h>
#include <qtooltip.h>
#include <qwhatsthis.h>
#include <qbuttongroup.h>
+#include <qcheckbox.h>
Set_Alarm::Set_Alarm( QWidget* parent, const char* name, bool modal, WFlags fl )
: QDialog( parent, name, modal, fl )
{
if ( !name )
setName( "Set_Alarm" );
resize( 240, 101 );
setMaximumSize( QSize( 240, 320 ) );
- move(0,48);
+ move(0,45);
setCaption( tr( "Set Alarm" ) );
connect( qApp,SIGNAL( aboutToQuit()),SLOT( cleanUp()) );
Set_AlarmLayout = new QGridLayout( this );
@@ -96,8 +99,14 @@ Set_Alarm::Set_Alarm( QWidget* parent, const char* name, bool modal, WFlags fl
connect( Pm_RadioButton, SIGNAL(toggled(bool)),this,SLOT( pmButtonToggled(bool)));
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)" ) );
Set_AlarmLayout->addMultiCellWidget( TextLabel3, 3, 3, 0, 1 );
@@ -113,9 +122,9 @@ Set_Alarm::Set_Alarm( QWidget* parent, const char* name, bool modal, WFlags fl
SnoozeSlider->setMaxValue( 60 );
SnoozeSlider->setOrientation( QSlider::Horizontal );
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" );
config.setGroup("Time");
@@ -147,9 +156,13 @@ Set_Alarm::Set_Alarm( QWidget* parent, const char* name, bool modal, WFlags fl
SnoozeSlider->setValue( snoozeTime.toInt(&ok,10) );
Am_RadioButton->hide();
Pm_RadioButton->hide();
}
+ if( config.readBoolEntry("mp3Alarm") )
+ useMp3Check->setChecked(true);
+
// signals and slots connections
+ connect(useMp3Check,SIGNAL(toggled(bool)),this,SLOT(slotChangemp3CkeckBox(bool)));
}
Set_Alarm::~Set_Alarm()
{
@@ -185,4 +198,20 @@ void Set_Alarm::pmButtonToggled(bool b)
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
@@ -25,9 +25,9 @@ class QLCDNumber;
class QLabel;
class QRadioButton;
class QSlider;
class QButtonGroup;
-
+class QCheckBox;
class Set_Alarm : public QDialog
{
Q_OBJECT
@@ -42,9 +42,11 @@ public:
QRadioButton* Am_RadioButton;
QRadioButton* Pm_RadioButton;
QButtonGroup *ButtonGroup1;
+ QCheckBox *useMp3Check;
protected slots:
+ void slotChangemp3CkeckBox(bool);
void slotChangeHour(int);
void slotChangeMinute(int);
void slotChangeSnooze(int);
void amButtonToggled(bool);