RFC: rename or kill KShortcut / add new triggers to KAction

David Faure faure at kde.org
Fri Nov 3 09:47:15 GMT 2006


On Fri Nov 3 2006, Andreas Hartmetz wrote:
> Hi!
> 
> I never liked the mess of KAction, KShortcut and KAccel. Hamish Rodda
> did a nice job cleaning it up and I still don't like the parts that
> are left.
> KShortcut is not much more than a QList<QKeySequence> now and I see no
> good reason to keep it. Applications may need to adapt, but a quick
> grep through kdebase didn't find any code that really needs KShortcut.
I'm afraid your grep program is broken :-)

Just one example from konqueror/konq_mainwindow.cc:
  KShortcut reloadShortcut = KStdAccel::shortcut(KStdAccel::Reload);
  reloadShortcut.append(Qt::CTRL + Qt::Key_R);
  m_paReload = new KAction(KIcon("reload"),  i18n( "&Reload" ), actionCollection(), "reload" );

> Additionally, QShortcut exists now (since Qt 4.0) and it is something
> very different from KShortcut. This violates the principle of least
> surprise.

Well it's only "very different" because it supports multiple alternative shortcuts, no?

The above code with QList<QKeySequence> would look a bit uglier.
Maybe KShortcut should be KShortcuts? ;)

> What I propose is to:
> either
> -remove KShortcut
> or
> -rename KShortcut to KActionTriggerSet and make its API very similar
> to KAction's shortcuts manipulation API. KActionTriggerSet should hold
> exactly the triggers of one KAction including its default triggers,
> not more and not less.
Hmm. I guess this proposal alone wouldn't make much sense (more complicated name)
but if that class also holds mouse gestures then I guess it does make sense.

-- 
David Faure, faure at kde.org, sponsored by Trolltech to work on KDE,
Konqueror (http://www.konqueror.org), and KOffice (http://www.koffice.org).




More information about the kde-core-devel mailing list