diff options
Diffstat (limited to 'src/field.cpp')
-rw-r--r-- | src/field.cpp | 66 |
1 files changed, 33 insertions, 33 deletions
diff --git a/src/field.cpp b/src/field.cpp index c260e9a..bfc6dff 100644 --- a/src/field.cpp +++ b/src/field.cpp @@ -26,14 +26,14 @@ #include <tqdatetime.h> namespace { - static const TQRegExp comma_split = TQRegExp(TQString::tqfromLatin1("\\s*,\\s*")); + static const TQRegExp comma_split = TQRegExp(TQString::fromLatin1("\\s*,\\s*")); } using Tellico::Data::Field; //these get overwritten, but are here since they're static TQStringList Field::s_articlesApos; -TQRegExp Field::s_delimiter = TQRegExp(TQString::tqfromLatin1("\\s*;\\s*")); +TQRegExp Field::s_delimiter = TQRegExp(TQString::fromLatin1("\\s*;\\s*")); // this constructor is for anything but Choice type Field::Field(const TQString& name_, const TQString& title_, Type type_/*=Line*/) @@ -54,15 +54,15 @@ Field::Field(const TQString& name_, const TQString& title_, Type type_/*=Line*/) m_flags = AllowMultiple; if(m_type == Table2) { m_type = Table; - setProperty(TQString::tqfromLatin1("columns"), TQChar('2')); + setProperty(TQString::fromLatin1("columns"), TQChar('2')); } else { - setProperty(TQString::tqfromLatin1("columns"), TQChar('1')); + setProperty(TQString::fromLatin1("columns"), TQChar('1')); } } else if(m_type == Date) { // hidden from user m_formatFlag = FormatDate; } else if(m_type == Rating) { - setProperty(TQString::tqfromLatin1("minimum"), TQChar('1')); - setProperty(TQString::tqfromLatin1("maximum"), TQChar('5')); + setProperty(TQString::fromLatin1("minimum"), TQChar('1')); + setProperty(TQString::fromLatin1("maximum"), TQChar('5')); } m_id = getID(); } @@ -83,7 +83,7 @@ Field::Field(const Field& field_) m_allowed = field_.allowed(); } else if(m_type == Table2) { m_type = Table; - setProperty(TQString::tqfromLatin1("columns"), TQChar('2')); + setProperty(TQString::fromLatin1("columns"), TQChar('2')); } m_id = getID(); } @@ -101,7 +101,7 @@ Field& Field::operator=(const Field& field_) { m_allowed = field_.allowed(); } else if(m_type == Table2) { m_type = Table; - setProperty(TQString::tqfromLatin1("columns"), TQChar('2')); + setProperty(TQString::fromLatin1("columns"), TQChar('2')); } m_flags = field_.flags(); m_formatFlag = field_.formatFlag(); @@ -129,10 +129,10 @@ void Field::setType(Field::Type type_) { m_flags |= AllowMultiple; if(m_type == Table2) { m_type = Table; - setProperty(TQString::tqfromLatin1("columns"), TQChar('2')); + setProperty(TQString::fromLatin1("columns"), TQChar('2')); } - if(property(TQString::tqfromLatin1("columns")).isEmpty()) { - setProperty(TQString::tqfromLatin1("columns"), TQChar('1')); + if(property(TQString::fromLatin1("columns")).isEmpty()) { + setProperty(TQString::fromLatin1("columns"), TQChar('1')); } } if(isSingleCategory()) { @@ -167,12 +167,12 @@ void Field::setFormatFlag(FormatFlag flag_) { } const TQString& Field::defaultValue() const { - return property(TQString::tqfromLatin1("default")); + return property(TQString::fromLatin1("default")); } void Field::setDefaultValue(const TQString& value_) { if(m_type != Choice || m_allowed.findIndex(value_) > -1) { - setProperty(TQString::tqfromLatin1("default"), value_); + setProperty(TQString::fromLatin1("default"), value_); } } @@ -208,7 +208,7 @@ TQStringList Field::dependsOn() const { return list; } - TQRegExp rx(TQString::tqfromLatin1("%\\{(.+)\\}")); + TQRegExp rx(TQString::fromLatin1("%\\{(.+)\\}")); rx.setMinimal(true); // do NOT call recursively! for(int pos = m_desc.find(rx); pos > -1; pos = m_desc.find(rx, pos+3)) { @@ -246,7 +246,7 @@ TQString Field::format(const TQString& value_, FormatFlag flag_) { TQString Field::formatTitle(const TQString& title_) { TQString newTitle = title_; // special case for multi-column tables, assume user never has '::' in a value - const TQString colonColon = TQString::tqfromLatin1("::"); + const TQString colonColon = TQString::fromLatin1("::"); TQString tail; if(newTitle.find(colonColon) > -1) { tail = colonColon + newTitle.section(colonColon, 1); @@ -265,11 +265,11 @@ TQString Field::formatTitle(const TQString& title_) { // assume white space is already stripped // the articles are already in lower-case if(lower.startsWith(*it + TQChar(' '))) { - TQRegExp regexp(TQChar('^') + TQRegExp::escape(*it) + TQString::tqfromLatin1("\\s*"), false); + TQRegExp regexp(TQChar('^') + TQRegExp::escape(*it) + TQString::fromLatin1("\\s*"), false); // can't just use *it since it's in lower-case TQString article = newTitle.left((*it).length()); newTitle = newTitle.replace(regexp, TQString()) - .append(TQString::tqfromLatin1(", ")) + .append(TQString::fromLatin1(", ")) .append(article); break; } @@ -277,15 +277,15 @@ TQString Field::formatTitle(const TQString& title_) { } // also, arbitrarily impose rule that a space must follow every comma - newTitle.replace(comma_split, TQString::tqfromLatin1(", ")); + newTitle.replace(comma_split, TQString::fromLatin1(", ")); return newTitle + tail; } TQString Field::formatName(const TQString& name_, bool multiple_/*=true*/) { - static const TQRegExp spaceComma(TQString::tqfromLatin1("[\\s,]")); - static const TQString colonColon = TQString::tqfromLatin1("::"); + static const TQRegExp spaceComma(TQString::fromLatin1("[\\s,]")); + static const TQString colonColon = TQString::fromLatin1("::"); // the ending look-ahead is so that a space is not added at the end - static const TQRegExp periodSpace(TQString::tqfromLatin1("\\.\\s*(?=.)")); + static const TQRegExp periodSpace(TQString::fromLatin1("\\.\\s*(?=.)")); TQStringList entries; if(multiple_) { @@ -307,7 +307,7 @@ TQString Field::formatName(const TQString& name_, bool multiple_/*=true*/) { tail = colonColon + name.section(colonColon, 1); name = name.section(colonColon, 0, 0); } - name.replace(periodSpace, TQString::tqfromLatin1(". ")); + name.replace(periodSpace, TQString::fromLatin1(". ")); if(Config::autoCapitalization()) { name = capitalize(name); } @@ -320,7 +320,7 @@ TQString Field::formatName(const TQString& name_, bool multiple_/*=true*/) { if(!Config::autoFormat() || (name.find(',') > -1 && Config::nameSuffixList().grep(lastWord).isEmpty())) { // arbitrarily impose rule that no spaces before a comma and // a single space after every comma - name.replace(comma_split, TQString::tqfromLatin1(", ")); + name.replace(comma_split, TQString::fromLatin1(", ")); names << name + tail; continue; } @@ -354,7 +354,7 @@ TQString Field::formatName(const TQString& name_, bool multiple_/*=true*/) { } } - return names.join(TQString::tqfromLatin1("; ")); + return names.join(TQString::fromLatin1("; ")); } TQString Field::formatDate(const TQString& date_) { @@ -366,11 +366,11 @@ TQString Field::formatDate(const TQString& date_) { // for empty month or date, use 1 TQStringList s = TQStringList::split('-', date_, true); bool ok = true; - int y = s.count() > 0 ? s[0].toInt(&ok) : TQDate::tqcurrentDate().year(); + int y = s.count() > 0 ? s[0].toInt(&ok) : TQDate::currentDate().year(); if(ok) { empty = false; } else { - y = TQDate::tqcurrentDate().year(); + y = TQDate::currentDate().year(); } int m = s.count() > 1 ? s[1].toInt(&ok) : 1; if(ok) { @@ -392,7 +392,7 @@ TQString Field::formatDate(const TQString& date_) { TQString Field::capitalize(TQString str_) { // regexp to split words - static const TQRegExp rx(TQString::tqfromLatin1("[-\\s,.;]")); + static const TQRegExp rx(TQString::fromLatin1("[-\\s,.;]")); if(str_.isEmpty()) { return str_; @@ -547,7 +547,7 @@ void Field::convertOldRating(Data::FieldPtr field_) { } if(field_->name() != Latin1Literal("rating") - && field_->property(TQString::tqfromLatin1("rating")) != Latin1Literal("true")) { + && field_->property(TQString::fromLatin1("rating")) != Latin1Literal("true")) { return; // nothing to do } @@ -568,9 +568,9 @@ void Field::convertOldRating(Data::FieldPtr field_) { min = 1; max = 5; } - field_->setProperty(TQString::tqfromLatin1("minimum"), TQString::number(min)); - field_->setProperty(TQString::tqfromLatin1("maximum"), TQString::number(max)); - field_->setProperty(TQString::tqfromLatin1("rating"), TQString()); + field_->setProperty(TQString::fromLatin1("minimum"), TQString::number(min)); + field_->setProperty(TQString::fromLatin1("maximum"), TQString::number(max)); + field_->setProperty(TQString::fromLatin1("rating"), TQString()); field_->setType(Rating); } @@ -586,9 +586,9 @@ void Field::stripArticles(TQString& value) { return; } for(TQStringList::ConstIterator it = articles.begin(); it != articles.end(); ++it) { - TQRegExp rx(TQString::tqfromLatin1("\\b") + *it + TQString::tqfromLatin1("\\b")); + TQRegExp rx(TQString::fromLatin1("\\b") + *it + TQString::fromLatin1("\\b")); value.remove(rx); } value = value.stripWhiteSpace(); - value.remove(TQRegExp(TQString::tqfromLatin1(",$"))); + value.remove(TQRegExp(TQString::fromLatin1(",$"))); } |