Skip to content
Permalink
Browse files
Don't append drive label if it's the same as the path
  • Loading branch information
nyalldawson committed Jul 2, 2021
1 parent e972e78 commit a4b78735be6b91ba38f9eb4f452faf5a3387547f
Showing with 2 additions and 2 deletions.
  1. +2 −2 src/core/browser/qgsbrowsermodel.cpp
@@ -122,7 +122,7 @@ void QgsBrowserModel::addRootItems()
continue;

const QString driveName = QStorageInfo( path ).displayName();
const QString name = driveName.isEmpty() ? path : QStringLiteral( "%1 (%2)" ).arg( path, driveName );
const QString name = driveName.isEmpty() || driveName == path ? path : QStringLiteral( "%1 (%2)" ).arg( path, driveName );

QgsDirectoryItem *item = new QgsDirectoryItem( nullptr, name, path, path, QStringLiteral( "special:Drives" ) );
item->setSortKey( QStringLiteral( " 3 %1" ).arg( path ) );
@@ -507,7 +507,7 @@ void QgsBrowserModel::refreshDrives()
if ( !mDriveItems.contains( path ) )
{
const QString driveName = QStorageInfo( path ).displayName();
const QString name = driveName.isEmpty() ? path : QStringLiteral( "%1 (%2)" ).arg( path, driveName );
const QString name = driveName.isEmpty() || driveName == path ? path : QStringLiteral( "%1 (%2)" ).arg( path, driveName );

QgsDirectoryItem *item = new QgsDirectoryItem( nullptr, name, path, path, QStringLiteral( "special:Drives" ) );
item->setSortKey( QStringLiteral( " 3 %1" ).arg( path ) );

0 comments on commit a4b7873

Please sign in to comment.