From d65dc25caec62d4c554c99fbc151bf4d07c63b72 Mon Sep 17 00:00:00 2001 From: zecke Date: Tue, 21 May 2002 14:21:59 +0000 Subject: usbaility updates a clock should be able to set the time --- (limited to 'noncore/tools/clock') diff --git a/noncore/tools/clock/clock.cpp b/noncore/tools/clock/clock.cpp index a21a061..ea8e8ca 100644 --- a/noncore/tools/clock/clock.cpp +++ b/noncore/tools/clock/clock.cpp @@ -31,6 +31,8 @@ #include #include +#include + #include #include #include @@ -92,7 +94,7 @@ Clock::Clock( QWidget * parent, const char * name, WFlags f ) 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 ); @@ -131,6 +133,11 @@ Clock::Clock( QWidget * parent, const char * name, WFlags f ) 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() ) ); @@ -167,7 +174,7 @@ Clock::Clock( QWidget * parent, const char * name, WFlags f ) alarmBool=FALSE; snoozeBtn->hide(); } - + QTimer::singleShot( 0, this, SLOT(updateClock()) ); modeSelect(0); } @@ -184,7 +191,7 @@ void Clock::updateClock() QString s; if ( ampm ) { int hour = tm.hour(); - if (hour == 0) + if (hour == 0) hour = 12; if (hour > 12) hour -= 12; @@ -281,7 +288,7 @@ void Clock::modeSelect( int m ) } //this sets the alarm time -void Clock::slotSetAlarm() +void Clock::slotSetAlarm() { if( !snoozeBtn->isHidden()) slotToggleAlarm(); @@ -303,7 +310,7 @@ void Clock::slotSetAlarm() config.writeEntry("clockAlarmMinute",tmp.setNum( minute ),10); config.writeEntry("clockAlarmSnooze",tmp.setNum( snoozeTime ),10); config.write(); - } + } } void Clock::slotSnooze() @@ -320,7 +327,7 @@ void Clock::slotSnooze() } //toggles alarm on/off -void Clock::slotToggleAlarm() +void Clock::slotToggleAlarm() { Config config( "qpe" ); config.setGroup("Time"); @@ -474,3 +481,8 @@ QPoint AnalogClock::rotate( QPoint c, QPoint p, int a ) ( p.x() - c.x() ) * sin( angle ); return QPoint( nx, ny ); } +void Clock::slotAdjustTime() +{ + QCopEnvelope e("QPE/System", "execute(QString)"); + e << QString("systemtime"); +} diff --git a/noncore/tools/clock/clock.h b/noncore/tools/clock/clock.h index 9b756b5..024dd28 100644 --- a/noncore/tools/clock/clock.h +++ b/noncore/tools/clock/clock.h @@ -76,6 +76,7 @@ private slots: void alarmOff(); void appMessage(const QCString& msg, const QByteArray& data); void timerEvent( QTimerEvent *e ); + void slotAdjustTime(); private: void clearClock(); diff --git a/noncore/tools/clock/clock.pro b/noncore/tools/clock/clock.pro index 5373515..7eecce1 100644 --- a/noncore/tools/clock/clock.pro +++ b/noncore/tools/clock/clock.pro @@ -6,7 +6,7 @@ SOURCES = clock.cpp setAlarm.cpp \ main.cpp INCLUDEPATH += $(OPIEDIR)/include DEPENDPATH += $(OPIEDIR)/include -LIBS += -lqpe +LIBS += -lqpe -lopie INTERFACES = TARGET = clock -- cgit v0.9.0.2