Index: /trunk/configure.cmd
===================================================================
--- /trunk/configure.cmd	(revision 254)
+++ /trunk/configure.cmd	(revision 255)
@@ -47,5 +47,5 @@
     "QT_NO_TABLET",
     "QT_NO_SYSTEMSEMAPHORE QT_NO_SHAREDMEMORY",
-    "QT_NO_SESSIONMANAGER QT_NO_SYSTEMTRAYICON",
+    "QT_NO_SESSIONMANAGER",
     "QT_NO_IM QT_NO_ACCESSIBILITY QT_NO_IPV6",
     "QT_NO_PRINTER QT_NO_PRINTDIALOG QT_NO_DRAGANDDROP"
Index: /trunk/src/3rdparty/os2/xsystray/xsystray.c
===================================================================
--- /trunk/src/3rdparty/os2/xsystray/xsystray.c	(revision 254)
+++ /trunk/src/3rdparty/os2/xsystray/xsystray.c	(revision 255)
@@ -1,4 +1,6 @@
 /*
  * Extended system tray widget for XCenter/eCenter
+ *
+ * Implementation
  *
  * Made by netlabs.org
@@ -67,4 +69,6 @@
 #include "shared\center.h"              // public XCenter interfaces
 
+#include "xsystray.h"
+
 #pragma hdrstop                     // VAC++ keeps crashing otherwise
 
@@ -93,8 +97,4 @@
  *      (WgtInitModule).
  */
-
-#define WNDCLASS_WIDGET_XSYSTRAY    "XWPCenterExtendedSysTray"
-#define INTCLASS_WIDGET_XSYSTRAY    "ExtendedSysTray"
-#define HUMANSTR_WIDGET_XSYSTRAY    "Extended system tray"
 
 static const XCENTERWIDGETCLASS G_WidgetClasses[] =
