summaryrefslogtreecommitdiff
authorllornkcor <llornkcor>2002-05-31 12:12:02 (UTC)
committer llornkcor <llornkcor>2002-05-31 12:12:02 (UTC)
commitdd08e7fa2ccbcc0489c17ed305b20a9a7d187161 (patch) (side-by-side diff)
tree59399ddb7c89ad178c85e576018db9471d292b52
parent40eac37ff82dd4499a95adb786eb063fd0b81584 (diff)
downloadopie-dd08e7fa2ccbcc0489c17ed305b20a9a7d187161.zip
opie-dd08e7fa2ccbcc0489c17ed305b20a9a7d187161.tar.gz
opie-dd08e7fa2ccbcc0489c17ed305b20a9a7d187161.tar.bz2
add zeckes change in again *DOH*, and initialize some silly int's to get rid of silly compiler warnings
Diffstat (more/less context) (show whitespace changes)
-rw-r--r--noncore/tools/clock/clock.cpp21
-rw-r--r--noncore/tools/clock/clock.h2
2 files changed, 17 insertions, 6 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
@@ -14,13 +14,12 @@
** See http://www.trolltech.com/gpl/ for GPL licensing information.
**
** 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"
#include <qpe/qpeapplication.h>
#include <qpe/qcopenvelope_qws.h>
@@ -29,12 +28,14 @@
#include <qpe/alarmserver.h>
#include <qpe/sound.h>
#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>
#include <qtimer.h>
#include <qpushbutton.h>
@@ -90,13 +91,13 @@ Clock::Clock( QWidget * parent, const char * name, WFlags f )
date = new QLabel( this );
date->setAlignment( AlignHCenter | AlignVCenter );
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();
clockRB = new QRadioButton ( tr( "Clock" ), controls );
@@ -129,12 +130,17 @@ Clock::Clock( QWidget * parent, const char * name, WFlags f )
alarmBtn = new QPushButton ( controls );
// 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() ) );
connect( snoozeBtn, SIGNAL( clicked() ), SLOT( slotSnooze() ) );
connect( alarmOffBtn, SIGNAL( clicked() ), SLOT( slotToggleAlarm() ) );
@@ -307,13 +313,13 @@ 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,
"QPE/Application/clock",
"alarm(QDateTime,int)", warn );
@@ -346,24 +352,24 @@ void Clock::alarmOn()
QDate d = QDate::currentDate();
QTime tm((int)hour,(int)minute,0);
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",
"alarm(QDateTime,int)", warn );
setCaption("Alarm set: "+ whenl.toString());
}
void Clock::alarmOff()
{
- int warn;
+ int warn = 0;
bSound=FALSE;
AlarmServer::deleteAlarm( when,
"QPE/Application/clock",
"alarm(QDateTime,int)", warn );
qDebug("Alarm Off "+ when.toString());
setCaption("Clock");
@@ -476,6 +482,11 @@ QPoint AnalogClock::rotate( QPoint c, QPoint p, int a )
double nx = c.x() - ( p.x() - c.x() ) * cos( angle ) -
( p.y() - c.y() ) * sin( angle );
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");
+}
diff --git a/noncore/tools/clock/clock.h b/noncore/tools/clock/clock.h
index e5ed13c..024dd28 100644
--- a/noncore/tools/clock/clock.h
+++ b/noncore/tools/clock/clock.h
@@ -73,13 +73,13 @@ private slots:
void slotSnooze();
void slotToggleAlarm();
void alarmOn();
void alarmOff();
void appMessage(const QCString& msg, const QByteArray& data);
void timerEvent( QTimerEvent *e );
-// void slotAdjustTime();
+ void slotAdjustTime();
private:
void clearClock();
bool alarmBool;
QTimer *t;