[netinstall] Only wrap-up if the packages list is OK
Avoid situation where the YAML is ok but doesn't contain a list of netinstall packages, so the packages list (the model) is still empty. FIXES #1673
This commit is contained in:
parent
5241e25ae8
commit
3c398bd15e
@ -49,10 +49,12 @@ public:
|
|||||||
FailedNetworkError,
|
FailedNetworkError,
|
||||||
FailedBadData,
|
FailedBadData,
|
||||||
FailedNoData
|
FailedNoData
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
|
/// Human-readable, translated representation of the status
|
||||||
QString status() const;
|
QString status() const;
|
||||||
|
/// Internal code for the status
|
||||||
|
Status statusCode() const { return m_status; }
|
||||||
void setStatus( Status s );
|
void setStatus( Status s );
|
||||||
|
|
||||||
bool required() const { return m_required; }
|
bool required() const { return m_required; }
|
||||||
|
@ -25,6 +25,9 @@
|
|||||||
* On destruction, a new call to fetchNext() is queued, so that
|
* On destruction, a new call to fetchNext() is queued, so that
|
||||||
* the queue continues loading. Calling release() before the
|
* the queue continues loading. Calling release() before the
|
||||||
* destructor skips the fetchNext(), ending the queue-loading.
|
* destructor skips the fetchNext(), ending the queue-loading.
|
||||||
|
*
|
||||||
|
* Calling done(b) is the same as release(), **plus** done()
|
||||||
|
* is called on the queue if @p b is @c true.
|
||||||
*/
|
*/
|
||||||
class FetchNextUnless
|
class FetchNextUnless
|
||||||
{
|
{
|
||||||
@ -41,6 +44,14 @@ public:
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
void release() { m_q = nullptr; }
|
void release() { m_q = nullptr; }
|
||||||
|
void done( bool b )
|
||||||
|
{
|
||||||
|
if ( b && m_q )
|
||||||
|
{
|
||||||
|
QMetaObject::invokeMethod( m_q, "done", Qt::QueuedConnection );
|
||||||
|
}
|
||||||
|
release();
|
||||||
|
}
|
||||||
|
|
||||||
private:
|
private:
|
||||||
LoaderQueue* m_q = nullptr;
|
LoaderQueue* m_q = nullptr;
|
||||||
@ -138,7 +149,7 @@ LoaderQueue::fetch( const QUrl& url )
|
|||||||
void
|
void
|
||||||
LoaderQueue::dataArrived()
|
LoaderQueue::dataArrived()
|
||||||
{
|
{
|
||||||
FetchNextUnless finished( this );
|
FetchNextUnless next( this );
|
||||||
|
|
||||||
if ( !m_reply || !m_reply->isFinished() )
|
if ( !m_reply || !m_reply->isFinished() )
|
||||||
{
|
{
|
||||||
@ -170,16 +181,14 @@ LoaderQueue::dataArrived()
|
|||||||
|
|
||||||
if ( groups.IsSequence() )
|
if ( groups.IsSequence() )
|
||||||
{
|
{
|
||||||
finished.release();
|
|
||||||
m_config->loadGroupList( CalamaresUtils::yamlSequenceToVariant( groups ) );
|
m_config->loadGroupList( CalamaresUtils::yamlSequenceToVariant( groups ) );
|
||||||
emit done();
|
next.done( m_config->statusCode() == Config::Status::Ok );
|
||||||
}
|
}
|
||||||
else if ( groups.IsMap() )
|
else if ( groups.IsMap() )
|
||||||
{
|
{
|
||||||
finished.release();
|
|
||||||
auto map = CalamaresUtils::yamlMapToVariant( groups );
|
auto map = CalamaresUtils::yamlMapToVariant( groups );
|
||||||
m_config->loadGroupList( map.value( "groups" ).toList() );
|
m_config->loadGroupList( map.value( "groups" ).toList() );
|
||||||
emit done();
|
next.done( m_config->statusCode() == Config::Status::Ok );
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
Loading…
Reference in New Issue
Block a user