@ -539,7 +539,14 @@ bool UBDocumentTreeModel::setData(const QModelIndex &index, const QVariant &valu
if ( ! index . isValid ( ) | | value . toString ( ) . isEmpty ( ) ) {
return false ;
}
setNewName ( index , value . toString ( ) ) ;
QString fullNewName = value . toString ( ) ;
if ( isCatalog ( index ) )
{
fullNewName . replace ( ' / ' , ' - ' ) ;
}
setNewName ( index , fullNewName ) ;
return true ;
}
return QAbstractItemModel : : setData ( index , value , role ) ;
@ -1019,7 +1026,7 @@ QString UBDocumentTreeModel::virtualPathForIndex(const QModelIndex &pIndex) cons
return virtualDirForIndex ( pIndex ) + " / " + curNode - > nodeName ( ) ;
}
QStringList UBDocumentTreeModel : : nodeNameList ( const QModelIndex & pIndex ) const
QStringList UBDocumentTreeModel : : nodeNameList ( const QModelIndex & pIndex , bool distinctNodeType ) const
{
QStringList result ;
@ -1030,12 +1037,21 @@ QStringList UBDocumentTreeModel::nodeNameList(const QModelIndex &pIndex) const
foreach ( UBDocumentTreeNode * curNode , catalog - > children ( ) )
{
/* this function is only used (at this time) to compare filenames eachother, so it has to distinguish a folder named "A" from a file named "A"
// notice that it is a really poor way to search for file indexes, and that the code where it is called should be entirely reworked, when the time permits it. */
if ( curNode - > nodeType ( ) ! = UBDocumentTreeNode : : Catalog )
result < < curNode - > nodeName ( ) ;
if ( distinctNodeType )
{
if ( curNode - > nodeType ( ) = = UBDocumentTreeNode : : Catalog )
{
result < < " folder - " + curNode - > nodeName ( ) ;
}
else
{
result < < curNode - > nodeName ( ) ;
}
}
else
result < < " folder - " + curNode - > nodeName ( ) ;
{
result < < curNode - > nodeName ( ) ;
}
}
return result ;
@ -1166,7 +1182,6 @@ void UBDocumentTreeModel::setNewName(const QModelIndex &index, const QString &ne
QString magicSeparator = " +!##s " ;
if ( isCatalog ( index ) ) {
QString fullNewName = newName ;
fullNewName . replace ( ' / ' , ' - ' ) ;
if ( ! newName . contains ( magicSeparator ) ) {
indexNode - > setNodeName ( fullNewName ) ;
QString virtualDir = virtualDirForIndex ( index ) ;