mirror of
https://github.com/qelectrotech/qelectrotech-source-mirror.git
synced 2025-12-17 12:40:35 +01:00
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:
@@ -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.
|
||||
|
||||
Reference in New Issue
Block a user