feat(ui): load the updates list as soon as the tab opens

Clicking the Updates tab already triggered the check but showed a bare
empty table until it completed, and an "Update all" button that stayed
disabled for ever. The tab now shows a searching hint, reports "system
is up to date" on an empty result, reloads by itself when the core
frees up, and enables "Update all" without a row selection.

🤖 Generated with Codebuff
Co-Authored-By: Codebuff <noreply@codebuff.com>
This commit is contained in:
BlackAngelTV committed 2026-09-23 21:58:29 +02:00
1 parent b204d6814a
commit 2c7d99138d
3 files changed
+59

No files matched your search

+49
View File
@@ -154,6 +154,10 @@ BrowsePage::BrowsePage(AppCore* core, QWidget* parent) : Page(core, parent) {
m_table,
"Aucun paquet à afficher.\nLancez une recherche ou ouvrez la liste des "
"paquets installés.");
// The "Tout mettre à jour" button only makes sense on the updates tab, but
// there it must be usable without selecting a row first; the per-package
// buttons stay gated on the selection.
m_updateAllButton->setToolTip("Mettre à jour tous les paquets listés");
listLayout->addWidget(m_tableStack);
splitter->addWidget(listCard);
@@ -222,9 +226,24 @@ BrowsePage::BrowsePage(AppCore* core, QWidget* parent) : Page(core, parent) {
m_installed = results;
if (m_mode == Mode::Installed) onFilterChanged(m_filterBar->text());
} else if (mode == AppCore::ListMode::Updates) {
// The "searching" hint is replaced by the outcome: an empty
// result means the system is up to date, not that the check
// is still running.
if (results.empty()) {
ui::setEmptyStateText(
m_tableStack,
"Aucune mise à jour disponible.\nVotre système est à "
"jour.");
}
if (m_mode == Mode::Updates) populateTable(results);
}
});
connect(core, &AppCore::busyChanged, this, [this](bool busy) {
// A listing started from elsewhere (dashboard) while the user was
// already on the updates tab would leave it without data: reload now
// that the core is free again.
if (!busy && m_mode == Mode::Updates && isVisible()) reloadCurrentView();
});
connect(core, &AppCore::busyChanged, this, [this](bool busy) {
m_progressBar->setVisible(busy);
if (!busy) {
@@ -298,6 +317,19 @@ void BrowsePage::showInstalled(const QString& select) {
void BrowsePage::showUpdates() {
setMode(Mode::Updates);
// The update check is what the user came for: run it on every arrival on
// the tab (pacman caches its queries for a few seconds, so a click right
// after the dashboard loaded reuses that answer instead of respawning it).
// The "searching" hint replaces the empty-state text for the duration, so
// the tab never looks stuck on an empty table.
ui::setEmptyStateText(m_tableStack,
"Recherche des mises à jour en cours...\nLes résultats "
"s'afficheront automatiquement.");
if (core()->busy()) {
// Something else is loading (e.g. the dashboard asked for the counts):
// the busyChanged handler below reloads when the core frees up.
return;
}
start(core()->loadUpdates(), tr("Mises à jour"));
}
@@ -307,6 +339,23 @@ void BrowsePage::setMode(Mode mode) {
m_filterRow->setVisible(mode == Mode::Installed);
m_installButton->setVisible(mode == Mode::Search);
// "Tout mettre à jour" acts on the whole list, so it is only offered on the
// tab that displays pending updates; there it needs no row selection.
if (m_updateAllButton) {
m_updateAllButton->setVisible(mode == Mode::Updates);
m_updateAllButton->setEnabled(mode == Mode::Updates
&& core()->hasAvailableProvider());
}
// The updates tab rewrote the empty-state hint for its own states; restore
// the generic one so the other tabs never show a stale updates message.
if (mode != Mode::Updates) {
ui::setEmptyStateText(
m_tableStack,
"Aucun paquet à afficher.\nLancez une recherche ou ouvrez la liste des "
"paquets installés.");
}
// Clear any stale selection and reset the details panel
m_table->clearSelection();
resetDetails();