mirror of
https://github.com/qelectrotech/qelectrotech-source-mirror.git
synced 2025-12-17 20:50:34 +01:00
ElementLocation : Fix addToPath.
git-svn-id: svn+ssh://svn.tuxfamily.org/svnroot/qet/qet/trunk@4435 bfdf4180-ca20-0410-9c96-a3a8aa849046
This commit is contained in:
@@ -299,16 +299,28 @@ void ElementsLocation::setPath(const QString &path)
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
Ajoute une chaine au chemin
|
* @brief ElementsLocation::addToPath
|
||||||
@param string Chaine a ajouter
|
* Add a string to the actual path of this location
|
||||||
@return true si l'operation a reussi, false si l'operation n'a pas de sens.
|
* @param string
|
||||||
Par exemple, il n'y a pas de sens a vouloir ajouter quelque chose apres le
|
* @return True if the operation success
|
||||||
chemin d'un element.
|
*/
|
||||||
*/
|
bool ElementsLocation::addToPath(const QString &string)
|
||||||
bool ElementsLocation::addToPath(const QString &string) {
|
{
|
||||||
if (m_collection_path.endsWith(".elmt", Qt::CaseInsensitive)) return(false);
|
if (m_collection_path.endsWith(".elmt", Qt::CaseInsensitive))
|
||||||
if (!m_collection_path.endsWith("/") && !string.startsWith("/")) m_collection_path += "/";
|
{
|
||||||
m_collection_path += string;
|
qDebug() << "ElementsLocation::addToPath : Can't add string to the path of an element";
|
||||||
|
return(false);
|
||||||
|
}
|
||||||
|
|
||||||
|
QString added_path = string;
|
||||||
|
|
||||||
|
if (!m_collection_path.endsWith("/") && !added_path.startsWith("/"))
|
||||||
|
added_path.prepend("/");
|
||||||
|
|
||||||
|
if (isFileSystem())
|
||||||
|
m_file_system_path += added_path;
|
||||||
|
|
||||||
|
m_collection_path += added_path;
|
||||||
return(true);
|
return(true);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user