-rw-r--r-- | noncore/tools/clock/clock.cpp | 21 |
1 files changed, 16 insertions, 5 deletions
diff --git a/noncore/tools/clock/clock.cpp b/noncore/tools/clock/clock.cpp index a85cc19..0a21146 100644 --- a/noncore/tools/clock/clock.cpp +++ b/noncore/tools/clock/clock.cpp @@ -16,9 +16,8 @@ ** Contact info@trolltech.com if any conditions of this licensing are ** not clear to you. ** **********************************************************************/ -// code added and Copyright (C) by L. J. Potter <ljp@llornkcor.com> 2002 #include "clock.h" #include "setAlarm.h" @@ -31,8 +30,10 @@ #include <qpe/resource.h> #include <qsound.h> #include <qtimer.h> +#include <opie/oclickablelabel.h> + #include <qlcdnumber.h> #include <qslider.h> #include <qlabel.h> #include <qlayout.h> @@ -92,9 +93,9 @@ Clock::Clock( QWidget * parent, const char * name, WFlags f ) date->setFont( QFont( "Helvetica", 14, QFont::Bold ) ); date->setText( TimeString::longDateString( QDate::currentDate() ) ); QWidget *controls = new QWidget( this ); - QGridLayout *gl = new QGridLayout( controls, 2, 2, 6, 4 ); + QGridLayout *gl = new QGridLayout( controls, 3, 2, 6, 4 ); QButtonGroup *grp = new QButtonGroup( controls ); grp->setRadioButtonExclusive( true ); grp->hide(); @@ -131,8 +132,13 @@ Clock::Clock( QWidget * parent, const char * name, WFlags f ) // alarmBtn->setMaximumSize(60,30); gl->addWidget( alarmBtn, 1, 2 ); alarmBtn->setText( tr( "Set Alarm" ) ); + OClickableLabel *click = new OClickableLabel(controls, "label" ); + click->setText(tr("Set date and time." ) ); + gl->addMultiCellWidget( click, 3, 3, 0, 2, AlignHCenter); + connect( click, SIGNAL(clicked() ), this, SLOT(slotAdjustTime() ) ); + connect( set, SIGNAL( pressed() ), SLOT( slotSet() ) ); connect( reset, SIGNAL( clicked() ), SLOT( slotReset() ) ); connect( alarmBtn, SIGNAL( clicked() ), SLOT( slotSetAlarm() ) ); @@ -309,9 +315,9 @@ void Clock::slotSetAlarm() void Clock::slotSnooze() { bSound=FALSE; - int warn; + int warn = 0; QTime t = QTime::currentTime(); QDateTime whenl( when.date(), t.addSecs( snoozeTime*60)); when=whenl; AlarmServer::addAlarm( when, @@ -348,9 +354,9 @@ void Clock::alarmOn() qDebug("Time set "+tm.toString()); QTime t = QTime::currentTime(); if( t > tm) d = d.addDays(1); - int warn; + int warn = 0; QDateTime whenl(d,tm); when=whenl; AlarmServer::addAlarm( when, "QPE/Application/clock", @@ -359,9 +365,9 @@ void Clock::alarmOn() } void Clock::alarmOff() { - int warn; + int warn = 0; bSound=FALSE; AlarmServer::deleteAlarm( when, "QPE/Application/clock", "alarm(QDateTime,int)", warn ); @@ -478,4 +484,9 @@ QPoint AnalogClock::rotate( QPoint c, QPoint p, int a ) double ny = c.y() - ( p.y() - c.y() ) * cos( angle ) + ( p.x() - c.x() ) * sin( angle ); return QPoint( nx, ny ); } +void Clock::slotAdjustTime() +{ + QCopEnvelope e("QPE/System", "execute(QString)"); + e << QString("systemtime"); +} |