void ItemXML::moveTo(QDomNode& _parent, QDomNode& _predecessor) { // the corresponding syntax in DOM looks slightly different: _parent.insertAfter(node_, _predecessor); setModified(); }
QDomNode QDomNodeProto:: insertAfter(const QDomNode& newChild, const QDomNode& refChild) { QDomNode *item = qscriptvalue_cast<QDomNode*>(thisObject()); if (item) return item->insertAfter(newChild, refChild); return QDomNode(); }
void PathMapper::addHistory(const QString &localpath, const QString &serverpath, bool saveinproject) { bool exists = false; for (unsigned int cnt = 0; cnt < m_serverlist.count() && !exists; cnt++ ) if(m_serverlist[cnt] == serverpath && m_locallist[cnt] == localpath) exists = true; if(!exists) { if(saveinproject) { QDomNode node = pathMapperNode(); QDomNode newnode = Project::ref()->dom()->createElement("mapping"); QDomAttr serverattr = Project::ref()->dom()->createAttribute("serverpath"); serverattr.setValue(serverpath); QDomAttr localattr = Project::ref()->dom()->createAttribute("localpath"); localattr.setValue(localpath); newnode.attributes().setNamedItem(serverattr); newnode.attributes().setNamedItem(localattr); node = node.namedItem("mappings"); node.insertAfter(newnode, node.lastChild()); } m_serverlist.append(serverpath); m_locallist.append(localpath); } }
void PolicyDocumentClass::behaviourDown(const QString& patternName, const QString& behaviourName) { // get DOM node of the given pattern and behaviour // QDomNode patternNode = getPatternNode(patternName); QDomNode behaviourNode = getBehaviourNode(patternName, behaviourName); QDomNode nextBehaviourNode = getNextBehaviourNode(patternName,behaviourName); if (nextBehaviourNode.isNull()) return; // remove DOM node // patternNode.insertAfter(behaviourNode, nextBehaviourNode); }
//=========================================================================== void detectorTabWidget::reassignPosition(int from, int to) { int direction = from - to ; std::string tabLabelFrom = this->tabText(from).toStdString() ; std::string tabLabelTo = this->tabText(to ).toStdString() ; QDomNode parentNode = detectorMap_[tabLabelFrom].parentNode() ; if( direction > 0 ) // Insert after { parentNode.insertAfter(detectorMap_[tabLabelFrom],detectorMap_[tabLabelTo]) ; } else // Insert before { parentNode.insertBefore(detectorMap_[tabLabelFrom],detectorMap_[tabLabelTo]) ; } }