135{
136 QDomElement actionPropElement = doc.documentElement().namedItem(QStringLiteral("ActionProperties")).toElement();
137
138 if (actionPropElement.isNull()) {
139 actionPropElement = doc.createElement(QStringLiteral("ActionProperties"));
140 doc.documentElement().appendChild(actionPropElement);
141 }
142
143
144
145
146 QDomNode actionNode = actionPropElement.firstChild();
147 while (!actionNode.isNull()) {
148 if (properties.contains(actionNode.toElement().attribute(QStringLiteral("name")))) {
149 QDomNode nextNode = actionNode.nextSibling();
150 actionPropElement.removeChild(actionNode);
151 actionNode = nextNode;
152 } else {
153 actionNode = actionNode.nextSibling();
154 }
155 }
156
157 ActionPropertiesMap::ConstIterator it = properties.begin();
158 const ActionPropertiesMap::ConstIterator end = properties.end();
159 for (; it != end; ++it) {
160 QDomElement action = doc.createElement(QStringLiteral("Action"));
161 action.setAttribute(QStringLiteral("name"), it.key());
162 actionPropElement.appendChild(action);
163
164 const QMap<QString, QString> attributes = (*it);
165 QMap<QString, QString>::ConstIterator attrIt = attributes.begin();
166 const QMap<QString, QString>::ConstIterator attrEnd = attributes.end();
167 for (; attrIt != attrEnd; ++attrIt) {
168 action.setAttribute(attrIt.key(), attrIt.value());
169 }
170 }
171}