summaryrefslogtreecommitdiffstats
path: root/kjsembed/docs/examples/netaccess
diff options
context:
space:
mode:
Diffstat (limited to 'kjsembed/docs/examples/netaccess')
-rwxr-xr-xkjsembed/docs/examples/netaccess/net.js24
1 files changed, 24 insertions, 0 deletions
diff --git a/kjsembed/docs/examples/netaccess/net.js b/kjsembed/docs/examples/netaccess/net.js
new file mode 100755
index 00000000..c406d79b
--- /dev/null
+++ b/kjsembed/docs/examples/netaccess/net.js
@@ -0,0 +1,24 @@
+#!/usr/bin/env kjscmd
+
+var net = new NetAccess( null, '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);
+ } else {
+ print( 'Image ' + loc + ' is OK \n' );
+ var lbl = new QLabel();
+ lbl.pixmap = img.pixmap();
+ lbl.show();
+ application.exec();
+ }
+}
+net.del( loc );