diff options
Diffstat (limited to 'kexi/plugins/macros/lib/macroitem.cpp')
-rw-r--r-- | kexi/plugins/macros/lib/macroitem.cpp | 64 |
1 files changed, 32 insertions, 32 deletions
diff --git a/kexi/plugins/macros/lib/macroitem.cpp b/kexi/plugins/macros/lib/macroitem.cpp index 4027f2cc..471f9660 100644 --- a/kexi/plugins/macros/lib/macroitem.cpp +++ b/kexi/plugins/macros/lib/macroitem.cpp @@ -40,62 +40,62 @@ namespace KoMacro { /** * The comment this @a MacroItem has. */ - QString comment; + TQString comment; /** - * The @a QMap of @a Variable this @a MacroItem has. + * The @a TQMap of @a Variable this @a MacroItem has. */ Variable::Map variables; /** - * define a @a QVariant -cast as inline for better performance - * @return the casted @a QVariant by passing a @param variant and its - * expected QVariant::Type @param type. + * define a @a TQVariant -cast as inline for better performance + * @return the casted @a TQVariant by passing a @param variant and its + * expected TQVariant::Type @param type. */ - inline const QVariant cast(const QVariant& variant, QVariant::Type type) const + inline const TQVariant cast(const TQVariant& variant, TQVariant::Type type) const { - // If ok is true the QVariant v holds our new and to the correct type + // If ok is true the TQVariant v holds our new and to the correct type // casted variant value. If ok is false the as argument passed variant - // QVariant contains the (maybe uncasted string to prevent data-loosing + // TQVariant contains the (maybe uncasted string to prevent data-loosing // what would happen if we e.g. would expect an integer and cast it to // an incompatible non-int string) value. bool ok = false; - QVariant v; + TQVariant v; // Try to cast the passed variant to the expected variant-type. switch(type) { - case QVariant::Bool: { - const QString s = variant.toString(); + case TQVariant::Bool: { + const TQString s = variant.toString(); ok = (s == "true" || s == "false" || s == "0" || s == "1" || s == "-1"); - v = QVariant( variant.toBool(), 0 ); + v = TQVariant( variant.toBool(), 0 ); } break; - case QVariant::Int: { + case TQVariant::Int: { v = variant.toInt(&ok); // Check if the cast is correct. Q_ASSERT(!ok || v.toString() == variant.toString()); } break; - case QVariant::UInt: { + case TQVariant::UInt: { v = variant.toUInt(&ok); Q_ASSERT(!ok || v.toString() == variant.toString()); } break; - case QVariant::LongLong: { + case TQVariant::LongLong: { v = variant.toLongLong(&ok); Q_ASSERT(!ok || v.toString() == variant.toString()); } break; - case QVariant::ULongLong: { + case TQVariant::ULongLong: { v = variant.toULongLong(&ok); Q_ASSERT(!ok || v.toString() == variant.toString()); } break; - case QVariant::Double: { + case TQVariant::Double: { v = variant.toDouble(&ok); Q_ASSERT(!ok || v.toString() == variant.toString()); } break; - case QVariant::String: { + case TQVariant::String: { ok = true; // cast will always be successfully v = variant.toString(); } break; default: { - // If we got another type we try to let Qt handle it... + // If we got another type we try to let TQt handle it... ok = v.cast(type); kdWarning()<<"MacroItem::Private::cast() Unhandled ok="<<ok<<" type="<<type<<" value="<<v<<endl; } break; @@ -119,12 +119,12 @@ MacroItem::~MacroItem() delete d; } -QString MacroItem::comment() const +TQString MacroItem::comment() const { return d->comment; } -void MacroItem::setComment(const QString& comment) +void MacroItem::setComment(const TQString& comment) { d->comment = comment; } @@ -139,15 +139,15 @@ void MacroItem::setAction(KSharedPtr<Action> action) d->action = action; } -QVariant MacroItem::variant(const QString& name, bool checkaction) const +TQVariant MacroItem::variant(const TQString& name, bool checkaction) const { KSharedPtr<Variable> v = variable(name, checkaction); - return v.data() ? v->variant() : QVariant(); + return v.data() ? v->variant() : TQVariant(); } -KSharedPtr<Variable> MacroItem::variable(const QString& name, bool checkaction) const +KSharedPtr<Variable> MacroItem::variable(const TQString& name, bool checkaction) const { - if(d->variables.contains(name)) + if(d->variables.tqcontains(name)) return d->variables[name]; if(checkaction && d->action.data()) return d->action->variable(name); @@ -159,7 +159,7 @@ Variable::Map MacroItem::variables() const return d->variables; } -bool MacroItem::setVariant(const QString& name, const QVariant& variant) +bool MacroItem::setVariant(const TQString& name, const TQVariant& variant) { // Let's look if there is an action defined for the variable. If that's // the case, we try to use that action to preserve the type of the variant. @@ -167,7 +167,7 @@ bool MacroItem::setVariant(const QString& name, const QVariant& variant) // If we know the expected type, we try to cast the variant to the expected // type else the variant stays untouched (so, it will stay a string). - const QVariant v = actionvariable.data() + const TQVariant v = actionvariable.data() ? d->cast(variant, actionvariable->variant().type()) // try to cast the variant : variant; // don't cast anything, just leave the string-type... @@ -179,11 +179,11 @@ bool MacroItem::setVariant(const QString& name, const QVariant& variant) variable = KSharedPtr<Variable>( new Variable() ); variable->setName(name); - d->variables.replace(name, variable); + d->variables.tqreplace(name, variable); } // Remember the previous value for the case we like to restore it. - const QVariant oldvar = variable->variant(); + const TQVariant oldvar = variable->variant(); // Set the variable. variable->setVariant(v); @@ -201,15 +201,15 @@ bool MacroItem::setVariant(const QString& name, const QVariant& variant) return true; } -KSharedPtr<Variable> MacroItem::addVariable(const QString& name, const QVariant& variant) +KSharedPtr<Variable> MacroItem::addVariable(const TQString& name, const TQVariant& variant) { - Q_ASSERT(! d->variables.contains(name) ); + Q_ASSERT(! d->variables.tqcontains(name) ); // Create a new Variable. KSharedPtr<Variable> variable = KSharedPtr<Variable>( new Variable() ); variable->setName(name); // Put it into the Variable-map. - d->variables.replace(name, variable); + d->variables.tqreplace(name, variable); // Set the variant of the Variable. this->setVariant(name, variant); |