Use PMUtils::findPartitionByPath in PVS + fix back button in Alongside.

main
Teo Mrnjavac 10 years ago
parent 2347ead200
commit 08a2ab94e7

@ -21,6 +21,7 @@
#include <core/DeviceModel.h> #include <core/DeviceModel.h>
#include <core/PartitionCoreModule.h> #include <core/PartitionCoreModule.h>
#include <core/PartitionModel.h> #include <core/PartitionModel.h>
#include <core/PMUtils.h>
#include "core/partition.h" #include "core/partition.h"
#include "core/device.h" #include "core/device.h"
#include <gui/ChoicePage.h> #include <gui/ChoicePage.h>
@ -113,6 +114,7 @@ PartitionViewStep::PartitionViewStep( QObject* parent )
m_widget->addWidget( m_choicePage ); m_widget->addWidget( m_choicePage );
m_widget->addWidget( m_manualPartitionPage ); m_widget->addWidget( m_manualPartitionPage );
m_widget->addWidget( m_alongsidePage );
m_widget->addWidget( m_erasePage ); m_widget->addWidget( m_erasePage );
m_widget->removeWidget( waitingWidget ); m_widget->removeWidget( waitingWidget );
waitingWidget->deleteLater(); waitingWidget->deleteLater();
@ -240,7 +242,8 @@ bool
PartitionViewStep::isAtBeginning() const PartitionViewStep::isAtBeginning() const
{ {
if ( m_widget->currentWidget() == m_manualPartitionPage || if ( m_widget->currentWidget() == m_manualPartitionPage ||
m_widget->currentWidget() == m_erasePage ) m_widget->currentWidget() == m_erasePage ||
m_widget->currentWidget() == m_alongsidePage )
return false; return false;
return true; return true;
} }
@ -275,12 +278,8 @@ PartitionViewStep::canBeResized( const QString& partitionPath )
for ( int i = 0; i < dm->rowCount(); ++i ) for ( int i = 0; i < dm->rowCount(); ++i )
{ {
Device* dev = dm->deviceForIndex( dm->index( i ) ); Device* dev = dm->deviceForIndex( dm->index( i ) );
PartitionModel* pm = m_core->partitionModelForDevice( dev ); Partition* candidate = PMUtils::findPartitionByPath( { dev }, partitionWithOs );
for ( int j = 0; j < pm->rowCount(); ++j ) if ( candidate )
{
QModelIndex index = pm->index( j, 0 );
Partition* candidate = pm->partitionForIndex( index );
if ( candidate->partitionPath() == partitionWithOs )
{ {
cDebug() << "found Partition* for" << partitionWithOs; cDebug() << "found Partition* for" << partitionWithOs;
bool ok = false; bool ok = false;
@ -299,18 +298,12 @@ PartitionViewStep::canBeResized( const QString& partitionPath )
if ( ok && if ( ok &&
availableStorageB > requiredStorageB ) availableStorageB > requiredStorageB )
{ {
canResize = true; cDebug() << "Partition" << partitionWithOs << "authorized for resize + autopartition install.";
}
return true;
} }
if ( canResize )
break;
} }
if ( canResize )
break;
} }
cDebug() << "Partition" << partitionWithOs << "authorized for resize + autopartition install.";
return canResize;
} }
cDebug() << "Partition" << partitionWithOs << "CANNOT BE RESIZED FOR AUTOINSTALL."; cDebug() << "Partition" << partitionWithOs << "CANNOT BE RESIZED FOR AUTOINSTALL.";

Loading…
Cancel
Save