On Tue, Jun 10, 2008 at 7:31 PM, David Boosalis <[EMAIL PROTECTED]> wrote:
> Hi Chris. > > The signal gets generated from a USB being plugged in. I use the following > to connect the signal to the slog given: > > connect(DeviceNotifier::instance(), > SIGNAL(deviceAdded(const QString &)), > this, > SLOT(slotSolidDeviceChanged(const QString &))); > > connect(Solid::DeviceNotifier::instance(), > SIGNAL(deviceRemoved(const QString &)), > this, > SLOT(slotSolidDeviceChanged(const QString &))); > > This was taken from the solid tutorial. Maybe I am getting an extraneous > signal when I plug in the usb stick because the qDebug statement for > filePath below prints nothing for hte filePath argument. I am using hte > latest build of the depot for all my coding work. You mentioned something > about StorgeAccess::setup(), I'll research this call, as I am not sure where > to put it. > > filePath() gives you the path to where the device is *mounted*. The signal you're receiving is sent when the device is plugged in, regardless of whether it's mounted or not. If you plug in your USB device, and it's not mounted you catch the signal that a device was added but since it's not mounted filePath() will return QString(). Try this in your slot: qDebug() << "Device changed " << str; QString filePath; Solid::Device device(str); Solid::StorageAccess *accessStorage = device.as<Solid::StorageAccess>(); if(storageAccess) { if(!storageAccess->isAccessible()) { //device is plugged in but not mounted storageAccess->setup(); } qDebug() << "File path is: " << storageAccess->filePath(); }
_______________________________________________ Kde-hardware-devel mailing list Kde-hardware-devel@kde.org https://mail.kde.org/mailman/listinfo/kde-hardware-devel