Add some more string guesswork to labels view, with FS pretty names.

This commit is contained in:
Teo Mrnjavac 2015-12-16 15:48:25 +01:00
parent df13b3ba08
commit fd33eb71ba

View File

@ -26,6 +26,7 @@
#include <utils/Logger.h> #include <utils/Logger.h>
#include <kpmcore/core/device.h> #include <kpmcore/core/device.h>
#include <kpmcore/fs/filesystem.h>
#include <KFormat> #include <KFormat>
@ -155,13 +156,9 @@ PartitionLabelsView::buildTexts( const QModelIndex& index ) const
else if ( mountPoint == "/boot" ) else if ( mountPoint == "/boot" )
firstLine = tr( "Boot" ); firstLine = tr( "Boot" );
else if ( mountPoint.contains( "/efi" ) && else if ( mountPoint.contains( "/efi" ) &&
index.sibling( index.row(), index.data( PartitionModel::FileSystemTypeRole ).toInt() == FileSystem::Fat32 )
PartitionModel::FileSystemColumn )
.data().toString() == "fat32" )
firstLine = tr( "EFI system" ); firstLine = tr( "EFI system" );
else if ( index.sibling( index.row(), else if ( index.data( PartitionModel::FileSystemTypeRole ).toInt() == FileSystem::LinuxSwap )
PartitionModel::FileSystemColumn )
.data().toString() == "linuxswap" )
firstLine = tr( "Swap" ); firstLine = tr( "Swap" );
else else
firstLine = tr( "New partition for %1" ).arg( mountPoint ); firstLine = tr( "New partition for %1" ).arg( mountPoint );
@ -171,13 +168,19 @@ PartitionLabelsView::buildTexts( const QModelIndex& index ) const
else else
firstLine = index.data( PartitionModel::OsproberNameRole ).toString(); firstLine = index.data( PartitionModel::OsproberNameRole ).toString();
secondLine = tr( "%1 %2" ) if ( index.data( PartitionModel::IsFreeSpaceRole ).toBool() ||
.arg( index.sibling( index.row(), index.data( PartitionModel::FileSystemTypeRole ).toInt() == FileSystem::Extended )
PartitionModel::SizeColumn ) secondLine = index.sibling( index.row(),
.data().toString() ) PartitionModel::SizeColumn )
.arg( index.sibling( index.row(), .data().toString();
PartitionModel::FileSystemColumn ) else
.data().toString() ); secondLine = tr( "%1 %2" )
.arg( index.sibling( index.row(),
PartitionModel::SizeColumn )
.data().toString() )
.arg( index.sibling( index.row(),
PartitionModel::FileSystemColumn )
.data().toString() );
return { firstLine, secondLine }; return { firstLine, secondLine };
} }