History combo bug
Jakub Stachowski
qbast at go2.pl
Sat Sep 22 19:40:55 BST 2007
Hello,
Right now konqueror has quite irritating bug: if you type address
containing ':' (which means every protocol - and no completion for http://
addresses is another bug), return key does not work anymore. I took some time
to debug this and even made quick hack to fix it, but it maybe someone with
better understanding of even handling can find more correct fix.
Konqueror url bar derives from KHistoryComboBox that in turn is made of two
widgets: KLineEdit and (only sometimes shown) KCompletionBox.
When user presses a key, then event can be delivered in two different ways,
depending on completion box being shown or not.
1) with completion box shown
- event is delivered to kcompletionbox.
- it is caught by kcompletionbox eventFilter and 'manually' sent to line edit
by QApplication::sendEvent. This looks hacky and was added by coolo with
following comment:
//not sure if this is a work around for a Qt bug or a fix for changed
qt behaviour, at least it makes the kcombobox work again for me
- klineedit gets event, and in its eventFilter handles 'return' key - this
means that return works if completion box is shown. After that keyPressed is
called.
2) with completion box hidden
- event is delivered to khistorycombobox
- there are no event filters there, so keyPressed is called
- qcombobox keyPress directly calls lineedit->event() (instead of using
sendEvent). This means that event filters registered for lineedit are not
called, and klineedit does not handle return.
How can it be fixed? My simple hack registers eventFilter for kcombobox and
directly calls lineedit->eventFilter. This fixes konqueror, but will fail to
call any other filters registered for line edit.
Another way to fix it would be move return handling from
klineedit::eventFilter to klineedit::keyPressed.
So, comments please?
-------------- next part --------------
A non-text attachment was scrubbed...
Name: konqfix.patch
Type: text/x-diff
Size: 543 bytes
Desc: not available
URL: <http://mail.kde.org/pipermail/kde-core-devel/attachments/20070922/bb91f346/attachment.patch>
More information about the kde-core-devel
mailing list