summaryrefslogtreecommitdiff
Side-by-side diff
Diffstat (more/less context) (ignore whitespace changes)
-rw-r--r--noncore/settings/netsystemtime/ntp.cpp10
-rw-r--r--noncore/settings/netsystemtime/settime.cpp6
2 files changed, 10 insertions, 6 deletions
diff --git a/noncore/settings/netsystemtime/ntp.cpp b/noncore/settings/netsystemtime/ntp.cpp
index 2b779fa..15dae93 100644
--- a/noncore/settings/netsystemtime/ntp.cpp
+++ b/noncore/settings/netsystemtime/ntp.cpp
@@ -265,61 +265,65 @@ void Ntp::slotCheckNtp(int i)
connect( ButtonSetTime, SIGNAL(clicked()), SLOT(slotRunNtp()) );
if ( ntpDelayElapsed() )
{
slotRunNtp();
disconnect(ntpTimer, SIGNAL( timeout() ), this, SLOT(slotProbeNtpServer()) );
connect(ntpTimer, SIGNAL( timeout() ), SLOT(slotRunNtp()) );
}else{
disconnect(ntpTimer, SIGNAL( timeout() ), this, SLOT(slotRunNtp()) );
connect(ntpTimer, SIGNAL( timeout() ), SLOT(slotProbeNtpServer()) );
}
}else{
preditctTime();
ButtonSetTime->setText( tr("Set predicted time") );
if (i>0)ntpOutPut(tr("Could not connect to server ")+getNtpServer());
connect( ButtonSetTime, SIGNAL(clicked()), SLOT(setPredictTime()) );
connect( ntpTimer, SIGNAL( timeout() ), SLOT(slotProbeNtpServer()) );
}
}
void Ntp::slotProbeNtpServer()
{
qDebug("Ntp::slotProbeNtpServer()");
ntpSock->connectToHost( getNtpServer() ,123);
}
void Ntp::slotNtpDelayChanged(int delay)
{
ntpTimer->changeInterval( delay*1000*60 );
}
void Ntp::ntpOutPut(QString out)
{
MultiLineEditntpOutPut->append(out);
MultiLineEditntpOutPut->setCursorPosition(MultiLineEditntpOutPut->numLines() + 1,0,FALSE);
}
void Ntp::makeChannel()
{
channel = new QCopChannel( "QPE/Application/netsystemtime", this );
connect( channel, SIGNAL(received(const QCString&, const QByteArray&)),
this, SLOT(receive(const QCString&, const QByteArray&)) );
}
void Ntp::receive(const QCString &msg, const QByteArray &arg)
{
- qDebug("QCop "+msg+" "+QCString(arg));
- if ( msg == "open(QString)" )
+ qDebug("QCop(Ntp) "+msg+" "+QCString(arg));
+ if ( msg == "ntpLookup(QString)" )
{
- // qApp->exec();
+ slotRunNtp();
+ }
+ if ( msg == "setPredictedTime(QString)" )
+ {
+ setPredictTime();
}else{
qDebug("Ntp::receive: Huh what do ya want");
}
}
void Ntp::setDocument(const QString &fileName)
{
} \ No newline at end of file
diff --git a/noncore/settings/netsystemtime/settime.cpp b/noncore/settings/netsystemtime/settime.cpp
index 9c5323a..b0fcb74 100644
--- a/noncore/settings/netsystemtime/settime.cpp
+++ b/noncore/settings/netsystemtime/settime.cpp
@@ -223,99 +223,99 @@ void SetDateTime::writeSettings()
config.writeEntry( "ClockApplet", clockAppletCombo->currentItem() );
Config lconfig("locale");
lconfig.setGroup( "Location" );
lconfig.writeEntry( "Timezone", tz->currentZone() );
}
void SetDateTime::commitTime()
{
Config cfg("ntp",Config::User);
cfg.setGroup("lookups");
cfg.writeEntry("lastNtp",false);
tz->setFocus();
// Need to process the QCOP event generated above before proceeding
qApp->processEvents();
// before we progress further, set our TZ!
setenv( "TZ", tz->currentZone(), 1 );
// now set the time...
QDateTime dt( dateButton->date(), timeButton->time() );
if ( dt.isValid() ) setTime(dt);
}
void SetDateTime::setTime(QDateTime dt)
{
// really turn off the screensaver before doing anything
{
// Needs to be encased in { } so that it deconstructs and sends
QCopEnvelope disableScreenSaver( "QPE/System", "setScreenSaverIntervals(int,int,int)" );
disableScreenSaver << 0 << 0 << 0;
}
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();
// 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;
- // Restore screensaver
- QCopEnvelope enableScreenSaver( "QPE/System", "setScreenSaverIntervals(int,int,int)" );
- enableScreenSaver << -1 << -1 << -1;
+ // Restore screensaver
+ QCopEnvelope enableScreenSaver( "QPE/System", "setScreenSaverIntervals(int,int,int)" );
+ enableScreenSaver << -1 << -1 << -1;
}
void SetDateTime::updateSystem(int i)
{
// really turn off the screensaver before doing anything
{
// Needs to be encased in { } so that it deconstructs and sends
QCopEnvelope disableScreenSaver( "QPE/System", "setScreenSaverIntervals(int,int,int)" );
disableScreenSaver << 0 << 0 << 0;
}
qDebug("SetDateTime::updateSystem(int %i)",i);
writeSettings();
// 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();
// 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;
// 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;
}
void SetDateTime::tzChange( const QString &tz )
{
// 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.