KeyBindings & Friends in KDE 4.0

Simon Hausmann hausmann at kde.org
Sun May 23 06:31:30 BST 2004


On Sunday 23 May 2004 06:32, Benjamin Meyer wrote:
> On Saturday 22 May 2004 6:11 am, Olivier Goffart wrote:
> > Le Samedi 22 Mai 2004 03:14, Benjamin Meyer a écrit :
> > > Most applications have a one line function in them as follows:
> > >
> > > /**
> > >  * Bring up the key configuration dialog.
> > >  */
> > > void KTron::configureKeys(){
> > >   KKeyDialog::configure(actionCollection(), this);
> > > }
> > >
> > > What if we made this a virtual function in KMainWindow?  Then for the
> > > majority of applications they would only have to do:
> > >
> > > KStdAction::keyBindings(this, SLOT(configureKeys()),
> > > actionCollection());
> >
> > I've done a  KXMLGUIFactory::configureShortcuts()  slot.  so it's already
> > possible to do
> >
> > KStdAction::keyBindings(factory(), SLOT(configureShortcuts()),
> > actionCollection());
> >
> > KXMLGUIFactory::configureShortcuts()  does not let to configure only the
> > set of actions from the action collection, but every action of kparts or
> > plugins.
> >
> > But AFAIK, only few applicaiton use that function.
> > Maybe i should add a @see also  in the KKeyDialog::configure API doc
> >
> > > Same with configuring the toolbars...
> > >
> > > KStdAction::configureToolbars(this, SLOT(configuretoolbars() ),
> > > actionCollection(), "configuretoolbars");
> > >
> > > Or even go one step further when createGUI is called if a toolbar is
> > > created the configure and show actions are automaticly added and
> > > handled same with shortcuts.
> > >
> > > Also what about turning  setAutoSaveSettings() on by default rather
> > > then having every single application have to call it (and some
> > > forgetting to)?
> >
> > Yes, i think the same
> > cf http://lists.kde.org/?l=kde-core-devel&m=108316630008423&w=2
>
> I have created a small patch which adds two functions to configure the
> toolbars.
>
> 1) How do you verify the parent is a KMainWindow?

Much like the already existing configureShortcuts methods I believe these two 
are in the wrong class, too. Code should be 'next' to the data it operates 
on. These operate on the mainwindow, hence they should be in the mainwindow 
class.

Simon




More information about the kde-core-devel mailing list