feat(files): confirm dropped files and refuse the ones already installed
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.
This commit is contained in:
16 files changed
+557
-9
No files matched your search
@@ -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;
|
||||
|
||||
|
||||
Reference in new issue
Block a user