From kde-core-devel Fri Sep 18 21:15:13 2009 From: David Faure Date: Fri, 18 Sep 2009 21:15:13 +0000 To: kde-core-devel Subject: Re: Mountable devices support in KDE Message-Id: <200909182315.14039.faure () kde ! org> X-MARC-Message: https://marc.info/?l=kde-core-devel&m=125330856917587 On Thursday 17 September 2009, Rafał Miłecki wrote: > 2009/9/14 David Faure : > > IIRC Solid has a way to find the device from the device name like > > /dev/sdb1, so instead of a kioslave-specific hack, how about using > > /dev/sdb1 as the path for which to show the popupmenu? "All" we need to > > do is to show mount/unmount for such paths, and that seems easy to do: > > just modify > > KDesktopFileActions::builtinServices (in kio) so that it calls > > KMountPoint::currentMountPoints().findByDevice(_url.path()) when _url is > > a device path rather than a .desktop file. Something like the attached > > patch (untested). > > > > Ah, but we can only recognize /dev/sdb1 if it's already mounted; > > otherwise (if it's not mounted and it's not in fstab), how can we find > > out it's a mountable device? Via Solid maybe? Kevin? ;) > > > > + if (KDesktopFile::isDesktopFile(path)) { > > It only checks if file name matches *.desktop. And KDE generates > desktop files without .desktop in name. Really? Where do we do that? > > + if (mp) { > > + return path; > > + } > > We expect deviceForUrl(...) to return device (/dev/...) not path > (/home/x/Desktop/harddrive). The variable "path", in the "else" block of that method was the device, not the mountpoint ;) Proof: findByDevice(path) one line above. > Moreover KDesktopFileActions::builtinServices is never called, because > of condition in kfileitemactions.cpp: > > if (isSingleLocal && d->m_props.mimeType() == "application/x-desktop") { > > // .desktop file Yep, I see you fixed that in your patch, good catch. > I understand your patch was not supposed to work, was not testes. Just > pointed that to explain why I made changes in my version. Sure. > One question: > It's very important IMO to backport this (un)mount work to KDE 4.3. > This KDE is used by openSUSE 11.2 (and KUbuntu 9.10 I guess) so > hopefully they will still able to update it and provide working > (un)mount for they distros. New feature -> no go for 4.3.x. Sorry but this is "only" about kio_sysinfo, which is in playground... There are other ways to unmount already (e.g. the plasma device list thingie). -- David Faure, faure@kde.org, sponsored by Nokia to work on KDE, Konqueror (http://www.konqueror.org), and KOffice (http://www.koffice.org).