3 KUrlRequester questions

Konstantinos Smanis kon.smanis at gmail.com
Tue Jul 21 14:40:19 BST 2009


I'll try to keep this quite straight-forward:

Please, take a look at where the openFileDialog( KUrlRequester * ) signal is
emitted:
http://api.kde.org/4.x-api/kdelibs-apidocs/kio/html/kurlrequester_8cpp-source.html#l00303

Now, question #1:
Why does the signal emission occur before everything else in the "else"
body? This can be quite frustrating if one wants to customise the
KFileDialog selection:

Let's say the KUrlRequester has a /home/user/foo.txt url(). And you want the
dialog to initially select a different file (let's say /home/user/bar.txt).
One would think "nice, just connect the signal openFileDialog() somewhere,
and there use setSelection() on the dialog to have the other file initially
selected". But no, this is impossible because the file dialog's selection
changes a few lines of code afterwards. Is this done on purpose to avoid
customising the file dialog's selection?

[The example is really dumb and makes no sense but I didn't want to mess
with the real case details. You get the idea..]

Question #2:
Just out of curiosity (and probably stupidity), why does the openFileDialog
signal provide a KUrlRequester pointer? Extract from the documentation:

"If you use multiple KUrlRequesters, you can connect all of them to the same
slot and use the given KUrlRequester pointer to know which one is going to
open."

Can't we simply call QObject::sender() to find out the caller?

Question #3:
Is there any need to have the "myCompletion" variable? Can't we just use
KLineEdit's/KComboBox's accessors?

Konstantinos Smanis
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.kde.org/pipermail/kde-core-devel/attachments/20090721/58967d61/attachment.htm>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 270 bytes
Desc: not available
URL: <http://mail.kde.org/pipermail/kde-core-devel/attachments/20090721/58967d61/attachment.sig>


More information about the kde-core-devel mailing list