summaryrefslogtreecommitdiffstats
path: root/src/upcvalidator.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/upcvalidator.cpp')
-rw-r--r--src/upcvalidator.cpp46
1 files changed, 23 insertions, 23 deletions
diff --git a/src/upcvalidator.cpp b/src/upcvalidator.cpp
index 2d5b7a2..4e51179 100644
--- a/src/upcvalidator.cpp
+++ b/src/upcvalidator.cpp
@@ -18,11 +18,11 @@
using Tellico::UPCValidator;
-UPCValidator::UPCValidator(QObject* parent_, const char* name_/*=0*/)
- : QValidator(parent_, name_), m_checkISBN(false) {
+UPCValidator::UPCValidator(TQObject* tqparent_, const char* name_/*=0*/)
+ : TQValidator(tqparent_, name_), m_checkISBN(false) {
}
-QValidator::State UPCValidator::validate(QString& input_, int& pos_) const {
+TQValidator::State UPCValidator::validate(TQString& input_, int& pos_) const {
// check if it's a cuecat first
State catState = decodeCat(input_);
if(catState == Acceptable) {
@@ -31,8 +31,8 @@ QValidator::State UPCValidator::validate(QString& input_, int& pos_) const {
}
// no spaces allowed
- if(input_.contains(' ')) {
- return QValidator::Invalid;
+ if(input_.tqcontains(' ')) {
+ return TQValidator::Invalid;
}
// no real checking, just if starts with 978, use isbnvalidator
@@ -42,14 +42,14 @@ QValidator::State UPCValidator::validate(QString& input_, int& pos_) const {
}
if(!m_checkISBN || (!m_isbn && len < 13)) {
- return QValidator::Intermediate;
+ return TQValidator::Intermediate;
}
// once it gets converted to an ISBN, remember that, and use it for later
- if(input_.startsWith(QString::fromLatin1("978")) || input_.startsWith(QString::fromLatin1("979"))) {
+ if(input_.startsWith(TQString::tqfromLatin1("978")) || input_.startsWith(TQString::tqfromLatin1("979"))) {
ISBNValidator val(0);
- QValidator::State s = val.validate(input_, pos_);
- if(s == QValidator::Acceptable) {
+ TQValidator::State s = val.validate(input_, pos_);
+ if(s == TQValidator::Acceptable) {
m_isbn = true;
// bad hack
UPCValidator* that = const_cast<UPCValidator*>(this);
@@ -58,16 +58,16 @@ QValidator::State UPCValidator::validate(QString& input_, int& pos_) const {
return s;
}
- return QValidator::Intermediate;
+ return TQValidator::Intermediate;
}
-void UPCValidator::fixup(QString& input_) const {
+void UPCValidator::fixup(TQString& input_) const {
if(input_.isEmpty()) {
return;
}
input_ = input_.stripWhiteSpace();
- int pos = input_.find(' ');
+ int pos = input_.tqfind(' ');
if(pos > -1) {
input_ = input_.left(pos);
}
@@ -77,12 +77,12 @@ void UPCValidator::fixup(QString& input_) const {
}
const uint len = input_.length();
- if(len > 12 && (input_.startsWith(QString::fromLatin1("978")) || input_.startsWith(QString::fromLatin1("979")))) {
- QString s = input_;
+ if(len > 12 && (input_.startsWith(TQString::tqfromLatin1("978")) || input_.startsWith(TQString::tqfromLatin1("979")))) {
+ TQString s = input_;
ISBNValidator val(0);
int p = 0;
int state = val.validate(s, p);
- if(state == QValidator::Acceptable) {
+ if(state == TQValidator::Acceptable) {
// bad hack
UPCValidator* that = const_cast<UPCValidator*>(this);
that->signalISBN();
@@ -91,14 +91,14 @@ void UPCValidator::fixup(QString& input_) const {
}
}
-QValidator::State UPCValidator::decodeCat(QString& input_) const {
+TQValidator::State UPCValidator::decodeCat(TQString& input_) const {
if(input_.length() < 3) {
return Intermediate;
}
- if(!input_.startsWith(QString::fromLatin1(".C3"))) { // all cuecat codes start with .C3
+ if(!input_.startsWith(TQString::tqfromLatin1(".C3"))) { // all cuecat codes start with .C3
return Invalid;
}
- const int periods = input_.contains('.');
+ const int periods = input_.tqcontains('.');
if(periods < 4) {
return Intermediate; // not enough yet
} else if(periods > 4) {
@@ -106,24 +106,24 @@ QValidator::State UPCValidator::decodeCat(QString& input_) const {
}
// ok, let's have a go, take the third token
- QString code = QStringList::split('.', input_)[2];
+ TQString code = TQStringList::split('.', input_)[2];
while(code.length() % 4 > 0) {
code += '=';
}
for(uint i = 0; i < code.length(); ++i) {
if(code[i] >= 'A' && code[i] <= 'Z') {
- code.replace(i, 1, code[i].lower());
+ code.tqreplace(i, 1, code[i].lower());
} else if(code[i] >= 'a' && code[i] <= 'z') {
- code.replace(i, 1, code[i].upper());
+ code.tqreplace(i, 1, code[i].upper());
}
}
- code = QString::fromLatin1(KCodecs::base64Decode(code.latin1()));
+ code = TQString::tqfromLatin1(KCodecs::base64Decode(TQCString(code.latin1())));
for(uint i = 0; i < code.length(); ++i) {
char c = code[i].latin1() ^ 'C';
- code.replace(i, 1, c);
+ code.tqreplace(i, 1, c);
}
input_ = code;