summaryrefslogtreecommitdiffstats
path: root/kjsembed/tests/test_kio.js
blob: 11bd6a1ccc3f8cb5e87820a7d3cdbed4a80a34ea (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
#!/usr/bin/env kjscmd

var net = new NetAccess( this, 'net' );

var loc = '/tmp/test.jpg';

var ret = net.download( 'http://www.kde.org/media/images/kde_logo.jpg', loc );

if ( ret ) {
  var mime = net.mimetype( loc );
  print( "Mimetype = " + mime + '\n' );
  var img = new Image();
  img.load( loc );
  if ( !img.isOk() ) {
      warn( 'Failed to load image '+loc);
      return;
  } else {
      print( 'Image ' + loc + ' is OK \n' );
  }
  var lbl = new QLabel(this);
  lbl.pixmap = img.pixmap();
  lbl.show();
}

net.del( loc );
application.exec();