From 081f27e3ea5903e0bdda95558246f62812b8719c Mon Sep 17 00:00:00 2001
From: Oswald Buddenhagen <oswald.buddenhagen@nokia.com>
Date: Thu, 11 Feb 2010 14:13:59 +0100
Subject: [PATCH] process second arg of include()

---
 src/shared/proparser/profileevaluator.cpp | 21 ++++++++++++++++-----
 1 file changed, 16 insertions(+), 5 deletions(-)

diff --git a/src/shared/proparser/profileevaluator.cpp b/src/shared/proparser/profileevaluator.cpp
index d9d36c7ee28..f9224d4ffca 100644
--- a/src/shared/proparser/profileevaluator.cpp
+++ b/src/shared/proparser/profileevaluator.cpp
@@ -2698,18 +2698,29 @@ ProItem::ProItemReturn ProFileEvaluator::Private::evaluateConditionalFunction(
             if ((args.count() == 2) || (args.count() == 3) ) {
                 parseInto = args[1];
             } else if (args.count() != 1) {
-                logMessage(format("include(file) requires one, two or three arguments."));
+                logMessage(format("include(file, into, silent) requires one, two or three arguments."));
                 return ProItem::ReturnFalse;
             }
-            State sts = m_sts;
-            bool ok = evaluateFile(resolvePath(expandEnvVars(args.first())));
-            m_sts = sts;
+            QString fn = resolvePath(expandEnvVars(args.first()));
+            bool ok;
+            if (parseInto.isEmpty()) {
+                State sts = m_sts;
+                ok = evaluateFile(fn);
+                m_sts = sts;
+            } else {
+                QHash<QString, QStringList> symbols;
+                if ((ok = evaluateFileInto(fn, &symbols, 0)))
+                    for (QHash<QString, QStringList>::ConstIterator it = symbols.constBegin();
+                         it != symbols.constEnd(); ++it)
+                        if (!it.key().startsWith(QLatin1Char('.')))
+                            m_valuemapStack.top().insert(parseInto + QLatin1Char('.') + it.key(),
+                                                         it.value());
+            }
             return returnBool(ok);
         }
         case T_LOAD: {
             if (m_skipLevel && !m_cumulative)
                 return ProItem::ReturnFalse;
-            QString parseInto;
             bool ignore_error = false;
             if (args.count() == 2) {
                 QString sarg = args[1];
-- 
GitLab