From 348a7730489478f549c33727d41f9dd4e26a4215 2017-07-13 08:18:09 From: Alexandre Leroux Date: 2017-07-13 08:18:09 Subject: [PATCH] Hack to download first component of a parameter if the parameter is a vector The hack will be removed when download of vectors will be implemented --- diff --git a/plugins/amda/src/AmdaPlugin.cpp b/plugins/amda/src/AmdaPlugin.cpp index 1fd9955..f1f6436 100644 --- a/plugins/amda/src/AmdaPlugin.cpp +++ b/plugins/amda/src/AmdaPlugin.cpp @@ -1,4 +1,5 @@ #include "AmdaPlugin.h" +#include "AmdaDefs.h" #include "AmdaParser.h" #include "AmdaProvider.h" @@ -31,6 +32,15 @@ void associateActions(DataSourceItem &item, const QUuid &dataSourceUid) const auto itemType = item.type(); if (itemType == DataSourceItemType::PRODUCT) { + /// @todo : As for the moment we do not manage the loading of vectors, in the case of a + /// parameter, we update the identifier of download of the data: + /// - if the parameter has no component, the identifier remains the same + /// - if the parameter has at least one component, the identifier is that of the first + /// component (for example, "imf" becomes "imf (0)") + if (item.childCount() != 0) { + item.setData(AMDA_XML_ID_KEY, item.child(0)->data(AMDA_XML_ID_KEY)); + } + addLoadAction(QObject::tr("Load %1 product").arg(item.name())); } else if (itemType == DataSourceItemType::COMPONENT) {