Index: /trunk/src/3rdparty/os2/xsystray/xsystray.h
===================================================================
--- /trunk/src/3rdparty/os2/xsystray/xsystray.h	(revision 255)
+++ /trunk/src/3rdparty/os2/xsystray/xsystray.h	(revision 255)
@@ -0,0 +1,79 @@
+/*
+ * Extended system tray widget for XCenter/eCenter
+ *
+ * Internal declarations
+ *
+ * Made by netlabs.org
+ *
+ * Author: Dmitry A. Kuminov
+ *
+ * This software is public domain.
+ *
+ * WITHOUT ANY WARRANTY..., AT YOUR OWN RISC... ETC.
+ *
+ */
+
+#ifndef XSYSTRAY_HEADER_INCLUDED
+#define XSYSTRAY_HEADER_INCLUDED
+
+#define WNDCLASS_WIDGET_XSYSTRAY_SERVER "XWPCenterExtendedSysTrayServer"
+
+#define WNDCLASS_WIDGET_XSYSTRAY        "XWPCenterExtendedSysTray"
+#define INTCLASS_WIDGET_XSYSTRAY        "ExtendedSysTray"
+#define HUMANSTR_WIDGET_XSYSTRAY        "Extended system tray"
+
+#define WM_XST_CONTROL  (WM_USER + 0)
+
+typedef enum
+{
+    SYSTRAYCMD_GETVERSION,
+    SYSTRAYCMD_ADDICON,
+    SYSTRAYCMD_REMOVEICON,
+    SYSTRAYCMD_SETTOOLTIP,
+    SYSTRAYCMD_SHOWBALLOON,
+    SYSTRAYCMD_HIDEBALLOON,
+} SYSTRAYCMD;
+
+// NOTE: the idea is to fit SYSTRAYMSGDATA into a page (4K) since this is the
+// smallest piece DosAllocSharedMem() allocates anyway.
+typedef struct
+{
+    SYSTRAYCMD  ulCommand;
+                // command to execute, must always be set
+    HWND        hwndSender;
+                // sender window, a must for SYSTRAYCMD_ADDICON, REMOVEICON,
+                // SETTOOLTIP, SHOWBALLOON, HIDEBALLOON
+    union
+    {
+        struct
+        {
+            ULONG ulMajor;
+            ULONG ulMinor;
+            ULONG ulRevision;
+        } version;
+          // used by SYSTRAYCMD_GETVERSION
+
+        struct
+        {
+            ULONG       ulId;
+            HPOINTER    hIcon;
+            ULONG       ulMsgId;
+        } icon;
+          // used by SYSTRAYCMD_ADDICON, SYSTRAYCMD_REMOVEICON
+
+        struct
+        {
+            ULONG   ulId;
+            CHAR    szText[4000]; // occupy as much of 4K page as we can
+        } tooltip;
+
+    } u;
+
+    BOOL    bAcknowledged : 1;
+            // set to true by the recipient if it processes the message
+
+} SYSTRAYMSGDATA, *PSYSTRAYMSGDATA;
+
+#endif // XSYSTRAY_HEADER_INCLUDED
+
+
Index: /trunk/src/3rdparty/os2/xsystray/xsystray_api.c
===================================================================
--- /trunk/src/3rdparty/os2/xsystray/xsystray_api.c	(revision 255)
+++ /trunk/src/3rdparty/os2/xsystray/xsystray_api.c	(revision 255)
@@ -0,0 +1,365 @@
+/*
+ * Extended system tray widget for XCenter/eCenter
+ *
+ * Public API implementation
+ *
+ * Made by netlabs.org
+ *
+ * Author: Dmitry A. Kuminov
+ *
+ * This software is public domain.
+ *
+ * WITHOUT ANY WARRANTY..., AT YOUR OWN RISC... ETC.
+ *
+ */
+
+#define INCL_DOSERRORS
+#define INCL_WINWINDOWMGR
+#define INCL_WINATOM
+#include <os2.h>
+
+#include "xsystray_api.h"
+#include "xsystray.h"
+
+#include <string.h>
+#include <sys/builtin.h>        // atomics
+#include <InnotekLIBC/thread.h> // TLS
+
+static HWND G_hwndSysTray = NULLHANDLE;
+static int G_itlsSysTrayMsgData = -1;
+
+static HWND FindSysTrayWindow()
+{
+    char buf[sizeof(WNDCLASS_WIDGET_XSYSTRAY_SERVER) + 1];
+    HWND hwnd;
+    HENUM henum = WinBeginEnumWindows(HWND_DESKTOP);
+    while ((hwnd = WinGetNextWindow(henum)) != NULLHANDLE)
+    {
+        LONG len = WinQueryClassName(hwnd, sizeof(buf), buf);
+        buf[len] = '\0';
+        if (strcmp(WNDCLASS_WIDGET_XSYSTRAY_SERVER, buf) == 0)
+            break;
+    }
+    WinEndEnumWindows(henum);
+
+    return hwnd;
+}
+
+static BOOL SendSysTrayCtlMsg(PSYSTRAYMSGDATA pData)
+{
+    APIRET arc;
+    PID pid;
+    TID tid;
+    MRESULT mrc;
+
+    BOOL bTriedFind = FALSE;
+
+    do
+    {
+        if (G_hwndSysTray == NULLHANDLE)
+        {
+            bTriedFind = TRUE;
+            HWND hwnd = FindSysTrayWindow();
+            __atomic_cmpxchg32((uint32_t *)&G_hwndSysTray, hwnd, NULLHANDLE);
+            if (G_hwndSysTray == NULLHANDLE)
+                break;
+        }
+
+        if (bTriedFind)
+        {
+            arc = ERROR_INVALID_HANDLE;
+            if (WinQueryWindowProcess(G_hwndSysTray, &pid, &tid))
+                arc = DosGiveSharedMem(__libc_TLSGet(G_itlsSysTrayMsgData),
+                                       pid, PAG_READ | PAG_WRITE);
+            if (arc != NO_ERROR)
+                break;
+        }
+
+        pData->bAcknowledged = FALSE;
+
+        mrc = WinSendMsg(G_hwndSysTray, WM_XST_CONTROL, pData, NULL);
+        if (mrc == (MRESULT)TRUE && pData->bAcknowledged)
+            break;
+
+        // if we failed to send the message, it may mean that XCenter was restarted
+        // or the system tray was re-enabled. Try to get a new handle (only if we
+        // didn't already do it in this call)
+        if (!bTriedFind)
+        {
+            G_hwndSysTray = NULLHANDLE;
+            continue;
+        }
+
+        break;
+    }
+    while (TRUE);
+
+    return FALSE;
+}
+
+static PSYSTRAYMSGDATA GetSysTrayMsgDataPtr()
+{
+    APIRET arc;
+
+    // allocate a thread local storage entry if not done so
+    if (G_itlsSysTrayMsgData == -1)
+    {
+        // @todo does XWorkplace have its own TLS? Not? Use
+        // DosAllocThreadLocalMemory() directly then (though it's not nice due
+        // to the lack of space in that area)
+        int itls = __libc_TLSAlloc();
+        if (!__atomic_cmpxchg32(&G_itlsSysTrayMsgData, itls, -1))
+        {
+            // another thread has already got an entry, discard our try
+            if (itls != -1)
+                __libc_TLSFree(itls);
+        }
+
+        if (G_itlsSysTrayMsgData == -1)
+            return NULL;
+    }
+
+    // allocate a SYSTRAYMSGDATA struct for this thread if not done so
+    PSYSTRAYMSGDATA pData = __libc_TLSGet(G_itlsSysTrayMsgData);
+    if (!pData)
+    {
+        arc = DosAllocSharedMem((PVOID)&pData, NULL, sizeof(SYSTRAYMSGDATA),
+                                PAG_COMMIT | PAG_READ | PAG_WRITE | OBJ_GIVEABLE);
+        if (arc != NO_ERROR)
+            return NULL;
+
+        __libc_TLSSet(G_itlsSysTrayMsgData, pData);
+
+        // note that we don't ever free the allocated block since our API doesn't
+        // have a concept of initialization/termination and therefore it's fine
+        // if the memory stays allocated until application termination
+    }
+
+    return pData;
+}
+
+/*
+ *@@ xstQuerySysTrayVersion:
+ *
+ *      Returns the version of the Extended system tray in the variables pointed
+ *      to by arguments. Any argument may be NULL in which case the
+ *      corresponding component of the version is not returned.
+ *
+ *      Returns TRUE on success and FALSE if the Extended system tray is not
+ *      installed or not operational.
+ *
+ *      NOTE: When the Extended system tray is started up or gets enabled after
+ *      being temporarily disabled, it sends a message with the ID returned by
+ *      xstGetSysTrayCreatedMsgId() to all top-level WC_FRAME windows on the
+ *      desktop to let them add tray icons if they need.
+ */
+
+BOOL xstQuerySysTrayVersion(PULONG pulMajor,    // out: major version number
+                            PULONG pulMinor,    // out: minor version number
+                            PULONG pulRevision) // out: revision number
+{
+    PSYSTRAYMSGDATA pData = GetSysTrayMsgDataPtr();
+    if (!pData)
+        return FALSE;
+
+    pData->ulCommand = SYSTRAYCMD_GETVERSION;
+    pData->hwndSender = NULLHANDLE;
+
+    BOOL rc = SendSysTrayCtlMsg(pData);
+    if (rc)
+    {
+        if (pulMajor)
+            *pulMajor = pData->u.version.ulMajor;
+        if (pulMinor)
+            *pulMinor = pData->u.version.ulMinor;
+        if (pulRevision)
+            *pulRevision = pData->u.version.ulRevision;
+    }
+
+    return rc;
+}
+
+/*
+ *@@ xstAddSysTrayIcon:
+ *
+ *      Adds an icon for the given window handle to the system tray. The icon ID
+ *      is used to distinguish between several icons for the same window handle.
+ *      If the icon with the specified ID already exists in the system tray, it
+ *      will be replaced.
+ *
+ *      Returns TRUE on success and FALSE otherwise.
+ *
+ *      The specified window handle receives notification messages about icon
+ *      events using the message ID specified by the ulMsgId parameter. The
+ *      layout of the message parameters is as follows:
+ *
+ *          param1
+ *              USHORT  usID        icon ID
+ *              USHORT  usCode      notify code, one of XST_IN_ constants
+ *
+ *          param2
+ *              PVOID   pData       notify code specific data (see below)
+ *
+ *      The following notify codes are currently recognized:
+ *
+ *          XST_IN_MOUSE:
+ *              Mouse event in the icon area. Currently, only mouse click
+ *              messages are recognized. param2 is a pointer to the XSTMOUSEMSG
+ *              structure containing full mouse message details.
+ */
+
+BOOL xstAddSysTrayIcon(HWND hwnd,       // in: window handle associated with the icon
+                       ULONG ulId,      // in: icon ID to add
+                       HPOINTER hIcon,  // in: icon handle
+                       ULONG ulMsgId,   // in: message ID for notifications
+                       ULONG ulFlags)   // in: flags (not currently used, must be 0)
+{
+    PSYSTRAYMSGDATA pData = GetSysTrayMsgDataPtr();
+    if (!pData)
+        return FALSE;
+
+    pData->ulCommand = SYSTRAYCMD_ADDICON;
+    pData->hwndSender = hwnd;
+    pData->u.icon.ulId = ulId;
+    pData->u.icon.hIcon = hIcon;
+    pData->u.icon.ulMsgId = ulMsgId;
+
+    return SendSysTrayCtlMsg(pData);
+}
+
+/*
+ *@@ xstRemoveSysTrayIcon:
+ *
+ *      Removes the icon previously added by xstAddSysTrayIcon() from the system
+ *      tray.
+ *
+ *      Returns TRUE on success and FALSE otherwise.
+ */
+
+BOOL xstRemoveSysTrayIcon(HWND hwnd,    // in: window handle associated with the icon
+                          ULONG ulId)   // in: icon ID to remove
+{
+    PSYSTRAYMSGDATA pData = GetSysTrayMsgDataPtr();
+    if (!pData)
+        return FALSE;
+
+    pData->ulCommand = SYSTRAYCMD_REMOVEICON;
+    pData->hwndSender = hwnd;
+    pData->u.icon.ulId = ulId;
+
+    return SendSysTrayCtlMsg(pData);
+}
+
+/*
+ *@@ xstSetSysTrayIconToolTip:
+ *
+ *      Sets the tooltip text for the given icon in the system tray. This text
+ *      is shown when the mouse pointer is held still over the icon area for
+ *      some time.
+ *
+ *      If pszText is NULL, the tooltip text is reset and will not be shown next
+ *      time. The old tooltip is hidden if it is being currently shown.
+ *
+ *      Returns TRUE on success and FALSE otherwise.
+ *
+ *      NOTE: The maximum tooltip text length (including terminating null) is
+ *      limited to a value returned by xstGetSysTrayMaxTextLen(). If the
+ *      supplied string is longer, it will be truncated.
+ */
+
+BOOL xstSetSysTrayIconToolTip(HWND hwnd,    // in: window handle associated with the icon
+                              ULONG ulId,   // in: icon ID to set the tooltip for
+                              PSZ pszText)  // in: tooltip text
+{
+    PSYSTRAYMSGDATA pData = GetSysTrayMsgDataPtr();
+    if (!pData)
+        return FALSE;
+
+    pData->ulCommand = SYSTRAYCMD_SETTOOLTIP;
+    pData->hwndSender = hwnd;
+    pData->u.tooltip.ulId = ulId;
+
+    if (pszText == NULL)
+        pData->u.tooltip.szText[0] = '\0';
+    else
+    {
+        strncpy(pData->u.tooltip.szText, pszText,
+                sizeof(pData->u.tooltip.szText) - 1);
+        // be on the safe side
+        pData->u.tooltip.szText[sizeof(pData->u.tooltip.szText) - 1] = '\0';
+    }
+
+    return SendSysTrayCtlMsg(pData);
+}
+
+BOOL xstShowSysTrayIconBalloon(HWND hwnd, ULONG ulId, PSZ pszTitle, PSZ pszText,
+                               ULONG ulFlags, ULONG ulTimeout)
+{
+    // @todo implement
+    return FALSE;
+}
+
+BOOL xstHideSysTrayIconBalloon(HWND hwnd, ULONG ulId)
+{
+    // @todo implement
+    return FALSE;
+}
+
+/*
+ *@@ xstQuerySysTrayIconRect:
+ *
+ *      Obtains a rectangle occupied by the given icon (in screen coordinates,
+ *      top right corner exclusive).
+ *
+ *      Returns TRUE on success and FALSE otherwise.
+ */
+BOOL xstQuerySysTrayIconRect(HWND hwnd, ULONG ulId, PRECTL prclRect)
+{
+    // @todo implement
+    return FALSE;
+}
+
+/*
+ *@@ xstGetSysTrayCreatedMsgId:
+ *
+ *      Returns the ID of the message that is sent by the Extended system tray
+ *      to all top-level WC_FRAME windows on the desktop to let them add tray
+ *      icons if they need.
+ *
+ *      NOTE: The returned value never changes until reboot so it is a good
+ *      practice to cache it instead of calling this function each time from the
+ *      window procedure of every involved window.
+ */
+
+ULONG xstGetSysTrayCreatedMsgId()
+{
+    static ULONG WM_XST_CREATED = 0;
+    if (WM_XST_CREATED == 0)
+        WM_XST_CREATED = WinAddAtom(WinQuerySystemAtomTable(),
+                                    "ExtendedSysTray.WM_XST_CREATED");
+    return WM_XST_CREATED;
+}
+
+/*
+ *@@ xstGetSysTrayMaxTextLen:
+ *
+ *      Returns the maximum length of the text (in bytes, including the
+ *      terminating null) that can be shown in the tooltop of the icon in the
+ *      system tray. You can use the returned value to determine the maximum
+ *      length of the string passed as pszText to xstSetSysTrayIconToolTip().
+ *
+ *      The returned value also defines the maximum length of both the title and
+ *      the text (including terminating nulls) of the icon's balloon for the
+ *      xstShowSysTrayIconBalloon() call.
+ *
+ *      Returns TRUE on success and FALSE otherwise.
+ *
+ *      NOTE: The returned value never changes until reboot so it is a good
+ *      practice to cache it instead of calling this function each time.
+ */
+
+ULONG xstGetSysTrayMaxTextLen()
+{
+    return sizeof(((PSYSTRAYMSGDATA)0)->u.tooltip.szText);
+}
+
Index: /trunk/src/3rdparty/os2/xsystray/xsystray_api.h
===================================================================
--- /trunk/src/3rdparty/os2/xsystray/xsystray_api.h	(revision 255)
+++ /trunk/src/3rdparty/os2/xsystray/xsystray_api.h	(revision 255)
@@ -0,0 +1,56 @@
+/*
+ * Extended system tray widget for XCenter/eCenter
+ *
+ * Public API
+ *
+ * Made by netlabs.org
+ *
+ * Author: Dmitry A. Kuminov
+ *
+ * This software is public domain.
+ *
+ * WITHOUT ANY WARRANTY..., AT YOUR OWN RISC... ETC.
+ *
+ */
+
+#ifndef XSYSTRAY_API_HEADER_INCLUDED
+#define XSYSTRAY_API_HEADER_INCLUDED
+
+#if __cplusplus
+extern "C" {
+#endif
+
+// notification code constants for WM_XST_NOTIFY, refer to xstAddSysTrayIcon()
+#define XST_IN_MOUSE    0x0001
+
+// structure for XST_IN_MOUSE
+typedef struct
+{
+    ULONG  ulMouseMsg;
+    POINTS ptsPointerPos;
+    USHORT fsHitTestRes;
+    USHORT fsFlags;
+
+} XSTMOUSEMSG, *PXSTMOUSEMSG;
+
+BOOL xstQuerySysTrayVersion(PULONG pulMajor, PULONG pulMinor, PULONG pulRevision);
+BOOL xstAddSysTrayIcon(HWND hwnd, ULONG ulId, HPOINTER hIcon, ULONG ulMsgId,
+                       ULONG ulFlags);
+BOOL xstRemoveSysTrayIcon(HWND hwnd, ULONG ulId);
+BOOL xstSetSysTrayIconToolTip(HWND hwnd, ULONG ulId, PSZ pszText);
+BOOL xstShowSysTrayIconBalloon(HWND hwnd, ULONG ulId, PSZ pszTitle, PSZ pszText,
+                               ULONG ulFlags, ULONG ulTimeout);
+BOOL xstHideSysTrayIconBalloon(HWND hwnd, ULONG ulId);
+
+BOOL xstQuerySysTrayIconRect(HWND hwnd, ULONG ulId, PRECTL prclRect);
+
+ULONG xstGetSysTrayCreatedMsgId();
+
+ULONG xstGetSysTrayMaxTextLen();
+
+#if __cplusplus
+}
+#endif
+
+#endif // XSYSTRAY_API_HEADER_INCLUDED
+
Index: /trunk/src/gui/util/qsystemtrayicon_pm.cpp
===================================================================
--- /trunk/src/gui/util/qsystemtrayicon_pm.cpp	(revision 255)
+++ /trunk/src/gui/util/qsystemtrayicon_pm.cpp	(revision 255)
@@ -0,0 +1,233 @@
+/****************************************************************************
+**
+** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
+** Contact: Qt Software Information (qt-info@nokia.com)
+**
+** Copyright (C) 2009 netlabs.org. OS/2 parts.
+**
+** This file is part of the QtGui module of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** Commercial Usage
+** Licensees holding valid Qt Commercial licenses may use this file in
+** accordance with the Qt Commercial License Agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and Nokia.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 2.1 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPL included in the
+** packaging of this file.  Please review the following information to
+** ensure the GNU Lesser General Public License version 2.1 requirements
+** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
+**
+** In addition, as a special exception, Nokia gives you certain
+** additional rights. These rights are described in the Nokia Qt LGPL
+** Exception version 1.0, included in the file LGPL_EXCEPTION.txt in this
+** package.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 3.0 as published by the Free Software
+** Foundation and appearing in the file LICENSE.GPL included in the
+** packaging of this file.  Please review the following information to
+** ensure the GNU General Public License version 3.0 requirements will be
+** met: http://www.gnu.org/copyleft/gpl.html.
+**
+** If you are unsure which license is appropriate for your use, please
+** contact the sales department at qt-sales@nokia.com.
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#include "qsystemtrayicon_p.h"
+
+#ifndef QT_NO_SYSTEMTRAYICON
+
+#include "qt_os2.h"
+
+#include "xsystray_api.h"
+
+QT_BEGIN_NAMESPACE
+
+#define WM_XST_MYNOTIFY     (WM_USER + 1000)
+
+static ULONG WM_XST_CREATED = xstGetSysTrayCreatedMsgId();
+static ULONG MaxTextLen = xstGetSysTrayMaxTextLen();
+
+class QSystemTrayIconSys : QWidget
+{
+public:
+    QSystemTrayIconSys(QSystemTrayIcon *object);
+    ~QSystemTrayIconSys();
+
+    HBITMAP createIconMask(const QBitmap &bitmap);
+    void createIcon();
+
+    void addToTray();
+    void removeFromTray();
+    QRect geometry();
+    void setToolTip();
+    void showMessage(const QString &title, const QString &message,
+                     QSystemTrayIcon::MessageIcon type, int timeOut);
+
+protected:
+    bool pmEvent(QMSG *msg, MRESULT *result);
+
+private:
+    HPOINTER hIcon;
+    QPoint globalPos;
+    QSystemTrayIcon *q;
+};
+
+QSystemTrayIconSys::QSystemTrayIconSys(QSystemTrayIcon *object)
+    : hIcon(NULLHANDLE), q(object)
+{
+}
+
+QSystemTrayIconSys::~QSystemTrayIconSys()
+{
+    if (hIcon != NULLHANDLE)
+        WinDestroyPointer(hIcon);
+}
+
+HBITMAP QSystemTrayIconSys::createIconMask(const QBitmap &bitmap)
+{
+    // @todo
+    return NULL;
+}
+
+void QSystemTrayIconSys::createIcon()
+{
+    HPOINTER hIconToDestroy = hIcon;
+
+    // @todo
+
+    if (hIconToDestroy != NULLHANDLE)
+        WinDestroyPointer(hIconToDestroy);
+}
+
+void QSystemTrayIconSys::addToTray()
+{
+    xstAddSysTrayIcon(winId(), 0, hIcon, WM_XST_MYNOTIFY, 0);
+}
+
+void QSystemTrayIconSys::removeFromTray()
+{
+    xstRemoveSysTrayIcon(winId(), 0);
+}
+
+QRect QSystemTrayIconSys::geometry()
+{
+    // @todo use xstQuerySysTrayIconRect()
+    return QRect();
+}
+
+void QSystemTrayIconSys::setToolTip()
+{
+    // @todo use xstSetSysTrayIconToolTip()
+}
+
+void QSystemTrayIconSys::showMessage(const QString &title, const QString &message,
+                                     QSystemTrayIcon::MessageIcon type, int timeOut)
+{
+    // @todo use xstShowSysTrayIconBalloon()
+}
+
+bool QSystemTrayIconSys::pmEvent(QMSG *msg, MRESULT *result)
+{
+    switch(msg->msg) {
+
+        case WM_XST_MYNOTIFY:
+        {
+            // @todo
+            break;
+        }
+
+        default:
+        {
+            if (msg->msg == WM_XST_CREATED)
+            {
+                addToTray();
+                return true;
+            }
+            break;
+        }
+    }
+
+    return QWidget::pmEvent(msg, result);
+}
+
+void QSystemTrayIconPrivate::install_sys()
+{
+    Q_Q(QSystemTrayIcon);
+    if (!sys) {
+        // @todo make QSystemTrayIconSys a singleton and use different icon IDs
+        // to differentiate between icons (this will save us from creating a new
+        // HWND per each icon the application wants to show)
+        sys = new QSystemTrayIconSys(q);
+        sys->createIcon();
+        sys->addToTray();
+    }
+}
+
+void QSystemTrayIconPrivate::
+showMessage_sys(const QString &title, const QString &message,
+                QSystemTrayIcon::MessageIcon type, int timeOut)
+{
+    if (!sys)
+        return;
+
+    sys->showMessage(title, message, type, timeOut);
+}
+
+QRect QSystemTrayIconPrivate::geometry_sys() const
+{
+    if (!sys)
+        return QRect();
+
+    return sys->geometry();
+}
+
+void QSystemTrayIconPrivate::remove_sys()
+{
+    if (!sys)
+        return;
+
+    sys->removeFromTray();
+    delete sys;
+    sys = 0;
+}
+
+void QSystemTrayIconPrivate::updateIcon_sys()
+{
+    if (!sys)
+        return;
+
+    sys->createIcon();
+    sys->addToTray();
+}
+
+void QSystemTrayIconPrivate::updateMenu_sys()
+{
+
+}
+
+void QSystemTrayIconPrivate::updateToolTip_sys()
+{
+    if (!sys)
+        return;
+
+    sys->setToolTip();
+}
+
+bool QSystemTrayIconPrivate::isSystemTrayAvailable_sys()
+{
+    return xstQuerySysTrayVersion(0, 0, 0);
+}
+
+QT_END_NAMESPACE
+
+#endif // ifndef QT_NO_SYSTEMTRAYICON
+
Index: /trunk/src/gui/util/util.pri
===================================================================
--- /trunk/src/gui/util/util.pri	(revision 254)
+++ /trunk/src/gui/util/util.pri	(revision 255)
@@ -26,4 +26,12 @@
 }
 
+os2 {
+		SOURCES += \
+				util/qsystemtrayicon_pm.cpp \
+				../3rdparty/os2/xsystray/xsystray_api.c
+		INCLUDEPATH += \
+				../3rdparty/os2/xsystray
+}
+
 unix:x11 {
 		SOURCES += \
