[netinstall] Improve 'next' button handling

- Document netinstall.conf a little,
 - Add setting *required* which influences whether next is enabled or not
   in case of missing or corrupt data,
 - Enable *next* button only once some (any!) data is received.

This can be used to disallow stepping past the netinstall step when
there is no data (e.g. internet has failed between the welcome page
and the netinstall page).
This commit is contained in:
Adriaan de Groot 2017-11-06 05:14:42 -05:00
parent 35f5612ec1
commit ee0b3b85dc
5 changed files with 47 additions and 13 deletions

View file

@ -57,14 +57,6 @@ NetInstallPage::NetInstallPage( QWidget* parent )
ui->setupUi( this );
}
bool
NetInstallPage::isReady()
{
// nothing to wait for, the data are immediately ready
// if the user does not select any group nothing is installed
return true;
}
bool
NetInstallPage::readGroups( const QByteArray& yamlData )
{
@ -92,10 +84,13 @@ NetInstallPage::readGroups( const QByteArray& yamlData )
void
NetInstallPage::dataIsHere( QNetworkReply* reply )
{
// If m_required is *false* then we still say we're ready
// even if the reply is corrupt or missing.
if ( reply->error() != QNetworkReply::NoError )
{
cDebug() << reply->errorString();
ui->netinst_status->setText( tr( "Network Installation. (Disabled: Unable to fetch package lists, check your network connection)" ) );
emit checkReady( !m_required );
return;
}
@ -104,6 +99,7 @@ NetInstallPage::dataIsHere( QNetworkReply* reply )
cDebug() << "Netinstall groups data was received, but invalid.";
ui->netinst_status->setText( tr( "Network Installation. (Disabled: Unable to fetch package lists, check your network connection)" ) );
reply->deleteLater();
emit checkReady( !m_required );
return;
}
@ -112,7 +108,7 @@ NetInstallPage::dataIsHere( QNetworkReply* reply )
ui->groupswidget->header()->setSectionResizeMode( 1, QHeaderView::Stretch );
reply->deleteLater();
emit checkReady( isReady() );
emit checkReady( true );
}
QList<PackageTreeItem::ItemData> NetInstallPage::selectedPackages() const
@ -139,6 +135,12 @@ void NetInstallPage::loadGroupList()
m_networkManager.get( request );
}
void NetInstallPage::setRequired(bool b)
{
m_required = b;
}
void NetInstallPage::onActivate()
{
ui->groupswidget->setFocus();