author | tille <tille> | 2002-11-17 16:41:01 (UTC) |
---|---|---|
committer | tille <tille> | 2002-11-17 16:41:01 (UTC) |
commit | bf2e3a43fb586274fd5aa67941a9a8671180628d (patch) (unidiff) | |
tree | 7d2dae34898825dbe24fad74eec8de0e85f51bc2 /noncore/settings | |
parent | 290ed6c181bdb212fe5ba004c3c5eeaff0170951 (diff) | |
download | opie-bf2e3a43fb586274fd5aa67941a9a8671180628d.zip opie-bf2e3a43fb586274fd5aa67941a9a8671180628d.tar.gz opie-bf2e3a43fb586274fd5aa67941a9a8671180628d.tar.bz2 |
saving bug fix
-rw-r--r-- | noncore/settings/netsystemtime/ntp.cpp | 14 |
1 files changed, 9 insertions, 5 deletions
diff --git a/noncore/settings/netsystemtime/ntp.cpp b/noncore/settings/netsystemtime/ntp.cpp index 551cedc..06d944d 100644 --- a/noncore/settings/netsystemtime/ntp.cpp +++ b/noncore/settings/netsystemtime/ntp.cpp | |||
@@ -91,41 +91,45 @@ Ntp::Ntp( QWidget* parent, const char* name, WFlags fl ) | |||
91 | slotCheckNtp(-1); | 91 | slotCheckNtp(-1); |
92 | readLookups(); | 92 | readLookups(); |
93 | } | 93 | } |
94 | 94 | ||
95 | Ntp::~Ntp() | 95 | Ntp::~Ntp() |
96 | { | 96 | { |
97 | delete ntpProcess; | 97 | delete ntpProcess; |
98 | } | 98 | } |
99 | 99 | ||
100 | void Ntp::saveConfig(){ | 100 | void Ntp::saveConfig(){ |
101 | int srvCount = ComboNtpSrv->count(); | 101 | int srvCount = ComboNtpSrv->count(); |
102 | bool serversChanged = true; | 102 | bool serversChanged = true; |
103 | int curSrv = ComboNtpSrv->currentItem(); | ||
103 | QString edit = ComboNtpSrv->currentText(); | 104 | QString edit = ComboNtpSrv->currentText(); |
104 | for (int i = 0; i < srvCount; i++){ | 105 | for (int i = 0; i < srvCount; i++){ |
105 | if ( edit == ComboNtpSrv->text(i)) serversChanged = false; | 106 | if ( edit == ComboNtpSrv->text(i)) serversChanged = false; |
106 | } | 107 | } |
107 | if (serversChanged){ | 108 | if (serversChanged){ |
108 | Config ntpSrvs("/etc/ntpservers",Config::File); | 109 | Config ntpSrvs(QPEApplication::qpeDir()+"etc/ntpservers",Config::File); |
109 | ntpSrvs.setGroup("servers"); | 110 | ntpSrvs.setGroup("servers"); |
110 | ntpSrvs.writeEntry("count", srvCount); | 111 | ntpSrvs.writeEntry("count", ++srvCount); |
111 | for (int i = 0; i < srvCount; i++){ | 112 | ntpSrvs.setGroup("0"); |
113 | ntpSrvs.writeEntry( "name", edit ); | ||
114 | curSrv = 0; | ||
115 | for (int i = 1; i < srvCount; i++){ | ||
112 | qDebug("ntpSrvs[%i/%i]=%s",i,srvCount,ComboNtpSrv->text(i).latin1()); | 116 | qDebug("ntpSrvs[%i/%i]=%s",i,srvCount,ComboNtpSrv->text(i).latin1()); |
113 | ntpSrvs.setGroup(QString::number(i)); | 117 | ntpSrvs.setGroup(QString::number(i)); |
114 | ntpSrvs.writeEntry( "name", ComboNtpSrv->text(i) ); | 118 | ntpSrvs.writeEntry( "name", ComboNtpSrv->text(i-1) ); |
115 | } | 119 | } |
116 | } | 120 | } |
117 | Config cfg("ntp",Config::User); | 121 | Config cfg("ntp",Config::User); |
118 | cfg.setGroup("settings"); | 122 | cfg.setGroup("settings"); |
119 | cfg.writeEntry("ntpServer", ComboNtpSrv->currentItem()); | 123 | cfg.writeEntry("ntpServer", curSrv ); |
120 | cfg.writeEntry( "minLookupDiff", SpinBoxMinLookupDelay->value() ); | 124 | cfg.writeEntry( "minLookupDiff", SpinBoxMinLookupDelay->value() ); |
121 | cfg.writeEntry( "ntpRefreshFreq", SpinBoxNtpDelay->value() ); | 125 | cfg.writeEntry( "ntpRefreshFreq", SpinBoxNtpDelay->value() ); |
122 | cfg.writeEntry( "advancedFeatures", CheckBoxAdvSettings->isChecked() ); | 126 | cfg.writeEntry( "advancedFeatures", CheckBoxAdvSettings->isChecked() ); |
123 | } | 127 | } |
124 | 128 | ||
125 | bool Ntp::ntpDelayElapsed() | 129 | bool Ntp::ntpDelayElapsed() |
126 | { | 130 | { |
127 | Config cfg("ntp",Config::User); | 131 | Config cfg("ntp",Config::User); |
128 | cfg.setGroup("lookups"); | 132 | cfg.setGroup("lookups"); |
129 | _lookupDiff = TimeConversion::toUTC(QDateTime::currentDateTime()) - cfg.readNumEntry("time",0); | 133 | _lookupDiff = TimeConversion::toUTC(QDateTime::currentDateTime()) - cfg.readNumEntry("time",0); |
130 | if (_lookupDiff < 0) return true; | 134 | if (_lookupDiff < 0) return true; |
131 | int i =_lookupDiff - (SpinBoxNtpDelay->value()*60); | 135 | int i =_lookupDiff - (SpinBoxNtpDelay->value()*60); |