Commit 435ff5df authored by dt's avatar dt
Browse files

For adding files use the "primary" variable for each file type.

That is e.g. SOURCES instead of whatever variable is used first in the
project file.

Reviewed-By: ossi
parent 79dae814
......@@ -735,7 +735,9 @@ void Qt4PriFileNode::changeFiles(const FileType fileType,
QDir priFileDir = QDir(m_qt4ProFileNode->m_projectDir);
if (change == AddToProFile) {
ProWriter::addFiles(includeFile, &lines, priFileDir, filePaths, vars);
// Use the first variable for adding.
// Yes, that's broken for adding objective c sources or other stuff.
ProWriter::addFiles(includeFile, &lines, priFileDir, filePaths, vars.first());
notChanged->clear();
} else { // RemoveFromProFile
*notChanged = ProWriter::removeFiles(includeFile, &lines, priFileDir, filePaths, vars);
......
......@@ -37,13 +37,13 @@ using namespace Qt4ProjectManager::Internal;
void ProWriter::addFiles(ProFile *profile, QStringList *lines,
const QDir &proFileDir, const QStringList &filePaths,
const QStringList &vars)
const QString &var)
{
// Check if variable item exists as child of root item
for (ProItem *item = profile->items(); item; item = item->next()) {
if (item->kind() == ProItem::VariableKind) {
ProVariable *proVar = static_cast<ProVariable*>(item);
if (vars.contains(proVar->variable())
if (var == proVar->variable()
&& proVar->variableOperator() != ProVariable::RemoveOperator
&& proVar->variableOperator() != ProVariable::ReplaceOperator) {
......@@ -78,7 +78,7 @@ void ProWriter::addFiles(ProFile *profile, QStringList *lines,
}
// Create & append new variable item
QString added = QLatin1Char('\n') + vars.first() + QLatin1String(" +=");
QString added = QLatin1Char('\n') + var + QLatin1String(" +=");
foreach (const QString &filePath, filePaths)
added += QLatin1String(" \\\n ") + proFileDir.relativeFilePath(filePath);
*lines << added;
......
......@@ -47,7 +47,7 @@ class ProWriter
public:
static void addFiles(ProFile *profile, QStringList *lines,
const QDir &proFileDir, const QStringList &filePaths,
const QStringList &vars);
const QString &var);
static QStringList removeFiles(ProFile *profile, QStringList *lines,
const QDir &proFileDir, const QStringList &filePaths,
const QStringList &vars);
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment