ElementsCategoryEditor : remove the use of ElementsCategory

git-svn-id: svn+ssh://svn.tuxfamily.org/svnroot/qet/qet/trunk@4475 bfdf4180-ca20-0410-9c96-a3a8aa849046
This commit is contained in:
blacksun
2016-05-12 15:41:55 +00:00
parent 432ab44c28
commit 5f93966984
8 changed files with 292 additions and 145 deletions

View File

@@ -465,6 +465,40 @@ bool XmlElementCollection::exist(const QString &path)
return true;
}
/**
* @brief XmlElementCollection::createDir
* Create a child directorie at path @path with the name @name.
* Emit directorieAdded if success.
* @param path : path of parent diectorie
* @param name : name of the directori to create.
* @param name_list : translation of the directorie name.
* @return true if creation success, if directorie already exist return true.
*/
bool XmlElementCollection::createDir(QString path, QString name, const NamesList &name_list)
{
QString new_dir_path = path + "/" + name;
if (!directory(new_dir_path).isNull()) {
return true;
}
QDomElement parent_dir = directory(path);
if (parent_dir.isNull()) {
qDebug() << "XmlElementCollection::createDir : directorie at path doesn't exist";
return false;
}
QDomElement new_dir = m_dom_document.createElement("category");
new_dir.setAttribute("name", name);
new_dir.appendChild(name_list.toXml(m_dom_document));
parent_dir.appendChild(new_dir);
emit directorieAdded(new_dir_path);
return true;
}
/**
* @brief XmlElementCollection::copyDirectory
* Copy the directory represented by source to destination.