summaryrefslogtreecommitdiffstats
path: root/kjsembed/docs/examples/xmlgui/xmlgui.js
blob: a951a2edcf7e76f32ab198b1fecbfd4b7a0381a7 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
#!/usr/bin/env kjscmd

//
// Setup main window
//
var mw = new KMainWindow();

var view = new TQTextEdit( mw, 'view' );
view.text = '<h1>Hello World</h1>'
	  + '<p>This application is written entirely in Javascript and works '
	  + 'thanks to KJSEmbed</p>';

mw.setCentralWidget( view );

//
// Actions
//
var ac = mw.actionCollection();

//
// Create the quit action and connect it to a C++ slot
//
StdAction.quit( application, 'quit()', ac );

//
// We'll wire the file open action up to a JS function
//

mw.openFile = function() {
   var filename = StdDialog.getOpenFileName( '.', '*' );
   if ( filename.length > 0 ) {
      view.text = System.readFile( filename );
   }
}

var open_action = StdAction.open( null, '', ac );
open_action.connect( open_action, 'activated()', mw, 'openFile' );

//
// We'll just accept the default for the rest of the actions
//

StdAction.aboutApp( null, '', ac );
StdAction.aboutKDE( null, '', ac );
StdAction.actualSize( null, '', ac );
StdAction.addBookmark( null, '', ac );
StdAction.back( null, '', ac );
StdAction.close( null, '', ac );
StdAction.configureNotifications( null, '', ac );
StdAction.configureToolbars( null, '', ac );
StdAction.copy( null, '', ac );
StdAction.cut( null, '', ac );
StdAction.deselect( null, '', ac );
StdAction.editBookmarks( null, '', ac );
StdAction.fileNew( null, '', ac );
StdAction.find( null, '', ac );
StdAction.findNext( null, '', ac );
StdAction.findPrev( null, '', ac );
StdAction.fitToHeight( null, '', ac );
StdAction.fitToPage( null, '', ac );
StdAction.fitToWidth( null, '', ac );
StdAction.forward( null, '', ac );
StdAction.help( null, '', ac );
StdAction.helpContents( null, '', ac );
StdAction.home( null, '', ac );
StdAction.keyBindings( null, '', ac );
StdAction.mail( null, '', ac );
StdAction.openRecent( null, '', ac );
StdAction.paste( null, '', ac );
StdAction.preferences( null, '', ac );
StdAction.print( null, '', ac );
StdAction.printPreview( null, '', ac );
StdAction.redisplay( null, '', ac );
StdAction.redo( null, '', ac );
StdAction.replace( null, '', ac );
StdAction.reportBug( null, '', ac );
StdAction.revert( null, '', ac );
StdAction.save( null, '', ac );
StdAction.saveAs( null, '', ac );
StdAction.saveOptions( null, '', ac );
StdAction.selectAll( null, '', ac );
StdAction.showMenubar( null, '', ac );
StdAction.showStatusbar( null, '', ac );
StdAction.showToolbar( null, '', ac );
StdAction.spelling( null, '', ac );
StdAction.tipofDay( null, '', ac );
StdAction.undo( null, '', ac );
StdAction.up( null, '', ac );
StdAction.whatsThis( null, '', ac );
StdAction.zoom( null, '', ac );
StdAction.zoomIn( null, '', ac );
StdAction.zoomOut( null, '', ac );

//
// There are two different Go menus define in XMLGUI, and we're using
// the browser oriented one, so we don't use these actions.
//

//StdAction.firstPage( null, '', ac );
//StdAction.goGoto( null, '', ac );
//StdAction.gotoLine( null, '', ac );
//StdAction.gotoPage( null, '', ac );
//StdAction.lastPage( null, '', ac );
//StdAction.next( null, '', ac );
//StdAction.prior( null, '', ac );

//
// Activate XMLGUI and show the window
//
mw.createGUI( 'stdactionsui.rc' );
mw.resize( 500, 350 );
mw.show();
application.exec();