author | cniehaus <cniehaus> | 2002-09-16 10:45:04 (UTC) |
---|---|---|
committer | cniehaus <cniehaus> | 2002-09-16 10:45:04 (UTC) |
commit | d5d64f7617836096a4e9de81997ada7b6f220b47 (patch) (unidiff) | |
tree | b0ad367ecd4327d8a95b22e725ec4e5b14efa230 /noncore/apps/oxygen/kmolcalc.cpp | |
parent | 1286c243028874523eb2805a0d07ae478537a20c (diff) | |
download | opie-d5d64f7617836096a4e9de81997ada7b6f220b47.zip opie-d5d64f7617836096a4e9de81997ada7b6f220b47.tar.gz opie-d5d64f7617836096a4e9de81997ada7b6f220b47.tar.bz2 |
yes, there is still a lot missing and it won't work for anyone due to
a hardcoded path but at least in theorie (if you copy kmolweights to
the correct position) it will work now. more to come this evening or so.
Diffstat (limited to 'noncore/apps/oxygen/kmolcalc.cpp') (more/less context) (ignore whitespace changes)
-rw-r--r-- | noncore/apps/oxygen/kmolcalc.cpp | 40 |
1 files changed, 2 insertions, 38 deletions
diff --git a/noncore/apps/oxygen/kmolcalc.cpp b/noncore/apps/oxygen/kmolcalc.cpp index 7257c4a..0ba52da 100644 --- a/noncore/apps/oxygen/kmolcalc.cpp +++ b/noncore/apps/oxygen/kmolcalc.cpp | |||
@@ -2,5 +2,5 @@ | |||
2 | * kmolcalc.cpp | 2 | * kmolcalc.cpp |
3 | * | 3 | * |
4 | * Copyright (C) 2000 Tomislav Gountchev <tomi@idiom.com> | 4 | * Copyright (C) 2000,2001 Tomislav Gountchev <tomi@idiom.com> |
5 | * Copyright (C) 2002 Carsten Niehaus <cniehaus@handhelds.org> | 5 | * Copyright (C) 2002 Carsten Niehaus <cniehaus@handhelds.org> |
6 | */ | 6 | */ |
@@ -37,26 +37,7 @@ void KMolCalc::readElstable() { | |||
37 | elstable = new QDict<SubUnit> (197, TRUE); | 37 | elstable = new QDict<SubUnit> (197, TRUE); |
38 | elstable->setAutoDelete(TRUE); | 38 | elstable->setAutoDelete(TRUE); |
39 | QStringList files = "/home/opie/opie/noncore/apps/oxigen/kmolweights"; | 39 | mwfile = "/home/opie/opie/noncore/apps/oxygen/kmolweights"; |
40 | mwfile = "/home/opie/opie/noncore/apps/oxigen/kmolweights"; | ||
41 | QFile f(mwfile); | 40 | QFile f(mwfile); |
42 | QString* latest_f = &mwfile; | ||
43 | for (uint i=0; i<files.count(); i++) { | ||
44 | if (QFileInfo(QFile(files[i])).lastModified() > QFileInfo(QFile(*latest_f)).lastModified()) { | ||
45 | latest_f = &files[i]; | ||
46 | } | ||
47 | } | ||
48 | QFile lf(*latest_f); | ||
49 | if (f.exists()) readMwfile(f); | 41 | if (f.exists()) readMwfile(f); |
50 | if (!f.exists()) { | ||
51 | readMwfile(lf); | ||
52 | writeElstable(); | ||
53 | } else if (QFileInfo(f).lastModified() < QFileInfo(lf).lastModified()) { | ||
54 | // announce | ||
55 | QMessageBox::information | ||
56 | (0, "Warning:", "Found new global Mw file.\nLocal definitions will be updated.", QMessageBox::Ok); | ||
57 | readMwfile(lf); | ||
58 | writeElstable(); | ||
59 | } | ||
60 | |||
61 | } | 42 | } |
62 | 43 | ||
@@ -189,21 +170,4 @@ void KMolCalc::readMwfile(QFile& f) { | |||
189 | 170 | ||
190 | /** | 171 | /** |
191 | * Save the element definitions file. | ||
192 | */ | ||
193 | void KMolCalc::writeElstable() { | ||
194 | QFile f(mwfile); | ||
195 | if (! f.open(IO_WriteOnly)) return; //ERROR | ||
196 | QTextStream fs (&f); | ||
197 | QString line; | ||
198 | QDictIterator<SubUnit> it(*elstable); | ||
199 | while (it.current()) { | ||
200 | it.current()->writeOut(line); | ||
201 | fs << line << endl; | ||
202 | ++it; | ||
203 | } | ||
204 | f.close(); | ||
205 | } | ||
206 | |||
207 | /** | ||
208 | * Remove a group or element definition from ELSTABLE. | 172 | * Remove a group or element definition from ELSTABLE. |
209 | */ | 173 | */ |