diff options
Diffstat (limited to 'kexi/formeditor/formIO.cpp')
-rw-r--r-- | kexi/formeditor/formIO.cpp | 234 |
1 files changed, 117 insertions, 117 deletions
diff --git a/kexi/formeditor/formIO.cpp b/kexi/formeditor/formIO.cpp index 639b4a83..563d89fd 100644 --- a/kexi/formeditor/formIO.cpp +++ b/kexi/formeditor/formIO.cpp @@ -52,8 +52,8 @@ #include "formIO.h" /// A blank widget used when the class name is not supported -CustomWidget::CustomWidget(const TQCString &className, TQWidget *tqparent, const char *name) -: TQWidget(tqparent, name), m_className(className) +CustomWidget::CustomWidget(const TQCString &className, TQWidget *parent, const char *name) +: TQWidget(parent, name), m_className(className) { setBackgroundMode(TQt::PaletteDark); } @@ -398,7 +398,7 @@ FormIO::loadFormFromDom(Form *form, TQWidget *container, TQDomDocument &inBuf) ///////////////////////////////////////////////////////////////////////////// void -FormIO::savePropertyValue(TQDomElement &parentNode, TQDomDocument &tqparent, const char *name, +FormIO::savePropertyValue(TQDomElement &parentNode, TQDomDocument &parent, const char *name, const TQVariant &value, TQWidget *w, WidgetLibrary *lib) { // Widget specific properties and attributes /////////////// @@ -416,14 +416,14 @@ FormIO::savePropertyValue(TQDomElement &parentNode, TQDomDocument &tqparent, con { kdDebug() << "FormIO::savePropertyValue() The object doesn't have this property. Let's try the WidgetLibrary." << endl; if(lib) - lib->saveSpecialProperty(w->className(), name, value, w, parentNode, tqparent); + lib->saveSpecialProperty(w->className(), name, value, w, parentNode, parent); return; } const TQMetaProperty *meta = subwidget->tqmetaObject()->property(propertyId, true); if (!meta->stored( subwidget )) //not storable return; - TQDomElement propertyE = tqparent.createElement("property"); + TQDomElement propertyE = parent.createElement("property"); propertyE.setAttribute("name", name); if (addSubwidgetFlag) propertyE.setAttribute("subwidget", "true"); @@ -437,15 +437,15 @@ FormIO::savePropertyValue(TQDomElement &parentNode, TQDomDocument &tqparent, con if(meta->isSetType()) { TQStringList list = TQStringList::fromStrList(meta->valueToKeys(value.toInt())); - type = tqparent.createElement("set"); - valueE = tqparent.createTextNode(list.join("|")); + type = parent.createElement("set"); + valueE = parent.createTextNode(list.join("|")); type.appendChild(valueE); } else { TQString s = meta->valueToKey(value.toInt()); - type = tqparent.createElement("enum"); - valueE = tqparent.createTextNode(s); + type = parent.createElement("enum"); + valueE = parent.createTextNode(s); type.appendChild(valueE); } propertyE.appendChild(type); @@ -455,13 +455,13 @@ FormIO::savePropertyValue(TQDomElement &parentNode, TQDomDocument &tqparent, con if(value.type() == TQVariant::Pixmap) { TQDomText valueE; - TQDomElement type = tqparent.createElement("pixmap"); + TQDomElement type = parent.createElement("pixmap"); TQCString property = propertyE.attribute("name").latin1(); //todo TQCString pixmapName = m_currentItem->widget()->property("pixmapName").toCString(); if(m_savePixmapsInline /* (js)too risky: || m_currentItem->pixmapName(property).isNull() */) - valueE = tqparent.createTextNode(saveImage(tqparent, value.toPixmap())); + valueE = parent.createTextNode(saveImage(parent, value.toPixmap())); else - valueE = tqparent.createTextNode(m_currentItem->pixmapName(property)); + valueE = parent.createTextNode(m_currentItem->pixmapName(property)); type.appendChild(valueE); propertyE.appendChild(type); parentNode.appendChild(propertyE); @@ -469,12 +469,12 @@ FormIO::savePropertyValue(TQDomElement &parentNode, TQDomDocument &tqparent, con } // Saving a "normal" property - writeVariant(tqparent, propertyE, value); + writeVariant(parent, propertyE, value); parentNode.appendChild(propertyE); } void -FormIO::writeVariant(TQDomDocument &tqparent, TQDomElement &parentNode, TQVariant value) +FormIO::writeVariant(TQDomDocument &parent, TQDomElement &parentNode, TQVariant value) { TQDomElement type; TQDomText valueE; @@ -483,29 +483,29 @@ FormIO::writeVariant(TQDomDocument &tqparent, TQDomElement &parentNode, TQVarian { case TQVariant::String: { - type = tqparent.createElement("string"); - valueE = tqparent.createTextNode(value.toString()); + type = parent.createElement("string"); + valueE = parent.createTextNode(value.toString()); type.appendChild(valueE); break; } case TQVariant::CString: { - type = tqparent.createElement("cstring"); - valueE = tqparent.createTextNode(value.toString()); + type = parent.createElement("cstring"); + valueE = parent.createTextNode(value.toString()); type.appendChild(valueE); break; } case TQVariant::Rect: { - type = tqparent.createElement("rect"); - TQDomElement x = tqparent.createElement("x"); - TQDomElement y = tqparent.createElement("y"); - TQDomElement w = tqparent.createElement("width"); - TQDomElement h = tqparent.createElement("height"); - TQDomText valueX = tqparent.createTextNode(TQString::number(value.toRect().x())); - TQDomText valueY = tqparent.createTextNode(TQString::number(value.toRect().y())); - TQDomText valueW = tqparent.createTextNode(TQString::number(value.toRect().width())); - TQDomText valueH = tqparent.createTextNode(TQString::number(value.toRect().height())); + type = parent.createElement("rect"); + TQDomElement x = parent.createElement("x"); + TQDomElement y = parent.createElement("y"); + TQDomElement w = parent.createElement("width"); + TQDomElement h = parent.createElement("height"); + TQDomText valueX = parent.createTextNode(TQString::number(value.toRect().x())); + TQDomText valueY = parent.createTextNode(TQString::number(value.toRect().y())); + TQDomText valueW = parent.createTextNode(TQString::number(value.toRect().width())); + TQDomText valueH = parent.createTextNode(TQString::number(value.toRect().height())); x.appendChild(valueX); y.appendChild(valueY); @@ -520,13 +520,13 @@ FormIO::writeVariant(TQDomDocument &tqparent, TQDomElement &parentNode, TQVarian } case TQVariant::Color: { - type = tqparent.createElement("color"); - TQDomElement r = tqparent.createElement("red"); - TQDomElement g = tqparent.createElement("green"); - TQDomElement b = tqparent.createElement("blue"); - TQDomText valueR = tqparent.createTextNode(TQString::number(value.toColor().red())); - TQDomText valueG = tqparent.createTextNode(TQString::number(value.toColor().green())); - TQDomText valueB = tqparent.createTextNode(TQString::number(value.toColor().blue())); + type = parent.createElement("color"); + TQDomElement r = parent.createElement("red"); + TQDomElement g = parent.createElement("green"); + TQDomElement b = parent.createElement("blue"); + TQDomText valueR = parent.createTextNode(TQString::number(value.toColor().red())); + TQDomText valueG = parent.createTextNode(TQString::number(value.toColor().green())); + TQDomText valueB = parent.createTextNode(TQString::number(value.toColor().blue())); r.appendChild(valueR); g.appendChild(valueG); @@ -539,27 +539,27 @@ FormIO::writeVariant(TQDomDocument &tqparent, TQDomElement &parentNode, TQVarian } case TQVariant::Bool: { - type = tqparent.createElement("bool"); - //valueE = tqparent.createTextNode(TQString::number(value.toBool())); - valueE = tqparent.createTextNode(value.toBool() ? "true" : "false"); + type = parent.createElement("bool"); + //valueE = parent.createTextNode(TQString::number(value.toBool())); + valueE = parent.createTextNode(value.toBool() ? "true" : "false"); type.appendChild(valueE); break; } case TQVariant::Int: case TQVariant::UInt: { - type = tqparent.createElement("number"); - valueE = tqparent.createTextNode(TQString::number(value.toInt())); + type = parent.createElement("number"); + valueE = parent.createTextNode(TQString::number(value.toInt())); type.appendChild(valueE); break; } case TQVariant::Size: { - type = tqparent.createElement("size"); - TQDomElement w = tqparent.createElement("width"); - TQDomElement h = tqparent.createElement("height"); - TQDomText valueW = tqparent.createTextNode(TQString::number(value.toSize().width())); - TQDomText valueH = tqparent.createTextNode(TQString::number(value.toSize().height())); + type = parent.createElement("size"); + TQDomElement w = parent.createElement("width"); + TQDomElement h = parent.createElement("height"); + TQDomText valueW = parent.createTextNode(TQString::number(value.toSize().width())); + TQDomText valueH = parent.createTextNode(TQString::number(value.toSize().height())); w.appendChild(valueW); h.appendChild(valueH); @@ -570,11 +570,11 @@ FormIO::writeVariant(TQDomDocument &tqparent, TQDomElement &parentNode, TQVarian } case TQVariant::Point: { - type = tqparent.createElement("point"); - TQDomElement x = tqparent.createElement("x"); - TQDomElement y = tqparent.createElement("y"); - TQDomText valueX = tqparent.createTextNode(TQString::number(value.toPoint().x())); - TQDomText valueY = tqparent.createTextNode(TQString::number(value.toPoint().y())); + type = parent.createElement("point"); + TQDomElement x = parent.createElement("x"); + TQDomElement y = parent.createElement("y"); + TQDomText valueX = parent.createTextNode(TQString::number(value.toPoint().x())); + TQDomText valueY = parent.createTextNode(TQString::number(value.toPoint().y())); x.appendChild(valueX); y.appendChild(valueY); @@ -585,21 +585,21 @@ FormIO::writeVariant(TQDomDocument &tqparent, TQDomElement &parentNode, TQVarian } case TQVariant::Font: { - type = tqparent.createElement("font"); - TQDomElement f = tqparent.createElement("family"); - TQDomElement p = tqparent.createElement("pointsize"); - TQDomElement w = tqparent.createElement("weight"); - TQDomElement b = tqparent.createElement("bold"); - TQDomElement i = tqparent.createElement("italic"); - TQDomElement u = tqparent.createElement("underline"); - TQDomElement s = tqparent.createElement("strikeout"); - TQDomText valueF = tqparent.createTextNode(value.toFont().family()); - TQDomText valueP = tqparent.createTextNode(TQString::number(value.toFont().pointSize())); - TQDomText valueW = tqparent.createTextNode(TQString::number(value.toFont().weight())); - TQDomText valueB = tqparent.createTextNode(TQString::number(value.toFont().bold())); - TQDomText valueI = tqparent.createTextNode(TQString::number(value.toFont().italic())); - TQDomText valueU = tqparent.createTextNode(TQString::number(value.toFont().underline())); - TQDomText valueS = tqparent.createTextNode(TQString::number(value.toFont().strikeOut())); + type = parent.createElement("font"); + TQDomElement f = parent.createElement("family"); + TQDomElement p = parent.createElement("pointsize"); + TQDomElement w = parent.createElement("weight"); + TQDomElement b = parent.createElement("bold"); + TQDomElement i = parent.createElement("italic"); + TQDomElement u = parent.createElement("underline"); + TQDomElement s = parent.createElement("strikeout"); + TQDomText valueF = parent.createTextNode(value.toFont().family()); + TQDomText valueP = parent.createTextNode(TQString::number(value.toFont().pointSize())); + TQDomText valueW = parent.createTextNode(TQString::number(value.toFont().weight())); + TQDomText valueB = parent.createTextNode(TQString::number(value.toFont().bold())); + TQDomText valueI = parent.createTextNode(TQString::number(value.toFont().italic())); + TQDomText valueU = parent.createTextNode(TQString::number(value.toFont().underline())); + TQDomText valueS = parent.createTextNode(TQString::number(value.toFont().strikeOut())); f.appendChild(valueF); p.appendChild(valueP); @@ -620,22 +620,22 @@ FormIO::writeVariant(TQDomDocument &tqparent, TQDomElement &parentNode, TQVarian } case TQVariant::Cursor: { - type = tqparent.createElement("cursor"); - valueE = tqparent.createTextNode(TQString::number(value.toCursor().tqshape())); + type = parent.createElement("cursor"); + valueE = parent.createTextNode(TQString::number(value.toCursor().tqshape())); type.appendChild(valueE); break; } case TQVariant::SizePolicy: { - type = tqparent.createElement("sizepolicy"); - TQDomElement h = tqparent.createElement("hsizetype"); - TQDomElement v = tqparent.createElement("vsizetype"); - TQDomElement hs = tqparent.createElement("horstretch"); - TQDomElement vs = tqparent.createElement("verstretch"); - TQDomText valueH = tqparent.createTextNode(TQString::number(value.toSizePolicy().horData())); - TQDomText valueV = tqparent.createTextNode(TQString::number(value.toSizePolicy().verData())); - TQDomText valueHS = tqparent.createTextNode(TQString::number(value.toSizePolicy().horStretch())); - TQDomText valueVS = tqparent.createTextNode(TQString::number(value.toSizePolicy().verStretch())); + type = parent.createElement("sizepolicy"); + TQDomElement h = parent.createElement("hsizetype"); + TQDomElement v = parent.createElement("vsizetype"); + TQDomElement hs = parent.createElement("horstretch"); + TQDomElement vs = parent.createElement("verstretch"); + TQDomText valueH = parent.createTextNode(TQString::number(value.toSizePolicy().horData())); + TQDomText valueV = parent.createTextNode(TQString::number(value.toSizePolicy().verData())); + TQDomText valueHS = parent.createTextNode(TQString::number(value.toSizePolicy().horStretch())); + TQDomText valueVS = parent.createTextNode(TQString::number(value.toSizePolicy().verStretch())); h.appendChild(valueH); v.appendChild(valueV); @@ -650,13 +650,13 @@ FormIO::writeVariant(TQDomDocument &tqparent, TQDomElement &parentNode, TQVarian } case TQVariant::Time: { - type = tqparent.createElement("time"); - TQDomElement h = tqparent.createElement("hour"); - TQDomElement m = tqparent.createElement("minute"); - TQDomElement s = tqparent.createElement("second"); - TQDomText valueH = tqparent.createTextNode(TQString::number(value.toTime().hour())); - TQDomText valueM = tqparent.createTextNode(TQString::number(value.toTime().minute())); - TQDomText valueS = tqparent.createTextNode(TQString::number(value.toTime().second())); + type = parent.createElement("time"); + TQDomElement h = parent.createElement("hour"); + TQDomElement m = parent.createElement("minute"); + TQDomElement s = parent.createElement("second"); + TQDomText valueH = parent.createTextNode(TQString::number(value.toTime().hour())); + TQDomText valueM = parent.createTextNode(TQString::number(value.toTime().minute())); + TQDomText valueS = parent.createTextNode(TQString::number(value.toTime().second())); h.appendChild(valueH); m.appendChild(valueM); @@ -669,13 +669,13 @@ FormIO::writeVariant(TQDomDocument &tqparent, TQDomElement &parentNode, TQVarian } case TQVariant::Date: { - type = tqparent.createElement("date"); - TQDomElement y = tqparent.createElement("year"); - TQDomElement m = tqparent.createElement("month"); - TQDomElement d = tqparent.createElement("day"); - TQDomText valueY = tqparent.createTextNode(TQString::number(value.toDate().year())); - TQDomText valueM = tqparent.createTextNode(TQString::number(value.toDate().month())); - TQDomText valueD = tqparent.createTextNode(TQString::number(value.toDate().day())); + type = parent.createElement("date"); + TQDomElement y = parent.createElement("year"); + TQDomElement m = parent.createElement("month"); + TQDomElement d = parent.createElement("day"); + TQDomText valueY = parent.createTextNode(TQString::number(value.toDate().year())); + TQDomText valueM = parent.createTextNode(TQString::number(value.toDate().month())); + TQDomText valueD = parent.createTextNode(TQString::number(value.toDate().day())); y.appendChild(valueY); m.appendChild(valueM); @@ -688,19 +688,19 @@ FormIO::writeVariant(TQDomDocument &tqparent, TQDomElement &parentNode, TQVarian } case TQVariant::DateTime: { - type = tqparent.createElement("datetime"); - TQDomElement h = tqparent.createElement("hour"); - TQDomElement m = tqparent.createElement("minute"); - TQDomElement s = tqparent.createElement("second"); - TQDomElement y = tqparent.createElement("year"); - TQDomElement mo = tqparent.createElement("month"); - TQDomElement d = tqparent.createElement("day"); - TQDomText valueH = tqparent.createTextNode(TQString::number(value.toDateTime().time().hour())); - TQDomText valueM = tqparent.createTextNode(TQString::number(value.toDateTime().time().minute())); - TQDomText valueS = tqparent.createTextNode(TQString::number(value.toDateTime().time().second())); - TQDomText valueY = tqparent.createTextNode(TQString::number(value.toDateTime().date().year())); - TQDomText valueMo = tqparent.createTextNode(TQString::number(value.toDateTime().date().month())); - TQDomText valueD = tqparent.createTextNode(TQString::number(value.toDateTime().date().day())); + type = parent.createElement("datetime"); + TQDomElement h = parent.createElement("hour"); + TQDomElement m = parent.createElement("minute"); + TQDomElement s = parent.createElement("second"); + TQDomElement y = parent.createElement("year"); + TQDomElement mo = parent.createElement("month"); + TQDomElement d = parent.createElement("day"); + TQDomText valueH = parent.createTextNode(TQString::number(value.toDateTime().time().hour())); + TQDomText valueM = parent.createTextNode(TQString::number(value.toDateTime().time().minute())); + TQDomText valueS = parent.createTextNode(TQString::number(value.toDateTime().time().second())); + TQDomText valueY = parent.createTextNode(TQString::number(value.toDateTime().date().year())); + TQDomText valueMo = parent.createTextNode(TQString::number(value.toDateTime().date().month())); + TQDomText valueD = parent.createTextNode(TQString::number(value.toDateTime().date().day())); h.appendChild(valueH); m.appendChild(valueM); @@ -909,7 +909,7 @@ FormIO::readPropertyValue(TQDomNode node, TQObject *obj, const TQString &name) ///////////////////////////////////////////////////////////////////////////// void -FormIO::saveWidget(ObjectTreeItem *item, TQDomElement &tqparent, TQDomDocument &domDoc, bool insideGridLayout) +FormIO::saveWidget(ObjectTreeItem *item, TQDomElement &parent, TQDomDocument &domDoc, bool insideGridLayout) { if (!item) return; @@ -917,7 +917,7 @@ FormIO::saveWidget(ObjectTreeItem *item, TQDomElement &tqparent, TQDomDocument & // we let Spring class handle saving itself if(item->className() == "Spring") { - Spring::saveSpring(item, tqparent, domDoc, insideGridLayout); + Spring::saveSpring(item, parent, domDoc, insideGridLayout); return; } @@ -926,7 +926,7 @@ FormIO::saveWidget(ObjectTreeItem *item, TQDomElement &tqparent, TQDomDocument & if(!m_currentForm) // copying widget { resetCurrentForm = true; - m_currentForm = item->container() ? item->container()->form() : item->tqparent()->container()->form(); + m_currentForm = item->container() ? item->container()->form() : item->parent()->container()->form(); } @@ -934,11 +934,11 @@ FormIO::saveWidget(ObjectTreeItem *item, TQDomElement &tqparent, TQDomDocument & // if(item->container()) // lib = item->container()->form()->manager()->lib(); // else -// lib = item->tqparent()->container()->form()->manager()->lib(); +// lib = item->parent()->container()->form()->manager()->lib(); // We create the "widget" element TQDomElement tclass = domDoc.createElement("widget"); - tqparent.appendChild(tclass); + parent.appendChild(tclass); if(insideGridLayout) { @@ -951,7 +951,7 @@ FormIO::saveWidget(ObjectTreeItem *item, TQDomElement &tqparent, TQDomDocument & } } - if(!item->tqparent()) // Toplevel widget + if(!item->parent()) // Toplevel widget tclass.setAttribute("class", TQWIDGET_OBJECT_NAME_STRING); // For compatibility, HBox, VBox and Grid are saved as TQLAYOUTWIDGET_OBJECT_NAME_STRING else if(item->widget()->isA("HBox") || item->widget()->isA("VBox") || item->widget()->isA("Grid") @@ -971,15 +971,15 @@ FormIO::saveWidget(ObjectTreeItem *item, TQDomElement &tqparent, TQDomDocument & // if (-1 != item->widget()->tqmetaObject()->findProperty("dataSource")) // savePropertyValue(tclass, domDoc, "dataSource", item->widget()->property("dataSource"), item->widget()); - // We don't want to save the tqgeometry if the widget is inside a tqlayout (so tqparent.tagName() == "grid" for example) - if(item && !item->tqparent()) { + // We don't want to save the tqgeometry if the widget is inside a tqlayout (so parent.tagName() == "grid" for example) + if(item && !item->parent()) { // save form widget size, but not its position savePropertyValue(tclass, domDoc, "geometry", TQRect( TQPoint(0,0), item->widget()->size()), item->widget()); } // normal widget (if == "UI', it means we're copying widget) - else if(tqparent.tagName() == "widget" || tqparent.tagName() == "UI") + else if(parent.tagName() == "widget" || parent.tagName() == "UI") savePropertyValue(tclass, domDoc, "geometry", item->widget()->property("geometry"), item->widget()); // Save the buddy widget for a label @@ -1116,7 +1116,7 @@ FormIO::cleanClipboard(TQDomElement &uiElement) } void -FormIO::loadWidget(Container *container, const TQDomElement &el, TQWidget *tqparent) +FormIO::loadWidget(Container *container, const TQDomElement &el, TQWidget *parent) { bool resetCurrentForm = false; if(!m_currentForm) // pasting widget @@ -1187,11 +1187,11 @@ FormIO::loadWidget(Container *container, const TQDomElement &el, TQWidget *tqpar widgetOptions ^= WidgetFactory::DesignViewMode; } - if(!tqparent) + if(!parent) w = container->form()->library()->createWidget(classname, container->widget(), wname.latin1(), container, widgetOptions); else - w = container->form()->library()->createWidget(classname, tqparent, wname.latin1(), + w = container->form()->library()->createWidget(classname, parent, wname.latin1(), container, widgetOptions); } @@ -1213,12 +1213,12 @@ FormIO::loadWidget(Container *container, const TQDomElement &el, TQWidget *tqpar // not yet created item = new ObjectTreeItem(container->form()->library()->displayName(classname), wname, w, container); - if(tqparent) { - ObjectTreeItem *titem = container->form()->objectTree()->lookup(tqparent->name()); + if(parent) { + ObjectTreeItem *titem = container->form()->objectTree()->lookup(parent->name()); if(titem) container->form()->objectTree()->addItem(titem, item); else - kdDebug() << "FORMIO :: ERROR no tqparent widget " << endl; + kdDebug() << "FORMIO :: ERROR no parent widget " << endl; } else container->form()->objectTree()->addItem(container->objectTree(), item); |