summaryrefslogtreecommitdiffstats
path: root/kexi/plugins/forms/kexidataprovider.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'kexi/plugins/forms/kexidataprovider.cpp')
-rw-r--r--kexi/plugins/forms/kexidataprovider.cpp96
1 files changed, 48 insertions, 48 deletions
diff --git a/kexi/plugins/forms/kexidataprovider.cpp b/kexi/plugins/forms/kexidataprovider.cpp
index 6706f838..400e6d37 100644
--- a/kexi/plugins/forms/kexidataprovider.cpp
+++ b/kexi/plugins/forms/kexidataprovider.cpp
@@ -19,8 +19,8 @@
#include "kexidataprovider.h"
-#include <qwidget.h>
-#include <qobjectlist.h>
+#include <tqwidget.h>
+#include <tqobjectlist.h>
#include <kdebug.h>
#include <klocale.h>
@@ -46,7 +46,7 @@ KexiFormDataProvider::~KexiFormDataProvider()
delete m_duplicatedItems;
}
-void KexiFormDataProvider::setMainDataSourceWidget(QWidget* mainWidget)
+void KexiFormDataProvider::setMainDataSourceWidget(TQWidget* mainWidget)
{
m_mainWidget = mainWidget;
m_dataItems.clear();
@@ -56,15 +56,15 @@ void KexiFormDataProvider::setMainDataSourceWidget(QWidget* mainWidget)
return;
//find widgets whose will work as data items
- QObjectList *l = m_mainWidget->queryList( "QWidget" );
- QObjectListIt it( *l );
- QObject *obj;
- QDict<char> tmpSources;
+ TQObjectList *l = m_mainWidget->queryList( TQWIDGET_OBJECT_NAME_STRING );
+ TQObjectListIt it( *l );
+ TQObject *obj;
+ TQDict<char> tmpSources;
for ( ; (obj = it.current()) != 0; ++it ) {
KexiFormDataItemInterface* const formDataItem = dynamic_cast<KexiFormDataItemInterface*>(obj);
if (!formDataItem)
continue;
- if (formDataItem->parentInterface()) //item with parent interface: collect parent instead...
+ if (formDataItem->tqparentInterface()) //item with tqparent interface: collect tqparent instead...
continue;
#if 0 //! @todo reenable when subform is moved to KexiDBForm
KexiDBForm *dbForm = KexiUtils::findParent<KexiDBForm>(obj, "KexiDBForm"); //form's surface...
@@ -75,18 +75,18 @@ void KexiFormDataProvider::setMainDataSourceWidget(QWidget* mainWidget)
if (KexiUtils::findParent<KexiDBForm>(obj, "KexiDBSubForm"))
continue;
#endif
- QString dataSource( formDataItem->dataSource().lower() );
+ TQString dataSource( formDataItem->dataSource().lower() );
if (dataSource.isEmpty())
continue;
kexipluginsdbg << obj->name() << endl;
m_dataItems.append( formDataItem );
formDataItem->installListener( this );
- tmpSources.replace( dataSource, (char*)1 );
+ tmpSources.tqreplace( dataSource, (char*)1 );
}
delete l;
//now we've got a set (unique list) of field names in tmpSources
//remember it in m_usedDataSources
- for (QDictIterator<char> it(tmpSources); it.current(); ++it) {
+ for (TQDictIterator<char> it(tmpSources); it.current(); ++it) {
m_usedDataSources += it.currentKey();
}
}
@@ -106,46 +106,46 @@ void KexiFormDataProvider::fillDataItems(KexiTableItem& row, bool cursorAtNewRow
int indexForVisibleLookupValue = itemIface->columnInfo()->indexForVisibleLookupValue();
if (indexForVisibleLookupValue<0 && indexForVisibleLookupValue>=(int)row.count()) //sanity
indexForVisibleLookupValue = -1; //no
- const QVariant value(row.at(it.data()));
- QVariant visibleLookupValue;
+ const TQVariant value(row.at(it.data()));
+ TQVariant visibleLookupValue;
if (indexForVisibleLookupValue!=-1 && (int)row.size()>indexForVisibleLookupValue)
visibleLookupValue = row.at(indexForVisibleLookupValue);
kexipluginsdbg << "fill data of '" << itemIface->dataSource() << "' at idx=" << it.data()
<< " data=" << value << (indexForVisibleLookupValue!=-1
- ? QString(" SPECIAL: indexForVisibleLookupValue=%1 visibleValue=%2")
- .arg(indexForVisibleLookupValue).arg(visibleLookupValue.toString())
- : QString::null)
+ ? TQString(" SPECIAL: indexForVisibleLookupValue=%1 visibleValue=%2")
+ .tqarg(indexForVisibleLookupValue).tqarg(visibleLookupValue.toString())
+ : TQString())
<< endl;
const bool displayDefaultValue = cursorAtNewRow && (value.isNull() && visibleLookupValue.isNull())
&& !itemIface->columnInfo()->field->defaultValue().isNull()
&& !itemIface->columnInfo()->field->isAutoIncrement(); //no value to set but there is default value defined
itemIface->setValue(
displayDefaultValue ? itemIface->columnInfo()->field->defaultValue() : value,
- QVariant(), /*add*/
+ TQVariant(), /*add*/
/*!remove old*/false,
indexForVisibleLookupValue==-1 ? 0 : &visibleLookupValue //pass visible value if available
);
// now disable/enable "display default value" if needed (do it after setValue(), before setValue() turns it off)
if (itemIface->hasDisplayedDefaultValue() != displayDefaultValue)
- itemIface->setDisplayDefaultValue( dynamic_cast<QWidget*>(itemIface), displayDefaultValue );
+ itemIface->setDisplayDefaultValue( dynamic_cast<TQWidget*>(itemIface), displayDefaultValue );
}
}
void KexiFormDataProvider::fillDuplicatedDataItems(
- KexiFormDataItemInterface* item, const QVariant& value)
+ KexiFormDataItemInterface* item, const TQVariant& value)
{
if (m_disableFillDuplicatedDataItems)
return;
if (!m_duplicatedItems) {
//build (once) a set of duplicated data items (having the same fields assigned)
//so we can later check if an item is duplicated with a cost of o(1)
- QMap<KexiDB::Field*,int> tmpDuplicatedItems;
- QMapIterator<KexiDB::Field*,int> it_dup;
- for (QPtrListIterator<KexiFormDataItemInterface> it(m_dataItems); it.current(); ++it) {
+ TQMap<KexiDB::Field*,int> tmpDuplicatedItems;
+ TQMapIterator<KexiDB::Field*,int> it_dup;
+ for (TQPtrListIterator<KexiFormDataItemInterface> it(m_dataItems); it.current(); ++it) {
if (!it.current()->columnInfo() || !it.current()->columnInfo()->field)
continue;
kdDebug() << " ** " << it.current()->columnInfo()->field->name() << endl;
- it_dup = tmpDuplicatedItems.find( it.current()->columnInfo()->field );
+ it_dup = tmpDuplicatedItems.tqfind( it.current()->columnInfo()->field );
uint count;
if (it_dup==tmpDuplicatedItems.end())
count = 0;
@@ -153,7 +153,7 @@ void KexiFormDataProvider::fillDuplicatedDataItems(
count = it_dup.data();
tmpDuplicatedItems.insert( it.current()->columnInfo()->field, ++count );
}
- m_duplicatedItems = new QPtrDict<char>(101);
+ m_duplicatedItems = new TQPtrDict<char>(101);
for (it_dup = tmpDuplicatedItems.begin(); it_dup!=tmpDuplicatedItems.end(); ++it_dup) {
if (it_dup.data() > 1) {
m_duplicatedItems->insert( it_dup.key(), (char*)1 );
@@ -162,11 +162,11 @@ void KexiFormDataProvider::fillDuplicatedDataItems(
}
}
}
- if (item->columnInfo() && m_duplicatedItems->find( item->columnInfo()->field )) {
- for (QPtrListIterator<KexiFormDataItemInterface> it(m_dataItems); it.current(); ++it) {
+ if (item->columnInfo() && m_duplicatedItems->tqfind( item->columnInfo()->field )) {
+ for (TQPtrListIterator<KexiFormDataItemInterface> it(m_dataItems); it.current(); ++it) {
if (it.current()!=item && item->columnInfo()->field == it.current()->columnInfo()->field) {
kexipluginsdbg << "- setting a copy of value for item '"
- << dynamic_cast<QObject*>(it.current())->name() << "' == " << value << endl;
+ << dynamic_cast<TQObject*>(it.current())->name() << "' == " << value << endl;
it.current()->setValue( value );
}
}
@@ -183,7 +183,7 @@ bool KexiFormDataProvider::cursorAtNewRow() const
return false;
}
-void KexiFormDataProvider::invalidateDataSources( const QDict<char>& invalidSources,
+void KexiFormDataProvider::tqinvalidateDataSources( const TQDict<char>& invalidSources,
KexiDB::QuerySchema* query)
{
//fill m_fieldNumbersForDataItems mapping from data item to field number
@@ -194,16 +194,16 @@ void KexiFormDataProvider::invalidateDataSources( const QDict<char>& invalidSour
if (query) {
fieldsExpanded = query->fieldsExpanded( KexiDB::QuerySchema::WithInternalFields );
// dataFieldsCount = fieldsExpanded.count();
- QMap<KexiDB::QueryColumnInfo*,int> columnsOrder( query->columnsOrder() );
- for (QMapConstIterator<KexiDB::QueryColumnInfo*,int> it = columnsOrder.constBegin(); it!=columnsOrder.constEnd(); ++it) {
+ TQMap<KexiDB::QueryColumnInfo*,int> columnsOrder( query->columnsOrder() );
+ for (TQMapConstIterator<KexiDB::QueryColumnInfo*,int> it = columnsOrder.constBegin(); it!=columnsOrder.constEnd(); ++it) {
kexipluginsdbg << "query->columnsOrder()[ " << it.key()->field->name() << " ] = " << it.data() << endl;
}
- for (QPtrListIterator<KexiFormDataItemInterface> it(m_dataItems); it.current(); ++it) {
+ for (TQPtrListIterator<KexiFormDataItemInterface> it(m_dataItems); it.current(); ++it) {
KexiFormDataItemInterface *item = it.current();
KexiDB::QueryColumnInfo* ci = query->columnInfo( it.current()->dataSource() );
int index = ci ? columnsOrder[ ci ] : -1;
kexipluginsdbg << "query->columnsOrder()[ " << (ci ? ci->field->name() : "") << " ] = " << index
- << " (dataSource: " << item->dataSource() << ", name=" << dynamic_cast<QObject*>(item)->name() << ")" << endl;
+ << " (dataSource: " << item->dataSource() << ", name=" << dynamic_cast<TQObject*>(item)->name() << ")" << endl;
if (index!=-1 && !m_fieldNumbersForDataItems[ item ])
m_fieldNumbersForDataItems.insert( item, index );
//todo
@@ -218,26 +218,26 @@ void KexiFormDataProvider::invalidateDataSources( const QDict<char>& invalidSour
#if 0 //moved down
//in 'newIndices' let's collect new indices for every data source
- foreach(QValueList<uint>::ConstIterator, it, invalidSources) {
+ foreach(TQValueList<uint>::ConstIterator, it, invalidSources) {
//all previous indices have corresponding data source
// for (; i < (*it); i++) {
// newIndices[i] = number++;
- //kexipluginsdbg << "invalidateDataSources(): " << i << " -> " << number-1 << endl;
+ //kexipluginsdbg << "tqinvalidateDataSources(): " << i << " -> " << number-1 << endl;
// }
//this index have no corresponding data source
// newIndices[i]=-1;
KexiFormDataItemInterface *item = m_dataItems.at( *it );
if (item)
- item->setInvalidState( QString::fromLatin1("#") + i18n("NAME") + QString::fromLatin1("?") );
+ item->setInvalidState( TQString::tqfromLatin1("#") + i18n("NAME") + TQString::tqfromLatin1("?") );
m_dataItems.remove(*it);
- kexipluginsdbg << "invalidateDataSources(): " << (*it) << " -> " << -1 << endl;
+ kexipluginsdbg << "tqinvalidateDataSources(): " << (*it) << " -> " << -1 << endl;
// i++;
}
#endif
//fill remaining part of the vector
// for (; i < dataFieldsCount; i++) { //m_dataItems.count(); i++) {
//newIndices[i] = number++;
- //kexipluginsdbg << "invalidateDataSources(): " << i << " -> " << number-1 << endl;
+ //kexipluginsdbg << "tqinvalidateDataSources(): " << i << " -> " << number-1 << endl;
//}
#if 0
@@ -247,35 +247,35 @@ void KexiFormDataProvider::invalidateDataSources( const QDict<char>& invalidSour
bool ok;
const int newIndex = newIndices.at( it.data(), &ok );
if (ok && newIndex!=-1) {
- kexipluginsdbg << "invalidateDataSources(): " << it.key()->dataSource() << ": " << it.data() << " -> " << newIndex << endl;
- newFieldNumbersForDataItems.replace(it.key(), newIndex);
+ kexipluginsdbg << "tqinvalidateDataSources(): " << it.key()->dataSource() << ": " << it.data() << " -> " << newIndex << endl;
+ newFieldNumbersForDataItems.tqreplace(it.key(), newIndex);
}
else {
- kexipluginsdbg << "invalidateDataSources(): removing " << it.key()->dataSource() << endl;
+ kexipluginsdbg << "tqinvalidateDataSources(): removing " << it.key()->dataSource() << endl;
m_dataItems.remove(it.key());
- it.key()->setInvalidState( QString::fromLatin1("#") + i18n("NAME") + QString::fromLatin1("?") );
+ it.key()->setInvalidState( TQString::tqfromLatin1("#") + i18n("NAME") + TQString::tqfromLatin1("?") );
}
}
#endif
// m_fieldNumbersForDataItems = newFieldNumbersForDataItems;
//update data sources set (some of them may be removed)
- QDict<char> tmpUsedDataSources(1013);
+ TQDict<char> tmpUsedDataSources(1013);
if (query)
query->debug();
//if (query && m_dataItems.count()!=query->fieldCount()) {
- // kdWarning() << "KexiFormDataProvider::invalidateDataSources(): m_dataItems.count()!=query->fieldCount() ("
+ // kdWarning() << "KexiFormDataProvider::tqinvalidateDataSources(): m_dataItems.count()!=query->fieldCount() ("
// << m_dataItems.count() << "," << query->fieldCount() << ")" << endl;
//}
//i = 0;
m_disableFillDuplicatedDataItems = true; // temporary disable fillDuplicatedDataItems()
// because setColumnInfo() can activate it
- for (QPtrListIterator<KexiFormDataItemInterface> it(m_dataItems); it.current();) {
+ for (TQPtrListIterator<KexiFormDataItemInterface> it(m_dataItems); it.current();) {
KexiFormDataItemInterface * item = it.current();
if (invalidSources[ item->dataSource().lower() ]) {
- item->setInvalidState( QString::fromLatin1("#") + i18n("NAME") + QString::fromLatin1("?") );
+ item->setInvalidState( TQString::tqfromLatin1("#") + i18n("NAME") + TQString::tqfromLatin1("?") );
m_dataItems.remove(item);
continue;
}
@@ -283,7 +283,7 @@ void KexiFormDataProvider::invalidateDataSources( const QDict<char>& invalidSour
if (query) {
KexiDB::QueryColumnInfo *ci = fieldsExpanded[fieldNumber];
item->setColumnInfo(ci);
- kexipluginsdbg << "- item=" << dynamic_cast<QObject*>(item)->name()
+ kexipluginsdbg << "- item=" << dynamic_cast<TQObject*>(item)->name()
<< " dataSource=" << item->dataSource()
<< " field=" << ci->field->name() << endl;
const int indexForVisibleLookupValue = ci->indexForVisibleLookupValue();
@@ -304,12 +304,12 @@ void KexiFormDataProvider::invalidateDataSources( const QDict<char>& invalidSour
}
}
}
- tmpUsedDataSources.replace( item->dataSource().lower(), (char*)1 );
+ tmpUsedDataSources.tqreplace( item->dataSource().lower(), (char*)1 );
++it;
}
m_disableFillDuplicatedDataItems = false;
m_usedDataSources.clear();
- foreach_list(QDictIterator<char>, it, tmpUsedDataSources) {
+ foreach_list(TQDictIterator<char>, it, tmpUsedDataSources) {
m_usedDataSources += it.currentKey();
}
}