~ci-train-bot/sni-qt/sni-qt-ubuntu-zesty-2208.1

« back to all changes in this revision

Viewing changes to src/statusnotifieritem.cpp

  • Committer: Aurelien Gateau
  • Date: 2011-09-27 10:31:01 UTC
  • Revision ID: aurelien.gateau@canonical.com-20110927103101-rie4662jkrrjxqcj
Use a placeholder menu if there is none defined yet (Fix one part of LP #860395)

Makes hp-systray menu show up again. See

Show diffs side-by-side

added added

removed removed

Lines of Context:
58
58
: QAbstractSystemTrayIconSys(icon)
59
59
, m_iconCache(iconCache)
60
60
, m_activateAction(0)
 
61
, m_placeholderMenu(new QMenu)
61
62
{
62
63
    SNI_VAR(this);
63
64
    registerMetaTypes();
85
86
    // - If the menu is deleted before StatusNotifierItem, then the exporter
86
87
    // will already be gone when we reach this point.
87
88
    delete m_dbusMenuExporter.data();
 
89
    delete m_placeholderMenu;
88
90
}
89
91
 
90
92
QRect StatusNotifierItem::geometry() const
119
121
    QMenu* menu = trayIcon->contextMenu();
120
122
    SNI_VAR(menu);
121
123
    if (!menu) {
122
 
        return;
 
124
        // A SNI *must* expose a valid menu.  If there is none yet, expose a
 
125
        // placeholder.
 
126
        // See: https://bugs.launchpad.net/ubuntu/+source/hplip/+bug/860395
 
127
        menu = m_placeholderMenu;
123
128
    }
124
129
    connect(menu, SIGNAL(aboutToShow()), SLOT(slotAboutToShow()));
125
130
    m_dbusMenuExporter = new DBusMenuExporter(menuObjectPath(), menu);