author | cniehaus <cniehaus> | 2002-09-16 10:45:04 (UTC) |
---|---|---|
committer | cniehaus <cniehaus> | 2002-09-16 10:45:04 (UTC) |
commit | d5d64f7617836096a4e9de81997ada7b6f220b47 (patch) (side-by-side diff) | |
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 @@ -1,8 +1,8 @@ /* * kmolcalc.cpp * - * Copyright (C) 2000 Tomislav Gountchev <tomi@idiom.com> + * Copyright (C) 2000,2001 Tomislav Gountchev <tomi@idiom.com> * Copyright (C) 2002 Carsten Niehaus <cniehaus@handhelds.org> */ /** @@ -35,30 +35,11 @@ void KMolCalc::readElstable() { weight = -1; // not calculated yet if (elstable) delete elstable; elstable = new QDict<SubUnit> (197, TRUE); elstable->setAutoDelete(TRUE); - QStringList files = "/home/opie/opie/noncore/apps/oxigen/kmolweights"; - mwfile = "/home/opie/opie/noncore/apps/oxigen/kmolweights"; + mwfile = "/home/opie/opie/noncore/apps/oxygen/kmolweights"; QFile f(mwfile); - QString* latest_f = &mwfile; - for (uint i=0; i<files.count(); i++) { - if (QFileInfo(QFile(files[i])).lastModified() > QFileInfo(QFile(*latest_f)).lastModified()) { - latest_f = &files[i]; - } - } - QFile lf(*latest_f); if (f.exists()) readMwfile(f); - if (!f.exists()) { - readMwfile(lf); - writeElstable(); - } else if (QFileInfo(f).lastModified() < QFileInfo(lf).lastModified()) { - // announce - QMessageBox::information - (0, "Warning:", "Found new global Mw file.\nLocal definitions will be updated.", QMessageBox::Ok); - readMwfile(lf); - writeElstable(); - } - } /** @@ -187,25 +168,8 @@ void KMolCalc::readMwfile(QFile& f) { f.close(); } /** - * Save the element definitions file. - */ -void KMolCalc::writeElstable() { - QFile f(mwfile); - if (! f.open(IO_WriteOnly)) return; //ERROR - QTextStream fs (&f); - QString line; - QDictIterator<SubUnit> it(*elstable); - while (it.current()) { - it.current()->writeOut(line); - fs << line << endl; - ++it; - } - f.close(); -} - -/** * Remove a group or element definition from ELSTABLE. */ void KMolCalc::undefineGroup (const QString& name) { elstable->remove (name); |