399 lineinfo.first, lineinfo.second); |
399 lineinfo.first, lineinfo.second); |
400 } else if (!WidgetInfo::isValidSlot(receiverClass, slot)) { |
400 } else if (!WidgetInfo::isValidSlot(receiverClass, slot)) { |
401 bool resolved = false; |
401 bool resolved = false; |
402 if (objName == receiver) { |
402 if (objName == receiver) { |
403 // see if it's a custom slot |
403 // see if it's a custom slot |
404 foreach (QString cs, ui_custom_slots) { |
404 foreach (const QString &cs, ui_custom_slots) { |
405 if (cs == slot) { |
405 if (cs == slot) { |
406 resolved = true; |
406 resolved = true; |
407 break; |
407 break; |
408 } |
408 } |
409 } |
409 } |
472 customWidget->setElementClass(customClass); |
472 customWidget->setElementClass(customClass); |
473 customWidget->setElementExtends(baseClass); |
473 customWidget->setElementExtends(baseClass); |
474 |
474 |
475 // Magic header generation feature for legacy KDE forms |
475 // Magic header generation feature for legacy KDE forms |
476 // (for example, filesharing/advanced/kcm_sambaconf/share.ui) |
476 // (for example, filesharing/advanced/kcm_sambaconf/share.ui) |
477 if (implicitIncludes && isKDEClass(customClass)) { |
477 if ((m_options & ImplicitIncludes) && isKDEClass(customClass)) { |
478 QString header = customClass.toLower(); |
478 QString header = customClass.toLower(); |
479 header += QLatin1String(".h"); |
479 header += QLatin1String(".h"); |
480 DomHeader *domHeader = new DomHeader; |
480 DomHeader *domHeader = new DomHeader; |
481 domHeader->setText(header); |
481 domHeader->setText(header); |
482 domHeader->setAttributeLocation(QLatin1String("global")); |
482 domHeader->setAttributeLocation(QLatin1String("global")); |
708 DomActionRef *a = new DomActionRef(); |
708 DomActionRef *a = new DomActionRef(); |
709 a->setAttributeName(QLatin1String("separator")); |
709 a->setAttributeName(QLatin1String("separator")); |
710 ui_action_list.append(a); |
710 ui_action_list.append(a); |
711 } else if (t == QLatin1String("property")) { |
711 } else if (t == QLatin1String("property")) { |
712 // skip the property it is already handled by createProperties |
712 // skip the property it is already handled by createProperties |
713 |
713 const QString name = e.attribute(QLatin1String("name")); // change the varname this widget |
714 QString name = e.attribute(QLatin1String("name")); // change the varname this widget |
714 if (name == QLatin1String("name")) { |
715 if (name == QLatin1String("name")) |
715 // Do not name QLayoutWidget if layout names are to be used. |
716 ui_widget->setAttributeName(DomTool::readProperty(w, QLatin1String("name"), QVariant()).toString()); |
716 const bool applyName = !(m_options & PreserveLayoutNames) || className != QLatin1String("QLayoutWidget"); |
|
717 if (applyName) |
|
718 ui_widget->setAttributeName(DomTool::readProperty(w, QLatin1String("name"), QVariant()).toString()); |
|
719 } |
717 } else if (t == QLatin1String("row")) { |
720 } else if (t == QLatin1String("row")) { |
718 DomRow *row = new DomRow(); |
721 DomRow *row = new DomRow(); |
719 row->read(e); |
722 row->read(e); |
720 ui_row_list.append(row); |
723 ui_row_list.append(row); |
721 } else if (t == QLatin1String("column")) { |
724 } else if (t == QLatin1String("column")) { |
795 |
798 |
796 lay->setAttributeClass(className); |
799 lay->setAttributeClass(className); |
797 |
800 |
798 createProperties(w, &ui_property_list, className); |
801 createProperties(w, &ui_property_list, className); |
799 createAttributes(w, &ui_attribute_list, className); |
802 createAttributes(w, &ui_attribute_list, className); |
|
803 if (m_options & PreserveLayoutNames) { |
|
804 const QString layoutName = getLayoutName(w); |
|
805 if (!layoutName.isEmpty()) |
|
806 lay->setAttributeName(layoutName); |
|
807 } |
800 |
808 |
801 QDomElement e = w.firstChild().toElement(); |
809 QDomElement e = w.firstChild().toElement(); |
802 while (!e.isNull()) { |
810 while (!e.isNull()) { |
803 QString t = e.tagName().toLower(); |
811 QString t = e.tagName().toLower(); |
804 if (t == QLatin1String("vbox") |
812 if (t == QLatin1String("vbox") |
1112 |
1120 |
1113 // resolve the flags and enumerator |
1121 // resolve the flags and enumerator |
1114 if (prop->kind() == DomProperty::Set) { |
1122 if (prop->kind() == DomProperty::Set) { |
1115 QStringList flags = prop->elementSet().split(QLatin1Char('|')); |
1123 QStringList flags = prop->elementSet().split(QLatin1Char('|')); |
1116 QStringList v; |
1124 QStringList v; |
1117 foreach (QString fl, flags) { |
1125 foreach (const QString &fl, flags) { |
1118 QString e = WidgetInfo::resolveEnumerator(className, fl); |
1126 QString e = WidgetInfo::resolveEnumerator(className, fl); |
1119 if (e.isEmpty()) { |
1127 if (e.isEmpty()) { |
1120 e = m_porting->renameEnumerator(className + QLatin1String("::") + fl); |
1128 e = m_porting->renameEnumerator(className + QLatin1String("::") + fl); |
1121 } |
1129 } |
1122 |
1130 |
1273 QString Ui3Reader::fixType(const QString &t) const |
1281 QString Ui3Reader::fixType(const QString &t) const |
1274 { |
1282 { |
1275 QString newText = t; |
1283 QString newText = t; |
1276 //split type name on <>*& and whitespace |
1284 //split type name on <>*& and whitespace |
1277 QStringList typeNames = t.split(QRegExp(QLatin1String("<|>|\\*|&| ")), QString::SkipEmptyParts); |
1285 QStringList typeNames = t.split(QRegExp(QLatin1String("<|>|\\*|&| ")), QString::SkipEmptyParts); |
1278 foreach(QString typeName , typeNames) { |
1286 foreach(const QString &typeName , typeNames) { |
1279 QString newName = fixClassName(typeName); |
1287 QString newName = fixClassName(typeName); |
1280 if( newName != typeName ) { |
1288 if( newName != typeName ) { |
1281 newText.replace(typeName, newName); |
1289 newText.replace(typeName, newName); |
1282 } |
1290 } |
1283 } |
1291 } |