On Thu, Nov 01, 2001 at 12:44:11PM +0200, Guillaume Laurent wrote: > I'd like to commit the attached patch to CVS Head. What it does is allowing > the definition of "state changes" in an XML rc file, to make easier the > management of actions' enable/disable status. This is done through a new slot > in KMainWindow : stateChanged(const QString&); > > For instance, you can define something like : > > > > > > > > > in your application's rc file, then in the relevant place of your code just do > stateChanged("file_changed"), which will enable the "file_save" and > "edit_undo" actions. > > Another example : > > > > > > > > > > > Then after loading a file you simply call stateChanged("file_loaded"), which > will enable "file_close" and disable "file_save". > > The state names are free form strings. Excellent idea! Implementation looks good to me. Just some minor comments (I'm a nitpicker ;-) 1) Just an idea, but how about reflecting the notion of the state in the API a bit more, by having sth. like an ActionState structure: struct ActionState (TODO: find better name ;) { QStringList actionsToEnable; QStringList actionsToDisable; }; Along with a QMap m_actionStates; instead of two maps as storage. 2) The stateChanged method sounds generally useful. Why not move it to KXMLGUIClient? (it should still be possible to declare it as slot in kmainwindow, I think) Simon