author | tille <tille> | 2002-10-19 15:33:05 (UTC) |
---|---|---|
committer | tille <tille> | 2002-10-19 15:33:05 (UTC) |
commit | 7a1c7fca5105427ff569f8219fb96873571a749a (patch) (unidiff) | |
tree | 4c5620553e8647c72fb9a9f42eb069600f62e3ea | |
parent | 04d045931cb66c8ff13b1247e6a366ff77c36474 (diff) | |
download | opie-7a1c7fca5105427ff569f8219fb96873571a749a.zip opie-7a1c7fca5105427ff569f8219fb96873571a749a.tar.gz opie-7a1c7fca5105427ff569f8219fb96873571a749a.tar.bz2 |
typo
-rw-r--r-- | noncore/settings/netsystemtime/ntp.cpp | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/noncore/settings/netsystemtime/ntp.cpp b/noncore/settings/netsystemtime/ntp.cpp index 9572993..fbd65a2 100644 --- a/noncore/settings/netsystemtime/ntp.cpp +++ b/noncore/settings/netsystemtime/ntp.cpp | |||
@@ -61,97 +61,97 @@ Ntp::Ntp( QWidget* parent, const char* name, WFlags fl ) | |||
61 | connect ( ntpProcess, SIGNAL(processExited(OProcess*)), | 61 | connect ( ntpProcess, SIGNAL(processExited(OProcess*)), |
62 | this, SLOT(ntpFinished(OProcess*))); | 62 | this, SLOT(ntpFinished(OProcess*))); |
63 | connect(runNtp, SIGNAL(clicked()), this, SLOT(slotRunNtp())); | 63 | connect(runNtp, SIGNAL(clicked()), this, SLOT(slotRunNtp())); |
64 | connect(PushButtonPredict, SIGNAL(clicked()), this, SLOT(preditctTime())); | 64 | connect(PushButtonPredict, SIGNAL(clicked()), this, SLOT(preditctTime())); |
65 | connect(PushButtonSetPredTime, SIGNAL(clicked()), this, SLOT(setPredictTime())); | 65 | connect(PushButtonSetPredTime, SIGNAL(clicked()), this, SLOT(setPredictTime())); |
66 | slotCheckNtp(-1); | 66 | slotCheckNtp(-1); |
67 | readLookups(); | 67 | readLookups(); |
68 | } | 68 | } |
69 | 69 | ||
70 | Ntp::~Ntp() | 70 | Ntp::~Ntp() |
71 | { | 71 | { |
72 | delete ntpProcess; | 72 | delete ntpProcess; |
73 | Config ntpSrvs("/etc/ntpservers",Config::File); | 73 | Config ntpSrvs("/etc/ntpservers",Config::File); |
74 | ntpSrvs.setGroup("servers"); | 74 | ntpSrvs.setGroup("servers"); |
75 | int srvCount = ComboNtpSrv->count(); | 75 | int srvCount = ComboNtpSrv->count(); |
76 | ntpSrvs.writeEntry("count", srvCount); | 76 | ntpSrvs.writeEntry("count", srvCount); |
77 | for (int i = 0; i < srvCount; i++) | 77 | for (int i = 0; i < srvCount; i++) |
78 | { | 78 | { |
79 | ntpSrvs.setGroup(QString::number(i)); | 79 | ntpSrvs.setGroup(QString::number(i)); |
80 | ntpSrvs.writeEntry( "name", ComboNtpSrv->text(i) ); | 80 | ntpSrvs.writeEntry( "name", ComboNtpSrv->text(i) ); |
81 | } | 81 | } |
82 | Config cfg("ntp",Config::User); | 82 | Config cfg("ntp",Config::User); |
83 | cfg.setGroup("settings"); | 83 | cfg.setGroup("settings"); |
84 | cfg.writeEntry("ntpServer", ComboNtpSrv->currentItem()); | 84 | cfg.writeEntry("ntpServer", ComboNtpSrv->currentItem()); |
85 | cfg.writeEntry( "minLookupDiff", SpinBoxMinLookupDelay->value() ); | 85 | cfg.writeEntry( "minLookupDiff", SpinBoxMinLookupDelay->value() ); |
86 | cfg.writeEntry( "ntpRefreshFreq", SpinBoxNtpDelay->value() ); | 86 | cfg.writeEntry( "ntpRefreshFreq", SpinBoxNtpDelay->value() ); |
87 | } | 87 | } |
88 | 88 | ||
89 | bool Ntp::ntpDelayElapsed() | 89 | bool Ntp::ntpDelayElapsed() |
90 | { | 90 | { |
91 | Config cfg("ntp",Config::User); | 91 | Config cfg("ntp",Config::User); |
92 | cfg.setGroup("lookups"); | 92 | cfg.setGroup("lookups"); |
93 | _lookupDiff = TimeConversion::toUTC(QDateTime::currentDateTime()) - cfg.readNumEntry("time",0); | 93 | _lookupDiff = TimeConversion::toUTC(QDateTime::currentDateTime()) - cfg.readNumEntry("time",0); |
94 | return (_lookupDiff - (SpinBoxNtpDelay->value()*60)) > -60; | 94 | return (_lookupDiff - (SpinBoxNtpDelay->value()*60)) > -60; |
95 | } | 95 | } |
96 | 96 | ||
97 | QString Ntp::getNtpServer() | 97 | QString Ntp::getNtpServer() |
98 | { | 98 | { |
99 | return ComboNtpSrv->currentText(); | 99 | return ComboNtpSrv->currentText(); |
100 | } | 100 | } |
101 | 101 | ||
102 | void Ntp::slotRunNtp() | 102 | void Ntp::slotRunNtp() |
103 | { | 103 | { |
104 | if ( !ntpDelayElapsed() ) | 104 | if ( !ntpDelayElapsed() ) |
105 | { | 105 | { |
106 | switch ( | 106 | switch ( |
107 | QMessageBox::warning(this, tr("Run NTP?"), | 107 | QMessageBox::warning(this, tr("Run NTP?"), |
108 | tr("You asked for a delay of ")+SpinBoxNtpDelay->text()+tr(" minutes, but only ")+ | 108 | tr("You asked for a delay of ")+SpinBoxNtpDelay->text()+tr(" minutes, but only ")+ |
109 | QString::number(_lookupDiff/60)+tr(" minutes elapsed since last loopup.")+ | 109 | QString::number(_lookupDiff/60)+tr(" minutes elapsed since last lookup.")+ |
110 | "<br>"+tr("Rerun NTP?"), | 110 | "<br>"+tr("Rerun NTP?"), |
111 | QMessageBox::Ok,QMessageBox::Cancel) | 111 | QMessageBox::Ok,QMessageBox::Cancel) |
112 | ) { | 112 | ) { |
113 | case QMessageBox::Ok: break; | 113 | case QMessageBox::Ok: break; |
114 | case QMessageBox::Cancel: return; | 114 | case QMessageBox::Cancel: return; |
115 | default: return; | 115 | default: return; |
116 | } | 116 | } |
117 | } | 117 | } |
118 | TextLabelStartTime->setText(QDateTime::currentDateTime().toString()); | 118 | TextLabelStartTime->setText(QDateTime::currentDateTime().toString()); |
119 | ntpOutPut( tr("Running:")+"\nntpdate "+getNtpServer() ); | 119 | ntpOutPut( tr("Running:")+"\nntpdate "+getNtpServer() ); |
120 | 120 | ||
121 | ntpProcess->clearArguments(); | 121 | ntpProcess->clearArguments(); |
122 | *ntpProcess << "ntpdate" << getNtpServer(); | 122 | *ntpProcess << "ntpdate" << getNtpServer(); |
123 | bool ret = ntpProcess->start(OProcess::NotifyOnExit,OProcess::AllOutput); | 123 | bool ret = ntpProcess->start(OProcess::NotifyOnExit,OProcess::AllOutput); |
124 | if ( !ret ) { | 124 | if ( !ret ) { |
125 | qDebug("Error while executing ntpdate"); | 125 | qDebug("Error while executing ntpdate"); |
126 | ntpOutPut( tr("Error while executing ntpdate")); | 126 | ntpOutPut( tr("Error while executing ntpdate")); |
127 | } | 127 | } |
128 | } | 128 | } |
129 | 129 | ||
130 | void Ntp::getNtpOutput(OProcess *proc, char *buffer, int buflen) | 130 | void Ntp::getNtpOutput(OProcess *proc, char *buffer, int buflen) |
131 | { | 131 | { |
132 | QString lineStr, lineStrOld; | 132 | QString lineStr, lineStrOld; |
133 | lineStr = buffer; | 133 | lineStr = buffer; |
134 | lineStr=lineStr.left(buflen); | 134 | lineStr=lineStr.left(buflen); |
135 | if (lineStr!=lineStrOld) | 135 | if (lineStr!=lineStrOld) |
136 | { | 136 | { |
137 | ntpOutPut(lineStr); | 137 | ntpOutPut(lineStr); |
138 | _ntpOutput += lineStr; | 138 | _ntpOutput += lineStr; |
139 | } | 139 | } |
140 | lineStrOld = lineStr; | 140 | lineStrOld = lineStr; |
141 | } | 141 | } |
142 | 142 | ||
143 | void Ntp::ntpFinished(OProcess *p) | 143 | void Ntp::ntpFinished(OProcess *p) |
144 | { | 144 | { |
145 | qDebug("p->exitStatus() %i",p->exitStatus()); | 145 | qDebug("p->exitStatus() %i",p->exitStatus()); |
146 | if (p->exitStatus()!=0 || !p->normalExit()) | 146 | if (p->exitStatus()!=0 || !p->normalExit()) |
147 | { | 147 | { |
148 | slotProbeNtpServer(); | 148 | slotProbeNtpServer(); |
149 | return; | 149 | return; |
150 | } | 150 | } |
151 | 151 | ||
152 | Global::writeHWClock(); | 152 | Global::writeHWClock(); |
153 | // since time has changed quickly load in the datebookdb | 153 | // since time has changed quickly load in the datebookdb |
154 | // to allow the alarm server to get a better grip on itself | 154 | // to allow the alarm server to get a better grip on itself |
155 | // (example re-trigger alarms for when we travel back in time) | 155 | // (example re-trigger alarms for when we travel back in time) |
156 | DateBookDB db; | 156 | DateBookDB db; |
157 | 157 | ||