Changeset 277


Ignore:
Timestamp:
Nov 2, 2009, 3:00:35 PM (16 years ago)
Author:
Dmitry A. Kuminov
Message:

gui: QSystemTrayIcon: Implemented reaction to notification messages from the system tray and emitting them as signals.

Location:
trunk/src/gui
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/gui/util/qsystemtrayicon_pm.cpp

    r260 r277  
    4646#ifndef QT_NO_SYSTEMTRAYICON
    4747
     48
     49
    4850#include "qt_os2.h"
    4951
     
    133135    switch(msg->msg) {
    134136
    135         case WM_XST_MYNOTIFY:
    136         {
    137             // @todo
     137        case WM_XST_MYNOTIFY: {
     138            switch (SHORT2FROMMP(msg->mp1)) {
     139                case XST_IN_MOUSE: {
     140                    PXSTMOUSEMSG pMsg = (PXSTMOUSEMSG)msg->mp2;
     141                    switch (pMsg->ulMouseMsg) {
     142                        case WM_BUTTON1CLICK:
     143                            emit q->activated(QSystemTrayIcon::Trigger);
     144                            break;
     145                        case WM_BUTTON1DBLCLK:
     146                            emit q->activated(QSystemTrayIcon::DoubleClick);
     147                            break;
     148                        case WM_BUTTON3CLICK:
     149                            emit q->activated(QSystemTrayIcon::MiddleClick);
     150                            break;
     151                        default:
     152                            break;
     153                    }
     154                    break;
     155                }
     156                case XST_IN_CONTEXT: {
     157                    PXSTCONTEXTMSG pMsg = (PXSTCONTEXTMSG)msg->mp2;
     158                    if (q->contextMenu()) {
     159                        QPoint gpos(pMsg->ptsPointerPos.x,
     160                                    // flip y coordinate
     161                                    QApplication::desktop()->height() -
     162                                        (pMsg->ptsPointerPos.y + 1));
     163                        q->contextMenu()->popup(gpos);
     164                        q->contextMenu()->activateWindow();
     165                        // Must be activated for proper keyboardfocus and
     166                        // menu closing on OS/2
     167                    }
     168                    emit q->activated(QSystemTrayIcon::Context);
     169                    break;
     170                }
     171                default:
     172                    break;
     173            }
    138174            break;
    139175        }
    140176
    141         default:
    142         {
    143             if (msg->msg == WM_XST_CREATED)
    144             {
     177        default: {
     178            if (msg->msg == WM_XST_CREATED) {
    145179                addToTray();
    146180                return true;
  • trunk/src/gui/widgets/qmenu.cpp

    r2 r277  
    165165}
    166166
    167 //Windows and KDE allows menus to cover the taskbar, while GNOME and Mac don't
     167// and KDE allows menus to cover the taskbar, while GNOME and Mac don't
    168168QRect QMenuPrivate::popupGeometry(int screen) const
    169169{
    170 #ifdef Q_WS_WIN
     170#if
    171171    return QApplication::desktop()->screenGeometry(screen);
    172172#elif defined Q_WS_X11
     
    10961096            QList< QPointer<QWidget> > list;
    10971097            for(QWidget *widget = q->parentWidget(); widget; ) {
    1098                 if (qobject_cast<QMenu*>(widget) 
     1098                if (qobject_cast<QMenu*>(widget)
    10991099#ifndef QT_NO_MENUBAR
    11001100                    || qobject_cast<QMenuBar*>(widget)
     
    12621262    is represented vertically and rendered by QStyle. In addition, actions
    12631263    can have a text label, an optional icon drawn on the very left side,
    1264     and shortcut key sequence such as "Ctrl+X". 
     1264    and shortcut key sequence such as "Ctrl+X".
    12651265
    12661266    The existing actions held by a menu can be found with actions().
Note: See TracChangeset for help on using the changeset viewer.