diff options
Diffstat (limited to 'lib/koproperty/property.cpp')
-rw-r--r-- | lib/koproperty/property.cpp | 256 |
1 files changed, 128 insertions, 128 deletions
diff --git a/lib/koproperty/property.cpp b/lib/koproperty/property.cpp index 9d677bd8..87d12a6d 100644 --- a/lib/koproperty/property.cpp +++ b/lib/koproperty/property.cpp @@ -26,10 +26,10 @@ #include <kdebug.h> -#include <qobject.h> -#include <qptrdict.h> -#include <qasciidict.h> -#include <qguardedptr.h> +#include <tqobject.h> +#include <tqptrdict.h> +#include <tqasciidict.h> +#include <tqguardedptr.h> namespace KoProperty { @@ -43,16 +43,16 @@ class PropertyPrivate : caption(0), listData(0), changed(false), storable(true), readOnly(false), visible(true), autosync(-1), custom(0), useCustomProperty(true), - sets(0), parent(0), children(0), relatedProperties(0), + sets(0), tqparent(0), tqchildren(0), relatedProperties(0), sortingKey(0) { } - inline void setCaptionForDisplaying(const QString& captionForDisplaying) + inline void setCaptionForDisplaying(const TQString& captionForDisplaying) { delete caption; if (captionForDisplaying.simplifyWhiteSpace()!=captionForDisplaying) - caption = new QString(captionForDisplaying.simplifyWhiteSpace()); + caption = new TQString(captionForDisplaying.simplifyWhiteSpace()); else caption = 0; this->captionForDisplaying = captionForDisplaying; @@ -63,45 +63,45 @@ class PropertyPrivate delete caption; caption = 0; delete listData; - delete children; + delete tqchildren; delete relatedProperties; delete custom; delete sets; } int type; - QCString name; - QString captionForDisplaying; - QString* caption; - QString description; - QVariant value; - QVariant oldValue; + TQCString name; + TQString captionForDisplaying; + TQString* caption; + TQString description; + TQVariant value; + TQVariant oldValue; /*! The string-to-value correspondence list of the property.*/ Property::ListData* listData; -// QMap<QString, QVariant> *valueList; - QString icon; +// TQMap<TQString, TQVariant> *valueList; + TQString icon; bool changed : 1; bool storable : 1; bool readOnly : 1; bool visible : 1; int autosync; - QMap<QCString, QVariant> options; + TQMap<TQCString, TQVariant> options; CustomProperty *custom; //! Flag used to allow CustomProperty to use setValue() bool useCustomProperty; //! Used when a single set is assigned for the property - QGuardedPtr<Set> set; + TQGuardedPtr<Set> set; //! Used when multiple sets are assigned for the property - QPtrDict< QGuardedPtr<Set> > *sets; -// QValueList<Set*> sets; + TQPtrDict< TQGuardedPtr<Set> > *sets; +// TQValueList<Set*> sets; - Property *parent; - QValueList<Property*> *children; + Property *tqparent; + TQValueList<Property*> *tqchildren; //! list of properties with the same name (when intersecting buffers) - QValueList<Property*> *relatedProperties; + TQValueList<Property*> *relatedProperties; int sortingKey; }; @@ -111,14 +111,14 @@ using namespace KoProperty; ///////////////////////////////////////////////////////////////// -Property::ListData::ListData(const QStringList& keys_, const QStringList& names_) +Property::ListData::ListData(const TQStringList& keys_, const TQStringList& names_) : names(names_) // , fixed(true) { setKeysAsStringList(keys_); } -Property::ListData::ListData(const QValueList<QVariant> keys_, const QStringList& names_) +Property::ListData::ListData(const TQValueList<TQVariant> keys_, const TQStringList& names_) : keys(keys_), names(names_) // , fixed(true) { @@ -133,18 +133,18 @@ Property::ListData::~ListData() { } -void Property::ListData::setKeysAsStringList(const QStringList& list) +void Property::ListData::setKeysAsStringList(const TQStringList& list) { keys.clear(); - for (QStringList::ConstIterator it = list.constBegin(); it!=list.constEnd(); ++it) { + for (TQStringList::ConstIterator it = list.constBegin(); it!=list.constEnd(); ++it) { keys.append(*it); } } -QStringList Property::ListData::keysAsStringList() const +TQStringList Property::ListData::keysAsStringList() const { - QStringList result; - for (QValueList<QVariant>::ConstIterator it = keys.constBegin(); it!=keys.constEnd(); ++it) { + TQStringList result; + for (TQValueList<TQVariant>::ConstIterator it = keys.constBegin(); it!=keys.constEnd(); ++it) { result.append((*it).toString()); } return result; @@ -153,16 +153,16 @@ QStringList Property::ListData::keysAsStringList() const ///////////////////////////////////////////////////////////////// /* -KOPROPERTY_EXPORT QMap<QString, QVariant> -KoProperty::createValueListFromStringLists(const QStringList &keys, const QStringList &values) +KOPROPERTY_EXPORT TQMap<TQString, TQVariant> +KoProperty::createValueListFromStringLists(const TQStringList &keys, const TQStringList &values) { - QMap<QString, QVariant> map; + TQMap<TQString, TQVariant> map; if(keys.count() != values.count()) return map; - QStringList::ConstIterator valueIt = values.begin(); - QStringList::ConstIterator endIt = keys.constEnd(); - for(QStringList::ConstIterator it = keys.begin(); it != endIt; ++it, ++valueIt) + TQStringList::ConstIterator valueIt = values.begin(); + TQStringList::ConstIterator endIt = keys.constEnd(); + for(TQStringList::ConstIterator it = keys.begin(); it != endIt; ++it, ++valueIt) map.insert( *it, *valueIt); return map; @@ -170,9 +170,9 @@ KoProperty::createValueListFromStringLists(const QStringList &keys, const QStrin */ -Property::Property(const QCString &name, const QVariant &value, - const QString &caption, const QString &description, - int type, Property* parent) +Property::Property(const TQCString &name, const TQVariant &value, + const TQString &caption, const TQString &description, + int type, Property* tqparent) : d( new PropertyPrivate() ) { d->name = name; @@ -186,14 +186,14 @@ Property::Property(const QCString &name, const QVariant &value, d->custom = FactoryManager::self()->createCustomProperty(this); - if (parent) - parent->addChild(this); + if (tqparent) + tqparent->addChild(this); setValue(value, false); } -Property::Property(const QCString &name, const QStringList &keys, const QStringList &strings, - const QVariant &value, const QString &caption, const QString &description, - int type, Property* parent) +Property::Property(const TQCString &name, const TQStringList &keys, const TQStringList &strings, + const TQVariant &value, const TQString &caption, const TQString &description, + int type, Property* tqparent) : d( new PropertyPrivate() ) { d->name = name; @@ -204,14 +204,14 @@ Property::Property(const QCString &name, const QStringList &keys, const QStringL d->custom = FactoryManager::self()->createCustomProperty(this); - if (parent) - parent->addChild(this); + if (tqparent) + tqparent->addChild(this); setValue(value, false); } -Property::Property(const QCString &name, ListData* listData, - const QVariant &value, const QString &caption, const QString &description, - int type, Property* parent) +Property::Property(const TQCString &name, ListData* listData, + const TQVariant &value, const TQString &caption, const TQString &description, + int type, Property* tqparent) : d( new PropertyPrivate() ) { d->name = name; @@ -222,8 +222,8 @@ Property::Property(const QCString &name, ListData* listData, d->custom = FactoryManager::self()->createCustomProperty(this); - if (parent) - parent->addChild(this); + if (tqparent) + tqparent->addChild(this); setValue(value, false); } @@ -244,44 +244,44 @@ Property::~Property() d = 0; } -QCString +TQCString Property::name() const { return d->name; } void -Property::setName(const QCString &name) +Property::setName(const TQCString &name) { d->name = name; } -QString +TQString Property::caption() const { return d->caption ? *d->caption : d->captionForDisplaying; } -QString +TQString Property::captionForDisplaying() const { return d->captionForDisplaying; } void -Property::setCaption(const QString &caption) +Property::setCaption(const TQString &caption) { d->setCaptionForDisplaying(caption); } -QString +TQString Property::description() const { return d->description; } void -Property::setDescription(const QString &desc) +Property::setDescription(const TQString &desc) { d->description = desc; } @@ -298,19 +298,19 @@ Property::setType(int type) d->type = type; } -QString +TQString Property::icon() const { return d->icon; } void -Property::setIcon(const QString &icon) +Property::setIcon(const TQString &icon) { d->icon = icon; } -QVariant +TQVariant Property::value() const { if(d->custom && d->custom->handleValue()) @@ -318,7 +318,7 @@ Property::value() const return d->value; } -QVariant +TQVariant Property::oldValue() const { /* if(d->oldValue.isNull()) @@ -328,23 +328,23 @@ Property::oldValue() const } void -Property::setValue(const QVariant &value, bool rememberOldValue, bool useCustomProperty) +Property::setValue(const TQVariant &value, bool rememberOldValue, bool useCustomProperty) { if (d->name.isEmpty()) { kopropertywarn << "Property::setValue(): COULD NOT SET value to a null property" << endl; return; } - QVariant currentValue = this->value(); - const QVariant::Type t = currentValue.type(); - const QVariant::Type newt = value.type(); + TQVariant currentValue = this->value(); + const TQVariant::Type t = currentValue.type(); + const TQVariant::Type newt = value.type(); // kopropertydbg << d->name << " : setValue('" << value.toString() << "' type=" << type() << ")" << endl; if (t != newt && !currentValue.isNull() && !value.isNull() - && !( (t==QVariant::Int && newt==QVariant::UInt) - || (t==QVariant::UInt && newt==QVariant::Int) - || (t==QVariant::CString && newt==QVariant::String) - || (t==QVariant::String && newt==QVariant::CString) - || (t==QVariant::ULongLong && newt==QVariant::LongLong) - || (t==QVariant::LongLong && newt==QVariant::ULongLong) + && !( (t==TQVariant::Int && newt==TQVariant::UInt) + || (t==TQVariant::UInt && newt==TQVariant::Int) + || (t==TQVariant::CString && newt==TQVariant::String) + || (t==TQVariant::String && newt==TQVariant::CString) + || (t==TQVariant::ULongLong && newt==TQVariant::LongLong) + || (t==TQVariant::LongLong && newt==TQVariant::ULongLong) )) { kopropertywarn << "Property::setValue(): INCOMPATIBLE TYPES! old=" << currentValue << " new=" << value << endl; @@ -352,20 +352,20 @@ Property::setValue(const QVariant &value, bool rememberOldValue, bool useCustomP //1. Check if the value should be changed bool ch; - if (t == QVariant::DateTime - || t == QVariant::Time) { + if (t == TQVariant::DateTime + || t == TQVariant::Time) { //for date and datetime types: compare with strings, because there //can be miliseconds difference ch = (currentValue.toString() != value.toString()); } - else if (t == QVariant::String || t==QVariant::CString) { + else if (t == TQVariant::String || t==TQVariant::CString) { //property is changed for string type, //if one of value is empty and other isn't.. ch = ( (currentValue.toString().isEmpty() != value.toString().isEmpty()) //..or both are not empty and values differ || (!currentValue.toString().isEmpty() && !value.toString().isEmpty() && currentValue != value) ); } - else if (t == QVariant::Invalid && newt == QVariant::Invalid) + else if (t == TQVariant::Invalid && newt == TQVariant::Invalid) ch = false; else ch = (currentValue != value); @@ -380,10 +380,10 @@ Property::setValue(const QVariant &value, bool rememberOldValue, bool useCustomP d->changed = true; } else { - d->oldValue = QVariant(); // clear old value + d->oldValue = TQVariant(); // clear old value d->changed = false; } - QVariant prevValue; + TQVariant prevValue; if(d->custom && useCustomProperty) { d->custom->setValue(value, rememberOldValue); prevValue = d->custom->value(); @@ -408,12 +408,12 @@ Property::resetValue() if (cleared) return; //property set has been cleared: no further actions make sense as 'this' is dead - // maybe parent prop is also unchanged now - if(d->parent && d->parent->value() == d->parent->oldValue()) - d->parent->d->changed = false; + // maybe tqparent prop is also unchanged now + if(d->tqparent && d->tqparent->value() == d->tqparent->oldValue()) + d->tqparent->d->changed = false; if (d->sets) { - for (QPtrDictIterator< QGuardedPtr<Set> > it(*d->sets); it.current(); ++it) { + for (TQPtrDictIterator< TQGuardedPtr<Set> > it(*d->sets); it.current(); ++it) { if (it.current()) //may be destroyed in the meantime emit (*it.current())->propertyReset(**it.current(), *this); } @@ -423,7 +423,7 @@ Property::resetValue() } } -//const QMap<QString, QVariant>* +//const TQMap<TQString, TQVariant>* Property::ListData* Property::listData() const { @@ -431,10 +431,10 @@ Property::listData() const } void -Property::setListData(ListData* list) //const QMap<QString, QVariant> &list) +Property::setListData(ListData* list) //const TQMap<TQString, TQVariant> &list) { // if(!d->valueList) -// d->valueList = new QMap<QString, QVariant>(); +// d->valueList = new TQMap<TQString, TQVariant>(); if (list == d->listData) return; delete d->listData; @@ -442,13 +442,13 @@ Property::setListData(ListData* list) //const QMap<QString, QVariant> &list) } void -Property::setListData(const QStringList &keys, const QStringList &names) +Property::setListData(const TQStringList &keys, const TQStringList &names) { ListData* list = new ListData(keys, names); setListData(list); // if(!d->valueList) -// d->valueList = new QMap<QString, QVariant>(); +// d->valueList = new TQMap<TQString, TQVariant>(); // *(d->valueList) = createValueListFromStringLists(keys, values); } @@ -521,17 +521,17 @@ Property::setStorable(bool storable) } void -Property::setOption(const char* name, const QVariant& val) +Property::setOption(const char* name, const TQVariant& val) { d->options[name] = val; } -QVariant +TQVariant Property::option(const char* name) const { - if (d->options.contains(name)) + if (d->options.tqcontains(name)) return d->options[name]; - return QVariant(); + return TQVariant(); } bool @@ -548,7 +548,7 @@ Property::operator bool () const } const Property& -Property::operator= (const QVariant& val) +Property::operator= (const TQVariant& val) { setValue(val); return *this; @@ -564,9 +564,9 @@ Property::operator= (const Property &property) delete d->listData; d->listData = 0; } - if(d->children) { - delete d->children; - d->children = 0; + if(d->tqchildren) { + delete d->tqchildren; + d->tqchildren = 0; } if(d->relatedProperties) { delete d->relatedProperties; @@ -590,20 +590,20 @@ Property::operator= (const Property &property) d->options = property.d->options; if(property.d->listData) { - d->listData = new ListData(*property.d->listData); //QMap<QString, QVariant>(*(property.d->valueList)); + d->listData = new ListData(*property.d->listData); //TQMap<TQString, TQVariant>(*(property.d->valueList)); } if(property.d->custom) { d->custom = FactoryManager::self()->createCustomProperty(this); - // updates all children value, using CustomProperty + // updates all tqchildren value, using CustomProperty setValue(property.value()); } else { d->value = property.d->value; - if(property.d->children) { - // no CustomProperty (should never happen), simply copy all children - d->children = new QValueList<Property*>(); - QValueList<Property*>::ConstIterator endIt = property.d->children->constEnd(); - for(QValueList<Property*>::ConstIterator it = property.d->children->constBegin(); it != endIt; ++it) { + if(property.d->tqchildren) { + // no CustomProperty (should never happen), simply copy all tqchildren + d->tqchildren = new TQValueList<Property*>(); + TQValueList<Property*>::ConstIterator endIt = property.d->tqchildren->constEnd(); + for(TQValueList<Property*>::ConstIterator it = property.d->tqchildren->constBegin(); it != endIt; ++it) { Property *child = new Property( *(*it) ); addChild(child); } @@ -611,10 +611,10 @@ Property::operator= (const Property &property) } if(property.d->relatedProperties) { - d->relatedProperties = new QValueList<Property*>( *(property.d->relatedProperties)); + d->relatedProperties = new TQValueList<Property*>( *(property.d->relatedProperties)); } - // update these later because they may have been changed when creating children + // update these later because they may have been changed when creating tqchildren d->oldValue = property.d->oldValue; d->changed = property.d->changed; d->sortingKey = property.d->sortingKey; @@ -630,17 +630,17 @@ Property::operator ==(const Property &prop) const ///////////////////////////////////////////////////////////////// -const QValueList<Property*>* -Property::children() const +const TQValueList<Property*>* +Property::tqchildren() const { - return d->children; + return d->tqchildren; } Property* -Property::child(const QCString &name) +Property::child(const TQCString &name) { - QValueList<Property*>::ConstIterator endIt = d->children->constEnd(); - for(QValueList<Property*>::ConstIterator it = d->children->constBegin(); it != endIt; ++it) { + TQValueList<Property*>::ConstIterator endIt = d->tqchildren->constEnd(); + for(TQValueList<Property*>::ConstIterator it = d->tqchildren->constBegin(); it != endIt; ++it) { if((*it)->name() == name) return *it; } @@ -648,9 +648,9 @@ Property::child(const QCString &name) } Property* -Property::parent() const +Property::tqparent() const { - return d->parent; + return d->tqparent; } void @@ -659,12 +659,12 @@ Property::addChild(Property *prop) if (!prop) return; - if(!d->children || qFind( d->children->begin(), d->children->end(), prop) == d->children->end()) { // not in our list - if(!d->children) - d->children = new QValueList<Property*>(); - d->children->append(prop); - prop->setSortingKey(d->children->count()); - prop->d->parent = this; + if(!d->tqchildren || tqFind( d->tqchildren->begin(), d->tqchildren->end(), prop) == d->tqchildren->end()) { // not in our list + if(!d->tqchildren) + d->tqchildren = new TQValueList<Property*>(); + d->tqchildren->append(prop); + prop->setSortingKey(d->tqchildren->count()); + prop->d->tqparent = this; } else { kopropertywarn << "Property::addChild(): property \"" << name() @@ -685,22 +685,22 @@ Property::addSet(Set *set) } if ((Set*)d->set==set) return; - QGuardedPtr<Set> *pset = d->sets ? d->sets->find(set) : 0; + TQGuardedPtr<Set> *pset = d->sets ? d->sets->tqfind(set) : 0; if (pset && (Set*)*pset == set) return; if (!d->sets) { - d->sets = new QPtrDict< QGuardedPtr<Set> >( 101 ); + d->sets = new TQPtrDict< TQGuardedPtr<Set> >( 101 ); d->sets->setAutoDelete(true); } - d->sets->replace(set, new QGuardedPtr<Set>( set )); + d->sets->tqreplace(set, new TQGuardedPtr<Set>( set )); -// QValueList<Set*>::iterator it = qFind( d->sets.begin(), d->sets.end(), set); +// TQValueList<Set*>::iterator it = tqFind( d->sets.begin(), d->sets.end(), set); // if(it == d->sets.end()) // not in our list // d->sets.append(set); } -const QValueList<Property*>* +const TQValueList<Property*>* Property::related() const { return d->relatedProperties; @@ -710,9 +710,9 @@ void Property::addRelatedProperty(Property *property) { if(!d->relatedProperties) - d->relatedProperties = new QValueList<Property*>(); + d->relatedProperties = new TQValueList<Property*>(); - QValueList<Property*>::iterator it = qFind( d->relatedProperties->begin(), d->relatedProperties->end(), property); + TQValueList<Property*>::iterator it = tqFind( d->relatedProperties->begin(), d->relatedProperties->end(), property); if(it == d->relatedProperties->end()) // not in our list d->relatedProperties->append(property); } @@ -742,7 +742,7 @@ void Property::setSortingKey(int key) void Property::emitPropertyChanged() { if (d->sets) { - for (QPtrDictIterator< QGuardedPtr<Set> > it(*d->sets); it.current(); ++it) { + for (TQPtrDictIterator< TQGuardedPtr<Set> > it(*d->sets); it.current(); ++it) { if (it.current()) {//may be destroyed in the meantime emit (*it.current())->propertyChangedInternal(**it.current(), *this); emit (*it.current())->propertyChanged(**it.current(), *this); @@ -766,11 +766,11 @@ void Property::emitPropertyChanged() void Property::debug() { - QString dbg = "Property( name='" + QString(d->name) + "' desc='" + d->description + TQString dbg = "Property( name='" + TQString(d->name) + "' desc='" + d->description + "' val=" + (value().isValid() ? value().toString() : "<INVALID>"); if (!d->oldValue.isValid()) dbg += (", oldVal='" + d->oldValue.toString() + '\''); - dbg += (QString(d->changed ? " " : " un") + "changed"); + dbg += (TQString(d->changed ? " " : " un") + "changed"); dbg += (d->visible ? " visible" : " hidden"); dbg+=" )"; |