summaryrefslogtreecommitdiff
path: root/noncore
Side-by-side diff
Diffstat (limited to 'noncore') (more/less context) (ignore whitespace changes)
-rw-r--r--noncore/settings/netsystemtime/ntp.cpp2
-rw-r--r--noncore/settings/netsystemtime/opie-netsystemtime.control3
-rw-r--r--noncore/settings/netsystemtime/settime.cpp25
-rw-r--r--noncore/settings/netsystemtime/settime.h2
4 files changed, 29 insertions, 3 deletions
diff --git a/noncore/settings/netsystemtime/ntp.cpp b/noncore/settings/netsystemtime/ntp.cpp
index 4a7959e..b2f192a 100644
--- a/noncore/settings/netsystemtime/ntp.cpp
+++ b/noncore/settings/netsystemtime/ntp.cpp
@@ -33,25 +33,25 @@ Ntp::Ntp( QWidget* parent, const char* name, WFlags fl )
QSocket *ntpSock = new QSocket( this );
ntpSock->connectToHost( LineEditNtpSrv->text() ,123);
connect( ntpSock, SIGNAL( error(int) ),
SLOT(slotCheckNtp(int)) );
connect ( ntpProcess, SIGNAL(receivedStdout(OProcess*,char*,int)),
this, SLOT(getNtpOutput(OProcess*,char*,int)));
connect ( ntpProcess, SIGNAL(processExited(OProcess*)),
this, SLOT(ntpFinished(OProcess*)));
connect(runNtp, SIGNAL(clicked()), this, SLOT(slotRunNtp()));
connect(PushButtonPredict, SIGNAL(clicked()), this, SLOT(preditctTime()));
-
+ slotCheckNtp(-1);
// slotRunNtp();
readLookups();
}
Ntp::~Ntp()
{
Config cfg("ntp",Config::User);
cfg.setGroup("settings");
cfg.writeEntry("ntpServer", LineEditNtpSrv->text());
cfg.writeEntry( "minLookupDiff", SpinBoxMinDelay->value() );
}
diff --git a/noncore/settings/netsystemtime/opie-netsystemtime.control b/noncore/settings/netsystemtime/opie-netsystemtime.control
index a5809b0..406d7b0 100644
--- a/noncore/settings/netsystemtime/opie-netsystemtime.control
+++ b/noncore/settings/netsystemtime/opie-netsystemtime.control
@@ -1,10 +1,11 @@
Files: bin/netsystemtime apps/Settings/ntpdatetime.desktop
Priority: optional
Section: opie/settings
Depends: ntpdate
+Conflicts: opie-systemtime
Maintainer: Patrick S. Vogt <tille@handhelds.org>
Architecture: arm
Version: $QPE_VERSION-$SUB_VERSION
Depends: opie-base ($QPE_VERSION), ntpdate
Description: ntp ( Network Time Protocol) gui
-This utility syncs system time with a atomic timerserver via internet \ No newline at end of file
+This utility syncs system time with a atomic timerserver via internet
diff --git a/noncore/settings/netsystemtime/settime.cpp b/noncore/settings/netsystemtime/settime.cpp
index 2cef6e8..b456012 100644
--- a/noncore/settings/netsystemtime/settime.cpp
+++ b/noncore/settings/netsystemtime/settime.cpp
@@ -183,29 +183,43 @@ SetDateTime::SetDateTime(QWidget *parent, const char *name, WFlags f )
int clockApplet = config.readNumEntry("ClockApplet",0);
clockAppletCombo->setCurrentItem( clockApplet );
vb->addStretch( 0 );
QObject::connect( PushButtonSetManualTime, SIGNAL(clicked()),
this, SLOT(commitTime()));
QObject::connect( tz, SIGNAL( signalNewTz( const QString& ) ),
timeButton, SLOT( slotTzChange( const QString& ) ) );
QObject::connect( tz, SIGNAL( signalNewTz( const QString& ) ),
SLOT( tzChange( const QString& ) ) );
+
+ QObject::connect( weekStartCombo, SIGNAL( activated ( int )),
+ SLOT(updateSystem(int ) ));
+ QObject::connect( ampmCombo, SIGNAL( activated ( int )),
+ SLOT(updateSystem(int ) ));
+ QObject::connect( dateFormatCombo, SIGNAL( activated ( int )),
+ SLOT(updateSystem(int ) ));
+ QObject::connect( clockAppletCombo, SIGNAL( activated ( int )),
+ SLOT(updateSystem(int ) ));
}
SetDateTime::~SetDateTime()
{
+ writeSettings();
+
+}
+void SetDateTime::writeSettings()
+{
Config config("qpe");
config.setGroup( "Time" );
config.writeEntry( "AMPM", ampmCombo->currentItem() );
config.writeEntry( "MONDAY", weekStartCombo->currentItem() );
config.setGroup( "Date" );
DateFormat df = date_formats[dateFormatCombo->currentItem()];
config.writeEntry( "Separator", QString(df.separator()));
config.writeEntry( "ShortOrder", df.shortOrder());
config.writeEntry( "LongOrder", df.longOrder());
config.writeEntry( "ClockApplet", clockAppletCombo->currentItem() );
Config lconfig("locale");
@@ -238,28 +252,34 @@ void SetDateTime::setTime(QDateTime dt)
{
Config cfg("ntp",Config::User);
cfg.setGroup("correction");
int t = TimeConversion::toUTC(dt);
struct timeval myTv;
myTv.tv_sec = t;
cfg.writeEntry("time", t );
myTv.tv_usec = 0;
if ( myTv.tv_sec != -1 )
::settimeofday( &myTv, 0 );
Global::writeHWClock();
+}
+
+void SetDateTime::updateSystem(int i)
+{
+ qDebug("SetDateTime::updateSystem(int %i)",i);
+ writeSettings();
// since time has changed quickly load in the datebookdb
// to allow the alarm server to get a better grip on itself
// (example re-trigger alarms for when we travel back in time)
- DateBookDB db;
+ // DateBookDB db;
// set the timezone for everyone else...
QCopEnvelope setTimeZone( "QPE/System", "timeChange(QString)" );
setTimeZone << tz->currentZone();
// AM/PM setting and notify time changed
QCopEnvelope setClock( "QPE/System", "clockChange(bool)" );
setClock << ampmCombo->currentItem();
// Notify everyone what day we prefer to start the week on.
QCopEnvelope setWeek( "QPE/System", "weekChange(bool)" );
setWeek << weekStartCombo->currentItem();
@@ -267,35 +287,37 @@ void SetDateTime::setTime(QDateTime dt)
// Notify everyone what date format to use
QCopEnvelope setDateFormat( "QPE/System", "setDateFormat(DateFormat)" );
setDateFormat << date_formats[dateFormatCombo->currentItem()];
// Restore screensaver
QCopEnvelope enableScreenSaver( "QPE/System", "setScreenSaverIntervals(int,int,int)" );
enableScreenSaver << -1 << -1 << -1;
}
void SetDateTime::tzChange( const QString &tz )
{
+ qDebug("SetDateTime::tzChange");
// set the TZ get the time and leave gracefully...
QString strSave;
strSave = getenv( "TZ" );
setenv( "TZ", tz, 1 );
QDate d = QDate::currentDate();
// reset the time.
if ( !strSave.isNull() ) {
setenv( "TZ", strSave, 1 );
}
dateButton->setDate( d );
+ updateSystem();
}
void SetDateTime::formatChanged(int i)
{
dateButton->setDateFormat(date_formats[i]);
}
static const int ValueAM = 0;
static const int ValuePM = 1;
@@ -421,24 +443,25 @@ void SetTime::checkedPM( int c )
int show_hour = sbHour->value();
if (show_hour == 12)
show_hour = 0;
if ( c == ValuePM )
show_hour += 12;
hour = show_hour;
}
void SetTime::slotTzChange( const QString &tz )
{
+ qDebug("SetTime::slotTzChange");
// set the TZ get the time and leave gracefully...
QString strSave;
strSave = getenv( "TZ" );
setenv( "TZ", tz, 1 );
QTime t = QTime::currentTime();
// reset the time.
if ( !strSave.isNull() ) {
setenv( "TZ", strSave, 1 );
}
// just set the spinboxes and let it propage through
diff --git a/noncore/settings/netsystemtime/settime.h b/noncore/settings/netsystemtime/settime.h
index 60423e7..778cb9c 100644
--- a/noncore/settings/netsystemtime/settime.h
+++ b/noncore/settings/netsystemtime/settime.h
@@ -65,27 +65,29 @@ class DateButton;
class SetDateTime : public NtpBase
{
Q_OBJECT
public:
SetDateTime( QWidget *parent=0, const char *name=0, WFlags f=0 );
~SetDateTime();
protected slots:
void commitTime();
void tzChange( const QString &tz );
void formatChanged(int);
+ void updateSystem(int i=0);
protected:
void setTime(QDateTime dt);
+ void writeSettings();
SetTime *timeButton;
DateButton *dateButton;
TimeZoneSelector *tz;
QComboBox *weekStartCombo;
QComboBox *ampmCombo;
QComboBox *dateFormatCombo;
QComboBox *clockAppletCombo;
QPushButton *ButtonSetTime;
QLabel *TextLabelMainPredTime;
DateFormat date_formats[4];