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. Thanks for the reply, David PS I am CCing the hardware list by the way, but was unable to find the line to subscribe to this group. On Tue, Jun 10, 2008 at 3:16 PM, Christopher Blauvelt <[EMAIL PROTECTED]> wrote: > > > On Tue, Jun 10, 2008 at 4:34 PM, David Boosalis <[EMAIL PROTECTED]> > wrote: > >> Hi All. >> >> 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. >> >> Here is my slot thus far: >> >> void MyApp::slotSolidDeviceChanged(const QString &str) >> { >> qDebug() << "Device changed " << str; >> QString filePath; >> Solid::Device device(str); >> Solid::DeviceInterface *deviceInterface; >> Solid::StorageAccess *accessStorage; >> Solid::StorageVolume *volumeStorage; >> if (device.isValid()) >> { >> if (device.is<Solid::StorageAccess>()) { >> deviceInterface = >> device.asDeviceInterface(Solid::DeviceInterface::StorageDrive); >> >> usbStick = device.as<Solid::StorageDrive>(); >> >> volumeStorage = device.as<Solid::StorageVolume>(); >> accessStorage = device.as<Solid::StorageAccess>(); >> qDebug() << "file path = " << accessStorage->filePath(); // >> produces NULL code >> qDebug() << "uuid = " << volumeStorage->uuid(); >> qDebug() << "Volumne Label = " << volumeStorage->label(); >> } >> >> > Dave, > 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. > Chris > > > >> Visit http://mail.kde.org/mailman/listinfo/kde-devel#unsub to > unsubscribe << > >
_______________________________________________ Kde-hardware-devel mailing list Kde-hardware-devel@kde.org https://mail.kde.org/mailman/listinfo/kde-hardware-devel