[luksbootkeyfile] Refactor static function to outside class
This commit is contained in:
parent
7d7d4c69ef
commit
efd409cf78
@ -66,6 +66,31 @@ struct LuksDevice
|
||||
QString passphrase;
|
||||
};
|
||||
|
||||
/** @brief Extract the luks passphrases setup.
|
||||
*
|
||||
* Given a list of partitions (as set up by the partitioning module,
|
||||
* so there's maps with keys inside), returns just the list of
|
||||
* luks passphrases for each device.
|
||||
*/
|
||||
static QList< LuksDevice >
|
||||
getLuksDevices( const QVariantList& list )
|
||||
{
|
||||
QList< LuksDevice > luksItems;
|
||||
|
||||
for ( const auto& p : list )
|
||||
{
|
||||
if ( p.canConvert< QVariantMap >() )
|
||||
{
|
||||
LuksDevice d( p.toMap() );
|
||||
if ( d.isValid )
|
||||
{
|
||||
luksItems.append( d );
|
||||
}
|
||||
}
|
||||
}
|
||||
return luksItems;
|
||||
}
|
||||
|
||||
struct LuksDeviceList
|
||||
{
|
||||
LuksDeviceList( const QVariant& partitions )
|
||||
@ -78,31 +103,6 @@ struct LuksDeviceList
|
||||
}
|
||||
}
|
||||
|
||||
/** @brief Extract the luks passphrases setup.
|
||||
*
|
||||
* Given a list of partitions (as set up by the partitioning module,
|
||||
* so there's maps with keys inside), returns just the list of
|
||||
* luks passphrases for each device.
|
||||
*/
|
||||
static QList< LuksDevice >
|
||||
getLuksDevices( const QVariantList& list )
|
||||
{
|
||||
QList< LuksDevice > luksItems;
|
||||
|
||||
for ( const auto& p : list )
|
||||
{
|
||||
if ( p.canConvert< QVariantMap >() )
|
||||
{
|
||||
LuksDevice d( p.toMap() );
|
||||
if ( d.isValid )
|
||||
{
|
||||
luksItems.append( d );
|
||||
}
|
||||
}
|
||||
}
|
||||
return luksItems;
|
||||
}
|
||||
|
||||
QList< LuksDevice > devices;
|
||||
bool valid;
|
||||
};
|
||||
|
Loading…
Reference in New Issue
Block a user