From f4aa661b54fc8702bcfdea2c3d5082eb7bae38de Mon Sep 17 00:00:00 2001 From: BlackAngelTV Date: Fri, 9 Oct 2026 19:22:19 +0200 Subject: [PATCH 1/3] fix(logging): keep Qt's platform chatter out of the journal MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Opening a dialog under Wayland made Qt write a burst of qt.qpa warnings into the application journal — the text-input focus one, repeated at every prompt — where the user can do nothing with them: they describe the display server, not the application. Those categories stay on stderr from now on, next to everything else, while what the application logs (its own categories, and a bare qCWarning) keeps going to the journal. --- doc/depannage.md | 9 +++++++++ logging/log-manager.cpp | 39 ++++++++++++++++++++++++------------- logging/log-manager.h | 13 ++++++++++++- tests/app-settings.test.cpp | 39 +++++++++++++++++++++++++++++++++++++ 4 files changed, 85 insertions(+), 15 deletions(-) diff --git a/doc/depannage.md b/doc/depannage.md index 6c73faf..3ed4284 100644 --- a/doc/depannage.md +++ b/doc/depannage.md @@ -51,6 +51,15 @@ Depuis un paquet installé, la sortie part dans le journal : journalctl --user -f | grep pacmgr ``` +Le journal de l'application **ne reprend pas** la sortie interne de Qt : les +catégories de la couche graphique (`qt.qpa.*`, par exemple +`qt.qpa.wayland.textinput`, qui redit un avertissement de focus à chaque boîte de +dialogue ouverte sous Wayland) décrivent le serveur d'affichage, pas +l'application, et noieraient le journal sous des lignes sur lesquelles +l'utilisateur ne peut rien. Elles restent sur la sortie standard — c'est là +qu'un développeur les cherche — et tout ce que l'application journalise +d'elle-même (événements, commandes, `pacmgr.*`) y est toujours. + Les commandes réellement lancées par les fournisseurs y sont tracées (ligne `$ …`, cache `cache · …`, compteurs de résultats), ce qui permet de reproduire l'échec à la main dans un terminal. Le détail est dans diff --git a/logging/log-manager.cpp b/logging/log-manager.cpp index daeae16..a85d263 100644 --- a/logging/log-manager.cpp +++ b/logging/log-manager.cpp @@ -229,6 +229,13 @@ bool LogManager::hasEntries() const { return !readFile().isEmpty(); } +bool LogManager::journalsQtCategory(const QString& category) { + // Only the platform plugin is filtered. A category the application chose + // (pacmgr.*, the "default" one a bare qCWarning carries) describes what the + // app did and stays in the journal. + return !category.startsWith(QStringLiteral("qt.qpa")); +} + void LogManager::installQtMessageHandler() { // Make sure the singleton is created on the calling (main) thread before any // worker emits a log message. @@ -237,23 +244,27 @@ void LogManager::installQtMessageHandler() { qInstallMessageHandler([](QtMsgType type, const QMessageLogContext& context, const QString& message) { // Keep the usual console output too, so a developer still sees the logs - // in a terminal. - const char* category = context.category ? context.category : "default"; - std::fprintf(stderr, "[%s] %s\n", category, message.toLocal8Bit().constData()); + // in a terminal — including the platform chatter the journal leaves + // out. + const char* rawCategory = context.category ? context.category : "default"; + std::fprintf(stderr, "[%s] %s\n", rawCategory, message.toLocal8Bit().constData()); - QString level; - switch (type) { - case QtDebugMsg: level = QStringLiteral("debug"); break; - case QtInfoMsg: level = QStringLiteral("info"); break; - case QtWarningMsg: level = QCoreApplication::translate("LogManager", "avertissement"); break; - case QtCriticalMsg: level = QCoreApplication::translate("LogManager", "critique"); break; - case QtFatalMsg: level = QStringLiteral("fatal"); break; + const QString category = QString::fromLatin1(rawCategory); + if (journalsQtCategory(category)) { + QString level; + switch (type) { + case QtDebugMsg: level = QStringLiteral("debug"); break; + case QtInfoMsg: level = QStringLiteral("info"); break; + case QtWarningMsg: level = QCoreApplication::translate("LogManager", "avertissement"); break; + case QtCriticalMsg: level = QCoreApplication::translate("LogManager", "critique"); break; + case QtFatalMsg: level = QStringLiteral("fatal"); break; + } + + LogManager::instance().logEvent( + QStringLiteral("qt/%1").arg(category), + QStringLiteral("%1: %2").arg(level, message)); } - LogManager::instance().logEvent( - QStringLiteral("qt/%1").arg(QString::fromLatin1(category)), - QStringLiteral("%1: %2").arg(level, message)); - if (type == QtFatalMsg) std::abort(); }); } diff --git a/logging/log-manager.h b/logging/log-manager.h index 7564c7e..dfba792 100644 --- a/logging/log-manager.h +++ b/logging/log-manager.h @@ -33,7 +33,9 @@ // // Every Qt log message (qCDebug/qCInfo/qCWarning/qCCritical) is funnelled into // the same journal by installQtMessageHandler(), so the categories already used -// across the code base feed it without extra plumbing. +// across the code base feed it without extra plumbing. Qt's own platform +// categories (`qt.qpa.*`) are the one exception: they describe the display +// server, not the application, and stay on stderr (see journalsQtCategory). // // The file lives in the user's own data tree (XDG_CONFIG_HOME / home) so it is // never lost when a sandbox is rebuilt, and both that directory and a size cap @@ -87,6 +89,15 @@ public: // QApplication exists. Safe to call more than once. static void installQtMessageHandler(); + // Whether a Qt log category belongs in the journal at all. Qt's platform + // plugins (`qt.qpa.*`: xcb, wayland, ...) narrate the display server, not + // the application: the Wayland one, for instance, repeats a warning about + // its text-input focus for every dialog the user opens, which is a line the + // user can neither read nor act on. Those keep going to stderr, where a + // developer looks for them; everything the application itself logs — its + // own categories, and a bare qCWarning — still lands in the journal. + static bool journalsQtCategory(const QString& category); + signals: // The journal changed on disk and a fresh copy of its content is available. void fileUpdated(); diff --git a/tests/app-settings.test.cpp b/tests/app-settings.test.cpp index 249fdbe..56183f7 100644 --- a/tests/app-settings.test.cpp +++ b/tests/app-settings.test.cpp @@ -5,6 +5,7 @@ #include #include #include +#include #include #include #include @@ -271,6 +272,43 @@ void testJournalMovesAndRotates() { assert(journal.currentSizeBytes() > before); } +// Qt's platform plugins narrate the display server, not the application: the +// Wayland text-input warning, for one, repeats for every dialog the user opens, +// and a journal full of it is unreadable. Those categories stay on stderr; what +// the application logs — its own categories, and the "default" one a bare +// qCWarning carries — still lands in the journal. +void testPlatformChatterStaysOutOfTheJournal() { + // The decision itself first, so the test says which side a category is on + // even when nothing is written. + assert(LogManager::journalsQtCategory(QStringLiteral("default"))); + assert(LogManager::journalsQtCategory(QStringLiteral("pacmgr.update"))); + assert(LogManager::journalsQtCategory(QStringLiteral("qt.sql"))); + assert(!LogManager::journalsQtCategory(QStringLiteral("qt.qpa.wayland.textinput"))); + assert(!LogManager::journalsQtCategory(QStringLiteral("qt.qpa.xcb"))); + + resetSettings(); + AppSettings& prefs = AppSettings::instance(); + const QString dir = QDir::homePath() + QStringLiteral("/journal-c"); + QFile::remove(dir + QStringLiteral("/operations.log")); + prefs.setLogDirectory(dir); + prefs.setLogMaxBytes(0); + + LogManager::installQtMessageHandler(); + LogManager& journal = LogManager::instance(); + + // An event the application writes, then the warning Qt's Wayland plugin + // repeats: the first must be in the journal, the second must not. + journal.logEvent(QStringLiteral("ui"), QStringLiteral("mot de passe fourni")); + qCWarning(QLoggingCategory("qt.qpa.wayland.textinput")) + << "Trying to disable 0x1 but 0x2 is focused"; + qCWarning(QLoggingCategory("pacmgr.update")) << "une alerte de l'application"; + + const QString content = journal.readFile(); + assert(content.contains(QStringLiteral("mot de passe fourni"))); + assert(content.contains(QStringLiteral("une alerte de l'application"))); + assert(!content.contains(QStringLiteral("Trying to disable"))); +} + } // namespace int main(int argc, char* argv[]) { @@ -299,6 +337,7 @@ int main(int argc, char* argv[]) { testUpdateBlockIsPersistedAndCleared(); testAutomaticCheckCanBeTurnedOff(); testJournalMovesAndRotates(); + testPlatformChatterStaysOutOfTheJournal(); std::cout << "app-settings: all tests passed" << std::endl; return 0; From 55718064a656e0dc5a72fa78ae4c797df6c9245a Mon Sep 17 00:00:00 2001 From: BlackAngelTV Date: Fri, 9 Oct 2026 19:22:24 +0200 Subject: [PATCH 2/3] feat(files): confirm dropped files and refuse the ones already installed MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit A drop — or "Ouvrir avec PacManager" — answered nothing: a Flatpak install walked off into the background and a plugin package landed without a sound, so the gesture read as ignored. Both now open a dialog saying what was taken and what it starts. A file the machine already has is refused before anything runs, and named. The application a file would install is read out of the file itself (the [Flatpak Ref] section of a .flatpakref, the header of a .flatpak bundle, the manifest of a .fwspacm) and compared with what the provider has, so nothing is started to find out: Flatpak would otherwise skip the install and report a success the user never got, and a plugin package would silently replace the one in place. --- app/main-window.cpp | 84 +++++++- app/main-window.h | 10 +- core/app-core.cpp | 30 +++ core/app-core.h | 17 ++ doc/interface.md | 18 ++ doc/plugins.md | 1 + doc/tests.md | 12 +- include/sdk/package-manager.h | 20 ++ .../flatpak-provider/flatpak-manager.cpp | 110 ++++++++++- providers/flatpak-provider/flatpak-manager.h | 18 +- tests/app-core.test.cpp | 31 +++ tests/flatpak-manager.test.cpp | 187 ++++++++++++++++++ translations/de.json | 7 + translations/en.json | 7 + translations/es.json | 7 + translations/it.json | 7 + 16 files changed, 557 insertions(+), 9 deletions(-) diff --git a/app/main-window.cpp b/app/main-window.cpp index 2ba75ec..b643ca9 100644 --- a/app/main-window.cpp +++ b/app/main-window.cpp @@ -1070,14 +1070,36 @@ void MainWindow::dropEvent(QDropEvent* event) { void MainWindow::installLocalFiles(const QStringList& paths) { if (paths.isEmpty()) return; - QStringList files; + QStringList files; // handed to a provider, one at a time + QStringList plugins; // installed on the spot + QStringList installedPackages; // already on the machine: refused + QStringList installedPlugins; QStringList rejected; + for (const QString& path : paths) { + // A file whose application is already there is refused before anything + // runs: flatpak would skip it and report a success the user did not + // get, and re-installing a plugin package would silently replace the + // one in place. + const AppCore::FileTarget target = m_core->fileTarget(path); + if (target.installed) { + (target.plugin ? installedPlugins : installedPackages) << target.name; + LogManager::instance().logEvent( + QStringLiteral("fichier"), + tr("%1 : déjà installé, rien à faire").arg(target.name)); + continue; + } + // A plugin package is installed by the core straight away: it needs no // provider, no password and no queue, and the registry is reloaded when // it lands (see AppCore::installPluginPackage). if (m_core->isPluginPackage(path)) { m_core->installPluginPackage(path); + // Only announced when its manifest could be read: a package the + // reader refuses installs nothing and is reported by the Plugins + // screen, and the window must not promise an install that is not + // happening. + if (!target.name.isEmpty()) plugins << path; continue; } if (m_core->canInstallFile(path)) files << path; @@ -1094,6 +1116,11 @@ void MainWindow::installLocalFiles(const QStringList& paths) { .arg(QFileInfo(rejected.first()).fileName())); } + // Nothing else in the window would tell the user their gesture landed: a + // drop starts a background install, or a plugin goes in without a sound. + announceAcceptedFiles(files, plugins); + announceInstalledFiles(installedPackages, installedPlugins); + if (files.isEmpty()) return; LogManager::instance().logEvent( @@ -1103,6 +1130,61 @@ void MainWindow::installLocalFiles(const QStringList& paths) { if (!m_fileInstallRunning) startNextFileInstall(); } +// What the window says about the files it just took. Without it, a drop that +// starts a background install — or a plugin that lands silently — reads as a +// gesture the application ignored. +void MainWindow::announceAcceptedFiles(const QStringList& installing, + const QStringList& plugins) { + if (installing.isEmpty() && plugins.isEmpty()) return; + + QStringList lines; + for (const QString& path : installing) { + lines << tr("%1 pris en compte : l'installation démarre, sa " + "progression s'affiche en bas de la fenêtre.") + .arg(QFileInfo(path).fileName()); + } + for (const QString& path : plugins) { + lines << tr("%1 pris en compte : le plugin est installé et " + "utilisable sans redémarrer.") + .arg(QFileInfo(path).fileName()); + } + + QMessageBox box(this); + box.setWindowTitle(tr("Fichiers pris en compte")); + box.setIcon(QMessageBox::Information); + box.setTextFormat(Qt::RichText); + box.setText(lines.join(QStringLiteral("
"))); + box.setStandardButtons(QMessageBox::Ok); + box.exec(); +} + +// The other half of the answer: a file the machine already has is refused, and +// the user is told which one it is and what to do instead. +void MainWindow::announceInstalledFiles(const QStringList& packages, + const QStringList& plugins) { + if (packages.isEmpty() && plugins.isEmpty()) return; + + QStringList lines; + for (const QString& name : packages) { + lines << tr("%1 est déjà installé : il n'y a rien à installer. " + "Sa mise à jour se fait depuis l'écran des mises à jour.") + .arg(name); + } + for (const QString& name : plugins) { + lines << tr("%1 : ce plugin est déjà installé. Supprimez-le " + "depuis l'écran Extensions pour en installer un autre.") + .arg(name); + } + + QMessageBox box(this); + box.setWindowTitle(tr("Déjà installé")); + box.setIcon(QMessageBox::Information); + box.setTextFormat(Qt::RichText); + box.setText(lines.join(QStringLiteral("
"))); + box.setStandardButtons(QMessageBox::Ok); + box.exec(); +} + void MainWindow::startNextFileInstall() { if (m_pendingFileInstalls.isEmpty()) { m_fileInstallRunning = false; diff --git a/app/main-window.h b/app/main-window.h index 352ad09..1d29ca2 100644 --- a/app/main-window.h +++ b/app/main-window.h @@ -58,7 +58,9 @@ public: // Installs the Flatpak files handed over by the desktop: dropped on the // window, or opened from the file manager ("Ouvrir avec PacManager", which // passes them on the command line). One install runs at a time; the rest - // wait in line. Paths the core does not recognise are reported and skipped. + // wait in line. Paths the core does not recognise are reported and skipped, + // a file the machine already has is refused, and both answers are told to + // the user in a dialog — the gesture is the only thing they see. void installLocalFiles(const QStringList& paths); protected: @@ -174,6 +176,12 @@ private: // Takes the next queued file and asks the core to install it. A core busy // with another operation leaves it queued: onCoreActionFinished calls back. void startNextFileInstall(); + // What the user is told about the files just handed over: which ones were + // taken (and what each of them starts), and which ones were refused because + // the machine already has them. Two dialogs, since the two answers ask for + // different things from the user. + void announceAcceptedFiles(const QStringList& installing, const QStringList& plugins); + void announceInstalledFiles(const QStringList& packages, const QStringList& plugins); // Logic layer: it owns the providers, the workers, the history, the // credentials and the self-updater. The frame never talks to them directly. diff --git a/core/app-core.cpp b/core/app-core.cpp index ecd1982..5c34808 100644 --- a/core/app-core.cpp +++ b/core/app-core.cpp @@ -544,6 +544,36 @@ bool AppCore::isPluginPackage(const QString& path) const { return PluginPackage::isPackagePath(path); } +AppCore::FileTarget AppCore::fileTarget(const QString& path) const { + FileTarget target; + const QString clean = path.trimmed(); + if (clean.isEmpty()) return target; + + // A plugin package names itself in its own manifest, and the registry knows + // whether that plugin is already there. Read only: nothing is written + // before the window has decided what to tell the user. + if (isPluginPackage(clean)) { + QString error; + const PluginPackage::Contents contents = PluginPackage::read(clean, &error); + if (!error.isEmpty()) return target; // unusable: nothing to announce + target.name = contents.manifest.id; + target.plugin = true; + target.installed = m_packages->isInstalled(target.name); + return target; + } + + // A provider file: the provider owning the format names the application it + // would install, and answers whether it is already deployed. + for (IPackageManager* pm : availableProviders()) { + const std::string name = pm->fileTargetName(clean.toStdString()); + if (name.empty()) continue; + target.name = QString::fromStdString(name); + target.installed = pm->isPackageInstalled(name); + return target; + } + return target; +} + AppCore::StartResult AppCore::removePackages(const std::vector& packages, const QString& description) { Request request; request.action = QStringLiteral("cleanup"); diff --git a/core/app-core.h b/core/app-core.h index 0366433..cc623d8 100644 --- a/core/app-core.h +++ b/core/app-core.h @@ -121,6 +121,23 @@ public: // by a provider: they carry a plugin, they are not packages to install, so // they never take the sudo gate and never enter the file install queue. bool isPluginPackage(const QString& path) const; + + // What a file the user drops (or opens with PacManager) would install, and + // whether that application is already on the machine. Read before anything + // runs, so the view can refuse a file the provider would only skip — or an + // install that would silently do nothing — and say why. + struct FileTarget { + // Application id for a provider file ("com.example.App"), plugin id for + // a .fwspacm. Empty when the file names no single application: a + // .flatpakrepo registers a remote, and an unreadable file names + // nothing at all. + QString name; + bool installed = false; + // A .fwspacm carries a plugin, not a package: the two are refused with + // different advice. + bool plugin = false; + }; + FileTarget fileTarget(const QString& path) const; // Bulk removal: one command per provider, run one provider at a time // (pacman locks its database for the whole operation). StartResult removePackages(const std::vector& packages, diff --git a/doc/interface.md b/doc/interface.md index 7aa7809..9a55035 100644 --- a/doc/interface.md +++ b/doc/interface.md @@ -64,6 +64,24 @@ d'un coup s'installent **un par un** (le core n'accepte qu'une opération à la fois) ; un paquet `.fwspacm`, lui, s'installe immédiatement, sans mot de passe ni file d'attente. +Un fichier accepté est **confirmé par une boîte de dialogue** : elle nomme ce qui +vient d'être pris en compte et ce que cela déclenche (l'installation démarre et +sa progression s'affiche en bas de la fenêtre, ou le plugin est installé et +utilisable tout de suite). Sans elle, un dépôt qui lance une installation en +arrière-plan — ou qui pose un plugin sans un bruit — se lit comme un geste +ignoré. + +Le cadre refuse en revanche un fichier que la machine possède **déjà**. Le +fournisseur nomme l'application que le fichier installerait +(`fileTargetName()`) et répond s'il l'a déjà (`isPackageInstalled()`), sans rien +lancer : le nom est lu dans le fichier lui-même (section `[Flatpak Ref]` d'un +`.flatpakref`, en-tête d'un `.flatpak`, manifeste d'un `.fwspacm`) et comparé à +ce qui est installé. La boîte de dialogue dit alors quel fichier est déjà +installé et quoi faire à la place : mettre à jour depuis l'écran des mises à +jour, ou supprimer le plugin depuis l'écran Extensions. Sans ce contrôle, +Flatpak se contenterait de sauter l'installation et de renvoyer un succès que +l'utilisateur n'a pas eu. + Certains widgets refusent le dépôt (`setAcceptDrops(false)`) : un `.fwspacm` lâché sur le champ de recherche ou sur celui des logs doit être traité par la fenêtre, pas collé dans le filtre. diff --git a/doc/plugins.md b/doc/plugins.md index 24ee40d..62e5ca9 100644 --- a/doc/plugins.md +++ b/doc/plugins.md @@ -96,6 +96,7 @@ Copiez `providers/example-provider/example-provider.cpp` comme point de départ. | `canListCleanup()`, `listCleanupCandidates()`, `canCleanCache()`, `cleanCache()` | non | Page Nettoyage. Un fournisseur qui ne les implémente pas est simplement ignoré. | | `removePackages(names, callback)` | non | Suppression groupée en une commande. Le défaut (un `remove()` par entrée) convient aux `target` d'un paquet installé plusieurs fois (voir plus bas). | | `canInstallFile(path)`, `installFile(path, callback)` | non | Installation depuis un fichier du bureau (glisser-déposer, « Ouvrir avec PacManager »). Le fournisseur ne revendique que **ses** formats : Flatpak accepte `.flatpakref`, `.flatpakrepo` et `.flatpak`, et ignore le reste. | +| `fileTargetName(path)`, `isPackageInstalled(name)` | non | L'application qu'un fichier installerait, et si elle est déjà là. Lue dans le fichier sans rien exécuter (section `[Flatpak Ref]` d'une référence, en-tête d'un bundle), pour refuser un fichier déjà installé au lieu de lancer une installation qui ne ferait rien. Une chaîne vide (dépôt, format inconnu, fichier illisible) signifie « rien à comparer » : le fichier s'installe normalement. | `update("")` signifie **tout mettre à jour** : c'est ce que le worker appelle pour l'opération globale. diff --git a/doc/tests.md b/doc/tests.md index 0638ae5..f101ae7 100644 --- a/doc/tests.md +++ b/doc/tests.md @@ -16,17 +16,17 @@ lance qu'une partie (`ctest -R progress`). | Cible | Ce qu'elle couvre | Dépendances | | --- | --- | --- | | `pacman-manager-test` | Parsing de la sortie pacman : listes, mises à jour, orphelins/étrangers, commandes construites (`removePackagesCommand`, `cleanCacheCommand`) et détection des échecs (mot de passe, verrou). | Aucune (pas de pacman). | -| `flatpak-manager-test` | Parsing de la sortie Flatpak : recherche, listes, colonnes ; reconnaissance des formats de fichier (`.flatpakref`, `.flatpakrepo`, `.flatpak`, casse et URL) et commandes construites pour l'installation depuis un fichier (chemins entre guillemets compris) ; **installations multiples** : chaque copie nommée (`:`, version absente qui ne décale pas les colonnes), copies conservées après fusion des lignes, commandes de désinstallation et de mise à jour ciblant une copie. | Aucune. | +| `flatpak-manager-test` | Parsing de la sortie Flatpak : recherche, listes, colonnes ; reconnaissance des formats de fichier (`.flatpakref`, `.flatpakrepo`, `.flatpak`, casse et URL) et commandes construites pour l'installation depuis un fichier (chemins entre guillemets compris) ; **installations multiples** : chaque copie nommée (`:`, version absente qui ne décale pas les colonnes), copies conservées après fusion des lignes, commandes de désinstallation et de mise à jour ciblant une copie ; **ce qu'un fichier installerait** : application lue dans la section `[Flatpak Ref]` d'un `.flatpakref` et dans l'en-tête d'un `.flatpak` (octets réels d'un bundle), refus d'un nom absent, d'un identifiant non conforme (injection comprise), d'une magie absente ou d'un en-tête tronqué. | Aucune. | | `flatpak-integration-test` | **Le vrai CLI flatpak** : installation et désinstallation d'une petite application, liste, recherche, mise à jour — donc aussi le `DownloadWatcher` en conditions réelles. | `flatpak` (le test se saute s'il est absent). | | `aur-manager-test` | Parsing du helper AUR (yay/paru) et nettoyage des séquences ANSI. | Aucune. | | `package-utils-test` | Logique partagée de `package-manager.h` : fusion des doublons entre fournisseurs, tri par fournisseur puis par nom. | Aucune. | | `progress-tracker-test` | `ProgressTracker` : compteurs pacman/Flatpak, pourcentages seuls, phases pondérées, étapes non identifiables, monotonie, faux positifs ; exécution d'une commande (`/bin/sh` en une ligne) : suppression des séquences ANSI, remontage d'une sortie au fil de l'eau, dernière ligne sans retour à la ligne, jalons de progression d'une jauge « sur place ». | Aucune, **même pas Qt**. | | `plugin-package-test` | Le format `.fwspacm` : lecture d'une archive valide, les deux méthodes de compression, refus d'un manifeste illisible / sans `id` / d'un format inconnu / d'une bibliothèque absente ou à nom dangereux, somme de contrôle non conforme, bibliothèque vide ; recherche de la bibliothèque par suffixe et ambiguïté ; installation, réinstallation, désinstallation, et le fait qu'une bibliothèque copiée à la main n'est jamais supprimée. | Qt Core + zlib, aucun accès réseau. | -| `app-core-test` | La couche logique : portes d'entrée (opération en cours, mot de passe, providers), file d'attente des listes, historique, mode d'identification, refus d'un fichier qu'aucun fournisseur ne sait installer ; **porte du mot de passe** : chaque chemin privilégié (install, suppression, mise à jour, globale, rafraîchissement, caches, nettoyage groupé, suppression d'une ou de plusieurs installations, libération du verrou) s'arrête là, sans lancer de commande, et sa demande reste rejouable. | Qt Core seulement — **pas** QtWidgets. | +| `app-core-test` | La couche logique : portes d'entrée (opération en cours, mot de passe, providers), file d'attente des listes, historique, mode d'identification, refus d'un fichier qu'aucun fournisseur ne sait installer, et `fileTarget()` — un fichier illisible ou qu'aucun fournisseur ne revendique ne nomme rien, donc n'est jamais refusé à tort ; **porte du mot de passe** : chaque chemin privilégié (install, suppression, mise à jour, globale, rafraîchissement, caches, nettoyage groupé, suppression d'une ou de plusieurs installations, libération du verrou) s'arrête là, sans lancer de commande, et sa demande reste rejouable. | Qt Core seulement — **pas** QtWidgets. | | `update-manager-test` | Comparaison de versions, choix de la méthode de mise à jour, et le script d'installation, exécuté pour de vrai contre un binaire en cours d'exécution. | Qt Core + Network. | | `startup-check-test` | La **vérification au démarrage** : parsing des deux formats (`checkupdates` puis le repli `pacman -Qu`), classement d'un paquet comme critique ou nécessitant un redémarrage, texte de la notification (dont le plafond des paquets cités), et l'unité systemd écrite **dans une arborescence temporaire** — installation, activation, suppression — jamais dans le `~/.config` de l'utilisateur. | Qt Core seulement. | | `language-manager-test` | La langue : ce que le réglage résout (un code connu, un code inconnu, « système » suivant `LC_ALL`/`LC_MESSAGES`/`LANG` puis `/etc/locale.conf`, le suffixe `@mod` ignoré, une locale non couverte qui retombe sur la langue d'écriture) ; le catalogue JSON en'core (installé, chaîne traduite, chaîne inconnue qui retombe sur la source, une clé seule servie à tous les contextes) ; un catalogue cassé ou sans chaîne **refusé**, l'interface restant entière ; et la couverture : le catalogue anglais doit contenir **toute** chaîne que le code demande, sinon une chaîne se lirait en français dans une interface anglaise. | Qt Core + les ressources, aucun affichage. | -| `app-settings-test` | Les préférences : valeurs par défaut, valeurs refusées (dossier vide, langue inconnue, taille de journal aberrante), persistance après relecture, un réglage qui n'émet que s'il change, la politique de blocage des mises à jour (durée, expiration, indefini) et — pour de vrai — le **journal** : il atterrit dans le dossier choisi, accompagne un changement de dossier, tourne au plafond de taille et garde une version précédente. | Qt Core seulement. | +| `app-settings-test` | Les préférences : valeurs par défaut, valeurs refusées (dossier vide, langue inconnue, taille de journal aberrante), persistance après relecture, un réglage qui n'émet que s'il change, la politique de blocage des mises à jour (durée, expiration, indefini) et — pour de vrai — le **journal** : il atterrit dans le dossier choisi, accompagne un changement de dossier, tourne au plafond de taille et garde une version précédente ; le bavardage de la couche graphique de Qt (`qt.qpa.*`) reste sur la sortie standard au lieu de le remplir, alors que les alertes de l'application (et une `qCWarning` sans catégorie) y sont. | Qt Core seulement. | | `cli-command-test` | La **grammaire de la ligne de commande** : ce qui demande la CLI plutôt que la fenêtre (mot-clé ou option, contre un chemin ou un fichier `.flatpak`/`.fwspacm`) et ce que chaque mot-clé donne — recherche à plusieurs mots, install/suppression de plusieurs paquets, `maj` avec ou sans nom, commandes de lecture sans argument, `-y` lu partout, `--help`/`--version` prioritaires, commande ou option inconnue. | Qt Core seulement, rien n'est lancé. | ### Pourquoi `app-core-test` ne lie pas QtWidgets @@ -91,8 +91,10 @@ est donc autant une vérification de comportement qu'un garde-fou d'architecture - L'interface, y compris le glisser-déposer sur la fenêtre (fichiers Flatpak et paquets `.fwspacm`) : elle est vérifiée à la main (`./build/PacManager`). Le reste du chemin est couvert (reconnaissance des formats, refus d'un fichier - inconnu, lecture d'un paquet, commandes construites) ; seul le geste de la - souris ne l'est pas. Un aperçu + inconnu, lecture d'un paquet, commandes construites, application visée par le + fichier et présence sur la machine) ; seul le geste de la souris et les deux + boîtes de dialogue qui y répondent (prise en compte, déjà installé) ne sont + pas automatisés. Un aperçu hors écran reste possible en rendant la fenêtre avec `QT_QPA_PLATFORM=offscreen`, ce qui est utile pour vérifier une feuille de style (aucune alerte de parsing, couleurs attendues) sans écran. diff --git a/include/sdk/package-manager.h b/include/sdk/package-manager.h index df0ca4f..1433747 100644 --- a/include/sdk/package-manager.h +++ b/include/sdk/package-manager.h @@ -236,6 +236,26 @@ public: return false; } + // The application a file would install, as this provider names it + // internally ("com.example.App" for flatpak): a reference file spells it + // out, a bundle embeds it. Empty when the format is not this provider's, + // when the file names no single application (a .flatpakrepo only defines a + // remote), or when nothing can be read from it. Read without running + // anything, so the app can tell the user a file is already installed + // instead of starting an install that would do nothing. + virtual std::string fileTargetName(const std::string& path) const { + (void)path; + return {}; + } + + // Whether the provider already has that application, in any of its + // installations. A single lookup through the provider's own tool, cheap + // enough to run while the user is dropping a file. + virtual bool isPackageInstalled(const std::string& packageName) const { + (void)packageName; + return false; + } + // Check if the package manager is available on the system virtual bool isAvailable() const = 0; diff --git a/providers/flatpak-provider/flatpak-manager.cpp b/providers/flatpak-provider/flatpak-manager.cpp index a3822ee..4d94cf0 100644 --- a/providers/flatpak-provider/flatpak-manager.cpp +++ b/providers/flatpak-provider/flatpak-manager.cpp @@ -14,6 +14,7 @@ #include #include #include +#include #include #include #include @@ -363,6 +364,15 @@ static bool endsWith(const std::string& text, const std::string& suffix) { && text.compare(text.size() - suffix.size(), suffix.size(), suffix) == 0; } +// Leading and trailing blanks removed, for the INI lines of a .flatpakref. +static std::string trimmed(const std::string& text) { + std::size_t begin = 0; + std::size_t end = text.size(); + while (begin < end && std::isspace(static_cast(text[begin]))) ++begin; + while (end > begin && std::isspace(static_cast(text[end - 1]))) --end; + return text.substr(begin, end - begin); +} + // Quote one argument for the shell popen() runs, so a dropped file whose name // contains spaces or quotes still reaches flatpak as a single argument. static std::string shellQuote(const std::string& value) { @@ -536,6 +546,88 @@ std::string FlatpakManager::repoNamespace(const std::string& path) { return name.empty() ? "flatpak-repo" : name; } +std::string FlatpakManager::appIdFromRef(const std::string& ref) { + const std::size_t typeEnd = ref.find('/'); + if (typeEnd == std::string::npos) return {}; + const std::size_t idEnd = ref.find('/', typeEnd + 1); + if (idEnd == std::string::npos) return {}; + + // A ref is "///", and only the two kinds flatpak + // installs name an application here. + const std::string kind = ref.substr(0, typeEnd); + if (kind != "app" && kind != "runtime") return {}; + + const std::string id = ref.substr(typeEnd + 1, idEnd - typeEnd - 1); + return isAppId(id) ? id : std::string(); +} + +std::string FlatpakManager::appIdFromRefFile(const std::string& path) { + std::ifstream file(path); + if (!file) return {}; + + // A .flatpakref is an INI file whose [Flatpak Ref] section names the + // application flatpak will resolve (`Name=com.example.App`); the rest of it + // describes the remote. Only that section is read. + bool inRefSection = false; + std::string line; + while (std::getline(file, line)) { + const std::string text = trimmed(line); + if (text.empty() || text[0] == '#' || text[0] == ';') continue; + if (text[0] == '[') { + inRefSection = toLower(text) == "[flatpak ref]"; + continue; + } + if (!inRefSection) continue; + + const std::size_t equals = text.find('='); + if (equals == std::string::npos) continue; + if (toLower(trimmed(text.substr(0, equals))) != "name") continue; + + // Refused rather than handed back when it is not an application id: + // this comes straight out of a file the user dropped, and the caller + // passes it to flatpak. + const std::string id = trimmed(text.substr(equals + 1)); + return isAppId(id) ? id : std::string(); + } + return {}; +} + +std::string FlatpakManager::appIdFromBundle(const std::string& path) { + // A bundle opens with a header of its own: the magic, then the exact ref it + // installs and the application metadata, both NUL-terminated. The header is + // all that is read — the payload behind it weighs tens of megabytes and + // nothing there would answer the question. + std::ifstream file(path, std::ios::binary); + if (!file) return {}; + + std::array buffer{}; + file.read(buffer.data(), static_cast(buffer.size())); + const std::string header(buffer.data(), static_cast(file.gcount())); + + const std::string magic("flatpak\0", 8); + if (header.size() <= magic.size() || header.compare(0, magic.size(), magic) != 0) { + // An OCI bundle, or a file that is not one: nothing is guessed at, so + // the caller installs it the ordinary way. + return {}; + } + + // The ref sits behind a "ref" key. Skipping the framing between the two — + // flatpak writes sizes there of its own choosing — is what keeps this + // readable across the versions of the format. + const std::string key("ref\0", 4); + for (std::size_t at = header.find(key, magic.size()); at != std::string::npos; + at = header.find(key, at + key.size())) { + std::size_t value = at + key.size(); + while (value < header.size() && header[value] == '\0') ++value; + const std::size_t end = header.find('\0', value); + if (end == std::string::npos) break; + + const std::string id = appIdFromRef(header.substr(value, end - value)); + if (!id.empty()) return id; + } + return {}; +} + std::string FlatpakManager::installFileCommand(FileKind kind, const std::string& path, bool userScope) { const std::string scope = userScope ? "--user " : ""; @@ -642,7 +734,7 @@ std::vector FlatpakManager::listUpdates() { return results; } -bool FlatpakManager::isInstalled(const std::string& appId) { +bool FlatpakManager::isInstalled(const std::string& appId) const { std::string cmd = "flatpak info " + appId + " > /dev/null 2>&1"; return system(cmd.c_str()) == 0; } @@ -942,6 +1034,22 @@ bool FlatpakManager::canInstallFile(const std::string& path) const { return classifyFile(path) != FileKind::None; } +// What the user is about to install, named the way flatpak names it. A +// `.flatpakrepo` answers nothing: it registers a remote and installs no +// application, so there is nothing that could already be there. +std::string FlatpakManager::fileTargetName(const std::string& path) const { + switch (classifyFile(path)) { + case FileKind::Ref: return appIdFromRefFile(path); + case FileKind::Bundle: return appIdFromBundle(path); + default: return {}; + } +} + +bool FlatpakManager::isPackageInstalled(const std::string& packageName) const { + if (packageName.empty()) return false; + return isInstalled(packageName); +} + bool FlatpakManager::installFile(const std::string& path, ProgressCallback progressCallback) { m_lastError.clear(); diff --git a/providers/flatpak-provider/flatpak-manager.h b/providers/flatpak-provider/flatpak-manager.h index bc26be0..35b9278 100644 --- a/providers/flatpak-provider/flatpak-manager.h +++ b/providers/flatpak-provider/flatpak-manager.h @@ -66,6 +66,18 @@ public: // types in `flatpak install `. static std::string repoNamespace(const std::string& path); + // Application a file would install. A `.flatpakref` spells it out in its + // `[Flatpak Ref]` section; a `.flatpak` bundle carries the exact ref it + // installs in its own header. Both are read without running flatpak — the + // file is already on disk — so the answer is available before anything is + // started. Empty when the file names no application or cannot be read, in + // which case the caller simply installs it. + static std::string appIdFromRefFile(const std::string& path); + static std::string appIdFromBundle(const std::string& path); + // The application id inside a ref ("app/com.example.App/x86_64/stable" -> + // "com.example.App"). Empty when the string is not a ref. + static std::string appIdFromRef(const std::string& ref); + std::vector search(const std::string& query) override; bool install(const std::string& packageName, ProgressCallback progressCallback) override; @@ -88,6 +100,8 @@ public: // URL, so flatpak resolves the remote itself. bool canInstallFile(const std::string& path) const override; bool installFile(const std::string& path, ProgressCallback progressCallback) override; + std::string fileTargetName(const std::string& path) const override; + bool isPackageInstalled(const std::string& packageName) const override; // Make an app appear in the desktop's application launcher (wofi, GNOME, // KDE, ...) regardless of XDG_DATA_DIRS, like a pacman install would: link @@ -102,7 +116,9 @@ public: void integrateAllInstalled(); private: - bool isInstalled(const std::string& appId); + // Whether that application is deployed, in any installation (flatpak info + // looks them all up). Exposed through isPackageInstalled(). + bool isInstalled(const std::string& appId) const; std::string m_lastError; }; diff --git a/tests/app-core.test.cpp b/tests/app-core.test.cpp index 5fc66c8..b642170 100644 --- a/tests/app-core.test.cpp +++ b/tests/app-core.test.cpp @@ -2,6 +2,7 @@ #include #include +#include #include #include @@ -252,6 +253,35 @@ void testDatabaseLockIsQueryable() { } } +// What a file the user drops would install. Only the half that needs no +// provider is asserted here (the Flatpak side is covered by that provider's own +// test, on the bytes a bundle really carries): an unreadable package names +// nothing, so the window installs it and lets the reader report the reason. +void testFileTargetAnswersNothingForWhatItCannotRead() { + AppCore core; + + assert(core.fileTarget(QString()).name.isEmpty()); + assert(!core.fileTarget(QString()).installed); + assert(!core.fileTarget(QStringLiteral(" ")).installed); + // No provider claims a text document, so there is nothing to name. + assert(core.fileTarget(QStringLiteral("/tmp/liste-de-courses.txt")).name.isEmpty()); + + QTemporaryDir dir; + assert(dir.isValid()); + const QString broken = dir.filePath(QStringLiteral("casse.fwspacm")); + QFile file(broken); + assert(file.open(QIODevice::WriteOnly)); + file.write("pas une archive"); + file.close(); + + const AppCore::FileTarget target = core.fileTarget(broken); + assert(target.name.isEmpty()); + assert(!target.installed); + // It is still a plugin package by its name, which is what the window asks + // next before handing it to the installer. + assert(core.isPluginPackage(broken)); +} + } // namespace int main(int argc, char* argv[]) { @@ -282,6 +312,7 @@ int main(int argc, char* argv[]) { testLogReadReportsItsFailure(); testUpdateStateIsReadableWithoutRunningAnything(); testDatabaseLockIsQueryable(); + testFileTargetAnswersNothingForWhatItCannotRead(); std::cout << "app-core: all tests passed" << std::endl; return 0; diff --git a/tests/flatpak-manager.test.cpp b/tests/flatpak-manager.test.cpp index f18612a..4b880aa 100644 --- a/tests/flatpak-manager.test.cpp +++ b/tests/flatpak-manager.test.cpp @@ -1,6 +1,39 @@ #include "flatpak-manager.h" + #include +#include +#include #include +#include + +// The parsers below read real files, so the tests write real bytes: a scratch +// directory of our own in the system temp tree, never the user's home. +static std::filesystem::path scratchDir() { + std::error_code ec; + const std::filesystem::path dir = + std::filesystem::temp_directory_path(ec) / "pacmanager-flatpak-manager-test"; + std::filesystem::create_directories(dir, ec); + return dir; +} + +static std::string writeScratch(const std::string& name, const std::string& bytes) { + const std::filesystem::path path = scratchDir() / name; + std::ofstream out(path, std::ios::binary | std::ios::trunc); + out.write(bytes.data(), static_cast(bytes.size())); + out.close(); + return path.string(); +} + +// Bytes encoded the way a hex dump reads, so a fixture can be copied from the +// real file it came from. +static std::string fromHex(const std::string& hex) { + std::string bytes; + bytes.reserve(hex.size() / 2); + for (std::size_t i = 0; i + 1 < hex.size(); i += 2) { + bytes.push_back(static_cast(std::stoi(hex.substr(i, 2), nullptr, 16))); + } + return bytes; +} static void testParseSearchOutput_parsesAlignedRows() { std::string output = @@ -240,6 +273,153 @@ static void testUninstallCommand_stillAcceptsAnApplicationId() { assert(plain.find("--user") == std::string::npos); } +// ---- What a dropped file would install ---- +// +// The window asks this before it runs anything, to refuse a file the machine +// already has. Both answers are read out of the file itself: no flatpak call, +// no network, and nothing guessed at. + +static void testAppIdFromRefFile_readsTheNameField() { + const std::string ref = writeScratch("org.gnome.Dictionary.flatpakref", + "[Flatpak Ref]\n" + "Title=Dictionary\n" + "Name=org.gnome.Dictionary\n" + "Branch=stable\n" + "Url=https://dl.flathub.org/repo/\n" + "SuggestRemoteName=flathub\n" + "RuntimeRepo=https://dl.flathub.org/repo/flathub.flatpakrepo\n" + "IsRuntime=false\n"); + assert(FlatpakManager::appIdFromRefFile(ref) == "org.gnome.Dictionary"); + + // A hand-written file: comments, blank lines, CRLF endings, spaces around + // the separator, a lower-case section, and another section behind it whose + // `Name` is not the application. + const std::string spoken = writeScratch("spaced.flatpakref", + "; written by hand\r\n" + "\r\n" + "[FLATPAK REF]\r\n" + " Name = org.gnome.Calculator \r\n" + "[Flatpak Repo]\n" + "Name=org.example.NotTheApp\n"); + assert(FlatpakManager::appIdFromRefFile(spoken) == "org.gnome.Calculator"); +} + +static void testAppIdFromRefFile_refusesWhatNamesNoApplication() { + // The name is not in the ref section: a repository definition lists other + // keys there, and reading one of them as the application would refuse an + // install that has every right to run. + const std::string repo = writeScratch("flathub.flatpakref", + "[Flatpak Repo]\n" + "Name=org.example.NotTheApp\n" + "[Flatpak Ref]\n" + "Branch=stable\n"); + assert(FlatpakManager::appIdFromRefFile(repo).empty()); + + // An id that is not one is refused rather than handed to flatpak: this came + // straight out of a file the user dropped. + const std::string injected = writeScratch("injected.flatpakref", + "[Flatpak Ref]\n" + "Name=org.example.App; rm -rf ~\n"); + assert(FlatpakManager::appIdFromRefFile(injected).empty()); + + // A file that is not there, an empty one, and one that is not a ref file. + assert(FlatpakManager::appIdFromRefFile("/tmp/pacmgr-does-not-exist.flatpakref").empty()); + assert(FlatpakManager::appIdFromRefFile(writeScratch("empty.flatpakref", "")).empty()); + assert(FlatpakManager::appIdFromRefFile(writeScratch("junk.flatpakref", "garbage")).empty()); +} + +static void testAppIdFromRef_stripsKindArchAndBranch() { + assert(FlatpakManager::appIdFromRef("app/org.gnome.Calculator/x86_64/stable") + == "org.gnome.Calculator"); + assert(FlatpakManager::appIdFromRef("runtime/org.freedesktop.Platform/x86_64/50") + == "org.freedesktop.Platform"); + // A branch can carry a dash and a version, which is not part of the id. + assert(FlatpakManager::appIdFromRef("app/org.winehq.Wine/x86_64/stable-25.08") + == "org.winehq.Wine"); + + // Not a ref at all: a bare id, a kind alone, an empty string, a URL. + assert(FlatpakManager::appIdFromRef("com.example.App").empty()); + assert(FlatpakManager::appIdFromRef("app/").empty()); + assert(FlatpakManager::appIdFromRef("").empty()); + assert(FlatpakManager::appIdFromRef("https://flathub.org/repo/app.flatpakref").empty()); + // A kind flatpak does not install as an application. + assert(FlatpakManager::appIdFromRef("something/org.example.App/x86_64/stable").empty()); +} + +// The first bytes of a real bundle, hex-encoded exactly as `flatpak +// build-bundle` wrote them: the magic, the ref it installs, then the metadata. +static std::string bundleHeaderFixture() { + return fromHex( + "666c617470616b00010089e500750800" + "72656600000000006170702f636f6d2e" + "757365626f74746c65732e626f74746c" + "65732f7838365f36342f737461626c65" + "00007304000000006d65746164617461" + "00000000000000005b4170706c696361" + "74696f6e5d0a6e616d653d636f6d2e75" + "7365626f74746c65732e626f74746c65" + "730a72756e74696d653d6f72672e676e" + "6f6d652e506c6174666f726d2f783836" + "5f36342f35300a73"); +} + +static void testAppIdFromBundle_readsTheRefInTheHeader() { + const std::string bundle = writeScratch("bottles.flatpak", bundleHeaderFixture()); + assert(FlatpakManager::appIdFromBundle(bundle) == "com.usebottles.bottles"); + + // A runtime bundle is named the same way, behind "runtime/" instead of + // "app/", and with the framing flatpak may put around the ref differing. + std::string runtime("flatpak\0", 8); + runtime += std::string("\x01\0\0\0\0\0\0\0", 8); + runtime += std::string("ref\0\0\0\0", 8); + runtime += "runtime/org.freedesktop.Platform/x86_64/50"; + runtime += '\0'; + runtime += "metadata"; + assert(FlatpakManager::appIdFromBundle(writeScratch("platform.flatpak", runtime)) + == "org.freedesktop.Platform"); +} + +static void testAppIdFromBundle_refusesWhatItCannotRead() { + assert(FlatpakManager::appIdFromBundle("/tmp/pacmgr-does-not-exist.flatpak").empty()); + assert(FlatpakManager::appIdFromBundle(writeScratch("empty.flatpak", "")).empty()); + assert(FlatpakManager::appIdFromBundle(writeScratch("plain.flatpak", "not a bundle")).empty()); + + // The magic alone, then a header that stops in the middle of the ref. + std::string truncated("flatpak\0", 8); + truncated += "ref\0"; + assert(FlatpakManager::appIdFromBundle(writeScratch("truncated.flatpak", truncated)).empty()); + + // The right magic with something else behind the ref key. + std::string foreign("flatpak\0", 8); + foreign += std::string("ref\0\0\0\0\0", 9); + foreign += "garbage-not-a-ref"; + foreign += '\0'; + assert(FlatpakManager::appIdFromBundle(writeScratch("foreign.flatpak", foreign)).empty()); +} + +// A repository definition installs no application, so it answers nothing and +// is installed the ordinary way; the two other formats name what they install. +static void testFileTargetName_onlyNamesApplications() { + FlatpakManager manager; + + const std::string repo = writeScratch("flathub.flatpakrepo", + "[Flatpak Repo]\n" + "Name=flathub\n" + "Url=https://dl.flathub.org/repo/\n"); + assert(manager.fileTargetName(repo).empty()); + + const std::string ref = writeScratch("calculator.flatpakref", + "[Flatpak Ref]\n" + "Name=org.gnome.Calculator\n"); + assert(manager.fileTargetName(ref) == "org.gnome.Calculator"); + + assert(manager.fileTargetName(writeScratch("app.flatpak", bundleHeaderFixture())) + == "com.usebottles.bottles"); + + // A file no format claims stays unknown rather than guessed at. + assert(manager.fileTargetName(writeScratch("documents.txt", "rien à voir")).empty()); +} + int main() { testParseSearchOutput_parsesAlignedRows(); testParseSearchOutput_keepsMultiWordDescriptions(); @@ -261,6 +441,13 @@ int main() { testUninstallAndUpdateCommands_targetOneCopy(); testUninstallCommand_stillAcceptsAnApplicationId(); + testAppIdFromRefFile_readsTheNameField(); + testAppIdFromRefFile_refusesWhatNamesNoApplication(); + testAppIdFromRef_stripsKindArchAndBranch(); + testAppIdFromBundle_readsTheRefInTheHeader(); + testAppIdFromBundle_refusesWhatItCannotRead(); + testFileTargetName_onlyNamesApplications(); + std::cout << "All flatpak-manager tests passed." << std::endl; return 0; } diff --git a/translations/de.json b/translations/de.json index 270f829..b266ee8 100644 --- a/translations/de.json +++ b/translations/de.json @@ -5,6 +5,7 @@ " PacManager reprendra ensuite l'opération automatiquement.": " PacManager setzt den Vorgang anschließend automatisch fort.", "%1 (jusqu'au %2)": "%1 (bis %2)", "%1 : %2": "%1: %2", + "%1 : déjà installé, rien à faire": "%1: bereits installiert, nichts zu tun", "%1 : format non reconnu (PacManager installe les fichiers .flatpakref, .flatpakrepo, .flatpak et les paquets de plugin .fwspacm).": "%1: Format nicht erkannt (PacManager installiert die Dateien .flatpakref, .flatpakrepo, .flatpak sowie .fwspacm-Plugin-Pakete).", "%1 Ko": "%1 KB", "%1 Mo": "%1 MB", @@ -37,6 +38,10 @@ "5 Mo": "5 MB", "7 jours": "7 Tage", "%1 utilise déjà la base pacman.": "%1 verwendet die pacman-Datenbank bereits.", + "%1 : ce plugin est déjà installé. Supprimez-le depuis l'écran Extensions pour en installer un autre.": "%1: Dieses Plugin ist bereits installiert. Entferne es im Bildschirm Erweiterungen, um ein anderes zu installieren.", + "%1 est déjà installé : il n'y a rien à installer. Sa mise à jour se fait depuis l'écran des mises à jour.": "%1 ist bereits installiert: es gibt nichts zu installieren. Aktualisiert wird es über den Bildschirm der Aktualisierungen.", + "%1 pris en compte : le plugin est installé et utilisable sans redémarrer.": "%1 berücksichtigt: das Plugin ist installiert und ohne Neustart nutzbar.", + "%1 pris en compte : l'installation démarre, sa progression s'affiche en bas de la fenêtre.": "%1 berücksichtigt: die Installation startet, ihr Fortschritt wird unten im Fenster angezeigt.", "

PacManager v%1

Gestionnaire de paquets pour Arch Linux (pacman).

": "

PacManager v%1

Paketverwaltung für Arch Linux (pacman).

", "

PacManager a été mis à jour

La nouvelle version sera active au prochain démarrage.

%1
": "

PacManager wurde aktualisiert

Die neue Version ist beim nächsten Start aktiv.

%1
", "

PacManager v%1 est disponible

Vous utilisez actuellement la version %2.

": "

PacManager v%1 ist verfügbar

Du verwendest derzeit Version %2.

", @@ -97,6 +102,7 @@ "Dossier du journal": "Journal-Ordner", "Dossier du journal : %1": "Journal-Ordner: %1", "Débloquer": "Entsperren", + "Déjà installé": "Bereits installiert", "Dépend de": "Hängt ab von", "Déposez un fichier %1 n'importe où sur la fenêtre : son bibliothèque est extraite dans %2, sans mot de passe, et le plugin est chargé immédiatement, sans redémarrer. Le paquet contient un manifeste plugin.json et la bibliothèque ; il se crée avec ./make-plugin-package.py (voir doc/plugins.md).": "Lege eine Datei %1 irgendwo im Fenster ab: Ihre Bibliothek wird nach %2 entpackt, ohne Passwort, und das Plugin wird sofort geladen, ohne Neustart. Das Paket enthält ein Manifest plugin.json und die Bibliothek; es wird mit ./make-plugin-package.py erstellt (siehe doc/plugins.md).", "Dépôt": "Repository", @@ -123,6 +129,7 @@ "Fermer le gestionnaire": "Die Paketverwaltung schließen", "Fichier": "Datei", "Fichier installé": "Installierte Datei", + "Fichiers pris en compte": "Dateien berücksichtigt", "Filtre local, instantané": "Lokaler Filter, sofort", "Filtrer :": "Filtern:", "Filtrer les logs (paquet, action, date)...": "Die Logs filtern (Paket, Aktion, Datum)...", diff --git a/translations/en.json b/translations/en.json index 4a1fadd..2f30eaa 100644 --- a/translations/en.json +++ b/translations/en.json @@ -5,6 +5,7 @@ " PacManager reprendra ensuite l'opération automatiquement.": " PacManager will then resume the operation automatically.", "%1 (jusqu'au %2)": "%1 (until %2)", "%1 : %2": "%1: %2", + "%1 : déjà installé, rien à faire": "%1: already installed, nothing to do", "%1 : format non reconnu (PacManager installe les fichiers .flatpakref, .flatpakrepo, .flatpak et les paquets de plugin .fwspacm).": "%1: unsupported format (PacManager installs the .flatpakref, .flatpakrepo and .flatpak files, and the .fwspacm plugin packages).", "%1 Ko": "%1 KB", "%1 Mo": "%1 MB", @@ -37,6 +38,10 @@ "5 Mo": "5 MB", "7 jours": "7 days", "%1 utilise déjà la base pacman.": "%1 is already using the pacman database.", + "%1 : ce plugin est déjà installé. Supprimez-le depuis l'écran Extensions pour en installer un autre.": "%1: this plugin is already installed. Remove it from the Extensions screen to install another one.", + "%1 est déjà installé : il n'y a rien à installer. Sa mise à jour se fait depuis l'écran des mises à jour.": "%1 is already installed: there is nothing to install. It is updated from the updates screen.", + "%1 pris en compte : le plugin est installé et utilisable sans redémarrer.": "%1 taken into account: the plugin is installed and usable without restarting.", + "%1 pris en compte : l'installation démarre, sa progression s'affiche en bas de la fenêtre.": "%1 taken into account: the installation starts, its progress is shown at the bottom of the window.", "

PacManager v%1

Gestionnaire de paquets pour Arch Linux (pacman).

": "

PacManager v%1

Package manager for Arch Linux (pacman).

", "

PacManager a été mis à jour

La nouvelle version sera active au prochain démarrage.

%1
": "

PacManager has been updated

The new version will be active on the next start.

%1
", "

PacManager v%1 est disponible

Vous utilisez actuellement la version %2.

": "

PacManager v%1 is available

You are currently running version %2.

", @@ -97,6 +102,7 @@ "Dossier du journal": "Journal folder", "Dossier du journal : %1": "Journal folder: %1", "Débloquer": "Unblock", + "Déjà installé": "Already installed", "Dépend de": "Depends on", "Déposez un fichier %1 n'importe où sur la fenêtre : son bibliothèque est extraite dans %2, sans mot de passe, et le plugin est chargé immédiatement, sans redémarrer. Le paquet contient un manifeste plugin.json et la bibliothèque ; il se crée avec ./make-plugin-package.py (voir doc/plugins.md).": "Drop a %1 file anywhere on the window: its library is extracted into %2, without a password, and the plugin is loaded right away, with no restart. The package holds a plugin.json manifest and the library; it is built with ./make-plugin-package.py (see doc/plugins.md).", "Dépôt": "Repository", @@ -123,6 +129,7 @@ "Fermer le gestionnaire": "Close the package manager", "Fichier": "File", "Fichier installé": "Installed file", + "Fichiers pris en compte": "Files taken into account", "Filtre local, instantané": "Local filter, instant", "Filtrer :": "Filter:", "Filtrer les logs (paquet, action, date)...": "Filter the logs (package, action, date)...", diff --git a/translations/es.json b/translations/es.json index 4b1158d..70ac123 100644 --- a/translations/es.json +++ b/translations/es.json @@ -5,6 +5,7 @@ " PacManager reprendra ensuite l'opération automatiquement.": " PacManager reanudará la operación automáticamente.", "%1 (jusqu'au %2)": "%1 (hasta %2)", "%1 : %2": "%1: %2", + "%1 : déjà installé, rien à faire": "%1: ya instalado, nada que hacer", "%1 : format non reconnu (PacManager installe les fichiers .flatpakref, .flatpakrepo, .flatpak et les paquets de plugin .fwspacm).": "%1: formato no reconocido (PacManager instala los archivos .flatpakref, .flatpakrepo, .flatpak y los paquetes de plugin .fwspacm).", "%1 Ko": "%1 KB", "%1 Mo": "%1 MB", @@ -37,6 +38,10 @@ "5 Mo": "5 MB", "7 jours": "7 días", "%1 utilise déjà la base pacman.": "%1 ya está usando la base de datos de pacman.", + "%1 : ce plugin est déjà installé. Supprimez-le depuis l'écran Extensions pour en installer un autre.": "%1: este plugin ya está instalado. Elimínalo desde la pantalla Extensiones para instalar otro.", + "%1 est déjà installé : il n'y a rien à installer. Sa mise à jour se fait depuis l'écran des mises à jour.": "%1 ya está instalado: no hay nada que instalar. Su actualización se hace desde la pantalla de actualizaciones.", + "%1 pris en compte : le plugin est installé et utilisable sans redémarrer.": "%1 tenido en cuenta: el plugin está instalado y se puede usar sin reiniciar.", + "%1 pris en compte : l'installation démarre, sa progression s'affiche en bas de la fenêtre.": "%1 tenido en cuenta: la instalación comienza y su progreso se muestra en la parte inferior de la ventana.", "

PacManager v%1

Gestionnaire de paquets pour Arch Linux (pacman).

": "

PacManager v%1

Gestor de paquetes para Arch Linux (pacman).

", "

PacManager a été mis à jour

La nouvelle version sera active au prochain démarrage.

%1
": "

PacManager se ha actualizado

La nueva versión estará activa en el próximo inicio.

%1
", "

PacManager v%1 est disponible

Vous utilisez actuellement la version %2.

": "

PacManager v%1 está disponible

Actualmente usas la versión %2.

", @@ -97,6 +102,7 @@ "Dossier du journal": "Carpeta del diario", "Dossier du journal : %1": "Carpeta del diario: %1", "Débloquer": "Desbloquear", + "Déjà installé": "Ya instalado", "Dépend de": "Depende de", "Déposez un fichier %1 n'importe où sur la fenêtre : son bibliothèque est extraite dans %2, sans mot de passe, et le plugin est chargé immédiatement, sans redémarrer. Le paquet contient un manifeste plugin.json et la bibliothèque ; il se crée avec ./make-plugin-package.py (voir doc/plugins.md).": "Suelta un archivo %1 en cualquier parte de la ventana: su biblioteca se extrae en %2, sin contraseña, y el plugin se carga de inmediato, sin reiniciar. El paquete contiene un manifiesto plugin.json y la biblioteca; se crea con ./make-plugin-package.py (ver doc/plugins.md).", "Dépôt": "Repositorio", @@ -123,6 +129,7 @@ "Fermer le gestionnaire": "Cerrar el gestor", "Fichier": "Archivo", "Fichier installé": "Archivo instalado", + "Fichiers pris en compte": "Archivos tenidos en cuenta", "Filtre local, instantané": "Filtro local, instantáneo", "Filtrer :": "Filtrar:", "Filtrer les logs (paquet, action, date)...": "Filtrar los registros (paquete, acción, fecha)...", diff --git a/translations/it.json b/translations/it.json index e9a449b..b2787d8 100644 --- a/translations/it.json +++ b/translations/it.json @@ -5,6 +5,7 @@ " PacManager reprendra ensuite l'opération automatiquement.": " PacManager riprenderà poi l'operazione automaticamente.", "%1 (jusqu'au %2)": "%1 (fino al %2)", "%1 : %2": "%1: %2", + "%1 : déjà installé, rien à faire": "%1: già installato, nulla da fare", "%1 : format non reconnu (PacManager installe les fichiers .flatpakref, .flatpakrepo, .flatpak et les paquets de plugin .fwspacm).": "%1: formato non riconosciuto (PacManager installa i file .flatpakref, .flatpakrepo, .flatpak e i pacchetti di plugin .fwspacm).", "%1 Ko": "%1 KB", "%1 Mo": "%1 MB", @@ -37,6 +38,10 @@ "5 Mo": "5 MB", "7 jours": "7 giorni", "%1 utilise déjà la base pacman.": "%1 sta già usando il database di pacman.", + "%1 : ce plugin est déjà installé. Supprimez-le depuis l'écran Extensions pour en installer un autre.": "%1: questo plugin è già installato. Rimuovilo dalla schermata Estensioni per installarne un altro.", + "%1 est déjà installé : il n'y a rien à installer. Sa mise à jour se fait depuis l'écran des mises à jour.": "%1 è già installato: non c'è nulla da installare. Il suo aggiornamento si fa dalla schermata degli aggiornamenti.", + "%1 pris en compte : le plugin est installé et utilisable sans redémarrer.": "%1 preso in carico: il plugin è installato e utilizzabile senza riavviare.", + "%1 pris en compte : l'installation démarre, sa progression s'affiche en bas de la fenêtre.": "%1 preso in carico: l'installazione inizia e il suo avanzamento è mostrato in fondo alla finestra.", "

PacManager v%1

Gestionnaire de paquets pour Arch Linux (pacman).

": "

PacManager v%1

Gestore di pacchetti per Arch Linux (pacman).

", "

PacManager a été mis à jour

La nouvelle version sera active au prochain démarrage.

%1
": "

PacManager è stato aggiornato

La nuova versione sarà attiva al prossimo avvio.

%1
", "

PacManager v%1 est disponible

Vous utilisez actuellement la version %2.

": "

PacManager v%1 è disponibile

Al momento usi la versione %2.

", @@ -97,6 +102,7 @@ "Dossier du journal": "Cartella del diario", "Dossier du journal : %1": "Cartella del diario: %1", "Débloquer": "Sblocca", + "Déjà installé": "Già installato", "Dépend de": "Dipende da", "Déposez un fichier %1 n'importe où sur la fenêtre : son bibliothèque est extraite dans %2, sans mot de passe, et le plugin est chargé immédiatement, sans redémarrer. Le paquet contient un manifeste plugin.json et la bibliothèque ; il se crée avec ./make-plugin-package.py (voir doc/plugins.md).": "Rilascia un file %1 in qualsiasi punto della finestra: la sua libreria viene estratta in %2, senza password, e il plugin viene caricato subito, senza riavviare. Il pacchetto contiene un manifesto plugin.json e la libreria; si crea con ./make-plugin-package.py (vedi doc/plugins.md).", "Dépôt": "Repository", @@ -123,6 +129,7 @@ "Fermer le gestionnaire": "Chiudi il gestore", "Fichier": "File", "Fichier installé": "File installato", + "Fichiers pris en compte": "File presi in carico", "Filtre local, instantané": "Filtro locale, istantaneo", "Filtrer :": "Filtra:", "Filtrer les logs (paquet, action, date)...": "Filtra i log (pacchetto, azione, data)...", From 111143cd4c2d206f4173b03d256efbb45ad253f3 Mon Sep 17 00:00:00 2001 From: BlackAngelTV Date: Fri, 9 Oct 2026 19:22:27 +0200 Subject: [PATCH 3/3] chore(release): 1.6.1 The journal fix and the file feedback of this branch ship together, with nothing else: 1.6.0 stays the feature release it was. --- ChangeLog.md | 53 +++++++++++++++++++++++++++++++++++++++++++++++++++- version | 2 +- 2 files changed, 53 insertions(+), 2 deletions(-) diff --git a/ChangeLog.md b/ChangeLog.md index 58165fa..c8c4a95 100644 --- a/ChangeLog.md +++ b/ChangeLog.md @@ -1,6 +1,57 @@ # ChangeLog -Toutes les modifications entre la **V1.5.0** (23/09/2026) et la version courante +## V1.6.1 — branche `release-1.6.1` + +Deux corrections ciblées, rien d'autre : le journal ne reprend plus le bavardage +de la couche graphique de Qt, et un fichier déposé est confirmé — ou refusé +quand la machine le possède déjà. + +### Le journal ne reprend plus la sortie interne de Qt + +Chaque boîte de dialogue ouverte sous Wayland faisait écrire à Qt, dans le +journal de l'application, une rafale de lignes de sa couche graphique : + +``` +[2026-10-09 18:49:23] [ui] mot de passe fourni +[2026-10-09 18:49:23] [qt/qt.qpa.wayland.textinput] avertissement: virtual void QtWaylandClient::QWaylandTextInputv3::disableSurface(wl_surface*) Trying to disable 0x… but 0x… is focused +``` + +Ces catégories (`qt.qpa.*`) décrivent le serveur d'affichage, pas +l'application, et l'utilisateur ne peut rien en faire : elles restent sur la +sortie standard — là où un développeur les cherche, la console n'ayant rien +perdu — et ne sont plus journalisées. Tout ce que l'application journalise +d'elle-même, `pacmgr.*` compris, y est toujours ; `LogManager::journalsQtCategory()` +porte la décision. + +### Un fichier déposé est confirmé, et refusé s'il est déjà installé + +Déposer un fichier Flatpak ou un paquet `.fwspacm` — ou l'ouvrir par « Ouvrir +avec PacManager » — répond maintenant par une boîte de dialogue : ce qui a été +pris en compte, et ce que cela déclenche (l'installation démarre et sa +progression s'affiche en bas de la fenêtre ; un plugin est installé et utilisable +sans redémarrer). Un dépôt restait sinon silencieux dès que l'installation +partait en arrière-plan. + +Un fichier dont l'application est **déjà** installée est refusé avant toute +exécution, avec la raison. Le nom est lu dans le fichier lui-même — section +`[Flatpak Ref]` d'un `.flatpakref`, en-tête d'un `.flatpak`, manifeste d'un +`.fwspacm` — puis comparé à ce que le fournisseur a déjà +(`IPackageManager::fileTargetName()` / `isPackageInstalled()`). Sans cela, +Flatpak se contentait de sauter l'installation et de renvoyer un succès que +l'utilisateur n'avait pas ; réinstaller un paquet de plugin écrasait celui en +place sans le dire. Rien n'est exécuté pour lire ces fichiers, et un fichier +qu'on ne sait pas lire (dépôt, format inconnu) s'installe comme avant. + +*Fichiers : `logging/log-manager.*`, `include/sdk/package-manager.h`, +`providers/flatpak-provider/flatpak-manager.*`, `core/app-core.*`, +`app/main-window.*`, les catalogues `translations/*.json`, et les tests +`flatpak-manager-test` / `app-settings-test` / `app-core-test`.* + +--- + +## V1.6.0 + +Toutes les modifications entre la **V1.5.0** (23/09/2026) et la version **1.6.0** (branche `release-1.6.0`, 33 commits, 95 fichiers touchés, +8 758 / −2 308 lignes). diff --git a/version b/version index dc1e644..9c6d629 100644 --- a/version +++ b/version @@ -1 +1 @@ -1.6.0 +1.6.1