FS: use untranslated name to identify filesystem
Resolves issue where 'linuxswap' is translated to 'Linux-Swap', for instance. FileSystem::name() provides a translated name, not an untranslated one. This should move to KPMCore. FIXES #797
This commit is contained in:
parent
174800b262
commit
fa6728b47c
@ -78,6 +78,50 @@ getLuksUuid( const QString& path )
|
|||||||
return uuid;
|
return uuid;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// TODO: this will be available from KPMCore soon
|
||||||
|
static const char* filesystem_labels[] = {
|
||||||
|
"unknown",
|
||||||
|
"extended",
|
||||||
|
|
||||||
|
"ext2",
|
||||||
|
"ext3",
|
||||||
|
"ext4",
|
||||||
|
"linuxswap",
|
||||||
|
"fat16",
|
||||||
|
"fat32",
|
||||||
|
"ntfs",
|
||||||
|
"reiser",
|
||||||
|
"reiser4",
|
||||||
|
"xfs",
|
||||||
|
"jfs",
|
||||||
|
"hfs",
|
||||||
|
"hfsplus",
|
||||||
|
"ufs",
|
||||||
|
"unformatted",
|
||||||
|
"btrfs",
|
||||||
|
"hpfs",
|
||||||
|
"luks",
|
||||||
|
"ocfs2",
|
||||||
|
"zfs",
|
||||||
|
"exfat",
|
||||||
|
"nilfs2",
|
||||||
|
"lvm2 pv",
|
||||||
|
"f2fs",
|
||||||
|
"udf",
|
||||||
|
"iso9660",
|
||||||
|
};
|
||||||
|
|
||||||
|
Q_STATIC_ASSERT_X((sizeof(filesystem_labels) / sizeof(char *)) >= FileSystem::__lastType, "Mismatch in filesystem labels");
|
||||||
|
|
||||||
|
static QString
|
||||||
|
untranslatedTypeName(FileSystem::Type t)
|
||||||
|
{
|
||||||
|
|
||||||
|
Q_ASSERT( t >= 0 );
|
||||||
|
Q_ASSERT( t <= FileSystem::__lastType );
|
||||||
|
|
||||||
|
return QLatin1String(filesystem_labels[t]);
|
||||||
|
}
|
||||||
|
|
||||||
static QVariant
|
static QVariant
|
||||||
mapForPartition( Partition* partition, const QString& uuid )
|
mapForPartition( Partition* partition, const QString& uuid )
|
||||||
@ -85,14 +129,15 @@ mapForPartition( Partition* partition, const QString& uuid )
|
|||||||
QVariantMap map;
|
QVariantMap map;
|
||||||
map[ "device" ] = partition->partitionPath();
|
map[ "device" ] = partition->partitionPath();
|
||||||
map[ "mountPoint" ] = PartitionInfo::mountPoint( partition );
|
map[ "mountPoint" ] = PartitionInfo::mountPoint( partition );
|
||||||
map[ "fs" ] = partition->fileSystem().name();
|
map[ "fsName" ] = partition->fileSystem().name();
|
||||||
|
map[ "fs" ] = untranslatedTypeName( partition->fileSystem().type() );
|
||||||
if ( partition->fileSystem().type() == FileSystem::Luks &&
|
if ( partition->fileSystem().type() == FileSystem::Luks &&
|
||||||
dynamic_cast< FS::luks& >( partition->fileSystem() ).innerFS() )
|
dynamic_cast< FS::luks& >( partition->fileSystem() ).innerFS() )
|
||||||
map[ "fs" ] = dynamic_cast< FS::luks& >( partition->fileSystem() ).innerFS()->name();
|
map[ "fs" ] = dynamic_cast< FS::luks& >( partition->fileSystem() ).innerFS()->name();
|
||||||
map[ "uuid" ] = uuid;
|
map[ "uuid" ] = uuid;
|
||||||
cDebug() << partition->partitionPath()
|
cDebug() << partition->partitionPath()
|
||||||
<< "mtpoint:" << PartitionInfo::mountPoint( partition )
|
<< "mtpoint:" << PartitionInfo::mountPoint( partition )
|
||||||
<< "fs:" << map[ "fs" ]
|
<< "fs:" << map[ "fs" ] << '(' << map[ "fsName" ] << ')'
|
||||||
<< uuid;
|
<< uuid;
|
||||||
|
|
||||||
if ( partition->roles().has( PartitionRole::Luks ) )
|
if ( partition->roles().has( PartitionRole::Luks ) )
|
||||||
|
Loading…
Reference in New Issue
Block a user