summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAndreas K. Hüttel <dilfridge@gentoo.org>2011-08-02 19:43:22 +0000
committerAndreas K. Hüttel <dilfridge@gentoo.org>2011-08-02 19:43:22 +0000
commit2455c6e2c548e94250e1ac8def8b89de7431a82a (patch)
treeca9d6781ca4710270191ecb5dd523f36459829e5 /kde-base/kdelibs/files
parentDon't install medium weight fonts as they look too bold in Qt, bug 370851. (diff)
downloadgentoo-2-2455c6e2c548e94250e1ac8def8b89de7431a82a.tar.gz
gentoo-2-2455c6e2c548e94250e1ac8def8b89de7431a82a.tar.bz2
gentoo-2-2455c6e2c548e94250e1ac8def8b89de7431a82a.zip
Backport patch so kdepim-4.4 and kdepim-4.6 builds with shared-desktop-ontologies-0.7
(Portage version: 2.1.10.9/cvs/Linux x86_64)
Diffstat (limited to 'kde-base/kdelibs/files')
-rw-r--r--kde-base/kdelibs/files/kdelibs-4.6.5-cardinality.patch323
1 files changed, 323 insertions, 0 deletions
diff --git a/kde-base/kdelibs/files/kdelibs-4.6.5-cardinality.patch b/kde-base/kdelibs/files/kdelibs-4.6.5-cardinality.patch
new file mode 100644
index 000000000000..cb892aec6a87
--- /dev/null
+++ b/kde-base/kdelibs/files/kdelibs-4.6.5-cardinality.patch
@@ -0,0 +1,323 @@
+commit 1f796983aa8385da77f30813041b40e208c17391
+Author: Vishesh Handa <handa.vish@gmail.com>
+Date: Thu May 19 20:52:30 2011 +0530
+
+ Make KDEPIM 4.6 compile with master
+
+ This makes the rcgen produce add/setProperty( QList<T> ) functions for
+ properties with nrl:maxCardinality and nrl:cardinality = 1. This was
+ required because with SDO 0.7 the cardinalities of many properties
+ have been set.
+
+ BUG: 268595
+
+diff --git a/nepomuk/rcgen/codegenerator.cpp b/nepomuk/rcgen/codegenerator.cpp
+index bc670e6..1bb2736 100644
+--- a/nepomuk/rcgen/codegenerator.cpp
++++ b/nepomuk/rcgen/codegenerator.cpp
+@@ -194,33 +194,28 @@ bool CodeGenerator::writeHeader( const ResourceClass *resourceClass, QTextStream
+ while( it.hasNext() ) {
+ const Property* p = it.next();
+
+- if( p->literalRange().isEmpty() &&
+- !p->range() ) {
+- if ( !quiet )
+- qDebug() << "(CodeGenerator::writeSource) type not defined for property: " << p->name() << endl;
+- continue;
+- }
+-
+- if ( m_mode == SafeMode ) {
+- ms << writeComment( QString("Get property '%1'. ").arg(p->name()) + p->comment(), 2*4 ) << endl;
+- ms << " " << m_code->propertyGetterDeclaration( p, resourceClass ) << ";" << endl;
+- ms << endl;
++ if( p->maxCardinality() == 1 || p->cardinality() == 1 ) {
++ Property * prop = const_cast<Property *>(p);
++ bool isList = prop->isList();
++
++ prop->setIsList( true );
++ if( !writePropertyHeader( prop, resourceClass, ms ) )
++ continue;
++
++ prop->setIsList( false );
++ if( !writePropertyHeader( prop, resourceClass, ms ) )
++ continue;
++
++ writePropertyUriHeader( prop, ms );
++
++ prop->setIsList( isList );
+ }
+-
+- ms << writeComment( QString("Set property '%1'. ").arg(p->name()) + p->comment(), 2*4 ) << endl;
+- ms << " " << m_code->propertySetterDeclaration( p, resourceClass ) << ";" << endl;
+- ms << endl;
+-
+- if( p->isList() ) {
+- ms << writeComment( QString("Add a value to property '%1'. ").arg(p->name()) + p->comment(), 2*4 ) << endl;
+- ms << " " << m_code->propertyAdderDeclaration( p, resourceClass ) << ";" << endl;
+- ms << endl;
++ else {
++ if( !writePropertyHeader( p, resourceClass, ms ) )
++ continue;
++ writePropertyUriHeader( p, ms );
+ }
+-
+- ms << writeComment( QString( "\\return The URI of the property '%1'." ).arg( p->name() ), 2*4 ) << endl;
+- ms << " " << "static QUrl " << p->name()[0].toLower() << p->name().mid(1) << "Uri();" << endl;
+- ms << endl;
+-
++
+ if( !p->hasSimpleType() )
+ includes.insert( p->typeString( true ) );
+ }
+@@ -299,6 +294,42 @@ bool CodeGenerator::writeHeader( const ResourceClass *resourceClass, QTextStream
+ return true;
+ }
+
++bool CodeGenerator::writePropertyHeader(const Property* p, const ResourceClass* resourceClass, QTextStream& ms) const
++{
++ if( p->literalRange().isEmpty() &&
++ !p->range() ) {
++ if ( !quiet )
++ qDebug() << "(CodeGenerator::writeSource) type not defined for property: " << p->name() << endl;
++ return false;
++ }
++
++ if ( m_mode == SafeMode ) {
++ ms << writeComment( QString("Get property '%1'. ").arg(p->name()) + p->comment(), 2*4 ) << endl;
++ ms << " " << m_code->propertyGetterDeclaration( p, resourceClass ) << ";" << endl;
++ ms << endl;
++ }
++
++ ms << writeComment( QString("Set property '%1'. ").arg(p->name()) + p->comment(), 2*4 ) << endl;
++ ms << " " << m_code->propertySetterDeclaration( p, resourceClass ) << ";" << endl;
++ ms << endl;
++
++ if( p->isList() ) {
++ ms << writeComment( QString("Add a value to property '%1'. ").arg(p->name()) + p->comment(), 2*4 ) << endl;
++ ms << " " << m_code->propertyAdderDeclaration( p, resourceClass ) << ";" << endl;
++ ms << endl;
++ }
++
++ return true;
++}
++
++void CodeGenerator::writePropertyUriHeader(const Property* p, QTextStream& ts) const
++{
++ ts << writeComment( QString( "\\return The URI of the property '%1'." ).arg( p->name() ), 2*4 ) << endl;
++ ts << " " << "static QUrl " << p->name()[0].toLower() << p->name().mid(1) << "Uri();" << endl;
++ ts << endl;
++}
++
++
+ bool CodeGenerator::writeSource( const ResourceClass* resourceClass, QTextStream& stream ) const
+ {
+ QString s = sourceTemplate( m_mode );
+@@ -318,29 +349,31 @@ bool CodeGenerator::writeSource( const ResourceClass* resourceClass, QTextStream
+ while( it.hasNext() ) {
+ const Property* p = it.next();
+
+- if( p->literalRange().isEmpty() &&
+- !p->range() ) {
+- if ( !quiet )
+- qDebug() << "(CodeGenerator::writeSource) type not defined for property: " << p->name() << endl;
+- continue;
++ if( p->maxCardinality() == 1 || p->cardinality() == 1 ) {
++ Property * prop = const_cast<Property *>(p);
++ bool isList = prop->isList();
++
++ prop->setIsList( true );
++ if( !writePropertySource( prop, resourceClass, ms ) )
++ continue;
++
++ prop->setIsList( false );
++ if( !writePropertySource( prop, resourceClass, ms ) )
++ continue;
++
++ writePropertyUriSource( prop, resourceClass, ms );
++
++ prop->setIsList( isList );
+ }
+-
++ else {
++ if( !writePropertySource( p, resourceClass, ms ) )
++ continue;
++ writePropertyUriSource( p, resourceClass, ms );
++ }
++
+ if ( !p->hasSimpleType() ) {
+ includes.append( QString( "#include \"%1.h\"" ).arg( p->typeString( true ).toLower() ) );
+ }
+-
+- if ( m_mode == SafeMode )
+- ms << m_code->propertyGetterDefinition( p, resourceClass ) << endl;
+-
+- ms << m_code->propertySetterDefinition( p, resourceClass ) << endl;
+- if( p->isList() )
+- ms << m_code->propertyAdderDefinition( p, resourceClass ) << endl;
+-
+- // write the static method that returns the property's Uri
+- ms << "QUrl " << resourceClass->name( m_nameSpace ) << "::" << p->name()[0].toLower() << p->name().mid(1) << "Uri()" << endl
+- << "{" << endl
+- << " return QUrl::fromEncoded(\"" << p->uri().toString() << "\");" << endl
+- << "}" << endl << endl;
+ }
+
+ it = resourceClass->allReverseProperties();
+@@ -395,6 +428,32 @@ bool CodeGenerator::writeSource( const ResourceClass* resourceClass, QTextStream
+ return true;
+ }
+
++bool CodeGenerator::writePropertySource(const Property* p, const ResourceClass* resourceClass, QTextStream& ms) const
++{
++ if( p->literalRange().isEmpty() && !p->range() ) {
++ if ( !quiet )
++ qDebug() << "(CodeGenerator::writeSource) type not defined for property: " << p->name() << endl;
++ return false;
++ }
++
++ if ( m_mode == SafeMode )
++ ms << m_code->propertyGetterDefinition( p, resourceClass ) << endl;
++
++ ms << m_code->propertySetterDefinition( p, resourceClass ) << endl;
++ if( p->isList() )
++ ms << m_code->propertyAdderDefinition( p, resourceClass ) << endl;
++
++ return true;
++}
++
++void CodeGenerator::writePropertyUriSource(const Property* p, const ResourceClass* resourceClass, QTextStream& ts) const
++{
++ // write the static method that returns the property's Uri
++ ts << "QUrl " << resourceClass->name( m_nameSpace ) << "::" << p->name()[0].toLower() << p->name().mid(1) << "Uri()" << endl
++ << "{" << endl
++ << " return QUrl::fromEncoded(\"" << p->uri().toString() << "\");" << endl
++ << "}" << endl << endl;
++}
+
+ bool CodeGenerator::writeSources( const QString& dir )
+ {
+diff --git a/nepomuk/rcgen/codegenerator.h b/nepomuk/rcgen/codegenerator.h
+index dc786a4..f26a875 100644
+--- a/nepomuk/rcgen/codegenerator.h
++++ b/nepomuk/rcgen/codegenerator.h
+@@ -22,6 +22,7 @@ class AbstractCode;
+ class ResourceClass;
+ class QString;
+ class QTextStream;
++class Property;
+
+ class CodeGenerator
+ {
+@@ -47,7 +48,13 @@ private:
+ bool writeHeader( const ResourceClass* resourceClass, QTextStream& ) const;
+ bool writeSource( const ResourceClass* resourceClass, QTextStream& ) const;
+ bool writeDummyClasses( const QString &folder ) const;
++
++ bool writePropertyHeader( const Property* p, const ResourceClass* resourceClass, QTextStream& ms ) const;
++ bool writePropertySource( const Property* p, const ResourceClass* resourceClass, QTextStream& ms ) const;
+
++ void writePropertyUriHeader( const Property* p, QTextStream& ts ) const;
++ void writePropertyUriSource( const Property* p, const ResourceClass* resourceClass, QTextStream& ts ) const;
++
+ QString visibilityHeader() const;
+ QString visibilityExportMacro() const;
+
+diff --git a/nepomuk/rcgen/ontologyparser.cpp b/nepomuk/rcgen/ontologyparser.cpp
+index 50e3397..f9f8673 100644
+--- a/nepomuk/rcgen/ontologyparser.cpp
++++ b/nepomuk/rcgen/ontologyparser.cpp
+@@ -164,7 +164,14 @@ bool OntologyParser::parse( const QString& filename, const QString& serializatio
+ }
+ else if( s.predicate().uri() == Soprano::Vocabulary::NRL::maxCardinality() ||
+ s.predicate().uri() == Soprano::Vocabulary::NRL::cardinality() ) {
+- d->getProperty(s.subject().uri())->setIsList( s.object().literal().toInt() > 1 );
++ Property * p = d->getProperty(s.subject().uri());
++ int cValue = s.object().literal().toInt();
++
++ p->setIsList( cValue > 1 );
++ if( s.predicate().uri() == Soprano::Vocabulary::NRL::maxCardinality() )
++ p->setMaxCardinality( cValue );
++ else
++ p->setCardinality( cValue );
+ }
+ else if( s.predicate().uri() == Soprano::Vocabulary::RDFS::comment() ) {
+ d->comments[s.subject().uri()] = s.object().literal().toString();
+diff --git a/nepomuk/rcgen/property.cpp b/nepomuk/rcgen/property.cpp
+index 1baa04c..51d9c07 100644
+--- a/nepomuk/rcgen/property.cpp
++++ b/nepomuk/rcgen/property.cpp
+@@ -27,7 +27,9 @@ Property::Property()
+ : m_range( 0 ),
+ m_isList( true ),
+ m_domain( 0 ),
+- m_inverseProperty( 0 )
++ m_inverseProperty( 0 ),
++ m_maxCardinality( -1 ),
++ m_cardinality( -1 )
+ {
+ }
+
+@@ -204,3 +206,24 @@ QString Property::literalTypeConversionMethod() const
+
+ return QString();
+ }
++
++void Property::setMaxCardinality(int value)
++{
++ m_maxCardinality = value;
++}
++
++int Property::maxCardinality() const
++{
++ return m_maxCardinality;
++}
++
++int Property::cardinality() const
++{
++ return m_cardinality;
++}
++
++void Property::setCardinality(int value)
++{
++ m_cardinality = value;
++}
++
+diff --git a/nepomuk/rcgen/property.h b/nepomuk/rcgen/property.h
+index a72ab5d..a09006d 100644
+--- a/nepomuk/rcgen/property.h
++++ b/nepomuk/rcgen/property.h
+@@ -139,6 +139,25 @@ public:
+ */
+ bool hasSimpleType() const;
+
++ /**
++ * Sets the max cardinality of the property
++ */
++ void setMaxCardinality( int value );
++
++ /**
++ * Returns the max cardinality of the property
++ */
++ int maxCardinality() const;
++
++ /**
++ * Sets the cardinality of the property
++ */
++ void setCardinality( int value );
++
++ /**
++ * Returns the cardinality of the property
++ */
++ int cardinality() const;
+ private:
+ QUrl m_uri;
+ ResourceClass* m_range;
+@@ -147,6 +166,8 @@ private:
+ bool m_isList;
+ ResourceClass* m_domain;
+ Property* m_inverseProperty;
++ int m_maxCardinality;
++ int m_cardinality;
+ };
+
+ #endif