[prev in list] [next in list] [prev in thread] [next in thread] 

List:       kde-commits
Subject:    KDE/kdepim/kode
From:       Andre Duffeck <andre () duffeck ! de>
Date:       2007-04-02 15:11:45
Message-ID: 1175526705.647529.3639.nullmailer () svn ! kde ! org
[Download RAW message or body]

SVN commit 649367 by duffeck:

Fix ComplexTypes with SimpleContent (extension only)


 M  +12 -1     kxforms/formcreator.cpp  
 M  +9 -0      kxml_compiler/parserxsd.cpp  
 M  +11 -1     kxml_compiler/schema.cpp  
 M  +5 -2      kxml_compiler/schema.h  


--- trunk/KDE/kdepim/kode/kxforms/formcreator.cpp #649366:649367
@@ -166,10 +166,21 @@
   if( element.text() ) {
     XmlBuilder *textInput = 0;
     textInput = section->tag( "xf:textarea" );
-    textInput->attribute( "ref", "." );
+    textInput->attribute( "ref", (path + Reference( element.name() ) ).toString() );
     createLabel( textInput, element );
     applyCommonHints( textInput, element.name() );
     mCollapsedForms.append( element.name() );
+  } else if( element.baseType() != Schema::Node::None ) {
+    XmlBuilder *textInput = 0;
+    if ( element.baseType() == Schema::Node::NormalizedString ) {
+      textInput = section->tag( "xf:input" );
+    } else {
+      textInput = section->tag( "xf:textarea" );
+    }
+    textInput->attribute( "ref", (path + Reference( element.name() ) ).toString() );
+    createLabel( textInput, element );
+    applyCommonHints( textInput, element.name() );
+    mCollapsedForms.append( element.name() );
   }
   else {
     foreach( Schema::Relation r, element.elementRelations() ) {
--- trunk/KDE/kdepim/kode/kxml_compiler/parserxsd.cpp #649366:649367
@@ -105,6 +105,15 @@
         qDebug() << "  Mixed";
       }
       e.setText( true );
+    } else if ( complexType.contentModel() == XSD::XSDType::SIMPLE &&
+            !complexType.baseTypeName().isEmpty() ) {
+      if ( complexType.baseTypeName().qname() == "xs:string" ) {
+        e.setBaseType( Schema::Node::String );
+      } else if ( complexType.baseTypeName().qname() == "xs:normalizedString" ) {
+        e.setBaseType( Schema::Node::NormalizedString );
+      } else if ( complexType.baseTypeName().qname() == "xs:token" ) {
+        e.setBaseType( Schema::Node::Token );
+      }
     }
 
     if ( element.type().qname() == "xs:string" ) {
--- trunk/KDE/kdepim/kode/kxml_compiler/schema.cpp #649366:649367
@@ -222,7 +222,7 @@
 
 
 Node::Node()
-  : mType( String )
+  : mType( String ), mBaseType( None )
 {
 }
 
@@ -260,6 +260,16 @@
   return mName;
 }
 
+void Node::setBaseType( Type type )
+{
+  mBaseType = type;
+}
+
+Node::Type Node::baseType() const
+{
+  return mBaseType;
+}
+
 bool Node::isValid() const
 {
   return !mIdentifier.isEmpty() && !mName.isEmpty();
--- trunk/KDE/kdepim/kode/kxml_compiler/schema.h #649366:649367
@@ -88,8 +88,7 @@
 class KSCHEMA_EXPORT Node : public Annotatable
 {
   public:
-    enum Type { String, NormalizedString, Token, Enumeration, ComplexType };
-  
+    enum Type { None, String, NormalizedString, Token, Enumeration, ComplexType };
     Node();
     virtual ~Node();
 
@@ -102,6 +101,9 @@
     void setName( const QString & );
     QString name() const;
 
+    void setBaseType( Type );
+    Type baseType() const;
+
     virtual QString ref() const = 0;
 
     bool isValid() const;
@@ -113,6 +115,7 @@
     Type mType;
     QString mIdentifier;
     QString mName;
+    Type mBaseType;
 
     QStringList mEnumerationValues;
 };
[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic