Split out a canBeResized overload that takes a Partition*.
This commit is contained in:
parent
984bc7ac08
commit
01eede3f6e
@ -35,23 +35,8 @@ namespace PartUtils
|
|||||||
{
|
{
|
||||||
|
|
||||||
bool
|
bool
|
||||||
canBeResized( PartitionCoreModule* core, const QString& partitionPath )
|
canBeResized( Partition* candidate )
|
||||||
{
|
{
|
||||||
//FIXME: check for max partitions count on DOS MBR
|
|
||||||
cDebug() << "checking if" << partitionPath << "can be resized.";
|
|
||||||
QString partitionWithOs = partitionPath;
|
|
||||||
if ( partitionWithOs.startsWith( "/dev/" ) )
|
|
||||||
{
|
|
||||||
cDebug() << partitionWithOs << "seems like a good path";
|
|
||||||
bool canResize = false;
|
|
||||||
DeviceModel* dm = core->deviceModel();
|
|
||||||
for ( int i = 0; i < dm->rowCount(); ++i )
|
|
||||||
{
|
|
||||||
Device* dev = dm->deviceForIndex( dm->index( i ) );
|
|
||||||
Partition* candidate = KPMHelpers::findPartitionByPath( { dev }, partitionWithOs );
|
|
||||||
if ( candidate )
|
|
||||||
{
|
|
||||||
cDebug() << "found Partition* for" << partitionWithOs;
|
|
||||||
if ( !candidate->fileSystem().supportGrow() ||
|
if ( !candidate->fileSystem().supportGrow() ||
|
||||||
!candidate->fileSystem().supportShrink() )
|
!candidate->fileSystem().supportShrink() )
|
||||||
return false;
|
return false;
|
||||||
@ -75,10 +60,33 @@ canBeResized( PartitionCoreModule* core, const QString& partitionPath )
|
|||||||
if ( ok &&
|
if ( ok &&
|
||||||
availableStorageB > requiredStorageB )
|
availableStorageB > requiredStorageB )
|
||||||
{
|
{
|
||||||
cDebug() << "Partition" << partitionWithOs << "authorized for resize + autopartition install.";
|
cDebug() << "Partition" << candidate->partitionPath() << "authorized for resize + autopartition install.";
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
bool
|
||||||
|
canBeResized( PartitionCoreModule* core, const QString& partitionPath )
|
||||||
|
{
|
||||||
|
//FIXME: check for max partitions count on DOS MBR
|
||||||
|
cDebug() << "checking if" << partitionPath << "can be resized.";
|
||||||
|
QString partitionWithOs = partitionPath;
|
||||||
|
if ( partitionWithOs.startsWith( "/dev/" ) )
|
||||||
|
{
|
||||||
|
cDebug() << partitionWithOs << "seems like a good path";
|
||||||
|
bool canResize = false;
|
||||||
|
DeviceModel* dm = core->deviceModel();
|
||||||
|
for ( int i = 0; i < dm->rowCount(); ++i )
|
||||||
|
{
|
||||||
|
Device* dev = dm->deviceForIndex( dm->index( i ) );
|
||||||
|
Partition* candidate = KPMHelpers::findPartitionByPath( { dev }, partitionWithOs );
|
||||||
|
if ( candidate )
|
||||||
|
{
|
||||||
|
cDebug() << "found Partition* for" << partitionWithOs;
|
||||||
|
return canBeResized( candidate );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -24,10 +24,13 @@
|
|||||||
#include <QString>
|
#include <QString>
|
||||||
|
|
||||||
class PartitionCoreModule;
|
class PartitionCoreModule;
|
||||||
|
class Partition;
|
||||||
|
|
||||||
namespace PartUtils
|
namespace PartUtils
|
||||||
{
|
{
|
||||||
|
|
||||||
|
bool canBeResized( Partition* candidate );
|
||||||
|
|
||||||
bool canBeResized( PartitionCoreModule* core, const QString& partitionPath );
|
bool canBeResized( PartitionCoreModule* core, const QString& partitionPath );
|
||||||
|
|
||||||
OsproberEntryList runOsprober( PartitionCoreModule* core );
|
OsproberEntryList runOsprober( PartitionCoreModule* core );
|
||||||
|
Loading…
Reference in New Issue
Block a user