Unmounting a busy device from the places panel doesn't tell which applications have open files blocking the unmount.
Details
- Reviewers
elvisangelaccio ngraham broulik meven - Group Reviewers
Dolphin - Commits
- R318:c3b914a7faed: Unmounting busy device doesn't tell who is blocking
Mount a USB stick using Dolphin
Open a file from the USB stick
Unmount the USB stick using Dolphin
Observe the new error message.
FEATURE: 189302
Diff Detail
- Repository
- R318 Dolphin
- Branch
- show_which_files_are_blocking_unmount (branched from master)
- Lint
No Linters Available - Unit
No Unit Test Coverage - Build Status
Buildable 17993 Build 18011: arc lint + arc unit
src/panels/places/placesitemmodel.cpp | ||
---|---|---|
476 | I just copied this code from the Device Notifier, but it would be nice to have this as general functionality somewhere | |
489 | What do you think about the wording of these error messages? Currently I just copied the ones from the Device Notifier, but actually I think that it should also state that unmounting has filed, or maybe that Removal has failed. |
Solid's signal void setupDone(Solid::ErrorType error, QVariant errorData, const QString &udi); has an errorData where you could probably send this to all interested parties without having to recreate this code all over the place
So what you are saying is to move the queryBlockingApps functionality to Solid? What about the dependency to KSysGuard, is that ok to add to Solid?
I'd also try to avoid copying the code here, is possible.
As long as it'd be an optional dependency, it should be fine, as I don't see it forbidden here: https://community.kde.org/Frameworks/Policies
But maybe send a mail to kde-frameworks-devel to double check ;)
As long as it'd be an optional dependency, it should be fine, as I don't see it forbidden here: https://community.kde.org/Frameworks/Policies
We can't.
Even ignoring the super confusing dependency loop trying to build frameworks and plasma at best this will break when one of us gets to Qt6 first.
But, there's good news:
This has come up a few times. Kdevelop has a plasma dep because of this same goal, and I want to get rid of that.
I've been meaning for ages to make a class in KF5::CoreAddon that is a super super minimal process list, listing running processes and getting a command line for them.
Effectively we just need to copy the files: https://github.com/KDAB/GammaRay/blob/master/launcher/ui/processlist.h (with the two backends) which are LGPL and currently copied about in a bunch of projects already.
This is yet another motivation.
@davidedmundson - Thanks for the info!
So I am thinking to do the following:
- Create a simple ProcessList class as @davidedmundson suggest in KF5::CoreAddon
- Move the queryBlockingApps functionality to Solid, but use the ProcessList implementation from KF5::CoreAddon (implement the functionality like @broulik suggests)
- Use the new functionality from Solid in Dolphin to show a nice end-user message
- Party?
Does that make sense?
Maybe after all this is done, use the general functionality from Solid in the Device Notifier as well? Does anyone know of other places that has the lsof functionality duplicated?
Does anyone know of other places that has the lsof functionality duplicated?
plasma-vault
libksysguard (KLsofWidget)
dataengines/devicenotifications/ksolidnotify
I have pushed the first commit with adding a GetProcessList function in KCoreAddons: D20007
@davidedmundson - Hi David! I am (finally) starting to look at implementing the lsof functionality in Solid, but I am unsure of where exactly to place it in Solid? Also, currently Solid does not depend on any KF5 libraries, this would be the first, is that ok?
ping @davidedmundson
Perhaps queryBlockingApps feature should be moved to kcoreaddons as well ?
Then it would depend on apps directly to use it.
Keeping solid clean of process miscellaneous utils.
And since D20007 has landed, this might be a good time to de-duplicate related code in
plasma-vault
libksysguard (KLsofWidget)
dataengines/devicenotifications/ksolidnotify
Also, currently Solid does not depend on any KF5 libraries, this would be the first, is that ok?
Probably ok.
Keeping solid clean of process miscellaneous utils.
It's not really cleaner if it just puts it somewhere else.
If you're dealing with lsof you're probably doing something with a drive, at which point you're doing something with a drive (and using solid) anyway?
And since D20007 has landed, this might be a good time to de-duplicate related code in
Ack. I've been porting the code that uses libksysguard just to get a process name. I haven't touched the lsof cases yet.
My point was also that KCoreAddons has already KProcessInfo ands KFileSystemType to find files fs types.
So a utility in the same area such as queryBlockingApps might make sense there. It would keep solid from getting a dependency.
CMakeLists.txt | ||
---|---|---|
11 ↗ | (On Diff #68212) | KListOpenFilesJob is available from KDE Frameworks 5.63.0 so I updated this min version, is there a process around this so that packagers are notified about this? |
src/panels/places/placesitemmodel.cpp | ||
492 ↗ | (On Diff #68212) | What do you think about the wording of these error messages? Currently I just copied the ones from the Device Notifier, but actually I think that it should also state that unmounting has filed, or maybe that Removal has failed. |
Please update the commit message, it is no longer true that "this commit copies the code from there to achieve the same thing."
CMakeLists.txt | ||
---|---|---|
11 ↗ | (On Diff #68212) | It's ok to bump the KF5 version as long as we do it before the dependency freeze. No need to notify the packagers. |
src/panels/places/placesitemmodel.cpp | ||
489 | Feel free to add those errors ;) | |
481 ↗ | (On Diff #68212) | Missing this as receiver. |
492 ↗ | (On Diff #68212) | Please use the <application> tag. More details in: https://api.kde.org/frameworks/ki18n/html/prg_guide.html#kuit_markup |
493 ↗ | (On Diff #68212) | Same here |
src/panels/places/placesitemmodel.cpp | ||
---|---|---|
481 | I am not sure I understand what you mean? So is what you are saying that I need to connect the signal to, e.g. a member function? |
src/panels/places/placesitemmodel.cpp | ||
---|---|---|
481 | I believe he means : connect(listOpenFilesJob, &KIO::Job::result, **this**, [this, listOpenFilesJob](KJob*) {... |
src/panels/places/placesitemmodel.cpp | ||
---|---|---|
481 | I have made this change, hope it is what you meant :) |
src/panels/places/placesitemmodel.cpp | ||
---|---|---|
481 | Yes. Without a receiver, a lambda slot could lead to crashes. More details here: https://medium.com/genymobile/how-c-lambda-expressions-can-improve-your-qt-code-8cd524f4ed9f |