New element panel : user can drag & drop item from project collection to another project collection

git-svn-id: svn+ssh://svn.tuxfamily.org/svnroot/qet/qet/trunk@4371 bfdf4180-ca20-0410-9c96-a3a8aa849046
This commit is contained in:
blacksun
2016-03-06 14:40:52 +00:00
parent 3192c8ccd7
commit 73e21c408d
6 changed files with 126 additions and 59 deletions

View File

@@ -125,22 +125,13 @@ ElementLocation ECHSFileToFile::copyElement(ElementLocation &source, ElementLoca
/******************************************************/
/**
* @brief ECHSFileToXml::ECHSFileToXml
* @param source
* @param destination
*/
ECHSFileToXml::ECHSFileToXml(ElementLocation &source, ElementLocation &destination) :
ECHSToXml::ECHSToXml(ElementLocation &source, ElementLocation &destination) :
ECHStrategy(source, destination)
{}
/**
* @brief ECHSFileToXml::copy
* @return
*/
ElementLocation ECHSFileToXml::copy()
ElementLocation ECHSToXml::copy()
{
if (!(m_source.isFileSystem() && m_destination.isDirectory() && m_destination.isProject())) return ElementLocation();
if (!(m_source.exist() && m_destination.isDirectory() && m_destination.isProject())) return ElementLocation();
//Check if the destination already have an item with the same name of the item to copy
ElementLocation location(m_destination.projectCollectionPath() + "/" + m_source.fileName());
@@ -186,7 +177,7 @@ ElementLocation ElementCollectionHandler::copy(ElementLocation &source, ElementL
if (!source.exist() || !destination.exist() || destination.isElement()) return ElementLocation();
if (source.isFileSystem() && destination.isFileSystem()) m_strategy = new ECHSFileToFile(source, destination);
else if (source.isFileSystem() && destination.isProject()) m_strategy = new ECHSFileToXml(source, destination);
else if (destination.isProject()) m_strategy = new ECHSToXml(source, destination);
if (m_strategy)
return m_strategy->copy();