On Tuesday 13 November 2001 11:44 pm, Waldo Bastian wrote: > On Tuesday 13 November 2001 03:25 pm, Richard Moore wrote: > > I've just added a new library KJSEmbed to kdenonbeta that makes it easy > > to embed a KJS interpreter in a KDE app. The lib includes bindings that > > let scripts access QWidgetFactory (so they can load dialogs/widgets from > > QtDesigner .ui files), and a binding to the properties of QObjects. > > Coolness, *feature request* could you (or someone else) add support for > scriptable custom KActions, so that you can add your own toolbar-buttons > that execute some script. I'm already working on it, but the code isn't quite done yet. :-) Here's an example of using things from the script point of view I just added to the README (shows the example in use): -- Enter a JS expression and press enter -- kjs> 10+20 30 kjs> print("Hello World!") Hello World! undefined kjs> Math.sin(0) 0 kjs> Math.cos(0) 1 kjs> console JSConsoleWidget (KJSEmbed::JSConsoleWidget) kjs> console.childCount() 4 kjs> console.childAt(1) CmdEdit (QComboBox) kjs> console.childAt(2) RunButton (QPushButton) kjs> console.findChild("RunButton") RunButton (QPushButton) kjs> console.findChild("RunButton").text = "Go!" Go! kjs> console.caption = "Different Title" Different Title The action loading will be an extension of the existing jshookloader class, so it shouldn't take long to get it working. I might extend the factory to let you make actions from the script itself too (not sure about that though). > > Real life test-case: *) > > As a user I want to be able to add a "Close this bugreport" action to > KMail. E.g. it should reply to a mail and set the to address to > "-done@bugs.kde.org", possibly scanning the subject for the bugnumber. > (Since coolo refuses to replace the "submit@bugs.kde.org" from address) Nice example! Rich. > > Cheers, > Waldo