Hi Chris.<br><br>The signal gets generated from a USB being plugged in. I use the following to connect the signal to the slog given:<br><br> connect(DeviceNotifier::instance(), <br> SIGNAL(deviceAdded(const QString &)),<br>
this, <br> SLOT(slotSolidDeviceChanged(const QString &)));<br> <br> connect(Solid::DeviceNotifier::instance(), <br> SIGNAL(deviceRemoved(const QString &)),<br> this, <br> SLOT(slotSolidDeviceChanged(const QString &)));<br>
<br>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.<br>
<br>Thanks for the reply,<br>David<br><br><br>PS I am CCing the hardware list by the way, but was unable to find the line to subscribe to this group.<br><br><br><br><div class="gmail_quote">On Tue, Jun 10, 2008 at 3:16 PM, Christopher Blauvelt <<a href="mailto:cblauvelt@gmail.com">cblauvelt@gmail.com</a>> wrote:<br>
<blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;"><div class="Ih2E3d"><br><br><div class="gmail_quote">On Tue, Jun 10, 2008 at 4:34 PM, David Boosalis <<a href="mailto:david.boosalis@gmail.com" target="_blank">david.boosalis@gmail.com</a>> wrote:<br>
<blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">
Hi All.<br><br>My first time use of Solid as I want to capture in my application when a USB Memory stick gets inserted into the computer. I have no problem getting the event, my question is how do I go from a Solid Class to a File Path, so I can open up a file dialog on it.<br>
<br>Here is my slot thus far:<br><br>void MyApp::slotSolidDeviceChanged(const QString &str)<br>{<br> qDebug() << "Device changed " << str;<br> QString filePath;<br> Solid::Device device(str);<br>
Solid::DeviceInterface *deviceInterface;<br> Solid::StorageAccess *accessStorage;<br> Solid::StorageVolume *volumeStorage;<br> if (device.isValid())<br> {<br> if (<a href="http://device.is" target="_blank">device.is</a><Solid::StorageAccess>()) {<br>
deviceInterface = device.asDeviceInterface(Solid::DeviceInterface::StorageDrive);<br><br> usbStick = <a href="http://device.as" target="_blank">device.as</a><Solid::StorageDrive>();<br><br> volumeStorage = <a href="http://device.as" target="_blank">device.as</a><Solid::StorageVolume>();<br>
accessStorage = <a href="http://device.as" target="_blank">device.as</a><Solid::StorageAccess>();<br> qDebug() << "file path = " << accessStorage->filePath(); // produces NULL code<br>
qDebug() << "uuid = " << volumeStorage->uuid();<br>
qDebug() << "Volumne Label = " << volumeStorage->label(); <br> }<br><br></blockquote></div><br></div>Dave,<br>Are you sure the drive is mounted? If not, then filePath() should return an empty string. Make to use StorageAccess::setup. This will mount the drive and, if successful, you should be able to get a file path. Also, I've included kde-hardware-devel on this list. Posting here will likely get you more attention from knowledgable people.<br>
Chris<br>
<br><br>
>> Visit <a href="http://mail.kde.org/mailman/listinfo/kde-devel#unsub" target="_blank">http://mail.kde.org/mailman/listinfo/kde-devel#unsub</a> to unsubscribe <<<br>
<br></blockquote></div><br>