Bug 353150 - Pressing Alt+E in composer results in message being send when kwidgetsaddons are active
Summary: Pressing Alt+E in composer results in message being send when kwidgetsaddons ...
Status: RESOLVED DUPLICATE of bug 337491
Alias: None
Product: trojita
Classification: Applications
Component: Desktop GUI (show other bugs)
Version: git
Platform: Other Linux
: NOR normal
Target Milestone: ---
Assignee: Trojita default assignee
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2015-09-24 22:48 UTC by Jan Kundrát
Modified: 2017-11-02 19:29 UTC (History)
1 user (show)

See Also:
Latest Commit:
Version Fixed In:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Jan Kundrát 2015-09-24 22:48:41 UTC
TL;DR: kwidgetsaddons' KAcceleratorManager injects accelerators to all buttons, unconditionally. Alt-E is a shortcut for € in Czech layout. If I confuse my layouts and want to type €, my e-mail gets sent. Happened to me twice in a row. Setting the shortcut to an empty QKeySequence() in the widget's ctor doesn't help :(. This happens on Plasma5 which injects that kwidgetsaddons plugin into Qt upon install, and this plugin gets loaded automagically upon app startup, apparently.

I think that eventFilter looks like a hammer big enough to fix this thing, but it will still result in the an underscore shown in the button's text, which might be confusing.

Unconditionally depending on KWIdgetsAddons so that one can call KAcceleratorManager::setNoAccel is a no-no from my point of view.

Should we maybe dlopen() that plugin, or something? This is crazy.

(gdb) bt
#0  QAbstractButton::setShortcut (this=this@entry=0x555555d4f450, key=...)
    at /var/tmp/portage/dev-qt/qtwidgets-5.5.9999/work/qtwidgets-5.5.9999/src/widgets/widgets/qabstractbutton.cpp:690
#1  0x00007ffff7709245 in QAbstractButton::setText (this=0x555555d4f450, text=...)
    at /var/tmp/portage/dev-qt/qtwidgets-5.5.9999/work/qtwidgets-5.5.9999/src/widgets/widgets/qabstractbutton.cpp:643
#2  0x00007ffff7a3300a in QAbstractButton::qt_static_metacall (_o=_o@entry=0x555555d4f450, _c=_c@entry=QMetaObject::WriteProperty, _id=_id@entry=0, _a=_a@entry=0x7fffffffc280)
    at .moc/moc_qabstractbutton.cpp:211
#3  0x00007ffff7a33263 in QAbstractButton::qt_metacall (this=this@entry=0x555555d4f450, _c=_c@entry=QMetaObject::WriteProperty, _id=0, _a=_a@entry=0x7fffffffc280)
    at .moc/moc_qabstractbutton.cpp:265
#4  0x00007ffff77b90e8 in QPushButton::qt_metacall (this=0x555555d4f450, _c=QMetaObject::WriteProperty, _id=<optimized out>, _a=0x7fffffffc280) at .moc/moc_qpushbutton.cpp:134
#5  0x00007ffff43fd95b in QMetaProperty::write (this=this@entry=0x7fffffffc360, object=object@entry=0x555555d4f450, value=...)
    at /var/tmp/portage/dev-qt/qtcore-5.5.9999/work/qtcore-5.5.9999/src/corelib/kernel/qmetaobject.cpp:3092
#6  0x00007ffff442f30f in QObject::setProperty (this=0x555555d4f450, name=0x7fffe57a5aad "text", value=...)
    at /var/tmp/portage/dev-qt/qtcore-5.5.9999/work/qtcore-5.5.9999/src/corelib/kernel/qobject.cpp:3858
#7  0x00007fffe5703e4e in KAcceleratorManagerPrivate::calculateAccelerators (item=item@entry=0x555555d415d0, used=...)
    at /var/tmp/portage/kde-frameworks/kwidgetsaddons-9999/work/kwidgetsaddons-9999/src/kacceleratormanager.cpp:177
