diff --git a/src/modules/netinstall/NetInstallPage.cpp b/src/modules/netinstall/NetInstallPage.cpp index 35086cb44..13e9418a4 100644 --- a/src/modules/netinstall/NetInstallPage.cpp +++ b/src/modules/netinstall/NetInstallPage.cpp @@ -154,6 +154,14 @@ NetInstallPage::dataIsHere() ui->groupswidget->header()->setSectionResizeMode( 0, QHeaderView::ResizeToContents ); ui->groupswidget->header()->setSectionResizeMode( 1, QHeaderView::Stretch ); + expandGroups(); + + emit checkReady( true ); +} + +void +NetInstallPage::expandGroups() +{ // Go backwards because expanding a group may cause rows to appear below it for ( int i = m_groups->rowCount() - 1; i >= 0; --i ) { @@ -163,8 +171,6 @@ NetInstallPage::dataIsHere() ui->groupswidget->setExpanded( index, true ); } } - - emit checkReady( true ); } PackageTreeItem::List @@ -203,6 +209,23 @@ NetInstallPage::loadGroupList( const QString& confUrl ) } } +void +NetInstallPage::loadGroupList( const QVariantList& l ) +{ + // This short-cuts through loading and just uses the data, + // containing cruft from dataIsHere() and readGroups(). + m_groups = new PackageModel( l ); + retranslate(); // For changed model + ui->groupswidget->setModel( m_groups ); + ui->groupswidget->header()->setSectionResizeMode( 0, QHeaderView::ResizeToContents ); + ui->groupswidget->header()->setSectionResizeMode( 1, QHeaderView::Stretch ); + + expandGroups(); + + emit checkReady( true ); +} + + void NetInstallPage::setRequired( bool b ) { diff --git a/src/modules/netinstall/NetInstallPage.h b/src/modules/netinstall/NetInstallPage.h index f9d7127e2..fdbdbac88 100644 --- a/src/modules/netinstall/NetInstallPage.h +++ b/src/modules/netinstall/NetInstallPage.h @@ -64,6 +64,8 @@ public: * displaying the page. */ void loadGroupList( const QString& url ); + /// @brief Retrieve pre-processed and fetched group data + void loadGroupList( const QVariantList& l ); // Sets the "required" state of netinstall data. Influences whether // corrupt or unavailable data causes checkReady() to be emitted @@ -90,6 +92,13 @@ private: // of this module to know the format expected of the YAML files. bool readGroups( const QByteArray& yamlData ); + /** @brief Expand entries that should be pre-expanded + * + * Follows the *expanded* key / the startExpanded field in the + * group entries of the model. Call this after filling up the model. + */ + void expandGroups(); + Ui::Page_NetInst* ui; std::unique_ptr< CalamaresUtils::Locale::TranslatedString > m_title; // Above the treeview diff --git a/src/modules/netinstall/NetInstallViewStep.cpp b/src/modules/netinstall/NetInstallViewStep.cpp index ba16d940c..9c8b186de 100644 --- a/src/modules/netinstall/NetInstallViewStep.cpp +++ b/src/modules/netinstall/NetInstallViewStep.cpp @@ -209,7 +209,15 @@ NetInstallViewStep::setConfigurationMap( const QVariantMap& configurationMap ) // Keep putting groupsUrl into the global storage, // even though it's no longer used for in-module data-passing. Calamares::JobQueue::instance()->globalStorage()->insert( "groupsUrl", groupsUrl ); - m_widget->loadGroupList( groupsUrl ); + if ( groupsUrl == QStringLiteral( "local" ) ) + { + QVariantList l = configurationMap.value( "groups" ).toList(); + m_widget->loadGroupList( l ); + } + else + { + m_widget->loadGroupList( groupsUrl ); + } } bool bogus = false;