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
|
#!/usr/bin/env kjscmd
//
// Example of loading several parts from a script
//
//
// Main
//
var qd = new QDir();
var dir = 'file://' + qd.path() + '/../';
var file = dir + 'index.html';
// Create the UI
var mw = new KParts_MainWindow();
var ac = mw.actionCollection();
var split = new QSplitter( mw );
mw.setCentralWidget( split );
//
// Load the sidebar
//
var side = Factory.createROPart( "inode/directory", split, "sidebar" );
//
// Load the views
//
var views = new QSplitter( split );
views.orientation = 1;
var top = Factory.createROPart( "text/html", views, "html" );
var bottom = Factory.createROPart( "text/plain", views, "source" );
//
// Glue it together
//
top.connect(side.child(0), 'openURLRequest(const KURL&,const KParts::URLArgs&)', 'openURL(const KURL&)' )
bottom.connect(side.child(0), 'openURLRequest(const KURL&,const KParts::URLArgs&)', 'openURL(const KURL&)' )
side.openURL( dir );
top.openURL( file );
bottom.openURL( file );
//
// Activate XMLGUI and show the window
//
StdAction.quit( mw, 'close()', mw.actionCollection() );
mw.resize( 700, 500 );
split.child(1).maximumWidth = 200;
mw.show();
application.exec();
|