diff -r 53efc2562a7d -r bef71af3f6ab version.cpp --- a/version.cpp Mon Nov 20 12:12:02 2006 +0000 +++ b/version.cpp Mon Jan 14 16:27:00 2008 +0000 @@ -4,6 +4,8 @@ { // returns true, if vym is able to read file regarding // the version set with setVersion + return checkVersion (v,__VYM_VERSION); + /* QString s1=v.section (".",0,0); QString s2=v.section (".",1,1); QString s3=v.section (".",2,2); @@ -31,5 +33,40 @@ if (vv3 < mv3) return false; return true; +*/ +} + +bool checkVersion (const QString &v, const QString &d) +{ + QString v1=v.section (".",0,0); + QString v2=v.section (".",1,1); + QString v3=v.section (".",2,2); + QString d1=d.section (".",0,0); + QString d2=d.section (".",1,1); + QString d3=d.section (".",2,2); + bool ok; + int d1i=d1.toInt(&ok,10); + int d2i=d2.toInt(&ok,10); + int d3i=d3.toInt(&ok,10); + int v1i=0; + int v2i=0; + int v3i=0; + if (!v1.isEmpty() ) v1i=v1.toInt(&ok,10); + if (!v2.isEmpty() ) v2i=v2.toInt(&ok,10); + if (!v3.isEmpty() ) v3i=v3.toInt(&ok,10); + + if (d1i > v1i) + return true; + if (d1i < v1i) + return false; + if (d2i > v2i) + return true; + if (d2i < v2i) + return false; + if (d3i > v3i) + return true; + if (d3i < v3i) + return false; + return true; }