Though this is documented in multiple places, it might not be apparent to a
lot of developers as I have encountered and addressed this issue in
multiple places recently.

If you are using KIO in your application and you want user provided
credentials to be cached for the duration of your application, you need to
make sure you call KIO::JobUiDelegate::setWindow once you obtain an
instance of a KIO job. You set the main window through the
KIO::JobUiDelegate instance provided by KIO::Job itself (see
KIO::Job::ui()):

KIO::TransferJob* job = KIO::get(url);
job->ui()->setWindow(widget->window());

Unless you do that, any credential requested from the user will only be
cached for approx. 10 secs. When that time expires, the user will be
prompted to enter those credentials again. BTW, this also applies to other
classes like KDirLister as well. In case of KDirLister, you have to do the
following:

KDirLister* lister = new KDirLister;
lister->setMainWindow(widget->window());

So, the next time a user complains about being required to login
credentials over and over again when using your application, check your
code to make sure it is doing the right thing.

Regards,
Dawit A.
>> Visit http://mail.kde.org/mailman/listinfo/kde-devel#unsub to unsubscribe <<

Reply via email to