[prev in list] [next in list] [prev in thread] [next in thread] 

List:       kde-devel
Subject:    A note about KIO and password management
From:       Dawit A <adawit () kde ! org>
Date:       2012-04-20 18:13:29
Message-ID: CALa28R4zSaa64LcdvSYUdk2nZT58rXzDy3Y4ZQmOxUg+yC=B6A () mail ! gmail ! com
[Download RAW message or body]

[Attachment #2 (multipart/alternative)]


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.

[Attachment #5 (text/html)]

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.<div><br></div><div><div>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()):</div>

<div><br></div><div>KIO::TransferJob* job = \
KIO::get(url);</div><div>job-&gt;ui()-&gt;setWindow(widget-&gt;window());</div><div><br></div><div>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:</div>

</div><div><br></div><div>KDirLister* lister = new \
KDirLister;</div><div>lister-&gt;setMainWindow(widget-&gt;window());</div><div><br></div><div>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.</div>

<div><br></div><div>Regards,</div><div>Dawit A.</div>



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


[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic