From 90825e2392b2d70e43c7a25b8a3752299a933894 Mon Sep 17 00:00:00 2001 From: toma Date: Wed, 25 Nov 2009 17:56:58 +0000 Subject: Copy the KDE 3.5 branch to branches/trinity for new KDE 3.5 features. BUG:215923 git-svn-id: svn://anonsvn.kde.org/home/kde/branches/trinity/kdebindings@1054174 283d02a7-25f6-0310-bc7c-ecb5cbfe19da --- kjsembed/docs/examples/systemtray/kjstray.png | Bin 0 -> 259 bytes kjsembed/docs/examples/systemtray/systemtray.js | 30 ++++++++++++++++++++++++ 2 files changed, 30 insertions(+) create mode 100644 kjsembed/docs/examples/systemtray/kjstray.png create mode 100755 kjsembed/docs/examples/systemtray/systemtray.js (limited to 'kjsembed/docs/examples/systemtray') diff --git a/kjsembed/docs/examples/systemtray/kjstray.png b/kjsembed/docs/examples/systemtray/kjstray.png new file mode 100644 index 00000000..f77ae150 Binary files /dev/null and b/kjsembed/docs/examples/systemtray/kjstray.png differ diff --git a/kjsembed/docs/examples/systemtray/systemtray.js b/kjsembed/docs/examples/systemtray/systemtray.js new file mode 100755 index 00000000..5ecc55f0 --- /dev/null +++ b/kjsembed/docs/examples/systemtray/systemtray.js @@ -0,0 +1,30 @@ +#!/usr/bin/env kjscmd + +// +// Example that uses KSystemTray +// + +// Create the main window +mainwin = new QTextEdit(this); +mainwin.text = 'This is the main window for a script that illustrates ' + + 'the use of the System Tray.'; + +// Create the tray icon +trayicon = new KSystemTray( mainwin ); + +// Set the pixmap of the tray icon (we force it to be loaded from the cwd here) +cwd = (new QDir()).absPath(); +trayicon.pixmap = trayicon.loadIcon( cwd + '/kjstray.png' ); + +// Ensure we quit when you choose the option from the tray item's menu +application.connect( trayicon, 'quitSelected()', 'quit()' ); + +// Get the context menu +var menu = trayicon.contextMenu(); +menu.insertItem("My Item"); + +// Show both the main window and the icon +trayicon.show(); +mainwin.show(); + +application.exec(); -- cgit v1.2.1