fix(flatpak): per-user install fallback and real error reporting

Installing through a system-wide remote fails under polkit and, when a
remote exists in both installations, flatpak refuses non-interactive
installs ("Multiple remotes have refs matching"). Retry with an explicit
`--user flathub` target, refresh appstream metadata before giving up on
stale refs, and let update/refresh fall back to the user installation as
well. Expose the last command output through IPackageManager::lastError
and show it in a dialog on failure instead of failing silently.

🤖 Generated with Codebuff
Co-Authored-By: Codebuff <noreply@codebuff.com>
This commit is contained in:
BlackAngelTV committed 2026-08-29 13:57:03 +02:00
1 parent 5cc85cac4a
commit 6aef549eb0
7 files changed
+144 -15

No files matched your search

+27 -2
View File
@@ -1099,6 +1099,14 @@ IPackageManager* MainWindow::providerFor(const std::string& id) const {
return available.empty() ? nullptr : available.front();
}
void MainWindow::showProviderError(const QString& title, IPackageManager* provider) {
if (!provider) return;
std::string err = provider->lastError();
if (!err.empty()) {
QMessageBox::warning(this, title, QString::fromStdString(err));
}
}
void MainWindow::clearCredentialsAfterUse() {
// In per-operation mode the password is single-use: drop it once the
// command ran so the next operation prompts again.
@@ -1489,6 +1497,7 @@ void MainWindow::onUpdate() {
statusBar()->showMessage("Mise à jour terminée");
} else {
statusBar()->showMessage("Échec de la mise à jour");
showProviderError("Échec de la mise à jour", provider);
}
m_historyManager->record({"", "update", m_selectedPackage.name,
provider->getName(), success});
@@ -1514,12 +1523,19 @@ void MainWindow::onUpdateAll() {
connect(worker, &InstallWorker::progress, this, [this](const QString& msg) {
statusBar()->showMessage(msg);
});
connect(worker, &InstallWorker::finished, this, [this](bool success) {
connect(worker, &InstallWorker::finished, this, [this, providers](bool success) {
setBusy(false);
if (success) {
statusBar()->showMessage("Tous les paquets sont à jour");
} else {
statusBar()->showMessage("Erreur lors de la mise à jour globale");
for (IPackageManager* pm : providers) {
if (!pm->lastError().empty()) {
QMessageBox::warning(this, "Erreur lors de la mise à jour globale",
QString::fromStdString(pm->lastError()));
break;
}
}
}
clearCredentialsAfterUse();
reloadCurrentView();
@@ -1544,12 +1560,19 @@ void MainWindow::onRefresh() {
connect(worker, &InstallWorker::progress, this, [this](const QString& msg) {
statusBar()->showMessage(msg);
});
connect(worker, &InstallWorker::finished, this, [this](bool success) {
connect(worker, &InstallWorker::finished, this, [this, providers](bool success) {
setBusy(false);
if (success) {
statusBar()->showMessage("Sources rafraîchies");
} else {
statusBar()->showMessage("Erreur lors du rafraîchissement");
for (IPackageManager* pm : providers) {
if (!pm->lastError().empty()) {
QMessageBox::warning(this, "Erreur lors du rafraîchissement",
QString::fromStdString(pm->lastError()));
break;
}
}
}
clearCredentialsAfterUse();
refreshDashboard();
@@ -1581,6 +1604,7 @@ void MainWindow::performInstall(const std::string& package) {
statusBar()->showMessage(
QString("Échec de l'installation de %1").arg(
QString::fromStdString(m_selectedPackage.name)));
showProviderError("Échec de l'installation", provider);
}
m_historyManager->record({"", "install", m_selectedPackage.name,
provider->getName(), success});
@@ -1615,6 +1639,7 @@ void MainWindow::performRemove(const std::string& package) {
statusBar()->showMessage(
QString("Échec de la suppression de %1").arg(
QString::fromStdString(m_selectedPackage.name)));
showProviderError("Échec de la suppression", provider);
}
m_historyManager->record({"", "remove", m_selectedPackage.name,
provider->getName(), success});