#8  0x00007fffe5705469 in KAcceleratorManagerPrivate::manage (widget=widget@entry=0x555555ddb7e0)
    at /var/tmp/portage/kde-frameworks/kwidgetsaddons-9999/work/kwidgetsaddons-9999/src/kacceleratormanager.cpp:113
#9  0x00007fffe57055a1 in KAcceleratorManager::manage (widget=widget@entry=0x555555ddb7e0, programmers_mode=programmers_mode@entry=false)
    at /var/tmp/portage/kde-frameworks/kwidgetsaddons-9999/work/kwidgetsaddons-9999/src/kacceleratormanager.cpp:435
#10 0x00007fffe69372ff in KCheckAccelerators::checkAccelerators (this=this@entry=0x555555abd6f0, automatic=<optimized out>)
    at /var/tmp/portage/kde-frameworks/kxmlgui-9999/work/kxmlgui-9999/src/kcheckaccelerators.cpp:258
#11 0x00007fffe6938404 in KCheckAccelerators::autoCheckSlot (this=0x555555abd6f0) at /var/tmp/portage/kde-frameworks/kxmlgui-9999/work/kxmlgui-9999/src/kcheckaccelerators.cpp:208
#12 0x00007ffff4425408 in QMetaObject::activate (sender=sender@entry=0x555555abd710, signalOffset=<optimized out>, local_signal_index=local_signal_index@entry=0, argv=argv@entry=0x0)
    at /var/tmp/portage/dev-qt/qtcore-5.5.9999/work/qtcore-5.5.9999/src/corelib/kernel/qobject.cpp:3711
#13 0x00007ffff4425b25 in QMetaObject::activate (sender=sender@entry=0x555555abd710, m=m@entry=0x7ffff46546e0 <QTimer::staticMetaObject>, local_signal_index=local_signal_index@entry=0, 
    argv=argv@entry=0x0) at /var/tmp/portage/dev-qt/qtcore-5.5.9999/work/qtcore-5.5.9999/src/corelib/kernel/qobject.cpp:3576
#14 0x00007ffff44c3696 in QTimer::timeout (this=this@entry=0x555555abd710) at .moc/moc_qtimer.cpp:197
#15 0x00007ffff4434c92 in QTimer::timerEvent (this=0x555555abd710, e=<optimized out>) at /var/tmp/portage/dev-qt/qtcore-5.5.9999/work/qtcore-5.5.9999/src/corelib/kernel/qtimer.cpp:247
#16 0x00007ffff442628c in QObject::event (this=0x555555abd710, e=<optimized out>) at /var/tmp/portage/dev-qt/qtcore-5.5.9999/work/qtcore-5.5.9999/src/corelib/kernel/qobject.cpp:1220
#17 0x00007ffff760cc1c in QApplicationPrivate::notify_helper (this=this@entry=0x555555a710b0, receiver=receiver@entry=0x555555abd710, e=e@entry=0x7fffffffcc40)
    at /var/tmp/portage/dev-qt/qtwidgets-5.5.9999/work/qtwidgets-5.5.9999/src/widgets/kernel/qapplication.cpp:3717
#18 0x00007ffff761247a in QApplication::notify (this=0x7fffffffd2b0, receiver=0x555555abd710, e=0x7fffffffcc40)
    at /var/tmp/portage/dev-qt/qtwidgets-5.5.9999/work/qtwidgets-5.5.9999/src/widgets/kernel/qapplication.cpp:3500
#19 0x00007ffff43ec38d in QCoreApplication::notifyInternal (this=0x7fffffffd2b0, receiver=0x555555abd710, event=event@entry=0x7fffffffcc40)
    at /var/tmp/portage/dev-qt/qtcore-5.5.9999/work/qtcore-5.5.9999/src/corelib/kernel/qcoreapplication.cpp:965
