diff options
author | tpearson <tpearson@283d02a7-25f6-0310-bc7c-ecb5cbfe19da> | 2011-07-02 06:40:27 +0000 |
---|---|---|
committer | tpearson <tpearson@283d02a7-25f6-0310-bc7c-ecb5cbfe19da> | 2011-07-02 06:40:27 +0000 |
commit | 2595a15ebeb6fc46b7cb241d01ec0c2460ec2111 (patch) | |
tree | 18a8f0f4ac5a86dacfa74c3537551ec39bc85e75 /src/lccnvalidator.cpp | |
parent | 1d90725a4001fab9d3922b2cbcceeee5e2d1686f (diff) | |
download | tellico-2595a15ebeb6fc46b7cb241d01ec0c2460ec2111.tar.gz tellico-2595a15ebeb6fc46b7cb241d01ec0c2460ec2111.zip |
TQt4 port tellico
This enables compilation under both Qt3 and Qt4
git-svn-id: svn://anonsvn.kde.org/home/kde/branches/trinity/applications/tellico@1239054 283d02a7-25f6-0310-bc7c-ecb5cbfe19da
Diffstat (limited to 'src/lccnvalidator.cpp')
-rw-r--r-- | src/lccnvalidator.cpp | 22 |
1 files changed, 11 insertions, 11 deletions
diff --git a/src/lccnvalidator.cpp b/src/lccnvalidator.cpp index 8c47931..9b103dd 100644 --- a/src/lccnvalidator.cpp +++ b/src/lccnvalidator.cpp @@ -16,8 +16,8 @@ using Tellico::LCCNValidator; -LCCNValidator::LCCNValidator(QObject* parent_) : QRegExpValidator(parent_) { - QRegExp rx(QString::fromLatin1("[a-z ]{0,3}" +LCCNValidator::LCCNValidator(TQObject* tqparent_) : TQRegExpValidator(tqparent_) { + TQRegExp rx(TQString::tqfromLatin1("[a-z ]{0,3}" "(" "\\d{2}-?\\d{1,6}" "|" @@ -28,24 +28,24 @@ LCCNValidator::LCCNValidator(QObject* parent_) : QRegExpValidator(parent_) { } // static -QString LCCNValidator::formalize(const QString& value_) { +TQString LCCNValidator::formalize(const TQString& value_) { const int len = value_.length(); // first remove alpha prefix - QString alpha; + TQString alpha; for(int pos = 0; pos < len; ++pos) { - QChar c = value_.at(pos); + TQChar c = value_.at(pos); if(c.isNumber()) { break; } alpha += value_.at(pos); } - QString afterAlpha = value_.mid(alpha.length()); + TQString afterAlpha = value_.mid(alpha.length()); alpha = alpha.stripWhiteSpace(); // possible to have a space at the end - QString year; - QString serial; + TQString year; + TQString serial; // have to be able to differentiate 2 and 4-digit years, first check for hyphen position - int pos = afterAlpha.find('-'); + int pos = afterAlpha.tqfind('-'); if(pos > -1) { year = afterAlpha.section('-', 0, 0); serial = afterAlpha.section('-', 1); @@ -54,7 +54,7 @@ QString LCCNValidator::formalize(const QString& value_) { // or from any year after 2100. Reasonable, right? // so if the string starts with '20' we take the first 4 digits as the year // otherwise the first 2 - if(afterAlpha.startsWith(QString::fromLatin1("20"))) { + if(afterAlpha.startsWith(TQString::tqfromLatin1("20"))) { year = afterAlpha.left(4); serial = afterAlpha.mid(4); } else { @@ -66,7 +66,7 @@ QString LCCNValidator::formalize(const QString& value_) { // now check for non digits in the serial pos = 0; for( ; pos < serial.length() && serial.at(pos).isNumber(); ++pos) { ; } - QString suffix = serial.mid(pos); + TQString suffix = serial.mid(pos); serial = serial.left(pos); // serial must be left-padded with zeros to 6 characters serial = serial.rightJustify(6, '0'); |