summaryrefslogtreecommitdiffstats
path: root/kexi/widget/tableview/kexitextformatter.cpp
diff options
context:
space:
mode:
authortpearson <tpearson@283d02a7-25f6-0310-bc7c-ecb5cbfe19da>2011-06-25 05:28:35 +0000
committertpearson <tpearson@283d02a7-25f6-0310-bc7c-ecb5cbfe19da>2011-06-25 05:28:35 +0000
commitf008adb5a77e094eaf6abf3fc0f36958e66896a5 (patch)
tree8e9244c4d4957c36be81e15b566b4aa5ea26c982 /kexi/widget/tableview/kexitextformatter.cpp
parent1210f27b660efb7b37ff43ec68763e85a403471f (diff)
downloadkoffice-f008adb5a77e094eaf6abf3fc0f36958e66896a5.tar.gz
koffice-f008adb5a77e094eaf6abf3fc0f36958e66896a5.zip
TQt4 port koffice
This should enable compilation under both Qt3 and Qt4; fixes for any missed components will be forthcoming git-svn-id: svn://anonsvn.kde.org/home/kde/branches/trinity/applications/koffice@1238284 283d02a7-25f6-0310-bc7c-ecb5cbfe19da
Diffstat (limited to 'kexi/widget/tableview/kexitextformatter.cpp')
-rw-r--r--kexi/widget/tableview/kexitextformatter.cpp36
1 files changed, 18 insertions, 18 deletions
diff --git a/kexi/widget/tableview/kexitextformatter.cpp b/kexi/widget/tableview/kexitextformatter.cpp
index f4e0b89d..b7388138 100644
--- a/kexi/widget/tableview/kexitextformatter.cpp
+++ b/kexi/widget/tableview/kexitextformatter.cpp
@@ -71,7 +71,7 @@ void KexiTextFormatter::setField( KexiDB::Field* field )
}
}
-QString KexiTextFormatter::valueToText(const QVariant& value, const QString& add) const
+TQString KexiTextFormatter::valueToText(const TQVariant& value, const TQString& add) const
{
//cases, in order of expected frequency
if (!d->field || d->field->isTextType())
@@ -86,16 +86,16 @@ QString KexiTextFormatter::valueToText(const QVariant& value, const QString& add
if (value.toDouble() == 0.0)
return add.isEmpty() ? "0" : add; //eat 0
#if 0 //moved to KexiDB::formatNumberForVisibleDecimalPlaces()
- QString text( QString::number(value.toDouble(), 'f',
- QMAX(d->field->visibleDecimalPlaces(), 10)) ); //!<-- 10 is quite good maximum for fractional digits
+ TQString text( TQString::number(value.toDouble(), 'f',
+ TQMAX(d->field->visibleDecimalPlaces(), 10)) ); //!<-- 10 is quite good maximum for fractional digits
//!< @todo add command line settings?
//! @todo (js): get decimal places settings here...
- QStringList sl = QStringList::split(".", text);
+ TQStringList sl = TQStringList::split(".", text);
//nothing
}
else if (sl.count()==2) {
// kdDebug() << "sl.count()=="<<sl.count()<< " " <<sl[0] << " | " << sl[1] << endl;
- const QString sl1 = sl[1];
+ const TQString sl1 = sl[1];
int pos = sl1.length()-1;
if (pos>=1) {
for (;pos>=0 && sl1[pos]=='0';pos--)
@@ -113,16 +113,16 @@ QString KexiTextFormatter::valueToText(const QVariant& value, const QString& add
}
else if (d->field->type() == KexiDB::Field::Boolean) {
//! @todo temporary solution for booleans!
- const bool boolValue = value.isNull() ? QVariant(add).toBool() : value.toBool();
+ const bool boolValue = value.isNull() ? TQVariant(add).toBool() : value.toBool();
return boolValue ? "1" : "0";
}
else if (d->field->type() == KexiDB::Field::Date) {
- return d->dateFormatter->dateToString( value.toString().isEmpty() ? QDate() : value.toDate() );
+ return d->dateFormatter->dateToString( value.toString().isEmpty() ? TQDate() : value.toDate() );
}
else if (d->field->type() == KexiDB::Field::Time) {
return d->timeFormatter->timeToString(
- //hack to avoid converting null variant to valid QTime(0,0,0)
- value.toString().isEmpty() ? value.toTime() : QTime(99,0,0) );
+ //hack to avoid converting null variant to valid TQTime(0,0,0)
+ value.toString().isEmpty() ? value.toTime() : TQTime(99,0,0) );
}
else if (d->field->type() == KexiDB::Field::DateTime) {
if (value.toString().isEmpty() )
@@ -138,10 +138,10 @@ QString KexiTextFormatter::valueToText(const QVariant& value, const QString& add
return value.toString() + add;
}
-QVariant KexiTextFormatter::textToValue(const QString& text) const
+TQVariant KexiTextFormatter::textToValue(const TQString& text) const
{
if (!d->field)
- return QVariant();
+ return TQVariant();
const KexiDB::Field::Type t = d->field->type();
switch (t) {
case KexiDB::Field::Text:
@@ -157,7 +157,7 @@ QVariant KexiTextFormatter::textToValue(const QString& text) const
return text.toLongLong();
case KexiDB::Field::Boolean:
//! @todo temporary solution for booleans!
- return text == "1" ? QVariant(true,1) : QVariant(false,0);
+ return text == "1" ? TQVariant(true,1) : TQVariant(false,0);
case KexiDB::Field::Date:
return d->dateFormatter->stringToVariant( text );
case KexiDB::Field::Time:
@@ -167,8 +167,8 @@ QVariant KexiTextFormatter::textToValue(const QString& text) const
case KexiDB::Field::Float:
case KexiDB::Field::Double: {
// replace custom decimal symbol with '.' as required by to{Float|Double}()
- QString fixedText( text );
- fixedText.replace(KGlobal::locale()->decimalSymbol(), ".");
+ TQString fixedText( text );
+ fixedText.tqreplace(KGlobal::locale()->decimalSymbol(), ".");
if (t == KexiDB::Field::Double)
return fixedText.toDouble();
return fixedText.toFloat();
@@ -179,7 +179,7 @@ QVariant KexiTextFormatter::textToValue(const QString& text) const
//! @todo more data types!
}
-bool KexiTextFormatter::valueIsEmpty(const QString& text) const
+bool KexiTextFormatter::valueIsEmpty(const TQString& text) const
{
if (text.isEmpty())
return true;
@@ -198,7 +198,7 @@ bool KexiTextFormatter::valueIsEmpty(const QString& text) const
return text.isEmpty();
}
-bool KexiTextFormatter::valueIsValid(const QString& text) const
+bool KexiTextFormatter::valueIsValid(const TQString& text) const
{
if (!d->field)
return true;
@@ -218,7 +218,7 @@ bool KexiTextFormatter::valueIsValid(const QString& text) const
return true;
}
-QString KexiTextFormatter::inputMask() const
+TQString KexiTextFormatter::inputMask() const
{
const KexiDB::Field::Type t = d->field->type();
if (t==KexiDB::Field::Date) {
@@ -232,6 +232,6 @@ QString KexiTextFormatter::inputMask() const
else if (t==KexiDB::Field::DateTime) {
dateTimeInputMask( *d->dateFormatter, *d->timeFormatter );
}
- return QString::null;
+ return TQString();
}