@ -72,8 +72,8 @@ ClearMountsJob::exec()
process . start ( ) ;
process . waitForFinished ( ) ;
QString partitions = process . readAllStandardOutput ( ) ;
QStringList partitionsList = partitions . simplified ( ) . split ( ' ' ) ;
const QString partitions = process . readAllStandardOutput ( ) ;
const QStringList partitionsList = partitions . simplified ( ) . split ( ' ' ) ;
// Build a list of partitions of type 82 (Linux swap / Solaris).
// We then need to clear them just in case they contain something resumable from a
@ -100,7 +100,8 @@ ClearMountsJob::exec()
* it = ( * it ) . simplified ( ) . split ( ' ' ) . first ( ) ;
}
foreach ( QString mapperPath , getCryptoDevices ( ) )
const QStringList cryptoDevices = getCryptoDevices ( ) ;
for ( const QString & mapperPath : cryptoDevices )
{
tryUmount ( mapperPath ) ;
QString news = tryCryptoClose ( mapperPath ) ;
@ -113,8 +114,8 @@ ClearMountsJob::exec()
process . waitForFinished ( ) ;
if ( process . exitCode ( ) = = 0 ) //means LVM2 tools are installed
{
QStringList lvscanLines = QString : : fromLocal8Bit ( process . readAllStandardOutput ( ) ) . split ( ' \n ' ) ;
foreach ( const QString & lvscanLine , lvscanLines )
const QStringList lvscanLines = QString : : fromLocal8Bit ( process . readAllStandardOutput ( ) ) . split ( ' \n ' ) ;
for ( const QString & lvscanLine : lvscanLines )
{
QString lvPath = lvscanLine . simplified ( ) . split ( ' ' ) . value ( 1 ) ; //second column
lvPath = lvPath . replace ( ' \' ' , " " ) ;
@ -137,8 +138,8 @@ ClearMountsJob::exec()
{
QSet < QString > vgSet ;
QStringList pvdisplayLines = pvdisplayOutput . split ( ' \n ' ) ;
foreach ( const QString & pvdisplayLine , pvdisplayLines )
const QStringList pvdisplayLines = pvdisplayOutput . split ( ' \n ' ) ;
for ( const QString & pvdisplayLine : pvdisplayLines )
{
QString pvPath = pvdisplayLine . simplified ( ) . split ( ' ' ) . value ( 0 ) ;
QString vgName = pvdisplayLine . simplified ( ) . split ( ' ' ) . value ( 1 ) ;
@ -160,7 +161,8 @@ ClearMountsJob::exec()
else
cDebug ( ) < < " WARNING: this system does not seem to have LVM2 tools. " ;
foreach ( QString mapperPath , getCryptoDevices ( ) )
const QStringList cryptoDevices2 = getCryptoDevices ( ) ;
for ( const QString & mapperPath : cryptoDevices2 )
{
tryUmount ( mapperPath ) ;
QString news = tryCryptoClose ( mapperPath ) ;
@ -168,7 +170,7 @@ ClearMountsJob::exec()
goodNews . append ( news ) ;
}
foreach ( QString p , partitionsList )
for ( const QString & p : partitionsList )
{
QString partPath = QString ( " /dev/%1 " ) . arg ( p ) ;
@ -247,13 +249,13 @@ ClearMountsJob::tryCryptoClose( const QString& mapperPath )
QStringList
ClearMountsJob : : getCryptoDevices ( )
ClearMountsJob : : getCryptoDevices ( ) const
{
QDir mapperDir ( " /dev/mapper " ) ;
QFileInfoList fiList = mapperDir . entryInfoList ( QDir : : Files ) ;
const QFileInfoList fiList = mapperDir . entryInfoList ( QDir : : Files ) ;
QStringList list ;
QProcess process ;
foreach ( QFileInfo fi , fiList )
for ( const QFileInfo & fi : fiList )
{
if ( fi . baseName ( ) = = " control " )
continue ;