Hi all,

I tried to figure out how KIO::mount() internally works -- but failed =

miserably. I intended to write a couple of lines to trace down into =

kdelibs -- but my code doesn't work as expected. The progress dialog =

pops up, telling me that the device is about to be mounted, but that's =

it. =


My feeble attempts:
- KIO::mount()
- KAutoMount()
- KDEDesktopMimeType::run()

The result was always the same, a progress dialog that doesn't show any =

progress. The KIO::Job::result() signal is never emitted - not even when =

cancelling the dialog (at least, the connected slot was never called).

The one and only line of console output:
> kio (KIOJob): kio_uiserver registered


Could anyone tell me what's wrong (or missing) in the code snippets below?
I expect that there's some type of "nudge" missing (a static initilisation =

method?), something to tell kio to actually DO what it's asked to do ... if =

so, I can't figure it out on my own =3D(

Any hint will be greatly appreciated.

Regards
Daniel



-- code 1 --
int main(int argc, char **argv) {
KCmdLineArgs::init(argc, argv, "app", "prog", "desc", "0.0");
KApplication app(false, false);

KURL url;
url.setPath("/home/daniel/Desktop/usb-stick.desktop");

// expected behaviour: mount the USB device
KDEDesktopMimeType::run(url, true);
}
-- end of code 1 --

$> cat /home/daniel/Desktop/usb-stick.desktop
[Desktop Entry]
Dev=3D/dev/sdb1
Encoding=3DUTF-8
Icon=3Dusbpendrive_mount
MountPoint=3D/mnt/usb
Name=3DUSB-Stick
Name[en_US]=3DUSB-Stick
ReadOnly=3Dfalse
Type=3DFSDevice
UnmountIcon=3Dusbpendrive_unmount


-- code 2 --
int main(int argc, char **argv) {
KCmdLineArgs::init(argc, argv, "app", "prog", "desc", "0.0");
KApplication app(false, true);

bool ro =3D false;
QString format =3D QString::null;
QString device =3D "/dev/sdb1";
QString mountpoint =3D "/mnt/usb";
// the desktopfile is used to update the icon, ignored in this case
QString desktopfile =3D QString::null;
bool progress =3D true;

// expected behaviour: mount the USB device
new KAutoMount(ro, format, device, mountpoint, desktopfile, progress);
}
-- end of code 2 --

-- code 3 --
class myMount : public QObject{
Q_OBJECT;
public:
myMount() {
bool ro =3D false;
QString device =3D "/dev/sdb1";
QString mountpoint =3D "/mnt/usb";
bool progress =3D true;

KIO::Job *job =3D KIO::mount(ro, 0L, device, mountpoint, progress);
connect(job, SIGNAL(result(KIO::Job*)), this, SLOT(jobResult(KIO::Job*)));
}

protected slots:
void jobResult(KIO::Job *job) {
if (job->error())
job->showErrorDialog();
}
};

int main(int argc, char **argv) {
KCmdLineArgs::init(argc, argv, "app", "prog", "desc", "0.0");
KApplication app(false, false);

myMount m;
}

#include "mount.moc"

-- end of code 3 --



=

>> Visit http://mail.kde.org/mailman/listinfo/kde-devel#unsub to unsubscrib=

e <<