#20 0x00007ffff445390d in sendEvent (event=0x7fffffffcc40, receiver=<optimized out>) at ../../include/QtCore/../../../qtcore-5.5.9999/src/corelib/kernel/qcoreapplication.h:224
#21 QTimerInfoList::activateTimers (this=0x555555abd890) at /var/tmp/portage/dev-qt/qtcore-5.5.9999/work/qtcore-5.5.9999/src/corelib/kernel/qtimerinfo_unix.cpp:637
#22 0x00007ffff4453d0f in timerSourceDispatch (source=<optimized out>) at /var/tmp/portage/dev-qt/qtcore-5.5.9999/work/qtcore-5.5.9999/src/corelib/kernel/qeventdispatcher_glib.cpp:177
#23 0x00007fffef5792a9 in g_main_dispatch (context=0x7fffe0002450) at /var/tmp/portage/dev-libs/glib-2.42.2/work/glib-2.42.2/glib/gmain.c:3111
#24 g_main_context_dispatch (context=context@entry=0x7fffe0002450) at /var/tmp/portage/dev-libs/glib-2.42.2/work/glib-2.42.2/glib/gmain.c:3710
#25 0x00007fffef579538 in g_main_context_iterate (context=context@entry=0x7fffe0002450, block=block@entry=1, dispatch=dispatch@entry=1, self=<optimized out>)
    at /var/tmp/portage/dev-libs/glib-2.42.2/work/glib-2.42.2/glib/gmain.c:3781
#26 0x00007fffef579641 in g_main_context_iteration (context=0x7fffe0002450, may_block=1) at /var/tmp/portage/dev-libs/glib-2.42.2/work/glib-2.42.2/glib/gmain.c:3842
#27 0x00007ffff44540f1 in QEventDispatcherGlib::processEvents (this=0x555555ab69e0, flags=...)
    at /var/tmp/portage/dev-qt/qtcore-5.5.9999/work/qtcore-5.5.9999/src/corelib/kernel/qeventdispatcher_glib.cpp:418
#28 0x00007ffff43e982b in QEventLoop::exec (this=this@entry=0x7fffffffcf20, flags=..., flags@entry=...)
    at /var/tmp/portage/dev-qt/qtcore-5.5.9999/work/qtcore-5.5.9999/src/corelib/kernel/qeventloop.cpp:204
#29 0x00007ffff43f2c9e in QCoreApplication::exec () at /var/tmp/portage/dev-qt/qtcore-5.5.9999/work/qtcore-5.5.9999/src/corelib/kernel/qcoreapplication.cpp:1229
#30 0x00005555555bb89a in main (argc=3, argv=<optimized out>) at /home/jkt/work/prog/trojita/src/Gui/main.cpp:213
Comment 1 Jan Kundrát 2015-09-24 22:53:25 UTC
...and this is all due to kxmlgui, apparently, which we of course do not even use :).
Comment 2 Thomas Lübking 2015-09-24 23:30:35 UTC
http://lxr.kde.org/source/frameworks/kxmlgui/src/kcheckaccelerators.cpp

This looks horrible.
It installs an eventfilter on the application(!) and for every QEvent::Resize AND QEvent::LayoutRequest (and only god knows why resize events are prone to alter accelerators) of _any_ widget (all!) restarts a timer (and on window de/activation and some other stuff)

Christoph, it reads from a "Development" group - could it be that this is accidentally opt-out (ie. "AutoCheckAccelerators" should default to false)?

Otherwise I assume "AutoCheckAccelerators" should default to some application property (and the code streamlined a bit ;-)
Comment 3 Christoph Feck 2017-10-04 13:20:52 UTC

*** This bug has been marked as a duplicate of bug 337491 ***
Comment 4 Jan Kundrát 2017-11-02 19:29:30 UTC
Git commit 9847606f232d01dd1ac6120579f2f2e90ea9bb1e by Jan Kundrát, on behalf of Roland Pallai.
Committed on 02/11/2017 at 19:20.
Pushed by gerrit into branch 'master'.

Do not add ampersands on address completion

Using qaction->data() instead of text() because the latter may (and will)
be tampered by Qt (with ampersands).
Change-Id: I61f9917d4079c05e0c477a02675c401beb19bf4d

M  +3    -3    src/Gui/ComposeWidget.cpp

https://commits.kde.org/trojita/9847606f232d01dd1ac6120579f2f2e90ea9bb1e