From kde-commits Tue Nov 09 14:56:59 2010 From: Kevin Ottens Date: Tue, 09 Nov 2010 14:56:59 +0000 To: kde-commits Subject: KDE/kdelibs/kdecore/kconfig_compiler Message-Id: <20101109145659.11C56AC89B () svn ! kde ! org> X-MARC-Message: https://marc.info/?l=kde-commits&m=128931466910362 SVN commit 1194706 by ervin: Really take the class we're inheriting from into account. M +11 -6 kconfig_compiler.cpp --- trunk/KDE/kdelibs/kdecore/kconfig_compiler/kconfig_compiler.cpp #1194705:1194706 @@ -979,7 +979,7 @@ QString fCap = e->name(); fCap[0] = fCap[0].toUpper(); - return " KConfigSkeleton::Item"+itemType( e->type() ) + + return " "+cfg.inherits+"::Item"+itemType( e->type() ) + " *item" + fCap + ( (!e->param().isEmpty())?(QString("[%1]").arg(e->paramMax()+1)) : QString()) + ";\n"; @@ -1027,7 +1027,7 @@ QString newItem( const QString &type, const QString &name, const QString &key, const QString &defaultValue, const CfgConfig &cfg, const QString ¶m = QString()) { - QString t = "new KConfigSkeleton::Item" + itemType( type ) + + QString t = "new "+cfg.inherits+"::Item" + itemType( type ) + "( currentGroup(), " + key + ", " + varPath( name, cfg ) + param; if ( type == "Enum" ) t += ", values" + name; if ( !defaultValue.isEmpty() ) { @@ -1493,7 +1493,12 @@ if ( !cfg.singleton && parameters.isEmpty() ) h << "#include " << endl; + if ( cfg.inherits=="KCoreConfigSkeleton" ) { + h << "#include " << endl; + } else { h << "#include " << endl; + } + h << "#include " << endl << endl; // Includes @@ -1938,7 +1943,7 @@ } cpp << endl << " // items" << endl; for( itEntry = entries.constBegin(); itEntry != entries.constEnd(); ++itEntry ) { - cpp << " KConfigSkeleton::Item" << itemType( (*itEntry)->type() ) << " *" << itemVar( *itEntry, cfg ); + cpp << " "+cfg.inherits+"::Item" << itemType( (*itEntry)->type() ) << " *" << itemVar( *itEntry, cfg ); if ( !(*itEntry)->param().isEmpty() ) cpp << QString("[%1]").arg( (*itEntry)->paramMax()+1 ); cpp << ";" << endl; } @@ -2057,13 +2062,13 @@ cpp << (*itEntry)->code() << endl; } if ( (*itEntry)->type() == "Enum" ) { - cpp << " QList values" + cpp << " QList<"+cfg.inherits+"::ItemEnum::Choice2> values" << (*itEntry)->name() << ";" << endl; const QList choices = (*itEntry)->choices().choices; QList::ConstIterator it; for( it = choices.constBegin(); it != choices.constEnd(); ++it ) { cpp << " {" << endl; - cpp << " KConfigSkeleton::ItemEnum::Choice2 choice;" << endl; + cpp << " "+cfg.inherits+"::ItemEnum::Choice2 choice;" << endl; cpp << " choice.name = QLatin1String(\"" << (*it).name << "\");" << endl; if ( cfg.setUserTexts ) { if ( !(*it).label.isEmpty() ) { @@ -2203,7 +2208,7 @@ if ( cfg.itemAccessors ) { cpp << endl; - cpp << "KConfigSkeleton::Item" << itemType( (*itEntry)->type() ) << " *" + cpp << cfg.inherits+"::Item" << itemType( (*itEntry)->type() ) << " *" << getFunction( n, cfg.className ) << "Item("; if ( !(*itEntry)->param().isEmpty() ) { cpp << " " << cppType( (*itEntry)->paramType() ) << " i ";