From fbe72b366305ae618c61c9b9a877c54b8d1b6a5d Mon Sep 17 00:00:00 2001 From: Teo Mrnjavac Date: Fri, 28 Oct 2016 09:23:33 +0200 Subject: [PATCH] Improve user-visible strings in SetPartFlagsJob. --- .../partition/jobs/SetPartitionFlagsJob.cpp | 76 +++++++++++++++---- 1 file changed, 63 insertions(+), 13 deletions(-) diff --git a/src/modules/partition/jobs/SetPartitionFlagsJob.cpp b/src/modules/partition/jobs/SetPartitionFlagsJob.cpp index c2304d16f..8c562450f 100644 --- a/src/modules/partition/jobs/SetPartitionFlagsJob.cpp +++ b/src/modules/partition/jobs/SetPartitionFlagsJob.cpp @@ -44,7 +44,15 @@ SetPartFlagsJob::SetPartFlagsJob( Device* device, QString SetPartFlagsJob::prettyName() const { - return tr( "Set flags on partition %1." ).arg( partition()->partitionPath() ); + if ( !partition()->partitionPath().isEmpty() ) + return tr( "Set flags on partition %1." ).arg( partition()->partitionPath() ); + + if ( !partition()->fileSystem().name().isEmpty() ) + return tr( "Set flags on %1MB %2 partition." ) + .arg( partition()->capacity() /1024 /1024) + .arg( partition()->fileSystem().name() ); + + return tr( "Set flags on new partition." ); } @@ -53,13 +61,34 @@ SetPartFlagsJob::prettyDescription() const { QStringList flagsList = PartitionTable::flagNames( m_flags ); if ( flagsList.count() == 0 ) - return tr( "Clear flags on partition %1." ) - .arg( partition()->partitionPath() ); + { + if ( !partition()->partitionPath().isEmpty() ) + return tr( "Clear flags on partition %1." ) + .arg( partition()->partitionPath() ); - return tr( "Flag partition %1 as " - "%2." ) - .arg( partition()->partitionPath() ) - .arg( flagsList.join( ", " ) ); + if ( !partition()->fileSystem().name().isEmpty() ) + return tr( "Clear flags on %1MB %2 partition." ) + .arg( partition()->capacity() /1024 /1024) + .arg( partition()->fileSystem().name() ); + + return tr( "Clear flags on new partition." ); + } + + if ( !partition()->partitionPath().isEmpty() ) + return tr( "Flag partition %1 as " + "%2." ) + .arg( partition()->partitionPath() ) + .arg( flagsList.join( ", " ) ); + + if ( !partition()->fileSystem().name().isEmpty() ) + return tr( "Flag %1MB %2 partition as " + "%3." ) + .arg( partition()->capacity() /1024 /1024) + .arg( partition()->fileSystem().name() ) + .arg( flagsList.join( ", " ) ); + + return tr( "Flag new partition as %1." ) + .arg( flagsList.join( ", " ) ); } @@ -68,13 +97,34 @@ SetPartFlagsJob::prettyStatusMessage() const { QStringList flagsList = PartitionTable::flagNames( m_flags ); if ( flagsList.count() == 0 ) - return tr( "Clearing flags on partition %1." ) - .arg( partition()->partitionPath() ); + { + if ( !partition()->partitionPath().isEmpty() ) + return tr( "Clearing flags on partition %1." ) + .arg( partition()->partitionPath() ); - return tr( "Setting flags %2 on partition " - "%1." ) - .arg( partition()->partitionPath() ) - .arg( flagsList.join( ", " ) ); + if ( !partition()->fileSystem().name().isEmpty() ) + return tr( "Clearing flags on %1MB %2 partition." ) + .arg( partition()->capacity() /1024 /1024) + .arg( partition()->fileSystem().name() ); + + return tr( "Clearing flags on new partition." ); + } + + if ( !partition()->partitionPath().isEmpty() ) + return tr( "Setting flags %2 on partition " + "%1." ) + .arg( partition()->partitionPath() ) + .arg( flagsList.join( ", " ) ); + + if ( !partition()->fileSystem().name().isEmpty() ) + return tr( "Setting flags %3 on " + "%1MB %2 partition." ) + .arg( partition()->capacity() /1024 /1024) + .arg( partition()->fileSystem().name() ) + .arg( flagsList.join( ", " ) ); + + return tr( "Setting flags %1 on new partition." ) + .arg( flagsList.join( ", " ) ); }