summaryrefslogtreecommitdiffstats
path: root/kjsembed
diff options
context:
space:
mode:
Diffstat (limited to 'kjsembed')
-rw-r--r--kjsembed/Doxyfile227
-rw-r--r--kjsembed/Doxyfile-Internal824
-rw-r--r--kjsembed/Makefile.am88
-rw-r--r--kjsembed/README48
-rw-r--r--kjsembed/TODO1
-rw-r--r--kjsembed/binding_type.desktop3
-rw-r--r--kjsembed/bindings/Makefile.am29
-rw-r--r--kjsembed/bindings/bindingobject.cpp18
-rw-r--r--kjsembed/bindings/bindingobject.h61
-rw-r--r--kjsembed/bindings/bindings.pro35
-rw-r--r--kjsembed/bindings/brush_imp.cpp121
-rw-r--r--kjsembed/bindings/brush_imp.h57
-rw-r--r--kjsembed/bindings/dcop_imp.cpp1020
-rw-r--r--kjsembed/bindings/dcop_imp.h152
-rw-r--r--kjsembed/bindings/iconset_imp.cpp167
-rw-r--r--kjsembed/bindings/iconset_imp.h59
-rw-r--r--kjsembed/bindings/image_imp.cpp259
-rw-r--r--kjsembed/bindings/image_imp.h95
-rw-r--r--kjsembed/bindings/kconfig_imp.cpp536
-rw-r--r--kjsembed/bindings/kconfig_imp.h135
-rw-r--r--kjsembed/bindings/movie_imp.cpp158
-rw-r--r--kjsembed/bindings/movie_imp.h77
-rw-r--r--kjsembed/bindings/netaccess_imp.cpp156
-rw-r--r--kjsembed/bindings/netaccess_imp.h62
-rw-r--r--kjsembed/bindings/painter_imp.cpp521
-rw-r--r--kjsembed/bindings/painter_imp.h127
-rw-r--r--kjsembed/bindings/pen_imp.cpp127
-rw-r--r--kjsembed/bindings/pen_imp.h57
-rw-r--r--kjsembed/bindings/pixmap_imp.cpp180
-rw-r--r--kjsembed/bindings/pixmap_imp.h87
-rw-r--r--kjsembed/bindings/point_imp.cpp92
-rw-r--r--kjsembed/bindings/point_imp.h56
-rw-r--r--kjsembed/bindings/rect_imp.cpp111
-rw-r--r--kjsembed/bindings/rect_imp.h56
-rw-r--r--kjsembed/bindings/size_imp.cpp133
-rw-r--r--kjsembed/bindings/size_imp.h56
-rw-r--r--kjsembed/bindings/sql_imp.cpp310
-rw-r--r--kjsembed/bindings/sql_imp.h141
-rw-r--r--kjsembed/bindwizard/Doxyfile.in824
-rwxr-xr-xkjsembed/bindwizard/binding_wizard.js244
-rw-r--r--kjsembed/bindwizard/binding_wizard.ui490
-rw-r--r--kjsembed/bindwizard/doxygen2imp_cpp.xsl560
-rw-r--r--kjsembed/bindwizard/doxygen2imp_h.xsl128
-rw-r--r--kjsembed/bindwizard/index_classes.xsl11
-rw-r--r--kjsembed/builtins/Makefile.am18
-rw-r--r--kjsembed/builtins/builtins.pro18
-rw-r--r--kjsembed/builtins/qdir_imp.cpp1009
-rw-r--r--kjsembed/builtins/qdir_imp.h172
-rw-r--r--kjsembed/builtins/qfile_imp.cpp622
-rw-r--r--kjsembed/builtins/qfile_imp.h148
-rw-r--r--kjsembed/builtins/resources.cpp231
-rw-r--r--kjsembed/builtins/resources.h99
-rw-r--r--kjsembed/builtins/saxhandler.cpp186
-rw-r--r--kjsembed/builtins/saxhandler.h80
-rw-r--r--kjsembed/builtins/stdaction_imp.cpp99
-rw-r--r--kjsembed/builtins/stdaction_imp.h68
-rw-r--r--kjsembed/builtins/stddialog_imp.cpp147
-rw-r--r--kjsembed/builtins/stddialog_imp.h81
-rw-r--r--kjsembed/builtins/textstream_imp.cpp134
-rw-r--r--kjsembed/builtins/textstream_imp.h79
-rw-r--r--kjsembed/cpptests/Makefile.am2
-rw-r--r--kjsembed/cpptests/jsaccess/Makefile.am18
-rw-r--r--kjsembed/cpptests/jsaccess/jsaccess.cpp106
-rw-r--r--kjsembed/customobject_imp.cpp1444
-rw-r--r--kjsembed/customobject_imp.h224
-rw-r--r--kjsembed/design.h183
-rw-r--r--kjsembed/docs/ChangeLog4243
-rw-r--r--kjsembed/docs/Makefile.am1
-rw-r--r--kjsembed/docs/TODO81
-rw-r--r--kjsembed/docs/build-docs.js230
-rwxr-xr-xkjsembed/docs/build-docs.sh87
-rw-r--r--kjsembed/docs/changes.html11
-rw-r--r--kjsembed/docs/classdocs/dummy.txt1
-rw-r--r--kjsembed/docs/conventions.html28
-rw-r--r--kjsembed/docs/embedding/Makefile.am2
-rw-r--r--kjsembed/docs/embedding/qtembed/main.cpp18
-rwxr-xr-xkjsembed/docs/embedding/qtembed/posviewbase.ui183
-rw-r--r--kjsembed/docs/embedding/qtembed/posviewimp.cpp30
-rw-r--r--kjsembed/docs/embedding/qtembed/posviewimp.h26
-rwxr-xr-xkjsembed/docs/embedding/qtembed/qtembed.pro12
-rw-r--r--kjsembed/docs/embedding/qtembed/test.js3
-rwxr-xr-xkjsembed/docs/embedding/qtembed/view.ui85
-rw-r--r--kjsembed/docs/embedding/simple-embed/Makefile.am40
-rw-r--r--kjsembed/docs/embedding/simple-embed/README81
-rw-r--r--kjsembed/docs/embedding/simple-embed/demo.html93
-rw-r--r--kjsembed/docs/embedding/simple-embed/embedjs.desktop29
-rw-r--r--kjsembed/docs/embedding/simple-embed/embedjs.lsm16
-rw-r--r--kjsembed/docs/embedding/simple-embed/embedjsui.rc14
-rw-r--r--kjsembed/docs/embedding/simple-embed/embedview.ui183
-rw-r--r--kjsembed/docs/embedding/simple-embed/embedviewimp.cpp78
-rw-r--r--kjsembed/docs/embedding/simple-embed/embedviewimp.h34
-rw-r--r--kjsembed/docs/embedding/simple-embed/hi16-app-embedjs.pngbin0 -> 1033 bytes
-rw-r--r--kjsembed/docs/embedding/simple-embed/hi32-app-embedjs.pngbin0 -> 2749 bytes
-rw-r--r--kjsembed/docs/embedding/simple-embed/main.cpp45
-rw-r--r--kjsembed/docs/embedding/simple-embed/test.js37
-rw-r--r--kjsembed/docs/examples/README67
-rw-r--r--kjsembed/docs/examples/actions/simple-actions.js19
-rwxr-xr-xkjsembed/docs/examples/builtins/messages.js8
-rw-r--r--kjsembed/docs/examples/buttonmaker/01.pngbin0 -> 482 bytes
-rw-r--r--kjsembed/docs/examples/buttonmaker/02.pngbin0 -> 220 bytes
-rw-r--r--kjsembed/docs/examples/buttonmaker/03.pngbin0 -> 583 bytes
-rw-r--r--kjsembed/docs/examples/buttonmaker/04.pngbin0 -> 209 bytes
-rw-r--r--kjsembed/docs/examples/buttonmaker/05.pngbin0 -> 153 bytes
-rw-r--r--kjsembed/docs/examples/buttonmaker/06.pngbin0 -> 205 bytes
-rw-r--r--kjsembed/docs/examples/buttonmaker/07.pngbin0 -> 582 bytes
-rw-r--r--kjsembed/docs/examples/buttonmaker/08.pngbin0 -> 217 bytes
-rw-r--r--kjsembed/docs/examples/buttonmaker/09.pngbin0 -> 617 bytes
-rw-r--r--kjsembed/docs/examples/buttonmaker/ButtonMakerUI.ui592
-rw-r--r--kjsembed/docs/examples/buttonmaker/buttonmaker.desktop10
-rwxr-xr-xkjsembed/docs/examples/buttonmaker/buttonmaker.js266
-rw-r--r--kjsembed/docs/examples/buttonmaker/default.pngbin0 -> 2159 bytes
-rw-r--r--kjsembed/docs/examples/buttonmaker/gray.pngbin0 -> 2127 bytes
-rw-r--r--kjsembed/docs/examples/buttonmaker/package.sh14
-rwxr-xr-xkjsembed/docs/examples/buttonmaker/pillbox.js172
-rwxr-xr-xkjsembed/docs/examples/calc/calc.js65
-rw-r--r--kjsembed/docs/examples/calc/calc.ui258
-rwxr-xr-xkjsembed/docs/examples/cmdline/cmdline.js78
-rw-r--r--kjsembed/docs/examples/combobox/combo.js17
-rw-r--r--kjsembed/docs/examples/connect-cpp/connect-cpp.js36
-rw-r--r--kjsembed/docs/examples/connect/connect.js45
-rw-r--r--kjsembed/docs/examples/connect/connect.ui160
-rw-r--r--kjsembed/docs/examples/customwidget/README2
-rwxr-xr-xkjsembed/docs/examples/customwidget/custom_widget.js57
-rwxr-xr-xkjsembed/docs/examples/dcop/interface.js17
-rwxr-xr-xkjsembed/docs/examples/dcop/rss.js39
-rwxr-xr-xkjsembed/docs/examples/dcop/signalslot.js25
-rwxr-xr-xkjsembed/docs/examples/dcop/weather.js25
-rw-r--r--kjsembed/docs/examples/docviewer/docviewer.js223
-rw-r--r--kjsembed/docs/examples/docviewer/docviewer.ui69
-rw-r--r--kjsembed/docs/examples/envelopemaker/EnvelopeMakerUI.ui568
-rw-r--r--kjsembed/docs/examples/envelopemaker/README6
-rwxr-xr-xkjsembed/docs/examples/envelopemaker/env.js253
-rw-r--r--kjsembed/docs/examples/envelopemaker/envelopemaker.desktop10
-rw-r--r--kjsembed/docs/examples/envelopemaker/package.sh10
-rw-r--r--kjsembed/docs/examples/eventhandling/jsboard.js89
-rw-r--r--kjsembed/docs/examples/eventhandling/mousetrack.js21
-rw-r--r--kjsembed/docs/examples/eventhandling/scribble.js34
-rw-r--r--kjsembed/docs/examples/frame/frame.js28
-rw-r--r--kjsembed/docs/examples/grepdialog/README6
-rw-r--r--kjsembed/docs/examples/grepdialog/grepdlg.js23
-rw-r--r--kjsembed/docs/examples/grepdialog/grepdlg.ui199
-rw-r--r--kjsembed/docs/examples/grepdialog/grepresults.js36
-rw-r--r--kjsembed/docs/examples/grepdialog/grepresults.ui131
-rwxr-xr-xkjsembed/docs/examples/grepdialog/guigrep6
-rw-r--r--kjsembed/docs/examples/html2text/html2text.js7
-rw-r--r--kjsembed/docs/examples/html2text/html2text_plugin.js19
-rw-r--r--kjsembed/docs/examples/html2text/html2text_plugin.xml24
-rw-r--r--kjsembed/docs/examples/html2text/html2text_pluginui.rc10
-rw-r--r--kjsembed/docs/examples/html2text/test.htm208
-rwxr-xr-xkjsembed/docs/examples/html2text/text2html.js9
-rwxr-xr-xkjsembed/docs/examples/htmlinfo/htmlinfo.js63
-rw-r--r--kjsembed/docs/examples/imagefun/base.pngbin0 -> 1445 bytes
-rwxr-xr-xkjsembed/docs/examples/imagefun/bump.js87
-rw-r--r--kjsembed/docs/examples/imagefun/bump.ui327
-rw-r--r--kjsembed/docs/examples/imagefun/bumptest.pngbin0 -> 950 bytes
-rw-r--r--kjsembed/docs/examples/imagefun/mask-gradient.pngbin0 -> 9678 bytes
-rw-r--r--kjsembed/docs/examples/imagefun/mask-noise.pngbin0 -> 15997 bytes
-rwxr-xr-xkjsembed/docs/examples/imagefun/rotate.js26
-rwxr-xr-xkjsembed/docs/examples/imagefun/title.js36
-rw-r--r--kjsembed/docs/examples/imageinfo/README22
-rw-r--r--kjsembed/docs/examples/imageinfo/example.html44
-rw-r--r--kjsembed/docs/examples/imageinfo/example1.htm6
-rw-r--r--kjsembed/docs/examples/imageinfo/example1.pngbin0 -> 67208 bytes
-rw-r--r--kjsembed/docs/examples/imageinfo/example2.htm7
-rw-r--r--kjsembed/docs/examples/imageinfo/example2.pngbin0 -> 12943 bytes
-rw-r--r--kjsembed/docs/examples/imageinfo/example3.pngbin0 -> 13796 bytes
-rw-r--r--kjsembed/docs/examples/imageinfo/example4.pngbin0 -> 21560 bytes
-rwxr-xr-xkjsembed/docs/examples/imageinfo/imagegallery.js113
-rwxr-xr-xkjsembed/docs/examples/imageinfo/imagegallery.sh8
-rwxr-xr-xkjsembed/docs/examples/imageinfo/imageinfo.js37
-rwxr-xr-xkjsembed/docs/examples/imageinfo/imagescale.js28
-rw-r--r--kjsembed/docs/examples/imageinfo/thumb-example1.pngbin0 -> 17080 bytes
-rw-r--r--kjsembed/docs/examples/imageinfo/thumb-example2.pngbin0 -> 18734 bytes
-rw-r--r--kjsembed/docs/examples/imageinfo/thumb-example3.pngbin0 -> 24897 bytes
-rw-r--r--kjsembed/docs/examples/imageinfo/thumb-example4.pngbin0 -> 17596 bytes
-rw-r--r--kjsembed/docs/examples/imageinfo/thumbs.html44
-rw-r--r--kjsembed/docs/examples/imagetweak/example1.pngbin0 -> 67208 bytes
-rw-r--r--kjsembed/docs/examples/imagetweak/example2.pngbin0 -> 12943 bytes
-rw-r--r--kjsembed/docs/examples/imagetweak/example3.pngbin0 -> 13796 bytes
-rw-r--r--kjsembed/docs/examples/imagetweak/example4.pngbin0 -> 21560 bytes
-rwxr-xr-xkjsembed/docs/examples/imagetweak/imagetweak.js76
-rw-r--r--kjsembed/docs/examples/imageviewer/imageviewer.js61
-rw-r--r--kjsembed/docs/examples/imunge/effectbrowser.ui151
-rw-r--r--kjsembed/docs/examples/imunge/imageeffect.pngbin0 -> 702 bytes
-rwxr-xr-xkjsembed/docs/examples/imunge/imunge.js239
-rwxr-xr-xkjsembed/docs/examples/imunge/imunge_actions.js320
-rw-r--r--kjsembed/docs/examples/imunge/imungeui.rc58
-rw-r--r--kjsembed/docs/examples/imunge/resizeparams.ui193
-rw-r--r--kjsembed/docs/examples/imunge/transform.pngbin0 -> 409 bytes
-rw-r--r--kjsembed/docs/examples/index.html121
-rwxr-xr-xkjsembed/docs/examples/invaders/invaders.js282
-rw-r--r--kjsembed/docs/examples/kjsuic/kjsuic.js47
-rw-r--r--kjsembed/docs/examples/listview/listview.js22
-rw-r--r--kjsembed/docs/examples/livedata/livepartdata.js25
-rw-r--r--kjsembed/docs/examples/madminute/configdialog.ui274
-rw-r--r--kjsembed/docs/examples/madminute/helpdialog.ui85
-rwxr-xr-xkjsembed/docs/examples/madminute/madminute.js161
-rw-r--r--kjsembed/docs/examples/madminute/madminute.ui361
-rwxr-xr-xkjsembed/docs/examples/multifile/multifile.js10
-rw-r--r--kjsembed/docs/examples/multifile/otherfile.js5
-rw-r--r--kjsembed/docs/examples/multipart/multipart.js56
-rwxr-xr-xkjsembed/docs/examples/netaccess/net.js24
-rwxr-xr-xkjsembed/docs/examples/opaquevalues/opaque.js26
-rwxr-xr-xkjsembed/docs/examples/qdocviewer/docviewer.ui523
-rw-r--r--kjsembed/docs/examples/qdocviewer/qdocviewer.js201
-rw-r--r--kjsembed/docs/examples/qobject-dom/qobject-dom.js24
-rw-r--r--kjsembed/docs/examples/readonlypart/README3
-rwxr-xr-xkjsembed/docs/examples/readonlypart/readonlypart.js24
-rw-r--r--kjsembed/docs/examples/readwritepart/README3
-rwxr-xr-xkjsembed/docs/examples/readwritepart/readwritepart.js25
-rw-r--r--kjsembed/docs/examples/sax/saxdefaults.js37
-rw-r--r--kjsembed/docs/examples/sax/saxdemo.js36
-rw-r--r--kjsembed/docs/examples/sax/saxerror.xml3
-rw-r--r--kjsembed/docs/examples/sax/saxnamespace.xml3
-rw-r--r--kjsembed/docs/examples/sax/saxtest.xml9
-rwxr-xr-xkjsembed/docs/examples/sql/sql.js57
-rwxr-xr-xkjsembed/docs/examples/stdicons/stdicons.js17
-rw-r--r--kjsembed/docs/examples/systemtray/kjstray.pngbin0 -> 259 bytes
-rwxr-xr-xkjsembed/docs/examples/systemtray/systemtray.js30
-rw-r--r--kjsembed/docs/examples/timer/timer.js10
-rw-r--r--kjsembed/docs/examples/treeview/showtree.js68
-rw-r--r--kjsembed/docs/examples/treeview/showtree.pngbin0 -> 9426 bytes
-rw-r--r--kjsembed/docs/examples/treeview/tree2.js56
-rw-r--r--kjsembed/docs/examples/treeview/treetest.ui111
-rwxr-xr-xkjsembed/docs/examples/xmlgui/xmlgui.js113
-rw-r--r--kjsembed/docs/features.html38
-rw-r--r--kjsembed/docs/images/embedjs.pngbin0 -> 19772 bytes
-rw-r--r--kjsembed/docs/images/jscalc.pngbin0 -> 12060 bytes
-rw-r--r--kjsembed/docs/index.html98
-rw-r--r--kjsembed/docs/jsref/dummy.txt0
-rw-r--r--kjsembed/docs/kjsembed-qsa.html43
-rw-r--r--kjsembed/docs/kjsembed.css47
-rw-r--r--kjsembed/docs/qtonly.html21
-rw-r--r--kjsembed/docs/tutorial/grepdlg.pngbin0 -> 3236 bytes
-rw-r--r--kjsembed/docs/tutorial/kjsembed.html213
-rw-r--r--kjsembed/docs/tutorial/passwordfileviewdlg.ui205
-rw-r--r--kjsembed/docs/types.html124
-rw-r--r--kjsembed/docs/write_classes.js36
-rw-r--r--kjsembed/docs/write_docs.js26
-rw-r--r--kjsembed/doxygen_fakes.h25
-rw-r--r--kjsembed/global.cpp178
-rw-r--r--kjsembed/global.h90
-rw-r--r--kjsembed/jsbinding.cpp789
-rw-r--r--kjsembed/jsbinding.h138
-rw-r--r--kjsembed/jsbindingbase.h59
-rw-r--r--kjsembed/jsbindingplugin.cpp39
-rw-r--r--kjsembed/jsbindingplugin.h66
-rw-r--r--kjsembed/jsbuiltin.cpp189
-rw-r--r--kjsembed/jsbuiltin.h99
-rw-r--r--kjsembed/jsbuiltin_imp.cpp281
-rw-r--r--kjsembed/jsbuiltin_imp.h83
-rw-r--r--kjsembed/jsbuiltinproxy.cpp48
-rw-r--r--kjsembed/jsbuiltinproxy.h57
-rw-r--r--kjsembed/jsconsolewidget.cpp242
-rw-r--r--kjsembed/jsconsolewidget.h153
-rw-r--r--kjsembed/jseventmapper.cpp99
-rw-r--r--kjsembed/jseventmapper.h71
-rw-r--r--kjsembed/jseventutils.cpp226
-rw-r--r--kjsembed/jseventutils.h101
-rw-r--r--kjsembed/jsfactory.cpp1132
-rw-r--r--kjsembed/jsfactory.h342
-rw-r--r--kjsembed/jsfactory_imp.cpp301
-rw-r--r--kjsembed/jsfactory_imp.h101
-rw-r--r--kjsembed/jsobjecteventproxy.cpp126
-rw-r--r--kjsembed/jsobjecteventproxy.h76
-rw-r--r--kjsembed/jsobjectproxy.cpp306
-rw-r--r--kjsembed/jsobjectproxy.h202
-rw-r--r--kjsembed/jsobjectproxy_imp.cpp638
-rw-r--r--kjsembed/jsobjectproxy_imp.h189
-rw-r--r--kjsembed/jsopaqueproxy.cpp137
-rw-r--r--kjsembed/jsopaqueproxy.h172
-rw-r--r--kjsembed/jsopaqueproxy_imp.cpp65
-rw-r--r--kjsembed/jsopaqueproxy_imp.h66
-rw-r--r--kjsembed/jsproxy.cpp122
-rw-r--r--kjsembed/jsproxy.h184
-rw-r--r--kjsembed/jsproxy_imp.cpp42
-rw-r--r--kjsembed/jsproxy_imp.h53
-rw-r--r--kjsembed/jssecuritypolicy.cpp103
-rw-r--r--kjsembed/jssecuritypolicy.h153
-rw-r--r--kjsembed/jsvalueproxy.cpp97
-rw-r--r--kjsembed/jsvalueproxy.h67
-rw-r--r--kjsembed/jsvalueproxy_imp.cpp66
-rw-r--r--kjsembed/jsvalueproxy_imp.h66
-rw-r--r--kjsembed/kjs.pro87
-rw-r--r--kjsembed/kjscmd.134
-rw-r--r--kjsembed/kjscmd.cpp194
-rw-r--r--kjsembed/kjscmd.desktop11
-rwxr-xr-xkjsembed/kjsembed/kjsembed.pro85
-rw-r--r--kjsembed/kjsembedpart.cpp449
-rw-r--r--kjsembed/kjsembedpart.h328
-rw-r--r--kjsembed/kjsembedpart_imp.cpp60
-rw-r--r--kjsembed/kjsembedpart_imp.h75
-rw-r--r--kjsembed/kscript/Makefile.am17
-rw-r--r--kjsembed/kscript/javascript.cpp111
-rw-r--r--kjsembed/kscript/javascript.desktop7
-rw-r--r--kjsembed/kscript/javascript.h60
-rw-r--r--kjsembed/kscript/swaptabs.desktop5
-rw-r--r--kjsembed/kscript/swaptabs.js75
-rw-r--r--kjsembed/kscript/swaptabs.ui172
-rw-r--r--kjsembed/ksimpleprocess.cpp93
-rw-r--r--kjsembed/ksimpleprocess.h70
-rw-r--r--kjsembed/lgpl.txt504
-rw-r--r--kjsembed/plugin/Makefile.am20
-rw-r--r--kjsembed/plugin/jsconsoleplugin.cpp99
-rw-r--r--kjsembed/plugin/jsconsoleplugin.h61
-rw-r--r--kjsembed/plugin/plugin_jsconsole.rc11
-rw-r--r--kjsembed/plugins/Makefile.am38
-rw-r--r--kjsembed/plugins/customobject_plugin.cpp183
-rw-r--r--kjsembed/plugins/customobject_plugin.desktop5
-rw-r--r--kjsembed/plugins/customobject_plugin.h68
-rw-r--r--kjsembed/plugins/customqobject_plugin.cpp96
-rw-r--r--kjsembed/plugins/customqobject_plugin.desktop5
-rw-r--r--kjsembed/plugins/customqobject_plugin.h68
-rw-r--r--kjsembed/plugins/imagefx_plugin.cpp858
-rw-r--r--kjsembed/plugins/imagefx_plugin.desktop5
-rw-r--r--kjsembed/plugins/imagefx_plugin.h130
-rw-r--r--kjsembed/plugins/kfileitem_plugin.desktop5
-rw-r--r--kjsembed/plugins/kfileitemloader.cpp223
-rw-r--r--kjsembed/plugins/kfileitemloader.h69
-rw-r--r--kjsembed/plugins/qprocess_plugin.cpp144
-rw-r--r--kjsembed/plugins/qprocess_plugin.desktop5
-rw-r--r--kjsembed/plugins/qprocess_plugin.h86
-rw-r--r--kjsembed/qjscmd.cpp83
-rwxr-xr-xkjsembed/qjscmd/qjscmd.pro14
-rwxr-xr-xkjsembed/qjscmdw/qjscmdw.pro15
-rwxr-xr-xkjsembed/qjsembed.nsi226
-rwxr-xr-xkjsembed/qjsembed.pri18
-rwxr-xr-xkjsembed/qjsembed.pro5
-rw-r--r--kjsembed/qtbindings/Makefile.am35
-rw-r--r--kjsembed/qtbindings/qcanvas_imp.cpp1117
-rw-r--r--kjsembed/qtbindings/qcanvas_imp.h198
-rw-r--r--kjsembed/qtbindings/qcanvasellipse_imp.cpp368
-rw-r--r--kjsembed/qtbindings/qcanvasellipse_imp.h120
-rw-r--r--kjsembed/qtbindings/qcanvasitem_imp.cpp790
-rw-r--r--kjsembed/qtbindings/qcanvasitem_imp.h174
-rw-r--r--kjsembed/qtbindings/qcanvasitemlist_imp.cpp172
-rw-r--r--kjsembed/qtbindings/qcanvasitemlist_imp.h100
-rw-r--r--kjsembed/qtbindings/qcanvasline_imp.cpp270
-rw-r--r--kjsembed/qtbindings/qcanvasline_imp.h110
-rw-r--r--kjsembed/qtbindings/qcanvaspixmap_imp.cpp252
-rw-r--r--kjsembed/qtbindings/qcanvaspixmap_imp.h108
-rw-r--r--kjsembed/qtbindings/qcanvaspixmaparray_imp.cpp340
-rw-r--r--kjsembed/qtbindings/qcanvaspixmaparray_imp.h116
-rw-r--r--kjsembed/qtbindings/qcanvaspolygon_imp.cpp243
-rw-r--r--kjsembed/qtbindings/qcanvaspolygon_imp.h108
-rw-r--r--kjsembed/qtbindings/qcanvaspolygonalitem_imp.cpp309
-rw-r--r--kjsembed/qtbindings/qcanvaspolygonalitem_imp.h116
-rw-r--r--kjsembed/qtbindings/qcanvasrectangle_imp.cpp346
-rw-r--r--kjsembed/qtbindings/qcanvasrectangle_imp.h118
-rw-r--r--kjsembed/qtbindings/qcanvasspline_imp.cpp228
-rw-r--r--kjsembed/qtbindings/qcanvasspline_imp.h106
-rw-r--r--kjsembed/qtbindings/qcanvassprite_imp.cpp593
-rw-r--r--kjsembed/qtbindings/qcanvassprite_imp.h148
-rw-r--r--kjsembed/qtbindings/qcanvastext_imp.cpp406
-rw-r--r--kjsembed/qtbindings/qcanvastext_imp.h126
-rw-r--r--kjsembed/qtbindings/qcanvasview_imp.cpp276
-rw-r--r--kjsembed/qtbindings/qcanvasview_imp.h110
-rw-r--r--kjsembed/qtbindings/qchecklistitem_imp.cpp587
-rw-r--r--kjsembed/qtbindings/qchecklistitem_imp.h139
-rw-r--r--kjsembed/qtbindings/qcombobox_imp.cpp964
-rw-r--r--kjsembed/qtbindings/qcombobox_imp.h190
-rw-r--r--kjsembed/qtbindings/qframe_imp.cpp64
-rw-r--r--kjsembed/qtbindings/qframe_imp.h35
-rw-r--r--kjsembed/qtbindings/qlistview_imp.cpp1329
-rw-r--r--kjsembed/qtbindings/qlistview_imp.h226
-rw-r--r--kjsembed/qtbindings/qlistviewitem_imp.cpp1429
-rw-r--r--kjsembed/qtbindings/qlistviewitem_imp.h229
-rw-r--r--kjsembed/qtbindings/qmenudata_imp.cpp1351
-rw-r--r--kjsembed/qtbindings/qmenudata_imp.h204
-rw-r--r--kjsembed/qtbindings/qmenuitem_imp.cpp430
-rw-r--r--kjsembed/qtbindings/qmenuitem_imp.h138
-rw-r--r--kjsembed/qtbindings/qpopupmenu_imp.cpp440
-rw-r--r--kjsembed/qtbindings/qpopupmenu_imp.h132
-rw-r--r--kjsembed/qtbindings/qt_imp.cpp780
-rw-r--r--kjsembed/qtbindings/qt_imp.h96
-rw-r--r--kjsembed/qtbindings/qtbindings.pro32
-rw-r--r--kjsembed/qtstubs.cpp51
-rw-r--r--kjsembed/qtstubs.h76
-rwxr-xr-xkjsembed/setup_qtonly54
-rw-r--r--kjsembed/slotproxy.cpp276
-rw-r--r--kjsembed/slotproxy.h110
-rw-r--r--kjsembed/slotutils.cpp879
-rw-r--r--kjsembed/slotutils.h175
-rw-r--r--kjsembed/stdlib/Makefile.am5
-rwxr-xr-xkjsembed/stdlib/cmdline.js78
-rw-r--r--kjsembed/testkjsembed.cpp61
-rw-r--r--kjsembed/tests/TestApplet.java17
-rw-r--r--kjsembed/tests/dcop.js40
-rw-r--r--kjsembed/tests/plugin.js40
-rw-r--r--kjsembed/tests/test.js11
-rw-r--r--kjsembed/tests/test.pngbin0 -> 798 bytes
-rw-r--r--kjsembed/tests/test.ui111
-rw-r--r--kjsembed/tests/test2.js4
-rwxr-xr-xkjsembed/tests/test_args.js9
-rw-r--r--kjsembed/tests/test_arrays.js49
-rw-r--r--kjsembed/tests/test_childevent.js45
-rw-r--r--kjsembed/tests/test_connect.js11
-rw-r--r--kjsembed/tests/test_connectsignal.js14
-rw-r--r--kjsembed/tests/test_customslots.js17
-rw-r--r--kjsembed/tests/test_datetime.js14
-rwxr-xr-xkjsembed/tests/test_dcop_interface.js45
-rw-r--r--kjsembed/tests/test_dcop_isregistered.js19
-rw-r--r--kjsembed/tests/test_dcopref.js27
-rw-r--r--kjsembed/tests/test_dcopref2.js23
-rw-r--r--kjsembed/tests/test_dcopstart.js27
-rw-r--r--kjsembed/tests/test_dom.js22
-rwxr-xr-xkjsembed/tests/test_gc.js21
-rw-r--r--kjsembed/tests/test_image.js18
-rwxr-xr-xkjsembed/tests/test_kconfig.js40
-rwxr-xr-xkjsembed/tests/test_kio.js26
-rw-r--r--kjsembed/tests/test_kparts_args.js16
-rw-r--r--kjsembed/tests/test_kropart.js5
-rwxr-xr-xkjsembed/tests/test_nogui.js3
-rw-r--r--kjsembed/tests/test_pixmap_slots.js11
-rw-r--r--kjsembed/tests/test_point.js22
-rw-r--r--kjsembed/tests/test_popupmenu.js15
-rw-r--r--kjsembed/tests/test_qcanvas.js29
-rw-r--r--kjsembed/tests/test_qcombobox.js8
-rw-r--r--kjsembed/tests/test_qdir.js9
-rw-r--r--kjsembed/tests/test_qframe.js33
-rw-r--r--kjsembed/tests/test_qlistview.js30
-rwxr-xr-xkjsembed/tests/test_qtabctl.js26
-rw-r--r--kjsembed/tests/test_qtimeedit.js8
-rw-r--r--kjsembed/tests/test_qtimeedit2.js13
-rwxr-xr-xkjsembed/tests/test_qtoolbox.js22
-rw-r--r--kjsembed/tests/test_rect.js38
-rw-r--r--kjsembed/tests/test_shellexec.js44
-rw-r--r--kjsembed/tests/test_size.js22
-rw-r--r--kjsembed/tests/test_splashscreen.js16
-rw-r--r--kjsembed/tests/test_stdio.js29
-rw-r--r--kjsembed/tests/testkjsembed.cpp64
-rw-r--r--kjsembed/tests/thisfail.js37
-rw-r--r--kjsembed/tools/Doxyfile824
-rw-r--r--kjsembed/tools/README3
-rw-r--r--kjsembed/tools/coverage/README2
-rw-r--r--kjsembed/tools/coverage/allqobjects.txt145
-rw-r--r--kjsembed/tools/coverage/classes.js5
-rw-r--r--kjsembed/tools/coverage/coverage.sh7
-rw-r--r--kjsembed/tools/coverage/supported.txt71
-rw-r--r--kjsembed/tools/coverage/unsupported.js11
-rw-r--r--kjsembed/tools/coverage/unsupported.txt95
-rwxr-xr-xkjsembed/tools/create_bindings.sh23
-rw-r--r--kjsembed/tools/doxygen2cons_cpp.xsl99
-rw-r--r--kjsembed/tools/doxygen2cons_h.xsl79
-rw-r--r--kjsembed/tools/doxygen2imp_cpp.xsl299
-rw-r--r--kjsembed/tools/doxygen2imp_h.xsl86
-rw-r--r--kjsembed/tools/headers/qbrush.h91
-rw-r--r--kjsembed/tools/headers/qcanvas.h806
-rw-r--r--kjsembed/tools/headers/qdir.h246
-rw-r--r--kjsembed/tools/headers/qpen.h99
-rw-r--r--kjsembed/tools/headers/qtimer.h88
-rw-r--r--kjsembed/tools/xml/DO_NOT_PRUNE0
-rw-r--r--kjsembed/xmlactionclient.cpp339
-rw-r--r--kjsembed/xmlactionclient.h232
454 files changed, 64847 insertions, 0 deletions
diff --git a/kjsembed/Doxyfile b/kjsembed/Doxyfile
new file mode 100644
index 00000000..2fc6e61d
--- /dev/null
+++ b/kjsembed/Doxyfile
@@ -0,0 +1,227 @@
+# Doxyfile 1.3.8-KDevelop
+
+#---------------------------------------------------------------------------
+# Project related configuration options
+#---------------------------------------------------------------------------
+PROJECT_NAME = KJSEmbed
+PROJECT_NUMBER = 0.3
+OUTPUT_DIRECTORY = ./docs/classdocs
+CREATE_SUBDIRS = NO
+OUTPUT_LANGUAGE = English
+USE_WINDOWS_ENCODING = NO
+BRIEF_MEMBER_DESC = NO
+REPEAT_BRIEF = YES
+ABBREVIATE_BRIEF =
+ALWAYS_DETAILED_SEC = YES
+INLINE_INHERITED_MEMB = YES
+FULL_PATH_NAMES = NO
+STRIP_FROM_PATH =
+STRIP_FROM_INC_PATH =
+SHORT_NAMES = NO
+JAVADOC_AUTOBRIEF = YES
+MULTILINE_CPP_IS_BRIEF = NO
+DETAILS_AT_TOP = YES
+INHERIT_DOCS = YES
+DISTRIBUTE_GROUP_DOC = YES
+TAB_SIZE = 8
+ALIASES =
+OPTIMIZE_OUTPUT_FOR_C = NO
+OPTIMIZE_OUTPUT_JAVA = NO
+SUBGROUPING = YES
+#---------------------------------------------------------------------------
+# Build related configuration options
+#---------------------------------------------------------------------------
+EXTRACT_ALL = YES
+EXTRACT_PRIVATE = NO
+EXTRACT_STATIC = YES
+EXTRACT_LOCAL_CLASSES = NO
+EXTRACT_LOCAL_METHODS = NO
+HIDE_UNDOC_MEMBERS = NO
+HIDE_UNDOC_CLASSES = NO
+HIDE_FRIEND_COMPOUNDS = NO
+HIDE_IN_BODY_DOCS = NO
+INTERNAL_DOCS = NO
+CASE_SENSE_NAMES = YES
+HIDE_SCOPE_NAMES = NO
+SHOW_INCLUDE_FILES = YES
+INLINE_INFO = YES
+SORT_MEMBER_DOCS = YES
+SORT_BRIEF_DOCS = YES
+SORT_BY_SCOPE_NAME = YES
+GENERATE_TODOLIST = YES
+GENERATE_TESTLIST = YES
+GENERATE_BUGLIST = YES
+GENERATE_DEPRECATEDLIST= YES
+ENABLED_SECTIONS =
+MAX_INITIALIZER_LINES = 30
+SHOW_USED_FILES = YES
+#---------------------------------------------------------------------------
+# configuration options related to warning and progress messages
+#---------------------------------------------------------------------------
+QUIET = NO
+WARNINGS = YES
+WARN_IF_UNDOCUMENTED = YES
+WARN_IF_DOC_ERROR = YES
+WARN_FORMAT =
+WARN_LOGFILE =
+#---------------------------------------------------------------------------
+# configuration options related to the input files
+#---------------------------------------------------------------------------
+INPUT = .
+FILE_PATTERNS = *.h
+RECURSIVE = NO
+EXCLUDE = doxygen_fakes.h \
+ slotutils.h \
+ slotproxy.h \
+ jseventmapper.h \
+ jseventutils.h \
+ jsobjecteventproxy.h \
+ xmlactionclient.h \
+ ksimpleprocess.h
+EXCLUDE_SYMLINKS = NO
+EXCLUDE_PATTERNS = *.moc.* \
+ *_imp.h
+EXAMPLE_PATH = docs/examples \
+ docs/embedding/simple-embed \
+ docs/tutorial \
+ cpptests/jsaccess
+EXAMPLE_PATTERNS = *.js \
+ *.cpp \
+ *.html
+EXAMPLE_RECURSIVE = YES
+IMAGE_PATH = docs/images
+INPUT_FILTER =
+FILTER_PATTERNS =
+FILTER_SOURCE_FILES = NO
+#---------------------------------------------------------------------------
+# configuration options related to source browsing
+#---------------------------------------------------------------------------
+SOURCE_BROWSER = NO
+INLINE_SOURCES = NO
+STRIP_CODE_COMMENTS = YES
+REFERENCED_BY_RELATION = YES
+REFERENCES_RELATION = YES
+VERBATIM_HEADERS = YES
+#---------------------------------------------------------------------------
+# configuration options related to the alphabetical class index
+#---------------------------------------------------------------------------
+ALPHABETICAL_INDEX = YES
+COLS_IN_ALPHA_INDEX = 5
+IGNORE_PREFIX = KJSEmbed \
+ JS
+#---------------------------------------------------------------------------
+# configuration options related to the HTML output
+#---------------------------------------------------------------------------
+GENERATE_HTML = YES
+HTML_OUTPUT = .
+HTML_FILE_EXTENSION = .html
+HTML_HEADER =
+HTML_FOOTER =
+HTML_STYLESHEET = docs/kjsembed.css
+HTML_ALIGN_MEMBERS = YES
+GENERATE_HTMLHELP = NO
+CHM_FILE =
+HHC_LOCATION =
+GENERATE_CHI = NO
+BINARY_TOC = NO
+TOC_EXPAND = NO
+DISABLE_INDEX = NO
+ENUM_VALUES_PER_LINE = 4
+GENERATE_TREEVIEW = NO
+TREEVIEW_WIDTH = 250
+#---------------------------------------------------------------------------
+# configuration options related to the LaTeX output
+#---------------------------------------------------------------------------
+GENERATE_LATEX = NO
+LATEX_OUTPUT =
+LATEX_CMD_NAME = latex
+MAKEINDEX_CMD_NAME = makeindex
+COMPACT_LATEX = NO
+PAPER_TYPE = a4wide
+EXTRA_PACKAGES =
+LATEX_HEADER =
+PDF_HYPERLINKS = NO
+USE_PDFLATEX = NO
+LATEX_BATCHMODE = NO
+LATEX_HIDE_INDICES = NO
+#---------------------------------------------------------------------------
+# configuration options related to the RTF output
+#---------------------------------------------------------------------------
+GENERATE_RTF = NO
+RTF_OUTPUT =
+COMPACT_RTF = NO
+RTF_HYPERLINKS = NO
+RTF_STYLESHEET_FILE =
+RTF_EXTENSIONS_FILE =
+#---------------------------------------------------------------------------
+# configuration options related to the man page output
+#---------------------------------------------------------------------------
+GENERATE_MAN = NO
+MAN_OUTPUT =
+MAN_EXTENSION =
+MAN_LINKS = NO
+#---------------------------------------------------------------------------
+# configuration options related to the XML output
+#---------------------------------------------------------------------------
+GENERATE_XML = NO
+XML_OUTPUT = xml
+XML_SCHEMA =
+XML_DTD =
+XML_PROGRAMLISTING = YES
+#---------------------------------------------------------------------------
+# configuration options for the AutoGen Definitions output
+#---------------------------------------------------------------------------
+GENERATE_AUTOGEN_DEF = NO
+#---------------------------------------------------------------------------
+# configuration options related to the Perl module output
+#---------------------------------------------------------------------------
+GENERATE_PERLMOD = NO
+PERLMOD_LATEX = NO
+PERLMOD_PRETTY = YES
+PERLMOD_MAKEVAR_PREFIX =
+#---------------------------------------------------------------------------
+# Configuration options related to the preprocessor
+#---------------------------------------------------------------------------
+ENABLE_PREPROCESSING = YES
+MACRO_EXPANSION = YES
+EXPAND_ONLY_PREDEF = YES
+SEARCH_INCLUDES = YES
+INCLUDE_PATH =
+INCLUDE_FILE_PATTERNS =
+PREDEFINED = Q_PROPERTY()=
+EXPAND_AS_DEFINED = KJSEMBED_EXPORT
+SKIP_FUNCTION_MACROS = NO
+#---------------------------------------------------------------------------
+# Configuration::additions related to external references
+#---------------------------------------------------------------------------
+TAGFILES =
+GENERATE_TAGFILE =
+ALLEXTERNALS = NO
+EXTERNAL_GROUPS = YES
+PERL_PATH =
+#---------------------------------------------------------------------------
+# Configuration options related to the dot tool
+#---------------------------------------------------------------------------
+CLASS_DIAGRAMS = YES
+HIDE_UNDOC_RELATIONS = YES
+HAVE_DOT = NO
+CLASS_GRAPH = YES
+COLLABORATION_GRAPH = YES
+UML_LOOK = YES
+TEMPLATE_RELATIONS = YES
+INCLUDE_GRAPH = YES
+INCLUDED_BY_GRAPH = YES
+CALL_GRAPH = YES
+GRAPHICAL_HIERARCHY = YES
+DOT_IMAGE_FORMAT = png
+DOT_PATH =
+DOTFILE_DIRS =
+MAX_DOT_GRAPH_WIDTH = 800
+MAX_DOT_GRAPH_HEIGHT = 600
+MAX_DOT_GRAPH_DEPTH = 0
+GENERATE_LEGEND = YES
+DOT_CLEANUP = YES
+#---------------------------------------------------------------------------
+# Configuration::additions related to the search engine
+#---------------------------------------------------------------------------
+SEARCHENGINE = NO
diff --git a/kjsembed/Doxyfile-Internal b/kjsembed/Doxyfile-Internal
new file mode 100644
index 00000000..1987988c
--- /dev/null
+++ b/kjsembed/Doxyfile-Internal
@@ -0,0 +1,824 @@
+# Doxyfile 1.2.9.1
+
+# This file describes the settings to be used by the documentation system
+# doxygen (www.doxygen.org) for a project
+#
+# All text after a hash (#) is considered a comment and will be ignored
+# The format is:
+# TAG = value [value, ...]
+# For lists items can also be appended using:
+# TAG += value [value, ...]
+# Values that contain spaces should be placed between quotes (" ")
+
+#---------------------------------------------------------------------------
+# General configuration options
+#---------------------------------------------------------------------------
+
+# The PROJECT_NAME tag is a single word (or a sequence of words surrounded
+# by quotes) that should identify the project.
+
+PROJECT_NAME = KJSEmbed
+
+# The PROJECT_NUMBER tag can be used to enter a project or revision number.
+# This could be handy for archiving the generated documentation or
+# if some version control system is used.
+
+PROJECT_NUMBER =
+
+# The OUTPUT_DIRECTORY tag is used to specify the (relative or absolute)
+# base path where the generated documentation will be put.
+# If a relative path is entered, it will be relative to the location
+# where doxygen was started. If left blank the current directory will be used.
+
+OUTPUT_DIRECTORY = ./docs/internal
+
+# The OUTPUT_LANGUAGE tag is used to specify the language in which all
+# documentation generated by doxygen is written. Doxygen will use this
+# information to generate all constant output in the proper language.
+# The default language is English, other supported languages are:
+# Brazilian, Chinese, Croatian, Czech, Danish, Dutch, Finnish, French,
+# German, Hungarian, Italian, Japanese, Korean, Norwegian, Polish,
+# Portuguese, Romanian, Russian, Slovak, Slovene, Spanish and Swedish.
+
+OUTPUT_LANGUAGE = English
+
+# If the EXTRACT_ALL tag is set to YES doxygen will assume all entities in
+# documentation are documented, even if no documentation was available.
+# Private class members and static file members will be hidden unless
+# the EXTRACT_PRIVATE and EXTRACT_STATIC tags are set to YES
+
+EXTRACT_ALL = YES
+
+# If the EXTRACT_PRIVATE tag is set to YES all private members of a class
+# will be included in the documentation.
+
+EXTRACT_PRIVATE = NO
+
+# If the EXTRACT_STATIC tag is set to YES all static members of a file
+# will be included in the documentation.
+
+EXTRACT_STATIC = NO
+
+# If the HIDE_UNDOC_MEMBERS tag is set to YES, Doxygen will hide all
+# undocumented members of documented classes, files or namespaces.
+# If set to NO (the default) these members will be included in the
+# various overviews, but no documentation section is generated.
+# This option has no effect if EXTRACT_ALL is enabled.
+
+HIDE_UNDOC_MEMBERS = NO
+
+# If the HIDE_UNDOC_CLASSES tag is set to YES, Doxygen will hide all
+# undocumented classes that are normally visible in the class hierarchy.
+# If set to NO (the default) these class will be included in the various
+# overviews. This option has no effect if EXTRACT_ALL is enabled.
+
+HIDE_UNDOC_CLASSES = YES
+
+# If the BRIEF_MEMBER_DESC tag is set to YES (the default) Doxygen will
+# include brief member descriptions after the members that are listed in
+# the file and class documentation (similar to JavaDoc).
+# Set to NO to disable this.
+
+BRIEF_MEMBER_DESC = NO
+
+# If the REPEAT_BRIEF tag is set to YES (the default) Doxygen will prepend
+# the brief description of a member or function before the detailed description.
+# Note: if both HIDE_UNDOC_MEMBERS and BRIEF_MEMBER_DESC are set to NO, the
+# brief descriptions will be completely suppressed.
+
+REPEAT_BRIEF = YES
+
+# If the ALWAYS_DETAILED_SEC and REPEAT_BRIEF tags are both set to YES then
+# Doxygen will generate a detailed section even if there is only a brief
+# description.
+
+ALWAYS_DETAILED_SEC = NO
+
+# If the FULL_PATH_NAMES tag is set to YES then Doxygen will prepend the full
+# path before files name in the file list and in the header files. If set
+# to NO the shortest path that makes the file name unique will be used.
+
+FULL_PATH_NAMES = NO
+
+# If the FULL_PATH_NAMES tag is set to YES then the STRIP_FROM_PATH tag
+# can be used to strip a user defined part of the path. Stripping is
+# only done if one of the specified strings matches the left-hand part of
+# the path. It is allowed to use relative paths in the argument list.
+
+STRIP_FROM_PATH =
+
+# The INTERNAL_DOCS tag determines if documentation
+# that is typed after a \internal command is included. If the tag is set
+# to NO (the default) then the documentation will be excluded.
+# Set it to YES to include the internal documentation.
+
+INTERNAL_DOCS = NO
+
+# If the CLASS_DIAGRAMS tag is set to YES (the default) Doxygen will
+# generate a class diagram (in Html and LaTeX) for classes with base or
+# super classes. Setting the tag to NO turns the diagrams off.
+
+CLASS_DIAGRAMS = YES
+
+# If the SOURCE_BROWSER tag is set to YES then a list of source files will
+# be generated. Documented entities will be cross-referenced with these sources.
+
+SOURCE_BROWSER = NO
+
+# Setting the INLINE_SOURCES tag to YES will include the body
+# of functions and classes directly in the documentation.
+
+INLINE_SOURCES = NO
+
+# Setting the STRIP_CODE_COMMENTS tag to YES (the default) will instruct
+# doxygen to hide any special comment blocks from generated source code
+# fragments. Normal C and C++ comments will always remain visible.
+
+STRIP_CODE_COMMENTS = YES
+
+# If the CASE_SENSE_NAMES tag is set to NO then Doxygen will only generate
+# file names in lower case letters. If set to YES upper case letters are also
+# allowed. This is useful if you have classes or files whose names only differ
+# in case and if your file system supports case sensitive file names. Windows
+# users are adviced to set this option to NO.
+
+CASE_SENSE_NAMES = YES
+
+# If the SHORT_NAMES tag is set to YES, doxygen will generate much shorter
+# (but less readable) file names. This can be useful is your file systems
+# doesn't support long names like on DOS, Mac, or CD-ROM.
+
+SHORT_NAMES = NO
+
+# If the HIDE_SCOPE_NAMES tag is set to NO (the default) then Doxygen
+# will show members with their full class and namespace scopes in the
+# documentation. If set to YES the scope will be hidden.
+
+HIDE_SCOPE_NAMES = YES
+
+# If the VERBATIM_HEADERS tag is set to YES (the default) then Doxygen
+# will generate a verbatim copy of the header file for each class for
+# which an include is specified. Set to NO to disable this.
+
+VERBATIM_HEADERS = YES
+
+# If the SHOW_INCLUDE_FILES tag is set to YES (the default) then Doxygen
+# will put list of the files that are included by a file in the documentation
+# of that file.
+
+SHOW_INCLUDE_FILES = YES
+
+# If the JAVADOC_AUTOBRIEF tag is set to YES then Doxygen
+# will interpret the first line (until the first dot) of a JavaDoc-style
+# comment as the brief description. If set to NO, the JavaDoc
+# comments will behave just like the Qt-style comments (thus requiring an
+# explict @brief command for a brief description.
+
+JAVADOC_AUTOBRIEF = YES
+
+# If the INHERIT_DOCS tag is set to YES (the default) then an undocumented
+# member inherits the documentation from any documented member that it
+# reimplements.
+
+INHERIT_DOCS = YES
+
+# If the INLINE_INFO tag is set to YES (the default) then a tag [inline]
+# is inserted in the documentation for inline members.
+
+INLINE_INFO = YES
+
+# If the SORT_MEMBER_DOCS tag is set to YES (the default) then doxygen
+# will sort the (detailed) documentation of file and class members
+# alphabetically by member name. If set to NO the members will appear in
+# declaration order.
+
+SORT_MEMBER_DOCS = NO
+
+# If member grouping is used in the documentation and the DISTRIBUTE_GROUP_DOC
+# tag is set to YES, then doxygen will reuse the documentation of the first
+# member in the group (if any) for the other members of the group. By default
+# all members of a group must be documented explicitly.
+
+DISTRIBUTE_GROUP_DOC = NO
+
+# The TAB_SIZE tag can be used to set the number of spaces in a tab.
+# Doxygen uses this value to replace tabs by spaces in code fragments.
+
+TAB_SIZE = 8
+
+# The ENABLED_SECTIONS tag can be used to enable conditional
+# documentation sections, marked by \if sectionname ... \endif.
+
+ENABLED_SECTIONS =
+
+# The GENERATE_TODOLIST tag can be used to enable (YES) or
+# disable (NO) the todo list. This list is created by putting \todo
+# commands in the documentation.
+
+GENERATE_TODOLIST = YES
+
+# The GENERATE_TESTLIST tag can be used to enable (YES) or
+# disable (NO) the test list. This list is created by putting \test
+# commands in the documentation.
+
+GENERATE_TESTLIST = YES
+
+# The GENERATE_BUGLIST tag can be used to enable (YES) or
+# disable (NO) the bug list. This list is created by putting \bug
+# commands in the documentation.
+
+GENERATE_BUGLIST = YES
+
+# This tag can be used to specify a number of aliases that acts
+# as commands in the documentation. An alias has the form "name=value".
+# For example adding "sideeffect=\par Side Effects:\n" will allow you to
+# put the command \sideeffect (or @sideeffect) in the documentation, which
+# will result in a user defined paragraph with heading "Side Effects:".
+# You can put \n's in the value part of an alias to insert newlines.
+
+ALIASES =
+
+# The MAX_INITIALIZER_LINES tag determines the maximum number of lines
+# the initial value of a variable or define consist of for it to appear in
+# the documentation. If the initializer consists of more lines than specified
+# here it will be hidden. Use a value of 0 to hide initializers completely.
+# The appearance of the initializer of individual variables and defines in the
+# documentation can be controlled using \showinitializer or \hideinitializer
+# command in the documentation regardless of this setting.
+
+MAX_INITIALIZER_LINES = 30
+
+# Set the OPTIMIZE_OUTPUT_FOR_C tag to YES if your project consists of C sources
+# only. Doxygen will then generate output that is more tailored for C.
+# For instance some of the names that are used will be different. The list
+# of all members will be omitted, etc.
+
+OPTIMIZE_OUTPUT_FOR_C = NO
+
+# Set the SHOW_USED_FILES tag to NO to disable the list of files generated
+# at the bottom of the documentation of classes and structs. If set to YES the
+# list will mention the files that were used to generate the documentation.
+
+SHOW_USED_FILES = YES
+
+#---------------------------------------------------------------------------
+# configuration options related to warning and progress messages
+#---------------------------------------------------------------------------
+
+# The QUIET tag can be used to turn on/off the messages that are generated
+# by doxygen. Possible values are YES and NO. If left blank NO is used.
+
+QUIET = NO
+
+# The WARNINGS tag can be used to turn on/off the warning messages that are
+# generated by doxygen. Possible values are YES and NO. If left blank
+# NO is used.
+
+WARNINGS = YES
+
+# If WARN_IF_UNDOCUMENTED is set to YES, then doxygen will generate warnings
+# for undocumented members. If EXTRACT_ALL is set to YES then this flag will
+# automatically be disabled.
+
+WARN_IF_UNDOCUMENTED = NO
+
+# The WARN_FORMAT tag determines the format of the warning messages that
+# doxygen can produce. The string should contain the $file, $line, and $text
+# tags, which will be replaced by the file and line number from which the
+# warning originated and the warning text.
+
+WARN_FORMAT =
+
+# The WARN_LOGFILE tag can be used to specify a file to which warning
+# and error messages should be written. If left blank the output is written
+# to stderr.
+
+WARN_LOGFILE =
+
+#---------------------------------------------------------------------------
+# configuration options related to the input files
+#---------------------------------------------------------------------------
+
+# The INPUT tag can be used to specify the files and/or directories that contain
+# documented source files. You may enter file names like "myfile.cpp" or
+# directories like "/usr/src/myproject". Separate the files or directories
+# with spaces.
+
+INPUT = . bindings builtins
+
+# If the value of the INPUT tag contains directories, you can use the
+# FILE_PATTERNS tag to specify one or more wildcard pattern (like *.cpp
+# and *.h) to filter out the source-files in the directories. If left
+# blank all files are included.
+
+FILE_PATTERNS = *.h
+
+# The RECURSIVE tag can be used to turn specify whether or not subdirectories
+# should be searched for input files as well. Possible values are YES and NO.
+# If left blank NO is used.
+
+RECURSIVE = NO
+
+# The EXCLUDE tag can be used to specify files and/or directories that should
+# excluded from the INPUT source files. This way you can easily exclude a
+# subdirectory from a directory tree whose root is specified with the INPUT tag.
+
+EXCLUDE = doxygen_fakes.h
+#EXCLUDE = customobject_imp.h jsfactory_imp.h jsproxy_imp.h \
+# kjsembedpart_imp.h jsbuiltin_imp.h \
+# jsobjectproxy_imp.h jsvalueproxy_imp.h \
+# doxygen_fakes.h
+
+# If the value of the INPUT tag contains directories, you can use the
+# EXCLUDE_PATTERNS tag to specify one or more wildcard patterns to exclude
+# certain files from those directories.
+
+EXCLUDE_PATTERNS = *.moc.*
+
+# The EXAMPLE_PATH tag can be used to specify one or more files or
+# directories that contain example code fragments that are included (see
+# the \include command).
+
+EXAMPLE_PATH =
+
+# If the value of the EXAMPLE_PATH tag contains directories, you can use the
+# EXAMPLE_PATTERNS tag to specify one or more wildcard pattern (like *.cpp
+# and *.h) to filter out the source-files in the directories. If left
+# blank all files are included.
+
+EXAMPLE_PATTERNS =
+
+# The IMAGE_PATH tag can be used to specify one or more files or
+# directories that contain image that are included in the documentation (see
+# the \image command).
+
+IMAGE_PATH =
+
+# The INPUT_FILTER tag can be used to specify a program that doxygen should
+# invoke to filter for each input file. Doxygen will invoke the filter program
+# by executing (via popen()) the command <filter> <input-file>, where <filter>
+# is the value of the INPUT_FILTER tag, and <input-file> is the name of an
+# input file. Doxygen will then use the output that the filter program writes
+# to standard output.
+
+INPUT_FILTER =
+
+# If the FILTER_SOURCE_FILES tag is set to YES, the input filter (if set using
+# INPUT_FILTER) will be used to filter the input files when producing source
+# files to browse.
+
+FILTER_SOURCE_FILES = NO
+
+#---------------------------------------------------------------------------
+# configuration options related to the alphabetical class index
+#---------------------------------------------------------------------------
+
+# If the ALPHABETICAL_INDEX tag is set to YES, an alphabetical index
+# of all compounds will be generated. Enable this if the project
+# contains a lot of classes, structs, unions or interfaces.
+
+ALPHABETICAL_INDEX = NO
+
+# If the alphabetical index is enabled (see ALPHABETICAL_INDEX) then
+# the COLS_IN_ALPHA_INDEX tag can be used to specify the number of columns
+# in which this list will be split (can be a number in the range [1..20])
+
+COLS_IN_ALPHA_INDEX = 5
+
+# In case all classes in a project start with a common prefix, all
+# classes will be put under the same header in the alphabetical index.
+# The IGNORE_PREFIX tag can be used to specify one or more prefixes that
+# should be ignored while generating the index headers.
+
+IGNORE_PREFIX = KJSEmbed
+
+#---------------------------------------------------------------------------
+# configuration options related to the HTML output
+#---------------------------------------------------------------------------
+
+# If the GENERATE_HTML tag is set to YES (the default) Doxygen will
+# generate HTML output.
+
+GENERATE_HTML = YES
+
+# The HTML_OUTPUT tag is used to specify where the HTML docs will be put.
+# If a relative path is entered the value of OUTPUT_DIRECTORY will be
+# put in front of it. If left blank `html' will be used as the default path.
+
+HTML_OUTPUT = .
+
+# The HTML_HEADER tag can be used to specify a personal HTML header for
+# each generated HTML page. If it is left blank doxygen will generate a
+# standard header.
+
+HTML_HEADER =
+
+# The HTML_FOOTER tag can be used to specify a personal HTML footer for
+# each generated HTML page. If it is left blank doxygen will generate a
+# standard footer.
+
+HTML_FOOTER =
+
+# The HTML_STYLESHEET tag can be used to specify a user defined cascading
+# style sheet that is used by each HTML page. It can be used to
+# fine-tune the look of the HTML output. If the tag is left blank doxygen
+# will generate a default style sheet
+
+HTML_STYLESHEET =
+
+# If the HTML_ALIGN_MEMBERS tag is set to YES, the members of classes,
+# files or namespaces will be aligned in HTML using tables. If set to
+# NO a bullet list will be used.
+
+HTML_ALIGN_MEMBERS = YES
+
+# If the GENERATE_HTMLHELP tag is set to YES, additional index files
+# will be generated that can be used as input for tools like the
+# Microsoft HTML help workshop to generate a compressed HTML help file (.chm)
+# of the generated HTML documentation.
+
+GENERATE_HTMLHELP = NO
+
+# If the GENERATE_HTMLHELP tag is set to YES, the GENERATE_CHI flag
+# controls if a separate .chi index file is generated (YES) or that
+# it should be included in the master .chm file (NO).
+
+GENERATE_CHI = NO
+
+# If the GENERATE_HTMLHELP tag is set to YES, the BINARY_TOC flag
+# controls whether a binary table of contents is generated (YES) or a
+# normal table of contents (NO) in the .chm file.
+
+BINARY_TOC = NO
+
+# The TOC_EXPAND flag can be set to YES to add extra items for group members
+# to the contents of the Html help documentation and to the tree view.
+
+TOC_EXPAND = NO
+
+# The DISABLE_INDEX tag can be used to turn on/off the condensed index at
+# top of each HTML page. The value NO (the default) enables the index and
+# the value YES disables it.
+
+DISABLE_INDEX = NO
+
+# This tag can be used to set the number of enum values (range [1..20])
+# that doxygen will group on one line in the generated HTML documentation.
+
+ENUM_VALUES_PER_LINE = 4
+
+# If the GENERATE_TREEVIEW tag is set to YES, a side panel will be
+# generated containing a tree-like index structure (just like the one that
+# is generated for HTML Help). For this to work a browser that supports
+# JavaScript and frames is required (for instance Netscape 4.0+
+# or Internet explorer 4.0+).
+
+GENERATE_TREEVIEW = NO
+
+# If the treeview is enabled (see GENERATE_TREEVIEW) then this tag can be
+# used to set the initial width (in pixels) of the frame in which the tree
+# is shown.
+
+TREEVIEW_WIDTH = 250
+
+#---------------------------------------------------------------------------
+# configuration options related to the LaTeX output
+#---------------------------------------------------------------------------
+
+# If the GENERATE_LATEX tag is set to YES (the default) Doxygen will
+# generate Latex output.
+
+GENERATE_LATEX = NO
+
+# The LATEX_OUTPUT tag is used to specify where the LaTeX docs will be put.
+# If a relative path is entered the value of OUTPUT_DIRECTORY will be
+# put in front of it. If left blank `latex' will be used as the default path.
+
+LATEX_OUTPUT =
+
+# If the COMPACT_LATEX tag is set to YES Doxygen generates more compact
+# LaTeX documents. This may be useful for small projects and may help to
+# save some trees in general.
+
+COMPACT_LATEX = NO
+
+# The PAPER_TYPE tag can be used to set the paper type that is used
+# by the printer. Possible values are: a4, a4wide, letter, legal and
+# executive. If left blank a4wide will be used.
+
+PAPER_TYPE = a4wide
+
+# The EXTRA_PACKAGES tag can be to specify one or more names of LaTeX
+# packages that should be included in the LaTeX output.
+
+EXTRA_PACKAGES =
+
+# The LATEX_HEADER tag can be used to specify a personal LaTeX header for
+# the generated latex document. The header should contain everything until
+# the first chapter. If it is left blank doxygen will generate a
+# standard header. Notice: only use this tag if you know what you are doing!
+
+LATEX_HEADER =
+
+# If the PDF_HYPERLINKS tag is set to YES, the LaTeX that is generated
+# is prepared for conversion to pdf (using ps2pdf). The pdf file will
+# contain links (just like the HTML output) instead of page references
+# This makes the output suitable for online browsing using a pdf viewer.
+
+PDF_HYPERLINKS = NO
+
+# If the USE_PDFLATEX tag is set to YES, pdflatex will be used instead of
+# plain latex in the generated Makefile. Set this option to YES to get a
+# higher quality PDF documentation.
+
+USE_PDFLATEX = NO
+
+# If the LATEX_BATCHMODE tag is set to YES, doxygen will add the \\batchmode.
+# command to the generated LaTeX files. This will instruct LaTeX to keep
+# running if errors occur, instead of asking the user for help.
+# This option is also used when generating formulas in HTML.
+
+LATEX_BATCHMODE = NO
+
+#---------------------------------------------------------------------------
+# configuration options related to the RTF output
+#---------------------------------------------------------------------------
+
+# If the GENERATE_RTF tag is set to YES Doxygen will generate RTF output
+# The RTF output is optimised for Word 97 and may not look very pretty with
+# other RTF readers or editors.
+
+GENERATE_RTF = NO
+
+# The RTF_OUTPUT tag is used to specify where the RTF docs will be put.
+# If a relative path is entered the value of OUTPUT_DIRECTORY will be
+# put in front of it. If left blank `rtf' will be used as the default path.
+
+RTF_OUTPUT =
+
+# If the COMPACT_RTF tag is set to YES Doxygen generates more compact
+# RTF documents. This may be useful for small projects and may help to
+# save some trees in general.
+
+COMPACT_RTF = NO
+
+# If the RTF_HYPERLINKS tag is set to YES, the RTF that is generated
+# will contain hyperlink fields. The RTF file will
+# contain links (just like the HTML output) instead of page references.
+# This makes the output suitable for online browsing using WORD or other
+# programs which support those fields.
+# Note: wordpad (write) and others do not support links.
+
+RTF_HYPERLINKS = NO
+
+# Load stylesheet definitions from file. Syntax is similar to doxygen's
+# config file, i.e. a series of assigments. You only have to provide
+# replacements, missing definitions are set to their default value.
+
+RTF_STYLESHEET_FILE =
+
+# Set optional variables used in the generation of an rtf document.
+# Syntax is similar to doxygen's config file.
+
+RTF_EXTENSIONS_FILE =
+
+#---------------------------------------------------------------------------
+# configuration options related to the man page output
+#---------------------------------------------------------------------------
+
+# If the GENERATE_MAN tag is set to YES (the default) Doxygen will
+# generate man pages
+
+GENERATE_MAN = NO
+
+# The MAN_OUTPUT tag is used to specify where the man pages will be put.
+# If a relative path is entered the value of OUTPUT_DIRECTORY will be
+# put in front of it. If left blank `man' will be used as the default path.
+
+MAN_OUTPUT =
+
+# The MAN_EXTENSION tag determines the extension that is added to
+# the generated man pages (default is the subroutine's section .3)
+
+MAN_EXTENSION =
+
+# If the MAN_LINKS tag is set to YES and Doxygen generates man output,
+# then it will generate one additional man file for each entity
+# documented in the real man page(s). These additional files
+# only source the real man page, but without them the man command
+# would be unable to find the correct page. The default is NO.
+
+MAN_LINKS = NO
+
+#---------------------------------------------------------------------------
+# configuration options related to the XML output
+#---------------------------------------------------------------------------
+
+# If the GENERATE_XML tag is set to YES Doxygen will
+# generate an XML file that captures the structure of
+# the code including all documentation. Note that this
+# feature is still experimental and incomplete at the
+# moment.
+
+GENERATE_XML = NO
+
+#---------------------------------------------------------------------------
+# Configuration options related to the preprocessor
+#---------------------------------------------------------------------------
+
+# If the ENABLE_PREPROCESSING tag is set to YES (the default) Doxygen will
+# evaluate all C-preprocessor directives found in the sources and include
+# files.
+
+ENABLE_PREPROCESSING = YES
+
+# If the MACRO_EXPANSION tag is set to YES Doxygen will expand all macro
+# names in the source code. If set to NO (the default) only conditional
+# compilation will be performed. Macro expansion can be done in a controlled
+# way by setting EXPAND_ONLY_PREDEF to YES.
+
+MACRO_EXPANSION = YES
+
+# If the EXPAND_ONLY_PREDEF and MACRO_EXPANSION tags are both set to YES
+# then the macro expansion is limited to the macros specified with the
+# PREDEFINED and EXPAND_AS_PREDEFINED tags.
+
+EXPAND_ONLY_PREDEF = YES
+
+# If the SEARCH_INCLUDES tag is set to YES (the default) the includes files
+# in the INCLUDE_PATH (see below) will be search if a #include is found.
+
+SEARCH_INCLUDES = YES
+
+# The INCLUDE_PATH tag can be used to specify one or more directories that
+# contain include files that are not input files but should be processed by
+# the preprocessor.
+
+INCLUDE_PATH =
+
+# You can use the INCLUDE_FILE_PATTERNS tag to specify one or more wildcard
+# patterns (like *.h and *.hpp) to filter out the header-files in the
+# directories. If left blank, the patterns specified with FILE_PATTERNS will
+# be used.
+
+INCLUDE_FILE_PATTERNS =
+
+# The PREDEFINED tag can be used to specify one or more macro names that
+# are defined before the preprocessor is started (similar to the -D option of
+# gcc). The argument of the tag is a list of macros of the form: name
+# or name=definition (no spaces). If the definition and the = are
+# omitted =1 is assumed.
+
+PREDEFINED = Q_PROPERTY()=
+
+# If the MACRO_EXPANSION and EXPAND_PREDEF_ONLY tags are set to YES then
+# this tag can be used to specify a list of macro names that should be expanded.
+# The macro definition that is found in the sources will be used.
+# Use the PREDEFINED tag if you want to use a different macro definition.
+
+EXPAND_AS_DEFINED =
+
+#---------------------------------------------------------------------------
+# Configuration::addtions related to external references
+#---------------------------------------------------------------------------
+
+# The TAGFILES tag can be used to specify one or more tagfiles.
+
+TAGFILES =
+
+# When a file name is specified after GENERATE_TAGFILE, doxygen will create
+# a tag file that is based on the input files it reads.
+
+GENERATE_TAGFILE =
+
+# If the ALLEXTERNALS tag is set to YES all external classes will be listed
+# in the class index. If set to NO only the inherited external classes
+# will be listed.
+
+ALLEXTERNALS = NO
+
+# The PERL_PATH should be the absolute path and name of the perl script
+# interpreter (i.e. the result of `which perl').
+
+PERL_PATH =
+
+#---------------------------------------------------------------------------
+# Configuration options related to the dot tool
+#---------------------------------------------------------------------------
+
+# If you set the HAVE_DOT tag to YES then doxygen will assume the dot tool is
+# available from the path. This tool is part of Graphviz, a graph visualization
+# toolkit from AT&T and Lucent Bell Labs. The other options in this section
+# have no effect if this option is set to NO (the default)
+
+HAVE_DOT = NO
+
+# If the CLASS_GRAPH and HAVE_DOT tags are set to YES then doxygen
+# will generate a graph for each documented class showing the direct and
+# indirect inheritance relations. Setting this tag to YES will force the
+# the CLASS_DIAGRAMS tag to NO.
+
+CLASS_GRAPH = YES
+
+# If the COLLABORATION_GRAPH and HAVE_DOT tags are set to YES then doxygen
+# will generate a graph for each documented class showing the direct and
+# indirect implementation dependencies (inheritance, containment, and
+# class references variables) of the class with other documented classes.
+
+COLLABORATION_GRAPH = YES
+
+# If the ENABLE_PREPROCESSING, SEARCH_INCLUDES, INCLUDE_GRAPH, and HAVE_DOT
+# tags are set to YES then doxygen will generate a graph for each documented
+# file showing the direct and indirect include dependencies of the file with
+# other documented files.
+
+INCLUDE_GRAPH = YES
+
+# If the ENABLE_PREPROCESSING, SEARCH_INCLUDES, INCLUDED_BY_GRAPH, and
+# HAVE_DOT tags are set to YES then doxygen will generate a graph for each
+# documented header file showing the documented files that directly or
+# indirectly include this file.
+
+INCLUDED_BY_GRAPH = YES
+
+# If the GRAPHICAL_HIERARCHY and HAVE_DOT tags are set to YES then doxygen
+# will graphical hierarchy of all classes instead of a textual one.
+
+GRAPHICAL_HIERARCHY = YES
+
+# The tag DOT_PATH can be used to specify the path where the dot tool can be
+# found. If left blank, it is assumed the dot tool can be found on the path.
+
+DOT_PATH =
+
+# The MAX_DOT_GRAPH_WIDTH tag can be used to set the maximum allowed width
+# (in pixels) of the graphs generated by dot. If a graph becomes larger than
+# this value, doxygen will try to truncate the graph, so that it fits within
+# the specified constraint. Beware that most browsers cannot cope with very
+# large images.
+
+MAX_DOT_GRAPH_WIDTH = 1024
+
+# The MAX_DOT_GRAPH_HEIGHT tag can be used to set the maximum allows height
+# (in pixels) of the graphs generated by dot. If a graph becomes larger than
+# this value, doxygen will try to truncate the graph, so that it fits within
+# the specified constraint. Beware that most browsers cannot cope with very
+# large images.
+
+MAX_DOT_GRAPH_HEIGHT = 1024
+
+# If the GENERATE_LEGEND tag is set to YES (the default) Doxygen will
+# generate a legend page explaining the meaning of the various boxes and
+# arrows in the dot generated graphs.
+
+GENERATE_LEGEND = YES
+
+# If the DOT_CLEANUP tag is set to YES (the default) Doxygen will
+# remove the intermedate dot files that are used to generate
+# the various graphs.
+
+DOT_CLEANUP = YES
+
+#---------------------------------------------------------------------------
+# Configuration::addtions related to the search engine
+#---------------------------------------------------------------------------
+
+# The SEARCHENGINE tag specifies whether or not a search engine should be
+# used. If set to NO the values of all tags below this one will be ignored.
+
+SEARCHENGINE = NO
+
+# The CGI_NAME tag should be the name of the CGI script that
+# starts the search engine (doxysearch) with the correct parameters.
+# A script with this name will be generated by doxygen.
+
+CGI_NAME =
+
+# The CGI_URL tag should be the absolute URL to the directory where the
+# cgi binaries are located. See the documentation of your http daemon for
+# details.
+
+CGI_URL =
+
+# The DOC_URL tag should be the absolute URL to the directory where the
+# documentation is located. If left blank the absolute path to the
+# documentation, with file:// prepended to it, will be used.
+
+DOC_URL =
+
+# The DOC_ABSPATH tag should be the absolute path to the directory where the
+# documentation is located. If left blank the directory on the local machine
+# will be used.
+
+DOC_ABSPATH =
+
+# The BIN_ABSPATH tag must point to the directory where the doxysearch binary
+# is installed.
+
+BIN_ABSPATH =
+
+# The EXT_DOC_PATHS tag can be used to specify one or more paths to
+# documentation generated for other projects. This allows doxysearch to search
+# the documentation for these projects as well.
+
+EXT_DOC_PATHS =
diff --git a/kjsembed/Makefile.am b/kjsembed/Makefile.am
new file mode 100644
index 00000000..d64849c6
--- /dev/null
+++ b/kjsembed/Makefile.am
@@ -0,0 +1,88 @@
+# -*- makefile -*-
+AM_CXXFLAGS = -frtti
+
+# Make sure the include path includes Qt's uilib
+INCLUDES = -I$(QTDIR)/tools/designer/uilib -I$(srcdir)/.. $(all_includes)
+
+INCLUDES += -DQT_CLEAN_NAMESPACE -DQT_NO_ASCII_CAST
+
+SUBDIRS = bindings builtins qtbindings . plugin plugins kscript stdlib cpptests docs
+
+lib_LTLIBRARIES = libkjsembed.la
+bin_PROGRAMS = kjscmd
+
+libkjsembed_la_METASOURCES = AUTO
+libkjsembed_la_SOURCES = jsconsolewidget.cpp kjsembedpart.cpp jsobjectproxy.cpp \
+ slotutils.cpp jsproxy.cpp slotproxy.cpp jsbinding.cpp jssecuritypolicy.cpp \
+ xmlactionclient.cpp jsfactory.cpp kjsembedpart_imp.cpp jsobjectproxy_imp.cpp \
+ customobject_imp.cpp jsvalueproxy_imp.cpp jsvalueproxy.cpp jsobjecteventproxy.cpp \
+ jseventmapper.cpp jsbuiltin.cpp jsproxy_imp.cpp jsfactory_imp.cpp jsbuiltin_imp.cpp \
+ jsopaqueproxy.cpp jsopaqueproxy_imp.cpp jseventutils.cpp jsbindingplugin.cpp \
+ ksimpleprocess.cpp global.cpp jsbuiltinproxy.cpp
+
+kjsembedincludedir = $(includedir)/kjsembed
+kjsembedinclude_HEADERS = jsconsolewidget.h \
+ kjsembedpart.h \
+ jsobjectproxy.h \
+ slotutils.h \
+ jsproxy.h \
+ slotproxy.h \
+ jsbinding.h \
+ jssecuritypolicy.h \
+ xmlactionclient.h \
+ jsfactory.h \
+ kjsembedpart_imp.h \
+ jsobjectproxy_imp.h \
+ customobject_imp.h \
+ jsvalueproxy_imp.h \
+ jsvalueproxy.h \
+ jsobjecteventproxy.h \
+ jseventmapper.h \
+ jsbuiltin.h \
+ jsproxy_imp.h \
+ jsfactory_imp.h \
+ jsbuiltin_imp.h \
+ jsopaqueproxy.h \
+ jsopaqueproxy_imp.h \
+ jseventutils.h \
+ jsbindingplugin.h \
+ global.h
+
+libkjsembed_la_LDFLAGS = -no-undefined -version-info 1:0 $(all_libraries) $(KDE_RPATH)
+
+libkjsembed_la_LIBADD = bindings/libkjsembedbindings.la \
+ builtins/libkjsembedbuiltins.la \
+ qtbindings/libkjsembedqtbindings.la \
+ -lqui \
+ $(LIB_QT) $(LIB_KDECORE) $(LIB_KDEUI) $(LIB_KPARTS) \
+ $(LIB_KFILE) $(LIB_KHTML) -lkjs $(LIBSOCKET)
+
+kjscmd_SOURCES = kjscmd.cpp
+kjscmd_LDFLAGS = $(all_libraries) $(KDE_RPATH)
+kjscmd_LDADD = libkjsembed.la
+
+man_MANS = kjscmd.1
+
+xdg_apps_DATA = kjscmd.desktop
+
+plugintypedir = $(kde_servicetypesdir)
+plugintype_DATA = binding_type.desktop
+
+changes:
+ cvs2cl --ignore 'ChangeLog' \
+ --prune --day-of-week \
+ --hide-filenames --no-wrap \
+ --stdout | grep -v 'CCMAIL' > docs/ChangeLog
+
+srcdoc:
+ $(kde_bindir)/kdoc -a -p -d classdocs -n 'KJSEmbed' *.h -lqt -lkdecore -lkdeui
+
+srcdox:
+ doxygen -u Doxyfile
+
+tidytildes:
+ rm -f *~
+
+
+
+noinst_HEADERS = jsbindingbase.h
diff --git a/kjsembed/README b/kjsembed/README
new file mode 100644
index 00000000..aa0ca684
--- /dev/null
+++ b/kjsembed/README
@@ -0,0 +1,48 @@
+WARNING:
+-------
+This library does not keep source or binary compatibility. Unless every one
+of your users compiles from source and recompiles after upgrading kjsembed,
+you should be making a complete copy of this code in your app and using that
+instead of the installed version.
+-----------------------------------------------------------------------------
+
+
+A library for embedding the KJS Javascript interpreter in application.
+
+- A tutorial is under development, see http://xmelegance.org/kjsembed/
+ or take a look in the docs directory.
+
+- For information on using the library run kdoc over the header files.
+
+
+Here is an example interactive session with the test application, all
+lines beginning with 'kjs>' show the commands typed.
+
+-- 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.child(1)
+CmdEdit (QComboBox)
+kjs> console.child(2)
+RunButton (QPushButton)
+kjs> console.child("RunButton")
+RunButton (QPushButton)
+kjs> console.child("RunButton").text = "Go!"
+Go!
+kjs> console.caption = "Different Title"
+Different Title
+
+
+Copyright (C) 2001-2003, Richard J. Moore <rich@kde.org>
+
diff --git a/kjsembed/TODO b/kjsembed/TODO
new file mode 100644
index 00000000..54fb9edf
--- /dev/null
+++ b/kjsembed/TODO
@@ -0,0 +1 @@
+This file has moved into the docs directory.
diff --git a/kjsembed/binding_type.desktop b/kjsembed/binding_type.desktop
new file mode 100644
index 00000000..0b8d0ca3
--- /dev/null
+++ b/kjsembed/binding_type.desktop
@@ -0,0 +1,3 @@
+[Desktop Entry]
+Type=ServiceType
+X-KDE-ServiceType=JSBindingPlugin/Binding
diff --git a/kjsembed/bindings/Makefile.am b/kjsembed/bindings/Makefile.am
new file mode 100644
index 00000000..95b634bd
--- /dev/null
+++ b/kjsembed/bindings/Makefile.am
@@ -0,0 +1,29 @@
+
+INCLUDES= -I$(srcdir)/.. -I$(srcdir)/../.. $(all_includes)
+KDE_CXXFLAGS = -DQT_NO_ASCII_CAST -DQT_CLEAN_NAMESPACE -Wno-unused
+
+noinst_LTLIBRARIES = libkjsembedbindings.la
+
+libkjsembedbindings_la_SOURCES = image_imp.cpp \
+ dcop_imp.cpp \
+ painter_imp.cpp \
+ pixmap_imp.cpp \
+ netaccess_imp.cpp \
+ kconfig_imp.cpp \
+ bindingobject.cpp \
+ movie_imp.cpp \
+ sql_imp.cpp \
+ pen_imp.cpp \
+ brush_imp.cpp \
+ iconset_imp.cpp \
+ point_imp.cpp \
+ rect_imp.cpp \
+ size_imp.cpp
+
+libkjsembedbindings_la_LDFLAGS = $(all_libraries) $(KDE_RPATH)
+libkjsembedbindings_la_LIBADD = $(LIB_QT) $(LIB_KDECORE) $(LIB_KDEUI) $(LIB_KPARTS) \
+ $(LIB_KFILE) $(LIBSOCKET)
+
+libkjsembedbindings_la_METASOURCES = AUTO
+
+
diff --git a/kjsembed/bindings/bindingobject.cpp b/kjsembed/bindings/bindingobject.cpp
new file mode 100644
index 00000000..4477c336
--- /dev/null
+++ b/kjsembed/bindings/bindingobject.cpp
@@ -0,0 +1,18 @@
+#include "bindingobject.h"
+#ifndef QT_ONLY
+#include "bindingobject.moc"
+#endif
+namespace KJSEmbed {
+namespace Bindings {
+
+BindingObject::BindingObject( QObject *parent, const char *name )
+ : QObject( parent, name )
+{
+}
+
+BindingObject::~BindingObject()
+{
+}
+
+}
+}
diff --git a/kjsembed/bindings/bindingobject.h b/kjsembed/bindings/bindingobject.h
new file mode 100644
index 00000000..1516ade2
--- /dev/null
+++ b/kjsembed/bindings/bindingobject.h
@@ -0,0 +1,61 @@
+// -*- c++ -*-
+
+/*
+ * Copyright (C) 2003, Richard J. Moore <rich@kde.org>
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Library General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Library General Public License for more details.
+ *
+ * You should have received a copy of the GNU Library General Public License
+ * along with this library; see the file COPYING.LIB. If not, write to
+ * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
+ * Boston, MA 02110-1301, USA.
+ */
+
+#ifndef KJSEMBED_BINDING_OBJECT_H
+#define KJSEMBED_BINDING_OBJECT_H
+
+#include <qobject.h>
+
+namespace KJSEmbed {
+namespace Bindings {
+
+/**
+ * A baseclass for QObject bindings. This class is currently just a
+ * stub, but I hope it will contain utilities for QObject wrapper
+ * classes.
+ *
+ * @author Richard Moore, rich@kde.org
+ * @version $Id$
+ */
+class BindingObject : public QObject
+{
+ Q_OBJECT
+
+public:
+ BindingObject( QObject *parent, const char *name=0 );
+ virtual ~BindingObject();
+
+ const char *jsClassName() const { return jsClazz; }
+
+protected:
+ void setJSClassName( const char *clazz ) { jsClazz = clazz; }
+
+private:
+ QCString jsClazz;
+ class BindingObjectPrivate *d;
+};
+
+}
+}
+
+#endif // KJSEMBED_BINDING_OBJECT_H
+
+
diff --git a/kjsembed/bindings/bindings.pro b/kjsembed/bindings/bindings.pro
new file mode 100644
index 00000000..d83d3ba5
--- /dev/null
+++ b/kjsembed/bindings/bindings.pro
@@ -0,0 +1,35 @@
+include(../qjsembed.pri)
+
+INCLUDEPATH += .. . ../..
+CONFIG += staticlib
+TEMPLATE = lib
+
+
+# Input
+HEADERS += bindingobject.h \
+ brush_imp.h \
+ iconset_imp.h \
+ image_imp.h \
+ movie_imp.h \
+ painter_imp.h \
+ pen_imp.h \
+ pixmap_imp.h \
+ sql_imp.h \
+ kconfig_imp.h \
+ point_imp.h \
+ rect_imp.h \
+ size_imp.h
+
+SOURCES += bindingobject.cpp \
+ brush_imp.cpp \
+ iconset_imp.cpp \
+ image_imp.cpp \
+ movie_imp.cpp \
+ painter_imp.cpp \
+ pen_imp.cpp \
+ pixmap_imp.cpp \
+ sql_imp.cpp \
+ kconfig_imp.cpp \
+ point_imp.cpp \
+ rect_imp.cpp \
+ size_imp.cpp
diff --git a/kjsembed/bindings/brush_imp.cpp b/kjsembed/bindings/brush_imp.cpp
new file mode 100644
index 00000000..061dc1f4
--- /dev/null
+++ b/kjsembed/bindings/brush_imp.cpp
@@ -0,0 +1,121 @@
+// -*- c++ -*-
+
+/*
+ * Copyright (C) 2003, Ian Reinhart Geiser <geiseri@kde.org>
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Library General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Library General Public License for more details.
+ *
+ * You should have received a copy of the GNU Library General Public License
+ * along with this library; see the file COPYING.LIB. If not, write to
+ * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
+ * Boston, MA 02110-1301, USA.
+ */
+
+#include <kjsembed/global.h>
+#include <kjsembed/jsvalueproxy.h>
+#include <kjsembed/jsbinding.h>
+#include <qvariant.h>
+#include <qbrush.h>
+
+#include "brush_imp.h"
+
+namespace KJSEmbed {
+namespace Bindings {
+
+BrushImp::BrushImp( KJS::ExecState *exec, int id )
+ : JSProxyImp(exec), mid(id)
+{
+}
+
+BrushImp::~BrushImp()
+{
+}
+
+void BrushImp::addBindings( KJS::ExecState *exec, KJS::Object &object ) {
+
+ if( !JSProxy::checkType(object, JSProxy::ValueProxy, "QBrush") ) return;
+
+ JSProxy::MethodTable methods[] = {
+ { Methodstyle, "style"},
+ { MethodsetStyle, "setStyle"},
+ { MethodColor, "color"},
+ { MethodsetColor, "setColor"},
+ { 0, 0 }
+ };
+
+ JSProxy::addMethods<BrushImp>(exec, methods, object );
+
+ JSProxy::EnumTable enums[] = {
+ // BrushType
+ { "NoBrush", 0 },
+ { "SolidBrush", 1 },
+ { "Dense1Pattern", 2 },
+ { "Dense2Pattern", 3 },
+ { "Dense3Pattern", 4 },
+ { "Dense4Pattern", 5 },
+ { "Dense5Pattern", 6 },
+ { "Dense6Pattern", 7 },
+ { "Dense7Pattern", 8 },
+ { "HorPattern", 9 },
+ { "VerPattern", 10 },
+ { "CrossPattern", 11},
+ { "BDiagPattern", 12 },
+ { "FDiagPattern", 13 },
+ { "DiagCrossPattern", 14},
+
+ { 0, 0 }
+ };
+
+ JSProxy::addEnums(exec, enums, object);
+
+}
+
+KJS::Value BrushImp::call( KJS::ExecState *exec, KJS::Object &self, const KJS::List &args ) {
+
+ if( !JSProxy::checkType(self, JSProxy::ValueProxy, "QBrush") ) return KJS::Value();
+ JSValueProxy *op = JSProxy::toValueProxy( self.imp() );
+ QBrush brush = op->toVariant().toBrush();
+
+ KJS::Value retValue = KJS::Value();
+ switch ( mid ) {
+ case Methodstyle:
+ {
+ return KJS::Number((int) brush.style() );
+ break;
+ }
+ case MethodsetStyle:
+ {
+ int style = extractInt(exec, args, 0);
+ brush.setStyle((Qt::BrushStyle)style);
+ break;
+ }
+ case MethodColor:
+ {
+ return convertToValue(exec, brush.color());
+ break;
+ }
+ case MethodsetColor:
+ {
+ QColor color = extractQColor(exec, args, 0);
+ brush.setColor(color);
+ break;
+ }
+ default:
+ kdWarning() << "Brush has no method " << mid << endl;
+ break;
+ }
+
+ op->setValue(brush);
+ return retValue;
+}
+
+} // namespace KJSEmbed::Bindings
+} // namespace KJSEmbed
diff --git a/kjsembed/bindings/brush_imp.h b/kjsembed/bindings/brush_imp.h
new file mode 100644
index 00000000..040c73b6
--- /dev/null
+++ b/kjsembed/bindings/brush_imp.h
@@ -0,0 +1,57 @@
+// -*- c++ -*-
+
+/*
+ * Copyright (C) 2003, Richard J. Moore <rich@kde.org>
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Library General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Library General Public License for more details.
+ *
+ * You should have received a copy of the GNU Library General Public License
+ * along with this library; see the file COPYING.LIB. If not, write to
+ * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
+ * Boston, MA 02110-1301, USA.
+ */
+
+#ifndef KJSEMBED_BRUSH_PLUGIN_H
+#define KJSEMBED_BRUSH_PLUGIN_H
+
+#include <kjsembed/jsproxy_imp.h>
+
+namespace KJSEmbed {
+namespace Bindings {
+
+class BrushImp : public JSProxyImp {
+
+ /** Identifiers for the methods provided by this class. */
+ enum MethodId { Methodstyle, MethodsetStyle, MethodColor, MethodsetColor };
+
+public:
+ BrushImp( KJS::ExecState *exec, int id );
+ virtual ~BrushImp();
+
+ static void addBindings( KJS::ExecState *exec, KJS::Object &object );
+
+ /** Returns true iff this object implements the call function. */
+ virtual bool implementsCall() const {
+ return true;
+ }
+
+ /** Invokes the call function. */
+ virtual KJS::Value call( KJS::ExecState *exec, KJS::Object &self, const KJS::List &args );
+
+
+private:
+ int mid;
+};
+
+} // namespace
+} // namespace
+
+#endif // KJSEMBED_IMAGE_IMP_H
diff --git a/kjsembed/bindings/dcop_imp.cpp b/kjsembed/bindings/dcop_imp.cpp
new file mode 100644
index 00000000..caa47313
--- /dev/null
+++ b/kjsembed/bindings/dcop_imp.cpp
@@ -0,0 +1,1020 @@
+// $Id$
+// -*- c++ -*-
+
+/*
+ * Copyright (C) 2003, Ian Reinhart Geiser <geiseri@kde.org>
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Library General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Library General Public License for more details.
+ *
+ * You should have received a copy of the GNU Library General Public License
+ * along with this library; see the file COPYING.LIB. If not, write to
+ * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
+ * Boston, MA 02110-1301, USA.
+ */
+#include <kapplication.h>
+#include <dcopref.h>
+#include <dcopclient.h>
+#include <kdebug.h>
+#include <qregexp.h>
+
+#include "dcop_imp.h"
+#include "dcop_imp.moc"
+
+#include <kdatastream.h>
+#include <kurl.h>
+#include <qvariant.h>
+#include <qstring.h>
+#include <qmap.h>
+#include <qfont.h>
+#include <qpixmap.h>
+#include <qbrush.h>
+#include <qrect.h>
+#include <qsize.h>
+#include <qcolor.h>
+#include <qimage.h>
+#include <qpoint.h>
+#include <qvaluelist.h>
+#include <qiconset.h>
+#include <qpointarray.h>
+#include <qbitmap.h>
+#include <qcursor.h>
+#include <qdatetime.h>
+#include <qmemarray.h>
+#include <qkeysequence.h>
+#include <qbitarray.h>
+
+#include <kjs/interpreter.h>
+#include <kjs/identifier.h>
+#include <kjs/types.h>
+#include <kjs/ustring.h>
+#include <kjs/value.h>
+
+#include "../jsbinding.h"
+#include <kjsembed/jsopaqueproxy.h>
+#include <kjsembed/jsobjectproxy.h>
+#include <kjsembed/kjsembedpart.h>
+namespace KJSEmbed {
+namespace Bindings {
+KJS::Object JSDCOPRefLoader::createBinding(KJSEmbedPart *jspart, KJS::ExecState *exec, const KJS::List &args) const
+{
+ QString application = extractQString(exec, args, 0);
+ QString object = extractQString(exec, args, 1);
+ JSOpaqueProxy * prx;
+ if( application.isEmpty() )
+ prx= new JSOpaqueProxy( new DCOPRef(), "DCOPRef" );
+ else
+ prx= new JSOpaqueProxy( new DCOPRef(application.latin1(),object.latin1()), "DCOPRef" );
+
+ KJS::Object proxyObj( prx );
+ prx->setOwner( JSProxy::JavaScript );
+ addBindings(jspart,exec,proxyObj);
+ return proxyObj;
+}
+
+void JSDCOPRefLoader::addBindings( KJSEmbedPart *jspart, KJS::ExecState *exec, KJS::Object &proxy ) const
+{
+ JSDCOPRef::addBindings( exec, proxy );
+}
+
+JSDCOPRef::JSDCOPRef(KJS::ExecState *exec, int id)
+ : JSProxyImp(exec), mid(id)
+{
+}
+
+JSDCOPRef::~JSDCOPRef()
+{
+}
+
+void JSDCOPRef::addBindings( KJS::ExecState *exec, KJS::Object &object )
+{
+ JSOpaqueProxy *op = JSProxy::toOpaqueProxy( object.imp() );
+ if ( !op ) {
+ kdWarning() << "JSDCOPRef::addBindings() failed, not a JSOpaqueProxy" << endl;
+ return;
+ }
+
+ if ( op->typeName() != "DCOPRef" ) {
+ kdWarning() << "JSDCOPRef::addBindings() failed, type is " << op->typeName() << endl;
+ return;
+ }
+
+ DCOPRef *ref = op->toNative<DCOPRef>();
+
+ JSProxy::MethodTable methods[] = {
+ { Methodcall, "call"},
+ { Methodsend, "send" },
+ { Methodapp, "app" },
+ { Methodobj, "obj" },
+ { Methodtype, "type" },
+ { MethodsetRef, "setRef" },
+ { 0, 0 }
+ };
+
+ int idx = 0;
+ do {
+ JSDCOPRef *meth = new JSDCOPRef( exec, methods[idx].id );
+ object.put( exec, methods[idx].name, KJS::Object(meth) );
+ ++idx;
+ } while( methods[idx].id );
+
+}
+
+KJS::Value JSDCOPRef::call( KJS::ExecState *exec, KJS::Object &self, const KJS::List &args ) {
+
+
+ JSOpaqueProxy *op = JSProxy::toOpaqueProxy( self.imp() );
+ if ( !op ) {
+ kdWarning() << "JSDCOPRef::call() failed, not a JSOpaqueProxy" << endl;
+ return KJS::Boolean(false);
+ }
+
+ if ( op->typeName() != "DCOPRef" ) {
+ kdWarning() << "JSDCOPRef::call() failed, type is " << op->typeName() << endl;
+ return KJS::Boolean(false);
+ }
+ DCOPRef *ref = op->toNative<DCOPRef>();
+ kdDebug() << "Ref valid" << ref << endl;
+ if( !ref )
+ {
+ kdWarning() << "Ref invalid" << ref << endl;
+ return KJS::Null();
+ }
+ kdDebug() << "DCOPRef call. " << mid << endl;
+ KJS::Value retValue = KJS::Value();
+ switch ( mid ) {
+ case Methodcall:
+ {
+ if ( args.size() < 1 )
+ {
+ kdWarning() << "Not enough args..." << endl;
+ return KJS::Boolean(false);
+ }
+ QByteArray data, replyData;
+ QDataStream ds( replyData, IO_ReadOnly);
+ QCString type;
+
+ QString app = ref->app();
+ QString interface = ref->obj();
+ QString function = extractQString(exec, args, 0);
+ QStringList argTypes = JSDCOPClient::getTypes( function );
+
+ if( args.size() > 1)
+ for( int idx = 1; idx < args.size(); ++idx)
+ {
+ JSDCOPClient::marshall(convertToVariant(exec,args[idx] ), argTypes[idx - 1], data);
+ }
+ if( !kapp->dcopClient()->call(app.local8Bit(), interface.local8Bit(), function.local8Bit(), data, type, replyData))
+ retValue = KJS::Boolean(false);
+ else
+ retValue = JSDCOPClient::demarshall(exec, type, ds);
+ break;
+ }
+ case Methodsend:
+ {
+ if ( args.size() < 1 )
+ return KJS::Boolean(false);
+
+ QByteArray data;
+ QString app = ref->app();
+ QString interface = ref->obj();
+ QString function = extractQString(exec, args, 0);
+
+ QStringList argTypes = JSDCOPClient::getTypes( function );
+
+ if( args.size() > 1)
+ for( int idx = 1; idx < args.size(); ++idx)
+ {
+ JSDCOPClient::marshall(convertToVariant(exec,args[idx] ), argTypes[idx - 1], data);
+ }
+ retValue = KJS::Boolean( kapp->dcopClient()->send(app.local8Bit(), interface.local8Bit(),
+ function.local8Bit(), data));
+ break;
+ }
+ case Methodapp:
+ {
+ retValue = convertToValue( exec, ref->app() );
+ break;
+ }
+ case Methodobj:
+ {
+ retValue = convertToValue( exec, ref->obj() );
+ break;
+ }
+ case Methodtype:
+ {
+ retValue = convertToValue( exec, ref->type() );
+ break;
+ }
+ case MethodsetRef:
+ {
+ QString arg0 = extractQString(exec, args, 0);
+ QString arg1 = extractQString(exec, args, 1);
+ QString arg2 = extractQString(exec, args, 0);
+ ref->setRef(arg0.latin1(), arg1.latin1(), arg2.latin1() );
+ break;
+ }
+ default:
+ {
+ kdWarning() << "JSDCOPClient has no method " << mid << endl;
+ break;
+ }
+ }
+ op->setValue( ref, "DCOPRef" );
+ return retValue;
+}
+
+KJS::Object JSDCOPClientLoader::createBinding(KJSEmbedPart *jspart, KJS::ExecState *exec, const KJS::List &/*args*/) const
+{
+ JSOpaqueProxy * prx = new JSOpaqueProxy( kapp->dcopClient(), "DCOPClient" );
+ prx->setOwner( JSProxy::Native );
+ KJS::Object proxyObj( prx );
+ addBindings( jspart, exec, proxyObj );
+ return proxyObj;
+}
+
+void JSDCOPClientLoader::addBindings( KJSEmbedPart *jspart, KJS::ExecState *exec, KJS::Object &proxy ) const
+{
+ JSDCOPClient::addBindings( exec, proxy );
+}
+
+JSDCOPClient::JSDCOPClient( KJS::ExecState *exec, int id )
+ : JSProxyImp(exec), mid(id)
+{
+}
+
+JSDCOPClient::~JSDCOPClient()
+{
+}
+
+
+void JSDCOPClient::addBindings( KJS::ExecState *exec, KJS::Object &object )
+{
+ if( !JSProxy::checkType(object, JSProxy::OpaqueProxy, "DCOPClient") ) return;
+
+ JSProxy::MethodTable methods[] = {
+ { Methodattach, "attach"},
+ { Methoddetach, "detach"},
+ { MethodisAttached, "isAttached" },
+ { MethodregisteredApplications, "registeredApplications" },
+ { MethodremoteObjects, "remoteObjects" },
+ { MethodremoteInterfaces, "remoteInterfaces" },
+ { MethodremoteFunctions, "remoteFunctions" },
+ { MethodconnectDCOPSignal, "connectDCOPSignal" },
+ { MethoddisconnectDCOPSignal, "disconnectDCOPSignal"},
+ { Methodcall, "call"},
+ { Methodsend, "send"},
+ { MethodDCOPStart, "dcopStart"},
+ { MethodappId, "appId"},
+ { MethodisApplicationRegistered, "isApplicationRegistered" },
+ { 0, 0 }
+ };
+
+ JSProxy::addMethods<JSDCOPClient>(exec, methods, object );
+}
+
+KJS::Value JSDCOPClient::call( KJS::ExecState *exec, KJS::Object &self, const KJS::List &args ) {
+ if( !JSProxy::checkType(self, JSProxy::OpaqueProxy, "DCOPClient") ) return KJS::Value();
+
+ JSOpaqueProxy *op = JSProxy::toOpaqueProxy( self.imp() );
+
+ KJS::Value retValue = KJS::Value();
+ switch ( mid ) {
+ case Methodattach: {
+ retValue = KJS::Boolean(attach( ));
+ break;
+ }
+ case Methoddetach: {
+ retValue = KJS::Boolean(detach( ));
+ break;
+ }
+ case MethodisAttached: {
+ retValue = KJS::Boolean(isAttached( ));
+ break;
+ }
+ case MethodregisteredApplications: {
+ retValue = convertToValue(exec, registeredApplications());
+ break;
+ }
+ case MethodremoteObjects: {
+ QString arg0 = extractQString(exec, args, 0);
+ retValue = convertToValue( exec, remoteObjects(arg0));
+ break;
+ }
+ case MethodremoteInterfaces: {
+ QString arg0 = extractQString(exec, args, 0);
+ QString arg1 = extractQString(exec, args, 1);
+ this->remoteInterfaces(arg0, arg1);
+ break;
+ }
+ case MethodremoteFunctions: {
+ QString arg0 = extractQString(exec, args, 0);
+ QString arg1 = extractQString(exec, args, 1);
+ remoteFunctions(arg0, arg1);
+ break;
+ }
+ case MethodconnectDCOPSignal: {
+ QString arg0 = extractQString(exec, args, 0);
+ QString arg1 = extractQString(exec, args, 1);
+ QString arg2 = extractQString(exec, args, 2);
+ QString arg3 = extractQString(exec, args, 3);
+ QString arg4 = extractQString(exec, args, 4);
+ bool arg5 = (args.size() > 5) ? args[5].toBoolean(exec) : false;
+ connectDCOPSignal( arg0, arg1, arg2, arg3, arg4, arg5);
+ break;
+ }
+ case MethoddisconnectDCOPSignal: {
+ QString arg0 = extractQString(exec, args, 0);
+ QString arg1 = extractQString(exec, args, 1);
+ QString arg2 = extractQString(exec, args, 2);
+ QString arg3 = extractQString(exec, args, 3);
+ QString arg4 = extractQString(exec, args, 4);
+ disconnectDCOPSignal(arg0, arg1, arg2, arg3, arg4);
+ break;
+ }
+ case MethodDCOPStart: {
+ QString arg0 = extractQString(exec, args, 0);
+
+ retValue = KJS::String( dcopStart( arg0, QStringList() ) );
+ break;
+ }
+ case MethodappId:
+ retValue = KJS::String( kapp->dcopClient()->appId().data() );
+ break;
+ case MethodisApplicationRegistered: {
+ QString arg0 = extractQString(exec, args, 0);
+ retValue = KJS::Boolean( kapp->dcopClient()->isApplicationRegistered( arg0.latin1() ) );
+ break;
+ }
+ case Methodsend:
+ return dcopSend( exec, self, args );
+ break;
+ case Methodcall:
+ return dcopCall( exec, self, args );
+ break;
+ default:
+ kdWarning() << "JSDCOPClient has no method " << mid << endl;
+ break;
+ }
+ return retValue;
+}
+
+bool JSDCOPClient::attach() const
+{
+ if( !kapp->dcopClient()->isAttached() )
+ return kapp->dcopClient()->attach();
+ return true;
+}
+bool JSDCOPClient::detach() const
+{ return kapp->dcopClient()->detach();
+
+}
+
+bool JSDCOPClient::isAttached() const
+{
+ return kapp->dcopClient()->isAttached();
+}
+
+KJS::Value JSDCOPClient::dcopCall( KJS::ExecState * exec, KJS::Object &, const KJS::List & args )
+{
+ if ( args.size() < 3 )
+ return KJS::Boolean(false);
+
+ QStringList types;
+ QByteArray data, replyData;
+ QDataStream ds( replyData, IO_ReadOnly);
+ QCString type;
+
+ QString app = extractQString(exec, args, 0);
+ QString interface = extractQString(exec, args, 1);
+ QString function = extractQString(exec, args, 2);
+ QStringList argTypes = getTypes( function );
+
+ if( args.size() > 3)
+ for( int idx = 3; idx < args.size(); ++idx)
+ {
+ QVariant var = convertToVariant(exec,args[idx] );
+ marshall(var, argTypes[idx -3 ], data);
+ }
+ if( !kapp->dcopClient()->call(app.local8Bit(), interface.local8Bit(), function.local8Bit(), data, type, replyData))
+ return KJS::Boolean(false);
+ else
+ return demarshall(exec, type, ds);
+}
+
+KJS::Value JSDCOPClient::dcopSend( KJS::ExecState * exec, KJS::Object &, const KJS::List & args )
+{
+ if ( args.size() < 3 )
+ return KJS::Boolean(false);
+
+ QByteArray data;
+ QString app = extractQString(exec, args, 0);
+ QString interface = extractQString(exec, args, 1);
+ QString function = extractQString(exec, args, 2);
+ QStringList argTypes = getTypes( function );
+
+ if( args.size() > 3)
+ for( int idx = 3; idx < args.size(); ++idx)
+ {
+ QVariant var = convertToVariant(exec,args[idx] );
+ marshall(var, argTypes[idx - 3], data);
+ }
+ return KJS::Boolean( kapp->dcopClient()->send(app.local8Bit(), interface.local8Bit(),
+ function.local8Bit(), data));
+}
+
+KJS::Value JSDCOPClient::demarshall( KJS::ExecState * exec, const QCString& type, QDataStream& data)
+{
+ kdDebug() << "Demarshall " << type << endl;
+
+ if( type == "DCOPRef" )
+ {
+ DCOPRef *ref = new DCOPRef();
+ data >> *ref;
+ JSOpaqueProxy *prx = new JSOpaqueProxy(ref, "DCOPRef" );
+
+ KJS::Object proxyObj(prx);
+ kdDebug() << "DCOPRef " << ref->app() << endl;
+ Bindings::JSDCOPRef::addBindings( exec, proxyObj );
+ return proxyObj;
+ }
+ else
+ return convertToValue(exec, demarshall(type, data));
+}
+
+QStringList JSDCOPClient::getTypes( const QString& function )
+{
+ QCString myFunction = DCOPClient::normalizeFunctionSignature (function.latin1());
+ QString args = myFunction.mid( myFunction.find('(') + 1 );
+ args = args.left( args.length() - 1);
+ return QStringList::split(',', args);
+}
+
+void JSDCOPClient::marshall( const QVariant& data, const QString& typeName, QByteArray& buffer )
+{
+ QDataStream stream(buffer, IO_WriteOnly | IO_Append);
+
+ if ( typeName == "QString" )
+ {
+ stream << data.toString();
+ }
+ else if ( typeName == "QCString")
+ {
+ stream << data.toCString();
+ }
+ else if ( typeName == "int")
+ {
+ stream << data.toInt();
+ }
+ else if ( typeName == "uint")
+ {
+ stream << data.toUInt();
+ }
+ else if ( typeName == "bool")
+ {
+ stream << data.toBool();
+ }
+ else if ( typeName == "double")
+ {
+ stream << data.toDouble();
+ }
+ else if ( typeName == "QMap" )
+ {
+ stream << data.toMap();
+ }
+ else if ( typeName == "QValueList")
+ {
+ stream << data.toList();
+ }
+ else if ( typeName == "QFont")
+ {
+ stream << data.toFont();
+ }
+ else if ( typeName == "QPixmap")
+ {
+ stream << data.toPixmap();
+ }
+ else if ( typeName == "QBrush")
+ {
+ stream << data.toBrush();
+ }
+ else if ( typeName == "QRect")
+ {
+ stream << data.toRect();
+ }
+ else if ( typeName == "QSize")
+ {
+ stream << data.toSize();
+ }
+ else if ( typeName == "QColor")
+ {
+ stream << data.toColor();
+ }
+ else if ( typeName == "QPalette")
+ {
+ stream << data.toPalette();
+ }
+ else if ( typeName == "QColorGroup")
+ {
+ stream << data.toColorGroup();
+ }
+ /*else if ( typeName == "QIconSet")
+ {
+ stream << data.toIconSet();
+ }*/
+ else if ( typeName == "QPoint")
+ {
+ stream << data.toPoint();
+ }
+ else if ( typeName == "QImage")
+ {
+ stream << data.toImage();
+ }
+ else if ( typeName == "QPointArray")
+ {
+ stream << data.toPointArray();
+ }
+ else if ( typeName == "QRegion")
+ {
+ stream << data.toRegion();
+ }
+ else if ( typeName == "QBitmap")
+ {
+ stream << data.toBitmap();
+ }
+ else if ( typeName == "QCursor")
+ {
+ stream << data.toCursor();
+ }
+ /*else if ( typeName == "QSizePolicy")
+ {
+ stream << data.toSizePolicy();
+ }*/
+ else if ( typeName == "QDate")
+ {
+ stream << data.toDate();
+ }
+ else if ( typeName == "QTime")
+ {
+ stream << data.toTime();
+ }
+ else if ( typeName == "QDateTime")
+ {
+ stream << data.toDateTime();
+ }
+ else if ( typeName == "QByteArray")
+ {
+ stream << data.toByteArray();
+ }
+ else if ( typeName == "QBitArray")
+ {
+ stream << data.toBitArray();
+ }
+ else if ( typeName == "QKeySequence")
+ {
+ stream << data.toKeySequence();
+ }
+ else if ( typeName == "KURL" )
+ {
+ KURL url = data.toString();
+ stream << url;
+ }
+ else
+ stream << 0;
+
+}
+
+QString JSDCOPClient::dcopStart( const QString &appName, const QStringList& args )
+{
+ QString error;
+ QString startFunction;
+ if (appName.endsWith(".desktop"))
+ startFunction = "start_service_by_desktop_path(QString,QStringList)";
+ else
+ startFunction = "start_service_by_desktop_name(QString,QStringList)";
+
+ QByteArray data, replyData;
+ QCString replyType;
+ QDataStream arg(data, IO_WriteOnly);
+ arg << appName << args;
+
+ if ( !kapp->dcopClient()->call( "klauncher", "klauncher", startFunction.latin1(), data, replyType, replyData) )
+ {
+ kdWarning() << "Error: Dcop call failed" << endl;
+ }
+ else
+ {
+ QDataStream reply(replyData, IO_ReadOnly);
+
+ if ( replyType != "serviceResult" )
+ {
+ kdWarning() << "Error: No serviceResult " << endl;
+ }
+ else
+ {
+ int result;
+ QCString dcopName;
+ QString error;
+ reply >> result >> dcopName >> error;
+ if (result != 0)
+ {
+ kdWarning() << "Error: " << error.local8Bit().data() << endl;
+ }
+ else if (!dcopName.isEmpty())
+ {
+ return dcopName;
+ }
+ else
+ kdWarning() << "Error: no app name returned." << endl;
+ }
+ }
+
+ return "";
+
+}
+
+QStringList JSDCOPClient::remoteFunctions( const QString & remApp, const QString & remObj )
+{
+ QStringList returnList;
+ QCStringList lst = kapp->dcopClient()->remoteFunctions(remApp.local8Bit(), remObj.local8Bit());
+ for(uint idx = 0; idx < lst.count(); ++idx)
+ returnList += lst[idx];
+ return returnList;
+}
+
+QStringList JSDCOPClient::remoteInterfaces( const QString & remApp, const QString & remObj )
+{
+ QStringList returnList;
+ QCStringList lst = kapp->dcopClient()->remoteInterfaces(remApp.local8Bit(), remObj.local8Bit());
+ for(uint idx = 0; idx < lst.count(); ++idx)
+ returnList += lst[idx];
+ return returnList;
+}
+
+QStringList JSDCOPClient::remoteObjects( const QString & remApp )
+{
+ QStringList returnList;
+ QCStringList lst = kapp->dcopClient()->remoteObjects(remApp.local8Bit());
+ for(uint idx = 0; idx < lst.count(); ++idx)
+ returnList += lst[idx];
+ return returnList;
+}
+
+QStringList JSDCOPClient::registeredApplications( )
+{
+ QStringList returnList;
+ QCStringList lst = kapp->dcopClient()->registeredApplications( );
+ for(uint idx = 0; idx < lst.count(); ++idx)
+ returnList += lst[idx];
+ return returnList;
+}
+
+bool JSDCOPClient::connectDCOPSignal (const QString &sender, const QString &senderObj, const QString &signal, const QString &receiverObj, const QString &slot, bool Volatile)
+{
+ return kapp->dcopClient()->connectDCOPSignal(sender.latin1(), senderObj.latin1(), signal.latin1(), receiverObj.latin1(), slot.latin1(), Volatile);
+}
+
+bool JSDCOPClient::disconnectDCOPSignal (const QString &sender, const QString &senderObj, const QString &signal, const QString &receiverObj, const QString &slot)
+{
+ return kapp->dcopClient()->disconnectDCOPSignal(sender.latin1(), senderObj.latin1(), signal.latin1(), receiverObj.latin1(), slot.latin1());
+}
+
+KJS::Object JSDCOPInterfacerLoader::createBinding(KJSEmbedPart *jspart, KJS::ExecState *exec, const KJS::List &args) const
+{
+ QObject *parent = extractQObject(exec, args, 0);
+ QString name = extractQString(exec, args, 1);
+ QObject *obj = new JSDCOPInterface(jspart->interpreter(),parent, name.latin1() );
+ JSObjectProxy *prxy = new JSObjectProxy(jspart, obj);
+ KJS::Object object(prxy);
+ addBindings(jspart,exec,object);
+ return object;
+}
+
+void JSDCOPInterfacerLoader::addBindings( KJSEmbedPart *jspart, KJS::ExecState *exec, KJS::Object &proxy ) const
+{
+ JSObjectProxy *prx = JSProxy::toObjectProxy( proxy.imp() );
+ if( prx )
+ prx->addBindings( exec, proxy );
+}
+
+void JSDCOPInterface::publish( const QString & signature )
+{
+ if( m_Members.find(signature.latin1() ) == m_Members.end())
+ m_Members.append(signature.latin1() );
+}
+
+JSDCOPInterface::~ JSDCOPInterface( )
+{
+}
+
+JSDCOPInterface::JSDCOPInterface( KJS::Interpreter *js, QObject * parent, const char * name )
+ : BindingObject( parent, name ),DCOPObject(name), m_js(js)
+{
+ m_Members.clear();
+}
+
+QCStringList JSDCOPInterface::functionsDynamic( )
+{
+ return m_Members;
+}
+
+bool JSDCOPInterface::processDynamic( const QCString & rawFunction, const QByteArray & data, QCString & replyType, QByteArray & replyData )
+{
+ bool isOkay = false;
+
+ QRegExp reg = QRegExp("([_\\d\\w]+)(\\()(.*)(\\))");
+ reg.search(rawFunction);
+
+ kdDebug() << "Raw function: " << rawFunction << endl;
+ kdDebug() << "Reply type: " << replyType << endl;
+ kdDebug() << "Signature: " << reg.cap(1) << endl;
+ kdDebug() << "Args: " << reg.cap(3) << endl;
+
+ QString signature = reg.cap(1);
+
+ QStringList argStrings = QStringList::split(',', reg.cap(3), false);
+ kdDebug() << argStrings.count() << " args..." << endl;
+
+ KJS::ExecState *exec = m_js->globalExec();
+ KJS::Object obj = m_js->globalObject();
+ KJS::Identifier id( KJS::UString( signature.latin1() ) );
+ KJS::Object fun = obj.get(exec, id ).toObject( exec );
+ KJS::Value retValue;
+
+
+ if ( fun.implementsCall() )
+ {
+ QDataStream ds( data, IO_ReadOnly );
+ KJS::List args;
+ for( uint idx = 0; idx < argStrings.count(); ++idx)
+ {
+ kdDebug() << "Get arg: " << argStrings[idx] << endl;
+ args.append( JSDCOPClient::demarshall( exec, argStrings[idx].latin1(), ds));
+ }
+
+ retValue = fun.call(exec, obj, args);
+
+ if( exec->hadException() )
+ {
+ kdWarning() << "Got error: " << exec->exception().toString(exec).qstring() << endl;
+ }
+ else
+ {
+ kdDebug() << "Returned type is a " << retValue.type() << endl;
+ if( retValue.isA(KJS::UndefinedType) )
+ {
+ replyType = "void";
+ isOkay = true;
+ }
+ else if( retValue.isA(KJS::ObjectType) )
+ {
+ JSOpaqueProxy *oprx = JSProxy::toOpaqueProxy( retValue.imp() );
+ if( oprx )
+ {
+ replyType = "DCOPRef";
+ QDataStream refStream( replyData, IO_WriteOnly );
+ if( oprx->typeName() == "DCOPRef" )
+ {
+ DCOPRef ref(*oprx->toNative<DCOPRef>());
+ refStream << ref;
+ isOkay = true;
+ }
+ }
+ }
+ else
+ {
+ QVariant returnVariant = convertToVariant(exec, retValue);
+ JSDCOPClient::marshall(returnVariant,returnVariant.typeName(), replyData);
+ replyType = returnVariant.typeName();
+ isOkay = true;
+ }
+ }
+ }
+ return isOkay;
+}
+
+QVariant JSDCOPClient::demarshall( const QCString & type, QDataStream & reply )
+{
+ kdDebug() << "Type: '" << type << "'"<< endl;
+ /*if ( type == "QMap" ) // ? dont handle?
+ {
+ QMap<QVariant, QVariant> result;
+ reply >> result;
+ return QVariant(result);
+ }
+ else if ( type == "QValueList") // ? dont handle?
+ {
+ QValueList<QVariant> result;
+ reply >> result;
+ return QVariant(result);
+ }else if ( type == "QVariantList")
+ {
+ QVariantList result;
+ reply >> result;
+ return QVariant(result);
+ }
+ else */
+ if ( type == "QString")
+ {
+ QString result;
+ reply >> result;
+ return QVariant(result);
+ }
+ else if ( type == "int")
+ {
+ int result;
+ reply >> result;
+ kdDebug() << "Result: " << result << endl;
+ return QVariant(result);
+ }
+ else if ( type == "uint")
+ {
+ uint result;
+ reply >> result;
+ return QVariant(result);
+ }
+ else if ( type == "bool")
+ {
+ bool result;
+ reply >> result;
+ return QVariant(result);
+ }
+ else if ( type == "double")
+ {
+ double result;
+ reply >> result;
+ return QVariant(result);
+ }
+ else if ( type == "QCString")
+ {
+ QCString result;
+ reply >> result;
+ return QVariant(result);
+ }
+ else if ( type == "QVariant")
+ {
+ QVariant result;
+ reply >> result;
+ return QVariant(result);
+ }
+ else if ( type == "QFont")
+ {
+ QFont result;
+ reply >> result;
+ return QVariant(result);
+ }
+ else if ( type == "QPixmap")
+ {
+ QPixmap result;
+ reply >> result;
+ return QVariant(result);
+ }
+ else if ( type == "QBrush")
+ {
+ QBrush result;
+ reply >> result;
+ return QVariant(result);
+ }
+ else if ( type == "QRect")
+ {
+ QRect result;
+ reply >> result;
+ return QVariant(result);
+ }
+ else if ( type == "QSize")
+ {
+ QSize result;
+ reply >> result;
+ return QVariant(result);
+ }
+ else if ( type == "QColor")
+ {
+ QColor result;
+ reply >> result;
+ return QVariant(result);
+ }
+ else if ( type == "QPalette")
+ {
+ QPalette result;
+ reply >> result;
+ return QVariant(result);
+ }
+ else if ( type == "QColorGroup")
+ {
+ QColorGroup result;
+ reply >> result;
+ return QVariant(result);
+ }
+ /*else if ( type == "QIconSet")
+ {
+ QIconSet result;
+ reply >> result;
+ return QVariant(result);
+ }*/
+ else if ( type == "QPoint")
+ {
+ QPoint result;
+ reply >> result;
+ return QVariant(result);
+ }
+ else if ( type == "QImage")
+ {
+ QImage result;
+ reply >> result;
+ return QVariant(result);
+ }
+ else if ( type == "QPointArray")
+ {
+ QPointArray result;
+ reply >> result;
+ return QVariant(result);
+ }
+ else if ( type == "QRegion")
+ {
+ QRegion result;
+ reply >> result;
+ return QVariant(result);
+ }
+ else if ( type == "QBitmap")
+ {
+ QBitmap result;
+ reply >> result;
+ return QVariant(result);
+ }
+ else if ( type == "QCursor")
+ {
+ QCursor result;
+ reply >> result;
+ return QVariant(result);
+ }
+ /*else if ( type == "QSizePolicy")
+ {
+ QSizePolicy result;
+ reply >> result;
+ return QVariant(result);
+ }*/
+ else if ( type == "QDate")
+ {
+ QDate result;
+ reply >> result;
+ return QVariant(result);
+ }
+ else if ( type == "QTime")
+ {
+ QTime result;
+ reply >> result;
+ return QVariant(result);
+ }
+ else if ( type == "QDateTime")
+ {
+ QDateTime result;
+ reply >> result;
+ return QVariant(result);
+ }
+ else if ( type == "QByteArray")
+ {
+ QByteArray result;
+ reply >> result;
+ return QVariant(result);
+ }
+ else if ( type == "QBitArray")
+ {
+ QBitArray result;
+ reply >> result;
+ return QVariant(result);
+ }
+ else if ( type == "QKeySequence")
+ {
+ QKeySequence result;
+ reply >> result;
+ return QVariant(result);
+ }
+ else if ( type == "QStringList")
+ {
+ QStringList result;
+ reply >> result;
+ return QVariant(result);
+ }
+ else if ( type == "QCStringList")
+ {
+ QStringList result;
+ reply >> result;
+ return QVariant(result);
+ }
+ else
+ return QVariant();
+
+}
+} // namespace Bindings
+} // namespace KJSEmbed
+
+
+
+
diff --git a/kjsembed/bindings/dcop_imp.h b/kjsembed/bindings/dcop_imp.h
new file mode 100644
index 00000000..56466a11
--- /dev/null
+++ b/kjsembed/bindings/dcop_imp.h
@@ -0,0 +1,152 @@
+// $Id$
+// -*- c++ -*-
+
+/*
+ * Copyright (C) 2003, Ian Reinhart Geiser <geiseri@kde.org>
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Library General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Library General Public License for more details.
+ *
+ * You should have received a copy of the GNU Library General Public License
+ * along with this library; see the file COPYING.LIB. If not, write to
+ * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
+ * Boston, MA 02110-1301, USA.
+ */
+
+#ifndef KJSEMBED_DCOP_IMP_H
+#define KJSEMBED_DCOP_IMP_H
+
+#include "bindingobject.h"
+#include <kjsembed/jsobjectproxy_imp.h>
+#include <kjsembed/jsbindingbase.h>
+#include <dcopobject.h>
+
+class DCOPClient;
+#include <kdatastream.h>
+#include <qvariant.h>
+#include <qstring.h>
+
+namespace KJS
+{
+ class Interpreter;
+}
+
+namespace KJSEmbed {
+namespace Bindings {
+class JSDCOPInterfacerLoader : public JSBindingBase
+{
+ public:
+ KJS::Object createBinding(KJSEmbedPart *jspart, KJS::ExecState *exec, const KJS::List &args) const;
+ void addBindings( KJSEmbedPart *jspart, KJS::ExecState *exec, KJS::Object &proxy) const;
+};
+
+/**
+* QObject Binding for a DCOP interface
+*/
+class JSDCOPInterface : public BindingObject, public DCOPObject
+{
+ Q_OBJECT
+
+public:
+ JSDCOPInterface( KJS::Interpreter *js, QObject *parent, const char *name=0 );
+ virtual ~JSDCOPInterface();
+ QCStringList functionsDynamic();
+ bool processDynamic (const QCString &fun, const QByteArray &data, QCString &replyType, QByteArray &replyData);
+public slots:
+ void publish(const QString& signature);
+
+private:
+ QCStringList m_Members;
+ KJS::Interpreter *m_js;
+};
+
+class JSDCOPRefLoader : public JSBindingBase
+{
+ public:
+ KJS::Object createBinding(KJSEmbedPart *jspart, KJS::ExecState *exec, const KJS::List &args) const;
+ void addBindings( KJSEmbedPart *jspart, KJS::ExecState *exec, KJS::Object &proxy) const;
+};
+
+/**
+ * DCOPRef binding.
+*/
+class JSDCOPRef : public JSProxyImp
+{
+ enum MethodId { Methodcall, Methodsend, Methodapp, Methodobj, Methodtype, MethodsetRef };
+
+public:
+ JSDCOPRef( KJS::ExecState *exec, int id );
+ virtual ~JSDCOPRef();
+ static void addBindings( KJS::ExecState *exec, KJS::Object &object );
+
+ /** Returns true iff this object implements the call function. */
+ virtual bool implementsCall() const { return true; }
+
+ /** Invokes the call function. */
+ virtual KJS::Value call( KJS::ExecState *exec, KJS::Object &self, const KJS::List &args );
+
+private:
+ int mid;
+
+};
+
+class JSDCOPClientLoader : public JSBindingBase
+{
+ public:
+ KJS::Object createBinding(KJSEmbedPart *jspart, KJS::ExecState *exec, const KJS::List &args) const;
+ void addBindings( KJSEmbedPart *jspart, KJS::ExecState *exec, KJS::Object &proxy) const;
+};
+
+/**
+ * Binding for DCOPClient.
+ */
+class JSDCOPClient : public JSProxyImp
+{
+ enum MethodId { Methodattach, Methoddetach, MethodisAttached, MethodregisteredApplications, MethodremoteObjects, MethodremoteInterfaces, MethodremoteFunctions, MethodconnectDCOPSignal, MethoddisconnectDCOPSignal, Methodcall, Methodsend, MethodDCOPStart, MethodappId, MethodisApplicationRegistered };
+
+public:
+ JSDCOPClient( KJS::ExecState *exec, int id );
+ virtual ~JSDCOPClient();
+
+ static void addBindings( KJS::ExecState *exec, KJS::Object &object );
+
+ /** Returns true iff this object implements the call function. */
+ virtual bool implementsCall() const { return true; }
+
+ /** Invokes the call function. */
+ virtual KJS::Value call( KJS::ExecState *exec, KJS::Object &self, const KJS::List &args );
+
+ static KJS::Value demarshall( KJS::ExecState * exec, const QCString& type, QDataStream& data);
+ static QVariant demarshall( const QCString &type, QDataStream &ds);
+ static void marshall( const QVariant& data, const QString &typeName, QByteArray& buffer );
+ static QStringList getTypes( const QString& function);
+
+ bool attach() const;
+ bool detach() const;
+
+ bool isAttached() const;
+
+ QString dcopStart( const QString& appName, const QStringList& args);
+ QStringList registeredApplications();
+ QStringList remoteObjects( const QString& remApp);
+ QStringList remoteInterfaces( const QString& remApp, const QString& remObj );
+ QStringList remoteFunctions( const QString& remApp, const QString& remObj);
+ bool connectDCOPSignal (const QString &sender, const QString &senderObj, const QString &signal, const QString &receiverObj, const QString &slot, bool Volatile = false);
+ bool disconnectDCOPSignal (const QString &sender, const QString &senderObj, const QString &signal, const QString &receiverObj, const QString &slot);
+ KJS::Value dcopCall(KJS::ExecState *exec, KJS::Object &, const KJS::List &args);
+ KJS::Value dcopSend(KJS::ExecState *exec, KJS::Object &, const KJS::List &args);
+ private:
+ int mid;
+};
+
+} // namespace Bindings
+} // namespace KJSEmbed
+
+#endif // KJSEMBED_TEXTSTREAM_IMP_H
diff --git a/kjsembed/bindings/iconset_imp.cpp b/kjsembed/bindings/iconset_imp.cpp
new file mode 100644
index 00000000..3575cc94
--- /dev/null
+++ b/kjsembed/bindings/iconset_imp.cpp
@@ -0,0 +1,167 @@
+// -*- c++ -*-
+
+/*
+ * Copyright (C) 2003, Ian Reinhart Geiser <geiseri@kde.org>
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Library General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Library General Public License for more details.
+ *
+ * You should have received a copy of the GNU Library General Public License
+ * along with this library; see the file COPYING.LIB. If not, write to
+ * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
+ * Boston, MA 02110-1301, USA.
+ */
+
+#include <kjsembed/global.h>
+#include <kjsembed/jsvalueproxy.h>
+#include <kjsembed/jsbinding.h>
+#include <qvariant.h>
+#include <qiconset.h>
+#include <qpixmap.h>
+
+#include "iconset_imp.h"
+
+namespace KJSEmbed {
+namespace Bindings {
+
+IconsetImp::IconsetImp( KJS::ExecState *exec, int id )
+ : JSProxyImp(exec), mid(id)
+{
+}
+
+IconsetImp::~IconsetImp()
+{
+}
+
+void IconsetImp::addBindings( KJS::ExecState *exec, KJS::Object &object ) {
+
+ JSValueProxy *op = JSProxy::toValueProxy( object.imp() );
+ if ( !op ) {
+ kdWarning() << "IconsetImp::addBindings() failed, not a JSValueProxy" << endl;
+ return;
+ }
+
+ if ( op->typeName() != "QIconset" ) {
+ kdWarning() << "IconsetImp::addBindings() failed, type is " << op->typeName() << endl;
+ return;
+ }
+
+ JSProxy::MethodTable methods[] = {
+ { MethodReset, "reset"},
+ { MethodSetPixmap, "setPixmap"},
+ { MethodPixmap, "pixmap"},
+ { MethodIsGenerated, "isGenerated"},
+ { MethodClearGenerated, "clearGenerated"},
+ { MethodIsNull, "isNull"},
+ { MethodDetach, "detach"},
+ { 0, 0 }
+ };
+
+ int idx = 0;
+ do {
+ IconsetImp *meth = new IconsetImp( exec, methods[idx].id );
+ object.put( exec , methods[idx].name, KJS::Object(meth) );
+ ++idx;
+ } while( methods[idx].id );
+
+ //
+ // Define the enum constants
+ //
+ struct EnumValue {
+ const char *id;
+ int val;
+ };
+
+ EnumValue enums[] = {
+ // Size
+ { "Automatic", 0 },
+ { "Small", 1 },
+ { "Large", 2 },
+ // Mode
+ { "Normal", 0 },
+ { "Disabled", 1 },
+ { "Active", 2 },
+ // State
+ { "On", 0 },
+ { "Off", 1 },
+ { 0, 0 }
+ };
+
+ int enumidx = 0;
+ do {
+ object.put( exec, enums[enumidx].id, KJS::Number(enums[enumidx].val), KJS::ReadOnly );
+ ++enumidx;
+ } while( enums[enumidx].id );
+}
+
+KJS::Value IconsetImp::call( KJS::ExecState *exec, KJS::Object &self, const KJS::List &args ) {
+
+ JSValueProxy *op = JSProxy::toValueProxy( self.imp() );
+ if ( !op ) {
+ kdWarning() << "IconsetImp::call() failed, not a JSValueProxy" << endl;
+ return KJS::Value();
+ }
+
+ if ( op->typeName() != "QIconSet" ) {
+ kdWarning() << "IconsetImp::call() failed, type is " << op->typeName() << endl;
+ return KJS::Value();
+ }
+
+ QIconSet iconset = op->toVariant().toIconSet();
+
+ KJS::Value retValue = KJS::Value();
+ switch ( mid ) {
+ case MethodReset:
+ {
+ QPixmap pix = extractQPixmap(exec, args, 0);
+ QIconSet::Size size = (QIconSet::Size) extractInt(exec, args, 1 );
+ iconset.reset(pix,size);
+ break;
+ }
+ case MethodSetPixmap:
+ {
+ QPixmap pix = extractQPixmap( exec, args, 0);
+ QString fname = extractQString( exec, args, 0);
+ QIconSet::Size size = (QIconSet::Size) extractInt(exec, args, 1 );
+ QIconSet::Mode mode = (QIconSet::Mode) extractInt( exec, args, 2 );
+ QIconSet::State state = (QIconSet::State) extractInt( exec, args, 3);
+ if( pix.isNull() )
+ iconset.setPixmap( fname, size, mode, state );
+ else
+ iconset.setPixmap( pix, size, mode, state );
+ break;
+ }
+ case MethodPixmap:
+ {
+ QPixmap pix;
+
+ if( args.size() == 3 )
+ {
+ QIconSet::Size size = (QIconSet::Size)extractInt( exec, args, 0 );
+ QIconSet::Mode mode = (QIconSet::Mode)extractInt( exec, args, 1 );
+ QIconSet::State state = (QIconSet::State)extractInt( exec, args, 1 );
+ pix = iconset.pixmap( size, mode, state );
+ }
+ else
+ pix = iconset.pixmap();
+
+ break;
+ }
+ default:
+ kdWarning() << "Iconset has no method " << mid << endl;
+ break;
+ }
+
+ op->setValue(iconset);
+ return retValue;
+}
+
+} // namespace KJSEmbed::Bindings
+} // namespace KJSEmbed
diff --git a/kjsembed/bindings/iconset_imp.h b/kjsembed/bindings/iconset_imp.h
new file mode 100644
index 00000000..d758f0b5
--- /dev/null
+++ b/kjsembed/bindings/iconset_imp.h
@@ -0,0 +1,59 @@
+// -*- c++ -*-
+
+/*
+ * Copyright (C) 2004, Ian Reinhart Geiser <geiseri@kde.org>
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Library General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Library General Public License for more details.
+ *
+ * You should have received a copy of the GNU Library General Public License
+ * along with this library; see the file COPYING.LIB. If not, write to
+ * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
+ * Boston, MA 02110-1301, USA.
+ */
+
+#ifndef KJSEMBED_ICONSET_H
+#define KJSEMBED_ICONSET_H
+
+#include <kjsembed/jsproxy_imp.h>
+
+namespace KJSEmbed {
+namespace Bindings {
+
+class IconsetImp : public JSProxyImp {
+
+ /** Identifiers for the methods provided by this class. */
+ enum MethodId { MethodReset, MethodSetPixmap, MethodPixmap,
+ MethodIsGenerated, MethodClearGenerated, MethodIsNull,
+ MethodDetach };
+
+public:
+ IconsetImp( KJS::ExecState *exec, int id );
+ virtual ~IconsetImp();
+
+ static void addBindings( KJS::ExecState *exec, KJS::Object &object );
+
+ /** Returns true iff this object implements the call function. */
+ virtual bool implementsCall() const {
+ return true;
+ }
+
+ /** Invokes the call function. */
+ virtual KJS::Value call( KJS::ExecState *exec, KJS::Object &self, const KJS::List &args );
+
+
+private:
+ int mid;
+};
+
+} // namespace
+} // namespace
+
+#endif // KJSEMBED_IMAGE_IMP_H
diff --git a/kjsembed/bindings/image_imp.cpp b/kjsembed/bindings/image_imp.cpp
new file mode 100644
index 00000000..7f6abdca
--- /dev/null
+++ b/kjsembed/bindings/image_imp.cpp
@@ -0,0 +1,259 @@
+// -*- c++ -*-
+
+/*
+ * Copyright (C) 2003, Richard J. Moore <rich@kde.org>
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Library General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Library General Public License for more details.
+ *
+ * You should have received a copy of the GNU Library General Public License
+ * along with this library; see the file COPYING.LIB. If not, write to
+ * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
+ * Boston, MA 02110-1301, USA.
+ */
+
+#include <qfile.h>
+#include <kjsembed/global.h>
+#include <kjsembed/jsopaqueproxy.h>
+#include <kjsembed/jsvalueproxy.h>
+#include <kjsembed/jsbinding.h>
+#include <qvariant.h>
+
+#include "image_imp.h"
+
+namespace KJSEmbed {
+namespace Bindings {
+
+
+ImageImp::ImageImp( KJS::ExecState *exec, int id )
+ : JSProxyImp(exec), mid(id)
+{
+}
+
+ImageImp::~ImageImp()
+{
+}
+
+void ImageImp::addBindings( KJS::ExecState *exec, KJS::Object &object ) {
+
+ if( !JSProxy::checkType(object, JSProxy::ValueProxy, "QImage") ) return;
+
+ JSProxy::MethodTable methods[] = {
+ { Methodwidth, "width" },
+ { Methodheight, "height" },
+ { Methoddepth, "depth" },
+ { MethodisOk, "isOk" },
+ { Methodpixmap, "pixmap" },
+ { Methodload, "load" },
+ { Methodsave, "save" },
+ { MethodsetFormat, "setFormat" },
+ { MethodsmoothScale, "smoothScale" },
+ { MethodsmoothScaleMin, "smoothScaleMin" },
+ { MethodsetPixmap, "setPixmap" },
+ { MethodinvertPixels, "invertPixels" },
+ { Methodpixel, "pixel"},
+ { MethodsetPixel, "setPixel"},
+ { Methodmirror, "mirror" },
+ { 0, 0 }
+ };
+ JSProxy::addMethods<ImageImp>(exec, methods, object);
+
+}
+
+KJS::Value ImageImp::call( KJS::ExecState *exec, KJS::Object &self, const KJS::List &args ) {
+ if( !JSProxy::checkType(self, JSProxy::ValueProxy, "QImage") ) return KJS::Value();
+ JSValueProxy *op = JSProxy::toValueProxy( self.imp() );
+ img = op->toVariant().toImage();
+
+ KJS::Value retValue = KJS::Value();
+ switch ( mid ) {
+// case Methodfilename:
+// retValue = KJS::String(filename());
+// break;
+// case Methodformat:
+// retValue = KJS::String(format());
+// break;
+ case Methodwidth:
+ retValue = KJS::Number(width());
+ break;
+ case Methodheight:
+ retValue = KJS::Number(height());
+ break;
+ case Methoddepth:
+ retValue = KJS::Number(depth());
+ break;
+ case MethodisOk:
+ retValue = KJS::Boolean(isOk());
+ break;
+ case Methodpixmap:
+ {
+ retValue = convertToValue(exec, pixmap());
+ break;
+ }
+
+ case Methodload: {
+ QString arg0 = extractQString( exec, args, 0);
+ retValue = KJS::Boolean( load( arg0 ));
+ break;
+ }
+ case Methodsave: {
+ QString arg0 = extractQString( exec, args, 0);
+ QString arg1 = extractQString( exec, args, 1);
+ retValue = KJS::Boolean( save( arg0, arg1 ));
+ break;
+ }
+ case MethodsetFormat: {
+ QString arg0 = extractQString( exec, args, 0);
+ setFormat( arg0 );
+ break;
+ }
+ case MethodsmoothScale: {
+ int arg0 = extractInt( exec, args, 0);
+ int arg1 = extractInt( exec, args, 1);
+ smoothScale(arg0, arg1);
+ break;
+ }
+ case MethodsmoothScaleMin: {
+ int arg0 = extractInt( exec, args, 0);
+ int arg1 = extractInt( exec, args, 1);
+ smoothScaleMin(arg0, arg1);
+ break;
+ }
+ case MethodsetPixmap: {
+ QPixmap pix = extractQPixmap(exec, args, 0);
+ setPixmap(pix);
+ break;
+ }
+ case MethodinvertPixels: {
+ bool alpha = extractBool( exec, args, 0);
+ img.invertPixels(alpha);
+ break;
+ }
+ case Methodpixel: {
+ int x = extractInt(exec, args, 0);
+ int y = extractInt(exec, args, 1);
+ retValue = KJS::Number( img.pixel(x, y) );
+ break;
+ }
+ case MethodsetPixel: {
+ int x = extractInt(exec, args, 0);
+ int y = extractInt(exec, args, 1);
+ uint col = extractUInt(exec, args, 2);
+ img.setPixel(x, y, col);
+ break;
+ }
+ case Methodmirror:
+ {
+ if ( img.isNull())
+ break;
+
+ bool arg0 = extractBool( exec, args, 0);
+ bool arg1 = extractBool( exec, args, 1);
+ img = img.mirror( arg0, arg1 );
+ }
+ default:
+ kdWarning() << "Image has no method " << mid << endl;
+ break;
+ }
+
+ op->setValue(img);
+ return retValue;
+}
+
+int ImageImp::width() const {
+
+ return !img.isNull() ? img.width() : 0;
+}
+
+int ImageImp::height() const {
+ return !img.isNull() ? img.height() : 0;
+}
+
+int ImageImp::depth() const {
+ return !img.isNull() ? img.depth() : 0;
+}
+
+bool ImageImp::isOk() const {
+ return !img.isNull();
+}
+
+QPixmap ImageImp::pixmap() const {
+ if ( img.isNull() )
+ return QPixmap();
+
+ QPixmap pix;
+ pix.convertFromImage( img );
+ return pix;
+}
+
+void ImageImp::setPixmap( const QPixmap &pix ) {
+ if ( img.isNull() )
+ img = QImage();
+
+ img = pix.convertToImage();
+}
+
+QString ImageImp::format() const {
+ return fmt;
+}
+
+QString ImageImp::filename() const {
+ return nm;
+}
+
+void ImageImp::setFormat( const QString &f ) {
+ fmt = f;
+}
+
+bool ImageImp::load( const QString &filename ) {
+
+ if ( !img.isNull() )
+ img = QImage();
+
+ nm = filename;
+ fmt = QImageIO::imageFormat( filename );
+ bool ok = img.load( filename );
+ if ( !ok ) {
+ kdWarning() << "Error loading " << filename << endl;
+ img = QImage();
+ }
+ return ok;
+}
+
+bool ImageImp::save( const QString &filename, const QString &fmt ) {
+
+ if ( img.isNull() ) {
+ kdWarning() << "Attempt to save a null image to '" << filename << "'" << endl;
+ return false;
+ }
+
+ bool ok = img.save( filename, fmt.isNull() ? "PNG" : fmt.ascii() );
+ if ( ok )
+ nm = filename;
+
+ return ok;
+}
+
+void ImageImp::smoothScale( int w, int h ) {
+ if ( img.isNull())
+ return;
+ img = img.smoothScale( w, h );
+}
+
+void ImageImp::smoothScaleMin( int w, int h ) {
+ if ( img.isNull())
+ return;
+ img = img.smoothScale( w, h, QImage::ScaleMin );
+}
+
+
+} // namespace KJSEmbed::Bindings
+} // namespace KJSEmbed
+
diff --git a/kjsembed/bindings/image_imp.h b/kjsembed/bindings/image_imp.h
new file mode 100644
index 00000000..4104d3b5
--- /dev/null
+++ b/kjsembed/bindings/image_imp.h
@@ -0,0 +1,95 @@
+// -*- c++ -*-
+
+/*
+ * Copyright (C) 2003, Richard J. Moore <rich@kde.org>
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Library General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Library General Public License for more details.
+ *
+ * You should have received a copy of the GNU Library General Public License
+ * along with this library; see the file COPYING.LIB. If not, write to
+ * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
+ * Boston, MA 02110-1301, USA.
+ */
+
+#ifndef KJSEMBED_IMAGE_IMP_H
+#define KJSEMBED_IMAGE_IMP_H
+
+#include <kjsembed/jsobjectproxy_imp.h>
+
+#include <qimage.h>
+#include <qpixmap.h>
+
+
+namespace KJSEmbed {
+namespace Bindings {
+
+/**
+ * Methods for the QImage binding.
+ *
+ * @author Richard Moore, rich@kde.org
+ * @version $Id$
+ */
+
+class ImageImp : public JSProxyImp {
+
+ /** Identifiers for the methods provided by this class. */
+ enum MethodId {
+ /*Methodfilename, Methodformat,*/Methodwidth, Methodheight, Methoddepth,
+ MethodisOk, Methodpixmap, Methodload, Methodsave,MethodsetFormat,
+ MethodsmoothScale, MethodsmoothScaleMin, MethodsetPixmap, MethodinvertPixels,
+ Methodpixel, MethodsetPixel, Methodmirror
+ };
+
+
+public:
+ ImageImp( KJS::ExecState *exec, int id );
+ virtual ~ImageImp();
+
+ static void addBindings( KJS::ExecState *exec, KJS::Object &object );
+
+ /** Returns true iff this object implements the call function. */
+ virtual bool implementsCall() const {
+ return true;
+ }
+
+ /** Invokes the call function. */
+ virtual KJS::Value call( KJS::ExecState *exec, KJS::Object &self, const KJS::List &args );
+
+
+private:
+
+ QString filename() const;
+ QString format() const;
+ int width() const;
+ int height() const;
+ int depth() const;
+
+ bool isOk() const;
+ QPixmap pixmap() const;
+
+ bool load( const QString &filename );
+ bool save( const QString &filename, const QString &fmt );
+ void setFormat( const QString &fmt );
+ void smoothScale( int w, int h );
+ void smoothScaleMin( int w, int h );
+ void setPixmap( const QPixmap &pix );
+
+
+ int mid;
+ QImage img; // this is a temp!!!
+ QString nm;
+ QString fmt;
+};
+
+} // namespace
+} // namespace
+
+#endif // KJSEMBED_IMAGE_IMP_H
diff --git a/kjsembed/bindings/kconfig_imp.cpp b/kjsembed/bindings/kconfig_imp.cpp
new file mode 100644
index 00000000..f45e4d42
--- /dev/null
+++ b/kjsembed/bindings/kconfig_imp.cpp
@@ -0,0 +1,536 @@
+/*
+* Copyright (C) 2003, Ian Reinhart Geiser <geiseri@kde.org>
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Library General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Library General Public License for more details.
+ *
+ * You should have received a copy of the GNU Library General Public License
+ * along with this library; see the file COPYING.LIB. If not, write to
+ * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
+ * Boston, MA 02110-1301, USA.
+ */
+
+#include "kconfig_imp.h"
+
+#include <kjsembed/global.h>
+
+#ifndef QT_ONLY
+#include <kconfig.h>
+#include <kstddirs.h>
+#include <kapplication.h>
+#include "kconfig_imp.moc"
+#else
+#include <qsettings.h>
+#endif
+namespace KJSEmbed {
+namespace Bindings {
+
+Config::Config( QObject *parent, const char *name)
+ : BindingObject(parent, name)
+{
+
+#ifndef QT_ONLY
+ if( name == 0)
+ m_config = kapp->config();
+ else
+ m_config = new KConfig(name);
+ if( !m_config->checkConfigFilesWritable(true) )
+ {
+ kdWarning( 80001 ) << "Could not write to config file." << endl;
+ }
+#else
+ m_config = new QSettings();
+ if( name == 0)
+ m_name = "qjcmd";
+ else
+ m_name = name;
+ m_config->setPath( "QJSEmbed",m_name, QSettings::User );
+ m_forceGlobal = false;
+#endif
+}
+
+/*
+Config::Config( QObject *parent, const char *name , const QString& confName)
+ : BindingObject(parent, name)
+{
+ QString fileName = ::locate("kde_config", confName);
+ m_config = new KConfig(fileName);
+}
+*/
+Config::~Config()
+{
+#ifndef QT_ONLY
+ if( kapp->config() != m_config )
+#endif
+ delete m_config;
+}
+
+void Config::setDesktopGroup()
+{
+#ifndef QT_ONLY
+ m_config->setDesktopGroup();
+#else
+ m_config->resetGroup();
+ m_config->beginGroup("/Desktop Entry");
+#endif
+}
+
+void Config::setGroup(const QString& group)
+{
+#ifndef QT_ONLY
+ m_config->setGroup(group);
+#else
+ m_config->resetGroup();
+ m_config->beginGroup(group);
+#endif
+}
+
+QString Config::group()
+{
+ return m_config->group();
+}
+
+QStringList Config::groupList()
+{
+#ifndef QT_ONLY
+ return m_config->groupList();
+#else
+ m_config->resetGroup();
+ return m_config->subkeyList(group());
+#endif
+}
+
+QString Config::locale()
+{
+#ifndef QT_ONLY
+ return m_config->locale();
+#else
+ return "C";
+#endif
+}
+
+void Config::setForceGlobal( bool force )
+{
+#ifndef QT_ONLY
+ m_config->setForceGlobal(force);
+#else
+ m_forceGlobal = force;
+ m_config->setPath( "QJSEmbed",m_name, (force)?QSettings::Global:QSettings::User );
+#endif
+}
+
+bool Config::forceGlobal( ) const
+{
+#ifndef QT_ONLY
+ return m_config->forceGlobal();
+#else
+ return m_forceGlobal;
+#endif
+}
+
+void Config::setDollarExpansion( bool _bExpand )
+{
+#ifndef QT_ONLY
+ m_config->setDollarExpansion(_bExpand);
+#else
+ Q_UNUSED(_bExpand);
+#endif
+}
+
+bool Config::isDollarExpansion() const
+{
+#ifndef QT_ONLY
+ return m_config->isDollarExpansion();
+#else
+ return false;
+#endif
+}
+
+void Config::setReadOnly(bool _ro)
+{
+#ifndef QT_ONLY
+ m_config->setReadOnly(_ro);
+#else
+ Q_UNUSED(_ro);
+#endif
+}
+
+bool Config::isReadOnly() const
+{
+#ifndef QT_ONLY
+ return m_config->isReadOnly();
+#else
+ return false;
+#endif
+}
+
+void Config::setReadDefaults(bool b)
+{
+#ifndef QT_ONLY
+ m_config->setReadDefaults(b);
+#else
+ Q_UNUSED(b);
+#endif
+}
+
+bool Config::readDefaults() const
+{
+#ifndef QT_ONLY
+ return m_config->readDefaults();
+#else
+ return false;
+#endif
+}
+
+void Config::rollback( bool bDeep )
+{
+#ifndef QT_ONLY
+ m_config->rollback(bDeep);
+#else
+ Q_UNUSED(bDeep);
+#endif
+}
+
+void Config::sync()
+{
+ m_config->sync();
+}
+
+bool Config::hasKey( const QString& key ) const
+{
+#ifndef QT_ONLY
+ return m_config->hasKey(key);
+#else
+ return false;
+#endif
+}
+
+bool Config::entryIsImmutable(const QString &key) const
+{
+#ifndef QT_ONLY
+ return m_config->entryIsImmutable(key);
+#else
+ Q_UNUSED( key );
+ return false;
+#endif
+}
+
+void Config::revertToDefault(const QString &key)
+{
+#ifndef QT_ONLY
+ m_config->revertToDefault(key);
+#else
+ Q_UNUSED(key);
+#endif
+}
+
+bool Config::hasDefault(const QString &key) const
+{
+#ifndef QT_ONLY
+ return m_config->hasDefault(key);
+#else
+ Q_UNUSED(key);
+ return false;
+#endif
+}
+
+void Config::setFileWriteMode(int mode)
+{
+#ifndef QT_ONLY
+ m_config->setFileWriteMode(mode);
+#else
+ Q_UNUSED(mode);
+#endif
+}
+
+QString Config::readEntry(const QString& pKey, const QString& aDefault ) const
+{
+ return m_config->readEntry(pKey,aDefault);
+}
+
+QVariant Config::readPropertyEntry( const QString& pKey, const QVariant &pDefault) const
+{
+#ifndef QT_ONLY
+ return m_config->readPropertyEntry(pKey,pDefault);
+#else
+ QVariant returnVariant;
+ returnVariant = m_config->readEntry(pKey, pDefault.toString());
+ return returnVariant;
+#endif
+}
+
+QStringList Config::readListEntry( const QString& pKey ) const
+{
+ return m_config->readListEntry(pKey);
+}
+
+QString Config::readPathEntry( const QString& pKey, const QString & aDefault ) const
+{
+#ifndef QT_ONLY
+ return m_config->readPathEntry(pKey,aDefault);
+#else
+ return readEntry(pKey,aDefault);
+#endif
+}
+
+QStringList Config::readPathListEntry( const QString& pKey ) const
+{
+#ifndef QT_ONLY
+ return m_config->readPathListEntry(pKey);
+#else
+ return readListEntry(pKey);
+#endif
+
+}
+
+int Config::readNumEntry( const QString& pKey, int nDefault) const
+{
+ return m_config->readNumEntry(pKey,nDefault);
+}
+
+uint Config::readUnsignedNumEntry( const QString& pKey, uint nDefault) const
+{
+#ifndef QT_ONLY
+ return m_config->readUnsignedNumEntry(pKey,nDefault);
+#else
+ return (uint)readNumEntry(pKey,nDefault);
+#endif
+}
+
+long Config::readLongNumEntry( const QString& pKey, long nDefault) const
+{
+#ifndef QT_ONLY
+ return m_config->readLongNumEntry(pKey,nDefault);
+#else
+ return (long)readNumEntry(pKey,nDefault);
+#endif
+}
+
+double Config::readDoubleNumEntry( const QString& pKey, double nDefault ) const
+{
+#ifndef QT_ONLY
+ return m_config->readDoubleNumEntry(pKey,nDefault);
+#else
+ return m_config->readDoubleEntry(pKey,nDefault);
+#endif
+}
+
+QFont Config::readFontEntry( const QString& pKey, const QFont* pDefault ) const
+{
+#ifndef QT_ONLY
+ return m_config->readFontEntry(pKey,pDefault);
+#else
+ return readPropertyEntry(pKey,QVariant(*pDefault)).toFont();
+#endif
+}
+
+bool Config::readBoolEntry( const QString& pKey, const bool bDefault ) const
+{
+ return m_config->readBoolEntry(pKey,bDefault);
+}
+
+QRect Config::readRectEntry( const QString& pKey, const QRect* pDefault ) const
+{
+#ifndef QT_ONLY
+ return m_config->readRectEntry(pKey,pDefault);
+#else
+ return readPropertyEntry(pKey,QVariant(*pDefault)).toRect();
+#endif
+}
+
+QPoint Config::readPointEntry( const QString& pKey, const QPoint* pDefault ) const
+{
+#ifndef QT_ONLY
+ return m_config->readPointEntry(pKey,pDefault);
+#else
+ return readPropertyEntry(pKey,QVariant(*pDefault)).toPoint();
+#endif
+}
+
+QSize Config::readSizeEntry( const QString& pKey, const QSize* pDefault ) const
+{
+#ifndef QT_ONLY
+ return m_config->readSizeEntry(pKey,pDefault);
+#else
+ return readPropertyEntry(pKey,QVariant(*pDefault)).toSize();
+#endif
+}
+
+QColor Config::readColorEntry( const QString& pKey, const QColor* pDefault ) const
+{
+#ifndef QT_ONLY
+ return m_config->readColorEntry(pKey,pDefault);
+#else
+ return readPropertyEntry(pKey,QVariant(*pDefault)).toColor();
+#endif
+}
+
+QDateTime Config::readDateTimeEntry( const QString& pKey, const QDateTime* pDefault) const
+{
+#ifndef QT_ONLY
+ return m_config->readDateTimeEntry(pKey,pDefault);
+#else
+ return readPropertyEntry(pKey,QVariant(*pDefault)).toDateTime();
+#endif
+}
+
+QString Config::readEntryUntranslated( const QString& pKey, const QString& aDefault ) const
+{
+#ifndef QT_ONLY
+ return m_config->readEntryUntranslated(pKey,aDefault);
+#else
+ return m_config->readEntry(pKey,aDefault);
+#endif
+}
+void Config::writeEntry( const QString& pKey, const QString& pValue )
+{
+ m_config->writeEntry(pKey,pValue);
+}
+
+void Config::writePropertyEntry( const QString& pKey, const QVariant& pValue )
+{
+#ifndef QT_ONLY
+ m_config->writeEntry(pKey, pValue );
+#else
+ m_config->writeEntry(pKey,pValue.toString());
+#endif
+}
+
+void Config::writeListEntry( const QString& pKey, const QStringList &rValue )
+{
+#ifndef QT_ONLY
+ m_config->writeEntry(pKey, rValue );
+#else
+ m_config->writeEntry(pKey,rValue);
+#endif
+}
+
+void Config::writeNumEntry( const QString& pKey, int nValue )
+{
+#ifndef QT_ONLY
+ m_config->writeEntry(pKey, nValue );
+#else
+ m_config->writeEntry(pKey,nValue);
+#endif
+}
+void Config::writeUnsignedNumEntry( const QString& pKey, uint nValue )
+{
+#ifndef QT_ONLY
+ m_config->writeEntry(pKey, nValue );
+#else
+ writeNumEntry(pKey, (int)nValue );
+#endif
+}
+void Config::writeLongNumEntry( const QString& pKey, unsigned long nValue )
+{
+#ifndef QT_ONLY
+ m_config->writeEntry(pKey, nValue );
+#else
+ writeNumEntry(pKey, (int)nValue);
+#endif
+}
+void Config::writeDoubleNumEntry( const QString& pKey, double nValue )
+{
+ m_config->writeEntry(pKey,nValue);
+}
+void Config::writeBoolEntry( const QString& pKey, bool bValue )
+{
+ m_config->writeEntry(pKey,bValue);
+}
+void Config::writeFontEntry( const QString& pKey, const QFont& rFont )
+{
+#ifndef QT_ONLY
+ m_config->writeEntry(pKey, rFont );
+#else
+ writePropertyEntry(pKey,rFont);
+#endif
+
+}
+void Config::writeColorEntry( const QString& pKey, const QColor& rColor )
+{
+#ifndef QT_ONLY
+ m_config->writeEntry(pKey, rColor );
+#else
+ writePropertyEntry(pKey,rColor);
+#endif
+
+}
+void Config::writeDateTimeEntry( const QString& pKey, const QDateTime& rDateTime )
+{
+#ifndef QT_ONLY
+ m_config->writeEntry(pKey, rDateTime );
+#else
+ writePropertyEntry(pKey,rDateTime);
+#endif
+
+}
+void Config::writeRectEntry( const QString& pKey, const QRect& rValue )
+{
+#ifndef QT_ONLY
+ m_config->writeEntry(pKey, rValue );
+#else
+ writePropertyEntry(pKey,rValue);
+#endif
+
+}
+void Config::writePointEntry( const QString& pKey, const QPoint& rValue )
+{
+#ifndef QT_ONLY
+ m_config->writeEntry(pKey, rValue );
+#else
+ writePropertyEntry(pKey,rValue);
+#endif
+
+}
+void Config::writeSizeEntry( const QString& pKey, const QSize& rValue )
+{
+#ifndef QT_ONLY
+ m_config->writeEntry(pKey, rValue );
+#else
+ writePropertyEntry(pKey,rValue);
+#endif
+}
+void Config::writePathEntry( const QString& pKey, const QString & path )
+{
+#ifndef QT_ONLY
+ m_config->writePathEntry(pKey,path);
+#else
+ writeEntry(pKey,path);
+#endif
+}
+void Config::writePathListEntry( const QString& pKey, const QStringList &rValue )
+{
+#ifndef QT_ONLY
+ m_config->writePathEntry(pKey,rValue);
+#else
+ writeListEntry(pKey,rValue);
+#endif
+}
+void Config::deleteEntry( const QString& pKey, bool bNLS , bool bGlobal )
+{
+#ifndef QT_ONLY
+ m_config->deleteEntry(pKey,bNLS,bGlobal);
+#else
+ Q_UNUSED(bNLS);
+ Q_UNUSED(bGlobal);
+ m_config->removeEntry(pKey);
+#endif
+}
+bool Config::deleteGroup( const QString& group, bool bDeep , bool bGlobal )
+{
+#ifndef QT_ONLY
+ return m_config->deleteGroup(group,bDeep,bGlobal);
+#else
+ return false;
+#endif
+}
+
+}
+}
diff --git a/kjsembed/bindings/kconfig_imp.h b/kjsembed/bindings/kconfig_imp.h
new file mode 100644
index 00000000..55f58e34
--- /dev/null
+++ b/kjsembed/bindings/kconfig_imp.h
@@ -0,0 +1,135 @@
+// -*- c++ -*-
+
+/*
+ * Copyright (C) 2003, Ian Reinhart Geiser <geiseri@kde.org>
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Library General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Library General Public License for more details.
+ *
+ * You should have received a copy of the GNU Library General Public License
+ * along with this library; see the file COPYING.LIB. If not, write to
+ * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
+ * Boston, MA 02110-1301, USA.
+ */
+
+#ifndef KJSEMBED_CONFIG_IMP_H
+#define KJSEMBED_CONFIG_IMP_H
+
+#include <qdatetime.h>
+#include <qfont.h>
+#include <qvariant.h>
+#include <qpoint.h>
+#include <qrect.h>
+#include <qsize.h>
+#include <qcolor.h>
+#include <qstringlist.h>
+
+#include "bindingobject.h"
+
+#ifndef QT_ONLY
+class KConfig;
+#else
+class QSettings;
+#endif
+
+namespace KJSEmbed {
+namespace Bindings {
+
+class Config : public BindingObject
+{
+ Q_OBJECT
+ Q_PROPERTY( bool forceGlobal READ forceGlobal WRITE setForceGlobal )
+ Q_PROPERTY( bool dollarExpansion READ isDollarExpansion WRITE setDollarExpansion )
+ Q_PROPERTY( bool readOnly READ isReadOnly WRITE setReadOnly )
+ Q_PROPERTY( bool readDefaults READ readDefaults WRITE setReadDefaults )
+
+public:
+ Config( QObject *parent=0, const char *name=0);
+ /*
+ Config( QObject *parent, const char *name, const QString& confName );
+ */
+ virtual ~Config();
+
+ void setForceGlobal( bool force );
+ bool forceGlobal() const;
+ void setDollarExpansion( bool _bExpand );
+ bool isDollarExpansion() const;
+ void setReadOnly(bool _ro);
+ bool isReadOnly() const;
+ void setReadDefaults(bool b);
+ bool readDefaults() const;
+
+public slots:
+
+ // Group
+ void setDesktopGroup();
+ void setGroup(const QString&);
+ QString group();
+ QStringList groupList();
+ QString locale();
+
+ void rollback( bool bDeep );
+ void sync();
+ bool hasKey( const QString& key ) const;
+ bool entryIsImmutable(const QString &key) const;
+ void revertToDefault(const QString &key);
+ bool hasDefault(const QString &key) const;
+
+ void setFileWriteMode(int mode);
+ QString readEntry(const QString& pKey, const QString& aDefault ) const;
+ QVariant readPropertyEntry( const QString& pKey, const QVariant &var) const;
+ QStringList readListEntry( const QString& pKey ) const;
+ QString readPathEntry( const QString& pKey, const QString & aDefault) const;
+ QStringList readPathListEntry( const QString& pKey ) const;
+ int readNumEntry( const QString& pKey, int nDefault ) const;
+ uint readUnsignedNumEntry( const QString& pKey, uint nDefault ) const;
+ long readLongNumEntry( const QString& pKey, long nDefault ) const;
+ double readDoubleNumEntry( const QString& pKey, double nDefault ) const;
+ QFont readFontEntry( const QString& pKey, const QFont* pDefault) const;
+ bool readBoolEntry( const QString& pKey, const bool bDefault ) const;
+ QRect readRectEntry( const QString& pKey, const QRect* pDefault) const;
+ QPoint readPointEntry( const QString& pKey, const QPoint* pDefault) const;
+ QSize readSizeEntry( const QString& pKey, const QSize* pDefault) const;
+ QColor readColorEntry( const QString& pKey, const QColor* pDefault) const;
+ QDateTime readDateTimeEntry( const QString& pKey, const QDateTime* pDefault) const;
+ QString readEntryUntranslated( const QString& pKey, const QString& aDefault ) const;
+
+ void writeEntry( const QString& pKey, const QString& pValue );
+ void writePropertyEntry( const QString& pKey, const QVariant& pValue );
+ void writeListEntry( const QString& pKey, const QStringList &rValue );
+ void writeNumEntry( const QString& pKey, int nValue );
+ void writeUnsignedNumEntry( const QString& pKey, uint nValue );
+ void writeLongNumEntry( const QString& pKey, unsigned long nValue );
+ void writeDoubleNumEntry( const QString& pKey, double nValue );
+ void writeBoolEntry( const QString& pKey, bool bValue );
+ void writeFontEntry( const QString& pKey, const QFont& rFont );
+ void writeColorEntry( const QString& pKey, const QColor& rColor );
+ void writeDateTimeEntry( const QString& pKey, const QDateTime& rDateTime );
+ void writeRectEntry( const QString& pKey, const QRect& rValue );
+ void writePointEntry( const QString& pKey, const QPoint& rValue );
+ void writeSizeEntry( const QString& pKey, const QSize& rValue );
+ void writePathEntry( const QString& pKey, const QString & path );
+ void writePathListEntry( const QString& pKey, const QStringList &rValue);
+ void deleteEntry( const QString& pKey, bool bNLS , bool bGlobal );
+ bool deleteGroup( const QString& group, bool bDeep , bool bGlobal );
+
+private:
+#ifndef QT_ONLY
+ KConfig *m_config;
+#else
+ QSettings *m_config;
+ QString m_name;
+ bool m_forceGlobal;
+#endif
+};
+}
+}
+
+#endif
diff --git a/kjsembed/bindings/movie_imp.cpp b/kjsembed/bindings/movie_imp.cpp
new file mode 100644
index 00000000..8a5ced01
--- /dev/null
+++ b/kjsembed/bindings/movie_imp.cpp
@@ -0,0 +1,158 @@
+// -*- c++ -*-
+
+/*
+ * Copyright (C) 2003, Ian Reinhart Geiser <geiseri@kde.org>
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Library General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Library General Public License for more details.
+ *
+ * You should have received a copy of the GNU Library General Public License
+ * along with this library; see the file COPYING.LIB. If not, write to
+ * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
+ * Boston, MA 02110-1301, USA.
+ */
+
+#include <qpixmap.h>
+#include <kjsembed/global.h>
+#include "movie_imp.h"
+
+
+namespace KJSEmbed {
+namespace Bindings {
+
+Movie::Movie( QObject *parent, const char *name ) : BindingObject(parent, name)
+{
+ movie = QMovie();
+}
+Movie::~Movie()
+{
+
+}
+QColor Movie::backgroundColor() const
+{
+ if( movie.isNull() )
+ return QColor();
+ return movie.backgroundColor();
+}
+void Movie::setBackgroundColor( const QColor &c )
+{
+ if( movie.isNull() )
+ return;
+ movie.setBackgroundColor(c);
+}
+int Movie::speed() const
+{
+ if( movie.isNull() )
+ return 0;
+ return movie.speed();
+}
+void Movie::setSpeed( int percent )
+{
+ if( movie.isNull() )
+ return;
+ movie.setSpeed(percent);
+}
+bool Movie::load( const QString &filename, int bufsize)
+{
+ movie = QMovie( filename, bufsize);
+ if ( movie.isNull() )
+ return false;
+ else
+ return true;
+}
+QRect Movie::getValidRect()
+{
+ if( movie.isNull() )
+ return QRect();
+ return movie.getValidRect();
+}
+QPixmap Movie::framePixmap()
+{
+ if( movie.isNull() )
+ return QPixmap();
+ return movie.framePixmap();
+}
+QImage Movie::frameImage()
+{
+ if( movie.isNull() )
+ return QImage();
+ return movie.frameImage();
+}
+bool Movie::isNull()
+{
+ return movie.isNull();
+}
+int Movie::frameNumber()
+{
+ if( movie.isNull() )
+ return 0;
+ return movie.frameNumber();
+}
+int Movie::steps()
+{
+ if( movie.isNull() )
+ return 0;
+ return movie.steps();
+}
+bool Movie::paused()
+{
+ if( movie.isNull() )
+ return false;
+ return movie.paused();
+}
+bool Movie::finished()
+{
+ if( movie.isNull() )
+ return false;
+ return movie.finished();
+}
+bool Movie::running()
+{
+ if( movie.isNull() )
+ return false;
+ return movie.running();
+}
+void Movie::unpause()
+{
+ if( movie.isNull() )
+ return;
+ movie.unpause();
+}
+void Movie::pause()
+{
+ if( movie.isNull() )
+ return;
+ movie.pause();
+}
+void Movie::step()
+{
+ if( movie.isNull() )
+ return;
+ movie.step();
+}
+void Movie::step( int steps )
+{
+ if( movie.isNull() )
+ return;
+ movie.step(steps);
+}
+void Movie::restart()
+{
+ if( movie.isNull() )
+ return;
+ movie.restart();
+}
+
+} // namespace KJSEmbed::Bindings
+} // namespace KJSEmbed
+
+#ifndef QT_ONLY
+#include "movie_imp.moc"
+#endif
diff --git a/kjsembed/bindings/movie_imp.h b/kjsembed/bindings/movie_imp.h
new file mode 100644
index 00000000..2b3024e4
--- /dev/null
+++ b/kjsembed/bindings/movie_imp.h
@@ -0,0 +1,77 @@
+// -*- c++ -*-
+
+/*
+ * Copyright (C) 2003, Ian Reinhart Geiser <geiseri@kde.org>
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Library General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Library General Public License for more details.
+ *
+ * You should have received a copy of the GNU Library General Public License
+ * along with this library; see the file COPYING.LIB. If not, write to
+ * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
+ * Boston, MA 02110-1301, USA.
+ */
+
+#ifndef KJSEMBED_MOVIE_IMP_H
+#define KJSEMBED_MOVIE_IMP_H
+
+#include "bindingobject.h"
+#include <qmovie.h>
+#include <qimage.h>
+
+namespace KJSEmbed {
+namespace Bindings {
+
+/**
+ * QObject Binding for QMovie.
+ *
+ * @author Ian Reinhart Geiser, geiseri@kde.org
+ * @version $Id$
+ */
+class Movie : public BindingObject
+{
+ Q_OBJECT
+
+ Q_PROPERTY( QColor setBackgroundColor READ backgroundColor )
+ Q_PROPERTY( int setSpeed READ speed )
+
+public:
+ Movie( QObject *parent=0, const char *name=0 );
+ virtual ~Movie();
+ QColor backgroundColor() const;
+ void setBackgroundColor( const QColor &c );
+ int speed() const;
+ void setSpeed ( int percent );
+
+public slots:
+ bool load( const QString &filename, int bufsize = 1024);
+ QRect getValidRect();
+ QPixmap framePixmap();
+ QImage frameImage();
+ bool isNull();
+ int frameNumber();
+ int steps();
+ bool paused();
+ bool finished();
+ bool running();
+ void unpause();
+ void pause();
+ void step();
+ void step( int steps );
+ void restart();
+
+private:
+ QMovie movie;
+};
+
+} // namespace
+} // namespace
+
+#endif // KJSEMBED_MOVIE_IMP_H
diff --git a/kjsembed/bindings/netaccess_imp.cpp b/kjsembed/bindings/netaccess_imp.cpp
new file mode 100644
index 00000000..b2d6cce7
--- /dev/null
+++ b/kjsembed/bindings/netaccess_imp.cpp
@@ -0,0 +1,156 @@
+// -*- Mode: C++; c-basic-offset: 4; indent-tabs-mode: nil; -*-
+/**
+ * netaccess_imp.cpp
+ *
+ * Copyright (C) 2003 Zack Rusin <zack@kde.org>
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
+ * 02110-1301 USA
+ */
+#include "netaccess_imp.h"
+
+#include <kio/netaccess.h>
+#include <kpropertiesdialog.h>
+
+#include <kurl.h>
+#include <kdebug.h>
+#include <kdeversion.h>
+#include <ktempfile.h>
+
+namespace KJSEmbed {
+namespace Bindings {
+
+NetAccess::NetAccess( QObject *parent, const char *name )
+ : BindingObject( parent, name )
+{
+}
+
+NetAccess::~NetAccess()
+{
+}
+
+bool NetAccess::download( const KURL& src, const QString& loc )
+{
+ QString mloc = loc;
+#if KDE_IS_VERSION(3,1,90)
+ return KIO::NetAccess::download( src, mloc, 0 );
+#else
+ return KIO::NetAccess::download( src, mloc );
+#endif
+}
+
+QString NetAccess::createTempFile( const QString& prefix, const QString& ext, uint mode )
+{
+ KTempFile tmpFile = KTempFile(prefix, ext, mode);
+ tmpFile.setAutoDelete(false);
+ return tmpFile.name();
+}
+
+void NetAccess::removeTempFile( const QString& name )
+{
+ KIO::NetAccess::removeTempFile( name );
+}
+
+bool NetAccess::upload( const QString& src, const KURL& dest )
+{
+#if KDE_IS_VERSION(3,1,90)
+ return KIO::NetAccess::upload( src, dest, 0 );
+#else
+ return KIO::NetAccess::upload( src, dest );
+#endif
+}
+
+bool NetAccess::copy( const KURL& src, const KURL& target )
+{
+#if KDE_IS_VERSION(3,1,90)
+ return KIO::NetAccess::copy( src, target, 0 );
+#else
+ return KIO::NetAccess::copy( src, target );
+#endif
+}
+
+bool NetAccess::dircopy( const KURL& src, const KURL& target )
+{
+#if KDE_IS_VERSION(3,1,90)
+ return KIO::NetAccess::dircopy( src, target, 0 );
+#else
+ return KIO::NetAccess::dircopy( src, target );
+#endif
+}
+
+bool NetAccess::move( const KURL& src, const KURL& target )
+{
+#if KDE_IS_VERSION(3,1,90)
+ return KIO::NetAccess::move( src, target, 0 );
+#else
+ kdWarning() << "NetAccess::move(src,target) is not supported on 3.1" << endl;
+ return false;
+#endif
+}
+
+bool NetAccess::exists( const KURL& url, bool source )
+{
+#if KDE_IS_VERSION(3,1,90)
+ return KIO::NetAccess::exists( url, source, 0 );
+#else
+ return KIO::NetAccess::exists( url, source );
+#endif
+}
+
+bool NetAccess::del( const KURL & url )
+{
+#if KDE_IS_VERSION(3,1,90)
+ return KIO::NetAccess::del( url, 0 );
+#else
+ return KIO::NetAccess::del( url );
+#endif
+}
+
+int NetAccess::propertiesDialog( const KURL &url )
+{
+ KPropertiesDialog dlg( url, 0, "file_properties", true, false );
+ return dlg.exec();
+}
+
+QString NetAccess::fish_execute( const KURL& url, const QString& command )
+{
+#if KDE_IS_VERSION(3,1,90)
+ return KIO::NetAccess::fish_execute( url, command, 0 );
+#else
+ kdWarning() << "NetAccess::fish_execute(url,command) is not supported on 3.1" << endl;
+ return QString::null;
+#endif
+}
+
+QString NetAccess::mimetype( const KURL& url )
+{
+ kdDebug()<<"mimetype CALLED "<<endl;
+
+#if KDE_IS_VERSION(3,1,90)
+ return KIO::NetAccess::mimetype( url, 0 );
+#else
+ return KIO::NetAccess::mimetype( url );
+#endif
+}
+
+QString NetAccess::lastErrorString()
+{
+ return KIO::NetAccess::lastErrorString();
+}
+
+}
+}
+
+#include "netaccess_imp.moc"
diff --git a/kjsembed/bindings/netaccess_imp.h b/kjsembed/bindings/netaccess_imp.h
new file mode 100644
index 00000000..c2c01bfe
--- /dev/null
+++ b/kjsembed/bindings/netaccess_imp.h
@@ -0,0 +1,62 @@
+// -*- Mode: C++; c-basic-offset: 4; indent-tabs-mode: nil; -*-
+/**
+ * netaccess.h
+ *
+ * Copyright (C) 2003 Zack Rusin <zack@kde.org>
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
+ * 02110-1301 USA
+ */
+#ifndef KJSEMBED_NETACCESS_IMP_H
+#define KJSEMBED_NETACCESS_IMP_H
+
+#include <qstring.h>
+#include "bindingobject.h"
+
+class KURL;
+
+namespace KJSEmbed {
+namespace Bindings {
+
+/**
+ * Provides a binding to KIO::NetAccess.
+ */
+class NetAccess : public BindingObject
+{
+ Q_OBJECT
+public:
+ NetAccess( QObject *parent, const char *name=0 );
+ virtual ~NetAccess();
+public slots:
+ bool download( const KURL& src, const QString & loc );
+ QString createTempFile(const QString& prefix, const QString& ext, uint mode );
+ void removeTempFile( const QString& name );
+ bool upload( const QString& src, const KURL& dest );
+ bool copy( const KURL& src, const KURL& target );
+ bool dircopy( const KURL& src, const KURL& target );
+ bool move( const KURL& src, const KURL& target );
+ bool exists( const KURL& url, bool source );
+ bool del( const KURL& url );
+ int propertiesDialog( const KURL &url );
+
+ QString fish_execute( const KURL& url, const QString& command );
+ QString mimetype( const KURL& url );
+ QString lastErrorString();
+};
+
+} // namespace Bindings
+} // namespace KJSEmbed
+
+#endif
diff --git a/kjsembed/bindings/painter_imp.cpp b/kjsembed/bindings/painter_imp.cpp
new file mode 100644
index 00000000..8fa77de0
--- /dev/null
+++ b/kjsembed/bindings/painter_imp.cpp
@@ -0,0 +1,521 @@
+// -*- c++ -*-
+
+/*
+ * Copyright (C) 2003, Richard J. Moore <rich@kde.org>
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Library General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Library General Public License for more details.
+ *
+ * You should have received a copy of the GNU Library General Public License
+ * along with this library; see the file COPYING.LIB. If not, write to
+ * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
+ * Boston, MA 02110-1301, USA.
+ */
+
+#include <qpainter.h>
+#include <qpixmap.h>
+#include <qimage.h>
+#include <kjsembed/jsopaqueproxy.h>
+#include <kjsembed/jsobjectproxy.h>
+#include <kjsembed/jsvalueproxy.h>
+#include <kjsembed/jsbinding.h>
+#include <qfont.h>
+#include <kjsembed/global.h>
+
+#include "painter_imp.h"
+
+namespace KJSEmbed {
+namespace Bindings {
+
+ KJS::Object PainterLoader::createBinding(KJSEmbedPart *jspart, KJS::ExecState *exec, const KJS::List &args) const
+ {
+ PainterRef * p = new PainterRef();
+ /*
+ QWidget *w = extractQWidget(exec, args, 0);
+ QPixmap pix = extractQPixmap(exec, args, 0);
+ if( w )
+ {
+ p->setDevice(w);
+ p->setCanDelete(false);
+ }
+ else if( !pix.isNull() )
+ p->setDevice( new QPixmap(pix) );
+ */
+ JSOpaqueProxy *prx = new JSOpaqueProxy( p, "Painter" );
+ prx->setOwner( JSProxy::JavaScript );
+ KJS::Object proxyObj( prx );
+ Painter::addBindings( exec, proxyObj );
+ return proxyObj;
+ }
+
+ void PainterLoader::addBindings( KJSEmbedPart *jspart, KJS::ExecState *exec, KJS::Object &proxy ) const
+ {
+ Painter::addBindings( exec, proxy );
+ }
+
+PainterRef::PainterRef()
+{
+ m_device = 0L;
+ m_painter = new QPainter;
+ m_canDelete = true;
+}
+PainterRef::~PainterRef()
+{
+ kdDebug() << "Painter ref going away..." << endl;
+ if( m_device && m_canDelete)
+ delete m_device;
+ delete m_painter;
+}
+
+QPainter *PainterRef::painter()
+{
+ return m_painter;
+}
+
+QPaintDevice *PainterRef::device()
+{
+ return m_device;
+}
+
+void PainterRef::setDevice(QPaintDevice *d)
+{
+ if( m_device && m_canDelete)
+ {
+ delete m_device;
+ m_device = 0L;
+ }
+ m_device = d;
+
+}
+
+void Painter::addBindings( KJS::ExecState *exec, KJS::Object &object ) {
+
+ if( !JSProxy::checkType(object, JSProxy::OpaqueProxy, "Painter") ) return;
+
+ JSProxy::MethodTable methods[] = {
+ { Methodbegin, "begin" },
+ { Methodend, "end" },
+ { Methodpixmap, "pixmap" },
+ { MethodsetPixmap, "setPixmap" },
+ { MethodsetPen, "setPen" },
+ { Methodpen, "pen" },
+ { MethodtextBox, "textBox" },
+ { MethodmoveTo, "moveTo" },
+ { MethodlineTo, "lineTo" },
+ { MethoddrawPoint, "drawPoint" },
+ { MethoddrawLine, "drawLine" },
+ { MethoddrawRect, "drawRect" },
+ { MethoddrawRoundRect, "drawRoundRect" },
+ { MethoddrawEllipse, "drawEllipse" },
+ { MethoddrawText, "drawText" },
+ { MethoddrawArc, "drawArc" },
+ { MethoddrawPie, "drawPie" },
+ { MethoddrawPixmap, "drawPixmap" },
+ { MethoddrawImage, "drawImage" },
+ { MethoddrawTiledPixmap, "drawTiledPixmap" },
+ { Methodscale, "scale" },
+ { Methodshear, "shear" },
+ { Methodrotate, "rotate" },
+ { Methodtranslate, "translate" },
+ { MethodsetFont, "setFont" },
+ { Methodfont, "font" },
+ { MethodsetBrush, "setBrush" },
+ { Methodbrush, "brush" },
+ { MethodbackgroundColor, "backgroundColor" },
+ { MethodsetBackgroundColor, "setBackgroundColor" },
+ { 0, 0 }
+ };
+
+ JSProxy::addMethods<Painter>(exec, methods, object );
+
+}
+
+KJS::Value Painter::call( KJS::ExecState *exec, KJS::Object &self, const KJS::List &args ) {
+ if( !JSProxy::checkType(self, JSProxy::OpaqueProxy, "Painter") ) return KJS::Boolean(false);
+
+ KJS::Value retValue = KJS::Boolean(false);
+ JSOpaqueProxy *op = JSProxy::toOpaqueProxy( self.imp() );
+
+ pr = op->toNative<PainterRef>();
+
+ switch ( mid ) {
+ case Methodbegin:
+ {
+ if ( args.size() == 1 ) {
+ JSObjectProxy *objp = JSProxy::toObjectProxy(args[0].imp() );
+ JSValueProxy *vp = JSProxy::toValueProxy(args[0].imp() );
+ JSOpaqueProxy *op = JSProxy::toOpaqueProxy(args[0].imp() );
+ if ( objp )
+ {
+ if( objp->widget() )
+ {
+ pr->setDevice( objp->widget() );
+ pr->setCanDelete(false);
+ retValue = KJS::Boolean( begin() );
+ }
+ else
+ {
+ QString msg = i18n( "Paintdevice was not a valid widget." );
+ throwError(exec,msg);
+ retValue = KJS::Boolean(false);
+ }
+ }
+ else if ( vp )
+ {
+ QPixmap *p = new QPixmap(vp->toVariant().toPixmap());
+ if( p->isNull() )
+ {
+ QString msg = i18n( "Cannto paint to a null pixmap." ).arg( op->typeName() );
+ throwError(exec,msg);
+ retValue = KJS::Boolean(false);
+ }
+ else
+ {
+ pr->setDevice( p );
+ pr->setCanDelete(true);
+ retValue = KJS::Boolean( begin() );
+ }
+ }
+ else if ( op && op->typeName() == "QPaintDevice" )
+ {
+ pr->setDevice( op->toNative<QPaintDevice>() );
+ pr->setCanDelete(false);
+ retValue = KJS::Boolean( begin() );
+ }
+ else
+ {
+ QString msg = i18n( "Paintdevice of type '%1' is not supported." ).arg( op->typeName() );
+ throwError(exec,msg);
+ retValue = KJS::Boolean(false);
+ }
+ }
+ else
+ {
+ QString msg = i18n( "Incorrect number of arguements '%1'." ).arg( args.size() );
+ throwError(exec,msg);
+ retValue = KJS::Boolean(false);
+ }
+ break;
+ }
+ case Methodend:
+ retValue = KJS::Boolean( end() );
+ break;
+ case Methodpixmap:
+ {
+ retValue = convertToValue(exec, pixmap());
+ break;
+ }
+ case MethodsetPixmap:
+ break;
+ case MethodsetPen:
+ {
+ QPen pn = extractQPen(exec, args, 0);
+ setPen(pn);
+ break;
+ }
+ case Methodpen:
+ {
+ retValue = convertToValue(exec, pen());
+ break;
+ }
+ case MethodtextBox:
+ {
+ retValue = convertToValue(exec, textBox(extractQString(exec, args, 0)));
+ break;
+ }
+ case MethodmoveTo:
+ {
+ moveTo(extractInt(exec, args, 0), extractInt(exec, args, 1));
+ break;
+ }
+ case MethodlineTo:
+ {
+ lineTo(extractInt(exec, args, 0), extractInt(exec, args, 1));
+ break;
+ }
+ case MethoddrawPoint:
+ {
+ drawPoint(extractInt(exec, args, 0), extractInt(exec, args, 1));
+ break;
+ }
+ case MethoddrawLine:
+ {
+ drawLine(extractInt(exec, args, 0), extractInt(exec, args, 1),extractInt(exec, args, 2), extractInt(exec, args, 3));
+ break;
+ }
+ case MethoddrawRect:
+ {
+ drawRect(extractInt(exec, args, 0), extractInt(exec, args, 1),extractInt(exec, args, 2), extractInt(exec, args, 3));
+ break;
+ }
+ case MethoddrawRoundRect:
+ {
+ drawRoundRect(extractInt(exec, args, 0), extractInt(exec, args, 1),extractInt(exec, args, 2), extractInt(exec, args, 3),extractInt(exec, args, 4), extractInt(exec, args, 5));
+ break;
+ }
+ case MethoddrawEllipse:
+ {
+ drawEllipse(extractInt(exec, args, 0), extractInt(exec, args, 1),extractInt(exec, args, 2), extractInt(exec, args, 3));
+ break;
+ }
+ case MethoddrawText:
+ {
+ drawText(extractInt(exec, args, 0), extractInt(exec, args, 1), extractQString(exec, args, 2));
+ break;
+ }
+ case MethoddrawArc:
+ {
+ drawArc(extractInt(exec, args, 0), extractInt(exec, args, 1),extractInt(exec, args, 2), extractInt(exec, args, 3),extractInt(exec, args, 4), extractInt(exec, args, 5));
+ break;
+ }
+ case MethoddrawPie:
+ {
+ drawPie(extractInt(exec, args, 0), extractInt(exec, args, 1),extractInt(exec, args, 2), extractInt(exec, args, 3),extractInt(exec, args, 4), extractInt(exec, args, 5));
+ break;
+ }
+ case MethoddrawPixmap:
+ {
+ drawPixmap(extractInt(exec, args, 0), extractInt(exec, args, 1), extractQPixmap(exec, args, 2), extractInt(exec, args, 3), extractInt(exec, args, 4), extractInt(exec, args, 5), extractInt(exec, args, 6));
+ break;
+ }
+ case MethoddrawImage:
+ {
+ drawImage( extractInt(exec, args, 0), extractInt(exec, args, 1), extractQImage(exec, args, 2), extractInt(exec, args, 3), extractInt(exec, args, 4), extractInt(exec, args, 5), extractInt(exec, args, 6), extractInt(exec, args, 7) );
+ break;
+ }
+ case MethoddrawTiledPixmap:
+ {
+ drawTiledPixmap(extractInt(exec, args, 0), extractInt(exec, args, 1), extractInt(exec, args, 2), extractInt(exec, args, 3), extractQPixmap(exec, args, 4), extractInt(exec, args, 5), extractInt(exec, args, 6));
+ break;
+ }
+ case Methodscale:
+ {
+ scale(extractDouble(exec, args, 0), extractDouble(exec, args, 1));
+ break;
+ }
+ case Methodshear:
+ {
+ shear(extractDouble(exec, args, 0), extractDouble(exec, args, 1));
+ break;
+ }
+ case Methodrotate:
+ {
+ rotate(extractDouble(exec, args, 0));
+ break;
+ }
+ case Methodtranslate:
+ {
+ translate(extractDouble(exec, args, 0), extractDouble(exec, args, 1));
+ break;
+ }
+ case MethodsetFont:
+ {
+ setFont(extractQFont(exec, args, 0));
+ break;
+ }
+ case Methodfont:
+ {
+ retValue = convertToValue(exec, font());
+ break;
+ }
+ case MethodsetBrush:
+ {
+ pr->painter()->setBrush(extractQBrush(exec, args, 0));
+ break;
+ }
+ case Methodbrush:
+ {
+ retValue = convertToValue(exec, brush());
+ break;
+ }
+ case MethodbackgroundColor:
+ {
+ retValue = convertToValue(exec, backgroundColor());
+ break;
+ }
+ case MethodsetBackgroundColor:
+ {
+ setBackgroundColor(extractQColor(exec, args, 0));
+ break;
+ }
+ default:
+ kdWarning() << "Painter has no method " << mid << endl;
+ break;
+ }
+
+ //op->setValue(pr, "Painter");
+ return retValue;
+}
+
+Painter::Painter( KJS::ExecState *exec, int id )
+ : JSProxyImp(exec), mid(id), pr(0)
+{
+}
+
+Painter::~Painter()
+{
+}
+
+bool Painter::begin()
+{
+ return pr->painter()->begin(pr->device());
+}
+bool Painter::begin(QPaintDevice *dev)
+{
+ return pr->painter()->begin(dev);
+}
+
+bool Painter::end()
+{
+ return pr->painter()->end();
+}
+
+QPixmap Painter::pixmap() const
+{
+ QPixmap *pix = dynamic_cast<QPixmap *>(pr->device());
+ if( pix )
+ {
+ return *pix;
+ }
+ return QPixmap();
+}
+
+void Painter::setPen( const QPen& pn )
+{
+ pr->painter()->setPen(pn);
+}
+
+QPen Painter::pen() const
+{
+ return pr->painter()->pen();
+}
+
+QRect Painter::textBox(const QString &text)
+{
+ QFontMetrics fnt = pr->painter()->fontMetrics();
+ return fnt.boundingRect(text);
+}
+
+void Painter::moveTo( int x, int y )
+{
+ pr->painter()->moveTo( x, y );
+}
+
+void Painter::lineTo( int x, int y )
+{
+ pr->painter()->lineTo( x, y );
+}
+
+void Painter::drawPoint( int x, int y )
+{
+ pr->painter()->drawPoint( x, y );
+}
+
+void Painter::drawLine( int x1, int y1, int x2, int y2 )
+{
+ pr->painter()->drawLine( x1, y1, x2, y2 );
+}
+
+void Painter::drawRect( int x, int y, int w, int h )
+{
+ pr->painter()->drawRect( x, y, w, h );
+}
+
+void Painter::drawRoundRect( int x, int y, int w, int h, int xrnd, int yrnd )
+{
+ pr->painter()->drawRoundRect( x, y, w, h, xrnd, yrnd );
+}
+
+void Painter::drawEllipse( int x, int y, int w, int h )
+{
+ pr->painter()->drawEllipse( x, y, w, h );
+}
+
+void Painter::drawText( int x, int y, const QString &txt )
+{
+ pr->painter()->drawText( x, y, txt );
+}
+
+void Painter::drawArc ( int x, int y, int w, int h, int a, int alen )
+{
+ pr->painter()->drawArc( x, y, w, h, a, alen );
+}
+void Painter::drawPie ( int x, int y, int w, int h, int a, int alen )
+{
+ pr->painter()->drawPie( x, y, w, h, a, alen);
+}
+void Painter::drawPixmap ( int x, int y, const QPixmap & pixmap, int sx, int sy, int sw, int sh )
+{
+ pr->painter()->drawPixmap( x, y, pixmap, sx, sy, sw, sh );
+}
+void Painter::drawImage ( int x, int y, const QImage &image, int sx , int sy, int sw , int sh, int conversionFlags)
+{
+ pr->painter()->drawImage( x, y, image, sx, sy, sw, sh, conversionFlags );
+}
+void Painter::drawTiledPixmap ( int x, int y, int w, int h, const QPixmap & pixmap, int sx, int sy )
+{
+ pr->painter()->drawTiledPixmap( x, y, w, h, pixmap, sx, sy );
+}
+
+void Painter::scale ( double sx, double sy )
+{
+ pr->painter()->scale( sx,sy );
+}
+void Painter::shear ( double sh, double sv )
+{
+ pr->painter()->shear( sh, sv );
+}
+void Painter::rotate ( double a )
+{
+ pr->painter()->rotate( a );
+}
+void Painter::translate ( double dx, double dy )
+{
+ pr->painter()->translate( dx, dy );
+}
+
+void KJSEmbed::Bindings::Painter::setFont( const QFont & font )
+{
+ pr->painter()->setFont(font);
+}
+
+QFont KJSEmbed::Bindings::Painter::font( ) const
+{
+ return pr->painter()->font();
+}
+
+QColor KJSEmbed::Bindings::Painter::backgroundColor( ) const
+{
+ return pr->painter()->backgroundColor();
+}
+
+void KJSEmbed::Bindings::Painter::setBackgroundColor( const QColor & color )
+{
+ pr->painter()->setBackgroundColor(color);
+}
+
+} // namespace Bindings
+} // namespace KJSEmbed
+
+
+void KJSEmbed::Bindings::Painter::setBrush( const QColor & brush )
+{
+ pr->painter()->setBrush(brush);
+}
+
+QColor KJSEmbed::Bindings::Painter::brush( ) const
+{
+ return pr->painter()->brush().color();
+}
+// Local Variables:
+// c-basic-offset: 4
+// End:
+
+
diff --git a/kjsembed/bindings/painter_imp.h b/kjsembed/bindings/painter_imp.h
new file mode 100644
index 00000000..0660a7ba
--- /dev/null
+++ b/kjsembed/bindings/painter_imp.h
@@ -0,0 +1,127 @@
+// -*- c++ -*-
+
+/*
+ * Copyright (C) 2003, Richard J. Moore <rich@kde.org>
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Library General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Library General Public License for more details.
+ *
+ * You should have received a copy of the GNU Library General Public License
+ * along with this library; see the file COPYING.LIB. If not, write to
+ * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
+ * Boston, MA 02110-1301, USA.
+ */
+
+#ifndef KJSEMBED_PAINTER_IMP_H
+#define KJSEMBED_PAINTER_IMP_H
+
+#include <kjsembed/jsbindingbase.h>
+#include <kjsembed/jsproxy_imp.h>
+#include <qpen.h>
+#include <qpainter.h>
+
+class QPixmap;
+
+namespace KJSEmbed {
+namespace Bindings {
+
+ class PainterLoader : public JSBindingBase
+ {
+ public:
+ KJS::Object createBinding(KJSEmbedPart *jspart, KJS::ExecState *exec, const KJS::List &args) const;
+ void addBindings( KJSEmbedPart *jspart, KJS::ExecState *exec, KJS::Object &proxy) const;
+ };
+
+
+class PainterRef
+{
+ public:
+ PainterRef();
+ ~PainterRef();
+
+ QPainter *painter();
+
+ QPaintDevice *device();
+ void setDevice(QPaintDevice *d);
+
+ void setCanDelete(bool can ) {m_canDelete = can;}
+ bool canDelete() const { return m_canDelete;}
+
+ private:
+ QPainter *m_painter;
+ QPaintDevice *m_device;
+ bool m_canDelete;
+};
+
+/**
+ * JSProxyImp binding for painting on a QPixmap.
+ *
+ * @author Richard Moore, rich@kde.org
+ */
+
+class Painter : public JSProxyImp
+{
+ /** Identifiers for the methods provided by this class. */
+ enum MethodId {Methodbegin, Methodend, Methodpixmap, MethodsetPixmap, MethodsetPen, Methodpen, MethodtextBox, MethodmoveTo, MethodlineTo, MethoddrawPoint, MethoddrawLine, MethoddrawRect, MethoddrawRoundRect, MethoddrawEllipse, MethoddrawText, MethoddrawArc, MethoddrawPie, MethoddrawPixmap, MethoddrawImage, MethoddrawTiledPixmap, Methodscale, Methodshear, Methodrotate, Methodtranslate, MethodsetFont, Methodfont, MethodsetBrush, Methodbrush, MethodbackgroundColor, MethodsetBackgroundColor};
+public:
+ Painter( KJS::ExecState *exec, int id );
+ virtual ~Painter();
+
+ static void addBindings( KJS::ExecState *exec, KJS::Object &object );
+
+ /** Returns true iff this object implements the call function. */
+ virtual bool implementsCall() const { return true; }
+
+ /** Invokes the call function. */
+ virtual KJS::Value call( KJS::ExecState *exec, KJS::Object &self, const KJS::List &args );
+private:
+
+ bool begin();
+ bool begin(QPaintDevice *dev);
+ bool end();
+ QPixmap pixmap() const;
+ void setPen( const QPen& pn);
+ QPen pen() const;
+ QRect textBox(const QString &text);
+ void moveTo( int x, int y );
+ void lineTo( int x, int y );
+ void drawPoint( int x, int y );
+ void drawLine( int x1, int y1, int x2, int y2 );
+ void drawRect( int x, int y, int w, int h );
+ void drawRoundRect( int x, int y, int w, int h, int, int);
+ void drawEllipse( int x, int y, int w, int h );
+ void drawText( int x, int y, const QString &txt );
+ void drawArc( int x, int y, int w, int h, int a, int alen );
+ void drawPie( int x, int y, int w, int h, int a, int alen );
+ void drawPixmap ( int x, int y, const QPixmap &pixmap, int sx, int sy, int sw, int sh );
+ void drawImage ( int x, int y, const QImage &image, int sx, int sy, int sw, int sh, int conversionFlags );
+ void drawTiledPixmap ( int x, int y, int w, int h, const QPixmap &pixmap, int sx, int sy);
+ void scale ( double sx, double sy );
+ void shear ( double sh, double sv );
+ void rotate ( double a );
+ void translate ( double dx, double dy );
+ void setFont( const QFont &font);
+ QFont font() const;
+ void setBrush( const QColor &brush );
+ QColor brush() const;
+ QColor backgroundColor() const;
+ void setBackgroundColor(const QColor &color);
+
+private:
+ int mid;
+ PainterRef *pr; // temps now
+
+};
+
+} // namespace Bindings
+} // namespace KJSEmbed
+
+#endif // KJSEMBED_PAINTER_IMP_H
+
diff --git a/kjsembed/bindings/pen_imp.cpp b/kjsembed/bindings/pen_imp.cpp
new file mode 100644
index 00000000..67ada965
--- /dev/null
+++ b/kjsembed/bindings/pen_imp.cpp
@@ -0,0 +1,127 @@
+// -*- c++ -*-
+
+/*
+ * Copyright (C) 2003, Richard J. Moore <rich@kde.org>
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Library General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Library General Public License for more details.
+ *
+ * You should have received a copy of the GNU Library General Public License
+ * along with this library; see the file COPYING.LIB. If not, write to
+ * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
+ * Boston, MA 02110-1301, USA.
+ */
+
+#include <qpainter.h>
+#include <qpixmap.h>
+#include <kjsembed/global.h>
+#include <qpen.h>
+#include "pen_imp.h"
+#include <kjsembed/jsvalueproxy.h>
+#include <kjsembed/jsbinding.h>
+
+namespace KJSEmbed {
+namespace Bindings {
+
+Pen::Pen( KJS::ExecState *exec, int id )
+ : JSProxyImp(exec), mid(id)
+{
+}
+
+Pen::~Pen()
+{
+}
+void Pen::addBindings( KJS::ExecState *exec, KJS::Object &object ) {
+
+ if( !JSProxy::checkType(object, JSProxy::ValueProxy, "QPen") ) return;
+
+ JSProxy::MethodTable methods[] = {
+ { Methodwidth, "width"},
+ { MethodsetWidth, "setWidth"},
+ { MethodColor, "color"},
+ { MethodsetColor, "setColor"},
+ { 0, 0 }
+ };
+
+ JSProxy::addMethods<Pen>(exec, methods, object );
+
+ JSProxy::EnumTable enums[] = {
+ // PenStyle
+ { "NoPen", 0 },
+ { "SolidLine", 1 },
+ { "DashLine", 2 },
+ { "DotLine", 3 },
+ { "DashDotLine", 4 },
+ { "DashDotDotLine", 5 },
+ { "MPenStyle", 6 },
+ // Pen Join Style
+ { "MiterJoin", 7 },
+ { "BevelJoin", 8 },
+ { "RoundJoin", 9 },
+ { "MPenJoinStyle", 10 },
+ // Pen Cap Style
+ { "FlatCap", 11},
+ { "SquareCap", 12 },
+ { "RoundCap", 13 },
+ { "MPenCapStyle", 14},
+
+ { 0, 0 }
+ };
+
+ JSProxy::addEnums(exec, enums, object);
+}
+
+KJS::Value Pen::call( KJS::ExecState *exec, KJS::Object &self, const KJS::List &args ) {
+
+ if( !JSProxy::checkType(self, JSProxy::ValueProxy, "QPen") ) return KJS::Value();
+ JSValueProxy *op = JSProxy::toValueProxy( self.imp() );
+ QPen pen = op->toVariant().toPen();
+
+ KJS::Value retValue = KJS::Value();
+ switch ( mid ) {
+ case Methodwidth:
+ {
+ return KJS::Number((int) pen.width() );
+ break;
+ }
+ case MethodsetWidth:
+ {
+ uint w = extractUInt(exec, args, 0);
+ pen.setWidth(w);
+ break;
+ }
+ case MethodColor:
+ {
+ return convertToValue(exec, pen.color());
+ break;
+ }
+ case MethodsetColor:
+ {
+ QColor color = extractQColor(exec, args, 0);
+ pen.setColor(color);
+ break;
+ }
+ default:
+ kdWarning() << "Pen has no method " << mid << endl;
+ break;
+ }
+
+ op->setValue(pen);
+ return retValue;
+}
+
+} // namespace Bindings
+} // namespace KJSEmbed
+
+// Local Variables:
+// c-basic-offset: 4
+// End:
+
+
diff --git a/kjsembed/bindings/pen_imp.h b/kjsembed/bindings/pen_imp.h
new file mode 100644
index 00000000..2068a6a5
--- /dev/null
+++ b/kjsembed/bindings/pen_imp.h
@@ -0,0 +1,57 @@
+// -*- c++ -*-
+
+/*
+ * Copyright (C) 2003, Richard J. Moore <rich@kde.org>
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Library General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Library General Public License for more details.
+ *
+ * You should have received a copy of the GNU Library General Public License
+ * along with this library; see the file COPYING.LIB. If not, write to
+ * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
+ * Boston, MA 02110-1301, USA.
+ */
+
+#ifndef KJSEMBED_PEN_IMP_H
+#define KJSEMBED_PEN_IMP_H
+
+#include <kjsembed/jsproxy_imp.h>
+
+
+namespace KJSEmbed {
+namespace Bindings {
+
+class Pen : public JSProxyImp
+{
+
+ /** Identifiers for the methods provided by this class. */
+ enum MethodId { Methodwidth, MethodsetWidth, MethodColor, MethodsetColor };
+public:
+ Pen( KJS::ExecState *exec, int id );
+ virtual ~Pen();
+
+ static void addBindings( KJS::ExecState *exec, KJS::Object &object );
+
+ /** Returns true iff this object implements the call function. */
+ virtual bool implementsCall() const { return true; }
+
+ /** Invokes the call function. */
+ virtual KJS::Value call( KJS::ExecState *exec, KJS::Object &self, const KJS::List &args );
+
+
+private:
+ int mid;
+};
+
+} // namespace Bindings
+} // namespace KJSEmbed
+
+#endif // KJSEMBED_PEN_IMP_H
+
diff --git a/kjsembed/bindings/pixmap_imp.cpp b/kjsembed/bindings/pixmap_imp.cpp
new file mode 100644
index 00000000..68e93658
--- /dev/null
+++ b/kjsembed/bindings/pixmap_imp.cpp
@@ -0,0 +1,180 @@
+// -*- c++ -*-
+
+/*
+ * Copyright (C) 2003, Richard J. Moore <rich@kde.org>
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Library General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Library General Public License for more details.
+ *
+ * You should have received a copy of the GNU Library General Public License
+ * along with this library; see the file COPYING.LIB. If not, write to
+ * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
+ * Boston, MA 02110-1301, USA.
+ */
+
+#include <qpixmap.h>
+#include <qbitmap.h>
+
+#include <kjsembed/global.h>
+#include <kjsembed/jsvalueproxy.h>
+#include <kjsembed/jsbinding.h>
+#include <qvariant.h>
+
+#include "pixmap_imp.h"
+
+namespace KJSEmbed {
+namespace Bindings {
+
+Pixmap::Pixmap( KJS::ExecState *exec, int id )
+ : JSProxyImp(exec), mid(id)
+{
+}
+
+Pixmap::~Pixmap()
+{
+}
+
+void Pixmap::addBindings( KJS::ExecState *exec, KJS::Object &object ) {
+
+ if( !JSProxy::checkType( object, JSProxy::ValueProxy, "QPixmap") )
+ return;
+
+ JSProxy::MethodTable methods[] = {
+ { MethodisNull, "isNull" },
+ { Methodwidth, "width" },
+ { Methodheight, "height" },
+ { Methodsize, "size" },
+ { Methodrect, "rect" },
+ { Methoddepth, "depth" },
+ { Methodresize, "resize" },
+ { Methodfill, "fill" },
+ { Methodmask, "mask" },
+ { MethodsetMask, "setMask" },
+ { MethodcreateHeuristicMask, "createHeuristicMask" },
+ { MethodgrabWindow, "grabWindow" },
+ { 0, 0 }
+ };
+
+ JSProxy::addMethods<Pixmap>(exec, methods, object);
+
+}
+
+KJS::Value Pixmap::call( KJS::ExecState *exec, KJS::Object &self, const KJS::List &args ) {
+
+ if( !JSProxy::checkType( self, JSProxy::ValueProxy, "QPixmap") )
+ return KJS::Value();
+
+ JSValueProxy *op = JSProxy::toValueProxy( self.imp() );
+ pix = op->toVariant().toPixmap();
+
+ KJS::Value retValue = KJS::Value();
+ switch ( mid ) {
+ case Methodwidth:
+ retValue = KJS::Number(width());
+ break;
+ case Methodheight:
+ retValue = KJS::Number(height());
+ break;
+ case Methoddepth:
+ retValue = KJS::Number(depth());
+ break;
+ case MethodisNull:
+ retValue = KJS::Boolean(isNull());
+ break;
+ case Methodsize:
+ retValue = convertToValue(exec, size());
+ break;
+ case Methodrect:
+ retValue = convertToValue(exec, rect());
+ break;
+ case Methodresize:
+ {
+ if( args.size() == 2)
+ resize(extractInt(exec, args, 0), extractInt(exec, args, 1));
+ else if( args.size() == 1)
+ resize(extractQSize(exec, args, 0) );
+ break;
+ }
+ case Methodfill:
+ fill( extractQColor(exec, args, 0));
+ break;
+ case Methodmask:
+ {
+ retValue = convertToValue(exec, mask() );
+ break;
+ }
+ case MethodsetMask:
+ {
+ setMask(extractQPixmap(exec, args, 0));
+ break;
+ }
+ case MethodcreateHeuristicMask:
+ {
+ retValue = convertToValue(exec, createHeuristicMask(extractBool(exec, args, 0)));
+ break;
+ }
+ case MethodgrabWindow:
+ {
+ int winid = extractInt(exec, args,0);
+ int x = extractInt(exec, args,1);
+ int y = extractInt(exec, args,2);
+ int w = extractInt(exec, args,3);
+ int h = extractInt(exec, args,4);
+ grabWindow(winid,x,y,w,h);
+ break;
+ }
+ default:
+ kdWarning() << "Image has no method " << mid << endl;
+ break;
+ }
+
+ op->setValue(pix);
+ return retValue;
+}
+
+void Pixmap::resize( int w, int h )
+{
+ pix.resize( w, h );
+}
+
+void Pixmap::resize( const QSize &size )
+{
+ pix.resize( size );
+}
+
+void Pixmap::fill( const QColor &c )
+{
+ pix.fill( c );
+}
+
+void Pixmap::grabWindow(int winID, int x, int y, int w, int h)
+{
+ pix = QPixmap::grabWindow((WId)winID, x, y, w, h);
+}
+
+QPixmap Pixmap::mask()
+{
+ return *(pix.mask());
+}
+void Pixmap::setMask(const QPixmap& mask)
+{
+ QBitmap bm;
+ bm = mask;
+ pix.setMask(bm);
+}
+
+QPixmap Pixmap::createHeuristicMask ( bool clipTight )
+{
+ return (QPixmap)pix.createHeuristicMask(clipTight);
+}
+
+} // namespace KJSEmbed::Bindings
+} // namespace KJSEmbed
+
diff --git a/kjsembed/bindings/pixmap_imp.h b/kjsembed/bindings/pixmap_imp.h
new file mode 100644
index 00000000..994c2699
--- /dev/null
+++ b/kjsembed/bindings/pixmap_imp.h
@@ -0,0 +1,87 @@
+// -*- c++ -*-
+
+/*
+ * Copyright (C) 2003, Richard J. Moore <rich@kde.org>
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Library General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Library General Public License for more details.
+ *
+ * You should have received a copy of the GNU Library General Public License
+ * along with this library; see the file COPYING.LIB. If not, write to
+ * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
+ * Boston, MA 02110-1301, USA.
+ */
+
+#ifndef KJSEMBED_PIXMAP_IMP_H
+#define KJSEMBED_PIXMAP_IMP_H
+
+#include <kjsembed/jsobjectproxy_imp.h>
+
+#include <qpixmap.h>
+
+namespace KJSEmbed {
+namespace Bindings {
+
+/**
+ * QObject Binding for QPixmap.
+ *
+ * @author Richard Moore, rich@kde.org
+ * @version $Id$
+ */
+class Pixmap : public JSProxyImp
+{
+
+ /** Identifiers for the methods provided by this class. */
+ enum MethodId { MethodisNull, Methodwidth, Methodheight, Methodsize, Methodrect, Methoddepth, Methodresize, Methodfill, Methodmask, MethodsetMask, MethodcreateHeuristicMask, MethodgrabWindow };
+
+public:
+ Pixmap( KJS::ExecState *exec, int id );
+ virtual ~Pixmap();
+
+ static void addBindings( KJS::ExecState *exec, KJS::Object &object );
+
+ /** Returns true iff this object implements the call function. */
+ virtual bool implementsCall() const { return true; }
+
+ /** Invokes the call function. */
+ virtual KJS::Value call( KJS::ExecState *exec, KJS::Object &self, const KJS::List &args );
+
+
+
+private:
+ bool isNull() const { return pix.isNull(); }
+
+ int width() const { return pix.width(); }
+ int height() const { return pix.height(); }
+ QSize size() const { return pix.size(); }
+ QRect rect() const { return pix.rect(); }
+
+ int depth() const { return pix.depth(); }
+
+ void resize( int w, int h );
+ void resize( const QSize &size );
+ void fill( const QColor &color );
+
+ QPixmap mask();
+ void setMask(const QPixmap& mask);
+ QPixmap createHeuristicMask ( bool clipTight );
+
+ // Image Capture
+ void grabWindow(int winID, int x =0, int y = 0, int w = -1, int h = -1);
+
+private:
+ int mid;
+ QPixmap pix;
+};
+
+} // namespace
+} // namespace
+
+#endif // KJSEMBED_PIXMAP_IMP_H
diff --git a/kjsembed/bindings/point_imp.cpp b/kjsembed/bindings/point_imp.cpp
new file mode 100644
index 00000000..9eeb5c6a
--- /dev/null
+++ b/kjsembed/bindings/point_imp.cpp
@@ -0,0 +1,92 @@
+// -*- c++ -*-
+
+/*
+ * Copyright (C) 2004 Ian Reinhart Geiser <geiseri@kde.org>
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Library General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Library General Public License for more details.
+ *
+ * You should have received a copy of the GNU Library General Public License
+ * along with this library; see the file COPYING.LIB. If not, write to
+ * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
+ * Boston, MA 02110-1301, USA.
+ */
+
+#include <kjsembed/global.h>
+#include "point_imp.h"
+#include <qpoint.h>
+#include <kjsembed/jsvalueproxy.h>
+#include <kjsembed/jsbinding.h>
+
+namespace KJSEmbed {
+namespace Bindings {
+
+ Point::Point( KJS::ExecState *exec, int id )
+ : JSProxyImp(exec), mid(id)
+ {
+ }
+
+ Point::~Point()
+ {
+ }
+ void Point::addBindings( KJS::ExecState *exec, KJS::Object &object ) {
+
+ if( !JSProxy::checkType(object, JSProxy::ValueProxy, "QPoint") ) return;
+
+ JSProxy::MethodTable methods[] = {
+ { Methodx, "x"},
+ { MethodsetX, "setX"},
+ { Methody, "y"},
+ { MethodsetY, "setY"},
+ { MethodmanhattanLength, "manhattanLength"},
+ { 0, 0 }
+ };
+ JSProxy::addMethods<Point>(exec, methods, object);
+
+ }
+
+ KJS::Value Point::call( KJS::ExecState *exec, KJS::Object &self, const KJS::List &args ) {
+ if( !JSProxy::checkType(self, JSProxy::ValueProxy, "QPoint") ) return KJS::Value();
+ JSValueProxy *vp = JSProxy::toValueProxy( self.imp() );
+ KJS::Value retValue = KJS::Value();
+ QPoint val = vp->toVariant().toPoint();
+
+ switch ( mid ) {
+ case Methodx:
+ retValue = KJS::Number(val.x());
+ break;
+ case MethodsetX:
+ val.setX(extractInt(exec,args,0));
+ break;
+ case Methody:
+ retValue = KJS::Number(val.y());
+ break;
+ case MethodsetY:
+ val.setY(extractInt(exec,args,0));
+ break;
+ case MethodmanhattanLength:
+ retValue = KJS::Number(val.manhattanLength());
+ break;
+ default:
+ QString msg = i18n( "Point has no method %1" ).arg(mid);
+ return throwError(exec, msg);
+ break;
+ }
+
+ vp->setValue(val);
+ return retValue;
+ }
+
+} // namespace Bindings
+} // namespace KJSEmbed
+
+// Local Variables:
+// c-basic-offset: 4
+// End:
diff --git a/kjsembed/bindings/point_imp.h b/kjsembed/bindings/point_imp.h
new file mode 100644
index 00000000..950cce7d
--- /dev/null
+++ b/kjsembed/bindings/point_imp.h
@@ -0,0 +1,56 @@
+// -*- c++ -*-
+
+/*
+ * Copyright (C) 2004 Ian Reinhart Geiser <geiseri@kde.org>
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Library General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Library General Public License for more details.
+ *
+ * You should have received a copy of the GNU Library General Public License
+ * along with this library; see the file COPYING.LIB. If not, write to
+ * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
+ * Boston, MA 02110-1301, USA.
+ */
+
+#ifndef KJSEMBED_POINT_IMP_H
+#define KJSEMBED_POINT_IMP_H
+
+#include <kjsembed/jsproxy_imp.h>
+
+
+namespace KJSEmbed {
+namespace Bindings {
+
+ class Point : public JSProxyImp
+ {
+
+ /** Identifiers for the methods provided by this class. */
+ enum MethodId { Methodx, MethodsetX, Methody, MethodsetY, MethodmanhattanLength };
+ public:
+ Point( KJS::ExecState *exec, int id );
+ virtual ~Point();
+
+ static void addBindings( KJS::ExecState *exec, KJS::Object &object );
+
+ /** Returns true iff this object implements the call function. */
+ virtual bool implementsCall() const { return true; }
+
+ /** Invokes the call function. */
+ virtual KJS::Value call( KJS::ExecState *exec, KJS::Object &self, const KJS::List &args );
+
+
+ private:
+ int mid;
+ };
+
+} // namespace Bindings
+} // namespace KJSEmbed
+
+#endif // KJSEMBED_POINT_IMP_H
diff --git a/kjsembed/bindings/rect_imp.cpp b/kjsembed/bindings/rect_imp.cpp
new file mode 100644
index 00000000..82b5268b
--- /dev/null
+++ b/kjsembed/bindings/rect_imp.cpp
@@ -0,0 +1,111 @@
+// -*- c++ -*-
+
+/*
+ * Copyright (C) 2004 Ian Reinhart Geiser <geiseri@kde.org>
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Library General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Library General Public License for more details.
+ *
+ * You should have received a copy of the GNU Library General Public License
+ * along with this library; see the file COPYING.LIB. If not, write to
+ * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
+ * Boston, MA 02110-1301, USA.
+ */
+
+#include <kjsembed/global.h>
+#include "rect_imp.h"
+#include <qrect.h>
+#include <kjsembed/jsvalueproxy.h>
+#include <kjsembed/jsbinding.h>
+
+namespace KJSEmbed {
+namespace Bindings {
+
+ Rect::Rect( KJS::ExecState *exec, int id )
+ : JSProxyImp(exec), mid(id)
+ {
+ }
+
+ Rect::~Rect()
+ {
+ }
+ void Rect::addBindings( KJS::ExecState *exec, KJS::Object &object ) {
+
+ if( !JSProxy::checkType(object, JSProxy::ValueProxy, "QRect") ) return;
+
+ JSProxy::MethodTable methods[] = {
+ { Methodx, "x" },
+ { MethodsetX, "setX" },
+ { Methody, "y" },
+ { MethodsetY, "setY" },
+ { Methodheight, "height" },
+ { MethodsetHeight, "setHeight" },
+ { Methodwidth, "width" },
+ { MethodsetWidth,"setWidth" },
+ { Methodcontains,"contains" },
+ { 0, 0 }
+ };
+
+ JSProxy::addMethods<Rect>(exec, methods, object );
+
+ }
+
+ KJS::Value Rect::call( KJS::ExecState *exec, KJS::Object &self, const KJS::List &args ) {
+ if( !JSProxy::checkType(self, JSProxy::ValueProxy, "QRect") ) return KJS::Value();
+
+ KJS::Value retValue = KJS::Value();
+ JSValueProxy *vp = JSProxy::toValueProxy( self.imp() );
+
+ QRect val = vp->toVariant().toRect();
+
+ switch ( mid ) {
+ case Methodx:
+ retValue = KJS::Number(val.x());
+ break;
+ case MethodsetX:
+ val.setX(extractInt(exec, args, 0));
+ break;
+ case Methody:
+ retValue = KJS::Number(val.y());
+ break;
+ case MethodsetY:
+ val.setY(extractInt(exec, args, 0));
+ break;
+ case Methodheight:
+ retValue = KJS::Number(val.height());
+ break;
+ case MethodsetHeight:
+ val.setHeight(extractInt(exec, args, 0));
+ break;
+ case Methodwidth:
+ retValue = KJS::Number(val.width());
+ break;
+ case MethodsetWidth:
+ val.setWidth(extractInt(exec, args, 0));
+ break;
+ case Methodcontains:
+ retValue = convertToValue( exec, val.contains( extractQRect(exec, args, 0), extractBool(exec, args, 1)) );
+ break;
+ default:
+ QString msg = i18n( "Rect has no method %1" ).arg(mid);
+ return throwError(exec, msg);
+ break;
+ }
+
+ vp->setValue(val);
+ return retValue;
+ }
+
+} // namespace Bindings
+} // namespace KJSEmbed
+
+// Local Variables:
+// c-basic-offset: 4
+// End:
diff --git a/kjsembed/bindings/rect_imp.h b/kjsembed/bindings/rect_imp.h
new file mode 100644
index 00000000..16910e4e
--- /dev/null
+++ b/kjsembed/bindings/rect_imp.h
@@ -0,0 +1,56 @@
+// -*- c++ -*-
+
+/*
+ * Copyright (C) 2004 Ian Reinhart Geiser <geiseri@kde.org>
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Library General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Library General Public License for more details.
+ *
+ * You should have received a copy of the GNU Library General Public License
+ * along with this library; see the file COPYING.LIB. If not, write to
+ * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
+ * Boston, MA 02110-1301, USA.
+ */
+
+#ifndef KJSEMBED_RECT_IMP_H
+#define KJSEMBED_RECT_IMP_H
+
+#include <kjsembed/jsproxy_imp.h>
+
+
+namespace KJSEmbed {
+namespace Bindings {
+
+ class Rect : public JSProxyImp
+ {
+
+ /** Identifiers for the methods provided by this class. */
+ enum MethodId { Methodx, MethodsetX, Methody, MethodsetY, Methodheight, MethodsetHeight, Methodwidth, MethodsetWidth, Methodcontains };
+ public:
+ Rect( KJS::ExecState *exec, int id );
+ virtual ~Rect();
+
+ static void addBindings( KJS::ExecState *exec, KJS::Object &object );
+
+ /** Returns true iff this object implements the call function. */
+ virtual bool implementsCall() const { return true; }
+
+ /** Invokes the call function. */
+ virtual KJS::Value call( KJS::ExecState *exec, KJS::Object &self, const KJS::List &args );
+
+
+ private:
+ int mid;
+ };
+
+} // namespace Bindings
+} // namespace KJSEmbed
+
+#endif // KJSEMBED_RECT_IMP_H
diff --git a/kjsembed/bindings/size_imp.cpp b/kjsembed/bindings/size_imp.cpp
new file mode 100644
index 00000000..09c01427
--- /dev/null
+++ b/kjsembed/bindings/size_imp.cpp
@@ -0,0 +1,133 @@
+// -*- c++ -*-
+
+/*
+ * Copyright (C) 2004 Ian Reinhart Geiser <geiseri@kde.org>
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Library General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Library General Public License for more details.
+ *
+ * You should have received a copy of the GNU Library General Public License
+ * along with this library; see the file COPYING.LIB. If not, write to
+ * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
+ * Boston, MA 02110-1301, USA.
+ */
+
+#include <kjsembed/global.h>
+#include "size_imp.h"
+#include <qsize.h>
+#include <kjsembed/jsvalueproxy.h>
+#include <kjsembed/jsbinding.h>
+
+namespace KJSEmbed {
+namespace Bindings {
+
+Size::Size( KJS::ExecState *exec, int id )
+ : JSProxyImp(exec), mid(id)
+{
+}
+
+Size::~Size()
+{
+}
+void Size::addBindings( KJS::ExecState *exec, KJS::Object &object ) {
+
+ if( !JSProxy::checkType(object, JSProxy::ValueProxy, "QSize") ) return;
+
+ JSProxy::MethodTable methods[] = {
+ { Methodwidth, "width"},
+ { MethodsetWidth, "setWidth"},
+ { MethodHeight, "height"},
+ { MethodsetHeight, "setHeight"},
+ { Methodscale, "scale"},
+ { Methodtranspose, "transpose"},
+ { MethodexpandedTo, "expandedTo"},
+ { MethodboundedTo, "boundedTo"},
+ { 0, 0 }
+ };
+
+ JSProxy::addMethods<Size>(exec, methods, object );
+ //
+ // Define the enum constants
+ //
+
+ JSProxy::EnumTable enums[] = {
+ { "ScaleFree", (int)QSize::ScaleFree },
+ { "ScaleMin", (int)QSize::ScaleMin },
+ { "ScaleMax", (int)QSize::ScaleMax },
+ { 0, 0 }
+ };
+
+ JSProxy::addEnums(exec, enums, object);
+}
+
+KJS::Value Size::call( KJS::ExecState *exec, KJS::Object &self, const KJS::List &args ) {
+ if( !JSProxy::checkType(self, JSProxy::ValueProxy, "QSize") ) return KJS::Value();
+ KJS::Value retValue = KJS::Value();
+ JSValueProxy *vp = JSProxy::toValueProxy( self.imp() );
+ QSize val = vp->toVariant().toSize();
+
+ switch ( mid ) {
+ case Methodwidth:
+ retValue = KJS::Number(val.width());
+ break;
+ case MethodsetWidth:
+ val.setWidth(extractInt(exec,args,0));
+ break;
+ case MethodHeight:
+ retValue = KJS::Number(val.height());
+ break;
+ case MethodsetHeight:
+ val.setHeight(extractInt(exec,args,0));
+ break;
+ case Methodscale:
+ {
+ if( args.size() == 2 ) {
+ QSize sz = extractQSize(exec, args, 0);
+ int mode = extractInt(exec, args, 1);
+ val.scale(sz, (QSize::ScaleMode)mode);
+ } else {
+ int x = extractInt(exec, args, 0);
+ int y = extractInt(exec, args, 1);
+ int mode = extractInt(exec, args, 2);
+ val.scale(x,y, (QSize::ScaleMode)mode);
+ }
+ break;
+ }
+ case Methodtranspose:
+ val.transpose();
+ break;
+ case MethodexpandedTo:
+ {
+ QSize sz = extractQSize(exec, args, 0);
+ retValue = convertToValue( exec, val.expandedTo(sz) );
+ break;
+ }
+ case MethodboundedTo:
+ {
+ QSize sz = extractQSize(exec, args, 0);
+ retValue = convertToValue( exec, val.boundedTo(sz) );
+ break;
+ }
+ default:
+ QString msg = i18n( "Size has no method %1" ).arg(mid);
+ return throwError(exec, msg);
+ break;
+ }
+
+ vp->setValue(val);
+ return retValue;
+}
+
+} // namespace Bindings
+} // namespace KJSEmbed
+
+// Local Variables:
+// c-basic-offset: 4
+// End:
diff --git a/kjsembed/bindings/size_imp.h b/kjsembed/bindings/size_imp.h
new file mode 100644
index 00000000..9a1fb4eb
--- /dev/null
+++ b/kjsembed/bindings/size_imp.h
@@ -0,0 +1,56 @@
+// -*- c++ -*-
+
+/*
+ * Copyright (C) 2004 Ian Reinhart Geiser <geiseri@kde.org>
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Library General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Library General Public License for more details.
+ *
+ * You should have received a copy of the GNU Library General Public License
+ * along with this library; see the file COPYING.LIB. If not, write to
+ * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
+ * Boston, MA 02110-1301, USA.
+ */
+
+#ifndef KJSEMBED_SIZE_IMP_H
+#define KJSEMBED_SIZE_IMP_H
+
+#include <kjsembed/jsproxy_imp.h>
+
+
+namespace KJSEmbed {
+namespace Bindings {
+
+ class Size : public JSProxyImp
+ {
+
+ /** Identifiers for the methods provided by this class. */
+ enum MethodId { Methodwidth, MethodsetWidth, MethodHeight, MethodsetHeight, Methodscale, Methodtranspose, MethodexpandedTo, MethodboundedTo };
+ public:
+ Size( KJS::ExecState *exec, int id );
+ virtual ~Size();
+
+ static void addBindings( KJS::ExecState *exec, KJS::Object &object );
+
+ /** Returns true iff this object implements the call function. */
+ virtual bool implementsCall() const { return true; }
+
+ /** Invokes the call function. */
+ virtual KJS::Value call( KJS::ExecState *exec, KJS::Object &self, const KJS::List &args );
+
+
+ private:
+ int mid;
+ };
+
+} // namespace Bindings
+} // namespace KJSEmbed
+
+#endif // KJSEMBED_SIZE_IMP_H
diff --git a/kjsembed/bindings/sql_imp.cpp b/kjsembed/bindings/sql_imp.cpp
new file mode 100644
index 00000000..31c7f53c
--- /dev/null
+++ b/kjsembed/bindings/sql_imp.cpp
@@ -0,0 +1,310 @@
+// -*- c++ -*-
+
+/*
+ * Copyright (C) 2003, Ian Reinhart Geiser <geiseri@kde.org>
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Library General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Library General Public License for more details.
+ *
+ * You should have received a copy of the GNU Library General Public License
+ * along with this library; see the file COPYING.LIB. If not, write to
+ * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
+ * Boston, MA 02110-1301, USA.
+ */
+
+#include <kjsembed/global.h>
+#include <qsqldatabase.h>
+#include <qsqlquery.h>
+#include <qsqlerror.h>
+#include "sql_imp.h"
+
+
+
+namespace KJSEmbed {
+namespace Bindings {
+
+SqlDatabase::SqlDatabase( QObject *parent, const char *name): BindingObject(parent, name)
+{
+ connectionName = "defaultConnection";
+ setJSClassName( "SqlDatabase" );
+}
+SqlDatabase::~SqlDatabase()
+{
+ QSqlDatabase::removeDatabase(connectionName);
+}
+bool SqlDatabase::addDatabase ( const QString &type, const QString &conn )
+{
+ connectionName = conn;
+ QSqlDatabase *db = QSqlDatabase::addDatabase(type, connectionName);
+ if ( !db )
+ return false;
+ return true;
+}
+QStringList SqlDatabase::drivers ()
+{
+ return QSqlDatabase::drivers();
+}
+bool SqlDatabase::open ( )
+{
+ QSqlDatabase *db = QSqlDatabase::database(connectionName,false);
+ if ( db )
+ return db->open();
+ return false;
+}
+bool SqlDatabase::open ( const QString &user, const QString &password )
+{
+ QSqlDatabase *db = QSqlDatabase::database(connectionName,false);
+ if ( db )
+ return db->open(user, password);
+ return false;
+}
+void SqlDatabase::close ()
+{
+ QSqlDatabase *db = QSqlDatabase::database(connectionName,false);
+ if ( db )
+ {
+ db->close();
+ }
+}
+bool SqlDatabase::isOpen ()
+{
+ QSqlDatabase *db = QSqlDatabase::database(connectionName,false);
+ if ( db )
+ return db->isOpen();
+ return false;
+}
+bool SqlDatabase::isOpenError ()
+{
+ QSqlDatabase *db = QSqlDatabase::database(connectionName,false);
+ if ( db )
+ return db->isOpenError();
+ return true;
+}
+QStringList SqlDatabase::tables ()
+{
+ QSqlDatabase *db = QSqlDatabase::database(connectionName,false);
+ if ( db )
+ return db->tables();
+ return QStringList();
+}
+SqlQuery *SqlDatabase::exec (const QString &query )
+{
+ QSqlDatabase *db = QSqlDatabase::database(connectionName,false);
+ if ( db )
+ {
+ kdDebug() <<" exec query " << query << endl;
+ SqlQuery *qw = new SqlQuery(this, "query",db->exec( query ));
+ //JSFactory::instance()->addType( "SqlQuery" );
+ kdDebug() <<" size " << qw->size() << endl;
+ kdDebug() <<" valid " << qw->isValid() << endl;
+ return qw;
+ }
+ return 0L;
+}
+QString SqlDatabase::lastError () const
+{
+ QSqlDatabase *db = QSqlDatabase::database(connectionName,false);
+ if ( db )
+ {
+ return db->lastError().text();
+ }
+ return "No Database Driver Loaded";
+}
+bool SqlDatabase::transaction ()
+{
+ QSqlDatabase *db = QSqlDatabase::database(connectionName,false);
+ if ( db )
+ return db->transaction();
+ return false;
+}
+bool SqlDatabase::commit ()
+{
+ QSqlDatabase *db = QSqlDatabase::database(connectionName,false);
+ if ( db )
+ return db->commit();
+ return false;
+}
+bool SqlDatabase::rollback ()
+{
+ QSqlDatabase *db = QSqlDatabase::database(connectionName,false);
+ if ( db )
+ return db->rollback();
+ return false;
+}
+void SqlDatabase::setDatabaseName (const QString &name )
+{
+ QSqlDatabase *db = QSqlDatabase::database(connectionName,false);
+ if ( db )
+ db->setDatabaseName(name);
+}
+void SqlDatabase::setUserName (const QString &name )
+{
+ QSqlDatabase *db = QSqlDatabase::database(connectionName,false);
+ if ( db )
+ db->setUserName(name);
+}
+void SqlDatabase::setPassword (const QString &password )
+{
+ QSqlDatabase *db = QSqlDatabase::database(connectionName,false);
+ if ( db )
+ db->setPassword(password);
+}
+void SqlDatabase::setHostName (const QString &host )
+{
+ QSqlDatabase *db = QSqlDatabase::database(connectionName,false);
+ if ( db )
+ db->setHostName(host);
+}
+void SqlDatabase::setPort ( int p )
+{
+ QSqlDatabase *db = QSqlDatabase::database(connectionName,false);
+ if ( db )
+ db->setPort(p);
+}
+QString SqlDatabase::databaseName () const
+{
+ QSqlDatabase *db = QSqlDatabase::database(connectionName,false);
+ if ( db )
+ return db->databaseName();
+ return "";
+}
+QString SqlDatabase::userName () const
+{
+ QSqlDatabase *db = QSqlDatabase::database(connectionName,false);
+ if ( db )
+ return db->userName();
+ return "";
+}
+QString SqlDatabase::password () const
+{
+ QSqlDatabase *db = QSqlDatabase::database(connectionName,false);
+ if ( db )
+ return db->password();
+ return "";
+}
+QString SqlDatabase::hostName () const
+{
+ QSqlDatabase *db = QSqlDatabase::database(connectionName,false);
+ if ( db )
+ return db->hostName();
+ return "";
+}
+QString SqlDatabase::driverName () const
+{
+ QSqlDatabase *db = QSqlDatabase::database(connectionName,false);
+ if ( db )
+ return db->driverName();
+ return "";
+}
+int SqlDatabase::port () const
+{
+ QSqlDatabase *db = QSqlDatabase::database(connectionName,false);
+ if ( db )
+ return db->port();
+ return 0;
+}
+
+SqlQuery::SqlQuery( QObject *parent, const char *name ): BindingObject(parent, name)
+{
+ kdDebug() << "New null SQL Query" << endl;
+ m_query = QSqlQuery();
+ setJSClassName( "SqlQuery" );
+}
+SqlQuery::SqlQuery( QObject *parent, const char *name, const QSqlQuery &q ): BindingObject(parent, name)
+{
+ kdDebug() << "New SQL Query with argument" << endl;
+ m_query = q;
+}
+SqlQuery::~SqlQuery()
+{
+ kdDebug() << "SQL Query going away..." << endl;
+}
+
+/*SqlQuery::SqlQuery(const SqlQuery &copy) : BindingObject(copy.parent(), copy.name())
+{
+ m_query = copy.m_query;
+}
+*/
+bool SqlQuery::isValid () const
+{
+ if ( m_query.isValid())
+ kdDebug() << "Query is valid" << endl;
+ else
+ kdDebug() << "Query is not valid" << endl;
+ return m_query.isValid();
+}
+bool SqlQuery::isActive () const
+{
+ return m_query.isActive();
+}
+bool SqlQuery::isNull ( int field )
+{
+ return m_query.isNull(field);
+}
+int SqlQuery::at () const
+{
+ return m_query.at();
+}
+QString SqlQuery::lastQuery () const
+{
+ kdDebug() << "Last query error: " << m_query.lastQuery() << endl;
+ return m_query.lastQuery();
+}
+int SqlQuery::numRowsAffected () const
+{
+ return m_query.numRowsAffected();
+}
+QString SqlQuery::lastError () const
+{
+ return m_query.lastError().text();
+}
+bool SqlQuery::isSelect () const
+{
+ return m_query.isSelect();
+}
+int SqlQuery::size () const
+{
+ return m_query.size();
+}
+bool SqlQuery::exec ( const QString & query )
+{
+ return m_query.exec( query );
+}
+QVariant SqlQuery::value ( int i )
+{
+ return m_query.value(i);
+}
+bool SqlQuery::seek ( int i, bool relative )
+{
+ return m_query.seek(i,relative);
+}
+bool SqlQuery::next ()
+{
+ return m_query.next();
+}
+bool SqlQuery::prev ()
+{
+ return m_query.prev();
+}
+bool SqlQuery::first ()
+{
+ return m_query.first();
+}
+bool SqlQuery::last ()
+{
+ return m_query.last();
+}
+
+} // namespace KJSEmbed::Bindings
+} // namespace KJSEmbed
+
+#ifndef QT_ONLY
+#include "sql_imp.moc"
+#endif
diff --git a/kjsembed/bindings/sql_imp.h b/kjsembed/bindings/sql_imp.h
new file mode 100644
index 00000000..78e54756
--- /dev/null
+++ b/kjsembed/bindings/sql_imp.h
@@ -0,0 +1,141 @@
+/*
+ * Copyright (C) 2003, Ian Reinhart Geiser <geiseri@kde.org>
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Library General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Library General Public License for more details.
+ *
+ * You should have received a copy of the GNU Library General Public License
+ * along with this library; see the file COPYING.LIB. If not, write to
+ * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
+ * Boston, MA 02110-1301, USA.
+ */
+
+#ifndef KJSEMBED_SQL_IMP_H
+#define KJSEMBED_SQL_IMP_H
+
+#include "bindingobject.h"
+#include <qsqlquery.h>
+#include <qsqldatabase.h>
+
+namespace KJSEmbed {
+namespace Bindings {
+
+/**
+ * QObject Binding for QSQLQuery.
+ *
+ * @author Ian Reinhart Geiser, geiseri@kde.org
+ * @version $Id$
+ */
+class SqlQuery : public BindingObject
+{
+ Q_OBJECT
+ Q_PROPERTY( int size READ size)
+ Q_PROPERTY( int at READ at)
+ Q_PROPERTY( int numRowsAffected READ numRowsAffected )
+ Q_PROPERTY( bool select READ isSelect)
+ Q_PROPERTY( bool valid READ isValid)
+ Q_PROPERTY( bool active READ isActive)
+ Q_PROPERTY( QString lastError READ lastError)
+ Q_PROPERTY( QString lastQuery READ lastQuery)
+
+public:
+ SqlQuery( QObject *parent=0, const char *name=0 );
+ SqlQuery( QObject *parent, const char *name, const QSqlQuery &q );
+ //SqlQuery( const SqlQuery &copy);
+ virtual ~SqlQuery();
+
+ QSqlQuery query(){ return m_query; }
+ void setQuery(const QSqlQuery &q) {m_query = QSqlQuery(q); }
+
+ int size () const;
+ bool isSelect () const;
+ bool isValid () const;
+ bool isActive () const;
+ int at () const;
+ int numRowsAffected () const;
+ QString lastError () const;
+ QString lastQuery () const;
+
+public slots:
+
+
+
+ bool isNull ( int field );
+ bool exec ( const QString & m_query );
+ QVariant value ( int i );
+ bool seek ( int i, bool relative = FALSE );
+ bool next ();
+ bool prev ();
+ bool first ();
+ bool last ();
+
+private:
+ QSqlQuery m_query;
+};
+
+/**
+ * QObject Binding for QSQLDatabase.
+ *
+ * @author Ian Reinhart Geiser, geiseri@kde.org
+ * @version $Id$
+ */
+class SqlDatabase : public BindingObject
+{
+ Q_OBJECT
+ Q_PROPERTY( QString databaseName READ databaseName WRITE setDatabaseName)
+ Q_PROPERTY( QString userName READ userName WRITE setUserName)
+ Q_PROPERTY( QString password READ password WRITE setPassword)
+ Q_PROPERTY( QString hostName READ hostName WRITE setHostName)
+ Q_PROPERTY( int port READ port WRITE setPort)
+ Q_PROPERTY( QString driverName READ driverName)
+ Q_PROPERTY( QString lastError READ lastError)
+
+public:
+ SqlDatabase( QObject *parent=0, const char *name=0 );
+ virtual ~SqlDatabase();
+
+
+public slots:
+ void setDatabaseName (const QString &name );
+ void setUserName (const QString &name );
+ void setPassword (const QString &password );
+ void setHostName (const QString &host );
+ void setPort ( int p );
+ QString databaseName () const;
+ QString userName () const;
+ QString password () const;
+ QString hostName () const;
+ int port () const;
+ QString driverName () const;
+
+ bool addDatabase ( const QString & type, const QString & connectionName = QSqlDatabase::defaultConnection );
+ QStringList drivers ();
+ bool open ();
+ bool open ( const QString &user, const QString &password );
+ void close ();
+ bool isOpen ();
+ bool isOpenError ();
+ QStringList tables ();
+ SqlQuery *exec( const QString &query );
+ QString lastError () const;
+ bool transaction ();
+ bool commit ();
+ bool rollback ();
+
+private:
+ QString connectionName;
+ //QSqlDatabase *db;
+};
+
+
+} // namespace KJSEmbed::Bindings
+} // namespace KJSEmbed
+
+#endif // KJSEMBED_SQL_IMP_H
diff --git a/kjsembed/bindwizard/Doxyfile.in b/kjsembed/bindwizard/Doxyfile.in
new file mode 100644
index 00000000..291c78cd
--- /dev/null
+++ b/kjsembed/bindwizard/Doxyfile.in
@@ -0,0 +1,824 @@
+# Doxyfile 1.2.9.1
+
+# This file describes the settings to be used by the documentation system
+# doxygen (www.doxygen.org) for a project
+#
+# All text after a hash (#) is considered a comment and will be ignored
+# The format is:
+# TAG = value [value, ...]
+# For lists items can also be appended using:
+# TAG += value [value, ...]
+# Values that contain spaces should be placed between quotes (" ")
+
+#---------------------------------------------------------------------------
+# General configuration options
+#---------------------------------------------------------------------------
+
+# The PROJECT_NAME tag is a single word (or a sequence of words surrounded
+# by quotes) that should identify the project.
+
+PROJECT_NAME = __PLUGIN_NAME__
+
+# The PROJECT_NUMBER tag can be used to enter a project or revision number.
+# This could be handy for archiving the generated documentation or
+# if some version control system is used.
+
+PROJECT_NUMBER =
+
+# The OUTPUT_DIRECTORY tag is used to specify the (relative or absolute)
+# base path where the generated documentation will be put.
+# If a relative path is entered, it will be relative to the location
+# where doxygen was started. If left blank the current directory will be used.
+
+OUTPUT_DIRECTORY =
+
+# The OUTPUT_LANGUAGE tag is used to specify the language in which all
+# documentation generated by doxygen is written. Doxygen will use this
+# information to generate all constant output in the proper language.
+# The default language is English, other supported languages are:
+# Brazilian, Chinese, Croatian, Czech, Danish, Dutch, Finnish, French,
+# German, Hungarian, Italian, Japanese, Korean, Norwegian, Polish,
+# Portuguese, Romanian, Russian, Slovak, Slovene, Spanish and Swedish.
+
+OUTPUT_LANGUAGE = English
+
+# If the EXTRACT_ALL tag is set to YES doxygen will assume all entities in
+# documentation are documented, even if no documentation was available.
+# Private class members and static file members will be hidden unless
+# the EXTRACT_PRIVATE and EXTRACT_STATIC tags are set to YES
+
+EXTRACT_ALL = YES
+
+# If the EXTRACT_PRIVATE tag is set to YES all private members of a class
+# will be included in the documentation.
+
+EXTRACT_PRIVATE = NO
+
+# If the EXTRACT_STATIC tag is set to YES all static members of a file
+# will be included in the documentation.
+
+EXTRACT_STATIC = NO
+
+# If the HIDE_UNDOC_MEMBERS tag is set to YES, Doxygen will hide all
+# undocumented members of documented classes, files or namespaces.
+# If set to NO (the default) these members will be included in the
+# various overviews, but no documentation section is generated.
+# This option has no effect if EXTRACT_ALL is enabled.
+
+HIDE_UNDOC_MEMBERS = NO
+
+# If the HIDE_UNDOC_CLASSES tag is set to YES, Doxygen will hide all
+# undocumented classes that are normally visible in the class hierarchy.
+# If set to NO (the default) these class will be included in the various
+# overviews. This option has no effect if EXTRACT_ALL is enabled.
+
+HIDE_UNDOC_CLASSES = YES
+
+# If the BRIEF_MEMBER_DESC tag is set to YES (the default) Doxygen will
+# include brief member descriptions after the members that are listed in
+# the file and class documentation (similar to JavaDoc).
+# Set to NO to disable this.
+
+BRIEF_MEMBER_DESC = NO
+
+# If the REPEAT_BRIEF tag is set to YES (the default) Doxygen will prepend
+# the brief description of a member or function before the detailed description.
+# Note: if both HIDE_UNDOC_MEMBERS and BRIEF_MEMBER_DESC are set to NO, the
+# brief descriptions will be completely suppressed.
+
+REPEAT_BRIEF = YES
+
+# If the ALWAYS_DETAILED_SEC and REPEAT_BRIEF tags are both set to YES then
+# Doxygen will generate a detailed section even if there is only a brief
+# description.
+
+ALWAYS_DETAILED_SEC = NO
+
+# If the FULL_PATH_NAMES tag is set to YES then Doxygen will prepend the full
+# path before files name in the file list and in the header files. If set
+# to NO the shortest path that makes the file name unique will be used.
+
+FULL_PATH_NAMES = NO
+
+# If the FULL_PATH_NAMES tag is set to YES then the STRIP_FROM_PATH tag
+# can be used to strip a user defined part of the path. Stripping is
+# only done if one of the specified strings matches the left-hand part of
+# the path. It is allowed to use relative paths in the argument list.
+
+STRIP_FROM_PATH =
+
+# The INTERNAL_DOCS tag determines if documentation
+# that is typed after a \internal command is included. If the tag is set
+# to NO (the default) then the documentation will be excluded.
+# Set it to YES to include the internal documentation.
+
+INTERNAL_DOCS = NO
+
+# If the CLASS_DIAGRAMS tag is set to YES (the default) Doxygen will
+# generate a class diagram (in Html and LaTeX) for classes with base or
+# super classes. Setting the tag to NO turns the diagrams off.
+
+CLASS_DIAGRAMS = YES
+
+# If the SOURCE_BROWSER tag is set to YES then a list of source files will
+# be generated. Documented entities will be cross-referenced with these sources.
+
+SOURCE_BROWSER = NO
+
+# Setting the INLINE_SOURCES tag to YES will include the body
+# of functions and classes directly in the documentation.
+
+INLINE_SOURCES = NO
+
+# Setting the STRIP_CODE_COMMENTS tag to YES (the default) will instruct
+# doxygen to hide any special comment blocks from generated source code
+# fragments. Normal C and C++ comments will always remain visible.
+
+STRIP_CODE_COMMENTS = YES
+
+# If the CASE_SENSE_NAMES tag is set to NO then Doxygen will only generate
+# file names in lower case letters. If set to YES upper case letters are also
+# allowed. This is useful if you have classes or files whose names only differ
+# in case and if your file system supports case sensitive file names. Windows
+# users are adviced to set this option to NO.
+
+CASE_SENSE_NAMES = YES
+
+# If the SHORT_NAMES tag is set to YES, doxygen will generate much shorter
+# (but less readable) file names. This can be useful is your file systems
+# doesn't support long names like on DOS, Mac, or CD-ROM.
+
+SHORT_NAMES = NO
+
+# If the HIDE_SCOPE_NAMES tag is set to NO (the default) then Doxygen
+# will show members with their full class and namespace scopes in the
+# documentation. If set to YES the scope will be hidden.
+
+HIDE_SCOPE_NAMES = YES
+
+# If the VERBATIM_HEADERS tag is set to YES (the default) then Doxygen
+# will generate a verbatim copy of the header file for each class for
+# which an include is specified. Set to NO to disable this.
+
+VERBATIM_HEADERS = NO
+
+# If the SHOW_INCLUDE_FILES tag is set to YES (the default) then Doxygen
+# will put list of the files that are included by a file in the documentation
+# of that file.
+
+SHOW_INCLUDE_FILES = YES
+
+# If the JAVADOC_AUTOBRIEF tag is set to YES then Doxygen
+# will interpret the first line (until the first dot) of a JavaDoc-style
+# comment as the brief description. If set to NO, the JavaDoc
+# comments will behave just like the Qt-style comments (thus requiring an
+# explict @brief command for a brief description.
+
+JAVADOC_AUTOBRIEF = YES
+
+# If the INHERIT_DOCS tag is set to YES (the default) then an undocumented
+# member inherits the documentation from any documented member that it
+# reimplements.
+
+INHERIT_DOCS = YES
+
+# If the INLINE_INFO tag is set to YES (the default) then a tag [inline]
+# is inserted in the documentation for inline members.
+
+INLINE_INFO = YES
+
+# If the SORT_MEMBER_DOCS tag is set to YES (the default) then doxygen
+# will sort the (detailed) documentation of file and class members
+# alphabetically by member name. If set to NO the members will appear in
+# declaration order.
+
+SORT_MEMBER_DOCS = NO
+
+# If member grouping is used in the documentation and the DISTRIBUTE_GROUP_DOC
+# tag is set to YES, then doxygen will reuse the documentation of the first
+# member in the group (if any) for the other members of the group. By default
+# all members of a group must be documented explicitly.
+
+DISTRIBUTE_GROUP_DOC = NO
+
+# The TAB_SIZE tag can be used to set the number of spaces in a tab.
+# Doxygen uses this value to replace tabs by spaces in code fragments.
+
+TAB_SIZE = 8
+
+# The ENABLED_SECTIONS tag can be used to enable conditional
+# documentation sections, marked by \if sectionname ... \endif.
+
+ENABLED_SECTIONS =
+
+# The GENERATE_TODOLIST tag can be used to enable (YES) or
+# disable (NO) the todo list. This list is created by putting \todo
+# commands in the documentation.
+
+GENERATE_TODOLIST = YES
+
+# The GENERATE_TESTLIST tag can be used to enable (YES) or
+# disable (NO) the test list. This list is created by putting \test
+# commands in the documentation.
+
+GENERATE_TESTLIST = YES
+
+# The GENERATE_BUGLIST tag can be used to enable (YES) or
+# disable (NO) the bug list. This list is created by putting \bug
+# commands in the documentation.
+
+GENERATE_BUGLIST = YES
+
+# This tag can be used to specify a number of aliases that acts
+# as commands in the documentation. An alias has the form "name=value".
+# For example adding "sideeffect=\par Side Effects:\n" will allow you to
+# put the command \sideeffect (or @sideeffect) in the documentation, which
+# will result in a user defined paragraph with heading "Side Effects:".
+# You can put \n's in the value part of an alias to insert newlines.
+
+ALIASES =
+
+# The MAX_INITIALIZER_LINES tag determines the maximum number of lines
+# the initial value of a variable or define consist of for it to appear in
+# the documentation. If the initializer consists of more lines than specified
+# here it will be hidden. Use a value of 0 to hide initializers completely.
+# The appearance of the initializer of individual variables and defines in the
+# documentation can be controlled using \showinitializer or \hideinitializer
+# command in the documentation regardless of this setting.
+
+MAX_INITIALIZER_LINES = 30
+
+# Set the OPTIMIZE_OUTPUT_FOR_C tag to YES if your project consists of C sources
+# only. Doxygen will then generate output that is more tailored for C.
+# For instance some of the names that are used will be different. The list
+# of all members will be omitted, etc.
+
+OPTIMIZE_OUTPUT_FOR_C = NO
+
+# Set the SHOW_USED_FILES tag to NO to disable the list of files generated
+# at the bottom of the documentation of classes and structs. If set to YES the
+# list will mention the files that were used to generate the documentation.
+
+SHOW_USED_FILES = YES
+
+#---------------------------------------------------------------------------
+# configuration options related to warning and progress messages
+#---------------------------------------------------------------------------
+
+# The QUIET tag can be used to turn on/off the messages that are generated
+# by doxygen. Possible values are YES and NO. If left blank NO is used.
+
+QUIET = YES
+
+# The WARNINGS tag can be used to turn on/off the warning messages that are
+# generated by doxygen. Possible values are YES and NO. If left blank
+# NO is used.
+
+WARNINGS = YES
+
+# If WARN_IF_UNDOCUMENTED is set to YES, then doxygen will generate warnings
+# for undocumented members. If EXTRACT_ALL is set to YES then this flag will
+# automatically be disabled.
+
+WARN_IF_UNDOCUMENTED = NO
+
+# The WARN_FORMAT tag determines the format of the warning messages that
+# doxygen can produce. The string should contain the $file, $line, and $text
+# tags, which will be replaced by the file and line number from which the
+# warning originated and the warning text.
+
+WARN_FORMAT =
+
+# The WARN_LOGFILE tag can be used to specify a file to which warning
+# and error messages should be written. If left blank the output is written
+# to stderr.
+
+WARN_LOGFILE =
+
+#---------------------------------------------------------------------------
+# configuration options related to the input files
+#---------------------------------------------------------------------------
+
+# The INPUT tag can be used to specify the files and/or directories that contain
+# documented source files. You may enter file names like "myfile.cpp" or
+# directories like "/usr/src/myproject". Separate the files or directories
+# with spaces.
+
+INPUT = __HEADER_DIR__
+
+# If the value of the INPUT tag contains directories, you can use the
+# FILE_PATTERNS tag to specify one or more wildcard pattern (like *.cpp
+# and *.h) to filter out the source-files in the directories. If left
+# blank all files are included.
+
+FILE_PATTERNS = *.h
+
+# The RECURSIVE tag can be used to turn specify whether or not subdirectories
+# should be searched for input files as well. Possible values are YES and NO.
+# If left blank NO is used.
+
+RECURSIVE = NO
+
+# The EXCLUDE tag can be used to specify files and/or directories that should
+# excluded from the INPUT source files. This way you can easily exclude a
+# subdirectory from a directory tree whose root is specified with the INPUT tag.
+
+EXCLUDE = doxygen_fakes.h
+#EXCLUDE = customobject_imp.h jsfactory_imp.h jsproxy_imp.h \
+# kjsembedpart_imp.h jsbuiltin_imp.h \
+# jsobjectproxy_imp.h jsvalueproxy_imp.h \
+# doxygen_fakes.h
+
+# If the value of the INPUT tag contains directories, you can use the
+# EXCLUDE_PATTERNS tag to specify one or more wildcard patterns to exclude
+# certain files from those directories.
+
+EXCLUDE_PATTERNS = *.moc.*
+
+# The EXAMPLE_PATH tag can be used to specify one or more files or
+# directories that contain example code fragments that are included (see
+# the \include command).
+
+EXAMPLE_PATH =
+
+# If the value of the EXAMPLE_PATH tag contains directories, you can use the
+# EXAMPLE_PATTERNS tag to specify one or more wildcard pattern (like *.cpp
+# and *.h) to filter out the source-files in the directories. If left
+# blank all files are included.
+
+EXAMPLE_PATTERNS =
+
+# The IMAGE_PATH tag can be used to specify one or more files or
+# directories that contain image that are included in the documentation (see
+# the \image command).
+
+IMAGE_PATH =
+
+# The INPUT_FILTER tag can be used to specify a program that doxygen should
+# invoke to filter for each input file. Doxygen will invoke the filter program
+# by executing (via popen()) the command <filter> <input-file>, where <filter>
+# is the value of the INPUT_FILTER tag, and <input-file> is the name of an
+# input file. Doxygen will then use the output that the filter program writes
+# to standard output.
+
+INPUT_FILTER =
+
+# If the FILTER_SOURCE_FILES tag is set to YES, the input filter (if set using
+# INPUT_FILTER) will be used to filter the input files when producing source
+# files to browse.
+
+FILTER_SOURCE_FILES = NO
+
+#---------------------------------------------------------------------------
+# configuration options related to the alphabetical class index
+#---------------------------------------------------------------------------
+
+# If the ALPHABETICAL_INDEX tag is set to YES, an alphabetical index
+# of all compounds will be generated. Enable this if the project
+# contains a lot of classes, structs, unions or interfaces.
+
+ALPHABETICAL_INDEX = NO
+
+# If the alphabetical index is enabled (see ALPHABETICAL_INDEX) then
+# the COLS_IN_ALPHA_INDEX tag can be used to specify the number of columns
+# in which this list will be split (can be a number in the range [1..20])
+
+COLS_IN_ALPHA_INDEX = 5
+
+# In case all classes in a project start with a common prefix, all
+# classes will be put under the same header in the alphabetical index.
+# The IGNORE_PREFIX tag can be used to specify one or more prefixes that
+# should be ignored while generating the index headers.
+
+IGNORE_PREFIX = KJSEmbed
+
+#---------------------------------------------------------------------------
+# configuration options related to the HTML output
+#---------------------------------------------------------------------------
+
+# If the GENERATE_HTML tag is set to YES (the default) Doxygen will
+# generate HTML output.
+
+GENERATE_HTML = NO
+
+# The HTML_OUTPUT tag is used to specify where the HTML docs will be put.
+# If a relative path is entered the value of OUTPUT_DIRECTORY will be
+# put in front of it. If left blank `html' will be used as the default path.
+
+HTML_OUTPUT = .
+
+# The HTML_HEADER tag can be used to specify a personal HTML header for
+# each generated HTML page. If it is left blank doxygen will generate a
+# standard header.
+
+HTML_HEADER =
+
+# The HTML_FOOTER tag can be used to specify a personal HTML footer for
+# each generated HTML page. If it is left blank doxygen will generate a
+# standard footer.
+
+HTML_FOOTER =
+
+# The HTML_STYLESHEET tag can be used to specify a user defined cascading
+# style sheet that is used by each HTML page. It can be used to
+# fine-tune the look of the HTML output. If the tag is left blank doxygen
+# will generate a default style sheet
+
+HTML_STYLESHEET =
+
+# If the HTML_ALIGN_MEMBERS tag is set to YES, the members of classes,
+# files or namespaces will be aligned in HTML using tables. If set to
+# NO a bullet list will be used.
+
+HTML_ALIGN_MEMBERS = YES
+
+# If the GENERATE_HTMLHELP tag is set to YES, additional index files
+# will be generated that can be used as input for tools like the
+# Microsoft HTML help workshop to generate a compressed HTML help file (.chm)
+# of the generated HTML documentation.
+
+GENERATE_HTMLHELP = NO
+
+# If the GENERATE_HTMLHELP tag is set to YES, the GENERATE_CHI flag
+# controls if a separate .chi index file is generated (YES) or that
+# it should be included in the master .chm file (NO).
+
+GENERATE_CHI = NO
+
+# If the GENERATE_HTMLHELP tag is set to YES, the BINARY_TOC flag
+# controls whether a binary table of contents is generated (YES) or a
+# normal table of contents (NO) in the .chm file.
+
+BINARY_TOC = NO
+
+# The TOC_EXPAND flag can be set to YES to add extra items for group members
+# to the contents of the Html help documentation and to the tree view.
+
+TOC_EXPAND = NO
+
+# The DISABLE_INDEX tag can be used to turn on/off the condensed index at
+# top of each HTML page. The value NO (the default) enables the index and
+# the value YES disables it.
+
+DISABLE_INDEX = NO
+
+# This tag can be used to set the number of enum values (range [1..20])
+# that doxygen will group on one line in the generated HTML documentation.
+
+ENUM_VALUES_PER_LINE = 4
+
+# If the GENERATE_TREEVIEW tag is set to YES, a side panel will be
+# generated containing a tree-like index structure (just like the one that
+# is generated for HTML Help). For this to work a browser that supports
+# JavaScript and frames is required (for instance Netscape 4.0+
+# or Internet explorer 4.0+).
+
+GENERATE_TREEVIEW = NO
+
+# If the treeview is enabled (see GENERATE_TREEVIEW) then this tag can be
+# used to set the initial width (in pixels) of the frame in which the tree
+# is shown.
+
+TREEVIEW_WIDTH = 250
+
+#---------------------------------------------------------------------------
+# configuration options related to the LaTeX output
+#---------------------------------------------------------------------------
+
+# If the GENERATE_LATEX tag is set to YES (the default) Doxygen will
+# generate Latex output.
+
+GENERATE_LATEX = NO
+
+# The LATEX_OUTPUT tag is used to specify where the LaTeX docs will be put.
+# If a relative path is entered the value of OUTPUT_DIRECTORY will be
+# put in front of it. If left blank `latex' will be used as the default path.
+
+LATEX_OUTPUT =
+
+# If the COMPACT_LATEX tag is set to YES Doxygen generates more compact
+# LaTeX documents. This may be useful for small projects and may help to
+# save some trees in general.
+
+COMPACT_LATEX = NO
+
+# The PAPER_TYPE tag can be used to set the paper type that is used
+# by the printer. Possible values are: a4, a4wide, letter, legal and
+# executive. If left blank a4wide will be used.
+
+PAPER_TYPE = a4wide
+
+# The EXTRA_PACKAGES tag can be to specify one or more names of LaTeX
+# packages that should be included in the LaTeX output.
+
+EXTRA_PACKAGES =
+
+# The LATEX_HEADER tag can be used to specify a personal LaTeX header for
+# the generated latex document. The header should contain everything until
+# the first chapter. If it is left blank doxygen will generate a
+# standard header. Notice: only use this tag if you know what you are doing!
+
+LATEX_HEADER =
+
+# If the PDF_HYPERLINKS tag is set to YES, the LaTeX that is generated
+# is prepared for conversion to pdf (using ps2pdf). The pdf file will
+# contain links (just like the HTML output) instead of page references
+# This makes the output suitable for online browsing using a pdf viewer.
+
+PDF_HYPERLINKS = NO
+
+# If the USE_PDFLATEX tag is set to YES, pdflatex will be used instead of
+# plain latex in the generated Makefile. Set this option to YES to get a
+# higher quality PDF documentation.
+
+USE_PDFLATEX = NO
+
+# If the LATEX_BATCHMODE tag is set to YES, doxygen will add the \\batchmode.
+# command to the generated LaTeX files. This will instruct LaTeX to keep
+# running if errors occur, instead of asking the user for help.
+# This option is also used when generating formulas in HTML.
+
+LATEX_BATCHMODE = NO
+
+#---------------------------------------------------------------------------
+# configuration options related to the RTF output
+#---------------------------------------------------------------------------
+
+# If the GENERATE_RTF tag is set to YES Doxygen will generate RTF output
+# The RTF output is optimised for Word 97 and may not look very pretty with
+# other RTF readers or editors.
+
+GENERATE_RTF = NO
+
+# The RTF_OUTPUT tag is used to specify where the RTF docs will be put.
+# If a relative path is entered the value of OUTPUT_DIRECTORY will be
+# put in front of it. If left blank `rtf' will be used as the default path.
+
+RTF_OUTPUT =
+
+# If the COMPACT_RTF tag is set to YES Doxygen generates more compact
+# RTF documents. This may be useful for small projects and may help to
+# save some trees in general.
+
+COMPACT_RTF = NO
+
+# If the RTF_HYPERLINKS tag is set to YES, the RTF that is generated
+# will contain hyperlink fields. The RTF file will
+# contain links (just like the HTML output) instead of page references.
+# This makes the output suitable for online browsing using WORD or other
+# programs which support those fields.
+# Note: wordpad (write) and others do not support links.
+
+RTF_HYPERLINKS = NO
+
+# Load stylesheet definitions from file. Syntax is similar to doxygen's
+# config file, i.e. a series of assigments. You only have to provide
+# replacements, missing definitions are set to their default value.
+
+RTF_STYLESHEET_FILE =
+
+# Set optional variables used in the generation of an rtf document.
+# Syntax is similar to doxygen's config file.
+
+RTF_EXTENSIONS_FILE =
+
+#---------------------------------------------------------------------------
+# configuration options related to the man page output
+#---------------------------------------------------------------------------
+
+# If the GENERATE_MAN tag is set to YES (the default) Doxygen will
+# generate man pages
+
+GENERATE_MAN = NO
+
+# The MAN_OUTPUT tag is used to specify where the man pages will be put.
+# If a relative path is entered the value of OUTPUT_DIRECTORY will be
+# put in front of it. If left blank `man' will be used as the default path.
+
+MAN_OUTPUT =
+
+# The MAN_EXTENSION tag determines the extension that is added to
+# the generated man pages (default is the subroutine's section .3)
+
+MAN_EXTENSION =
+
+# If the MAN_LINKS tag is set to YES and Doxygen generates man output,
+# then it will generate one additional man file for each entity
+# documented in the real man page(s). These additional files
+# only source the real man page, but without them the man command
+# would be unable to find the correct page. The default is NO.
+
+MAN_LINKS = NO
+
+#---------------------------------------------------------------------------
+# configuration options related to the XML output
+#---------------------------------------------------------------------------
+
+# If the GENERATE_XML tag is set to YES Doxygen will
+# generate an XML file that captures the structure of
+# the code including all documentation. Note that this
+# feature is still experimental and incomplete at the
+# moment.
+
+GENERATE_XML = YES
+
+#---------------------------------------------------------------------------
+# Configuration options related to the preprocessor
+#---------------------------------------------------------------------------
+
+# If the ENABLE_PREPROCESSING tag is set to YES (the default) Doxygen will
+# evaluate all C-preprocessor directives found in the sources and include
+# files.
+
+ENABLE_PREPROCESSING = YES
+
+# If the MACRO_EXPANSION tag is set to YES Doxygen will expand all macro
+# names in the source code. If set to NO (the default) only conditional
+# compilation will be performed. Macro expansion can be done in a controlled
+# way by setting EXPAND_ONLY_PREDEF to YES.
+
+MACRO_EXPANSION = YES
+
+# If the EXPAND_ONLY_PREDEF and MACRO_EXPANSION tags are both set to YES
+# then the macro expansion is limited to the macros specified with the
+# PREDEFINED and EXPAND_AS_PREDEFINED tags.
+
+EXPAND_ONLY_PREDEF = YES
+
+# If the SEARCH_INCLUDES tag is set to YES (the default) the includes files
+# in the INCLUDE_PATH (see below) will be search if a #include is found.
+
+SEARCH_INCLUDES = YES
+
+# The INCLUDE_PATH tag can be used to specify one or more directories that
+# contain include files that are not input files but should be processed by
+# the preprocessor.
+
+INCLUDE_PATH =
+
+# You can use the INCLUDE_FILE_PATTERNS tag to specify one or more wildcard
+# patterns (like *.h and *.hpp) to filter out the header-files in the
+# directories. If left blank, the patterns specified with FILE_PATTERNS will
+# be used.
+
+INCLUDE_FILE_PATTERNS =
+
+# The PREDEFINED tag can be used to specify one or more macro names that
+# are defined before the preprocessor is started (similar to the -D option of
+# gcc). The argument of the tag is a list of macros of the form: name
+# or name=definition (no spaces). If the definition and the = are
+# omitted =1 is assumed.
+
+PREDEFINED = Q_PROPERTY()=
+
+# If the MACRO_EXPANSION and EXPAND_PREDEF_ONLY tags are set to YES then
+# this tag can be used to specify a list of macro names that should be expanded.
+# The macro definition that is found in the sources will be used.
+# Use the PREDEFINED tag if you want to use a different macro definition.
+
+EXPAND_AS_DEFINED =
+
+#---------------------------------------------------------------------------
+# Configuration::addtions related to external references
+#---------------------------------------------------------------------------
+
+# The TAGFILES tag can be used to specify one or more tagfiles.
+
+TAGFILES =
+
+# When a file name is specified after GENERATE_TAGFILE, doxygen will create
+# a tag file that is based on the input files it reads.
+
+GENERATE_TAGFILE =
+
+# If the ALLEXTERNALS tag is set to YES all external classes will be listed
+# in the class index. If set to NO only the inherited external classes
+# will be listed.
+
+ALLEXTERNALS = NO
+
+# The PERL_PATH should be the absolute path and name of the perl script
+# interpreter (i.e. the result of `which perl').
+
+PERL_PATH =
+
+#---------------------------------------------------------------------------
+# Configuration options related to the dot tool
+#---------------------------------------------------------------------------
+
+# If you set the HAVE_DOT tag to YES then doxygen will assume the dot tool is
+# available from the path. This tool is part of Graphviz, a graph visualization
+# toolkit from AT&T and Lucent Bell Labs. The other options in this section
+# have no effect if this option is set to NO (the default)
+
+HAVE_DOT = NO
+
+# If the CLASS_GRAPH and HAVE_DOT tags are set to YES then doxygen
+# will generate a graph for each documented class showing the direct and
+# indirect inheritance relations. Setting this tag to YES will force the
+# the CLASS_DIAGRAMS tag to NO.
+
+CLASS_GRAPH = YES
+
+# If the COLLABORATION_GRAPH and HAVE_DOT tags are set to YES then doxygen
+# will generate a graph for each documented class showing the direct and
+# indirect implementation dependencies (inheritance, containment, and
+# class references variables) of the class with other documented classes.
+
+COLLABORATION_GRAPH = YES
+
+# If the ENABLE_PREPROCESSING, SEARCH_INCLUDES, INCLUDE_GRAPH, and HAVE_DOT
+# tags are set to YES then doxygen will generate a graph for each documented
+# file showing the direct and indirect include dependencies of the file with
+# other documented files.
+
+INCLUDE_GRAPH = YES
+
+# If the ENABLE_PREPROCESSING, SEARCH_INCLUDES, INCLUDED_BY_GRAPH, and
+# HAVE_DOT tags are set to YES then doxygen will generate a graph for each
+# documented header file showing the documented files that directly or
+# indirectly include this file.
+
+INCLUDED_BY_GRAPH = YES
+
+# If the GRAPHICAL_HIERARCHY and HAVE_DOT tags are set to YES then doxygen
+# will graphical hierarchy of all classes instead of a textual one.
+
+GRAPHICAL_HIERARCHY = YES
+
+# The tag DOT_PATH can be used to specify the path where the dot tool can be
+# found. If left blank, it is assumed the dot tool can be found on the path.
+
+DOT_PATH =
+
+# The MAX_DOT_GRAPH_WIDTH tag can be used to set the maximum allowed width
+# (in pixels) of the graphs generated by dot. If a graph becomes larger than
+# this value, doxygen will try to truncate the graph, so that it fits within
+# the specified constraint. Beware that most browsers cannot cope with very
+# large images.
+
+MAX_DOT_GRAPH_WIDTH = 1024
+
+# The MAX_DOT_GRAPH_HEIGHT tag can be used to set the maximum allows height
+# (in pixels) of the graphs generated by dot. If a graph becomes larger than
+# this value, doxygen will try to truncate the graph, so that it fits within
+# the specified constraint. Beware that most browsers cannot cope with very
+# large images.
+
+MAX_DOT_GRAPH_HEIGHT = 1024
+
+# If the GENERATE_LEGEND tag is set to YES (the default) Doxygen will
+# generate a legend page explaining the meaning of the various boxes and
+# arrows in the dot generated graphs.
+
+GENERATE_LEGEND = YES
+
+# If the DOT_CLEANUP tag is set to YES (the default) Doxygen will
+# remove the intermedate dot files that are used to generate
+# the various graphs.
+
+DOT_CLEANUP = YES
+
+#---------------------------------------------------------------------------
+# Configuration::addtions related to the search engine
+#---------------------------------------------------------------------------
+
+# The SEARCHENGINE tag specifies whether or not a search engine should be
+# used. If set to NO the values of all tags below this one will be ignored.
+
+SEARCHENGINE = NO
+
+# The CGI_NAME tag should be the name of the CGI script that
+# starts the search engine (doxysearch) with the correct parameters.
+# A script with this name will be generated by doxygen.
+
+CGI_NAME =
+
+# The CGI_URL tag should be the absolute URL to the directory where the
+# cgi binaries are located. See the documentation of your http daemon for
+# details.
+
+CGI_URL =
+
+# The DOC_URL tag should be the absolute URL to the directory where the
+# documentation is located. If left blank the absolute path to the
+# documentation, with file:// prepended to it, will be used.
+
+DOC_URL =
+
+# The DOC_ABSPATH tag should be the absolute path to the directory where the
+# documentation is located. If left blank the directory on the local machine
+# will be used.
+
+DOC_ABSPATH =
+
+# The BIN_ABSPATH tag must point to the directory where the doxysearch binary
+# is installed.
+
+BIN_ABSPATH =
+
+# The EXT_DOC_PATHS tag can be used to specify one or more paths to
+# documentation generated for other projects. This allows doxysearch to search
+# the documentation for these projects as well.
+
+EXT_DOC_PATHS =
diff --git a/kjsembed/bindwizard/binding_wizard.js b/kjsembed/bindwizard/binding_wizard.js
new file mode 100755
index 00000000..7fb35679
--- /dev/null
+++ b/kjsembed/bindwizard/binding_wizard.js
@@ -0,0 +1,244 @@
+#!/usr/bin/env kjscmd
+
+//
+// Script for automatically generating bindings to C++ classes.
+//
+
+plugin_name = '';
+header_dir = '';
+output_dir = '';
+
+wiz = Factory.loadui( 'binding_wizard.ui' );
+
+classview = wiz.child('classes');
+classes = new Array();
+page = 0;
+output = new Array();
+
+imp = new BindingWizard();
+
+function BindingWizard()
+{
+ //
+ // Update the GUI view from the classview list.
+ //
+ this.update_classes = function() {
+ classview.clear();
+ for ( var i=0 ; i < classes.length ; i++ ) {
+ classview.insertItem( 'Yes', classes[i] );
+ }
+ }
+
+ //
+ // Selects all the classes.
+ //
+ this.select_all = function() {
+ classview.selectAll( true );
+ }
+
+ //
+ // Populate list views
+ //
+ this.choose_classes = function( view, name ) {
+
+ sax = new Object();
+ sax.chars = '';
+
+ sax.endElement = function( namespace, localname, qualifiedname ) {
+ if ( localname == 'class' ) {
+ classes[ classes.length ] = this.chars;
+ }
+ this.chars = '';
+ return true;
+ }
+
+ sax.characters = function( chars ) {
+ this.chars = chars;
+ return true;
+ }
+
+ try {
+ saxLoadFile( sax, name );
+ }
+ catch( theErr )
+ {
+ println(theErr);
+ }
+ }
+
+ //
+ // Creates the binding for the named class.
+ //
+ this.bind_class = function( clazz ) {
+
+ var out = "<b>Binding Class '" + clazz + "'...</b><pre>\n";
+
+ var outfile = output_dir + '/' + clazz.toLowerCase() + '_imp.h';
+ var cmd = 'xsltproc -o ' + outfile + ' doxygen2imp_h.xsl xml/class' + clazz + '.xml';
+
+ out += cmd + '\n';
+ out += shell( cmd );
+ output[ output.length ] = outfile;
+
+ outfile = output_dir + '/' + clazz.toLowerCase() + '_imp.cpp';
+ var cmd2 = 'xsltproc -o ' + outfile + ' doxygen2imp_cpp.xsl xml/class' + clazz + '.xml';
+
+ out += cmd2 + '\n';
+ out += shell( cmd2 );
+
+ out += '</pre>';
+
+ return out;
+ }
+
+ this.create_makefile = function() {
+
+ var sources = output.join(' ');
+ sources = sources.replace( /\w*\//g, '' );
+
+ var make = System.readFile( 'plugin_Makefile.in' );
+ make = make.replace( /__PLUGIN_NAME__/g, plugin_name );
+ make = make.replace( /__PLUGIN_NAME_LC__/g, plugin_name.toLowerCase() );
+ make = make.replace( /__PLUGIN_SOURCES__/g, sources );
+
+ System.writeFile( output_dir + '/' + 'Makefile.am', make );
+ }
+
+ //
+ // Called when the wizard has all the information it needs. This method
+ // binds the classes the user specified.
+ //
+ this.invoke = function() {
+
+ wiz.child('next').enabled = false;
+ wiz.child('output').clear();
+
+ for ( var i=0 ; i < classes.length ; i++ ) {
+ wiz.child('output').append( this.bind_class( classes[i] ) );
+ }
+
+ wiz.child('next').enabled = true;
+ }
+
+ this.browse_input = function() {
+ res = StdDialog.getExistingDirectory( '.' );
+ wiz.child('header_dir').text = res;
+ }
+
+ this.browse_output = function() {
+ res = StdDialog.getExistingDirectory( '.' );
+ wiz.child('output_dir').text = res;
+ }
+
+ //
+ // Lists the classes available for binding. In future, this will let you
+ // control which classes are processed.
+ //
+ this.list_classes = function() {
+
+ wiz.child('next').enabled = false;
+
+ // Create class index
+ var clazz = shell( 'xsltproc index_classes.xsl xml/index.xml' );
+ System.writeFile( 'classes.xml', clazz );
+
+ // Offer class selection
+ var classview = wiz.child('classes');
+ classview.selectionMode = 2 // Extended mode;
+ classview.resizeMode = 2;
+
+ this.choose_classes( classview, 'classes.xml' );
+ this.update_classes();
+
+ wiz.connect( wiz.child('select_all'), 'clicked()', this, 'select_all' );
+ wiz.child('next').enabled = true;
+ }
+
+ //
+ // Create the doxygen config
+ //
+ this.analyse = function() {
+
+ wiz.child('next').enabled = false;
+
+ led = wiz.child('analyse_led');
+ led.color = 'orange';
+
+ plugin_name = wiz.child('plugin_name').text;
+ header_dir = wiz.child('header_dir').text;
+ output_dir = wiz.child('output_dir').text;
+
+ // Create Doxygen config
+ var doxy = System.readFile( 'Doxyfile.in' );
+
+ doxy = doxy.replace( /__PLUGIN_NAME__/, plugin_name );
+ doxy = doxy.replace( /__HEADER_DIR__/, header_dir );
+
+ System.writeFile( 'Doxyfile', doxy );
+
+ // Run doxygen
+ shell( 'doxygen' );
+
+ wiz.child('analyse_led').color = 'green';
+ wiz.child('analyse_status').text = 'Done';
+
+ wiz.child('next').enabled = true;
+ }
+
+ this.view_results = function() {
+
+ this.create_makefile();
+
+ var lv = wiz.child('bindings');
+
+ for ( var i=0 ; i < output.length ; i++ ) {
+ lv.insertItem( output[i] );
+ }
+
+ wiz.child('finish').enabled = true;
+ }
+
+ //
+ // Called to setup the display of the next page.
+ //
+ this.do_next = function() {
+
+ try {
+ page++;
+
+ if ( page == 1 ) {
+ this.analyse();
+ }
+ else if ( page == 2 ) {
+ this.list_classes();
+ }
+ else if ( page == 3 ) {
+ this.invoke();
+ }
+ else if ( page == 4 ) {
+ this.view_results();
+ }
+ }
+ catch(err) {
+ warn( 'Error: ' + err );
+ }
+ }
+
+ this.do_back = function() {
+
+ page--;
+
+ }
+
+ wiz.connect( wiz.child('next'), 'clicked()', this, 'do_next' );
+ wiz.connect( wiz.child('back'), 'clicked()', this, 'do_back' );
+
+ //
+ // Connnect the first page
+ //
+ wiz.connect( wiz.child('browse_header'), 'clicked()', this, 'browse_input' );
+ wiz.connect( wiz.child('browse_output' ), 'clicked()', this, 'browse_output' );
+}
+
+wiz.show();
+application.exec();
diff --git a/kjsembed/bindwizard/binding_wizard.ui b/kjsembed/bindwizard/binding_wizard.ui
new file mode 100644
index 00000000..f6697bd3
--- /dev/null
+++ b/kjsembed/bindwizard/binding_wizard.ui
@@ -0,0 +1,490 @@
+<!DOCTYPE UI><UI version="3.2" stdsetdef="1">
+<class>binding_wizard</class>
+<widget class="QWizard">
+ <property name="name">
+ <cstring>binding_wizard</cstring>
+ </property>
+ <property name="geometry">
+ <rect>
+ <x>0</x>
+ <y>0</y>
+ <width>802</width>
+ <height>564</height>
+ </rect>
+ </property>
+ <property name="sizePolicy">
+ <sizepolicy>
+ <hsizetype>3</hsizetype>
+ <vsizetype>5</vsizetype>
+ <horstretch>0</horstretch>
+ <verstretch>0</verstretch>
+ </sizepolicy>
+ </property>
+ <property name="caption">
+ <string>KJSEmbed Binding Wizard</string>
+ </property>
+ <widget class="QWidget">
+ <property name="name">
+ <cstring>WizardPage</cstring>
+ </property>
+ <attribute name="title">
+ <string>Specify Target Information</string>
+ </attribute>
+ <grid>
+ <property name="name">
+ <cstring>unnamed</cstring>
+ </property>
+ <widget class="QLabel" row="0" column="0" rowspan="1" colspan="3">
+ <property name="name">
+ <cstring>textLabel1</cstring>
+ </property>
+ <property name="sizePolicy">
+ <sizepolicy>
+ <hsizetype>3</hsizetype>
+ <vsizetype>0</vsizetype>
+ <horstretch>0</horstretch>
+ <verstretch>0</verstretch>
+ </sizepolicy>
+ </property>
+ <property name="text">
+ <string>Please specify a name for your binding plugin, and the directory the header
+files of the C++ classes you want to make available to Javascript are located.</string>
+ </property>
+ </widget>
+ <spacer row="1" column="1">
+ <property name="name">
+ <cstring>spacer2</cstring>
+ </property>
+ <property name="orientation">
+ <enum>Vertical</enum>
+ </property>
+ <property name="sizeType">
+ <enum>Fixed</enum>
+ </property>
+ <property name="sizeHint">
+ <size>
+ <width>20</width>
+ <height>40</height>
+ </size>
+ </property>
+ </spacer>
+ <spacer row="5" column="1">
+ <property name="name">
+ <cstring>spacer1</cstring>
+ </property>
+ <property name="orientation">
+ <enum>Vertical</enum>
+ </property>
+ <property name="sizeType">
+ <enum>Expanding</enum>
+ </property>
+ <property name="sizeHint">
+ <size>
+ <width>20</width>
+ <height>50</height>
+ </size>
+ </property>
+ </spacer>
+ <widget class="QLabel" row="2" column="0">
+ <property name="name">
+ <cstring>textLabel3</cstring>
+ </property>
+ <property name="text">
+ <string>Header files:</string>
+ </property>
+ </widget>
+ <widget class="QLabel" row="3" column="0">
+ <property name="name">
+ <cstring>textLabel2</cstring>
+ </property>
+ <property name="text">
+ <string>Plugin name:</string>
+ </property>
+ </widget>
+ <widget class="QLabel" row="4" column="0">
+ <property name="name">
+ <cstring>textLabel2_2</cstring>
+ </property>
+ <property name="text">
+ <string>Output directory:</string>
+ </property>
+ </widget>
+ <widget class="KPushButton" row="2" column="2">
+ <property name="name">
+ <cstring>browse_header</cstring>
+ </property>
+ <property name="sizePolicy">
+ <sizepolicy>
+ <hsizetype>0</hsizetype>
+ <vsizetype>0</vsizetype>
+ <horstretch>0</horstretch>
+ <verstretch>0</verstretch>
+ </sizepolicy>
+ </property>
+ <property name="text">
+ <string>...</string>
+ </property>
+ </widget>
+ <widget class="KPushButton" row="4" column="2">
+ <property name="name">
+ <cstring>browse_output</cstring>
+ </property>
+ <property name="sizePolicy">
+ <sizepolicy>
+ <hsizetype>0</hsizetype>
+ <vsizetype>0</vsizetype>
+ <horstretch>0</horstretch>
+ <verstretch>0</verstretch>
+ </sizepolicy>
+ </property>
+ <property name="text">
+ <string>...</string>
+ </property>
+ </widget>
+ <widget class="KLineEdit" row="2" column="1">
+ <property name="name">
+ <cstring>header_dir</cstring>
+ </property>
+ <property name="sizePolicy">
+ <sizepolicy>
+ <hsizetype>1</hsizetype>
+ <vsizetype>0</vsizetype>
+ <horstretch>0</horstretch>
+ <verstretch>0</verstretch>
+ </sizepolicy>
+ </property>
+ <property name="text">
+ <string>input</string>
+ </property>
+ </widget>
+ <widget class="KLineEdit" row="3" column="1">
+ <property name="name">
+ <cstring>plugin_name</cstring>
+ </property>
+ <property name="sizePolicy">
+ <sizepolicy>
+ <hsizetype>3</hsizetype>
+ <vsizetype>0</vsizetype>
+ <horstretch>0</horstretch>
+ <verstretch>0</verstretch>
+ </sizepolicy>
+ </property>
+ </widget>
+ <widget class="KLineEdit" row="4" column="1">
+ <property name="name">
+ <cstring>output_dir</cstring>
+ </property>
+ <property name="sizePolicy">
+ <sizepolicy>
+ <hsizetype>3</hsizetype>
+ <vsizetype>0</vsizetype>
+ <horstretch>0</horstretch>
+ <verstretch>0</verstretch>
+ </sizepolicy>
+ </property>
+ <property name="text">
+ <string>output</string>
+ </property>
+ </widget>
+ </grid>
+ </widget>
+ <widget class="QWidget">
+ <property name="name">
+ <cstring>WizardPage</cstring>
+ </property>
+ <attribute name="title">
+ <string>Analysing Classes</string>
+ </attribute>
+ <grid>
+ <property name="name">
+ <cstring>unnamed</cstring>
+ </property>
+ <spacer row="0" column="0">
+ <property name="name">
+ <cstring>spacer4</cstring>
+ </property>
+ <property name="orientation">
+ <enum>Vertical</enum>
+ </property>
+ <property name="sizeType">
+ <enum>Expanding</enum>
+ </property>
+ <property name="sizeHint">
+ <size>
+ <width>20</width>
+ <height>191</height>
+ </size>
+ </property>
+ </spacer>
+ <spacer row="2" column="0">
+ <property name="name">
+ <cstring>spacer4_3</cstring>
+ </property>
+ <property name="orientation">
+ <enum>Vertical</enum>
+ </property>
+ <property name="sizeType">
+ <enum>Expanding</enum>
+ </property>
+ <property name="sizeHint">
+ <size>
+ <width>20</width>
+ <height>191</height>
+ </size>
+ </property>
+ </spacer>
+ <spacer row="2" column="1">
+ <property name="name">
+ <cstring>spacer4_4</cstring>
+ </property>
+ <property name="orientation">
+ <enum>Vertical</enum>
+ </property>
+ <property name="sizeType">
+ <enum>Expanding</enum>
+ </property>
+ <property name="sizeHint">
+ <size>
+ <width>20</width>
+ <height>191</height>
+ </size>
+ </property>
+ </spacer>
+ <widget class="QLabel" row="1" column="0">
+ <property name="name">
+ <cstring>analysing_label</cstring>
+ </property>
+ <property name="text">
+ <string>Analysing the classes available for binding...</string>
+ </property>
+ </widget>
+ <spacer row="0" column="1">
+ <property name="name">
+ <cstring>spacer4_2</cstring>
+ </property>
+ <property name="orientation">
+ <enum>Vertical</enum>
+ </property>
+ <property name="sizeType">
+ <enum>Expanding</enum>
+ </property>
+ <property name="sizeHint">
+ <size>
+ <width>20</width>
+ <height>191</height>
+ </size>
+ </property>
+ </spacer>
+ <widget class="QLayoutWidget" row="1" column="1">
+ <property name="name">
+ <cstring>layout1</cstring>
+ </property>
+ <hbox>
+ <property name="name">
+ <cstring>unnamed</cstring>
+ </property>
+ <widget class="KLed">
+ <property name="name">
+ <cstring>analyse_led</cstring>
+ </property>
+ <property name="sizePolicy">
+ <sizepolicy>
+ <hsizetype>0</hsizetype>
+ <vsizetype>0</vsizetype>
+ <horstretch>0</horstretch>
+ <verstretch>0</verstretch>
+ </sizepolicy>
+ </property>
+ </widget>
+ <widget class="QLabel">
+ <property name="name">
+ <cstring>analyse_status</cstring>
+ </property>
+ <property name="frameShape">
+ <enum>Box</enum>
+ </property>
+ <property name="text">
+ <string>Working</string>
+ </property>
+ <property name="alignment">
+ <set>AlignVCenter|AlignLeft</set>
+ </property>
+ </widget>
+ </hbox>
+ </widget>
+ </grid>
+ </widget>
+ <widget class="QWidget">
+ <property name="name">
+ <cstring>WizardPage</cstring>
+ </property>
+ <attribute name="title">
+ <string>Select Classes</string>
+ </attribute>
+ <grid>
+ <property name="name">
+ <cstring>unnamed</cstring>
+ </property>
+ <widget class="QLabel" row="0" column="0" rowspan="1" colspan="2">
+ <property name="name">
+ <cstring>textLabel6</cstring>
+ </property>
+ <property name="text">
+ <string>Select the classes that are to be made available to scripts.</string>
+ </property>
+ </widget>
+ <widget class="KPushButton" row="2" column="1">
+ <property name="name">
+ <cstring>select_all</cstring>
+ </property>
+ <property name="enabled">
+ <bool>false</bool>
+ </property>
+ <property name="text">
+ <string>Select &amp;All</string>
+ </property>
+ </widget>
+ <widget class="KListView" row="1" column="0" rowspan="1" colspan="2">
+ <column>
+ <property name="text">
+ <string>Scriptable</string>
+ </property>
+ <property name="clickable">
+ <bool>true</bool>
+ </property>
+ <property name="resizable">
+ <bool>false</bool>
+ </property>
+ </column>
+ <column>
+ <property name="text">
+ <string>Class Name</string>
+ </property>
+ <property name="clickable">
+ <bool>true</bool>
+ </property>
+ <property name="resizable">
+ <bool>false</bool>
+ </property>
+ </column>
+ <property name="name">
+ <cstring>classes</cstring>
+ </property>
+ <property name="resizeMode">
+ <enum>LastColumn</enum>
+ </property>
+ </widget>
+ <spacer row="2" column="0">
+ <property name="name">
+ <cstring>spacer8</cstring>
+ </property>
+ <property name="orientation">
+ <enum>Horizontal</enum>
+ </property>
+ <property name="sizeType">
+ <enum>Expanding</enum>
+ </property>
+ <property name="sizeHint">
+ <size>
+ <width>430</width>
+ <height>20</height>
+ </size>
+ </property>
+ </spacer>
+ </grid>
+ </widget>
+ <widget class="QWidget">
+ <property name="name">
+ <cstring>WizardPage</cstring>
+ </property>
+ <attribute name="title">
+ <string>Generate Bindings</string>
+ </attribute>
+ <grid>
+ <property name="name">
+ <cstring>unnamed</cstring>
+ </property>
+ <widget class="QTextEdit" row="0" column="0">
+ <property name="name">
+ <cstring>output</cstring>
+ </property>
+ <property name="font">
+ <font>
+ <family>Courier New</family>
+ <pointsize>8</pointsize>
+ </font>
+ </property>
+ <property name="readOnly">
+ <bool>true</bool>
+ </property>
+ <property name="undoRedoEnabled">
+ <bool>false</bool>
+ </property>
+ </widget>
+ </grid>
+ </widget>
+ <widget class="QWidget">
+ <property name="name">
+ <cstring>WizardPage</cstring>
+ </property>
+ <attribute name="title">
+ <string>Results</string>
+ </attribute>
+ <widget class="QLabel">
+ <property name="name">
+ <cstring>textLabel3_2</cstring>
+ </property>
+ <property name="geometry">
+ <rect>
+ <x>0</x>
+ <y>10</y>
+ <width>312</width>
+ <height>19</height>
+ </rect>
+ </property>
+ <property name="text">
+ <string>The following binding files have been created:</string>
+ </property>
+ </widget>
+ <widget class="KListView">
+ <column>
+ <property name="text">
+ <string>File Name</string>
+ </property>
+ <property name="clickable">
+ <bool>false</bool>
+ </property>
+ <property name="resizable">
+ <bool>false</bool>
+ </property>
+ </column>
+ <property name="name">
+ <cstring>bindings</cstring>
+ </property>
+ <property name="geometry">
+ <rect>
+ <x>10</x>
+ <y>40</y>
+ <width>700</width>
+ <height>430</height>
+ </rect>
+ </property>
+ <property name="resizeMode">
+ <enum>LastColumn</enum>
+ </property>
+ </widget>
+ </widget>
+</widget>
+<layoutdefaults spacing="6" margin="11"/>
+<includehints>
+ <includehint>kpushbutton.h</includehint>
+ <includehint>kpushbutton.h</includehint>
+ <includehint>klineedit.h</includehint>
+ <includehint>klineedit.h</includehint>
+ <includehint>klineedit.h</includehint>
+ <includehint>kled.h</includehint>
+ <includehint>kpushbutton.h</includehint>
+ <includehint>klistview.h</includehint>
+ <includehint>klistview.h</includehint>
+</includehints>
+</UI>
diff --git a/kjsembed/bindwizard/doxygen2imp_cpp.xsl b/kjsembed/bindwizard/doxygen2imp_cpp.xsl
new file mode 100644
index 00000000..c65b5650
--- /dev/null
+++ b/kjsembed/bindwizard/doxygen2imp_cpp.xsl
@@ -0,0 +1,560 @@
+<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
+<xsl:output method="text" />
+
+<xsl:template match="/doxygen/compounddef">
+
+<!-- Find the name of the class -->
+<xsl:variable name="clazz" select="compoundname" />
+
+<!-- Find the constructors and methods -->
+<xsl:variable name="consmeth" select="sectiondef/memberdef[@kind='function' and @prot='public']" />
+
+<!-- Find the enums -->
+<xsl:variable name="enums" select="sectiondef/memberdef[@kind='enum' and @prot='public']" />
+
+#include &lt;qcstring.h>
+#include &lt;qimage.h>
+#include &lt;qpainter.h>
+#include &lt;qpalette.h>
+#include &lt;qpixmap.h>
+#include &lt;qfont.h>
+
+#include &lt;kjs/object.h>
+
+#include &lt;kjsembed/global.h>
+#include &lt;kjsembed/jsobjectproxy.h>
+#include &lt;kjsembed/jsopaqueproxy.h>
+#include &lt;kjsembed/jsbinding.h>
+
+#include &lt;<xsl:value-of select="includes" />>
+#include "<xsl:value-of select="translate($clazz,'ABCDEFGHIJKLMNOPQRSTUVWXYZ','abcdefghijklmnopqrstuvwxyz')"/>_imp.h"
+
+/**
+ * Namespace containing the KJSEmbed library.
+ */
+namespace KJSEmbed {
+
+<xsl:value-of select="$clazz" />Imp::<xsl:value-of select="$clazz" />Imp( KJS::ExecState *exec, int mid, bool constructor )
+ : JSProxyImp(exec), id(mid), cons(constructor)
+{
+}
+
+<xsl:value-of select="$clazz" />Imp::~<xsl:value-of select="$clazz" />Imp()
+{
+}
+
+/**
+ * Adds bindings for static methods and enum constants to the specified Object.
+ */
+void <xsl:value-of select="$clazz" />Imp::addStaticBindings( KJS::ExecState *exec, KJS::Object &amp;object )
+{
+ JSProxy::MethodTable methods[] = {
+<xsl:for-each select="consmeth">
+ <xsl:variable name="method_name"><xsl:value-of select="name" />_<xsl:value-of select="position()" /></xsl:variable>
+ <xsl:variable name="method_id">Method_<xsl:value-of select="$method_name" /></xsl:variable>
+ <xsl:choose>
+ <xsl:when test="@static = 'yes'">
+ { <xsl:value-of select="$method_id" />, "<xsl:value-of select="name" />" },</xsl:when></xsl:choose>
+</xsl:for-each>
+ { 0, 0 }
+ };
+
+ int idx = 0;
+ QCString lastName;
+
+ while( methods[idx].name ) {
+ if ( lastName != methods[idx].name ) {
+ <xsl:value-of select="$clazz" />Imp *meth = new <xsl:value-of select="$clazz" />Imp( exec, methods[idx].id );
+ object.put( exec , methods[idx].name, KJS::Object(meth) );
+ lastName = methods[idx].name;
+ }
+ ++idx;
+ }
+
+<xsl:if test="count($enums) != 0">
+ //
+ // Define the enum constants
+ //
+ struct EnumValue {
+ const char *id;
+ int val;
+ };
+
+ EnumValue enums[] = {
+<xsl:for-each select="$enums">
+ // enum <xsl:value-of select="./name" />
+ <xsl:for-each select="./enumvalue">
+ { "<xsl:value-of select="./name" />", <xsl:value-of select="$clazz" />::<xsl:value-of select="./name" /> },</xsl:for-each>
+</xsl:for-each>
+ { 0, 0 }
+ };
+
+ int enumidx = 0;
+ while( enums[enumidx].id ) {
+ object.put( exec, enums[enumidx].id, KJS::Number(enums[enumidx].val), KJS::ReadOnly );
+ ++enumidx;
+ }
+</xsl:if>
+}
+
+/**
+ * Adds bindings for instance methods to the specified Object.
+ */
+void <xsl:value-of select="$clazz" />Imp::addBindings( KJS::ExecState *exec, KJS::Object &amp;object )
+{
+ JSProxy::MethodTable methods[] = {
+<xsl:for-each select="$consmeth">
+ <xsl:variable name="method_name"><xsl:value-of select="name" />_<xsl:value-of select="position()" /></xsl:variable>
+ <xsl:variable name="method_id">Method_<xsl:value-of select="$method_name" /></xsl:variable>
+ <xsl:choose>
+ <xsl:when test="not( @static = 'yes'
+ or starts-with( name, 'operator' )
+ or starts-with( name, '~' )
+ or starts-with( name, $clazz ))">
+ { <xsl:value-of select="$method_id" />, "<xsl:value-of select="name" />" },</xsl:when></xsl:choose>
+</xsl:for-each>
+ { 0, 0 }
+ };
+
+ int idx = 0;
+ QCString lastName;
+
+ while( methods[idx].name ) {
+ if ( lastName != methods[idx].name ) {
+ <xsl:value-of select="$clazz" />Imp *meth = new <xsl:value-of select="$clazz" />Imp( exec, methods[idx].id );
+ object.put( exec , methods[idx].name, KJS::Object(meth) );
+ lastName = methods[idx].name;
+ }
+ ++idx;
+ }
+}
+
+/**
+ * Extract a <xsl:value-of select="$clazz" /> pointer from an Object.
+ */
+<xsl:value-of select="$clazz" /> *<xsl:value-of select="$clazz" />Imp::to<xsl:value-of select="$clazz" />( KJS::Object &amp;self )
+{
+ JSObjectProxy *ob = JSProxy::toObjectProxy( self.imp() );
+ if ( ob ) {
+ QObject *obj = ob->object();
+ if ( obj )
+ return dynamic_cast&lt;<xsl:value-of select="$clazz" /> *>( obj );
+ }
+
+ JSOpaqueProxy *op = JSProxy::toOpaqueProxy( self.imp() );
+ if ( !op )
+ return 0;
+
+ if ( op->typeName() != "<xsl:value-of select="$clazz" />" )
+ return 0;
+
+ return (<xsl:value-of select="$clazz" /> *)( op->toVoidStar() );
+}
+
+/**
+ * Select and invoke the correct constructor.
+ */
+KJS::Object <xsl:value-of select="$clazz" />Imp::construct( KJS::ExecState *exec, const KJS::List &amp;args )
+{
+ switch( id ) {
+<xsl:for-each select="$consmeth">
+ <xsl:choose>
+ <xsl:when test="name = $clazz">
+ <xsl:variable name="cons_name"><xsl:value-of select="name" />_<xsl:value-of select="position()" /></xsl:variable>
+ <xsl:variable name="cons_id">Constructor_<xsl:value-of select="$cons_name" /></xsl:variable>
+ case <xsl:value-of select="$cons_id" />:
+ return <xsl:value-of select="$cons_name" />( exec, args );
+ break;
+ </xsl:when>
+ </xsl:choose>
+</xsl:for-each>
+ default:
+ break;
+ }
+
+ QString msg = i18n("<xsl:value-of select="$clazz" />Cons has no constructor with id '%1'").arg(id);
+ KJS::Object err = KJS::Error::create( exec, KJS::ReferenceError, msg.utf8() );
+ exec->setException( err );
+ return err;
+}
+
+<!-- Implementations of the constructors. -->
+<xsl:for-each select="$consmeth">
+ <xsl:choose>
+ <xsl:when test="(name = $clazz)">
+ <xsl:variable name="cons_name"><xsl:value-of select="name" />_<xsl:value-of select="position()" /></xsl:variable>
+ <xsl:variable name="cons_id">Constructor_<xsl:value-of select="$cons_name" /></xsl:variable>
+KJS::Object <xsl:value-of select="$clazz" />Imp::<xsl:value-of select="$cons_name" />( KJS::ExecState *exec, const KJS::List &amp;args )
+{
+ <xsl:if test="($clazz = 'QCanvasItem') or ($clazz = 'QCanvasPolygonalItem')">
+#if 0 // This constructor has been disabled by the XSL template
+ </xsl:if>
+
+ <xsl:for-each select="param/type">
+
+ <xsl:variable name="idx" select="position()-1" />
+
+ <xsl:choose>
+ <xsl:when test=". = 'QString'">
+ QString arg<xsl:value-of select="$idx" /> = extractQString(exec, args, <xsl:value-of select="$idx" />);
+ </xsl:when>
+ <xsl:when test=". = 'const QString &amp;'">
+ QString arg<xsl:value-of select="$idx" /> = extractQString(exec, args, <xsl:value-of select="$idx" />);
+ </xsl:when>
+ <xsl:when test=". = 'QString &amp;'">
+ QString arg<xsl:value-of select="$idx" /> = extractQString(exec, args, <xsl:value-of select="$idx" />);
+ </xsl:when>
+ <xsl:when test=". = 'const QCString &amp;'">
+ const QCString arg<xsl:value-of select="$idx" /> = (args.size() >= <xsl:value-of select="position()" />) ? args[<xsl:value-of select="$idx" />].toString(exec).ascii() : 0;
+ </xsl:when>
+ <xsl:when test=". = 'const char *'">
+ const char *arg<xsl:value-of select="$idx" /> = (args.size() >= <xsl:value-of select="position()" />) ? args[<xsl:value-of select="$idx" />].toString(exec).ascii() : 0;
+ </xsl:when>
+ <xsl:when test=". = 'int'">
+ int arg<xsl:value-of select="$idx" /> = extractInt(exec, args, <xsl:value-of select="$idx" />);
+ </xsl:when>
+ <xsl:when test=". = 'uint'">
+ uint arg<xsl:value-of select="$idx" /> = extractUInt(exec, args, <xsl:value-of select="$idx" />);
+ </xsl:when>
+ <xsl:when test=". = 'double'">
+ double arg<xsl:value-of select="$idx" /> = extractDouble(exec, args, <xsl:value-of select="$idx" />);
+ </xsl:when>
+ <xsl:when test=". = 'bool'">
+ bool arg<xsl:value-of select="$idx" /> = extractBool(exec, args, <xsl:value-of select="$idx" />);
+ </xsl:when>
+ <xsl:when test=". = 'const QFont &amp;'">
+ QFont arg<xsl:value-of select="$idx" /> = extractQFont(exec, args, <xsl:value-of select="$idx" />);
+ </xsl:when>
+ <xsl:when test=". = 'const QPalette &amp;'">
+ QPalette arg<xsl:value-of select="$idx" /> = extractQPalette(exec, args, <xsl:value-of select="$idx" />);
+ </xsl:when>
+ <xsl:when test=". = 'const QStringList &amp;'">
+ QStringList arg<xsl:value-of select="$idx" /> = extractQStringList(exec, args, <xsl:value-of select="$idx" />);
+ </xsl:when>
+ <xsl:when test=". = 'const QStrList &amp;'">
+ QStrList arg<xsl:value-of select="$idx" /> = extractQStrList(exec, args, <xsl:value-of select="$idx" />);
+ </xsl:when>
+ <xsl:when test=". = 'const QPoint &amp;'">
+ QPoint arg<xsl:value-of select="$idx" /> = extractQPoint(exec, args, <xsl:value-of select="$idx" />);
+ </xsl:when>
+ <xsl:when test=". = 'const QRect &amp;'">
+ QRect arg<xsl:value-of select="$idx" /> = extractQRect(exec, args, <xsl:value-of select="$idx" />);
+ </xsl:when>
+ <xsl:when test=". = 'const QSize &amp;'">
+ QSize arg<xsl:value-of select="$idx" /> = extractQSize(exec, args, <xsl:value-of select="$idx" />);
+ </xsl:when>
+ <xsl:when test=". = 'const QPixmap &amp;'">
+ QPixmap arg<xsl:value-of select="$idx" /> = extractQPixmap(exec, args, <xsl:value-of select="$idx" />);
+ </xsl:when>
+ <xsl:when test=". = 'const QImage &amp;'">
+ QImage arg<xsl:value-of select="$idx" /> = extractQImage(exec, args, <xsl:value-of select="$idx" />);
+ </xsl:when>
+ <xsl:when test=". = 'const QColor &amp;'">
+ QColor arg<xsl:value-of select="$idx" /> = extractQColor(exec, args, <xsl:value-of select="$idx" />);
+ </xsl:when>
+ <xsl:when test=". = 'const QDate &amp;'">
+ QDate arg<xsl:value-of select="$idx" /> = extractQDate(exec, args, <xsl:value-of select="$idx" />);
+ </xsl:when>
+ <xsl:when test=". = 'const QTime &amp;'">
+ QTime arg<xsl:value-of select="$idx" /> = extractQTime(exec, args, <xsl:value-of select="$idx" />);
+ </xsl:when>
+ <xsl:when test=". = 'const QDateTime &amp;'">
+ QDateTime arg<xsl:value-of select="$idx" /> = extractQDateTime(exec, args, <xsl:value-of select="$idx" />);
+ </xsl:when>
+
+ <xsl:when test=". = 'WFlags'">
+ Qt::WFlags arg<xsl:value-of select="$idx" />; // TODO (hack for QCanvasView)
+ </xsl:when>
+
+ <xsl:otherwise>
+ // Unsupported parameter <xsl:value-of select="." />
+ return KJS::Object();
+
+ <xsl:value-of select="." /> arg<xsl:value-of select="$idx" />; // Dummy
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:for-each>
+
+ // We should now create an instance of the <xsl:value-of select="$clazz" /> object
+
+ <xsl:value-of select="$clazz" /> *ret = new <xsl:value-of select="$clazz" />(
+ <xsl:for-each select="param">
+ arg<xsl:value-of select="position()-1" /><xsl:if test="position() != count(../param)">,</xsl:if>
+ </xsl:for-each> );
+
+ <xsl:if test="($clazz = 'QCanvasItem') or ($clazz = 'QCanvasPolygonalItem')">
+#endif // This constructor has been disabled by the XSL template
+ </xsl:if>
+}
+ </xsl:when>
+ </xsl:choose>
+</xsl:for-each>
+
+<!-- Select and invoke the correct method. -->
+KJS::Value <xsl:value-of select="$clazz" />Imp::call( KJS::ExecState *exec, KJS::Object &amp;self, const KJS::List &amp;args )
+{
+ instance = <xsl:value-of select="$clazz" />Imp::to<xsl:value-of select="$clazz" />( self );
+
+ switch( id ) {
+<xsl:for-each select="$consmeth">
+ <xsl:variable name="method_name"><xsl:value-of select="name" />_<xsl:value-of select="position()" /></xsl:variable>
+ <xsl:variable name="method_id">Method_<xsl:value-of select="$method_name" /></xsl:variable>
+ <xsl:choose>
+ <xsl:when test="not(starts-with( name, 'operator' ) or starts-with( name, '~' ) or starts-with( name, $clazz ))">
+ case <xsl:value-of select="$method_id" />:
+ return <xsl:value-of select="$method_name" />( exec, self, args );
+ break;
+ </xsl:when>
+ </xsl:choose>
+</xsl:for-each>
+ default:
+ break;
+ }
+
+ QString msg = i18n( "<xsl:value-of select="$clazz" />Imp has no method with id '%1'" ).arg( id );
+ KJS::Object err = KJS::Error::create( exec, KJS::ReferenceError, msg.utf8() );
+ exec->setException( err );
+ return err;
+}
+
+<!-- Create the implementation for each method. -->
+<xsl:for-each select="$consmeth">
+<xsl:variable name="method">
+<xsl:value-of select="$clazz" />Imp::<xsl:value-of select="name" />_<xsl:value-of select="position()" />
+</xsl:variable>
+
+ <xsl:choose>
+ <xsl:when test="(name != $clazz) and not(starts-with(name, 'operator') or starts-with(name, '~'))">
+<!-- Binding defined for a specific method. -->
+KJS::Value <xsl:value-of select="$method" />( KJS::ExecState *exec, KJS::Object &amp;obj, const KJS::List &amp;args )
+{
+ <xsl:for-each select="param/type">
+
+ <xsl:variable name="idx" select="position()-1" />
+
+ <xsl:choose>
+ <xsl:when test=". = 'QString'">
+ QString arg<xsl:value-of select="$idx" /> = extractQString(exec, args, <xsl:value-of select="$idx" />);
+ </xsl:when>
+ <xsl:when test=". = 'const QString &amp;'">
+ QString arg<xsl:value-of select="$idx" /> = extractQString(exec, args, <xsl:value-of select="$idx" />);
+ </xsl:when>
+ <xsl:when test=". = 'QString &amp;'">
+ QString arg<xsl:value-of select="$idx" /> = extractQString(exec, args, <xsl:value-of select="$idx" />);
+ </xsl:when>
+ <xsl:when test=". = 'const QCString &amp;'">
+ const QCString arg<xsl:value-of select="$idx" /> = (args.size() >= <xsl:value-of select="position()" />) ? args[<xsl:value-of select="$idx" />].toString(exec).ascii() : 0;
+ </xsl:when>
+ <xsl:when test=". = 'const char *'">
+ const char *arg<xsl:value-of select="$idx" /> = (args.size() >= <xsl:value-of select="position()" />) ? args[<xsl:value-of select="$idx" />].toString(exec).ascii() : 0;
+ </xsl:when>
+ <xsl:when test=". = 'int'">
+ int arg<xsl:value-of select="$idx" /> = extractInt(exec, args, <xsl:value-of select="$idx" />);
+ </xsl:when>
+ <xsl:when test=". = 'uint'">
+ uint arg<xsl:value-of select="$idx" /> = extractUInt(exec, args, <xsl:value-of select="$idx" />);
+ </xsl:when>
+ <xsl:when test=". = 'double'">
+ double arg<xsl:value-of select="$idx" /> = extractDouble(exec, args, <xsl:value-of select="$idx" />);
+ </xsl:when>
+ <xsl:when test=". = 'bool'">
+ bool arg<xsl:value-of select="$idx" /> = extractBool(exec, args, <xsl:value-of select="$idx" />);
+ </xsl:when>
+ <xsl:when test=". = 'const QFont &amp;'">
+ QFont arg<xsl:value-of select="$idx" /> = extractQFont(exec, args, <xsl:value-of select="$idx" />);
+ </xsl:when>
+ <xsl:when test=". = 'const QPalette &amp;'">
+ QPalette arg<xsl:value-of select="$idx" /> = extractQPalette(exec, args, <xsl:value-of select="$idx" />);
+ </xsl:when>
+ <xsl:when test=". = 'const QStringList &amp;'">
+ QStringList arg<xsl:value-of select="$idx" /> = extractQStringList(exec, args, <xsl:value-of select="$idx" />);
+ </xsl:when>
+ <xsl:when test=". = 'const QStrList &amp;'">
+ QStrList arg<xsl:value-of select="$idx" /> = extractQStrList(exec, args, <xsl:value-of select="$idx" />);
+ </xsl:when>
+ <xsl:when test=". = 'const QPoint &amp;'">
+ QPoint arg<xsl:value-of select="$idx" /> = extractQPoint(exec, args, <xsl:value-of select="$idx" />);
+ </xsl:when>
+ <xsl:when test=". = 'const QRect &amp;'">
+ QRect arg<xsl:value-of select="$idx" /> = extractQRect(exec, args, <xsl:value-of select="$idx" />);
+ </xsl:when>
+ <xsl:when test=". = 'const QSize &amp;'">
+ QSize arg<xsl:value-of select="$idx" /> = extractQSize(exec, args, <xsl:value-of select="$idx" />);
+ </xsl:when>
+ <xsl:when test=". = 'const QPixmap &amp;'">
+ QPixmap arg<xsl:value-of select="$idx" /> = extractQPixmap(exec, args, <xsl:value-of select="$idx" />);
+ </xsl:when>
+ <xsl:when test=". = 'const QImage &amp;'">
+ QImage arg<xsl:value-of select="$idx" /> = extractQImage(exec, args, <xsl:value-of select="$idx" />);
+ </xsl:when>
+ <xsl:when test=". = 'const QColor &amp;'">
+ QColor arg<xsl:value-of select="$idx" /> = extractQColor(exec, args, <xsl:value-of select="$idx" />);
+ </xsl:when>
+ <xsl:when test=". = 'const QDate &amp;'">
+ QDate arg<xsl:value-of select="$idx" /> = extractQDate(exec, args, <xsl:value-of select="$idx" />);
+ </xsl:when>
+ <xsl:when test=". = 'const QTime &amp;'">
+ QTime arg<xsl:value-of select="$idx" /> = extractQTime(exec, args, <xsl:value-of select="$idx" />);
+ </xsl:when>
+ <xsl:when test=". = 'const QDateTime &amp;'">
+ QDateTime arg<xsl:value-of select="$idx" /> = extractQDateTime(exec, args, <xsl:value-of select="$idx" />);
+ </xsl:when>
+
+ <!-- Hacks for enum types, this should be handled in a much cleaner way. -->
+
+ <xsl:when test=". = 'Policy'">
+ QComboBox::Policy arg<xsl:value-of select="$idx" />; // TODO (hack for combo box)
+ </xsl:when>
+ <xsl:when test=". = 'Shape'">
+ QFrame::Shape arg<xsl:value-of select="$idx" />; // TODO (hack for frame)
+ </xsl:when>
+ <xsl:when test=". = 'Shadow'">
+ QFrame::Shadow arg<xsl:value-of select="$idx" />; // TODO (hack for frame)
+ </xsl:when>
+ <xsl:when test=". = 'FILE *'">
+ FILE *arg<xsl:value-of select="$idx" />; // TODO (hack for qfile)
+ </xsl:when>
+ <xsl:when test=". = 'Offset'">
+ QFile::Offset arg<xsl:value-of select="$idx" />; // TODO (hack for qfile)
+ </xsl:when>
+ <xsl:when test=". = 'EncoderFn'">
+ QFile::EncoderFn arg<xsl:value-of select="$idx" />; // TODO (hack for qfile)
+ </xsl:when>
+ <xsl:when test=". = 'DecoderFn'">
+ QFile::DecoderFn arg<xsl:value-of select="$idx" />; // TODO (hack for qfile)
+ </xsl:when>
+ <xsl:when test=". = 'FrameAnimationType'">
+ QCanvasSprite::FrameAnimationType arg<xsl:value-of select="$idx" />; // TODO (hack for QCanvasSprite)
+ </xsl:when>
+ <xsl:when test=". = 'WFlags'">
+ Qt::WFlags arg<xsl:value-of select="$idx" />; // TODO (hack for QCanvasView)
+ </xsl:when>
+
+ <!-- Unsupported for now -->
+
+ <xsl:when test=". = 'const QByteArray &amp;'">
+ QByteArray arg<xsl:value-of select="$idx" />; // TODO (hack for qfile)
+ </xsl:when>
+ <xsl:when test=". = 'const QPointArray &amp;'">
+ QPointArray arg<xsl:value-of select="$idx" />; // TODO (hack for qcanvas)
+ </xsl:when>
+ <xsl:when test=". = 'QPainter &amp;'">
+ QPainter arg<xsl:value-of select="$idx" />; // TODO (hack for qcanvas)
+ </xsl:when>
+ <xsl:when test=". = 'const QPainter &amp;'">
+ QPainter arg<xsl:value-of select="$idx" />; // TODO (hack for qcanvas)
+ </xsl:when>
+ <xsl:when test=". = 'const QWMatrix &amp;'">
+ QWMatrix arg<xsl:value-of select="$idx" />; // TODO (hack for qcanvasview)
+ </xsl:when>
+
+ <xsl:otherwise>
+ // Unsupported parameter <xsl:value-of select="." />
+ return KJS::Value();
+
+ <xsl:value-of select="." /> arg<xsl:value-of select="$idx" />; // Dummy
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:for-each>
+
+ <!-- Specifies the return type -->
+ <xsl:variable name="rettype">
+ <xsl:choose>
+ <xsl:when test="starts-with(type,'virtual ')">
+ <xsl:value-of select="substring-after(type,'virtual ')" />
+ </xsl:when>
+ <xsl:otherwise><xsl:value-of select="type" /></xsl:otherwise>
+ </xsl:choose>
+ </xsl:variable>
+
+ <xsl:choose>
+
+ <xsl:when test="$rettype = 'bool'">
+ bool ret;
+ ret = instance-><xsl:value-of select="name" />( <xsl:for-each select="param">
+ arg<xsl:value-of select="position()-1" /><xsl:if test="position() != count(../param)">,</xsl:if></xsl:for-each> );
+ return KJS::Boolean( ret );
+ </xsl:when>
+
+ <xsl:when test="$rettype = 'int'">
+ int ret;
+ ret = instance-><xsl:value-of select="name" />( <xsl:for-each select="param">
+ arg<xsl:value-of select="position()-1" /><xsl:if test="position() != count(../param)">,</xsl:if></xsl:for-each> );
+ return KJS::Number( ret );
+ </xsl:when>
+
+ <xsl:when test="$rettype = 'uint'">
+ uint ret;
+ ret = instance-><xsl:value-of select="name" />( <xsl:for-each select="param">
+ arg<xsl:value-of select="position()-1" /><xsl:if test="position() != count(../param)">,</xsl:if></xsl:for-each> );
+ return KJS::Number( ret );
+ </xsl:when>
+
+ <xsl:when test="$rettype = 'double'">
+ double ret;
+ ret = instance-><xsl:value-of select="name" />( <xsl:for-each select="param">
+ arg<xsl:value-of select="position()-1" /><xsl:if test="position() != count(../param)">,</xsl:if></xsl:for-each> );
+ return KJS::Number( ret );
+ </xsl:when>
+
+ <xsl:when test="$rettype = 'QString'">
+ QString ret;
+ ret = instance-><xsl:value-of select="name" />( <xsl:for-each select="param">
+ arg<xsl:value-of select="position()-1" /><xsl:if test="position() != count(../param)">,</xsl:if></xsl:for-each> );
+ return KJS::String( ret );
+ </xsl:when>
+
+ <xsl:when test="$rettype = 'const char *'">
+ const char *ret;
+ ret = instance-><xsl:value-of select="name" />( <xsl:for-each select="param">
+ arg<xsl:value-of select="position()-1" /><xsl:if test="position() != count(../param)">,</xsl:if></xsl:for-each> );
+ return KJS::String( ret );
+ </xsl:when>
+
+ <!-- Value returns -->
+
+ <xsl:when test="($rettype = 'QRect') or ($rettype = 'QSize') or ($rettype = 'QPoint')
+ or ($rettype = 'QPixmap') or ($rettype = 'QImage') or ($rettype = 'QBrush')
+ or ($rettype = 'QPen') or ($rettype = 'QDate') or ($rettype = 'QDateTime')
+ or ($rettype = 'QTime')">
+ <xsl:value-of select="$rettype"/> ret;
+ ret = instance-><xsl:value-of select="name" />( <xsl:for-each select="param">
+ arg<xsl:value-of select="position()-1" /><xsl:if test="position() != count(../param)">,</xsl:if></xsl:for-each> );
+
+ return convertToValue( exec, ret );
+ </xsl:when>
+ <xsl:when test="$rettype = 'QStringList'">
+ QStringList ret;
+ ret = instance-><xsl:value-of select="name" />( <xsl:for-each select="param">
+ arg<xsl:value-of select="position()-1" /><xsl:if test="position() != count(../param)">,</xsl:if></xsl:for-each> );
+
+ return convertToValue( exec, ret );
+ </xsl:when>
+
+ <!-- Special returns -->
+
+ <xsl:when test="$rettype = 'void'">
+ instance-><xsl:value-of select="name" />( <xsl:for-each select="param">
+ arg<xsl:value-of select="position()-1" /><xsl:if test="position() != count(../param)">,</xsl:if></xsl:for-each> );
+ return KJS::Value(); // Returns void
+ </xsl:when>
+
+ <xsl:otherwise>
+ instance-><xsl:value-of select="name" />( <xsl:for-each select="param">
+ arg<xsl:value-of select="position()-1" /><xsl:if test="position() != count(../param)">,</xsl:if></xsl:for-each> );
+ return KJS::Value(); // Returns '<xsl:value-of select="$rettype" />'
+ </xsl:otherwise>
+ </xsl:choose>
+}
+ </xsl:when>
+ </xsl:choose>
+</xsl:for-each>
+
+} // namespace KJSEmbed
+
+// Local Variables:
+// c-basic-offset: 4
+// End:
+
+</xsl:template>
+</xsl:stylesheet>
diff --git a/kjsembed/bindwizard/doxygen2imp_h.xsl b/kjsembed/bindwizard/doxygen2imp_h.xsl
new file mode 100644
index 00000000..d5aaa8d2
--- /dev/null
+++ b/kjsembed/bindwizard/doxygen2imp_h.xsl
@@ -0,0 +1,128 @@
+<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
+<xsl:output method="text" />
+
+<xsl:template match="/doxygen/compounddef">
+
+<xsl:variable name="clazz" select="compoundname" />
+<xsl:variable name="consmeth" select="sectiondef/memberdef[@kind='function' and @prot='public']" />
+
+#ifndef KJSEMBED_<xsl:value-of select="$clazz" />_H
+#define KJSEMBED_<xsl:value-of select="$clazz" />_H
+
+#include &lt;kjs/interpreter.h&gt;
+#include &lt;kjs/object.h&gt;
+
+#include &lt;kjsembed/jsobjectproxy_imp.h&gt;
+
+class <xsl:value-of select="$clazz" />;
+
+/**
+ * Namespace containing the KJSEmbed library.
+ */
+namespace KJSEmbed {
+
+/**
+ * Wrapper class for <xsl:value-of select="$clazz" /> methods.
+ *
+ * @author Richard Moore, rich@kde.org
+ */
+class <xsl:value-of select="$clazz" />Imp : public JSProxyImp
+{
+public:
+ /** Enumerates the constructors supported by this class. */
+ enum Constructors {
+<xsl:for-each select="$consmeth">
+ <xsl:choose>
+ <xsl:when test="name = $clazz">
+ <xsl:variable name="cons_name"><xsl:value-of select="name" />_<xsl:value-of select="position()" /></xsl:variable>
+ <xsl:variable name="cons_id">Constructor_<xsl:value-of select="$cons_name" /></xsl:variable>
+ <xsl:text> </xsl:text><xsl:value-of select="$cons_id" />,
+</xsl:when>
+ </xsl:choose>
+</xsl:for-each>
+ LastConstuctor = -1
+ };
+
+ /** Enumerates the methods supported by this class. */
+ enum Methods {
+<xsl:for-each select="$consmeth">
+ <xsl:variable name="method_name"><xsl:value-of select="name" />_<xsl:value-of select="position()" /></xsl:variable>
+ <xsl:choose>
+ <xsl:when test="not(starts-with( name, 'operator' ) or starts-with( name, '~' ) or starts-with( name, $clazz ))">
+ Method_<xsl:value-of select="$method_name" />,</xsl:when>
+ </xsl:choose>
+</xsl:for-each>
+ Method_Last = -1
+ };
+
+ <xsl:value-of select="$clazz" />Imp( KJS::ExecState *exec, int id, bool constructor=false );
+ ~<xsl:value-of select="$clazz" />Imp();
+
+ /**
+ * Adds the static bindings for this class to the specified Object. The
+ * static bindings are the static methods and the enums of this class.
+ */
+ static void addStaticBindings( KJS::ExecState *exec, KJS::Object &amp;object );
+
+ /**
+ * Adds the bindings for this class to the specified Object. The bindings
+ * added are the instance methods of this class.
+ */
+ static void addBindings( KJS::ExecState *exec, KJS::Object &amp;object );
+
+ static <xsl:value-of select="$clazz" /> *to<xsl:value-of select="$clazz" />( KJS::Object &amp;object );
+
+ //
+ // Constructors implemented by this class.
+ //
+<xsl:for-each select="$consmeth">
+ <xsl:variable name="cons_name"><xsl:value-of select="name" />_<xsl:value-of select="position()" /></xsl:variable>
+ <xsl:choose>
+ <xsl:when test="name = $clazz">
+ KJS::Object <xsl:value-of select="$cons_name" />( KJS::ExecState *exec, const KJS::List &amp;args );</xsl:when>
+ </xsl:choose>
+</xsl:for-each>
+
+ //
+ // Methods implemented by this class.
+ //
+<xsl:for-each select="$consmeth">
+ <xsl:variable name="method_name"><xsl:value-of select="name" />_<xsl:value-of select="position()" /></xsl:variable>
+ <xsl:choose>
+ <xsl:when test="not(starts-with( name, 'operator' ) or starts-with( name, '~' ) or starts-with( name, $clazz ))">
+ KJS::Value <xsl:value-of select="$method_name" />( KJS::ExecState *exec, KJS::Object &amp;obj, const KJS::List &amp;args );</xsl:when>
+ </xsl:choose>
+</xsl:for-each>
+
+ //
+ // JS binding code.
+ //
+
+ /** Returns true iff this object implements the construct function. */
+ virtual bool implementsConstruct() const { return cons; }
+
+ /** Invokes the construct function. */
+ virtual KJS::Object construct( KJS::ExecState *exec, const KJS::List &amp;args );
+
+ /** Returns true iff this object implements the call function. */
+ virtual bool implementsCall() const { return !cons; }
+
+ /** Invokes the call function. */
+ virtual KJS::Value call( KJS::ExecState *exec, KJS::Object &amp;self, const KJS::List &amp;args );
+
+private:
+ <xsl:value-of select="$clazz" /> *instance; // Temp
+ int id;
+ bool cons;
+};
+
+} // namespace KJSEmbed
+
+#endif // KJSEMBED_<xsl:value-of select="compoundname" />_H
+
+// Local Variables:
+// c-basic-offset: 4
+// End:
+
+</xsl:template>
+</xsl:stylesheet>
diff --git a/kjsembed/bindwizard/index_classes.xsl b/kjsembed/bindwizard/index_classes.xsl
new file mode 100644
index 00000000..88309be6
--- /dev/null
+++ b/kjsembed/bindwizard/index_classes.xsl
@@ -0,0 +1,11 @@
+<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
+<xsl:output method="xml" />
+
+<xsl:template match="/doxygen">
+<classes>
+ <xsl:for-each select="compound[@kind='class']">
+ <class><xsl:value-of select="name/text()" /></class>
+ </xsl:for-each>
+</classes>
+</xsl:template>
+</xsl:stylesheet>
diff --git a/kjsembed/builtins/Makefile.am b/kjsembed/builtins/Makefile.am
new file mode 100644
index 00000000..d1b1ade9
--- /dev/null
+++ b/kjsembed/builtins/Makefile.am
@@ -0,0 +1,18 @@
+INCLUDES= -I$(srcdir)/../.. -I.. -I$(top_srcdir)/kjsembed $(all_includes)
+KDE_CXXFLAGS = -DQT_NO_ASCII_CAST -DQT_CLEAN_NAMESPACE -Wno-unused
+
+noinst_LTLIBRARIES = libkjsembedbuiltins.la
+
+libkjsembedbuiltins_la_SOURCES = stdaction_imp.cpp \
+ resources.cpp \
+ stddialog_imp.cpp \
+ saxhandler.cpp \
+ textstream_imp.cpp \
+ qdir_imp.cpp \
+ qfile_imp.cpp
+
+libkjsembedbuiltins_la_LDFLAGS = $(all_libraries) $(KDE_RPATH)
+libkjsembedbuiltins_la_LIBADD = $(LIB_QT) $(LIB_KDECORE) $(LIB_KDEUI) $(LIB_KPARTS) \
+ $(LIB_KFILE) -lkjs $(LIBSOCKET)
+
+libkjsembedbuiltins_la_METASOURCES = AUTO
diff --git a/kjsembed/builtins/builtins.pro b/kjsembed/builtins/builtins.pro
new file mode 100644
index 00000000..cb408cf2
--- /dev/null
+++ b/kjsembed/builtins/builtins.pro
@@ -0,0 +1,18 @@
+# File generated by kdevelop's qmake manager.
+# -------------------------------------------
+# Subdir relative project main directory: ./builtins
+# Target is a library:
+include(../qjsembed.pri)
+INCLUDEPATH += .. . ../..
+CONFIG += staticlib
+TEMPLATE = lib
+HEADERS += textstream_imp.h \
+ qdir_imp.h \
+ saxhandler.h \
+ stddialog_imp.h
+
+SOURCES += saxhandler.cpp \
+ qdir_imp.cpp \
+ stddialog_imp.cpp \
+ textstream_imp.cpp \
+ qfile_imp.cpp
diff --git a/kjsembed/builtins/qdir_imp.cpp b/kjsembed/builtins/qdir_imp.cpp
new file mode 100644
index 00000000..32d79d14
--- /dev/null
+++ b/kjsembed/builtins/qdir_imp.cpp
@@ -0,0 +1,1009 @@
+
+
+
+#include <kjsembed/global.h>
+
+#include <kjs/object.h>
+
+#ifndef QT_ONLY
+#include <klocale.h>
+#include <kdebug.h>
+#endif
+
+
+#include <kjsembed/jsopaqueproxy.h>
+#include <kjsembed/jsbinding.h>
+
+#include <qdir.h>
+#include "qdir_imp.h"
+
+/**
+ * Namespace containing the KJSEmbed library.
+ */
+namespace KJSEmbed {
+namespace Bindings {
+ KJS::Object QDirLoader::createBinding(KJSEmbedPart *jspart, KJS::ExecState *exec, const KJS::List &args) const
+ {
+ JSOpaqueProxy * prx;
+ if ( args.size() == 0 ) {
+ prx = new JSOpaqueProxy( new QDir( QDir::current() ), "QDir" );
+ } else {
+ QString arg0 = ( args.size() >= 1 ) ? args[ 0 ].toString( exec ).qstring() : QString::null;
+ prx = new JSOpaqueProxy( new QDir( arg0 ), "QDir" );
+ }
+ prx->setOwner( JSProxy::JavaScript );
+ KJS::Object proxyObj( prx );
+ addBindings( jspart, exec, proxyObj );
+ return proxyObj;
+ }
+
+ void QDirLoader::addBindings( KJSEmbedPart *jspart, KJS::ExecState *exec, KJS::Object &proxy ) const
+ {
+ QDirImp::addBindings( exec, proxy );
+ }
+
+}
+
+QDirImp::QDirImp( KJS::ExecState *exec, int id )
+ : JSProxyImp(exec), mid(id)
+{
+}
+
+QDirImp::~QDirImp()
+{
+}
+
+void QDirImp::addBindings( KJS::ExecState *exec, KJS::Object &object )
+{
+ JSProxy::MethodTable methods[] = {
+
+ { Method_setPath_7, "setPath" },
+
+ { Method_path_8, "path" },
+
+ { Method_absPath_9, "absPath" },
+
+ { Method_canonicalPath_10, "canonicalPath" },
+
+ { Method_dirName_11, "dirName" },
+
+ { Method_filePath_12, "filePath" },
+
+ { Method_absFilePath_13, "absFilePath" },
+
+ { Method_cd_14, "cd" },
+
+ { Method_cdUp_15, "cdUp" },
+
+ { Method_nameFilter_16, "nameFilter" },
+
+ { Method_setNameFilter_17, "setNameFilter" },
+
+ { Method_filter_18, "filter" },
+
+ { Method_setFilter_19, "setFilter" },
+
+ { Method_sorting_20, "sorting" },
+
+ { Method_setSorting_21, "setSorting" },
+
+ { Method_matchAllDirs_22, "matchAllDirs" },
+
+ { Method_setMatchAllDirs_23, "setMatchAllDirs" },
+
+ { Method_count_24, "count" },
+
+ { Method_encodedEntryList_26, "encodedEntryList" },
+
+ { Method_encodedEntryList_27, "encodedEntryList" },
+
+ { Method_entryList_28, "entryList" },
+
+ { Method_entryList_29, "entryList" },
+
+ { Method_entryInfoList_30, "entryInfoList" },
+
+ { Method_entryInfoList_31, "entryInfoList" },
+
+ { Method_mkdir_32, "mkdir" },
+
+ { Method_rmdir_33, "rmdir" },
+
+ { Method_isReadable_34, "isReadable" },
+
+ { Method_exists_35, "exists" },
+
+ { Method_isRoot_36, "isRoot" },
+
+ { Method_isRelative_37, "isRelative" },
+
+ { Method_convertToAbs_38, "convertToAbs" },
+
+ { Method_remove_41, "remove" },
+
+ { Method_rename_42, "rename" },
+
+ { Method_exists_43, "exists" },
+
+ { Method_refresh_44, "refresh" },
+
+ { Method_convertSeparators_45, "convertSeparators" },
+
+ { Method_drives_46, "drives" },
+
+ { Method_separator_47, "separator" },
+
+ { Method_setCurrent_48, "setCurrent" },
+
+ { Method_current_49, "current" },
+
+ { Method_home_50, "home" },
+
+ { Method_root_51, "root" },
+
+ { Method_currentDirPath_52, "currentDirPath" },
+
+ { Method_homeDirPath_53, "homeDirPath" },
+
+ { Method_rootDirPath_54, "rootDirPath" },
+
+ { Method_match_55, "match" },
+
+ { Method_match_56, "match" },
+
+ { Method_cleanDirPath_57, "cleanDirPath" },
+
+ { Method_isRelativePath_58, "isRelativePath" },
+
+ { 0, 0 }
+ };
+
+ int idx = 0;
+ do {
+ QDirImp *meth = new QDirImp( exec, methods[idx].id );
+ object.put( exec , methods[idx].name, KJS::Object(meth) );
+ ++idx;
+ } while( methods[idx].id );
+
+ //
+ // Define the enum constants
+ //
+ struct EnumValue {
+ const char *id;
+ int val;
+ };
+
+
+ EnumValue enums[] = {
+
+ // enum FilterSpec
+ { "Dirs", QDir::Dirs },
+ { "Files", QDir::Files },
+ { "Drives", QDir::Drives },
+ { "NoSymLinks", QDir::NoSymLinks },
+ { "All", QDir::All },
+ { "TypeMask", QDir::TypeMask },
+ { "Readable", QDir::Readable },
+ { "Writable", QDir::Writable },
+ { "Executable", QDir::Executable },
+ { "RWEMask", QDir::RWEMask },
+ { "Modified", QDir::Modified },
+ { "Hidden", QDir::Hidden },
+ { "System", QDir::System },
+ { "AccessMask", QDir::AccessMask },
+ { "DefaultFilter", QDir::DefaultFilter },
+ // enum SortSpec
+ { "Name", QDir::Name },
+ { "Time", QDir::Time },
+ { "Size", QDir::Size },
+ { "Unsorted", QDir::Unsorted },
+ { "SortByMask", QDir::SortByMask },
+ { "DirsFirst", QDir::DirsFirst },
+ { "Reversed", QDir::Reversed },
+ { "IgnoreCase", QDir::IgnoreCase },
+ { "DefaultSort", QDir::DefaultSort },
+ { 0, 0 }
+ };
+
+ int enumidx = 0;
+ do {
+ object.put( exec, enums[enumidx].id, KJS::Number(enums[enumidx].val), KJS::ReadOnly );
+ ++enumidx;
+ } while( enums[enumidx].id );
+
+}
+
+
+KJS::Value QDirImp::call( KJS::ExecState *exec, KJS::Object &self, const KJS::List &args )
+{
+ JSOpaqueProxy *op = JSProxy::toOpaqueProxy( self.imp() );
+ if ( !op ) {
+ kdWarning() << "QDirImp::call() failed, not a JSOpaqueProxy" << endl;
+ return KJS::Value();
+ }
+
+ if ( op->typeName() != "QDir" ) {
+ kdWarning() << "QDirImp::call() failed, type is " << op->typeName() << endl;
+ return KJS::Value();
+ }
+
+ instance = op->toNative<QDir>();
+
+ switch( mid ) {
+
+ case Method_setPath_7:
+ return setPath_7( exec, self, args );
+ break;
+
+ case Method_path_8:
+ return path_8( exec, self, args );
+ break;
+
+ case Method_absPath_9:
+ return absPath_9( exec, self, args );
+ break;
+
+ case Method_canonicalPath_10:
+ return canonicalPath_10( exec, self, args );
+ break;
+
+ case Method_dirName_11:
+ return dirName_11( exec, self, args );
+ break;
+
+ case Method_filePath_12:
+ return filePath_12( exec, self, args );
+ break;
+
+ case Method_absFilePath_13:
+ return absFilePath_13( exec, self, args );
+ break;
+
+ case Method_cd_14:
+ return cd_14( exec, self, args );
+ break;
+
+ case Method_cdUp_15:
+ return cdUp_15( exec, self, args );
+ break;
+
+ case Method_nameFilter_16:
+ return nameFilter_16( exec, self, args );
+ break;
+
+ case Method_setNameFilter_17:
+ return setNameFilter_17( exec, self, args );
+ break;
+
+ case Method_filter_18:
+ return filter_18( exec, self, args );
+ break;
+
+ case Method_setFilter_19:
+ return setFilter_19( exec, self, args );
+ break;
+
+ case Method_sorting_20:
+ return sorting_20( exec, self, args );
+ break;
+
+ case Method_setSorting_21:
+ return setSorting_21( exec, self, args );
+ break;
+
+ case Method_matchAllDirs_22:
+ return matchAllDirs_22( exec, self, args );
+ break;
+
+ case Method_setMatchAllDirs_23:
+ return setMatchAllDirs_23( exec, self, args );
+ break;
+
+ case Method_count_24:
+ return count_24( exec, self, args );
+ break;
+
+ case Method_encodedEntryList_26:
+ return encodedEntryList_26( exec, self, args );
+ break;
+
+ case Method_encodedEntryList_27:
+ return encodedEntryList_27( exec, self, args );
+ break;
+
+ case Method_entryList_28:
+ return entryList_28( exec, self, args );
+ break;
+
+ case Method_entryList_29:
+ return entryList_29( exec, self, args );
+ break;
+
+ case Method_entryInfoList_30:
+ return entryInfoList_30( exec, self, args );
+ break;
+
+ case Method_entryInfoList_31:
+ return entryInfoList_31( exec, self, args );
+ break;
+
+ case Method_mkdir_32:
+ return mkdir_32( exec, self, args );
+ break;
+
+ case Method_rmdir_33:
+ return rmdir_33( exec, self, args );
+ break;
+
+ case Method_isReadable_34:
+ return isReadable_34( exec, self, args );
+ break;
+
+ case Method_exists_35:
+ return exists_35( exec, self, args );
+ break;
+
+ case Method_isRoot_36:
+ return isRoot_36( exec, self, args );
+ break;
+
+ case Method_isRelative_37:
+ return isRelative_37( exec, self, args );
+ break;
+
+ case Method_convertToAbs_38:
+ return convertToAbs_38( exec, self, args );
+ break;
+
+ case Method_remove_41:
+ return remove_41( exec, self, args );
+ break;
+
+ case Method_rename_42:
+ return rename_42( exec, self, args );
+ break;
+
+ case Method_exists_43:
+ return exists_43( exec, self, args );
+ break;
+
+ case Method_refresh_44:
+ return refresh_44( exec, self, args );
+ break;
+
+ case Method_convertSeparators_45:
+ return convertSeparators_45( exec, self, args );
+ break;
+
+ case Method_drives_46:
+ return drives_46( exec, self, args );
+ break;
+
+ case Method_separator_47:
+ return separator_47( exec, self, args );
+ break;
+
+ case Method_setCurrent_48:
+ return setCurrent_48( exec, self, args );
+ break;
+
+ case Method_current_49:
+ return current_49( exec, self, args );
+ break;
+
+ case Method_home_50:
+ return home_50( exec, self, args );
+ break;
+
+ case Method_root_51:
+ return root_51( exec, self, args );
+ break;
+
+ case Method_currentDirPath_52:
+ return currentDirPath_52( exec, self, args );
+ break;
+
+ case Method_homeDirPath_53:
+ return homeDirPath_53( exec, self, args );
+ break;
+
+ case Method_rootDirPath_54:
+ return rootDirPath_54( exec, self, args );
+ break;
+
+ case Method_match_55:
+ return match_55( exec, self, args );
+ break;
+
+ case Method_match_56:
+ return match_56( exec, self, args );
+ break;
+
+ case Method_cleanDirPath_57:
+ return cleanDirPath_57( exec, self, args );
+ break;
+
+ case Method_isRelativePath_58:
+ return isRelativePath_58( exec, self, args );
+ break;
+
+ default:
+ break;
+ }
+
+ QString msg = i18n( "QDirImp has no method with id '%1'." ).arg( mid );
+ return throwError(exec, msg,KJS::ReferenceError);
+}
+
+
+KJS::Value QDirImp::setPath_7( KJS::ExecState *exec, KJS::Object &obj, const KJS::List &args )
+{
+
+ QString arg0 = (args.size() >= 1) ? args[0].toString(exec).qstring() : QString::null;
+
+ instance->setPath(
+ arg0 );
+ return KJS::Value(); // Returns void
+
+}
+
+KJS::Value QDirImp::path_8( KJS::ExecState *exec, KJS::Object &obj, const KJS::List &args )
+{
+
+ QString ret;
+ ret = instance->path( );
+ return KJS::String( ret );
+
+}
+
+KJS::Value QDirImp::absPath_9( KJS::ExecState *exec, KJS::Object &obj, const KJS::List &args )
+{
+
+ QString ret;
+ ret = instance->absPath( );
+ return KJS::String( ret );
+
+}
+
+KJS::Value QDirImp::canonicalPath_10( KJS::ExecState *exec, KJS::Object &obj, const KJS::List &args )
+{
+
+ QString ret;
+ ret = instance->canonicalPath( );
+ return KJS::String( ret );
+
+}
+
+KJS::Value QDirImp::dirName_11( KJS::ExecState *exec, KJS::Object &obj, const KJS::List &args )
+{
+
+ QString ret;
+ ret = instance->dirName( );
+ return KJS::String( ret );
+
+}
+
+KJS::Value QDirImp::filePath_12( KJS::ExecState *exec, KJS::Object &obj, const KJS::List &args )
+{
+
+ QString arg0 = (args.size() >= 1) ? args[0].toString(exec).qstring() : QString::null;
+
+ bool arg1 = (args.size() >= 2) ? args[1].toBoolean(exec) : false;
+
+ QString ret;
+ ret = instance->filePath(
+ arg0,
+ arg1 );
+ return KJS::String( ret );
+
+}
+
+KJS::Value QDirImp::absFilePath_13( KJS::ExecState *exec, KJS::Object &obj, const KJS::List &args )
+{
+
+ QString arg0 = (args.size() >= 1) ? args[0].toString(exec).qstring() : QString::null;
+
+ bool arg1 = (args.size() >= 2) ? args[1].toBoolean(exec) : false;
+
+ QString ret;
+ ret = instance->absFilePath(
+ arg0,
+ arg1 );
+ return KJS::String( ret );
+
+}
+
+KJS::Value QDirImp::cd_14( KJS::ExecState *exec, KJS::Object &obj, const KJS::List &args )
+{
+
+ QString arg0 = (args.size() >= 1) ? args[0].toString(exec).qstring() : QString::null;
+
+ bool arg1 = (args.size() >= 2) ? args[1].toBoolean(exec) : false;
+
+ bool ret;
+ ret = instance->cd(
+ arg0,
+ arg1 );
+ return KJS::Boolean( ret );
+
+}
+
+KJS::Value QDirImp::cdUp_15( KJS::ExecState *exec, KJS::Object &obj, const KJS::List &args )
+{
+
+ bool ret;
+ ret = instance->cdUp( );
+ return KJS::Boolean( ret );
+
+}
+
+KJS::Value QDirImp::nameFilter_16( KJS::ExecState *exec, KJS::Object &obj, const KJS::List &args )
+{
+
+ QString ret;
+ ret = instance->nameFilter( );
+ return KJS::String( ret );
+
+}
+
+KJS::Value QDirImp::setNameFilter_17( KJS::ExecState *exec, KJS::Object &obj, const KJS::List &args )
+{
+
+ QString arg0 = (args.size() >= 1) ? args[0].toString(exec).qstring() : QString::null;
+
+ instance->setNameFilter(
+ arg0 );
+ return KJS::Value(); // Returns void
+
+}
+
+KJS::Value QDirImp::filter_18( KJS::ExecState *exec, KJS::Object &obj, const KJS::List &args )
+{
+
+ instance->filter( );
+ return KJS::Value(); // Returns 'FilterSpec'
+
+}
+
+KJS::Value QDirImp::setFilter_19( KJS::ExecState *exec, KJS::Object &obj, const KJS::List &args )
+{
+
+ int arg0 = (args.size() >= 1) ? args[0].toInteger(exec) : -1;
+
+ instance->setFilter(
+ arg0 );
+ return KJS::Value(); // Returns void
+
+}
+
+KJS::Value QDirImp::sorting_20( KJS::ExecState *exec, KJS::Object &obj, const KJS::List &args )
+{
+
+ instance->sorting( );
+ return KJS::Value(); // Returns 'SortSpec'
+
+}
+
+KJS::Value QDirImp::setSorting_21( KJS::ExecState *exec, KJS::Object &obj, const KJS::List &args )
+{
+
+ int arg0 = (args.size() >= 1) ? args[0].toInteger(exec) : -1;
+
+ instance->setSorting(
+ arg0 );
+ return KJS::Value(); // Returns void
+
+}
+
+KJS::Value QDirImp::matchAllDirs_22( KJS::ExecState *exec, KJS::Object &obj, const KJS::List &args )
+{
+
+ bool ret;
+ ret = instance->matchAllDirs( );
+ return KJS::Boolean( ret );
+
+}
+
+KJS::Value QDirImp::setMatchAllDirs_23( KJS::ExecState *exec, KJS::Object &obj, const KJS::List &args )
+{
+
+ bool arg0 = (args.size() >= 1) ? args[0].toBoolean(exec) : false;
+
+ instance->setMatchAllDirs(
+ arg0 );
+ return KJS::Value(); // Returns void
+
+}
+
+KJS::Value QDirImp::count_24( KJS::ExecState *exec, KJS::Object &obj, const KJS::List &args )
+{
+
+ uint ret;
+ ret = instance->count( );
+ return KJS::Number( ret );
+
+}
+
+KJS::Value QDirImp::encodedEntryList_26( KJS::ExecState *exec, KJS::Object &obj, const KJS::List &args )
+{
+
+ int arg0 = (args.size() >= 1) ? args[0].toInteger(exec) : -1;
+
+ int arg1 = (args.size() >= 2) ? args[1].toInteger(exec) : -1;
+
+ instance->encodedEntryList(
+ arg0,
+ arg1 );
+ return KJS::Value(); // Returns 'QStrList'
+
+}
+
+KJS::Value QDirImp::encodedEntryList_27( KJS::ExecState *exec, KJS::Object &obj, const KJS::List &args )
+{
+
+ QString arg0 = (args.size() >= 1) ? args[0].toString(exec).qstring() : QString::null;
+
+ int arg1 = (args.size() >= 2) ? args[1].toInteger(exec) : -1;
+
+ int arg2 = (args.size() >= 3) ? args[2].toInteger(exec) : -1;
+
+ instance->encodedEntryList(
+ arg0,
+ arg1,
+ arg2 );
+ return KJS::Value(); // Returns 'QStrList'
+
+}
+
+KJS::Value QDirImp::entryList_28( KJS::ExecState *exec, KJS::Object &obj, const KJS::List &args )
+{
+
+ int arg0 = (args.size() >= 1) ? args[0].toInteger(exec) : -1;
+
+ int arg1 = (args.size() >= 2) ? args[1].toInteger(exec) : -1;
+
+ QStringList ret;
+ ret = instance->entryList(
+ arg0,
+ arg1 );
+
+ return convertToValue( exec, ret );
+
+}
+
+KJS::Value QDirImp::entryList_29( KJS::ExecState *exec, KJS::Object &obj, const KJS::List &args )
+{
+
+ QString arg0 = (args.size() >= 1) ? args[0].toString(exec).qstring() : QString::null;
+
+ int arg1 = (args.size() >= 2) ? args[1].toInteger(exec) : -1;
+
+ int arg2 = (args.size() >= 3) ? args[2].toInteger(exec) : -1;
+
+ QStringList ret;
+ ret = instance->entryList(
+ arg0,
+ arg1,
+ arg2 );
+
+ return convertToValue( exec, ret );
+
+}
+
+KJS::Value QDirImp::entryInfoList_30( KJS::ExecState *exec, KJS::Object &obj, const KJS::List &args )
+{
+
+ int arg0 = (args.size() >= 1) ? args[0].toInteger(exec) : -1;
+
+ int arg1 = (args.size() >= 2) ? args[1].toInteger(exec) : -1;
+
+ instance->entryInfoList(
+ arg0,
+ arg1 );
+ return KJS::Value(); // Returns 'const QFileInfoList *'
+
+}
+
+KJS::Value QDirImp::entryInfoList_31( KJS::ExecState *exec, KJS::Object &obj, const KJS::List &args )
+{
+
+ QString arg0 = (args.size() >= 1) ? args[0].toString(exec).qstring() : QString::null;
+
+ int arg1 = (args.size() >= 2) ? args[1].toInteger(exec) : -1;
+
+ int arg2 = (args.size() >= 3) ? args[2].toInteger(exec) : -1;
+
+ instance->entryInfoList(
+ arg0,
+ arg1,
+ arg2 );
+ return KJS::Value(); // Returns 'const QFileInfoList *'
+
+}
+
+KJS::Value QDirImp::mkdir_32( KJS::ExecState *exec, KJS::Object &obj, const KJS::List &args )
+{
+
+ QString arg0 = (args.size() >= 1) ? args[0].toString(exec).qstring() : QString::null;
+
+ bool arg1 = (args.size() >= 2) ? args[1].toBoolean(exec) : false;
+
+ bool ret;
+ ret = instance->mkdir(
+ arg0,
+ arg1 );
+ return KJS::Boolean( ret );
+
+}
+
+KJS::Value QDirImp::rmdir_33( KJS::ExecState *exec, KJS::Object &obj, const KJS::List &args )
+{
+
+ QString arg0 = (args.size() >= 1) ? args[0].toString(exec).qstring() : QString::null;
+
+ bool arg1 = (args.size() >= 2) ? args[1].toBoolean(exec) : false;
+
+ bool ret;
+ ret = instance->rmdir(
+ arg0,
+ arg1 );
+ return KJS::Boolean( ret );
+
+}
+
+KJS::Value QDirImp::isReadable_34( KJS::ExecState *exec, KJS::Object &obj, const KJS::List &args )
+{
+
+ bool ret;
+ ret = instance->isReadable( );
+ return KJS::Boolean( ret );
+
+}
+
+KJS::Value QDirImp::exists_35( KJS::ExecState *exec, KJS::Object &obj, const KJS::List &args )
+{
+
+ bool ret;
+ ret = instance->exists( );
+ return KJS::Boolean( ret );
+
+}
+
+KJS::Value QDirImp::isRoot_36( KJS::ExecState *exec, KJS::Object &obj, const KJS::List &args )
+{
+
+ bool ret;
+ ret = instance->isRoot( );
+ return KJS::Boolean( ret );
+
+}
+
+KJS::Value QDirImp::isRelative_37( KJS::ExecState *exec, KJS::Object &obj, const KJS::List &args )
+{
+
+ bool ret;
+ ret = instance->isRelative( );
+ return KJS::Boolean( ret );
+
+}
+
+KJS::Value QDirImp::convertToAbs_38( KJS::ExecState *exec, KJS::Object &obj, const KJS::List &args )
+{
+
+ instance->convertToAbs( );
+ return KJS::Value(); // Returns void
+
+}
+
+KJS::Value QDirImp::remove_41( KJS::ExecState *exec, KJS::Object &obj, const KJS::List &args )
+{
+
+ QString arg0 = (args.size() >= 1) ? args[0].toString(exec).qstring() : QString::null;
+
+ bool arg1 = (args.size() >= 2) ? args[1].toBoolean(exec) : false;
+
+ bool ret;
+ ret = instance->remove(
+ arg0,
+ arg1 );
+ return KJS::Boolean( ret );
+
+}
+
+KJS::Value QDirImp::rename_42( KJS::ExecState *exec, KJS::Object &obj, const KJS::List &args )
+{
+
+ QString arg0 = (args.size() >= 1) ? args[0].toString(exec).qstring() : QString::null;
+
+ QString arg1 = (args.size() >= 2) ? args[1].toString(exec).qstring() : QString::null;
+
+ bool arg2 = (args.size() >= 3) ? args[2].toBoolean(exec) : false;
+
+ bool ret;
+ ret = instance->rename(
+ arg0,
+ arg1,
+ arg2 );
+ return KJS::Boolean( ret );
+
+}
+
+KJS::Value QDirImp::exists_43( KJS::ExecState *exec, KJS::Object &obj, const KJS::List &args )
+{
+
+ QString arg0 = (args.size() >= 1) ? args[0].toString(exec).qstring() : QString::null;
+
+ bool arg1 = (args.size() >= 2) ? args[1].toBoolean(exec) : false;
+
+ bool ret;
+ ret = instance->exists(
+ arg0,
+ arg1 );
+ return KJS::Boolean( ret );
+
+}
+
+KJS::Value QDirImp::refresh_44( KJS::ExecState *exec, KJS::Object &obj, const KJS::List &args )
+{
+
+ instance->refresh( );
+ return KJS::Value(); // Returns void
+
+}
+
+KJS::Value QDirImp::convertSeparators_45( KJS::ExecState *exec, KJS::Object &obj, const KJS::List &args )
+{
+
+ QString arg0 = (args.size() >= 1) ? args[0].toString(exec).qstring() : QString::null;
+
+ QString ret;
+ ret = instance->convertSeparators(
+ arg0 );
+ return KJS::String( ret );
+
+}
+
+KJS::Value QDirImp::drives_46( KJS::ExecState *exec, KJS::Object &obj, const KJS::List &args )
+{
+
+ instance->drives( );
+ return KJS::Value(); // Returns 'const QFileInfoList *'
+
+}
+
+KJS::Value QDirImp::separator_47( KJS::ExecState *exec, KJS::Object &obj, const KJS::List &args )
+{
+
+ instance->separator( );
+ return KJS::Value(); // Returns 'char'
+
+}
+
+KJS::Value QDirImp::setCurrent_48( KJS::ExecState *exec, KJS::Object &obj, const KJS::List &args )
+{
+
+ QString arg0 = (args.size() >= 1) ? args[0].toString(exec).qstring() : QString::null;
+
+ bool ret;
+ ret = instance->setCurrent(
+ arg0 );
+ return KJS::Boolean( ret );
+
+}
+
+KJS::Value QDirImp::current_49( KJS::ExecState *exec, KJS::Object &obj, const KJS::List &args )
+{
+
+ instance->current( );
+ return KJS::Value(); // Returns 'QDir'
+
+}
+
+KJS::Value QDirImp::home_50( KJS::ExecState *exec, KJS::Object &obj, const KJS::List &args )
+{
+
+ instance->home( );
+ return KJS::Value(); // Returns 'QDir'
+
+}
+
+KJS::Value QDirImp::root_51( KJS::ExecState *exec, KJS::Object &obj, const KJS::List &args )
+{
+
+ instance->root( );
+ return KJS::Value(); // Returns 'QDir'
+
+}
+
+KJS::Value QDirImp::currentDirPath_52( KJS::ExecState *exec, KJS::Object &obj, const KJS::List &args )
+{
+
+ QString ret;
+ ret = instance->currentDirPath( );
+ return KJS::String( ret );
+
+}
+
+KJS::Value QDirImp::homeDirPath_53( KJS::ExecState *exec, KJS::Object &obj, const KJS::List &args )
+{
+
+ QString ret;
+ ret = instance->homeDirPath( );
+ return KJS::String( ret );
+
+}
+
+KJS::Value QDirImp::rootDirPath_54( KJS::ExecState *exec, KJS::Object &obj, const KJS::List &args )
+{
+
+ QString ret;
+ ret = instance->rootDirPath( );
+ return KJS::String( ret );
+
+}
+
+KJS::Value QDirImp::match_55( KJS::ExecState *exec, KJS::Object &obj, const KJS::List &args )
+{
+
+ QStringList arg0;
+ if ( args.size() >= 1 ) {
+ // TODO: populate the list
+ }
+
+ QString arg1 = (args.size() >= 2) ? args[1].toString(exec).qstring() : QString::null;
+
+ bool ret;
+ ret = instance->match(
+ arg0,
+ arg1 );
+ return KJS::Boolean( ret );
+
+}
+
+KJS::Value QDirImp::match_56( KJS::ExecState *exec, KJS::Object &obj, const KJS::List &args )
+{
+
+ QString arg0 = (args.size() >= 1) ? args[0].toString(exec).qstring() : QString::null;
+
+ QString arg1 = (args.size() >= 2) ? args[1].toString(exec).qstring() : QString::null;
+
+ bool ret;
+ ret = instance->match(
+ arg0,
+ arg1 );
+ return KJS::Boolean( ret );
+
+}
+
+KJS::Value QDirImp::cleanDirPath_57( KJS::ExecState *exec, KJS::Object &obj, const KJS::List &args )
+{
+
+ QString arg0 = (args.size() >= 1) ? args[0].toString(exec).qstring() : QString::null;
+
+ QString ret;
+ ret = instance->cleanDirPath(
+ arg0 );
+ return KJS::String( ret );
+
+}
+
+KJS::Value QDirImp::isRelativePath_58( KJS::ExecState *exec, KJS::Object &obj, const KJS::List &args )
+{
+
+ QString arg0 = (args.size() >= 1) ? args[0].toString(exec).qstring() : QString::null;
+
+ bool ret;
+ ret = instance->isRelativePath(
+ arg0 );
+ return KJS::Boolean( ret );
+
+}
+
+
+} // namespace KJSEmbed
+
+// Local Variables:
+// c-basic-offset: 4
+// End:
+
+
diff --git a/kjsembed/builtins/qdir_imp.h b/kjsembed/builtins/qdir_imp.h
new file mode 100644
index 00000000..f78850e7
--- /dev/null
+++ b/kjsembed/builtins/qdir_imp.h
@@ -0,0 +1,172 @@
+
+
+
+#ifndef KJSEMBED_QDir_H
+#define KJSEMBED_QDir_H
+
+#include <kjs/interpreter.h>
+#include <kjs/object.h>
+
+#include <kjsembed/jsobjectproxy_imp.h>
+#include <kjsembed/jsbindingbase.h>
+
+class QDir;
+
+/**
+ * Namespace containing the KJSEmbed library.
+ */
+namespace KJSEmbed {
+namespace Bindings {
+ class QDirLoader : public JSBindingBase
+ {
+ public:
+ KJS::Object createBinding(KJSEmbedPart *jspart, KJS::ExecState *exec, const KJS::List &args) const;
+ void addBindings( KJSEmbedPart *jspart, KJS::ExecState *exec, KJS::Object &proxy) const;
+ };
+}
+/**
+ * Wrapper class for QDir methods.
+ *
+ * @author Richard Moore, rich@kde.org
+ */
+class QDirImp : public JSProxyImp
+{
+public:
+ /** Enumerates the methods supported by this class. */
+ enum Methods {
+
+ Method_setPath_7,
+ Method_path_8,
+ Method_absPath_9,
+ Method_canonicalPath_10,
+ Method_dirName_11,
+ Method_filePath_12,
+ Method_absFilePath_13,
+ Method_cd_14,
+ Method_cdUp_15,
+ Method_nameFilter_16,
+ Method_setNameFilter_17,
+ Method_filter_18,
+ Method_setFilter_19,
+ Method_sorting_20,
+ Method_setSorting_21,
+ Method_matchAllDirs_22,
+ Method_setMatchAllDirs_23,
+ Method_count_24,
+ Method_encodedEntryList_26,
+ Method_encodedEntryList_27,
+ Method_entryList_28,
+ Method_entryList_29,
+ Method_entryInfoList_30,
+ Method_entryInfoList_31,
+ Method_mkdir_32,
+ Method_rmdir_33,
+ Method_isReadable_34,
+ Method_exists_35,
+ Method_isRoot_36,
+ Method_isRelative_37,
+ Method_convertToAbs_38,
+ Method_remove_41,
+ Method_rename_42,
+ Method_exists_43,
+ Method_refresh_44,
+ Method_convertSeparators_45,
+ Method_drives_46,
+ Method_separator_47,
+ Method_setCurrent_48,
+ Method_current_49,
+ Method_home_50,
+ Method_root_51,
+ Method_currentDirPath_52,
+ Method_homeDirPath_53,
+ Method_rootDirPath_54,
+ Method_match_55,
+ Method_match_56,
+ Method_cleanDirPath_57,
+ Method_isRelativePath_58,
+ Method_Last = -1
+ };
+
+ QDirImp( KJS::ExecState *exec, int id );
+ ~QDirImp();
+
+ static void addBindings( KJS::ExecState *exec, KJS::Object &object );
+
+ //
+ // Methods implemented by this class.
+ //
+
+ KJS::Value setPath_7( KJS::ExecState *exec, KJS::Object &obj, const KJS::List &args );
+ KJS::Value path_8( KJS::ExecState *exec, KJS::Object &obj, const KJS::List &args );
+ KJS::Value absPath_9( KJS::ExecState *exec, KJS::Object &obj, const KJS::List &args );
+ KJS::Value canonicalPath_10( KJS::ExecState *exec, KJS::Object &obj, const KJS::List &args );
+ KJS::Value dirName_11( KJS::ExecState *exec, KJS::Object &obj, const KJS::List &args );
+ KJS::Value filePath_12( KJS::ExecState *exec, KJS::Object &obj, const KJS::List &args );
+ KJS::Value absFilePath_13( KJS::ExecState *exec, KJS::Object &obj, const KJS::List &args );
+ KJS::Value cd_14( KJS::ExecState *exec, KJS::Object &obj, const KJS::List &args );
+ KJS::Value cdUp_15( KJS::ExecState *exec, KJS::Object &obj, const KJS::List &args );
+ KJS::Value nameFilter_16( KJS::ExecState *exec, KJS::Object &obj, const KJS::List &args );
+ KJS::Value setNameFilter_17( KJS::ExecState *exec, KJS::Object &obj, const KJS::List &args );
+ KJS::Value filter_18( KJS::ExecState *exec, KJS::Object &obj, const KJS::List &args );
+ KJS::Value setFilter_19( KJS::ExecState *exec, KJS::Object &obj, const KJS::List &args );
+ KJS::Value sorting_20( KJS::ExecState *exec, KJS::Object &obj, const KJS::List &args );
+ KJS::Value setSorting_21( KJS::ExecState *exec, KJS::Object &obj, const KJS::List &args );
+ KJS::Value matchAllDirs_22( KJS::ExecState *exec, KJS::Object &obj, const KJS::List &args );
+ KJS::Value setMatchAllDirs_23( KJS::ExecState *exec, KJS::Object &obj, const KJS::List &args );
+ KJS::Value count_24( KJS::ExecState *exec, KJS::Object &obj, const KJS::List &args );
+ KJS::Value encodedEntryList_26( KJS::ExecState *exec, KJS::Object &obj, const KJS::List &args );
+ KJS::Value encodedEntryList_27( KJS::ExecState *exec, KJS::Object &obj, const KJS::List &args );
+ KJS::Value entryList_28( KJS::ExecState *exec, KJS::Object &obj, const KJS::List &args );
+ KJS::Value entryList_29( KJS::ExecState *exec, KJS::Object &obj, const KJS::List &args );
+ KJS::Value entryInfoList_30( KJS::ExecState *exec, KJS::Object &obj, const KJS::List &args );
+ KJS::Value entryInfoList_31( KJS::ExecState *exec, KJS::Object &obj, const KJS::List &args );
+ KJS::Value mkdir_32( KJS::ExecState *exec, KJS::Object &obj, const KJS::List &args );
+ KJS::Value rmdir_33( KJS::ExecState *exec, KJS::Object &obj, const KJS::List &args );
+ KJS::Value isReadable_34( KJS::ExecState *exec, KJS::Object &obj, const KJS::List &args );
+ KJS::Value exists_35( KJS::ExecState *exec, KJS::Object &obj, const KJS::List &args );
+ KJS::Value isRoot_36( KJS::ExecState *exec, KJS::Object &obj, const KJS::List &args );
+ KJS::Value isRelative_37( KJS::ExecState *exec, KJS::Object &obj, const KJS::List &args );
+ KJS::Value convertToAbs_38( KJS::ExecState *exec, KJS::Object &obj, const KJS::List &args );
+ KJS::Value remove_41( KJS::ExecState *exec, KJS::Object &obj, const KJS::List &args );
+ KJS::Value rename_42( KJS::ExecState *exec, KJS::Object &obj, const KJS::List &args );
+ KJS::Value exists_43( KJS::ExecState *exec, KJS::Object &obj, const KJS::List &args );
+ KJS::Value refresh_44( KJS::ExecState *exec, KJS::Object &obj, const KJS::List &args );
+ KJS::Value convertSeparators_45( KJS::ExecState *exec, KJS::Object &obj, const KJS::List &args );
+ KJS::Value drives_46( KJS::ExecState *exec, KJS::Object &obj, const KJS::List &args );
+ KJS::Value separator_47( KJS::ExecState *exec, KJS::Object &obj, const KJS::List &args );
+ KJS::Value setCurrent_48( KJS::ExecState *exec, KJS::Object &obj, const KJS::List &args );
+ KJS::Value current_49( KJS::ExecState *exec, KJS::Object &obj, const KJS::List &args );
+ KJS::Value home_50( KJS::ExecState *exec, KJS::Object &obj, const KJS::List &args );
+ KJS::Value root_51( KJS::ExecState *exec, KJS::Object &obj, const KJS::List &args );
+ KJS::Value currentDirPath_52( KJS::ExecState *exec, KJS::Object &obj, const KJS::List &args );
+ KJS::Value homeDirPath_53( KJS::ExecState *exec, KJS::Object &obj, const KJS::List &args );
+ KJS::Value rootDirPath_54( KJS::ExecState *exec, KJS::Object &obj, const KJS::List &args );
+ KJS::Value match_55( KJS::ExecState *exec, KJS::Object &obj, const KJS::List &args );
+ KJS::Value match_56( KJS::ExecState *exec, KJS::Object &obj, const KJS::List &args );
+ KJS::Value cleanDirPath_57( KJS::ExecState *exec, KJS::Object &obj, const KJS::List &args );
+ KJS::Value isRelativePath_58( KJS::ExecState *exec, KJS::Object &obj, const KJS::List &args );
+
+ //
+ // JS binding code.
+ //
+
+ /** Returns true iff this object implements the call function. */
+ virtual bool implementsCall() const { return true; }
+
+ /** Invokes the call function. */
+ virtual KJS::Value call( KJS::ExecState *exec, KJS::Object &self, const KJS::List &args );
+
+private:
+ QDir *instance; // Temp
+ int mid;
+};
+
+} // namespace KJSEmbed
+
+#endif // KJSEMBED_QDir_H
+
+// Local Variables:
+// c-basic-offset: 4
+// End:
+
+
diff --git a/kjsembed/builtins/qfile_imp.cpp b/kjsembed/builtins/qfile_imp.cpp
new file mode 100644
index 00000000..d404e239
--- /dev/null
+++ b/kjsembed/builtins/qfile_imp.cpp
@@ -0,0 +1,622 @@
+
+
+#include <qcstring.h>
+#include <qpalette.h>
+#include <qpixmap.h>
+#include <qfont.h>
+
+#ifndef QT_ONLY
+#include <klocale.h>
+#include <kdebug.h>
+#endif
+
+#include <kjs/object.h>
+
+#include <kjsembed/jsobjectproxy.h>
+#include <kjsembed/jsopaqueproxy.h>
+#include <kjsembed/jsbinding.h>
+#include <kjsembed/global.h>
+
+#include <qfile.h>
+#include "qfile_imp.h"
+
+/**
+ * Namespace containing the KJSEmbed library.
+ */
+namespace KJSEmbed {
+
+QFileImp::QFileImp( KJS::ExecState *exec, int mid, bool constructor )
+ : JSProxyImp(exec), id(mid), cons(constructor)
+{
+}
+
+QFileImp::~QFileImp()
+{
+}
+
+void QFileImp::addBindings( KJS::ExecState *exec, KJS::Object &object )
+{
+ JSProxy::MethodTable methods[] = {
+
+ { Method_name_4, "name" },
+ { Method_setName_5, "setName" },
+ { Method_exists_6, "exists" },
+ { Method_remove_7, "remove" },
+ { Method_open_8, "open" },
+ { Method_open_9, "open" },
+ { Method_open_10, "open" },
+ { Method_close_11, "close" },
+ { Method_flush_12, "flush" },
+ { Method_size_13, "size" },
+ { Method_at_14, "at" },
+ { Method_at_15, "at" },
+ { Method_atEnd_16, "atEnd" },
+ { Method_readBlock_17, "readBlock" },
+ { Method_writeBlock_18, "writeBlock" },
+ { Method_writeBlock_19, "writeBlock" },
+ { Method_readLine_20, "readLine" },
+ { Method_readLine_21, "readLine" },
+ { Method_getch_22, "getch" },
+ { Method_putch_23, "putch" },
+ { Method_ungetch_24, "ungetch" },
+ { Method_handle_25, "handle" },
+ { Method_errorString_26, "errorString" },
+ { Method_encodeName_27, "encodeName" },
+ { Method_decodeName_28, "decodeName" },
+ { Method_setEncodingFunction_29, "setEncodingFunction" },
+ { Method_setDecodingFunction_30, "setDecodingFunction" },
+ { Method_exists_31, "exists" },
+ { Method_remove_32, "remove" },
+ { 0, 0 }
+ };
+
+ int idx = 0;
+ QCString lastName;
+
+ do {
+ if ( lastName != methods[idx].name ) {
+ QFileImp *meth = new QFileImp( exec, methods[idx].id );
+ object.put( exec , methods[idx].name, KJS::Object(meth) );
+ lastName = methods[idx].name;
+ }
+ ++idx;
+ } while( methods[idx].id );
+
+
+}
+
+QFile *QFileImp::toQFile( KJS::Object &self )
+{
+ JSObjectProxy *ob = JSProxy::toObjectProxy( self.imp() );
+ if ( ob ) {
+ QObject *obj = ob->object();
+ if ( obj )
+ return dynamic_cast<QFile *>( obj );
+ }
+
+ JSOpaqueProxy *op = JSProxy::toOpaqueProxy( self.imp() );
+ if ( !op )
+ return 0;
+
+ if ( op->typeName() != "QFile" )
+ return 0;
+
+ return op->toNative<QFile>();
+}
+
+
+KJS::Object QFileImp::construct( KJS::ExecState *exec, const KJS::List &args )
+{
+ switch( id ) {
+
+ case Constructor_QFile_1:
+ return QFile_1( exec, args );
+ break;
+
+ case Constructor_QFile_2:
+ return QFile_2( exec, args );
+ break;
+
+ default:
+ break;
+ }
+
+ QString msg = i18n("QFileCons has no constructor with id '%1'.").arg(id);
+ return throwError(exec, msg,KJS::ReferenceError);
+}
+
+
+KJS::Object QFileImp::QFile_1( KJS::ExecState *exec, const KJS::List &args )
+{
+ return KJS::Object();
+}
+
+KJS::Object QFileImp::QFile_2( KJS::ExecState *exec, const KJS::List &args )
+{
+
+ // TODO
+ QWidget *arg0 = 0L;
+ return KJS::Object();
+
+}
+
+KJS::Value QFileImp::call( KJS::ExecState *exec, KJS::Object &self, const KJS::List &args )
+{
+ instance = QFileImp::toQFile( self );
+
+ switch( id ) {
+
+ case Method_name_4:
+ return name_4( exec, self, args );
+ break;
+
+ case Method_setName_5:
+ return setName_5( exec, self, args );
+ break;
+
+ case Method_exists_6:
+ return exists_6( exec, self, args );
+ break;
+
+ case Method_remove_7:
+ return remove_7( exec, self, args );
+ break;
+
+ case Method_open_8:
+ return open_8( exec, self, args );
+ break;
+
+ case Method_open_9:
+ return open_9( exec, self, args );
+ break;
+
+ case Method_open_10:
+ return open_10( exec, self, args );
+ break;
+
+ case Method_close_11:
+ return close_11( exec, self, args );
+ break;
+
+ case Method_flush_12:
+ return flush_12( exec, self, args );
+ break;
+
+ case Method_size_13:
+ return size_13( exec, self, args );
+ break;
+
+ case Method_at_14:
+ return at_14( exec, self, args );
+ break;
+
+ case Method_at_15:
+ return at_15( exec, self, args );
+ break;
+
+ case Method_atEnd_16:
+ return atEnd_16( exec, self, args );
+ break;
+
+ case Method_readBlock_17:
+ return readBlock_17( exec, self, args );
+ break;
+
+ case Method_writeBlock_18:
+ return writeBlock_18( exec, self, args );
+ break;
+
+ case Method_writeBlock_19:
+ return writeBlock_19( exec, self, args );
+ break;
+
+ case Method_readLine_20:
+ return readLine_20( exec, self, args );
+ break;
+
+ case Method_readLine_21:
+ return readLine_21( exec, self, args );
+ break;
+
+ case Method_getch_22:
+ return getch_22( exec, self, args );
+ break;
+
+ case Method_putch_23:
+ return putch_23( exec, self, args );
+ break;
+
+ case Method_ungetch_24:
+ return ungetch_24( exec, self, args );
+ break;
+
+ case Method_handle_25:
+ return handle_25( exec, self, args );
+ break;
+
+ case Method_errorString_26:
+ return errorString_26( exec, self, args );
+ break;
+
+ case Method_encodeName_27:
+ return encodeName_27( exec, self, args );
+ break;
+
+ case Method_decodeName_28:
+ return decodeName_28( exec, self, args );
+ break;
+
+ case Method_setEncodingFunction_29:
+ return setEncodingFunction_29( exec, self, args );
+ break;
+
+ case Method_setDecodingFunction_30:
+ return setDecodingFunction_30( exec, self, args );
+ break;
+
+ case Method_exists_31:
+ return exists_31( exec, self, args );
+ break;
+
+ case Method_remove_32:
+ return remove_32( exec, self, args );
+ break;
+
+ default:
+ break;
+ }
+
+ QString msg = i18n( "QFileImp has no method with id '%1'." ).arg( id );
+ return throwError(exec, msg, KJS::ReferenceError );
+}
+
+
+KJS::Value QFileImp::name_4( KJS::ExecState *exec, KJS::Object &obj, const KJS::List &args )
+{
+
+ QString ret;
+ ret = instance->name( );
+ return KJS::String( ret );
+
+}
+
+KJS::Value QFileImp::setName_5( KJS::ExecState *exec, KJS::Object &obj, const KJS::List &args )
+{
+
+ QString arg0 = (args.size() >= 1) ? args[0].toString(exec).qstring() : QString::null;
+
+ instance->setName(
+ arg0 );
+ return KJS::Value(); // Returns void
+
+}
+
+KJS::Value QFileImp::exists_6( KJS::ExecState *exec, KJS::Object &obj, const KJS::List &args )
+{
+
+ bool ret;
+ ret = instance->exists( );
+ return KJS::Boolean( ret );
+
+}
+
+KJS::Value QFileImp::remove_7( KJS::ExecState *exec, KJS::Object &obj, const KJS::List &args )
+{
+
+ bool ret;
+ ret = instance->remove( );
+ return KJS::Boolean( ret );
+
+}
+
+KJS::Value QFileImp::open_8( KJS::ExecState *exec, KJS::Object &obj, const KJS::List &args )
+{
+
+ int arg0 = (args.size() >= 1) ? args[0].toInteger(exec) : -1;
+
+ bool ret;
+ ret = instance->open(
+ arg0 );
+ return KJS::Boolean( ret );
+
+}
+
+KJS::Value QFileImp::open_9( KJS::ExecState *exec, KJS::Object &obj, const KJS::List &args )
+{
+
+ int arg0 = (args.size() >= 1) ? args[0].toInteger(exec) : -1;
+
+ // Unsupported parameter FILE *
+ return KJS::Value();
+
+ FILE * arg1; // Dummy
+
+ bool ret;
+ ret = instance->open(
+ arg0,
+ arg1 );
+ return KJS::Boolean( ret );
+
+}
+
+KJS::Value QFileImp::open_10( KJS::ExecState *exec, KJS::Object &obj, const KJS::List &args )
+{
+
+ int arg0 = (args.size() >= 1) ? args[0].toInteger(exec) : -1;
+
+ int arg1 = (args.size() >= 2) ? args[1].toInteger(exec) : -1;
+
+ bool ret;
+ ret = instance->open(
+ arg0,
+ arg1 );
+ return KJS::Boolean( ret );
+
+}
+
+KJS::Value QFileImp::close_11( KJS::ExecState *exec, KJS::Object &obj, const KJS::List &args )
+{
+
+ instance->close( );
+ return KJS::Value(); // Returns void
+
+}
+
+KJS::Value QFileImp::flush_12( KJS::ExecState *exec, KJS::Object &obj, const KJS::List &args )
+{
+
+ instance->flush( );
+ return KJS::Value(); // Returns void
+
+}
+
+KJS::Value QFileImp::size_13( KJS::ExecState *exec, KJS::Object &obj, const KJS::List &args )
+{
+
+ instance->size( );
+ return KJS::Value(); // Returns 'Offset'
+
+}
+
+KJS::Value QFileImp::at_14( KJS::ExecState *exec, KJS::Object &obj, const KJS::List &args )
+{
+
+ instance->at( );
+ return KJS::Value(); // Returns 'Offset'
+
+}
+
+KJS::Value QFileImp::at_15( KJS::ExecState *exec, KJS::Object &obj, const KJS::List &args )
+{
+
+ QFile::Offset arg0 = 0; // TODO (hack for qfile)
+
+ bool ret;
+ ret = instance->at(
+ arg0 );
+ return KJS::Boolean( ret );
+
+}
+
+KJS::Value QFileImp::atEnd_16( KJS::ExecState *exec, KJS::Object &obj, const KJS::List &args )
+{
+
+ bool ret;
+ ret = instance->atEnd( );
+ return KJS::Boolean( ret );
+
+}
+
+KJS::Value QFileImp::readBlock_17( KJS::ExecState *exec, KJS::Object &obj, const KJS::List &args )
+{
+
+ // Unsupported parameter char *
+ return KJS::Value();
+
+ char * arg0; // Dummy
+
+ // Unsupported parameter Q_ULONG
+ return KJS::Value();
+
+ Q_ULONG arg1; // Dummy
+
+ instance->readBlock(
+ arg0,
+ arg1 );
+ return KJS::Value(); // Returns 'Q_LONG'
+
+}
+
+KJS::Value QFileImp::writeBlock_18( KJS::ExecState *exec, KJS::Object &obj, const KJS::List &args )
+{
+
+ const char *arg0 = (args.size() >= 1) ? args[0].toString(exec).ascii() : 0;
+
+ // Unsupported parameter Q_ULONG
+ return KJS::Value();
+
+ Q_ULONG arg1; // Dummy
+
+ instance->writeBlock(
+ arg0,
+ arg1 );
+ return KJS::Value(); // Returns 'Q_LONG'
+
+}
+
+KJS::Value QFileImp::writeBlock_19( KJS::ExecState *exec, KJS::Object &obj, const KJS::List &args )
+{
+
+ QByteArray arg0; // TODO (hack for qfile)
+
+ instance->writeBlock(
+ arg0 );
+ return KJS::Value(); // Returns 'Q_LONG'
+
+}
+
+KJS::Value QFileImp::readLine_20( KJS::ExecState *exec, KJS::Object &obj, const KJS::List &args )
+{
+
+ // Unsupported parameter char *
+ return KJS::Value();
+
+ char * arg0; // Dummy
+
+ // Unsupported parameter Q_ULONG
+ return KJS::Value();
+
+ Q_ULONG arg1; // Dummy
+
+ instance->readLine(
+ arg0,
+ arg1 );
+ return KJS::Value(); // Returns 'Q_LONG'
+
+}
+
+KJS::Value QFileImp::readLine_21( KJS::ExecState *exec, KJS::Object &obj, const KJS::List &args )
+{
+
+ QString arg0 = (args.size() >= 1) ? args[0].toString(exec).qstring() : QString::null;
+
+ // Unsupported parameter Q_ULONG
+ return KJS::Value();
+
+ Q_ULONG arg1; // Dummy
+
+ instance->readLine(
+ arg0,
+ arg1 );
+ return KJS::Value(); // Returns 'Q_LONG'
+
+}
+
+KJS::Value QFileImp::getch_22( KJS::ExecState *exec, KJS::Object &obj, const KJS::List &args )
+{
+
+ int ret;
+ ret = instance->getch( );
+ return KJS::Number( ret );
+
+}
+
+KJS::Value QFileImp::putch_23( KJS::ExecState *exec, KJS::Object &obj, const KJS::List &args )
+{
+
+ int arg0 = (args.size() >= 1) ? args[0].toInteger(exec) : -1;
+
+ int ret;
+ ret = instance->putch(
+ arg0 );
+ return KJS::Number( ret );
+
+}
+
+KJS::Value QFileImp::ungetch_24( KJS::ExecState *exec, KJS::Object &obj, const KJS::List &args )
+{
+
+ int arg0 = (args.size() >= 1) ? args[0].toInteger(exec) : -1;
+
+ int ret;
+ ret = instance->ungetch(
+ arg0 );
+ return KJS::Number( ret );
+
+}
+
+KJS::Value QFileImp::handle_25( KJS::ExecState *exec, KJS::Object &obj, const KJS::List &args )
+{
+
+ int ret;
+ ret = instance->handle( );
+ return KJS::Number( ret );
+
+}
+
+KJS::Value QFileImp::errorString_26( KJS::ExecState *exec, KJS::Object &obj, const KJS::List &args )
+{
+
+ QString ret;
+ ret = instance->errorString( );
+ return KJS::String( ret );
+
+}
+
+KJS::Value QFileImp::encodeName_27( KJS::ExecState *exec, KJS::Object &obj, const KJS::List &args )
+{
+
+ QString arg0 = (args.size() >= 1) ? args[0].toString(exec).qstring() : QString::null;
+
+ instance->encodeName(
+ arg0 );
+ return KJS::Value(); // Returns 'QCString'
+
+}
+
+KJS::Value QFileImp::decodeName_28( KJS::ExecState *exec, KJS::Object &obj, const KJS::List &args )
+{
+
+ const QCString arg0 = (args.size() >= 1) ? args[0].toString(exec).ascii() : 0;
+
+ QString ret;
+ ret = instance->decodeName(
+ arg0 );
+ return KJS::String( ret );
+
+}
+
+KJS::Value QFileImp::setEncodingFunction_29( KJS::ExecState *exec, KJS::Object &obj, const KJS::List &args )
+{
+
+ QFile::EncoderFn arg0 = 0; // TODO (hack for qfile)
+
+ instance->setEncodingFunction(
+ arg0 );
+ return KJS::Value(); // Returns void
+
+}
+
+KJS::Value QFileImp::setDecodingFunction_30( KJS::ExecState *exec, KJS::Object &obj, const KJS::List &args )
+{
+
+ QFile::DecoderFn arg0 = 0; // TODO (hack for qfile)
+
+ instance->setDecodingFunction(
+ arg0 );
+ return KJS::Value(); // Returns void
+
+}
+
+KJS::Value QFileImp::exists_31( KJS::ExecState *exec, KJS::Object &obj, const KJS::List &args )
+{
+
+ QString arg0 = (args.size() >= 1) ? args[0].toString(exec).qstring() : QString::null;
+
+ bool ret;
+ ret = instance->exists(
+ arg0 );
+ return KJS::Boolean( ret );
+
+}
+
+KJS::Value QFileImp::remove_32( KJS::ExecState *exec, KJS::Object &obj, const KJS::List &args )
+{
+
+ QString arg0 = (args.size() >= 1) ? args[0].toString(exec).qstring() : QString::null;
+
+ bool ret;
+ ret = instance->remove(
+ arg0 );
+ return KJS::Boolean( ret );
+
+}
+
+
+} // namespace KJSEmbed
+
+// Local Variables:
+// c-basic-offset: 4
+// End:
+
+
diff --git a/kjsembed/builtins/qfile_imp.h b/kjsembed/builtins/qfile_imp.h
new file mode 100644
index 00000000..ae88dd52
--- /dev/null
+++ b/kjsembed/builtins/qfile_imp.h
@@ -0,0 +1,148 @@
+
+
+
+#ifndef KJSEMBED_QFile_H
+#define KJSEMBED_QFile_H
+
+#include <kjs/interpreter.h>
+#include <kjs/object.h>
+
+#include <kjsembed/jsobjectproxy_imp.h>
+
+class QFile;
+
+/**
+ * Namespace containing the KJSEmbed library.
+ */
+namespace KJSEmbed {
+
+/**
+ * Wrapper class for QFile methods.
+ *
+ * @author Richard Moore, rich@kde.org
+ */
+class QFileImp : public JSProxyImp
+{
+public:
+ /** Enumerates the constructors supported by this class. */
+ enum Constructors {
+ Constructor_QFile_1,
+ Constructor_QFile_2,
+
+ LastConstuctor = -1
+ };
+
+ /** Enumerates the methods supported by this class. */
+ enum Methods {
+
+ Method_name_4,
+ Method_setName_5,
+ Method_exists_6,
+ Method_remove_7,
+ Method_open_8,
+ Method_open_9,
+ Method_open_10,
+ Method_close_11,
+ Method_flush_12,
+ Method_size_13,
+ Method_at_14,
+ Method_at_15,
+ Method_atEnd_16,
+ Method_readBlock_17,
+ Method_writeBlock_18,
+ Method_writeBlock_19,
+ Method_readLine_20,
+ Method_readLine_21,
+ Method_getch_22,
+ Method_putch_23,
+ Method_ungetch_24,
+ Method_handle_25,
+ Method_errorString_26,
+ Method_encodeName_27,
+ Method_decodeName_28,
+ Method_setEncodingFunction_29,
+ Method_setDecodingFunction_30,
+ Method_exists_31,
+ Method_remove_32,
+ Method_Last = -1
+ };
+
+ QFileImp( KJS::ExecState *exec, int id, bool constructor=false );
+ ~QFileImp();
+
+ static void addBindings( KJS::ExecState *exec, KJS::Object &object );
+
+ static QFile *toQFile( KJS::Object &object );
+
+ //
+ // Constructors implemented by this class.
+ //
+
+ KJS::Object QFile_1( KJS::ExecState *exec, const KJS::List &args );
+ KJS::Object QFile_2( KJS::ExecState *exec, const KJS::List &args );
+
+ //
+ // Methods implemented by this class.
+ //
+
+ KJS::Value name_4( KJS::ExecState *exec, KJS::Object &obj, const KJS::List &args );
+ KJS::Value setName_5( KJS::ExecState *exec, KJS::Object &obj, const KJS::List &args );
+ KJS::Value exists_6( KJS::ExecState *exec, KJS::Object &obj, const KJS::List &args );
+ KJS::Value remove_7( KJS::ExecState *exec, KJS::Object &obj, const KJS::List &args );
+ KJS::Value open_8( KJS::ExecState *exec, KJS::Object &obj, const KJS::List &args );
+ KJS::Value open_9( KJS::ExecState *exec, KJS::Object &obj, const KJS::List &args );
+ KJS::Value open_10( KJS::ExecState *exec, KJS::Object &obj, const KJS::List &args );
+ KJS::Value close_11( KJS::ExecState *exec, KJS::Object &obj, const KJS::List &args );
+ KJS::Value flush_12( KJS::ExecState *exec, KJS::Object &obj, const KJS::List &args );
+ KJS::Value size_13( KJS::ExecState *exec, KJS::Object &obj, const KJS::List &args );
+ KJS::Value at_14( KJS::ExecState *exec, KJS::Object &obj, const KJS::List &args );
+ KJS::Value at_15( KJS::ExecState *exec, KJS::Object &obj, const KJS::List &args );
+ KJS::Value atEnd_16( KJS::ExecState *exec, KJS::Object &obj, const KJS::List &args );
+ KJS::Value readBlock_17( KJS::ExecState *exec, KJS::Object &obj, const KJS::List &args );
+ KJS::Value writeBlock_18( KJS::ExecState *exec, KJS::Object &obj, const KJS::List &args );
+ KJS::Value writeBlock_19( KJS::ExecState *exec, KJS::Object &obj, const KJS::List &args );
+ KJS::Value readLine_20( KJS::ExecState *exec, KJS::Object &obj, const KJS::List &args );
+ KJS::Value readLine_21( KJS::ExecState *exec, KJS::Object &obj, const KJS::List &args );
+ KJS::Value getch_22( KJS::ExecState *exec, KJS::Object &obj, const KJS::List &args );
+ KJS::Value putch_23( KJS::ExecState *exec, KJS::Object &obj, const KJS::List &args );
+ KJS::Value ungetch_24( KJS::ExecState *exec, KJS::Object &obj, const KJS::List &args );
+ KJS::Value handle_25( KJS::ExecState *exec, KJS::Object &obj, const KJS::List &args );
+ KJS::Value errorString_26( KJS::ExecState *exec, KJS::Object &obj, const KJS::List &args );
+ KJS::Value encodeName_27( KJS::ExecState *exec, KJS::Object &obj, const KJS::List &args );
+ KJS::Value decodeName_28( KJS::ExecState *exec, KJS::Object &obj, const KJS::List &args );
+ KJS::Value setEncodingFunction_29( KJS::ExecState *exec, KJS::Object &obj, const KJS::List &args );
+ KJS::Value setDecodingFunction_30( KJS::ExecState *exec, KJS::Object &obj, const KJS::List &args );
+ KJS::Value exists_31( KJS::ExecState *exec, KJS::Object &obj, const KJS::List &args );
+ KJS::Value remove_32( KJS::ExecState *exec, KJS::Object &obj, const KJS::List &args );
+
+ //
+ // JS binding code.
+ //
+
+ /** Returns true iff this object implements the construct function. */
+ virtual bool implementsConstruct() const { return cons; }
+
+ /** Invokes the construct function. */
+ virtual KJS::Object construct( KJS::ExecState *exec, const KJS::List &args );
+
+ /** Returns true iff this object implements the call function. */
+ virtual bool implementsCall() const { return !cons; }
+
+ /** Invokes the call function. */
+ virtual KJS::Value call( KJS::ExecState *exec, KJS::Object &self, const KJS::List &args );
+
+private:
+ QFile *instance; // Temp
+ int id;
+ bool cons;
+};
+
+} // namespace KJSEmbed
+
+#endif // KJSEMBED_QFile_H
+
+// Local Variables:
+// c-basic-offset: 4
+// End:
+
+
diff --git a/kjsembed/builtins/resources.cpp b/kjsembed/builtins/resources.cpp
new file mode 100644
index 00000000..14912303
--- /dev/null
+++ b/kjsembed/builtins/resources.cpp
@@ -0,0 +1,231 @@
+/*
+ * Copyright (C) 2003, Richard J. Moore <rich@kde.org>
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Library General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Library General Public License for more details.
+ *
+ * You should have received a copy of the GNU Library General Public License
+ * along with this library; see the file COPYING.LIB. If not, write to
+ * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
+ * Boston, MA 02110-1301, USA.
+ */
+
+#include <kstandarddirs.h>
+#include <kiconloader.h>
+#include <kglobal.h>
+#include <kdebug.h>
+#include <jsproxy.h>
+#include <jsbinding.h>
+#include <jsfactory.h>
+#include <qdir.h>
+#include <qapplication.h>
+#include "resources.h"
+
+namespace KJSEmbed {
+namespace BuiltIns {
+
+
+StdDirsImp::StdDirsImp( KJS::ExecState *exec, uint mid )
+ : JSProxyImp(exec), id(mid)
+{
+
+}
+
+StdDirsImp::~StdDirsImp() {}
+
+void StdDirsImp::addBindings( KJS::ExecState *exec, KJS::Object &parent )
+{
+
+ JSProxy::MethodTable methods[] = {
+ { StdDirsImp::findResource, "findResource" },
+ { StdDirsImp::addResourceType, "addResourceType" },
+ { StdDirsImp::kde_default, "kde_default" },
+ { StdDirsImp::addResourceDir, "addResourceDir" },
+ { StdDirsImp::findResourceDir, "findResourceDir" },
+ { StdDirsImp::saveLocation, "saveLocation" },
+ { StdDirsImp::makeDir, "makeDir" },
+ { StdDirsImp::exists, "exists" },
+ { StdDirsImp::realPath, "realPath" },
+ { StdDirsImp::currentDirPath, "currentDirPath" },
+ { StdDirsImp::homeDirPath, "homeDirPath" },
+ { StdDirsImp::applicationDirPath, "applicationDirPath" },
+ { 0, 0 }
+ };
+
+ int idx = 0;
+ do {
+ StdDirsImp *sdi = new StdDirsImp( exec, idx );
+ parent.put( exec , methods[idx].name, KJS::Object(sdi) );
+ ++idx;
+ } while( methods[idx].id );
+
+}
+
+KJS::Value StdDirsImp::call( KJS::ExecState *exec, KJS::Object &/*self*/, const KJS::List &args )
+{
+// QString arg0 = extractQString(exec, args, 0);
+// QString arg1 = extractQString(exec, args, 1);
+
+ switch( id ) {
+ case StdDirsImp::findResource:
+ {
+ QString arg0 = extractQString(exec, args, 0);
+ QString arg1 = extractQString(exec, args, 1);
+ QString path = KGlobal::dirs ()->findResource(arg0.latin1(), arg1);
+ return KJS::String( path );
+ }
+ case StdDirsImp::addResourceType:
+ {
+ QString arg0 = extractQString(exec, args, 0);
+ QString arg1 = extractQString(exec, args, 1);
+ bool isOk = KGlobal::dirs ()->addResourceType(arg0.latin1(), arg1);
+ return KJS::Boolean( isOk );
+ }
+ case StdDirsImp::kde_default:
+ {
+ QString arg0 = extractQString(exec, args, 0);
+ QString path = KGlobal::dirs ()->kde_default(arg0.latin1());
+ return KJS::String( path );
+ }
+ case StdDirsImp::addResourceDir:
+ {
+ QString arg0 = extractQString(exec, args, 0);
+ QString arg1 = extractQString(exec, args, 1);
+ bool isOk = KGlobal::dirs ()->addResourceDir(arg0.latin1(), arg1);
+ return KJS::Boolean( isOk );
+ }
+ case StdDirsImp::findResourceDir:
+ {
+ QString arg0 = extractQString(exec, args, 0);
+ QString arg1 = extractQString(exec, args, 1);
+ QString path = KGlobal::dirs ()->findResourceDir(arg0.latin1(), arg1);
+ return KJS::String( path );
+ }
+ case StdDirsImp::saveLocation:
+ {
+ QString arg0 = extractQString(exec, args, 0);
+ QString arg1 = extractQString(exec, args, 1);
+ bool arg2 = (args.size() > 2) ? args[2].toBoolean(exec) : true;
+ QString path = KGlobal::dirs ()->saveLocation(arg0.latin1(), arg1, arg2);
+ return KJS::String( path );
+ }
+ case StdDirsImp::makeDir:
+ {
+ QString arg0 = extractQString(exec, args, 0);
+ int arg1 = (args.size() > 1) ? args[1].toInteger(exec) : 0755;
+ bool isOk = KStandardDirs::makeDir(arg0, arg1);
+ return KJS::Boolean( isOk );
+ }
+ case StdDirsImp::exists:
+ {
+ QString arg0 = extractQString(exec, args, 0);
+ bool isOk = KStandardDirs::exists(arg0);
+ return KJS::Boolean( isOk );
+ }
+ case StdDirsImp::realPath:
+ {
+ QString arg0 = extractQString(exec, args, 0);
+ QString path = KStandardDirs::realPath(arg0);
+ return KJS::String( path );
+ }
+ case StdDirsImp::currentDirPath:
+ return KJS::String(QDir::currentDirPath());
+ case StdDirsImp::homeDirPath:
+ return KJS::String(QDir::homeDirPath());
+ case StdDirsImp::applicationDirPath:
+ return KJS::String(qApp->applicationDirPath());
+ default:
+ kdWarning() << "StdDirsImp has no method " << id << endl;
+ }
+
+ kdWarning() << "StdDirsImp returning null" << endl;
+
+ return KJS::Null();
+}
+
+StdIconsImp::StdIconsImp( JSFactory *fact, KJS::ExecState *exec, uint mid )
+ : JSProxyImp(exec), id(mid), jsfact(fact)
+{
+}
+
+StdIconsImp::~StdIconsImp() {}
+
+void StdIconsImp::addBindings( JSFactory *fact, KJS::ExecState *exec, KJS::Object &parent )
+{
+ JSProxy::MethodTable methods[] = {
+ { StdIconsImp::BarIcon, "BarIcon" },
+ { StdIconsImp::DesktopIcon, "DesktopIcon" },
+ { StdIconsImp::SmallIcon, "SmallIcon" },
+ { StdIconsImp::MainBarIcon, "MainBarIcon" },
+ { StdIconsImp::UserIcon, "UserIcon" },
+ { StdIconsImp::MimeSourceIcon, "MimeSourceIcon" },
+ { 0, 0 }
+ };
+
+ int idx = 0;
+ do {
+ StdIconsImp *sdi = new StdIconsImp( fact, exec, idx );
+ parent.put( exec , methods[idx].name, KJS::Object(sdi) );
+ ++idx;
+ } while( methods[idx].id );
+
+}
+
+KJS::Value StdIconsImp::wrapPixmap(KJS::ExecState *exec, const QPixmap &icon)
+{
+ return convertToValue(exec, icon);
+}
+
+KJS::Value StdIconsImp::call( KJS::ExecState *exec, KJS::Object &/*obj*/, const KJS::List &args )
+{
+ QString arg0 = extractQString(exec, args, 0); // Name
+ int arg1 = extractInt(exec, args, 1); // Size 0, 16, 24, 32, 48, 64, 128
+ int arg2 = extractInt(exec, args, 2);
+ // State 0 DefaultState, 1 ActiveState, 2 DisabledState, 3 LastState
+ switch( id ) {
+ case StdIconsImp::BarIcon:
+ {
+ return wrapPixmap(exec, ::BarIcon(arg0, arg1, arg2));
+ }
+ case StdIconsImp::DesktopIcon:
+ {
+ return wrapPixmap(exec, ::DesktopIcon(arg0, arg1, arg2));
+ }
+ case StdIconsImp::SmallIcon:
+ {
+ return wrapPixmap(exec, ::SmallIcon(arg0, arg1, arg2));
+ }
+ case StdIconsImp::MainBarIcon:
+ {
+ return wrapPixmap(exec, ::MainBarIcon(arg0, arg1, arg2));
+ }
+ case StdIconsImp::UserIcon:
+ {
+ return wrapPixmap(exec, ::UserIcon(arg0, arg2));
+ }
+ case StdIconsImp::MimeSourceIcon:
+ {
+ return wrapPixmap( exec, QPixmap::fromMimeSource(arg0));
+ }
+ default:
+ kdWarning() << "StdDirsImp has no method " << id << endl;
+ }
+
+ kdWarning() << "StdDirsImp returning null" << endl;
+
+ return KJS::Null();
+}
+
+} // namespace KJSEmbed::BuiltIns
+} // namespace KJSEmbed
+
+// Local Variables:
+// c-basic-offset: 4
+// End:
diff --git a/kjsembed/builtins/resources.h b/kjsembed/builtins/resources.h
new file mode 100644
index 00000000..d83cd0b3
--- /dev/null
+++ b/kjsembed/builtins/resources.h
@@ -0,0 +1,99 @@
+// -*- c++ -*-
+
+/*
+ * Copyright (C) 2003, Ian Reinhart Geiser <geiseri@kde.org>
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Library General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Library General Public License for more details.
+ *
+ * You should have received a copy of the GNU Library General Public License
+ * along with this library; see the file COPYING.LIB. If not, write to
+ * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
+ * Boston, MA 02110-1301, USA.
+ */
+
+#ifndef KJSEMBED_RESOURCES_H
+#define KJSEMBED_RESOURCES_H
+
+#include <qpixmap.h>
+
+#include <kjs/interpreter.h>
+#include <kjs/object.h>
+
+#include <kjsembed/jsobjectproxy_imp.h>
+
+namespace KJSEmbed {
+namespace BuiltIns {
+
+/**
+ * KJS binding for KStandardDirs.
+ *
+ * @author Ian Reinhart Geiser geiseri@kde.org
+ */
+class StdDirsImp : public JSProxyImp
+{
+
+public:
+ /** Identifiers for the various methods. */
+ enum DirMethods {
+ findResource, addResourceType, kde_default,
+ addResourceDir, findResourceDir, saveLocation,
+ makeDir, exists, realPath, currentDirPath,
+ homeDirPath, applicationDirPath };
+ StdDirsImp( KJS::ExecState *exec, uint id );
+ virtual ~StdDirsImp();
+
+ /** Adds the StdActions object to the specified parent. */
+ static void addBindings( KJS::ExecState *exec, KJS::Object &parent );
+
+ /** Returns true iff this object implements the call function. */
+ virtual bool implementsCall() const { return true; }
+
+ /** Invokes the call function. */
+ virtual KJS::Value call( KJS::ExecState *exec, KJS::Object &self, const KJS::List &args );
+
+private:
+ uint id;
+ JSFactory *jsfact;
+};
+
+
+/**
+ * KJS binding for KIconLoader.
+ *
+ * @author Ian Reinhart Geiser geiseri@kde.org
+ */
+class StdIconsImp : public JSProxyImp
+{
+public:
+ enum IconMethods { BarIcon, DesktopIcon, SmallIcon, MainBarIcon, UserIcon, MimeSourceIcon };
+ StdIconsImp(JSFactory *fac, KJS::ExecState *exec, uint id );
+ virtual ~StdIconsImp();
+
+ /** Adds the StdActions object to the specified parent. */
+ static void addBindings( JSFactory *fac, KJS::ExecState *exec, KJS::Object &parent );
+
+ /** Returns true iff this object implements the call function. */
+ virtual bool implementsCall() const { return true; }
+
+ /** Invokes the call function. */
+ virtual KJS::Value call( KJS::ExecState *exec, KJS::Object &self, const KJS::List &args );
+
+private:
+ /** wrap a QPixmap **/
+ KJS::Value wrapPixmap(KJS::ExecState *exec,const QPixmap &icon);
+ uint id;
+ JSFactory *jsfact;
+};
+
+} // namespace BuiltIns
+} // namespace KJSEmbed
+
+#endif // KJSEMBED_RESOURCES_H
diff --git a/kjsembed/builtins/saxhandler.cpp b/kjsembed/builtins/saxhandler.cpp
new file mode 100644
index 00000000..d4a6f5f3
--- /dev/null
+++ b/kjsembed/builtins/saxhandler.cpp
@@ -0,0 +1,186 @@
+/*
+ * Copyright (C) 2003, Richard J. Moore <rich@kde.org>
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Library General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Library General Public License for more details.
+ *
+ * You should have received a copy of the GNU Library General Public License
+ * along with this library; see the file COPYING.LIB. If not, write to
+ * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
+ * Boston, MA 02110-1301, USA.
+ */
+#include "kjsembed/jsbinding.h"
+#include "saxhandler.h"
+
+namespace KJSEmbed {
+namespace BuiltIns {
+
+SaxHandler::SaxHandler( KJS::ExecState *execstate )
+ : QXmlDefaultHandler(), exec(execstate), error( ErrorNone )
+{
+}
+
+SaxHandler::~SaxHandler()
+{
+}
+
+void SaxHandler::setHandler( const KJS::Object &handler )
+{
+ jshandler = handler;
+}
+
+bool SaxHandler::startDocument()
+{
+ if ( !jshandler.isValid() ) {
+ error = ErrorNoHandler;
+ return false;
+ }
+
+ KJS::Identifier funName("startDocument");
+ if ( !jshandler.hasProperty(exec, funName) )
+ return QXmlDefaultHandler::startDocument();
+
+ KJS::Object fun = jshandler.get(exec, funName).toObject( exec );
+ if ( !fun.implementsCall() ) {
+ error = ErrorNotCallable;
+ return false;
+ }
+
+ KJS::Value ret = fun.call( exec, jshandler, KJS::List() );
+ return ret.toBoolean( exec );
+}
+
+bool SaxHandler::endDocument()
+{
+ if ( !jshandler.isValid() ) {
+ error = ErrorNoHandler;
+ return false;
+ }
+
+ KJS::Identifier funName("endDocument");
+ if ( !jshandler.hasProperty(exec, funName) )
+ return QXmlDefaultHandler::endDocument();
+
+ KJS::Object fun = jshandler.get(exec, funName).toObject( exec );
+ if ( !fun.implementsCall() ) {
+ error = ErrorNotCallable;
+ return false;
+ }
+
+ KJS::Value ret = fun.call( exec, jshandler, KJS::List() );
+ return ret.toBoolean( exec );
+}
+
+bool SaxHandler::startElement( const QString &ns, const QString &ln, const QString &qn,
+ const QXmlAttributes &attrs )
+{
+ if ( !jshandler.isValid() ) {
+ error = ErrorNoHandler;
+ return false;
+ }
+
+ KJS::Identifier funName("startElement");
+ if ( !jshandler.hasProperty(exec, funName) )
+ return QXmlDefaultHandler::startElement( ns, ln, qn, attrs );
+
+ KJS::Object fun = jshandler.get(exec, funName).toObject( exec );
+ if ( !fun.implementsCall() ) {
+ error = ErrorNotCallable;
+ return false;
+ }
+
+ KJS::List args;
+ args.append( KJS::String(ns) );
+ args.append( KJS::String(ln) );
+ args.append( KJS::String(qn) );
+ // TODO: XmlAttributes not yet supported
+
+ KJS::Value ret = fun.call( exec, jshandler, args );
+ return ret.toBoolean( exec );
+}
+
+bool SaxHandler::endElement( const QString &ns, const QString &ln, const QString &qn )
+{
+ if ( !jshandler.isValid() ) {
+ error = ErrorNoHandler;
+ return false;
+ }
+
+ KJS::Identifier funName("endElement");
+ if ( !jshandler.hasProperty(exec, funName) )
+ return QXmlDefaultHandler::endElement( ns, ln, qn );
+
+ KJS::Object fun = jshandler.get(exec, funName).toObject( exec );
+ if ( !fun.implementsCall() ) {
+ error = ErrorNotCallable;
+ return false;
+ }
+
+ KJS::List args;
+ args.append( KJS::String(ns) );
+ args.append( KJS::String(ln) );
+ args.append( KJS::String(qn) );
+
+ KJS::Value ret = fun.call( exec, jshandler, args );
+ return ret.toBoolean( exec );
+}
+
+bool SaxHandler::characters( const QString &chars )
+{
+ if ( !jshandler.isValid() ) {
+ error = ErrorNoHandler;
+ return false;
+ }
+
+ KJS::Identifier funName("characters");
+ if ( !jshandler.hasProperty(exec, funName) )
+ return QXmlDefaultHandler::characters( chars );
+
+ KJS::Object fun = jshandler.get(exec, funName).toObject( exec );
+ if ( !fun.implementsCall() ) {
+ error = ErrorNotCallable;
+ return false;
+ }
+
+ KJS::List args;
+ args.append( KJS::String(chars) );
+
+ KJS::Value ret = fun.call( exec, jshandler, args );
+ return ret.toBoolean( exec );
+}
+
+QString SaxHandler::errorString()
+{
+ switch( error ) {
+
+ case ErrorNoHandler:
+ return QString("No handler specified");
+ break;
+ case ErrorNotCallable:
+ return QString("One of the callbacks of the handler is not callable");
+ break;
+ case ErrorNone:
+ // This only means that no error occured in the JS dispatch, there
+ // could still have been an error from the parser so we fall
+ // though to call the baseclass.
+ break;
+ default:
+ break;
+ }
+
+ return QXmlDefaultHandler::errorString();
+}
+
+} // namespace KJSEmbed::BuiltIns
+} // namespace KJSEmbed
+
+// Local Variables:
+// c-basic-offset: 4
+// End:
diff --git a/kjsembed/builtins/saxhandler.h b/kjsembed/builtins/saxhandler.h
new file mode 100644
index 00000000..f396dbfe
--- /dev/null
+++ b/kjsembed/builtins/saxhandler.h
@@ -0,0 +1,80 @@
+// -*- c++ -*-
+
+/*
+ * Copyright (C) 2003, Richard J. Moore <rich@kde.org>
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Library General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Library General Public License for more details.
+ *
+ * You should have received a copy of the GNU Library General Public License
+ * along with this library; see the file COPYING.LIB. If not, write to
+ * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
+ * Boston, MA 02110-1301, USA.
+ */
+
+#ifndef KJSEMBED_SAXHANDLER_H
+#define KJSEMBED_SAXHANDLER_H
+
+#include <qxml.h>
+#include <kjs/object.h>
+
+namespace KJSEmbed {
+namespace BuiltIns {
+
+/**
+ * SAX handler that calls JS methods according to the SAX API.
+ *
+ * @author Richard Moore, rich@kde.org
+ */
+class SaxHandler : public QXmlDefaultHandler
+{
+public:
+ /** Defines the errors that are specific to the KJS SAX support. */
+ enum SaxHandlerError {
+ ErrorNone,
+ ErrorNoHandler,
+ ErrorNotCallable
+ };
+
+ /** Creates a SaxHandler. */
+ SaxHandler( KJS::ExecState *exec );
+ /** Cleans up. */
+ virtual ~SaxHandler();
+
+ /**
+ * Sets the handler object that defines the callbacks to be invoked
+ * according to the SAX api.
+ */
+ void setHandler( const KJS::Object &handler );
+
+ virtual bool startDocument();
+ virtual bool endDocument();
+
+ virtual bool startElement( const QString &ns, const QString &ln, const QString &qn,
+ const QXmlAttributes &attrs );
+ virtual bool endElement( const QString &ns, const QString &ln, const QString &qn );
+ virtual bool characters( const QString &chars );
+
+ virtual QString errorString();
+
+private:
+ KJS::ExecState *exec;
+ KJS::Object jshandler;
+ int error;
+
+ class SaxHandlerPrivate *d;
+};
+
+} // namespace KJSEmbed::BuiltIns
+} // namespace KJSEmbed
+
+#endif // KJSEMBED_SAXHANDLER_H
+
+
diff --git a/kjsembed/builtins/stdaction_imp.cpp b/kjsembed/builtins/stdaction_imp.cpp
new file mode 100644
index 00000000..1361acf8
--- /dev/null
+++ b/kjsembed/builtins/stdaction_imp.cpp
@@ -0,0 +1,99 @@
+/*
+ * Copyright (C) 2003, Richard J. Moore <rich@kde.org>
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Library General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Library General Public License for more details.
+ *
+ * You should have received a copy of the GNU Library General Public License
+ * along with this library; see the file COPYING.LIB. If not, write to
+ * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
+ * Boston, MA 02110-1301, USA.
+ */
+
+#include <kaction.h>
+#include <kdebug.h>
+#include <kstdaction.h>
+
+#include <jsfactory.h>
+#include <jsobjectproxy.h>
+
+#include "stdaction_imp.h"
+
+namespace KJSEmbed {
+namespace BuiltIns {
+
+StdActionImp::StdActionImp( KJS::ExecState *exec, JSFactory *fact, uint actid )
+ : JSProxyImp(exec), id(actid), jsfact( fact )
+{
+}
+
+StdActionImp::~StdActionImp()
+{
+}
+
+static uint KSTDACTION_START = KStdAction::New;
+static uint KSTDACTION_END = KStdAction::ConfigureNotifications+1;
+
+const char *factoryMethodNames[] = {
+ "START_MARKER",
+ "fileNew", "open", "openRecent", "save", "saveAs", "revert", "close",
+ "print", "printPreview", "mail", "quit",
+ "undo", "redo", "cut", "copy", "paste", "selectAll", "deselect", "find", "findNext", "findPrev",
+ "replace",
+ "actualSize", "fitToPage", "fitToWidth", "fitToHeight", "zoomIn", "zoomOut",
+ "zoom", "redisplay",
+ "up", "back", "forward", "home", "prior", "next", "goGoto", "gotoPage", "gotoLine",
+ "firstPage", "lastPage",
+ "addBookmark", "editBookmarks",
+ "spelling",
+ "showMenubar", "showToolbar", "showStatusbar", "saveOptions", "keyBindings",
+ "preferences", "configureToolbars",
+ "help", "helpContents", "whatsThis", "reportBug", "aboutApp", "aboutKDE",
+ "tipofDay",
+ "configureNotifications",
+ "END_MARKER"
+};
+
+void StdActionImp::addBindings( JSFactory *fact, KJS::ExecState *exec, KJS::Object &parent )
+{
+ for ( uint i = KSTDACTION_START; i < KSTDACTION_END; i++ ) {
+ StdActionImp *sai = new StdActionImp( exec, fact, i );
+ parent.put( exec, factoryMethodNames[i], KJS::Object( sai ) );
+ }
+}
+
+KJS::Value StdActionImp::call( KJS::ExecState *exec, KJS::Object &/*self*/, const KJS::List &args )
+{
+ if ( ( args.size() < 3 ) || ( args.size() > 4 ) )
+ return KJS::Null();
+
+ // recv, slot, parent, name?
+ QObject *recv = extractQObject( exec, args, 0);
+
+ QString sl = extractQString( exec, args, 1 );
+ const char *slc = sl.isNull() ? "" : sl.ascii();
+
+ QObject *parentobj = extractQObject( exec, args, 2 );
+ KActionCollection *parent = parentobj ? dynamic_cast<KActionCollection *>( parentobj ) : 0;
+
+ KStdAction::StdAction actid = static_cast<KStdAction::StdAction>(id);
+ const char *arg3 = (args.size() == 4) ? args[3].toString(exec).ascii() : KStdAction::name( actid );
+
+ // Create the object
+ KAction *act = KStdAction::create( actid, arg3, recv, slc, parent );
+ return jsfact->createProxy( exec, act );
+}
+
+} // namespace KJSEmbed::BuiltIns
+} // namespace KJSEmbed
+
+// Local Variables:
+// c-basic-offset: 4
+// End:
diff --git a/kjsembed/builtins/stdaction_imp.h b/kjsembed/builtins/stdaction_imp.h
new file mode 100644
index 00000000..9a64174b
--- /dev/null
+++ b/kjsembed/builtins/stdaction_imp.h
@@ -0,0 +1,68 @@
+// -*- c++ -*-
+
+/*
+ * Copyright (C) 2003, Richard J. Moore <rich@kde.org>
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Library General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Library General Public License for more details.
+ *
+ * You should have received a copy of the GNU Library General Public License
+ * along with this library; see the file COPYING.LIB. If not, write to
+ * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
+ * Boston, MA 02110-1301, USA.
+ */
+
+#ifndef KJSEMBED_STDACTION_IMP_H
+#define KJSEMBED_STDACTION_IMP_H
+
+#include <kjs/interpreter.h>
+#include <kjs/object.h>
+
+#include <kjsembed/jsobjectproxy_imp.h>
+
+/**
+ * Namespace containing the KJSEmbed library.
+ */
+namespace KJSEmbed {
+namespace BuiltIns {
+
+/**
+ * KJS bindings to KStdAction.
+ *
+ * @author Richard Moore, rich@kde.org
+ */
+class StdActionImp : public JSProxyImp
+{
+public:
+ StdActionImp( KJS::ExecState *exec, JSFactory *fact, uint id );
+ virtual ~StdActionImp();
+
+ /** Adds the StdActions object to the specified parent. */
+ static void addBindings( JSFactory *fact, KJS::ExecState *exec, KJS::Object &parent );
+
+ /** Returns true iff this object implements the call function. */
+ virtual bool implementsCall() const { return true; }
+
+ /** Invokes the call function. */
+ virtual KJS::Value call( KJS::ExecState *exec, KJS::Object &self, const KJS::List &args );
+
+private:
+ uint id;
+ JSFactory *jsfact;
+};
+
+} // namespace KJSEmbed::BuiltIns
+} // namespace KJSEmbed
+
+#endif // KJSEMBED_STDACTION_IMP_H
+
+// Local Variables:
+// c-basic-offset: 4
+// End:
diff --git a/kjsembed/builtins/stddialog_imp.cpp b/kjsembed/builtins/stddialog_imp.cpp
new file mode 100644
index 00000000..1b45c5e0
--- /dev/null
+++ b/kjsembed/builtins/stddialog_imp.cpp
@@ -0,0 +1,147 @@
+/*
+ * Copyright (C) 2003, Richard J. Moore <rich@kde.org>
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Library General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Library General Public License for more details.
+ *
+ * You should have received a copy of the GNU Library General Public License
+ * along with this library; see the file COPYING.LIB. If not, write to
+ * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
+ * Boston, MA 02110-1301, USA.
+ */
+
+#ifndef QT_ONLY
+
+#include <kcolordialog.h>
+#include <kfiledialog.h>
+#include <kpropertiesdialog.h>
+
+#else
+
+#include <qfiledialog.h>
+#define KFileDialog QFileDialog
+
+#endif // QT_ONLY
+
+#include <kjsembed/jsbinding.h>
+#include <kjsembed/global.h>
+
+#include "stddialog_imp.h"
+
+namespace KJSEmbed {
+namespace BuiltIns {
+
+StdDialogImp::StdDialogImp( KJS::ExecState *exec, int mid )
+ : JSProxyImp(exec), id(mid)
+{
+}
+
+StdDialogImp::~StdDialogImp() {}
+
+void StdDialogImp::addBindings( KJS::ExecState *exec, KJS::Object &parent )
+{
+ StdDialogImp *sdi;
+
+ sdi = new StdDialogImp( exec, StdDialogImp::MethodGetOpenFileName );
+ parent.put( exec, "getOpenFileName", KJS::Object( sdi ) );
+ sdi = new StdDialogImp( exec, StdDialogImp::MethodGetSaveFileName );
+ parent.put( exec, "getSaveFileName", KJS::Object( sdi ) );
+
+ sdi = new StdDialogImp( exec, StdDialogImp::MethodGetOpenURL );
+ parent.put( exec, "getOpenURL", KJS::Object( sdi ) );
+ sdi = new StdDialogImp( exec, StdDialogImp::MethodGetSaveURL );
+ parent.put( exec, "getSaveURL", KJS::Object( sdi ) );
+
+ sdi = new StdDialogImp( exec, StdDialogImp::MethodGetExistingDirectory );
+ parent.put( exec, "getExistingDirectory", KJS::Object( sdi ) );
+ sdi = new StdDialogImp( exec, StdDialogImp::MethodGetExistingURL );
+ parent.put( exec, "getExistingURL", KJS::Object( sdi ) );
+
+ sdi = new StdDialogImp( exec, StdDialogImp::MethodGetImageOpenURL );
+ parent.put( exec, "getImageOpenURL", KJS::Object( sdi ) );
+
+ sdi = new StdDialogImp( exec, StdDialogImp::MethodGetColor );
+ parent.put( exec, "getColor", KJS::Object( sdi ) );
+
+ sdi = new StdDialogImp( exec, StdDialogImp::MethodShowProperties );
+ parent.put( exec, "showProperties", KJS::Object( sdi ) );
+}
+
+KJS::Value StdDialogImp::call( KJS::ExecState *exec, KJS::Object &/*self*/, const KJS::List &args )
+{
+ QString arg0 = (args.size() > 0) ? args[0].toString(exec).qstring() : QString::null;
+ QString arg1 = (args.size() > 1) ? args[1].toString(exec).qstring() : QString::null;
+
+ switch( id ) {
+ case MethodGetOpenFileName:
+ {
+ QString s = KFileDialog::getOpenFileName( arg0, arg1 );
+ return KJS::String( s );
+ }
+ case MethodGetSaveFileName:
+ {
+ QString s = KFileDialog::getSaveFileName( arg0, arg1 );
+ return KJS::String( s );
+ }
+ case MethodGetExistingDirectory:
+ {
+ QString s = KFileDialog::getExistingDirectory( arg0 );
+ return KJS::String( s );
+ }
+#ifndef QT_ONLY
+ case MethodGetColor:
+ {
+ QColor col;
+ int res = KColorDialog::getColor( col );
+ if ( res == QDialog::Accepted )
+ return convertToValue( exec, QVariant(col) );
+ }
+ case MethodGetOpenURL:
+ {
+ KURL u = KFileDialog::getOpenURL( arg0, arg1 );
+ return KJS::String( u.url() );
+ }
+ case MethodGetSaveURL:
+ {
+ KURL u = KFileDialog::getSaveURL( arg0, arg1 );
+ return KJS::String( u.url() );
+ }
+ case MethodGetExistingURL:
+ {
+ KURL u = KFileDialog::getExistingURL( arg0 );
+ return KJS::String( u.url() );
+ }
+ case MethodGetImageOpenURL:
+ {
+ KURL u = KFileDialog::getImageOpenURL( arg0 );
+ return KJS::String( u.url() );
+ }
+ case MethodShowProperties:
+ {
+ // The default args mean this dialog auto-shows
+ /*KPropertiesDialog *dlg =*/ new KPropertiesDialog( KURL(arg0) );
+ return KJS::Null();
+ }
+#endif // QT_ONLY
+ default:
+ kdWarning() << "StdDialogImp has no method " << id << endl;
+ }
+
+ kdWarning() << "StdDialogImp returning null" << endl;
+
+ return KJS::Null();
+}
+
+} // namespace KJSEmbed::BuiltIns
+} // namespace KJSEmbed
+
+// Local Variables:
+// c-basic-offset: 4
+// End:
diff --git a/kjsembed/builtins/stddialog_imp.h b/kjsembed/builtins/stddialog_imp.h
new file mode 100644
index 00000000..ea70db73
--- /dev/null
+++ b/kjsembed/builtins/stddialog_imp.h
@@ -0,0 +1,81 @@
+// -*- c++ -*-
+
+/*
+ * Copyright (C) 2003, Richard J. Moore <rich@kde.org>
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Library General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Library General Public License for more details.
+ *
+ * You should have received a copy of the GNU Library General Public License
+ * along with this library; see the file COPYING.LIB. If not, write to
+ * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
+ * Boston, MA 02110-1301, USA.
+ */
+
+#ifndef KJSEMBED_STDDIALOG_IMP_H
+#define KJSEMBED_STDDIALOG_IMP_H
+
+#include <kjs/interpreter.h>
+#include <kjs/object.h>
+
+#include <kjsembed/jsobjectproxy_imp.h>
+
+/**
+ * Namespace containing the KJSEmbed library.
+ */
+namespace KJSEmbed {
+namespace BuiltIns {
+
+/**
+ * KJS bindings to the standard KDE dialogs.
+ *
+ * @author Richard Moore, rich@kde.org
+ */
+class StdDialogImp : public JSProxyImp
+{
+public:
+ /** Identifiers for the various methods. */
+ enum MethodId {
+ // KFileDialog
+ MethodGetOpenFileName, MethodGetSaveFileName,
+ MethodGetOpenURL, MethodGetSaveURL,
+ MethodGetExistingDirectory, MethodGetExistingURL,
+ MethodGetImageOpenURL,
+
+ // KColorDialog
+ MethodGetColor,
+ // KPropertiesDialog
+ MethodShowProperties
+ };
+
+ StdDialogImp( KJS::ExecState *exec, int id );
+ ~StdDialogImp();
+
+ /** Adds the StdDialogs object to the specified parent. */
+ static void addBindings( KJS::ExecState *exec, KJS::Object &parent );
+
+ /** Returns true iff this object implements the call function. */
+ virtual bool implementsCall() const { return true; }
+
+ /** Invokes the call function. */
+ virtual KJS::Value call( KJS::ExecState *exec, KJS::Object &self, const KJS::List &args );
+
+private:
+ uint id;
+};
+
+} // namespace KJSEmbed::BuiltIns
+} // namespace KJSEmbed
+
+#endif // KJSEMBED_STDDIALOG_IMP_H
+
+// Local Variables:
+// c-basic-offset: 4
+// End:
diff --git a/kjsembed/builtins/textstream_imp.cpp b/kjsembed/builtins/textstream_imp.cpp
new file mode 100644
index 00000000..6be24dd9
--- /dev/null
+++ b/kjsembed/builtins/textstream_imp.cpp
@@ -0,0 +1,134 @@
+/*
+ * Copyright (C) 2003, Richard J. Moore <rich@kde.org>
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Library General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Library General Public License for more details.
+ *
+ * You should have received a copy of the GNU Library General Public License
+ * along with this library; see the file COPYING.LIB. If not, write to
+ * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
+ * Boston, MA 02110-1301, USA.
+ */
+
+#include <qtextstream.h>
+#include <qiodevice.h>
+
+#include <kjsembed/global.h>
+#include <kjsembed/jsbinding.h>
+#include "jsopaqueproxy.h"
+#include "textstream_imp.h"
+
+namespace KJSEmbed {
+namespace BuiltIns {
+
+TextStreamImp::TextStreamImp( KJS::ExecState *exec, int mid, QTextStream *textstream )
+ : JSProxyImp(exec), id(mid), ts(textstream)
+{
+}
+
+TextStreamImp::~TextStreamImp()
+{
+}
+
+void TextStreamImp::addBindings( KJS::ExecState *exec, KJS::Object &parent )
+{
+ kdDebug() << "TextStreamImp::addBindings()" << endl;
+
+ JSOpaqueProxy *op = JSProxy::toOpaqueProxy( parent.imp() );
+ if ( !op ) {
+ kdWarning() << "TextStreamImp::addBindings() failed, not a JSOpaqueProxy" << endl;
+ return;
+ }
+
+ QTextStream *ts = op->toTextStream();
+ if ( !ts ) {
+ kdWarning() << "TextStreamImp::addBindings() failed, type is " << op->typeName() << endl;
+ return;
+ }
+
+ JSProxy::MethodTable methods[] = {
+ { MethodIsReadable, "isReadable" },
+ { MethodIsWritable, "isWritable" },
+ { MethodPrint, "print" },
+ { MethodPrintLn, "println" },
+ { MethodReadLine, "readLine" },
+ { MethodFlush, "flush" },
+ { 0, 0 }
+ };
+
+ int idx = 0;
+ do {
+ TextStreamImp *tsi = new TextStreamImp( exec, idx, ts );
+ parent.put( exec , methods[idx].name, KJS::Object(tsi) );
+ ++idx;
+ } while( methods[idx].id );
+}
+
+KJS::Value TextStreamImp::call( KJS::ExecState *exec, KJS::Object &/*self*/, const KJS::List &args )
+{
+ QString not_readable = i18n( "Attempt to read from a write-only text stream." );
+ QString not_writable = i18n( "Attempt to write to a read-only text stream." );
+
+ QString arg0 = extractQString(exec, args, 0);
+
+ QIODevice *dev = ts->device();
+ KJS::Object err;
+
+ switch ( id ) {
+ case MethodIsReadable:
+ return KJS::Boolean( dev->isReadable() );
+ break;
+ case MethodIsWritable:
+ return KJS::Boolean( dev->isWritable() );
+ break;
+ case MethodPrint:
+ if ( !dev->isWritable() ) {
+ return throwError(exec, not_writable.utf8());
+ }
+ (*ts) << arg0;
+ break;
+ case MethodPrintLn:
+ if ( !dev->isWritable() ) {
+ return throwError(exec, not_writable.utf8());
+ }
+ (*ts) << arg0 << endl;
+ break;
+ case MethodReadLine:
+ if ( dev->isReadable() ) {
+ QString line = ts->readLine();
+ if ( line.isNull() )
+ return KJS::Null();
+ else
+ return KJS::String( line );
+ }
+ else {
+ return throwError(exec, not_readable.utf8());
+ }
+ break;
+ case MethodFlush:
+ if ( !dev->isWritable() ) {
+ return throwError(exec, not_writable.utf8());
+ }
+ (*ts) << flush;
+ break;
+ default:
+ kdWarning() << "TextStreamImp has no method " << id << endl;
+ break;
+ }
+
+ return KJS::Value();
+}
+
+} // namespace KJSEmbed::BuiltIns
+} // namespace KJSEmbed
+
+// Local Variables:
+// c-basic-offset: 4
+// End:
diff --git a/kjsembed/builtins/textstream_imp.h b/kjsembed/builtins/textstream_imp.h
new file mode 100644
index 00000000..ca46fc37
--- /dev/null
+++ b/kjsembed/builtins/textstream_imp.h
@@ -0,0 +1,79 @@
+// -*- c++ -*-
+
+/*
+ * Copyright (C) 2003, Richard J. Moore <rich@kde.org>
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Library General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Library General Public License for more details.
+ *
+ * You should have received a copy of the GNU Library General Public License
+ * along with this library; see the file COPYING.LIB. If not, write to
+ * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
+ * Boston, MA 02110-1301, USA.
+ */
+
+#ifndef KJSEMBEDTEXTSTREAMIMP_H
+#define KJSEMBEDTEXTSTREAMIMP_H
+
+#include <kjs/object.h>
+#include <kjsembed/jsbinding.h>
+
+#include <kjsembed/jsobjectproxy_imp.h>
+
+class QTextStream;
+
+namespace KJSEmbed {
+namespace BuiltIns {
+
+/**
+ * Implements the JS methods of text stream object bindings.
+ *
+ * @author Richard Moore, rich@kde.org
+ * @version $Id$
+ */
+class TextStreamImp : public JSProxyImp
+{
+public:
+ /** Identifiers for the methods provided by this class. */
+ enum MethodId {
+ MethodIsReadable,
+ MethodIsWritable,
+ MethodPrint,
+ MethodPrintLn,
+ MethodReadLine,
+ MethodFlush
+ };
+
+ TextStreamImp( KJS::ExecState *exec, int id, QTextStream *ts );
+ ~TextStreamImp();
+
+ static void addBindings( KJS::ExecState *exec, KJS::Object &object );
+
+ /** Returns true iff this object implements the call function. */
+ virtual bool implementsCall() const { return true; }
+
+ /** Invokes the call function. */
+ virtual KJS::Value call( KJS::ExecState *exec, KJS::Object &self, const KJS::List &args );
+
+private:
+ int id;
+ QTextStream *ts;
+
+ class TextStreamImpPrivate *d;
+};
+
+} // namespace KJSEmbed::BuiltIns
+} // namespace KJSEmbed
+
+#endif // KJSEMBEDTEXTSTREAMIMP_H
+
+// Local Variables:
+// c-basic-offset: 4
+// End:
diff --git a/kjsembed/cpptests/Makefile.am b/kjsembed/cpptests/Makefile.am
new file mode 100644
index 00000000..f70b1e8b
--- /dev/null
+++ b/kjsembed/cpptests/Makefile.am
@@ -0,0 +1,2 @@
+SUBDIRS = jsaccess
+
diff --git a/kjsembed/cpptests/jsaccess/Makefile.am b/kjsembed/cpptests/jsaccess/Makefile.am
new file mode 100644
index 00000000..eda2e3e1
--- /dev/null
+++ b/kjsembed/cpptests/jsaccess/Makefile.am
@@ -0,0 +1,18 @@
+# -*- makefile -*-
+
+# Make sure the include path includes Qt's uilib
+INCLUDES = -I$(QTDIR)/tools/designer/uilib -I$(srcdir)/../../../.. -I.. -I$(top_srcdir) $(all_includes)
+
+INCLUDES += -DQT_CLEAN_NAMESPACE -DQT_NO_ASCII_CAST
+
+bin_PROGRAMS = jsaccess
+
+jsaccess_SOURCES = jsaccess.cpp
+jsaccess_LDFLAGS = $(all_libraries) $(KDE_RPATH)
+jsaccess_LDADD = $(top_builddir)/kjsembed/libkjsembed.la
+
+METASOURCES = AUTO
+
+
+
+
diff --git a/kjsembed/cpptests/jsaccess/jsaccess.cpp b/kjsembed/cpptests/jsaccess/jsaccess.cpp
new file mode 100644
index 00000000..5693ceea
--- /dev/null
+++ b/kjsembed/cpptests/jsaccess/jsaccess.cpp
@@ -0,0 +1,106 @@
+/*
+ * Copyright (C) 2004 Ian Reinhart Geiser <geiseri@kde.org>
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Library General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Library General Public License for more details.
+ *
+ * You should have received a copy of the GNU Library General Public License
+ * along with this library; see the file COPYING.LIB. If not, write to
+ * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
+ * Boston, MA 02110-1301, USA.
+ */
+
+#include <kdebug.h>
+
+#include <kaboutdata.h>
+#include <kapplication.h>
+#include <kcmdlineargs.h>
+#include <klocale.h>
+#include <kjs/interpreter.h>
+
+#include <kjsembed/jsconsolewidget.h>
+#include <kjsembed/jsobjectproxy.h>
+#include <kjsembed/jsfactory.h>
+#include <kjsembed/kjsembedpart.h>
+#include <kjsembed/jssecuritypolicy.h>
+
+using namespace KJSEmbed;
+
+int main( int argc, char **argv )
+{
+ KAboutData about( "test-kjsembed", I18N_NOOP("KJS Embed Test For C++ access of variables and functions."), "0.1",
+ I18N_NOOP("Test"),
+ KAboutData::License_LGPL, I18N_NOOP("(c) 2004 Ian Reinhart Geiser") );
+ KCmdLineArgs::init( argc, argv, &about );
+ KApplication app;
+
+ // Setup Interpreter
+ KJSEmbed::JSSecurityPolicy::setDefaultPolicy( KJSEmbed::JSSecurityPolicy::CapabilityAll );
+ KJSEmbed::KJSEmbedPart *part = new KJSEmbed::KJSEmbedPart;
+ KJS::Interpreter *js = part->interpreter();
+ KJS::ExecState *exec = js->globalExec();
+
+ QString script = "var foobar = \"test from javascript.\";"
+ "function testNoArgsFunction( ){ return foobar; }"
+ "function testNoReturnFunction( value ){ foobar = value; }"
+ "function testFunction( value ){ return \"testFunction dorks with \" + value;}";
+ KJS::Value returnValue = part->evaluate(script,js->globalObject());
+ if( returnValue.isValid() && !returnValue.toBoolean(exec ) )
+ kdWarning() << "Script failed to run." << endl;
+
+ /**
+ * Test extraction of a Variant from javascript
+ */
+ QString value = part->getVariant("foobar").toString();
+ if( value != "test from javascript." )
+ kdWarning() << "Get variant failed with: " << value << endl;
+
+ /**
+ * Test manipulation of a Variant from C++
+ */
+ part->putVariant("foobar", "test from C++.");
+ value = part->getVariant("foobar").toString();
+ if( value != "test from C++." )
+ kdWarning() << "Put variant failed with: " << value << endl;
+
+ /**
+ * Test to see if a function is present
+ */
+ if( !part->hasMethod("testFunction") )
+ kdWarning() << "error finding testFunction" << endl;
+
+ if( part->hasMethod("foobar") )
+ kdWarning() << "error i found a value and was looking for a method" << endl;
+ /**
+ * Test calling function that takes an arg, and returns a value.
+ */
+ KJS::List args;
+ args.append(KJS::String("C++ String"));
+ value = part->callMethod("testFunction", args).toString(exec).qstring();
+ if ( value != "testFunction dorks with C++ String" )
+ kdWarning() << "error calling testFunction, wanted \"testFunction dorks with C++ String\" but got " << value << endl;
+
+ /**
+ * Test calling function that takes an arg, and returns nothing.
+ */
+ args.clear();
+ args.append(KJS::String("C++ String"));
+ returnValue = part->callMethod("testNoReturnFunction", args);
+ if ( returnValue.isNull() )
+ kdWarning() << "error calling testNoReturnFunction is suppose to be null and was " << returnValue.toString(exec).qstring() << endl;
+ /**
+ * Test calling function that takes no args, and returns a value
+ */
+ args.clear();
+ value = part->callMethod("testNoArgsFunction", args).toString(exec).qstring();
+ if ( value != "C++ String" )
+ kdWarning() << "error calling testNoArgsFunction, wanted \"C++ String\" but got " << value << endl;
+ return 1;
+}
diff --git a/kjsembed/customobject_imp.cpp b/kjsembed/customobject_imp.cpp
new file mode 100644
index 00000000..8dd9fc24
--- /dev/null
+++ b/kjsembed/customobject_imp.cpp
@@ -0,0 +1,1444 @@
+/*
+ * Copyright (C) 2001-2004, Richard J. Moore <rich@kde.org>
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Library General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Library General Public License for more details.
+ *
+ * You should have received a copy of the GNU Library General Public License
+ * along with this library; see the file COPYING.LIB. If not, write to
+ * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
+ * Boston, MA 02110-1301, USA.
+ */
+#include "global.h"
+#include <qapplication.h>
+#include <qobject.h>
+#include <qobjectlist.h>
+#include <qcombobox.h>
+#include <qpopupmenu.h>
+#include <qdialog.h>
+#include <qhbox.h>
+#include <qlayout.h>
+#include <qlistbox.h>
+#include <qlistview.h>
+#include <qmetaobject.h>
+#include <qpainter.h>
+#include <qregexp.h>
+#include <qsignal.h>
+#include <qstrlist.h>
+#include <qtabwidget.h>
+#include <qtimer.h>
+#include <qvariant.h>
+#include <qcanvas.h>
+#include <qsplashscreen.h>
+#include <qtoolbox.h>
+#include <qmenudata.h>
+
+#include <private/qucom_p.h>
+#include <private/qucomextra_p.h>
+
+#ifndef QT_ONLY
+
+#include <khtml_part.h>
+#include <kaction.h>
+
+#include <klistview.h>
+#include <kurl.h>
+#include <kmainwindow.h>
+#include <kmenubar.h>
+#include <kstatusbar.h>
+#include <ksystemtray.h>
+#include <kpopupmenu.h>
+
+#endif // QT_ONLY
+
+#include <kjs/interpreter.h>
+#include <kjs/types.h>
+#include <kjs/ustring.h>
+
+#include "kjsembedpart.h"
+#include "jssecuritypolicy.h"
+#include "jsfactory.h"
+#include "jsbinding.h"
+#include "slotproxy.h"
+#include "jsopaqueproxy.h"
+
+#include "customobject_imp.h"
+
+#include "qtbindings/qcombobox_imp.h"
+//#include "qtbindings/qlistviewitem_imp.h"
+//#include "qtbindings/qlistview_imp.h"
+#include "qtbindings/qcanvasview_imp.h"
+//#include "qtbindings/qchecklistitem_imp.h"
+#include "qtbindings/qpopupmenu_imp.h"
+#include "qtbindings/qframe_imp.h"
+#include "qtbindings/qmenudata_imp.h"
+#include "qtbindings/qmenuitem_imp.h"
+
+
+
+#define ADDBINDING(TYPE,PROXY) \
+TYPE *ptr ## TYPE = dynamic_cast< TYPE *> ( PROXY );\
+if ( ptr ## TYPE ) \
+{ \
+ TYPE ## Imp::addBindings( exec, object ); \
+}
+
+namespace KJSEmbed {
+namespace Bindings {
+
+void CustomObjectImp::addBindings( KJS::ExecState *exec, KJS::Object &object )
+{
+ kdDebug() << "CustomObjectImp::addBindings for " << object.className().qstring() << endl;
+ CustomObjectImp *obj = 0;
+
+ JSObjectProxy *proxy = JSProxy::toObjectProxy( object.imp() );
+ if ( !proxy )
+ return;
+ kdDebug() << "CustomObjectImp::addBindings is a proxy" << endl;
+ QObject *qobj = proxy->object();
+ QWidget *widget = proxy->widget();
+
+#ifndef QT_ONLY
+ if ( qobj ) {
+ KXMLGUIClient *gc = dynamic_cast<KXMLGUIClient *>( qobj );
+ if ( gc ) {
+ obj = new CustomObjectImp( exec, KXMLGUIClientActionCollection, proxy );
+ object.put( exec, "actionCollection", KJS::Object(obj) );
+ }
+ }
+
+ KActionCollection *collection = dynamic_cast<KActionCollection*>( qobj );
+ if( collection ) proxy->setOwner(JSProxy::Native);
+#endif // QT_ONLY
+
+ if ( widget ) {
+ obj = new CustomObjectImp( exec, WidgetGrabWidget, proxy );
+ object.put(exec, "grabWidget", KJS::Object(obj));
+ obj = new CustomObjectImp( exec, WidgetDrawLine, proxy );
+ object.put( exec, "drawLine", KJS::Object(obj) );
+ obj = new CustomObjectImp( exec, WidgetDrawText, proxy );
+ object.put( exec, "drawText", KJS::Object(obj) );
+
+ QListBox *listbox = dynamic_cast<QListBox *>( widget );
+ if ( listbox ) {
+ obj = new CustomObjectImp( exec, ListBoxInsertItem, proxy );
+ object.put( exec, "insertItem", KJS::Object(obj) );
+ }
+
+ QListView *listview = dynamic_cast<QListView *>( widget );
+ if ( listview ) {
+ obj = new CustomObjectImp( exec, ListViewAddColumn, proxy );
+ object.put( exec, "addColumn", KJS::Object(obj) );
+ obj = new CustomObjectImp( exec, ListViewInsertItem, proxy );
+ object.put( exec, "insertItem", KJS::Object(obj) );
+ obj = new CustomObjectImp( exec, ListViewSelectedItem, proxy );
+ object.put( exec, "selectedItem", KJS::Object(obj) );
+ obj = new CustomObjectImp( exec, ListViewHideColumn, proxy );
+ object.put( exec, "hideColumn", KJS::Object(obj) );
+ obj = new CustomObjectImp( exec, ListViewTakeItem, proxy );
+ object.put( exec, "takeItem", KJS::Object(obj) );
+ obj = new CustomObjectImp( exec, ListViewFirstChild, proxy );
+ object.put( exec, "firstChild", KJS::Object(obj) );
+ obj = new CustomObjectImp( exec, ListViewCurrentItem, proxy );
+ object.put( exec, "currentItem", KJS::Object(obj) );
+ }
+ QSplashScreen *splashscreen = dynamic_cast<QSplashScreen *>(widget);
+ if( splashscreen )
+ {
+ obj = new CustomObjectImp(exec, QSplashScreenSetPixmap, proxy );
+ object.put(exec, "setPixmap", KJS::Object(obj) );
+ obj = new CustomObjectImp(exec, QSplashScreenPixmap, proxy );
+ object.put(exec, "pixmap", KJS::Object(obj) );
+ obj = new CustomObjectImp(exec, QSplashScreenFinish, proxy );
+ object.put(exec, "finish", KJS::Object(obj) );
+ obj = new CustomObjectImp(exec, QSplashScreenRepaint, proxy );
+ object.put(exec, "repaint", KJS::Object(obj) );
+ }
+
+#ifndef QT_ONLY
+ KMainWindow *mw = dynamic_cast<KMainWindow *>( widget );
+ if ( mw ) {
+ obj = new CustomObjectImp( exec, MainWindowSetCentralWidget, proxy );
+ object.put( exec, "setCentralWidget", KJS::Object(obj) );
+ obj = new CustomObjectImp( exec, MainWindowCreateGUI, proxy );
+ object.put( exec, "createGUI", KJS::Object(obj) );
+ obj = new CustomObjectImp( exec, MainWindowMenuBar, proxy );
+ object.put( exec, "menuBar", KJS::Object(obj) );
+ obj = new CustomObjectImp( exec, MainWindowStatusBar, proxy );
+ object.put( exec, "statusBar", KJS::Object(obj) );
+ obj = new CustomObjectImp( exec, MainWindowSetStandardToolBarMenuEnabled, proxy );
+ object.put( exec, "setStandardToolBarMenuEnabled", KJS::Object(obj) );
+ }
+
+ KSystemTray *systray = dynamic_cast<KSystemTray *>( qobj );
+ if ( systray ) {
+ obj = new CustomObjectImp( exec, KSystemTrayContextMenu, proxy );
+ object.put( exec, "contextMenu", KJS::Object(obj) );
+ obj = new CustomObjectImp( exec, KSystemTrayActionCollection, proxy );
+ object.put( exec, "actionCollection", KJS::Object(obj) );
+ obj = new CustomObjectImp( exec, KSystemTrayLoadIcon, proxy );
+ object.put( exec, "loadIcon", KJS::Object(obj) );
+ }
+
+#endif // QT_ONLY
+
+ QTabWidget *tw = dynamic_cast<QTabWidget *>( widget );
+ if ( tw ) {
+ obj = new CustomObjectImp( exec, TabWidgetAddTab, proxy );
+ object.put( exec, "addTab", KJS::Object(obj) );
+ }
+
+ QScrollView *sv = dynamic_cast<QScrollView *>( widget );
+ if ( sv ) {
+ obj = new CustomObjectImp( exec, ScrollViewViewport, proxy );
+ object.put( exec, "viewport", KJS::Object(obj) );
+ obj = new CustomObjectImp( exec, ScrollViewAddChild, proxy );
+ object.put( exec, "addChild", KJS::Object(obj) );
+ }
+
+ //ADDBINDING( QMenuItem, widget)
+ //ADDBINDING( QMenuData, widget)
+
+ ADDBINDING( QPopupMenu, widget )
+ ADDBINDING( QComboBox, widget )
+ //ADDBINDING( QFrame, widget )
+ /*ADDBINDING( QListView, widget )*/
+ ADDBINDING( QCanvasView, widget )
+
+ /*
+ QMenuData *md = dynamic_cast<QMenuData *>( widget );
+ if ( md ) {
+ QMenuDataImp::addBindings( exec, object );
+ }
+
+ QMenuItem *mitem = dynamic_cast<QMenuItem *>( widget );
+ if ( mitem ) {
+ QMenuItemImp::addBindings( exec, object );
+ }
+ */
+ QMenuData *menuData = dynamic_cast<QMenuData*>(widget);
+ if( menuData )
+ {
+ obj = new CustomObjectImp( exec, QMenuDataInsertItem, proxy );
+ object.put( exec, "insertItem", KJS::Object(obj) );
+ obj = new CustomObjectImp( exec, QMenuDataRemoveItem, proxy );
+ object.put( exec, "removeItem", KJS::Object(obj) );
+ obj = new CustomObjectImp( exec, QMenuDataRemoveItem, proxy );
+ object.put( exec, "insertSeparator", KJS::Object(obj) );
+ }
+
+ QHBox *hbox = dynamic_cast<QHBox *>( widget );
+ if ( hbox ) {
+ obj = new CustomObjectImp( exec, HBoxSpacing, proxy );
+ object.put( exec, "setSpacing", KJS::Object(obj) );
+ }
+ QToolBox *tb = dynamic_cast<QToolBox *>( qobj );
+ if ( tb ) {
+ obj = new CustomObjectImp( exec, QToolBoxAddItem, proxy );
+ object.put( exec, "addItem", KJS::Object(obj) );
+ obj = new CustomObjectImp( exec, QToolBoxInsertItem, proxy );
+ object.put( exec, "insertItem", KJS::Object(obj) );
+ obj = new CustomObjectImp( exec, QToolBoxRemoveItem, proxy );
+ object.put( exec, "removeItem", KJS::Object(obj) );
+ obj = new CustomObjectImp( exec, QToolBoxItemLabel, proxy );
+ object.put( exec, "itemLabel", KJS::Object(obj) );
+ obj = new CustomObjectImp( exec, QToolBoxSetItemLabel, proxy );
+ object.put( exec, "setItemLabel", KJS::Object(obj) );
+ obj = new CustomObjectImp( exec, QToolBoxItemIconSet, proxy );
+ object.put( exec, "itemIconSet", KJS::Object(obj) );
+ obj = new CustomObjectImp( exec, QToolBoxSetItemIconSet, proxy );
+ object.put( exec, "setItemIconSet", KJS::Object(obj) );
+ obj = new CustomObjectImp( exec, QToolBoxItem, proxy );
+ object.put( exec, "item", KJS::Object(obj) );
+ }
+ return;
+ }
+
+ if ( qobj ) {
+ QApplication *app = dynamic_cast<QApplication *>( qobj );
+ if ( app ) {
+ obj = new CustomObjectImp( exec, ApplicationExec, proxy );
+ object.put( exec, "exec", KJS::Object(obj) );
+ }
+
+#ifndef QT_ONLY
+
+ KParts::ReadOnlyPart *ropart = dynamic_cast<KParts::ReadOnlyPart *>( qobj );
+ if ( ropart ) {
+ obj = new CustomObjectImp( exec, KReadOnlyPartOpenStream, proxy );
+ object.put( exec, "openStream", KJS::Object(obj) );
+ obj = new CustomObjectImp( exec, KReadOnlyPartWriteStream, proxy );
+ object.put( exec, "writeStream", KJS::Object(obj) );
+ obj = new CustomObjectImp( exec, KReadOnlyPartCloseStream, proxy );
+ object.put( exec, "closeStream", KJS::Object(obj) );
+ }
+
+ KHTMLPart *htmlpart = dynamic_cast<KHTMLPart *>( qobj );
+ if ( htmlpart ) {
+ obj = new CustomObjectImp( exec, KHTMLPartSelectAll, proxy );
+ object.put( exec, "selectAll", KJS::Object(obj) );
+ obj = new CustomObjectImp( exec, KHTMLPartHasSelection, proxy );
+ object.put( exec, "hasSelection", KJS::Object(obj) );
+ obj = new CustomObjectImp( exec, KHTMLPartSelectedText, proxy );
+ object.put( exec, "selectedText", KJS::Object(obj) );
+ }
+
+#endif // QT_ONLY
+
+ QTimer *timer = dynamic_cast<QTimer *>( qobj );
+ if ( timer ) {
+ obj = new CustomObjectImp( exec, TimerIsActive, proxy );
+ object.put( exec, "isActive", KJS::Object(obj) );
+ obj = new CustomObjectImp( exec, TimerStart, proxy );
+ object.put( exec, "start", KJS::Object(obj) );
+ obj = new CustomObjectImp( exec, TimerStop, proxy );
+ object.put( exec, "stop", KJS::Object(obj) );
+ }
+
+ QBoxLayout *box = dynamic_cast<QBoxLayout *>( qobj );
+ if ( box ) {
+ obj = new CustomObjectImp( exec, BoxLayoutAddWidget, proxy );
+ object.put( exec, "addWidget", KJS::Object(obj) );
+ obj = new CustomObjectImp( exec, BoxLayoutAddSpacing, proxy );
+ object.put( exec, "addSpacing", KJS::Object(obj) );
+ obj = new CustomObjectImp( exec, BoxLayoutAddStretch, proxy );
+ object.put( exec, "addStretch", KJS::Object(obj) );
+ obj = new CustomObjectImp( exec, BoxLayoutAddLayout, proxy );
+ object.put( exec, "addLayout", KJS::Object(obj) );
+ }
+ }
+}
+
+CustomObjectImp::CustomObjectImp( KJS::ExecState *exec, int mid, JSObjectProxy *parent )
+ : JSProxyImp(exec), id(mid), proxy(parent)
+{
+}
+
+KJS::Value CustomObjectImp::call( KJS::ExecState *exec, KJS::Object &self, const KJS::List &args )
+{
+ switch( id ) {
+ case WidgetGrabWidget:
+ return widgetGrabWidget( exec, self, args );
+ break;
+ case WidgetDrawLine:
+ widgetDrawLine( exec, self, args );
+ return KJS::Value();
+ break;
+ case WidgetDrawText:
+ widgetDrawText( exec, self, args );
+ return KJS::Value();
+ break;
+ case ListBoxInsertItem:
+ listBoxInsertItem( exec, self, args );
+ return KJS::Value();
+ break;
+ case ListViewAddColumn:
+ listViewAddColumn( exec, self, args );
+ return KJS::Value();
+ break;
+ case ListViewInsertItem:
+ listViewInsertItem( exec, self, args );
+ return KJS::Value();
+ break;
+ case ListViewSelectedItem:
+ return listViewSelectedItem( exec, self, args );
+ break;
+ case ListViewHideColumn:
+ listViewHideColumn( exec, self, args );
+ return KJS::Value();
+ break;
+ case MainWindowSetCentralWidget:
+ mainWinSetCentralWidget( exec, self, args );
+ return KJS::Value();
+ break;
+ case MainWindowCreateGUI:
+ mainWinCreateGUI( exec, self, args );
+ return KJS::Value();
+ break;
+ case MainWindowMenuBar:
+ return mainWinMenuBar( exec, self, args );
+ break;
+ case MainWindowStatusBar:
+ return mainWinStatusBar( exec, self, args );
+ break;
+ case MainWindowSetStandardToolBarMenuEnabled:
+ mainWinSetStandardToolBarMenuEnabled( exec, self, args );
+ return KJS::Value();
+ break;
+ case TabWidgetAddTab:
+ tabWidgetAddTab( exec, self, args );
+ return KJS::Value();
+ break;
+ case ScrollViewViewport:
+ return scrollViewViewport( exec, self, args );
+ break;
+ case ScrollViewAddChild:
+ scrollViewAddChild( exec, self, args );
+ return KJS::Value();
+ break;
+ case ApplicationExec:
+ return applicationExec( exec, self, args );
+ break;
+ case TimerIsActive:
+ return timerIsActive( exec, self, args );
+ break;
+ case TimerStart:
+ return timerStart( exec, self, args );
+ break;
+ case TimerStop:
+ return timerStop( exec, self, args );
+ break;
+ case BoxLayoutAddWidget:
+ boxLayoutAddWidget( exec, self, args );
+ return KJS::Value();
+ break;
+ case BoxLayoutAddSpacing:
+ boxLayoutAddSpacing( exec, self, args );
+ return KJS::Value();
+ break;
+ case BoxLayoutAddStretch:
+ boxLayoutAddStretch( exec, self, args );
+ return KJS::Value();
+ break;
+ case BoxLayoutAddLayout:
+ boxLayoutAddLayout( exec, self, args );
+ return KJS::Value();
+ break;
+ case URLRequesterSetMode:
+ case URLRequesterSetFilter:
+ case URLRequesterUrl:
+ case URLRequesterSetLocalProtocol:
+ case URLRequesterLocalProtocol:
+ kdWarning() << "CustomObjectImp unsupported method call " << id << endl;
+ break;
+ case KXMLGUIClientActionCollection:
+ return xmlguiClientActionCollection( exec, self, args );
+ break;
+ case KReadOnlyPartOpenStream:
+ return kroPartOpenStream( exec, self, args );
+ break;
+ case KReadOnlyPartWriteStream:
+ return kroPartWriteStream( exec, self, args );
+ break;
+ case KReadOnlyPartCloseStream:
+ return kroPartCloseStream( exec, self, args );
+ break;
+ case HBoxSpacing:
+ hboxSpacing( exec, self, args );
+ return KJS::Value();
+ break;
+ case KHTMLPartSelectAll:
+ khtmlPartSelectAll( exec, self, args );
+ return KJS::Value();
+ break;
+ case KHTMLPartHasSelection:
+ return khtmlPartHasSelection( exec, self, args );
+ break;
+ case KHTMLPartSelectedText:
+ return khtmlPartSelectedText( exec, self, args );
+ break;
+ case KSystemTrayContextMenu:
+ return ksystemtrayContextMenu( exec, self, args );
+ break;
+ case KSystemTrayActionCollection:
+ return ksystemtrayActionCollection( exec, self, args );
+ break;
+ case KSystemTrayLoadIcon:
+ return ksystemtrayLoadIcon( exec, self, args );
+ break;
+ case QCanvasViewCanvas:
+ return qcanvasViewCanvas( exec, self, args );
+ break;
+ case QCanvasViewSetCanvas:
+ qcanvasViewSetCanvas( exec, self, args );
+ return KJS::Value();
+ break;
+ case QSplashScreenSetPixmap:
+ return qsplashScreenSetPixmap(exec, self, args );
+ break;
+ case QSplashScreenPixmap:
+ return qsplashScreenPixmap(exec, self, args );
+ break;
+ case QSplashScreenFinish:
+ return qsplashScreenFinish(exec, self, args );
+ break;
+ case QSplashScreenRepaint:
+ return qsplashScreenRepaint(exec, self, args );
+ break;
+ case QToolBoxAddItem:
+ return qtoolBoxAddItem(exec, self, args );
+ break;
+ case QToolBoxInsertItem:
+ return qtoolBoxInsertItem(exec, self, args );
+ break;
+ case QToolBoxRemoveItem:
+ qtoolBoxRemoveItem(exec, self, args );
+ return KJS::Boolean(true);
+ break;
+ case QToolBoxItemLabel:
+ return qtoolBoxItemLabel(exec, self, args );
+ break;
+ case QToolBoxSetItemLabel:
+ qtoolBoxSetItemLabel(exec, self, args );
+ return KJS::Boolean(true);
+ break;
+ case QToolBoxItemIconSet:
+ return qtoolBoxItemIconSet(exec, self, args );
+ break;
+ case QToolBoxSetItemIconSet:
+ qtoolBoxSetItemIconSet(exec, self, args );
+ return KJS::Boolean(true);
+ break;
+ case QToolBoxItem:
+ return qtoolBoxItem(exec, self, args );
+ break;
+ case QMenuDataInsertItem:
+ return qmenuDataInsertItem(exec, self, args );
+ break;
+ case QMenuDataRemoveItem:
+ qmenuDataRemoveItem(exec, self, args );
+ return KJS::Boolean(true);
+ break;
+ case QMenuDataInsertSeparator:
+ qmenuDataInsertSeparator(exec, self, args );
+ return KJS::Boolean(true);
+ break;
+
+ case ListViewTakeItem:
+ return qlistViewTakeItem(exec, self, args );
+ break;
+ case ListViewFirstChild:
+ return qlistViewFirstChild(exec, self, args );
+ break;
+ case ListViewCurrentItem:
+ return qlistViewFirstChild(exec, self, args );
+ break;
+ default:
+ break;
+ }
+
+ return KJS::ObjectImp::call( exec, self, args );
+}
+
+KJS::Value CustomObjectImp::qsplashScreenSetPixmap(KJS::ExecState *exec, KJS::Object &, const KJS::List &args )
+{
+ QSplashScreen *ss = dynamic_cast<QSplashScreen*>(proxy->widget());
+ if ( ss )
+ {
+ QPixmap pix = extractQPixmap(exec, args, 0 );
+ ss->setPixmap(pix);
+ }
+ return KJS::Value();
+}
+
+KJS::Value CustomObjectImp::qsplashScreenPixmap(KJS::ExecState *exec, KJS::Object &, const KJS::List & )
+{
+ QSplashScreen *ss = dynamic_cast<QSplashScreen*>(proxy->widget());
+ if ( ss )
+ {
+ QPixmap pix = *(ss->pixmap());
+ return convertToValue(exec, pix);
+ }
+ return KJS::Value();
+}
+
+KJS::Value CustomObjectImp::qsplashScreenFinish(KJS::ExecState *exec, KJS::Object &, const KJS::List &args )
+{
+ QSplashScreen *ss = dynamic_cast<QSplashScreen*>(proxy->widget());
+ if ( ss )
+ {
+ QWidget *w = extractQWidget(exec, args, 0 );
+ ss->finish(w);
+ }
+ return KJS::Value();
+}
+
+KJS::Value CustomObjectImp::qsplashScreenRepaint(KJS::ExecState *exec, KJS::Object &, const KJS::List & )
+{
+ QSplashScreen *ss = dynamic_cast<QSplashScreen*>(proxy->widget());
+ if ( ss )
+ {
+ ss->repaint();
+ }
+ return KJS::Value();
+}
+
+
+KJS::Value CustomObjectImp::widgetGrabWidget(KJS::ExecState *exec, KJS::Object &, const KJS::List & )
+{
+ QWidget *w = proxy->widget();
+ if ( !w )
+ return KJS::Value();
+ QVariant pix(QPixmap::grabWidget(w) );
+ return convertToValue( exec, pix );
+
+}
+void CustomObjectImp::widgetDrawLine( KJS::ExecState *exec, KJS::Object &, const KJS::List &args )
+{
+ if ( args.size() != 4 )
+ return;
+
+ QWidget *w = proxy->widget();
+ if ( !w )
+ return;
+
+ int x = extractInt( exec, args, 0 );
+ int y = extractInt( exec, args, 1 );
+ int x1 = extractInt( exec, args, 2 );
+ int y1 = extractInt( exec, args, 3 );
+
+ QPainter p(w);
+ p.drawLine(x,y,x1,y1);
+}
+
+void CustomObjectImp::widgetDrawText( KJS::ExecState *exec, KJS::Object &, const KJS::List &args )
+{
+ if ( args.size() != 3 )
+ return;
+
+ QWidget *w = proxy->widget();
+ if ( !w )
+ return;
+
+ int x = extractInt( exec, args, 0 );
+ int y = extractInt( exec, args, 1 );
+ QString s = extractQString( exec, args, 2 );
+ w->drawText( x, y, s );
+}
+
+void CustomObjectImp::listBoxInsertItem( KJS::ExecState *exec, KJS::Object &, const KJS::List &args )
+{
+ if ( args.size() != 1 )
+ return;
+
+ QListBox *lb = dynamic_cast<QListBox *>( proxy->object() );
+ if ( !lb )
+ return;
+
+ QString s = extractQString( exec, args, 0 );
+ lb->insertItem( s );
+}
+
+void CustomObjectImp::listViewAddColumn( KJS::ExecState *exec, KJS::Object &, const KJS::List &args )
+{
+ if ( args.size() != 1 )
+ return;
+
+ QListView *lv = dynamic_cast<QListView *>( proxy->object() );
+ if ( !lv )
+ return;
+
+ QString s = extractQString( exec, args, 0 );
+ lv->addColumn( s );
+}
+
+void CustomObjectImp::listViewInsertItem( KJS::ExecState *exec, KJS::Object &, const KJS::List &args )
+{
+ if ( !args.size() )
+ return;
+
+#ifndef QT_ONLY
+
+ KListView *klv = dynamic_cast<KListView *>( proxy->object() );
+ if ( klv ) {
+ KListViewItem *lvm = new KListViewItem(klv);
+
+ for( int idx = 0; idx < args.size(); ++idx){
+ QVariant arg = convertToVariant(exec, args[idx]);
+ if( arg.canCast(QVariant::String) )
+ lvm->setText(idx, arg.toString());
+ else if ( arg.canCast(QVariant::Pixmap) )
+ lvm->setPixmap(idx, arg.toPixmap());
+ }
+ return;
+ }
+
+#endif // QT_ONLY
+
+ QListView *lv = dynamic_cast<QListView *>( proxy->object() );
+ if ( lv ) {
+ QListViewItem *lvm = new QListViewItem(lv);
+
+ for( int idx = 0; idx < args.size(); ++idx){
+ QVariant arg = convertToVariant(exec, args[idx]);
+ if( arg.canCast(QVariant::String) )
+ lvm->setText(idx, arg.toString());
+ else if ( arg.canCast(QVariant::Pixmap) )
+ lvm->setPixmap(idx, arg.toPixmap());
+ }
+
+ }
+}
+
+KJS::Value CustomObjectImp::listViewSelectedItem( KJS::ExecState *exec, KJS::Object &, const KJS::List &args )
+{
+ if ( args.size() )
+ return KJS::Value();
+
+ QListView *lv = dynamic_cast<QListView *>( proxy->object() );
+ if ( !lv )
+ return KJS::Value();
+
+ QListViewItem *lvi = lv->selectedItem();
+ if ( !lvi )
+ return KJS::Null();
+
+ QCheckListItem *cli = dynamic_cast<QCheckListItem *>( lvi );
+ if ( cli ) {
+ JSOpaqueProxy *prx = new JSOpaqueProxy( lvi, "QCheckListItem" );
+ KJS::Object proxyObj(prx);
+ proxy->part()->factory()->extendOpaqueProxy(exec, proxyObj);
+ return proxyObj;
+ }
+
+ JSOpaqueProxy *prx = new JSOpaqueProxy( lvi, "QListViewItem" );
+ KJS::Object proxyObj(prx);
+ proxy->part()->factory()->extendOpaqueProxy(exec, proxyObj);
+ return proxyObj;
+
+}
+
+void CustomObjectImp::listViewHideColumn( KJS::ExecState *exec, KJS::Object &, const KJS::List &args )
+{
+ if ( args.size() != 1 )
+ return;
+
+ QListView *lv = dynamic_cast<QListView *>( proxy->object() );
+ if ( !lv )
+ return;
+
+ int i = extractInt( exec, args, 0 );
+ lv->hideColumn( i );
+}
+
+void CustomObjectImp::mainWinSetCentralWidget( KJS::ExecState *exec,
+ KJS::Object &, const KJS::List &args )
+{
+#ifndef QT_ONLY
+
+ if ( args.size() != 1 )
+ return;
+
+ KJS::Object jsobj = args[0].toObject(exec);
+ JSObjectProxy *cwproxy = JSProxy::toObjectProxy( jsobj.imp() );
+ QWidget *cw = cwproxy ? cwproxy->widget() : 0;
+ if ( !cw )
+ return;
+ KMainWindow *mw = dynamic_cast<KMainWindow *>( proxy->object() );
+ if ( !mw )
+ return;
+
+ mw->setCentralWidget( cw );
+
+#else // QT_ONLY
+ Q_UNUSED( exec );
+ Q_UNUSED( args );
+ return;
+#endif // QT_ONLY
+}
+
+void CustomObjectImp::mainWinSetStandardToolBarMenuEnabled( KJS::ExecState *exec,
+ KJS::Object &, const KJS::List &args )
+{
+#ifndef QT_ONLY
+
+ if ( args.size() != 1 )
+ return;
+
+ KMainWindow *mw = dynamic_cast<KMainWindow *>( proxy->object() );
+ if ( !mw )
+ return;
+
+ mw->setStandardToolBarMenuEnabled( args[0].toBoolean(exec) );
+
+#else // QT_ONLY
+ Q_UNUSED( exec );
+ Q_UNUSED( args );
+ return;
+#endif // QT_ONLY
+}
+
+void CustomObjectImp::mainWinCreateGUI( KJS::ExecState *exec, KJS::Object &, const KJS::List &args )
+{
+#ifndef QT_ONLY
+ kdDebug(80001) << "mainWinCreateGUI() called" << endl;
+ KMainWindow *mw = dynamic_cast<KMainWindow *>( proxy->object() );
+ if ( !mw ) {
+ kdWarning() << "mainWinCreateGUI() called on non-KMainWindow" << endl;
+ return;
+ }
+
+ mw->createGUI( extractQString( exec, args, 0 ) );
+#else // QT_ONLY
+ Q_UNUSED( exec );
+ Q_UNUSED( args );
+ return;
+#endif // QT_ONLY
+}
+
+KJS::Value CustomObjectImp::mainWinMenuBar( KJS::ExecState *exec, KJS::Object &, const KJS::List & )
+{
+#ifndef QT_ONLY
+ kdDebug(80001) << "mainWinMenuBar() called" << endl;
+ KMainWindow *mw = dynamic_cast<KMainWindow *>( proxy->object() );
+ if ( !mw ) {
+ kdWarning() << "mainWinMenuBar() called on non-KMainWindow" << endl;
+ return KJS::Value();
+ }
+
+ QObject *obj = mw->menuBar();
+ return proxy->part()->factory()->createProxy( exec, obj, proxy );
+
+#else // QT_ONLY
+ Q_UNUSED( exec );
+ return KJS::Value();
+#endif // QT_ONLY
+}
+
+KJS::Value CustomObjectImp::mainWinStatusBar( KJS::ExecState *exec, KJS::Object &, const KJS::List & )
+{
+#ifndef QT_ONLY
+ kdDebug(80001) << "mainWinStatusBar() called" << endl;
+ KMainWindow *mw = dynamic_cast<KMainWindow *>( proxy->object() );
+ if ( !mw ) {
+ kdWarning() << "mainWinStatusBar() called on non-KMainWindow" << endl;
+ return KJS::Value();
+ }
+
+ QObject *obj = mw->statusBar();
+ return proxy->part()->factory()->createProxy( exec, obj, proxy );
+
+#else // QT_ONLY
+ Q_UNUSED( exec );
+ return KJS::Value();
+#endif // QT_ONLY
+}
+
+KJS::Value CustomObjectImp::xmlguiClientActionCollection( KJS::ExecState *exec, KJS::Object&, const KJS::List& )
+{
+#ifndef QT_ONLY
+ KXMLGUIClient *gc = dynamic_cast<KXMLGUIClient *>( proxy->object() );
+ if ( !gc ) {
+ kdDebug(80001) << "Unable to cast to XMLGUIClient" << endl;
+ return KJS::Value();
+ }
+
+ KActionCollection *ac = gc->actionCollection();
+ if (!ac) {
+ kdDebug(80001) << "XMLGUIClient action collection is null" << endl;
+ return KJS::Null();
+ }
+/* JSObjectProxy *prxy = new JSObjectProxy( proxy->part(), ac );
+ KJS::Object proxyObject( prxy );
+ prxy->setOwner(JSProxy::Native);
+ prxy->addBindings( exec, proxyObject );
+ return proxyObject;
+ */
+ return proxy->part()->factory()->createProxy( exec, ac, proxy );
+#else // QT_ONLY
+ Q_UNUSED( exec );
+ return KJS::Value();
+#endif // QT_ONLY
+}
+
+void CustomObjectImp::tabWidgetAddTab( KJS::ExecState *exec, KJS::Object&, const KJS::List &args )
+{
+ if ( args.size() < 2 )
+ return;
+
+ QTabWidget *tw = dynamic_cast<QTabWidget *>( proxy->object() );
+ if ( !tw )
+ return;
+
+ KJS::Object jsobj = args[0].toObject(exec);
+ JSObjectProxy *tproxy = JSProxy::toObjectProxy( jsobj.imp() );
+ QWidget *w = tproxy ? tproxy->widget() : 0;
+ if ( !w )
+ return;
+
+ tw->addTab( w, extractQString( exec, args, 0 ) );
+}
+
+KJS::Value CustomObjectImp::scrollViewViewport( KJS::ExecState *exec, KJS::Object&, const KJS::List &args )
+{
+ QScrollView *sv = dynamic_cast<QScrollView *>( proxy->object() );
+ if ( !sv )
+ return KJS::Value();
+
+ KJS::Object jsobj = args[0].toObject(exec);
+ JSObjectProxy *sproxy = JSProxy::toObjectProxy( jsobj.imp() );
+ QWidget *w = sproxy ? sproxy->widget() : 0;
+ if ( !w )
+ return KJS::Value();
+
+ return proxy->part()->factory()->createProxy( exec, w, proxy );
+}
+
+void CustomObjectImp::scrollViewAddChild( KJS::ExecState *exec, KJS::Object&, const KJS::List &args )
+{
+ if ( args.size() < 1 )
+ return;
+
+ QScrollView *sv = dynamic_cast<QScrollView *>( proxy->object() );
+ if ( !sv )
+ return;
+
+ KJS::Object jsobj = args[0].toObject(exec);
+ JSObjectProxy *sproxy = JSProxy::toObjectProxy( jsobj.imp() );
+ QWidget *w = sproxy ? sproxy->widget() : 0;
+ if ( !w )
+ return;
+
+ int x = args.size() >= 2 ? extractInt( exec, args, 1 ) : 0;
+ int y = args.size() >= 3 ? extractInt( exec, args, 2 ) : 0;
+
+ sv->addChild( w, x, y );
+}
+
+KJS::Value CustomObjectImp::applicationExec( KJS::ExecState *, KJS::Object&, const KJS::List& )
+{
+ QApplication *app = dynamic_cast<QApplication *>( proxy->object() );
+ if ( !app )
+ return KJS::Value();
+
+ return KJS::Number( app->exec() );
+}
+
+KJS::Value CustomObjectImp::timerIsActive( KJS::ExecState *, KJS::Object &, const KJS::List & )
+{
+ QTimer *timer = dynamic_cast<QTimer *>( proxy->object() );
+ if ( !timer )
+ return KJS::Value();
+
+ return KJS::Boolean( timer->isActive() );
+}
+
+KJS::Value CustomObjectImp::timerStart( KJS::ExecState *exec, KJS::Object &, const KJS::List &args )
+{
+ QTimer *timer = dynamic_cast<QTimer *>( proxy->object() );
+ if ( !timer )
+ return KJS::Value();
+
+ int timerid;
+ if ( args.size() == 1 )
+ timerid = timer->start( extractInt( exec, args, 0 ) );
+ else if ( args.size() == 2 )
+ timerid = timer->start( extractInt( exec, args, 0 ), extractBool( exec, args, 0 ) );
+ else
+ return KJS::Value();
+
+ return KJS::Number( timerid );
+}
+
+KJS::Value CustomObjectImp::timerStop( KJS::ExecState *, KJS::Object &, const KJS::List & )
+{
+ QTimer *timer = dynamic_cast<QTimer *>( proxy->object() );
+ if ( !timer )
+ return KJS::Value();
+
+ timer->stop();
+ return KJS::Value();
+}
+
+void CustomObjectImp::boxLayoutAddWidget( KJS::ExecState *exec, KJS::Object &, const KJS::List &args )
+{
+ if ( (args.size() < 1) || (args.size() > 3) )
+ return;
+
+ QBoxLayout *box = dynamic_cast<QBoxLayout *>( proxy->object() );
+ if ( !box )
+ return;
+
+ KJS::Object jsobj = args[0].toObject(exec);
+ JSObjectProxy *proxy = JSProxy::toObjectProxy( jsobj.imp() );
+ QWidget *w = proxy ? proxy->widget() : 0;
+ if ( !w )
+ return;
+
+ if ( args.size() == 1 )
+ box->addWidget( w );
+ else if ( args.size() == 2 )
+ box->addWidget( w, extractInt( exec, args, 1 ) );
+ else if ( args.size() == 3 )
+ box->addWidget( w, extractInt( exec, args, 1 ), extractInt( exec, args, 2 ) );
+}
+
+void CustomObjectImp::boxLayoutAddSpacing( KJS::ExecState *exec, KJS::Object &, const KJS::List &args )
+{
+ if ( args.size() != 1 )
+ return;
+
+ QBoxLayout *box = dynamic_cast<QBoxLayout *>( proxy->object() );
+ if ( !box )
+ return;
+
+ box->addSpacing( extractInt( exec, args, 0 ) );
+}
+
+void CustomObjectImp::boxLayoutAddStretch( KJS::ExecState *exec, KJS::Object &, const KJS::List &args )
+{
+ if ( args.size() > 1 )
+ return;
+
+ QBoxLayout *box = dynamic_cast<QBoxLayout *>( proxy->object() );
+ if ( !box )
+ return;
+
+ if ( args.size() == 0 )
+ box->addStretch();
+ else
+ box->addStretch( extractInt( exec, args, 0 ) );
+}
+
+void CustomObjectImp::boxLayoutAddLayout( KJS::ExecState *exec, KJS::Object &, const KJS::List &args )
+{
+ if ( (args.size() < 1) || (args.size() > 2) )
+ return;
+
+ QBoxLayout *box = dynamic_cast<QBoxLayout *>( proxy->object() );
+ if ( !box )
+ return;
+
+ KJS::Object jsobj = args[0].toObject(exec);
+ JSObjectProxy *proxy = JSProxy::toObjectProxy( jsobj.imp() );
+ QLayout *l = proxy ? (dynamic_cast<QLayout *>(proxy->object())) : 0;
+ if ( !l )
+ return;
+
+ if ( args.size() == 1 )
+ box->addLayout( l );
+ else if ( args.size() == 2 )
+ box->addLayout( l, extractInt( exec, args, 1 ) );
+}
+
+KJS::Value CustomObjectImp::kroPartOpenStream( KJS::ExecState *exec, KJS::Object &, const KJS::List &args )
+{
+#ifndef QT_ONLY
+
+ if ( args.size() != 2 )
+ return KJS::Boolean( false );
+
+ KParts::ReadOnlyPart *ro = dynamic_cast<KParts::ReadOnlyPart *>( proxy->object() );
+ if ( !ro )
+ return KJS::Boolean( false );
+
+ bool ok = ro->openStream( extractQString( exec, args, 0 )
+ , KURL(extractQString( exec, args, 1 )) );
+ return KJS::Boolean( ok );
+
+#else // QT_ONLY
+ Q_UNUSED( exec );
+ Q_UNUSED( args );
+ return KJS::Boolean( false );
+#endif // QT_ONLY
+}
+
+KJS::Value CustomObjectImp::kroPartWriteStream( KJS::ExecState *exec, KJS::Object &, const KJS::List &args )
+{
+#ifndef QT_ONLY
+
+ if ( args.size() != 1 )
+ return KJS::Boolean( false );
+
+ KParts::ReadOnlyPart *ro = dynamic_cast<KParts::ReadOnlyPart *>( proxy->object() );
+ if ( !ro )
+ return KJS::Boolean( false );
+
+ QCString s = extractQString( exec, args, 0 ).latin1();
+ bool ok = ro->writeStream( s );
+ return KJS::Boolean( ok );
+
+#else // QT_ONLY
+ Q_UNUSED( exec );
+ Q_UNUSED( args );
+ return KJS::Boolean( false );
+#endif // QT_ONLY
+}
+
+KJS::Value CustomObjectImp::kroPartCloseStream( KJS::ExecState *, KJS::Object &, const KJS::List &args )
+{
+#ifndef QT_ONLY
+
+ if ( args.size() != 0 )
+ return KJS::Boolean( false );
+
+ KParts::ReadOnlyPart *ro = dynamic_cast<KParts::ReadOnlyPart *>( proxy->object() );
+ if ( !ro )
+ return KJS::Boolean( false );
+
+ bool ok = ro->closeStream();
+ return KJS::Boolean( ok );
+
+#else // QT_ONLY
+ Q_UNUSED( args );
+ return KJS::Boolean( false );
+#endif // QT_ONLY
+}
+
+void CustomObjectImp::hboxSpacing( KJS::ExecState *exec, KJS::Object &, const KJS::List &args )
+{
+ if ( args.size() != 1 )
+ return;
+
+ QHBox *box = dynamic_cast<QHBox *>( proxy->object() );
+ if ( !box )
+ return;
+
+ box->setSpacing( extractInt( exec, args, 0 ) );
+}
+
+void CustomObjectImp::khtmlPartSelectAll( KJS::ExecState *, KJS::Object &, const KJS::List & )
+{
+#ifndef QT_ONLY
+
+ KHTMLPart *htmlpart = dynamic_cast<KHTMLPart *>( proxy->object() );
+ if ( htmlpart )
+ htmlpart->selectAll();
+
+#endif // QT_ONLY
+}
+
+KJS::Value CustomObjectImp::khtmlPartHasSelection( KJS::ExecState *, KJS::Object &, const KJS::List & )
+{
+#ifndef QT_ONLY
+
+ KHTMLPart *htmlpart = dynamic_cast<KHTMLPart *>( proxy->object() );
+ if ( !htmlpart )
+ return KJS::Boolean();
+
+ return KJS::Boolean( htmlpart->hasSelection() );
+#endif // QT_ONLY
+ return KJS::Null();
+}
+
+KJS::Value CustomObjectImp::khtmlPartSelectedText( KJS::ExecState *, KJS::Object &, const KJS::List & )
+{
+#ifndef QT_ONLY
+
+ KHTMLPart *htmlpart = dynamic_cast<KHTMLPart *>( proxy->object() );
+ if ( !htmlpart )
+ return KJS::String();
+
+ return KJS::String( htmlpart->selectedText() );
+#endif // QT_ONLY
+return KJS::Null();
+}
+
+KJS::Value CustomObjectImp::ksystemtrayContextMenu( KJS::ExecState *exec, KJS::Object&, const KJS::List & )
+{
+#ifndef QT_ONLY
+ KSystemTray *st = dynamic_cast<KSystemTray *>( proxy->widget() );
+ if ( !st )
+ {
+ kdWarning() << "Not a KSystemTray" << endl;
+ return KJS::Boolean(false);
+ }
+ kdDebug() << "Valid system tray?" << endl;
+ KPopupMenu *pop = st->contextMenu();
+ return proxy->part()->factory()->createProxy( exec, pop, proxy );
+#endif // QT_ONLY
+return KJS::Null();
+}
+
+KJS::Value CustomObjectImp::ksystemtrayActionCollection( KJS::ExecState *exec, KJS::Object&, const KJS::List & )
+{
+#ifndef QT_ONLY
+ KSystemTray *st = dynamic_cast<KSystemTray *>( proxy->object() );
+ if ( !st )
+ return KJS::Value();
+
+ KActionCollection *ac = st->actionCollection();
+ return proxy->part()->factory()->createProxy( exec, ac, proxy );
+#endif // QT_ONLY
+return KJS::Null();
+}
+
+KJS::Value CustomObjectImp::ksystemtrayLoadIcon( KJS::ExecState *exec, KJS::Object&, const KJS::List &args )
+{
+#ifndef QT_ONLY
+ // TODO: Support the 2 arg form of KSystemTray::loadIcon() when we support KInstance args
+ if ( args.size() != 1 )
+ return KJS::Value();
+
+ QVariant pix( KSystemTray::loadIcon( extractQString( exec, args, 0 ) ) );
+ return convertToValue( exec, pix );
+#endif // QT_ONLY
+return KJS::Null();
+}
+
+KJS::Value CustomObjectImp::qcanvasViewCanvas( KJS::ExecState *exec, KJS::Object&, const KJS::List &args )
+{
+ QCanvasView *cv = dynamic_cast<QCanvasView *>( proxy->object() );
+ if ( !cv )
+ return KJS::Value();
+
+ return proxy->part()->factory()->createProxy( exec, cv->canvas(), proxy );
+}
+
+void CustomObjectImp::qcanvasViewSetCanvas( KJS::ExecState *exec, KJS::Object&, const KJS::List &args )
+{
+ QCanvasView *cv = dynamic_cast<QCanvasView *>( proxy->object() );
+ if ( !cv )
+ return;
+
+ KJS::Object jsobj = args[0].toObject(exec);
+ JSObjectProxy *proxy = JSProxy::toObjectProxy( jsobj.imp() );
+
+ QObject *obj = proxy->object();
+ if ( !obj )
+ return;
+
+ QCanvas *c = (QCanvas *) obj;
+ cv->setCanvas(c);
+}
+KJS::Value Bindings::CustomObjectImp::qlistViewTakeItem( KJS::ExecState * exec, KJS::Object &, const KJS::List &args )
+{
+ QListView *lv = dynamic_cast<QListView *>( proxy->object() );
+ if( !lv )
+ return KJS::Boolean(false);
+ KJS::Object lviObj = args[0].toObject(exec);
+ JSOpaqueProxy *prxy = JSProxy::toOpaqueProxy(lviObj.imp() );
+ QListViewItem *itm = prxy->toNative<QListViewItem>();
+ if( !itm )
+ {
+ // Trow an error...
+ return KJS::Boolean(false);
+ }
+ lv->takeItem(itm);
+ return KJS::Boolean(true);
+}
+
+KJS::Value Bindings::CustomObjectImp::qlistViewFirstChild( KJS::ExecState * exec, KJS::Object &, const KJS::List &args )
+{
+ QListView *lv = dynamic_cast<QListView *>( proxy->object() );
+ if( !lv )
+ return KJS::Boolean(false);
+ QListViewItem *itm = lv->firstChild();
+ KJS::Object jsObject( new JSOpaqueProxy( itm, "QListViewItem") );
+ proxy->part()->factory()->extendOpaqueProxy(exec, jsObject);
+ return jsObject;
+}
+
+KJS::Value Bindings::CustomObjectImp::qlistViewCurrentItem( KJS::ExecState * exec, KJS::Object &, const KJS::List &args )
+{
+ QListView *lv = dynamic_cast<QListView *>( proxy->object() );
+ if( !lv )
+ return KJS::Boolean(false);
+ QListViewItem *itm = lv->currentItem();
+ KJS::Object jsObject( new JSOpaqueProxy( itm, "QListViewItem") );
+ proxy->part()->factory()->extendOpaqueProxy(exec, jsObject);
+ return jsObject;
+}
+
+KJS::Value Bindings::CustomObjectImp::qtoolBoxAddItem(KJS::ExecState *exec, KJS::Object &, const KJS::List &args)
+{
+ QToolBox *tb = dynamic_cast<QToolBox *>( proxy->object() );
+ if( !tb )
+ return KJS::Boolean(false);
+ if( args.size() == 2)
+ {
+ QWidget *w = extractQWidget( exec, args, 0 );
+ QString lab = extractQString( exec, args, 1 );
+ return KJS::Number( tb->addItem(w,lab) );
+ }
+ if( args.size() == 3)
+ {
+ QWidget *w = extractQWidget( exec, args, 0 );
+ QIconSet ico = extractQPixmap( exec, args, 1 );
+ QString lab = extractQString( exec, args, 2 );
+ return KJS::Number( tb->addItem(w,ico,lab) );
+ }
+ return KJS::Boolean(false);
+}
+
+KJS::Value Bindings::CustomObjectImp::qtoolBoxInsertItem(KJS::ExecState *exec, KJS::Object &, const KJS::List &args )
+{
+ QToolBox *tb = dynamic_cast<QToolBox *>( proxy->object() );
+ if( !tb )
+ return KJS::Boolean(false);
+ if( args.size() == 3)
+ {
+ int idx = extractInt(exec, args, 0);
+ QWidget *w = extractQWidget( exec, args, 1 );
+ QString lab = extractQString( exec, args, 2 );
+ return KJS::Number( tb->insertItem(idx,w,lab) );
+ }
+ if( args.size() == 4)
+ {
+ int idx = extractInt(exec, args, 0);
+ QWidget *w = extractQWidget( exec, args, 1 );
+ QIconSet ico = extractQPixmap( exec, args, 2 );
+ QString lab = extractQString( exec, args, 3 );
+ return KJS::Number( tb->insertItem(idx,w,ico,lab) );
+ }
+ return KJS::Boolean(false);
+}
+
+void Bindings::CustomObjectImp::qtoolBoxRemoveItem(KJS::ExecState *exec, KJS::Object &, const KJS::List &args )
+{
+ QToolBox *tb = dynamic_cast<QToolBox *>( proxy->object() );
+ if( !tb )
+ return;
+ QWidget *w = extractQWidget(exec, args, 0);
+ tb->removeItem(w);
+}
+
+KJS::Value Bindings::CustomObjectImp::qtoolBoxItemLabel(KJS::ExecState *exec, KJS::Object &, const KJS::List &args )
+{
+ QToolBox *tb = dynamic_cast<QToolBox *>( proxy->object() );
+ if( !tb )
+ return KJS::Boolean(false);
+ int idx = extractInt(exec, args, 0);
+ return KJS::String(tb->itemLabel(idx).latin1());
+}
+
+void Bindings::CustomObjectImp::qtoolBoxSetItemLabel(KJS::ExecState *exec, KJS::Object &, const KJS::List &args )
+{
+ QToolBox *tb = dynamic_cast<QToolBox *>( proxy->object() );
+ if( !tb )
+ return;
+
+ int idx = extractInt(exec, args, 0);
+ QString lab = extractQString( exec, args, 1 );
+ tb->setItemLabel(idx,lab);
+}
+
+KJS::Value Bindings::CustomObjectImp::qtoolBoxItemIconSet(KJS::ExecState *exec, KJS::Object &, const KJS::List &args )
+{
+ QToolBox *tb = dynamic_cast<QToolBox *>( proxy->object() );
+ if( !tb )
+ return KJS::Boolean(false);
+ int idx = extractInt(exec, args, 0);
+ QPixmap pix = tb->itemIconSet(idx).pixmap();
+ return convertToValue( exec, pix );
+
+}
+
+void Bindings::CustomObjectImp::qtoolBoxSetItemIconSet(KJS::ExecState *exec, KJS::Object &, const KJS::List &args)
+{
+ QToolBox *tb = dynamic_cast<QToolBox *>( proxy->object() );
+ if( !tb )
+ return;
+ int idx = extractInt(exec, args, 0);
+ QIconSet ico = extractQPixmap( exec, args, 1);
+ tb->setItemIconSet(idx,ico);
+}
+
+KJS::Value Bindings::CustomObjectImp::qtoolBoxItem(KJS::ExecState *exec, KJS::Object &, const KJS::List &args )
+{
+ QToolBox *tb = dynamic_cast<QToolBox *>( proxy->object() );
+ if( !tb )
+ return KJS::Boolean(false);
+ int idx = extractInt(exec, args, 0);
+ return proxy->part()->factory()->createProxy( exec, tb->item(idx), proxy );
+}
+QPopupMenu *getMenu(const KJS::Object &obj)
+{
+ JSObjectProxy *jsproxy = JSProxy::toObjectProxy( obj.imp() );
+ return dynamic_cast<QPopupMenu *>( jsproxy->object() );
+}
+
+KJS::Value Bindings::CustomObjectImp::qmenuDataInsertItem(KJS::ExecState *exec, KJS::Object &, const KJS::List &args )
+{
+ QMenuData *menu = dynamic_cast<QMenuData *>( proxy->object() );
+ if( !menu )
+ return KJS::Boolean(false);
+ int offset = 0;
+
+ QString text = extractQString(exec,args, offset);
+ QPixmap pix = extractQPixmap(exec,args, offset);
+ int id = -1;
+ int idx = -1;
+ int newIndex = 0;
+ QPopupMenu *parentMenu = 0;
+
+ if( !pix.isNull() )
+ {
+ ++offset;
+ if( args.size() > offset)
+ text = extractQString(exec,args,offset);
+ }
+ kdDebug() << "text " << text << " " << offset << endl;
+
+ ++offset;
+ if( args.size() > offset)
+ parentMenu = getMenu(args[offset].toObject(exec));
+
+ if( parentMenu )
+ ++offset;
+ kdDebug() << "text " << text << " " << offset << endl;
+
+ if( args.size() > offset )
+ id = extractInt(exec, args, offset);
+ ++offset;
+ kdDebug() << "text " << text << " " << offset << endl;
+
+ if( args.size() > offset )
+ idx = extractInt(exec, args, offset);
+
+ kdDebug() << "text " << text << " " << offset << endl;
+
+ if( parentMenu )
+ {
+ if( pix.isNull() )
+ {
+ newIndex = menu->insertItem(text, parentMenu, id, idx); // text, parent, id, idx
+ }
+ else
+ {
+ if( text.isEmpty() )
+ newIndex = menu->insertItem(pix, parentMenu, id, idx); // pixmap, parent, id, idx
+ else
+ newIndex = menu->insertItem(pix, text, parentMenu, id, idx); // pixmap, text, parent, id, idx
+ }
+ }
+ else
+ {
+ if( pix.isNull() )
+ {
+ newIndex = menu->insertItem(text, id, idx); // text, id, idx
+ }
+ else
+ {
+ if( text.isEmpty() )
+ newIndex = menu->insertItem(pix, id, idx); // pixmap, id, idx
+ else
+ newIndex = menu->insertItem(pix, text, id, idx); // pixmap, text, id, idx
+ }
+ }
+
+ return KJS::Number(newIndex);
+}
+
+void Bindings::CustomObjectImp::qmenuDataRemoveItem(KJS::ExecState *exec, KJS::Object &, const KJS::List &args )
+{
+ QMenuData *menu = dynamic_cast<QMenuData *>( proxy->object() );
+ if( !menu )
+ return;
+ int idx = extractInt(exec, args, 0);
+ menu->removeItem(idx);
+}
+
+KJS::Value Bindings::CustomObjectImp::qmenuDataInsertSeparator(KJS::ExecState *exec, KJS::Object &, const KJS::List &args )
+{
+ QMenuData *menu = dynamic_cast<QMenuData *>( proxy->object() );
+ if( !menu )
+ return KJS::Boolean(false);
+ int idx = extractInt(exec, args, 0);
+ return KJS::Number( menu->insertSeparator(idx) );
+}
+
+} // namespace KJSEmbed::Bindings
+}// namespace KJSEmbed
+
+// Local Variables:
+// c-basic-offset: 4
+// End:
+
diff --git a/kjsembed/customobject_imp.h b/kjsembed/customobject_imp.h
new file mode 100644
index 00000000..553e55b9
--- /dev/null
+++ b/kjsembed/customobject_imp.h
@@ -0,0 +1,224 @@
+// -*- c++ -*-
+
+/*
+ * Copyright (C) 2001-2004, Richard J. Moore <rich@kde.org>
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Library General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Library General Public License for more details.
+ *
+ * You should have received a copy of the GNU Library General Public License
+ * along with this library; see the file COPYING.LIB. If not, write to
+ * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
+ * Boston, MA 02110-1301, USA.
+ */
+
+#ifndef KJSEMBEDCUSTOMOBJECTIMP_H
+#define KJSEMBEDCUSTOMOBJECTIMP_H
+
+#include <kjs/object.h>
+#include <kjsembed/jsbinding.h>
+#include <kjsembed/slotutils.h>
+
+#include <kjsembed/jsobjectproxy_imp.h>
+
+class QObject;
+
+namespace KJSEmbed {
+namespace Bindings {
+
+/**
+ * Implements the JS methods of custom object bindings.
+ *
+ * @author Richard Moore, rich@kde.org
+ * @version $Id$
+ */
+class KJSEMBED_EXPORT CustomObjectImp : public JSProxyImp
+{
+public:
+ /** Identifiers for the methods provided by this class. */
+ enum MethodId {
+ WidgetGrabWidget,
+ WidgetDrawLine,
+ WidgetDrawText,
+
+ ListBoxInsertItem,
+ ListBoxRemoveItem,
+
+ ListViewAddColumn,
+ ListViewInsertItem,
+ ListViewSelectedItem,
+ ListViewHideColumn,
+ ListViewTakeItem,
+ ListViewFirstChild,
+ ListViewCurrentItem,
+
+
+ MainWindowSetCentralWidget,
+ MainWindowCreateGUI,
+ MainWindowMenuBar,
+ MainWindowStatusBar,
+ MainWindowSetStandardToolBarMenuEnabled,
+
+ TabWidgetAddTab,
+
+ ScrollViewViewport,
+ ScrollViewAddChild,
+
+ ApplicationExec,
+
+ TimerIsActive,
+ TimerStart,
+ TimerStop,
+
+ BoxLayoutAddWidget,
+ BoxLayoutAddSpacing,
+ BoxLayoutAddStretch,
+ BoxLayoutAddLayout,
+
+ URLRequesterSetMode,
+ URLRequesterSetFilter,
+ URLRequesterUrl,
+ URLRequesterSetLocalProtocol,
+ URLRequesterLocalProtocol,
+
+ KXMLGUIClientActionCollection,
+
+ KReadOnlyPartOpenStream,
+ KReadOnlyPartWriteStream,
+ KReadOnlyPartCloseStream,
+
+ HBoxSpacing,
+
+ KHTMLPartSelectAll,
+ KHTMLPartHasSelection,
+ KHTMLPartSelectedText,
+
+ KSystemTrayContextMenu,
+ KSystemTrayActionCollection,
+ KSystemTrayLoadIcon,
+
+ QCanvasViewCanvas,
+ QCanvasViewSetCanvas,
+
+ QSplashScreenSetPixmap,
+ QSplashScreenPixmap,
+ QSplashScreenFinish,
+ QSplashScreenRepaint,
+
+ QToolBoxAddItem,
+ QToolBoxInsertItem,
+ QToolBoxRemoveItem,
+ QToolBoxItemLabel,
+ QToolBoxSetItemLabel,
+ QToolBoxItemIconSet,
+ QToolBoxSetItemIconSet,
+ QToolBoxItem,
+
+ QMenuDataInsertItem,
+ QMenuDataRemoveItem,
+ QMenuDataInsertSeparator
+ };
+
+ static void addBindings( KJS::ExecState *exec, KJS::Object &object );
+
+ CustomObjectImp( KJS::ExecState *exec, int id, JSObjectProxy *parent );
+ virtual ~CustomObjectImp() {}
+
+ KJS::Value widgetGrabWidget(KJS::ExecState *exec, KJS::Object &, const KJS::List &args );
+ void widgetDrawLine( KJS::ExecState *exec, KJS::Object &, const KJS::List &args );
+ void widgetDrawText( KJS::ExecState *exec, KJS::Object &, const KJS::List &args );
+
+ void listBoxInsertItem( KJS::ExecState *exec, KJS::Object &, const KJS::List &args );
+
+ void listViewAddColumn( KJS::ExecState *exec, KJS::Object &, const KJS::List &args );
+ void listViewInsertItem( KJS::ExecState *exec, KJS::Object &, const KJS::List &args );
+ KJS::Value listViewSelectedItem( KJS::ExecState *exec, KJS::Object &, const KJS::List & );
+ void listViewHideColumn( KJS::ExecState *exec, KJS::Object &, const KJS::List &args );
+
+ void mainWinSetCentralWidget( KJS::ExecState *exec, KJS::Object &, const KJS::List &args );
+ void mainWinCreateGUI( KJS::ExecState *exec, KJS::Object &, const KJS::List &args );
+ KJS::Value mainWinMenuBar( KJS::ExecState *exec, KJS::Object &, const KJS::List &args );
+ KJS::Value mainWinStatusBar( KJS::ExecState *exec, KJS::Object &, const KJS::List &args );
+ void mainWinSetStandardToolBarMenuEnabled( KJS::ExecState *exec, KJS::Object &, const KJS::List &args );
+
+ void tabWidgetAddTab( KJS::ExecState *exec, KJS::Object&, const KJS::List &args );
+
+ KJS::Value scrollViewViewport( KJS::ExecState *exec, KJS::Object&, const KJS::List &args );
+ void scrollViewAddChild( KJS::ExecState *exec, KJS::Object&, const KJS::List &args );
+
+ KJS::Value applicationExec( KJS::ExecState *exec, KJS::Object &, const KJS::List &args );
+
+ KJS::Value timerIsActive( KJS::ExecState *exec, KJS::Object &, const KJS::List &args );
+ KJS::Value timerStart( KJS::ExecState *exec, KJS::Object &, const KJS::List &args );
+ KJS::Value timerStop( KJS::ExecState *exec, KJS::Object &, const KJS::List &args );
+
+ void boxLayoutAddWidget( KJS::ExecState *exec, KJS::Object &, const KJS::List &args );
+ void boxLayoutAddSpacing( KJS::ExecState *exec, KJS::Object &, const KJS::List &args );
+ void boxLayoutAddStretch( KJS::ExecState *exec, KJS::Object &, const KJS::List &args );
+ void boxLayoutAddLayout( KJS::ExecState *exec, KJS::Object &, const KJS::List &args );
+
+ KJS::Value xmlguiClientActionCollection( KJS::ExecState *exec, KJS::Object &, const KJS::List &args );
+
+ KJS::Value kroPartOpenStream( KJS::ExecState *exec, KJS::Object &, const KJS::List &args );
+ KJS::Value kroPartWriteStream( KJS::ExecState *exec, KJS::Object &, const KJS::List &args );
+ KJS::Value kroPartCloseStream( KJS::ExecState *exec, KJS::Object &, const KJS::List &args );
+
+ void hboxSpacing( KJS::ExecState *exec, KJS::Object &, const KJS::List &args );
+
+ void khtmlPartSelectAll( KJS::ExecState *, KJS::Object &, const KJS::List & );
+ KJS::Value khtmlPartHasSelection( KJS::ExecState *, KJS::Object &, const KJS::List & );
+ KJS::Value khtmlPartSelectedText( KJS::ExecState *, KJS::Object &, const KJS::List &args );
+
+ KJS::Value ksystemtrayContextMenu( KJS::ExecState *exec, KJS::Object&, const KJS::List &args );
+ KJS::Value ksystemtrayActionCollection( KJS::ExecState *exec, KJS::Object&, const KJS::List &args );
+ KJS::Value ksystemtrayLoadIcon( KJS::ExecState *exec, KJS::Object&, const KJS::List &args );
+
+ KJS::Value qcanvasViewCanvas( KJS::ExecState *exec, KJS::Object&, const KJS::List &args );
+ void qcanvasViewSetCanvas( KJS::ExecState *exec, KJS::Object&, const KJS::List &args );
+
+ KJS::Value qsplashScreenSetPixmap(KJS::ExecState *exec, KJS::Object &, const KJS::List & );
+ KJS::Value qsplashScreenPixmap(KJS::ExecState *exec, KJS::Object &, const KJS::List & );
+ KJS::Value qsplashScreenFinish(KJS::ExecState *exec, KJS::Object &, const KJS::List & );
+ KJS::Value qsplashScreenRepaint(KJS::ExecState *exec, KJS::Object &, const KJS::List & );
+
+ KJS::Value qlistViewTakeItem(KJS::ExecState *exec, KJS::Object &, const KJS::List & );
+ KJS::Value qlistViewFirstChild(KJS::ExecState *exec, KJS::Object &, const KJS::List & );
+ KJS::Value qlistViewCurrentItem(KJS::ExecState *exec, KJS::Object &, const KJS::List & );
+
+ KJS::Value qtoolBoxAddItem(KJS::ExecState *exec, KJS::Object &, const KJS::List & );
+ KJS::Value qtoolBoxInsertItem(KJS::ExecState *exec, KJS::Object &, const KJS::List & );
+ void qtoolBoxRemoveItem(KJS::ExecState *exec, KJS::Object &, const KJS::List & );
+ KJS::Value qtoolBoxItemLabel(KJS::ExecState *exec, KJS::Object &, const KJS::List & );
+ void qtoolBoxSetItemLabel(KJS::ExecState *exec, KJS::Object &, const KJS::List & );
+ KJS::Value qtoolBoxItemIconSet(KJS::ExecState *exec, KJS::Object &, const KJS::List & );
+ void qtoolBoxSetItemIconSet(KJS::ExecState *exec, KJS::Object &, const KJS::List & );
+ KJS::Value qtoolBoxItem(KJS::ExecState *exec, KJS::Object &, const KJS::List & );
+
+ KJS::Value qmenuDataInsertItem(KJS::ExecState *exec, KJS::Object &, const KJS::List & );
+ void qmenuDataRemoveItem(KJS::ExecState *exec, KJS::Object &, const KJS::List & );
+ KJS::Value qmenuDataInsertSeparator(KJS::ExecState *exec, KJS::Object &, const KJS::List & );
+
+ virtual bool implementsCall() const { return true; }
+ virtual KJS::Value call( KJS::ExecState *exec, KJS::Object &self, const KJS::List &args );
+
+private:
+ int id;
+ JSObjectProxy *proxy;
+ class CustomObjectImpPrivate *d;
+};
+
+} // namespace KJSEmbed::Bindings
+} // namespace KJSEmbed
+
+#endif // KJSEMBEDCUSTOMOBJECTIMP_H
+
+// Local Variables:
+// c-basic-offset: 4
+// End:
diff --git a/kjsembed/design.h b/kjsembed/design.h
new file mode 100644
index 00000000..d255aeef
--- /dev/null
+++ b/kjsembed/design.h
@@ -0,0 +1,183 @@
+/*
+ * Copyright (C) 2002-2004, Richard J. Moore <rich@kde.org>
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Library General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Library General Public License for more details.
+ *
+ * You should have received a copy of the GNU Library General Public License
+ * along with this library; see the file COPYING.LIB. If not, write to
+ * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
+ * Boston, MA 02110-1301, USA.
+ */
+
+/**
+ * @mainpage Framework for embedding the KJS Javascript Interpreter
+ *
+ * @section intro Introduction
+ *
+ * The KJSEmbed library provides a framework that makes it easy for
+ * applications to embed KJS, the KDE JavaScript interpreter. The
+ * facilities available include a JS console widget, a dialog loader
+ * and a binding between JS and the properties and slots of QObjects.
+ *
+ * @section classes Important Classes
+ *
+ * The most important classes to consider are:
+ *
+ * @ref KJSEmbed::KJSEmbedPart :
+ * Main API for KJSEmbed.
+ *
+ * @ref KJSEmbed::JSConsoleWidget :
+ * A widget that provides an interactive JS console.
+ *
+ * @ref KJSEmbed::JSObjectProxy :
+ * A Javascript object that can access the properties of a QObject,
+ *
+ * @ref KJSEmbed::SecurityPolicy :
+ * Defines a security policy for @ref JSObjectProxy.
+ *
+ * @section basic Basic Usage
+ *
+ * The simplest way to use KJSEmbed is by simply creating a Javascript
+ * console widget. The console allows the user to enter and run arbitrary
+ * Javascript expressions.
+ * <pre>
+ * KJSEmbed::JSConsoleWidget *win = new KJSEmbed::JSConsoleWidget();
+ * win->show();
+ * </pre>
+ * The embedding application can run scripts in the console using the
+ * execute() method.
+ *
+ * The best way to use KJSEmbed is keep control of the interpreter
+ * yourself using the KJSEmbedPart, this way you can make parts of your
+ * application available to scripts. The following example creates its
+ * own interpreter then binds it to the console:
+ * <pre>
+ * KJSEmbed::KJSEmbedPart *js = new KJSEmbed::KJSEmbedPart();
+ * KJSEmbed::JSConsoleWidget *console = js->view();
+ * </pre>
+ *
+ * @section proxy Publishing QObjects
+ *
+ * KJSEmbed allows applications to make arbitrary QObjects visible to a
+ * Javascript interpreter. The binding itself is provided by the @ref JSProxyObject
+ * class, but is more easily used via the addObject(...) methods of @ref KJSEmbedPart.
+ *
+ * The following code shows how easy it is to make an object available for
+ * scripting. It creates a QVBox containing two QLabels then makes them visible
+ * to KJSEmbed:
+ * <pre>
+ * QVBox *toplevel = new QVBox( 0, "box" );
+ * QLabel *title = new QLabel( "Some Title", toplevel, "title");
+ * QLabel *main = new QLabel( "Some text, more text.", toplevel, "main" );
+ *
+ * js->addObject( title );
+ * js->addObject( main, "text" );
+ * </pre>
+ *
+ * Publishing an object makes it possibile for scripts to access both the
+ * properties and slots as if it was a normal Javascript object. The code
+ * above allows scripts read-write access to the label properties as this
+ * script illustrates:
+ * <pre>
+ * title.text = "World"
+ * title.text = "Hello " + title.text
+ * </pre>
+ * The script above would set the text of the label to 'Hello World'.
+ *
+ * The slots of a QObject bound to the interpreter are made available to
+ * scripts as if they normal methods. In the example above, we could conceal
+ * the label 'main' entirely by calling its hide() slot:
+ * <pre>
+ * main.hide()
+ * </pre>
+ *
+ * @section tree Access To the QObject Tree
+ *
+ * As well as providing script access to an individual widget, KJSEmbed
+ * allows scripts to walk the object tree and access others. If we
+ * modified the previous example to publish the QBox widget 'toplevel' as
+ * follows:
+ * <pre>
+ * js->addObject( toplevel, "window" );
+ * </pre>
+ * Then, despite the fact we've only explicitly published a single widget,
+ * we've also provided access to both 'main' and 'title'. The ability
+ * to navigate the object tree is limited by the SecurityPolicy, the default
+ * policy only allows scripts access to children of the published object.
+ *
+ * To achieve the same result as before, we could use script like this:
+ * <pre>
+ * window.child("main").text = "World"
+ * window.child("main").text = "Hello " + window.child("main").text
+ * </pre>
+ * The result of this script is identical to the previous example.
+ *
+ * @section examples Some KJSEmbed examples
+ * @subsection embedjs Example of embedding KJSEmbed into an application.
+ * @image html embedjs.png
+ * This is an example of how to embed and interface with KJSEmbed. This
+ * example covers:
+ * @li embedding the kpart.
+ * @li publishing the interface.
+ * @li calling javascript members.
+ * @li handling javascript objects returned by these members.
+ * @li embedding the KJSEmbed console.
+ * @dontinclude embedviewimp.cpp
+ * To embed the interpreter we can just create a new KJSEmbed part.
+ * @skipline m_part
+ * To publish the objects we can then call @ref KJSEmbed::KJSEmbedPart::addObject on our part.
+ * This will then add any QObject based class the the global scope of the
+ * javascript interperter.
+ * @skipline addObject
+ * Once you have your objects published you can then execute javascript code from a file.
+ * @skipline runFile
+ * @dontinclude embedviewimp.cpp
+ * When the script is running javascript methods can be accessed by calling the
+ * @ref KJSEmbed::KJSEmbedPart::callMethod method.
+ * @skipline args
+ * @until callMethod
+ * Any arguments that you wish to pass into the javascript method are contained in the
+ * @ref KJS::List. This is just a list of @ref KJS::Value objects and can be created from
+ * QVariants or from custom @ref KJS::Object based classes.
+ * Once you have the data back from the method you can convert it easily from the @ref KJS::Value
+ * type to a QVariant with the @ref KJSEmbed::convertToVariant method.
+ * @line personalData
+ * @until notes:
+ * Complex arrays or @ref KJS::Objects are transparently converted to QVariant::Map types so
+ * they can easily be manipulated from C++.
+ * The KJSEmbed::console is also easy to add to applications. An example of a method that
+ * will toggle the console is below.
+ * @skipline consoleClicked
+ * @until }
+ *
+ * @subsection embedjs Example of Using Qt Designer files in KJSEmbed.
+ * @image html jscalc.png
+ * This is a very simple example that shows off how to use Qt widget files
+ * and connect the objects to javascript functions.
+ * @dontinclude calc.js
+ * To load the Qt Designer user interface file and publish the objects in the XML file
+ * the KJSEmbed Factory class has a UI loader.
+ * @skipline Factory.loadui
+ * Once the file is loaded the user interface object can then be manipulated by javascript.
+ * @line new Calculator
+ * @until application.exec
+ * It is important to note that before the javascript will support connecting signals and slots
+ * the application.exec() method must be called.
+ *
+ * Connecting the user interface to javascript methods is similar C++ in that you create
+ * a method and then use the connect(...) method to connect the signal to the method.
+ * @dontinclude calc.js
+ * @skipline function
+ * @until display
+ * @skipline this.clear
+ * @skipline clear
+ * @skipline }
+ */
diff --git a/kjsembed/docs/ChangeLog b/kjsembed/docs/ChangeLog
new file mode 100644
index 00000000..95cedca2
--- /dev/null
+++ b/kjsembed/docs/ChangeLog
@@ -0,0 +1,4243 @@
+2004-12-11 Saturday 09:01 geiseri
+
+ Added two examples to the Doxygen documentation.
+
+2004-12-11 Saturday 07:27 geiseri
+
+ Updated Doxyfile.
+
+2004-12-11 Saturday 07:22 geiseri
+
+ Added method throwError(...).
+ This method will take an error message and a type and throw a
+ complete exception with an error object. This object has the
+ following properties that can be accessed:
+ line - the line number the exception happened at.
+ sourceid - the source fragment the exception happened in.
+ message - the actual error message.
+ name - the error type.
+
+ This object can be accessed in both javascript and C++, and
+ will be returned as the completion object when there is an
+ exception in an executed script.
+
+ Moved all errors in the code to throwError()
+
+2004-12-11 Saturday 07:15 geiseri
+
+ Use extractQObject here because it is safer.
+
+2004-12-11 Saturday 07:15 geiseri
+
+ Added home directory path, current path, and application directory path.
+
+2004-12-11 Saturday 07:12 geiseri
+
+ Added more verbose documentation on how to use the part interface.
+
+2004-12-11 Saturday 07:11 geiseri
+
+ documentation cleanup
+
+2004-12-11 Saturday 02:25 geiseri
+
+ Actually return the line number that the error happened.
+
+2004-12-10 Friday 13:12 geiseri
+
+ Things that are created via the widgetFactory should be owned in
+ javascript. So when the parent is destroyed so will the children.
+
+2004-12-10 Friday 13:10 geiseri
+
+ Make sure the KActionCollection is native, it seems that
+ it has no parent so the GC will happily collect it.
+
+2004-12-10 Friday 13:09 geiseri
+
+ Added registration of more proxies.
+
+2004-12-10 Friday 13:07 geiseri
+
+ Small code cleanup.
+
+2004-12-10 Friday 13:03 geiseri
+
+ remove some debug information
+
+2004-12-10 Friday 13:01 geiseri
+
+ Added some debugging info for object ownership.
+ Moved the typeName to a pure virtual here. We already
+ broke BC here, and this method is in every child class.
+
+2004-12-10 Friday 12:59 geiseri
+
+ Implemented better QVariant to JSObject mappings. The big change here
+ that Javascript arrays and Javascript objects can be mapped to QVariants
+ in C++. Conversions break down as follows:
+ QStringList -> Array of javascript strings.
+ QValueList<QVariant> -> Array of Javascript values.
+ QMap<QString,QVariant> -> Object/Array that has each QString key as
+ a property, and the QVariant is mapped to a Javascript value.
+
+ From Javascript the conversions are a little different.
+ All arrays that have a numeric index will be converted to
+ QValueList<QVariant> QVariants. These can be mapped to both
+ QStringList and to normal QValueList. An example would be like this:
+ KJS::Value someArrayValue;
+ QStringList strLst = convertToVariant(exec, someArrayValue).toStringList();
+ QValueList<QVariant> varLst
+ = convertToVariant( exec, someArrayValue).toList();
+
+ Now if the Javascript value is a Javascript object or a map then
+ the conversion will go to a QMap<QString,QVariant>. An example of
+ this would be like:
+ KJS::Value someJSObject;
+ QMap<QString,QVariant> map = convertToVariant(exec,someJSObject)
+ .toMap();
+ QString someVal = map["someProp"].toString();
+
+ This is done via some testing of the array and you can trip
+ it up in some cases:
+ 1) If the object is empty, or null will return an empty QMap
+ 2) If the object is an array that has the last element null
+ then a QMap will be returned.
+
+ The first case is not much of an issue because an empty variant
+ is the same for all types, but the second case can cause
+ unexpected results.
+
+ In cases of sparse arrays the empty values will be filled in
+ with empty QVariants in the QValueList.
+
+2004-12-10 Friday 12:42 geiseri
+
+ Changed the example to actually show off using KJSEmbed.
+ Example shows the following:
+ 1) Embedding KJSEmbed.
+ 2) Calling Javascript methods from C++.
+ 3) Transparent mapping of custom javascript objects into QVariant maps.
+ 4) Adding widgets to a C++ based form from Javascript.
+ 5) Execution of a script from outside of the main application.
+
+2004-12-09 Thursday 23:55 geiseri
+
+ removed generated docs from cvs
+
+2004-12-09 Thursday 15:09 geiseri
+
+ torture test for QFrame, still fails.
+
+2004-12-09 Thursday 15:07 geiseri
+
+ more complete test for arrays
+
+2004-12-08 Wednesday 11:15 geiseri
+
+ Added a QVariant slot so C++ bindings can easier get more
+ complex data types into the bindings.
+
+2004-12-08 Wednesday 11:12 geiseri
+
+ Fixed some logic errors.
+ Throw exceptions with meaningful errors.
+
+2004-12-08 Wednesday 11:12 geiseri
+
+ Removed debug information that was screwing with QVariants.
+
+2004-12-07 Tuesday 20:10 staikos
+
+ compile
+
+2004-12-07 Tuesday 12:02 geiseri
+
+ do not delete a QWidget if you are painting on it, its rude
+
+2004-12-07 Tuesday 12:01 geiseri
+
+ fix name of include
+
+2004-12-06 Monday 14:08 geiseri
+
+ Moved to new bindings extension class.
+
+2004-12-06 Monday 14:07 geiseri
+
+ With new API QListViewItem objects now iterate properly.
+
+ QListView::firstChild() and QListView::currentSelection now work.
+ QListViewItems can now iterate property.
+
+ The test now shows how to use these methods.
+
+
+2004-12-06 Monday 14:04 geiseri
+
+ Moved registered bindings to their own baseclass. This API is not stable
+ so it is subject to change. More documentation on this will follow once
+ it is more solid.
+
+2004-12-06 Monday 13:34 geiseri
+
+ Removed autogenerated docs, since the scripts now work to generate them
+ property on Qt only and KDE mode.
+
+2004-12-05 Sunday 19:54 geiseri
+
+ Moved QListViewItem and QCheckListItem to the object registry.
+
+2004-12-05 Sunday 19:11 geiseri
+
+ Moved bindings to the new object registry.
+
+ The new object registry allows developers to add custom types
+ to KJSEmbed when they embed the interpreter into their applications.
+
+ To add a binding you create the binding as binding plugin, but instead
+ of using the KTrader to register the plugin, you call
+ JSFactory::registerOpaqueType("Name", new TypeFactory(parent,"name");
+
+ Now KJS can create your type and manipulate it. This currently supports
+ only opaque types, QObject types are next once this migration is
+ complete.
+
+2004-12-05 Sunday 19:08 geiseri
+
+ Throw errors on type mismatches. This causes scripts to
+ actually give errors where they happen vs at some random
+ later point.
+
+2004-12-05 Sunday 10:12 geiseri
+
+ Test for QFrame
+
+2004-12-04 Saturday 17:57 geiseri
+
+ Do not delete the internal dcop client pointer, it is considered rude.
+
+2004-12-04 Saturday 14:25 geiseri
+
+ Added QProgressDialog to the list of creatable types.
+
+2004-12-04 Saturday 02:34 geiseri
+
+ QT_NO_ASCII_CAST build fix.
+
+2004-12-04 Saturday 02:25 geiseri
+
+ Gave the KJSEmbed documentation viewer a facelift.
+ Runs in Qt only and KDE mode just fine.
+ Search is not implemented, but most browser features are.
+ Maybe we need to fix up the dump() output and make it
+ follow the current KDE color styles?
+
+2004-12-04 Saturday 01:33 geiseri
+
+ Add QToolBox items to the published children when comming from QWidgetFactory
+
+2004-12-03 Friday 21:28 geiseri
+
+ Small cleanup.
+
+2004-12-03 Friday 21:27 geiseri
+
+ Add config to Qt only.
+
+2004-12-03 Friday 21:27 geiseri
+
+ dont delete the builting kapplication ptr.
+
+2004-12-03 Friday 21:25 geiseri
+
+ code cleanup.
+
+2004-12-03 Friday 20:07 geiseri
+
+ These are no longer needed.
+
+2004-12-03 Friday 20:06 geiseri
+
+ Added createObject method.
+
+2004-12-03 Friday 20:06 geiseri
+
+ logic fix
+
+2004-12-03 Friday 20:05 geiseri
+
+ Do not delete QObjects that are managed by their parents.
+
+2004-12-03 Friday 20:04 geiseri
+
+ Added Factory.createObject(classname,args,...) for those coming
+ from windows land.
+
+2004-12-03 Friday 20:01 geiseri
+
+ Do not manage QListView, and ListBox items as the containers will.
+ Had to wash this file over with AStyle, it was getting to be a mess.
+
+2004-12-02 Thursday 22:15 geiseri
+
+ note start position
+
+2004-12-02 Thursday 21:50 geiseri
+
+ Added QRect::contains(...) to Rect class.
+ Updated game board to detect objects getting in the target.
+
+2004-12-01 Wednesday 14:45 geiseri
+
+ make 10 items, use QFrame for formatting.
+
+2004-12-01 Wednesday 11:25 geiseri
+
+ added a small gameboard example
+
+2004-12-01 Wednesday 09:58 geiseri
+
+ Added tests for QSize, QPoint and QRect.
+
+2004-12-01 Wednesday 09:58 geiseri
+
+ Added support for:
+ QPoint
+ QRect
+ QSize
+
+ Cleanup headers in QPen
+
+ These are all handled as value proxies so they are transparently supported
+ in slots, QObject bindings, and dcop. These can be used by their variant
+ names of Point, Rect and Size respectivly. Also constructors are provided
+ for Point, Rect and Size so you can construct items in one step
+ ex:
+ var point = new Point(x,y);
+ var size = new Size(w,h);
+ var rect = new Rect(x,y,w,h);
+
+2004-12-01 Wednesday 09:54 geiseri
+
+ Throw an exception on a handler error so the user can figure out what went wrong.
+
+2004-12-01 Wednesday 09:54 geiseri
+
+ Added drag and drop event handlers.
+
+2004-11-30 Tuesday 17:47 geiseri
+
+ test kconfig more robustly.
+
+2004-11-30 Tuesday 12:02 geiseri
+
+ Fixed issue where config files where not reading and writing properly
+ When the default args where removed they would pass invalid items to
+ the KConfig methods. This would basicly cause the methods to fail
+ in strange and entertaining ways. Since the methods with default
+ args had the default args ignored before this really changes nothing
+ on the public API. This will someday change to an opaque proxy
+ though and those args will work.
+
+2004-11-30 Tuesday 12:00 geiseri
+
+ save the max input from the dialog
+
+2004-11-30 Tuesday 10:45 geiseri
+
+ Added support for passing QStringList through slots. This fixed the problems with KConfig bindings not showing up. It should also fix the problem of not being able to pass StringLists to C++ slots that have been published to javascript.
+
+2004-11-29 Monday 17:41 annma
+
+ add a maximum value that can be changed in config
+ config dialog is a bit bloated though now ;-)
+
+2004-11-29 Monday 13:26 geiseri
+
+ Start of QSettings support for real. Binding is complete hozed though so it probably needs to be replaced before we release the next release.
+
+2004-11-29 Monday 13:25 geiseri
+
+ Qt only fixes
+
+2004-11-29 Monday 13:22 geiseri
+
+ Qt only fixes.
+
+2004-11-29 Monday 13:22 geiseri
+
+ Remove unused headers.
+
+2004-11-29 Monday 11:14 geiseri
+
+ Update to use KJSEmbed from KDE 3.3 features.
+
+2004-11-28 Sunday 21:38 geiseri
+
+ removed default args, they really screw up QObject bindings.
+
+2004-11-28 Sunday 21:32 geiseri
+
+ more qtonly config fixes
+
+2004-11-28 Sunday 21:11 geiseri
+
+ Added some help
+
+2004-11-28 Sunday 20:39 geiseri
+
+ added widget extraction methods to cleanup code elsewhere
+
+2004-11-28 Sunday 20:23 geiseri
+
+ Small example application with KJSEmbed:
+ This is a small math drill application I wrote for my cousin this weekend. She is
+ having a horrible time of it in math, so I created a simple drill utility for addition and
+ subtraction. Basicly what it does is throws random math problems at you for a
+ minute. The goal is to see how many you can get correct in that time. This is loosely
+ based off of a very foggy memory of a math drill that I did in second grade. I
+ think the important message here is that KJSEmbed could be a powerful tool
+ that teachers who are not strong programmers could create learning tools in short
+ order. This particular app took me all of 45 minutes, and after three days of random
+ playing of the game (that and khangman) she got up to 38 questions correctly answered
+ in a minute up from about 25. Not sure if its earth shattering, but its an improvement.
+
+ ccmail: annma@kde.org
+
+2004-11-28 Sunday 20:14 geiseri
+
+ Test for Config.
+
+2004-11-28 Sunday 20:13 geiseri
+
+ Splashscreen test.
+
+2004-11-28 Sunday 20:13 geiseri
+
+ Add bindings to Qt only.
+
+2004-11-28 Sunday 20:12 geiseri
+
+ Vain attempt to fix the QCanvas bindings. They are no longer crashing, but they are so not implemented they don't do much yet.
+
+2004-11-28 Sunday 20:12 geiseri
+
+ Attempt at unscrewing up this binding.
+ It compiles and works slightly more, but it needs a friend seriously.
+
+2004-11-28 Sunday 20:11 geiseri
+
+ QFrame now actually works as expected.
+
+2004-11-28 Sunday 20:10 geiseri
+
+ Remove dead code.
+ Fix stupid corner case where the QPainter would become invalid and crash kjsembed.
+
+2004-11-28 Sunday 20:09 geiseri
+
+ Compile in Qt Only mode
+
+2004-11-28 Sunday 20:08 geiseri
+
+ Remove dead code.
+ Enable working with Qt Only mode.
+
+2004-11-28 Sunday 20:08 geiseri
+
+ Change this so the Config bindings handle all the dirty work. This
+ removes a very strange misbehavior with the Config object when
+ used with scripts.
+ Started adding support for QSettings in Qt Only mode, but its disabled for now.
+
+2004-11-28 Sunday 20:07 geiseri
+
+ Change this so the Config bindings handle all the dirty work. This
+ removes a very strange misbehavior with the Config object when
+ used with scripts.
+
+2004-11-28 Sunday 20:06 geiseri
+
+ QSplashScreen works again, the object was there but the bindings where not.
+ General code cleanup.
+ Made the factory throw some exceptions instead of just warnings. This will
+ allow developers to actually be able to debug their scripts with a nondebug
+ version of KJSEmbed.
+
+2004-11-28 Sunday 20:03 geiseri
+
+ Clean up old debug messages.
+
+2004-11-28 Sunday 20:00 geiseri
+
+ Clean up code.
+ Remove old debug messages.
+
+2004-11-28 Sunday 19:59 geiseri
+
+ Throw a real exception on a slot error so the script actually knows what the heck went wrong.
+ Remove some debug messages that no longer make sense.
+
+2004-11-28 Sunday 19:57 geiseri
+
+ Add bindings to Qt only compile
+
+2004-11-24 Wednesday 19:49 geiseri
+
+ there is suck and there is this, temporary fix until we can get a better solution.
+
+2004-11-24 Wednesday 17:00 geiseri
+
+ sync with zack's tree, builds but sucks
+
+2004-11-24 Wednesday 16:59 geiseri
+
+ sync with zack's tree, isnt building yet
+
+2004-11-24 Wednesday 16:58 geiseri
+
+ cleanup dead code
+
+2004-11-24 Wednesday 11:37 geiseri
+
+ Removed the copy operator and clone functions. They are never called, and if they
+ where they would not function as one would expect.
+
+ Check for void types in the destructor. This should keep anyone from trying
+ to delete a void *.
+
+2004-11-24 Wednesday 01:59 staikos
+
+ QT_NO_COMPAT fix (untested, but at least it compiles now):
+ int match ( const QString & str, int index = 0, int * len = 0, bool indexIsStart = TRUE ) const (obsolete)
+ int search ( const QString & str, int offset = 0, CaretMode caretMode = CaretAtZero ) const
+
+2004-11-24 Wednesday 01:36 geiseri
+
+ remove debug information
+
+2004-11-24 Wednesday 01:28 geiseri
+
+ fixed example
+
+2004-11-24 Wednesday 01:21 geiseri
+
+ globals is now gone.
+
+2004-11-24 Wednesday 01:21 geiseri
+
+ toNative fixes
+
+2004-11-24 Wednesday 01:20 geiseri
+
+ added missing include
+
+2004-11-24 Wednesday 01:19 geiseri
+
+ symbol visibility can work in KDE land now too.
+
+2004-11-24 Wednesday 01:02 geiseri
+
+ toNative<> fixes.
+
+2004-11-24 Wednesday 00:54 geiseri
+
+ More memory management fun:
+ 1) Removed the any object, it basicly was useless for
+ managing pointers.
+ 2) Changed the opaque proxy to handle the pointers
+ internally. Based heavily on boost::any but focuses on
+ pointers only.
+ 3) Things to note now that KJS is actually managing
+ memory. If you create a QObject binding but do not store
+ it anywhere and let it go out of scope the GC WILL delete
+ it. This may cause some unwanted side effects, so
+ please keep track of your objects.
+ 4) Fixed some casting problems that was causing the
+ QCanvas bindings not to work. They have not been completely
+ solved yet but they are at least not crashing anymore.
+
+ There are still a few crashes, but these should be easier to
+ track down now that we have more clear ownership roles.
+
+2004-11-23 Tuesday 18:06 staikos
+
+ warn the users
+
+2004-11-23 Tuesday 11:51 geiseri
+
+ Clarified the object ownership symantics. This changes the interface a bit so instead of a boolean there is now an enum. Also the create methods in the factory will automaticly give ownership of pointers created by the factory to KJSEmbed. Any external proxies created will be owned by the object that creates it. To change ownership you now use the method JSProxy::setOwner() and JSProxy::owner() to read it.
+
+2004-11-23 Tuesday 11:44 geiseri
+
+ do not screw up dlls
+
+2004-11-23 Tuesday 11:44 geiseri
+
+ header cleanup
+
+2004-11-23 Tuesday 11:43 geiseri
+
+ Share symbol visibility with GCC
+
+2004-11-22 Monday 01:27 zrusin
+
+ We should have a law preventing Ian/Rich from creating Makefile's ;)
+
+2004-11-19 Friday 21:16 bmeyer
+
+ Terminal=0 -> Terminal=false
+ Added missing ; to Categories
+
+2004-11-08 Monday 10:12 geiseri
+
+ Qt Events now work on windows.
+ GC works on win32.
+ NOTE on win32: the standard in/out/err will crash if you do not have
+ matching Qt debug and KJSEmbed debug libs. So if you have a nondebug
+ build of Qt NEVER build a debug version of QJSEmbed. Gold star for
+ MS on this one.
+
+2004-10-03 Sunday 23:25 zrusin
+
+ fixing build
+
+2004-09-23 Thursday 15:51 mlaurent
+
+ CVS_SILENT QString(i18n(...)) -> i18n(...)
+
+2004-09-01 Wednesday 20:47 geiseri
+
+ more include fixes
+
+2004-09-01 Wednesday 20:43 geiseri
+
+ one more makefile.am fix
+
+2004-09-01 Wednesday 20:42 geiseri
+
+ i just cant get enough of autohell...
+
+2004-09-01 Wednesday 20:36 geiseri
+
+ added qtonly project files.
+
+2004-09-01 Wednesday 20:31 geiseri
+
+ More updates from qtonly version to bring it in sync with KDE version
+
+2004-09-01 Wednesday 20:11 geiseri
+
+ More updates from qtonly version to bring it in sync with KDE version
+
+2004-09-01 Wednesday 20:03 geiseri
+
+ move to plain boost::any. need to move the deletion of the pointers to the opaque proxies themselves.
+
+2004-09-01 Wednesday 19:58 geiseri
+
+ More updates from qtonly version to bring it in sync with KDE version
+
+2004-09-01 Wednesday 19:52 geiseri
+
+ for some reason vc7 gets confused on casting...
+
+2004-09-01 Wednesday 19:50 geiseri
+
+ qtonly fixes to the globals methods.
+
+2004-09-01 Wednesday 19:49 geiseri
+
+ More updates from qtonly version to bring it in sync with KDE version
+
+2004-09-01 Wednesday 19:00 geiseri
+
+ start merging win32 changes
+
+2004-09-01 Wednesday 10:32 geiseri
+
+ gc test
+
+2004-08-25 Wednesday 11:07 geiseri
+
+ Introduced any object to remove the void* in opaque proxy.
+ Introduced the concept of pointer ownership, this api is not yet stable though.
+
+2004-08-20 Friday 16:10 geiseri
+
+ doesnt anyone compile this anymore?
+
+2004-08-16 Monday 19:44 geiseri
+
+ mumble mumble, didnt this compile at one time...
+
+2004-08-16 Monday 09:28 geiseri
+
+ Qt only changes merged into KJSEmbed.
+
+2004-08-16 Monday 09:27 geiseri
+
+ Qt only fixes merged back into KJSEmbed.
+
+2004-08-16 Monday 09:22 geiseri
+
+ more robust exception handling. soon backtraces.
+
+2004-08-16 Monday 09:22 geiseri
+
+ attempt at custom signatures.
+
+2004-08-16 Monday 09:13 geiseri
+
+ Added KFileItem bindings for doing directory listviews with KFile.
+
+2004-08-16 Monday 08:54 geiseri
+
+ Update dcop test.
+
+2004-08-16 Monday 08:52 geiseri
+
+ moved methods to slots, since when this becomes a nonQt binding the properties will break.
+
+2004-08-16 Monday 08:51 geiseri
+
+ Added iconset bindings.
+
+2004-08-16 Monday 08:48 geiseri
+
+ Reorganization of the bindings here to make Qt/KDE separation easier.
+
+2004-08-16 Monday 08:46 geiseri
+
+ QWidget and QObject extraction helper functions.
+
+2004-08-16 Monday 08:45 geiseri
+
+ QComboBox and QPopup menu fixes.
+
+2004-07-14 Wednesday 04:31 binner
+
+ CVS_SILENT
+
+2004-06-21 Monday 14:58 binner
+
+ CVS_SILENT No punctuation in command line descriptions
+
+2004-06-21 Monday 06:17 binner
+
+ CVS_SILENT i18n style guide fixes
+
+2004-06-20 Sunday 18:51 rich
+
+ - Added a missing doc file and the test program for qcanvas.
+
+2004-06-20 Sunday 18:49 rich
+
+ - Improvements to the bindingwizard.
+
+ - Start of bindings for QCanvasXX. These might need to be disabled for the
+ 3.3 release but they're a good stress test of the code.
+
+ - Update docs.
+
+ - Added support for QPoint to jsbinding methods.
+
+2004-06-18 Friday 19:44 rich
+
+ - Added newlines to the documentation to make the html sources more readable.
+
+2004-06-18 Friday 19:33 rich
+
+ - Update docs
+
+2004-06-18 Friday 19:27 rich
+
+ - Added support for the QStringList parameter argument of the KParts
+ constructors. For now, this can only be used with the full 5 argument
+ forms of the factory's part construction methods. Added the test script
+ from Koos, though it can't be used without an accompanying applet!
+
+
+2004-06-18 Friday 18:51 rich
+
+ - Updated the qtbindings using the bindwizard. The problems identified in
+ #83427 and my own QListView testing turned out to be caused by a stupid
+ logic error in the code generated by the XSL. Basically, I forgot that
+ enum values start at 0 even if they're being automagically generated.
+
+2004-06-18 Friday 17:34 rich
+
+ - Reverted the updated QComboBox bindings. Looks like I need to do some
+ more work on making the XSL binding generator work with the custom
+ bindings code.
+
+ - Added a test case so I don't break this again.
+
+
+2004-06-12 Saturday 23:03 rich
+
+ - Update docs
+
+2004-06-12 Saturday 22:53 rich
+
+ - Added support for a couple of new types to the extractXX() methods.
+
+ - Major improvements to the binding wizard.
+
+2004-06-12 Saturday 20:51 rich
+
+ - Added action for launching ksnapshot.
+
+2004-06-12 Saturday 20:49 rich
+
+ - Reverted update of the QListViewItem bindings as it broke things.
+
+2004-06-11 Friday 20:52 rich
+
+ - Handling for slots with signatures xx( const QTime &) and xx( QWidget *).
+
+
+2004-06-11 Friday 19:03 rich
+
+ - Added a way for non-konq users to view the changelog.
+
+2004-06-11 Friday 18:45 rich
+
+ - Disable compilation of the embedding example. This example wasn't
+ written to support compilation with the library (something which
+ needs addressing). Bug #83020, Bug #82991.
+
+ - Added the missing kjs.pro for the qt-only build.
+
+
+2004-06-06 Sunday 20:58 rich
+
+ - Fixes to make qt-only mode work with the latest changes.
+
+2004-06-06 Sunday 20:42 rich
+
+ - Forgot to add the implementation.
+
+2004-06-06 Sunday 20:40 rich
+
+ - Added support for QCheckListItem.
+
+ - Regenerated qtbindings using the wizard.
+
+2004-06-06 Sunday 19:37 rich
+
+ - Added support for signals and slots with signature func(const QTime &)
+ including support for handling them from scripts.
+
+ - Added a check for exceptions occurring in event handlers.
+
+
+2004-06-06 Sunday 19:03 rich
+
+ - Added a few missing files.
+
+2004-06-06 Sunday 19:00 rich
+
+ - Updated documentation.
+
+2004-06-06 Sunday 18:44 rich
+
+ - Added a binding for the Qt namespace class. This gives scripts access to
+ important constants such as the alignment flags.
+
+ - Added an accessor for the KPropertiesDialog of a URL to NetAccess.
+
+ - Minor fix to the binding wizard to support classes that provide no methods.
+
+ - Added partially complete cropping tool to imunge, along with support for
+ showing the file's properties dialog.
+
+2004-06-06 Sunday 18:10 rich
+
+ CVS_SILENT fix ignores
+
+2004-06-05 Saturday 22:07 rich
+
+ - JSObjectProxy now reuses the same JSObjectEventProxy no matter how many
+ event handlers there are.
+
+2004-06-04 Friday 22:06 rich
+
+ - Added an example script that provides a documentation browser for the
+ qt-only build.
+
+2004-06-04 Friday 21:31 rich
+
+ - Added a script that makes building the qt-only kjsembed easy. All you
+ need to do is ./setup_qtonly in a clean checkout of kjsembed.
+
+ - Fixed some minor issues with types that only showed up because the
+ qt-only tree uses an unusual set of header files. (it's nice that this
+ development has the side effect of making some rare bugs visible).
+
+ - Added a minimal command line for the qt-only build. You can see that
+ things are working by running tests/test_stdio.js. Note that this test
+ script is one of the kde build scripts which shows how easy it should
+ be to migrate between the two.
+
+2004-06-04 Friday 18:52 geiseri
+
+ Resolve conflicts.
+
+2004-05-28 Friday 22:10 rich
+
+ - Updated js reference documentation.
+
+2004-05-28 Friday 22:06 rich
+
+ - Removing docs.
+
+2004-05-28 Friday 21:08 rich
+
+ - Improved the documentation generation.
+
+2004-05-28 Friday 19:55 rich
+
+ - Ensure we always use our debug area in our kdDebug() calls.
+
+2004-05-28 Friday 19:51 rich
+
+ - JS exceptions that occur when a js function has been invoked by a signal
+ are now reported and cleaned up properly.
+
+2004-05-28 Friday 19:15 rich
+
+ - Fixed the problem of the time property of a QTimeEdit returning -1. This
+ in fact turned out to be a general problem that affects all QTime
+ properties and was happening because you can't create a Date object in js
+ with just a time in it.
+
+
+2004-05-27 Thursday 21:05 rich
+
+ - Added the missing mirror() method to the image binding.
+
+ - Added missing icons to imunge.
+
+2004-05-27 Thursday 17:41 rich
+
+ - Added support for passing opaque types as arguments to slots. This is a big
+ win and turned out to be pretty simple once I tracked down a logic error
+ that caused any subsequent args to be ignored. This would all be perfect
+ except for the minor flaw that it doesn't work.
+
+ - Improvements to imunge.
+ - Made it work again after I broke it.
+ - Added support for a bunch more effects.
+ - Shows the filename in the status bar.
+
+ - Added an accessor to the KConfig wrapper that lets you obtain an opaque
+ pointer to the KConfig object.
+
+ - Updated class docs
+
+2004-05-20 Thursday 20:24 rich
+
+ - Improved the Imunge example code by splitting the image effect handling into
+ a standalone file. In addition, I added support to the GUI for several
+ additional effects and added a toolbar that makes it easy to invoke them.
+
+2004-05-19 Wednesday 21:24 geiseri
+
+ Added the ability to query if a function is available.
+
+2004-05-19 Wednesday 21:17 rich
+
+ - Added support for the selectedItem() method of QListView then converted the
+ docviewer example to use QListView.
+
+2004-05-19 Wednesday 20:10 rich
+
+ - Modified the imunge demo to avoid hard-coding the path to the ui.rc file I
+ use here.
+
+2004-05-19 Wednesday 20:08 rich
+
+ - Added support for creating system tray icons from scripts using
+ KSystemTray, and an example that shows how this can be used.
+
+2004-05-19 Wednesday 18:54 rich
+
+ - Fixed a couple of naming errors in QProcess's signals that resulted from
+ the conversion from KProcess.
+
+2004-05-19 Wednesday 18:31 rich
+
+ - Missed this in the last commit.
+
+2004-05-19 Wednesday 18:29 rich
+
+ - Added a new directory for the Qt bindings. This means that these bindings
+ can now be made available for the qtonly version of kjsembed. This also
+ greatly simplifies the structure of the code (basically it's what I should
+ have done initially).
+
+2004-05-19 Wednesday 18:02 rich
+
+ Added something for testing
+
+2004-05-19 Wednesday 16:55 rich
+
+ - Added the first bit of an image manipulation app for kde (using
+ KImageEffect). The app is implemented in javascript.
+
+2004-05-17 Monday 14:52 geiseri
+
+ added the java test applet
+
+2004-05-17 Monday 14:52 geiseri
+
+ I added a test for the args stuff. Is this correct code?
+
+
+2004-05-13 Thursday 12:36 geiseri
+
+ Test for slots that use pixmaps
+
+2004-05-13 Thursday 12:35 geiseri
+
+ Qt wants the real thing, not cheap immitations.
+
+ Fixed QPixmaps in slots.
+
+2004-05-07 Friday 17:13 geiseri
+
+ Added tests to the make file.
+
+2004-05-07 Friday 17:10 geiseri
+
+ Added the C++ based tests used to develop the new part code for manipulating the script engine.
+
+ These need to be refactored, but I hate CPPUnit too much to use that here.
+
+2004-05-05 Wednesday 23:51 geiseri
+
+ Const cleanups
+ Fixed accidental memory leak
+ Added the following methods to make access of QVariant based objects
+ easier:
+ void putVariant( const QString &valueName, const QVariant &value);
+ QVariant getVariant( const QString &valueName ) const;
+
+ Started an implementation of a scope walker so the added methods
+ will work beyond the global scope. Not reliable yet, so its not used.
+
+2004-05-05 Wednesday 22:26 geiseri
+
+ Added the following functions to the part for embedders to enjoy:
+ KJS::Value getValue( const QString &valueName );
+ KJS::Value callMethod(const QString &methodName, KJS::List &args);
+ void putValue( const QString &valueName, const KJS::Value &value);
+
+ Rich I have tests, but they require being compiled. We need a C++ tests
+ directory at this point i think to show off what we are up to.
+
+2004-05-04 Tuesday 19:52 rich
+
+ - Update class reference
+
+2004-05-04 Tuesday 19:50 rich
+
+ - Improved the argument handling of kjscmd so that it will automatically
+ invoke the console if there is no script to run. It will also call exec
+ implicitly in this situation, though not if there is a script to invoke
+ so the exec() call in the graphical scripts is still required.
+
+ - Added a directory for a standard library of javascript utilities and put
+ the command line prompt script in it - other reusable scripts and objects
+ will follow. Scripts installed in this location will be found automatically
+ by the include(...) method.
+
+ - Added an option to kjscmd to tell it to invoke the cmdprompt script from
+ the standard library.
+
+ - Updated the man page to reflect these changes.
+
+2004-05-03 Monday 21:21 rich
+
+ - Added support for a few KHTMLPart method to the custom bindings.
+
+ - Added a simple example of embedding the engine. This will be used
+ by the embedding tutorial i'm working on. The example is based on
+ the KDevelop template for a non-parts KDE app and embeds the
+ interpreter. It then offers an action to show the js console, and
+ a word count action that is implemented in js.
+
+2004-04-30 Friday 20:53 rich
+
+ - Improved binding wizard.
+
+2004-04-30 Friday 20:27 rich
+
+ - Extended the range of types supported by the XSL stylesheet to allow QFile
+ and QFrame to be wrapped. Added the generated wrappers to the build.
+
+2004-04-30 Friday 19:36 rich
+
+ - Integrated the constructor bindings into the binding wizard and added a hack
+ that only enables the first method we see with a given name, meaning that
+ only the first version of overloaded methods can be used. This change means
+ that the QComboBox binding is now generated directly from the Qt header file
+ using the wizard.
+
+2004-04-30 Friday 17:38 rich
+
+ - Started rolling the code for instantiating bound objects into the wizard.
+ I accidentally deleted the stylesheet it uses to index the classes, so i'm
+ adding that to the repository now too so I don't have to write it a third
+ time.
+
+2004-04-29 Thursday 21:11 rich
+
+ - Improved the command line tool.
+
+2004-04-29 Thursday 20:37 rich
+
+ - Further steps towards a GUI for binding generation. The wizard pages are now
+ split up into functions and it uses an LED to provide feedback when it's
+ running doxygen. There's still a way to go, but this is slowly approaching
+ release quality.
+
+2004-04-29 Thursday 20:34 rich
+
+ - Update class reference
+
+2004-04-29 Thursday 20:33 rich
+
+ - Update class reference.
+
+2004-04-29 Thursday 18:57 rich
+
+ - More updates to the binding generation wizard.
+
+ - Added support for the flush method to textstreams.
+
+ - Added a script that provides an interactive command line prompt.
+
+2004-04-23 Friday 22:19 rich
+
+ Added the start of a wizard that will make creating bindings for a set of
+ C++ classes a point-and-click process.
+
+2004-04-23 Friday 18:47 geiseri
+
+ Added event support for:
+ QEvent::QTimer
+ QEvent::ContextMenu
+ QEvent::DragMove
+ QEvent::DragEnter
+ QEvent::Drop
+ QEvent::Enter
+ QEvent::Leave
+ QEvent::Clipboard
+ QEvent::DragLeave
+ Based all events off the default handler so interited
+ properties are preserved.
+
+2004-04-23 Friday 15:57 geiseri
+
+ move to QProcess.
+
+2004-04-23 Friday 15:20 rich
+
+ Update to qt-only support
+
+2004-04-23 Friday 10:57 geiseri
+
+ added some of my things i want to see.
+
+2004-04-22 Thursday 20:33 rich
+
+ Update changelog.
+
+ Allow C++ doc pages to link to each other in the docviewer.
+
+2004-04-22 Thursday 20:27 rich
+
+ Improvements to the docviewer.
+
+2004-04-22 Thursday 20:17 geiseri
+
+ remove printfs
+
+2004-04-22 Thursday 20:01 geiseri
+
+ since im trapped in the basement here, i figured id fix
+ the appname patch rich commited. Rich friends dont
+ let friends use C string crap ;)
+
+2004-04-22 Thursday 18:27 rich
+
+ Changed the behaviour of kjscmd so that it uses the name of the script as
+ the name of the instance it uses. This means that scripts can now have their
+ own config files etc.
+
+2004-04-22 Thursday 17:33 geiseri
+
+ Added extractQPalette
+ Added extractQStrList
+
+2004-04-22 Thursday 16:57 rich
+
+ Added support for Ian's new string munging functions to the XSL binding
+ generator.
+
+2004-04-22 Thursday 15:07 geiseri
+
+ Normalized the size and color extraction.
+ Added QRect helper function.
+
+2004-04-22 Thursday 15:03 geiseri
+
+ Normalize extraction helper function so its easier to use with
+ the bindings generator.
+
+2004-04-22 Thursday 12:59 geiseri
+
+ remove noise...
+
+2004-04-22 Thursday 12:58 geiseri
+
+ Found out javascripts month index starts at 0.
+ Fixed validation test, and code
+ Added ability to handle date, datetime, and time in slots
+ Added ability to call slots that use datetime, date, and time.
+
+2004-04-22 Thursday 10:01 geiseri
+
+ added test for dealing with time in slots
+
+2004-04-22 Thursday 09:17 geiseri
+
+ Rich I really dont like this one bit.
+ Added a few more slot signatures.
+ Way more effort than its worth, we need to rethink how this all ties
+ together.
+
+2004-04-21 Wednesday 23:10 geiseri
+
+ There is a moral here... untested code is buggy code.
+
+2004-04-21 Wednesday 22:17 geiseri
+
+ Added transparent mapping between Javascript dates and Qt's dates
+
+2004-04-21 Wednesday 16:09 geiseri
+
+ forgot to add the one i really wanted to. Now we can map a string array to a QVariant properly.
+
+2004-04-21 Wednesday 15:48 geiseri
+
+ Added the ability to convert from JS Arrays to stringlists. Rich to use this
+ code follow what i did in qcombobox_imp.cpp. Its a oneliner and Hari says
+ its the most maintainable way to do it... Learned more about KJS than I ever
+ did today. Hari I owe you a beer, or 3, and john, you owe me your first born.
+
+2004-04-19 Monday 11:53 geiseri
+
+ fixed QBoxLayouts. might want to backport
+
+2004-04-16 Friday 21:51 rich
+
+ We can now build kjsembed without needing KDE! There is tidying up needed,
+ but it builds ok.
+
+2004-04-16 Friday 19:47 rich
+
+ More work on making a qt only build possible. This build mode doesn't work
+ yet, but the standard mode is unaffected by the changes.
+
+ Tidied up the header file inclusion in various places which makes life simpler
+ and should also speed up compilation.
+
+2004-04-15 Thursday 20:19 rich
+
+ More work towards a qt-only build
+
+2004-04-15 Thursday 18:53 rich
+
+ Began adding support for Qt-only builds.
+ Explained to Ian's copyrights that the year is now 2004.
+
+2004-04-13 Tuesday 12:08 geiseri
+
+ Added DCOPClient::isApplicationRegistered(...)
+ Added validation test for it.
+
+2004-04-13 Tuesday 11:10 geiseri
+
+ Test for clobbering return values of dcoprefs call.
+ The fixed dcopref code... yay validation tests...
+
+2004-04-12 Monday 17:48 geiseri
+
+ DCOPRefs now work correctly as return values from javascript
+ dcop interfaces.
+
+2004-04-12 Monday 16:53 geiseri
+
+ Added testcase for pixmaps.
+ Fixed no object type returned bug.
+
+ Dcop interfaces now work for more cases.
+
+2004-04-12 Monday 16:28 geiseri
+
+ test case to show off problems calling void functions in dcop interfaces.
+
+2004-04-12 Monday 13:08 geiseri
+
+ Fixed an issue with dcop interfaces where only the first
+ argument was being read.
+
+2004-04-12 Monday 10:11 geiseri
+
+ Added ktempfile support.
+
+2004-04-12 Monday 10:11 geiseri
+
+ Added ability to invert pixels on the painter.
+
+2004-04-12 Monday 10:10 geiseri
+
+ More spacing and formatting fixes... soon my cvs will be in sync.
+
+2004-04-12 Monday 10:09 geiseri
+
+ Added support for the command shell(...).
+ Added ksimple process ( a blocking shell process that returns the output)
+ I dont like where this is going, but ideally in cvs we can work this out.
+ The goal is to get a function that allows us to do the following:
+ var response = shell( 'ps -aux' );
+ prinln( response );
+ So we can run simple shell commands and get a response back.
+ Suggestions welcome.
+
+2004-04-12 Monday 10:05 geiseri
+
+ Formatting and spacing.
+
+2004-04-12 Monday 10:03 geiseri
+
+ Formatting and spacing cleanups.
+
+2004-04-12 Monday 10:02 geiseri
+
+ Added support for dcopstart (like the shell command line version).
+ Added tests for dcopreferences.
+
+2004-04-12 Monday 10:00 geiseri
+
+ Added support for QProcess as a bindings plugin.
+ Exposed API identical to QProcess.
+
+2004-04-10 Saturday 20:40 rich
+
+ Added support for the setSpacing method of QHBox.
+
+ Converted the docviewer example to use the KHTML streaming API and made it
+ work properly.
+
+2004-04-10 Saturday 17:24 rich
+
+ Fix link to livedata example.
+
+2004-04-09 Friday 21:26 rich
+
+ Added support for streaming data to a KPart, and an example of doing so. This
+ means you no longer need to have a temporary file to display stuff in khtml.
+
+2004-04-09 Friday 20:22 rich
+
+ Added an example of how to embed several parts in one scripts GUI.
+
+2004-04-09 Friday 19:34 rich
+
+ Added some methods that should allow us to have a unified interface to the
+ proxy types in future. This change is the first step towards an understanding
+ of inheritence. The first win of the change is that the code now understands
+ that KXMLGUIClient's are not necessarily QWidgets.
+
+2004-04-09 Friday 17:52 rich
+
+ Added proper support for QComboBox. This binding was generated automagically
+ using the xsl stuff in the tools dir, but I had to disable 4 methods to work
+ around missing support for method overloading. There's also an example.
+
+2004-04-09 Friday 16:39 rich
+
+ Added support for loading read-write parts, and an example showing how it's
+ done.