summaryrefslogtreecommitdiff
path: root/noncore/settings/netsystemtime/settime.cpp
Unidiff
Diffstat (limited to 'noncore/settings/netsystemtime/settime.cpp') (more/less context) (ignore whitespace changes)
-rw-r--r--noncore/settings/netsystemtime/settime.cpp3
1 files changed, 3 insertions, 0 deletions
diff --git a/noncore/settings/netsystemtime/settime.cpp b/noncore/settings/netsystemtime/settime.cpp
index e7e604f..9c5323a 100644
--- a/noncore/settings/netsystemtime/settime.cpp
+++ b/noncore/settings/netsystemtime/settime.cpp
@@ -185,96 +185,99 @@ SetDateTime::SetDateTime(QWidget *parent, const char *name, WFlags f )
185 185
186 vb->addStretch( 0 ); 186 vb->addStretch( 0 );
187 187
188 QObject::connect( PushButtonSetManualTime, SIGNAL(clicked()), 188 QObject::connect( PushButtonSetManualTime, SIGNAL(clicked()),
189 this, SLOT(commitTime())); 189 this, SLOT(commitTime()));
190 190
191 QObject::connect( tz, SIGNAL( signalNewTz( const QString& ) ), 191 QObject::connect( tz, SIGNAL( signalNewTz( const QString& ) ),
192 timeButton, SLOT( slotTzChange( const QString& ) ) ); 192 timeButton, SLOT( slotTzChange( const QString& ) ) );
193 QObject::connect( tz, SIGNAL( signalNewTz( const QString& ) ), 193 QObject::connect( tz, SIGNAL( signalNewTz( const QString& ) ),
194 SLOT( tzChange( const QString& ) ) ); 194 SLOT( tzChange( const QString& ) ) );
195 195
196 QObject::connect( weekStartCombo, SIGNAL( activated ( int )), 196 QObject::connect( weekStartCombo, SIGNAL( activated ( int )),
197 SLOT(updateSystem(int ) )); 197 SLOT(updateSystem(int ) ));
198 QObject::connect( ampmCombo, SIGNAL( activated ( int )), 198 QObject::connect( ampmCombo, SIGNAL( activated ( int )),
199 SLOT(updateSystem(int ) )); 199 SLOT(updateSystem(int ) ));
200 QObject::connect( dateFormatCombo, SIGNAL( activated ( int )), 200 QObject::connect( dateFormatCombo, SIGNAL( activated ( int )),
201 SLOT(updateSystem(int ) )); 201 SLOT(updateSystem(int ) ));
202 QObject::connect( clockAppletCombo, SIGNAL( activated ( int )), 202 QObject::connect( clockAppletCombo, SIGNAL( activated ( int )),
203 SLOT(updateSystem(int ) )); 203 SLOT(updateSystem(int ) ));
204} 204}
205 205
206SetDateTime::~SetDateTime() 206SetDateTime::~SetDateTime()
207{ 207{
208 writeSettings(); 208 writeSettings();
209 209
210} 210}
211 211
212void SetDateTime::writeSettings() 212void SetDateTime::writeSettings()
213{ 213{
214 Config config("qpe"); 214 Config config("qpe");
215 config.setGroup( "Time" ); 215 config.setGroup( "Time" );
216 config.writeEntry( "AMPM", ampmCombo->currentItem() ); 216 config.writeEntry( "AMPM", ampmCombo->currentItem() );
217 config.writeEntry( "MONDAY", weekStartCombo->currentItem() ); 217 config.writeEntry( "MONDAY", weekStartCombo->currentItem() );
218 config.setGroup( "Date" ); 218 config.setGroup( "Date" );
219 DateFormat df = date_formats[dateFormatCombo->currentItem()]; 219 DateFormat df = date_formats[dateFormatCombo->currentItem()];
220 config.writeEntry( "Separator", QString(df.separator())); 220 config.writeEntry( "Separator", QString(df.separator()));
221 config.writeEntry( "ShortOrder", df.shortOrder()); 221 config.writeEntry( "ShortOrder", df.shortOrder());
222 config.writeEntry( "LongOrder", df.longOrder()); 222 config.writeEntry( "LongOrder", df.longOrder());
223 config.writeEntry( "ClockApplet", clockAppletCombo->currentItem() ); 223 config.writeEntry( "ClockApplet", clockAppletCombo->currentItem() );
224 224
225 Config lconfig("locale"); 225 Config lconfig("locale");
226 lconfig.setGroup( "Location" ); 226 lconfig.setGroup( "Location" );
227 lconfig.writeEntry( "Timezone", tz->currentZone() ); 227 lconfig.writeEntry( "Timezone", tz->currentZone() );
228 228
229} 229}
230 230
231void SetDateTime::commitTime() 231void SetDateTime::commitTime()
232{ 232{
233 Config cfg("ntp",Config::User);
234 cfg.setGroup("lookups");
235 cfg.writeEntry("lastNtp",false);
233 tz->setFocus(); 236 tz->setFocus();
234 // Need to process the QCOP event generated above before proceeding 237 // Need to process the QCOP event generated above before proceeding
235 qApp->processEvents(); 238 qApp->processEvents();
236 239
237 // before we progress further, set our TZ! 240 // before we progress further, set our TZ!
238 setenv( "TZ", tz->currentZone(), 1 ); 241 setenv( "TZ", tz->currentZone(), 1 );
239 // now set the time... 242 // now set the time...
240 QDateTime dt( dateButton->date(), timeButton->time() ); 243 QDateTime dt( dateButton->date(), timeButton->time() );
241 244
242 if ( dt.isValid() ) setTime(dt); 245 if ( dt.isValid() ) setTime(dt);
243} 246}
244 247
245void SetDateTime::setTime(QDateTime dt) 248void SetDateTime::setTime(QDateTime dt)
246{ 249{
247 // really turn off the screensaver before doing anything 250 // really turn off the screensaver before doing anything
248 { 251 {
249 // Needs to be encased in { } so that it deconstructs and sends 252 // Needs to be encased in { } so that it deconstructs and sends
250 QCopEnvelope disableScreenSaver( "QPE/System", "setScreenSaverIntervals(int,int,int)" ); 253 QCopEnvelope disableScreenSaver( "QPE/System", "setScreenSaverIntervals(int,int,int)" );
251 disableScreenSaver << 0 << 0 << 0; 254 disableScreenSaver << 0 << 0 << 0;
252 } 255 }
253 Config cfg("ntp",Config::User); 256 Config cfg("ntp",Config::User);
254 cfg.setGroup("correction"); 257 cfg.setGroup("correction");
255 int t = TimeConversion::toUTC(dt); 258 int t = TimeConversion::toUTC(dt);
256 struct timeval myTv; 259 struct timeval myTv;
257 myTv.tv_sec = t; 260 myTv.tv_sec = t;
258 cfg.writeEntry("time", t ); 261 cfg.writeEntry("time", t );
259 myTv.tv_usec = 0; 262 myTv.tv_usec = 0;
260 263
261 if ( myTv.tv_sec != -1 ) 264 if ( myTv.tv_sec != -1 )
262 ::settimeofday( &myTv, 0 ); 265 ::settimeofday( &myTv, 0 );
263 Global::writeHWClock(); 266 Global::writeHWClock();
264 // since time has changed quickly load in the datebookdb 267 // since time has changed quickly load in the datebookdb
265 // to allow the alarm server to get a better grip on itself 268 // to allow the alarm server to get a better grip on itself
266 // (example re-trigger alarms for when we travel back in time) 269 // (example re-trigger alarms for when we travel back in time)
267 DateBookDB db; 270 DateBookDB db;
268 // Restore screensaver 271 // Restore screensaver
269 QCopEnvelope enableScreenSaver( "QPE/System", "setScreenSaverIntervals(int,int,int)" ); 272 QCopEnvelope enableScreenSaver( "QPE/System", "setScreenSaverIntervals(int,int,int)" );
270 enableScreenSaver << -1 << -1 << -1; 273 enableScreenSaver << -1 << -1 << -1;
271} 274}
272 275
273void SetDateTime::updateSystem(int i) 276void SetDateTime::updateSystem(int i)
274{ 277{
275 // really turn off the screensaver before doing anything 278 // really turn off the screensaver before doing anything
276 { 279 {
277 // Needs to be encased in { } so that it deconstructs and sends 280 // Needs to be encased in { } so that it deconstructs and sends
278 QCopEnvelope disableScreenSaver( "QPE/System", "setScreenSaverIntervals(int,int,int)" ); 281 QCopEnvelope disableScreenSaver( "QPE/System", "setScreenSaverIntervals(int,int,int)" );
279 disableScreenSaver << 0 << 0 << 0; 282 disableScreenSaver << 0 << 0 << 0;
280 } 283 }