KStatusNotifierItem
kstatusnotifieritem.cpp
124 QString::fromLatin1(metaObject()->enumerator(metaObject()->indexOfEnumerator("ItemStatus")).valueToKey(d->status)));
191 QPixmap iconPixmap = QIcon::fromTheme(d->iconName).pixmap(s_legacyTrayIconSize, s_legacyTrayIconSize);
193 QPixmap overlayPixmap = QIcon::fromTheme(d->overlayIconName).pixmap(s_legacyTrayIconSize / 2, s_legacyTrayIconSize / 2);
195 p.drawPixmap(iconPixmap.width() - overlayPixmap.width(), iconPixmap.height() - overlayPixmap.height(), overlayPixmap);
223 QPixmap overlayPixmap = d->overlayIcon.pixmap(s_legacyTrayIconSize / 2, s_legacyTrayIconSize / 2);
226 p.drawPixmap(iconPixmap.width() - overlayPixmap.width(), iconPixmap.height() - overlayPixmap.height(), overlayPixmap);
307static void setTrayToolTip(KStatusNotifierLegacyIcon *systemTrayIcon, const QString &title, const QString &subTitle)
327static void setTrayToolTip(KStatusNotifierLegacyIcon *systemTrayIcon, const QString &title, const QString &)
335void KStatusNotifierItem::setToolTip(const QString &iconName, const QString &title, const QString &subTitle)
353void KStatusNotifierItem::setToolTip(const QIcon &icon, const QString &title, const QString &subTitle)
603void KStatusNotifierItem::showMessage(const QString &title, const QString &message, const QString &icon, int timeout)
607 d->notificationsClient = new org::freedesktop::Notifications(QStringLiteral("org.freedesktop.Notifications"),
625 d->notificationsClient->Notify(d->title, id, icon, title, message, QStringList(), hints, timeout);
650 QString::fromLatin1(metaObject()->enumerator(metaObject()->indexOfEnumerator("ItemStatus")).valueToKey(d->status)));
686 const bool mapped = associatedWindow->isVisible() && !(associatedWindow->windowState() & Qt::WindowMinimized);
703 const KWindowInfo info1(associatedWindow->winId(), NET::XAWMState | NET::WMState | NET::WMDesktop);
712 KWindowInfo info2(id, NET::WMDesktop | NET::WMGeometry | NET::XAWMState | NET::WMState | NET::WMWindowType);
799 || (event->type() == QEvent::MouseButtonRelease && static_cast<QMouseEvent *>(event)->button() == Qt::LeftButton))) {
840 QDBusServiceWatcher *watcher = new QDBusServiceWatcher(QString::fromLatin1(s_statusNotifierWatcherServiceName),
844 QObject::connect(watcher, SIGNAL(serviceOwnerChanged(QString, QString, QString)), q, SLOT(serviceChange(QString, QString, QString)));
861 // Systray icon and menu ("menu extra") are often used by applications that provide no other interface.
862 // It is thus reasonable to show the application icon in the menu; Finder, Dock and App Switcher
863 // all show it in addition to the application name (and Apple's input "menu extra" also shows icons).
890 iconThemePath = QStandardPaths::locate(QStandardPaths::AppDataLocation, QStringLiteral("icons"), QStandardPaths::LocateDirectory);
899 qCDebug(LOG_KSTATUSNOTIFIERITEM) << "Registering a client interface to the KStatusNotifierWatcher";
901 statusNotifierWatcher = new org::kde::StatusNotifierWatcher(QString::fromLatin1(s_statusNotifierWatcherServiceName),
908 QDBusMessage msg = QDBusMessage::createMethodCall(QString::fromLatin1(s_statusNotifierWatcherServiceName),
912 msg.setArguments(QVariantList{QStringLiteral("org.kde.StatusNotifierWatcher"), QStringLiteral("ProtocolVersion")});
919 qCDebug(LOG_KSTATUSNOTIFIERITEM) << "Failed to read protocol version of KStatusNotifierWatcher";
943void KStatusNotifierItemPrivate::serviceChange(const QString &name, const QString &oldOwner, const QString &newOwner)
995 bool isKde = !qEnvironmentVariableIsEmpty("KDE_FULL_SESSION") || qgetenv("XDG_CURRENT_DESKTOP") == "KDE";
1005 QObject::connect(systemTrayIcon, SIGNAL(activated(QSystemTrayIcon::ActivationReason)), q, SLOT(legacyActivated(QSystemTrayIcon::ActivationReason)));
1161 const QString title = KStatusNotifierItem::tr("Confirm Quit From System Tray", "@title:window");
1162 const QString query = KStatusNotifierItem::tr("<qt>Are you sure you want to quit <b>%1</b>?</qt>").arg(caption);
1167 auto *quitButton = dialog->addButton(KStatusNotifierItem::tr("Quit", "@action:button"), QMessageBox::AcceptRole);
1204 Qt::WindowState state = (Qt::WindowState)(associatedWindow->windowState() & ~Qt::WindowMinimized);
1207 if (auto *widgetwindow = static_cast<QWidgetWindow*>(associatedWindow->qt_metacast("QWidgetWindow"))) {
1216 if (auto *widgetwindow = static_cast<QWidgetWindow*>(associatedWindow->qt_metacast("QWidgetWindow"))) {
A DBusMenuExporter instance can serialize a menu over DBus.
Definition dbusmenuexporter.h:23
KDE Status notifier Item protocol implementation
Definition kstatusnotifieritem.h:66
virtual void activate(const QPoint &pos=QPoint())
Shows the main window and try to position it on top of the other windows, if the window is already vi...
Definition kstatusnotifieritem.cpp:639
void setStatus(const ItemStatus status)
Sets a new status for this icon.
Definition kstatusnotifieritem.cpp:114
void setAssociatedWindow(QWindow *window)
Sets the main window associated with this StatusNotifierItem.
Definition kstatusnotifieritem.cpp:494
QIcon overlayIconPixmap() const
Definition kstatusnotifieritem.cpp:232
void setContextMenu(QMenu *menu)
Sets a new context menu for this StatusNotifierItem.
Definition kstatusnotifieritem.cpp:450
ItemCategory
Different kinds of applications announce their type to the systemtray, so can be drawn in a different...
Definition kstatusnotifieritem.h:103
QWindow * associatedWindow() const
Access the main window associated with this StatusNotifierItem.
Definition kstatusnotifieritem.cpp:542
void setAttentionIconByName(const QString &name)
Sets a new icon that should be used when the application wants to request attention (usually the syst...
Definition kstatusnotifieritem.cpp:239
void activateRequested(bool active, const QPoint &pos)
Inform the host application that an activation has been requested, for instance left mouse click,...
void setToolTipIconByName(const QString &name)
Set a new icon for the toolTip.
Definition kstatusnotifieritem.cpp:374
void setToolTipSubTitle(const QString &subTitle)
Sets a new subtitle for the toolTip.
Definition kstatusnotifieritem.cpp:431
ItemStatus
All the possible status this icon can have, depending on the importance of the events that happens in...
Definition kstatusnotifieritem.h:87
@ Active
The application is doing something, or it is important that the icon is always reachable from the use...
Definition kstatusnotifieritem.h:92
@ NeedsAttention
The application requests the attention of the user, for instance battery running out or a new IM mess...
Definition kstatusnotifieritem.h:95
@ Passive
Nothing is happening in the application, so showing this icon is not required. This is the default va...
Definition kstatusnotifieritem.h:89
void setToolTip(const QString &iconName, const QString &title, const QString &subTitle)
Sets a new toolTip or this icon, a toolTip is composed of an icon, a title and a text,...
Definition kstatusnotifieritem.cpp:335
void setStandardActionsEnabled(bool enabled)
Sets whether to show the standard items in the menu, such as Quit.
Definition kstatusnotifieritem.cpp:575
void setOverlayIconByPixmap(const QIcon &icon)
Sets an icon to be used as overlay for the main one setOverlayIconByPixmap(QIcon()) will remove the o...
Definition kstatusnotifieritem.cpp:207
void showMessage(const QString &title, const QString &message, const QString &icon, int timeout=10000)
Shows the user a notification.
Definition kstatusnotifieritem.cpp:603
void setIconByName(const QString &name)
Sets a new main icon for the system tray.
Definition kstatusnotifieritem.cpp:133
QIcon toolTipIconPixmap() const
Definition kstatusnotifieritem.cpp:407
QString providedToken() const
Definition kstatusnotifieritem.cpp:674
void hideAssociatedWindow()
Hides the main window, if not already hidden.
Definition kstatusnotifieritem.cpp:666
void setIconByPixmap(const QIcon &icon)
Sets a new main icon for the system tray.
Definition kstatusnotifieritem.cpp:156
QIcon attentionIconPixmap() const
Definition kstatusnotifieritem.cpp:273
QString attentionMovieName() const
Definition kstatusnotifieritem.cpp:299
void setCategory(const ItemCategory category)
Sets the category for this icon, usually it's needed to call this function only once.
Definition kstatusnotifieritem.cpp:94
void setAttentionMovieByName(const QString &name)
Sets a movie as the requesting attention icon.
Definition kstatusnotifieritem.cpp:278
void setTitle(const QString &title)
Sets a title for this icon.
Definition kstatusnotifieritem.cpp:109
void setAttentionIconByPixmap(const QIcon &icon)
Sets the pixmap of the requesting attention icon.
Definition kstatusnotifieritem.cpp:258
KStatusNotifierItem(QObject *parent=nullptr)
Construct a new status notifier item.
Definition kstatusnotifieritem.cpp:59
QMenu * contextMenu() const
Access the context menu associated to this status notifier item.
Definition kstatusnotifieritem.cpp:489
void setToolTipTitle(const QString &title)
Sets a new title for the toolTip.
Definition kstatusnotifieritem.cpp:412
bool standardActionsEnabled() const
Definition kstatusnotifieritem.cpp:598
void setOverlayIconByName(const QString &name)
Sets an icon to be used as overlay for the main one.
Definition kstatusnotifieritem.cpp:180
void setToolTipIconByPixmap(const QIcon &icon)
Set a new icon for the toolTip.
Definition kstatusnotifieritem.cpp:392
bool onAllDesktops() const
static Q_INVOKABLE void activateWindow(QWindow *window, long time=0)
static bool isPlatformX11()
static KWindowSystem * self()
static void setOnAllDesktops(WId win, bool b)
static void setCurrentDesktop(int desktop)
static QList< WId > stackingOrder()
static Q_INVOKABLE void forceActiveWindow(QWindow *window, long time=0)
KeepAbove
DialogMask
MenuMask
SplashMask
UtilityMask
OverrideMask
ToolbarMask
DockMask
NormalMask
DesktopMask
TopMenuMask
WindowType
TopMenu
Dock
Visible
Q_SCRIPTABLE CaptureState status()
Type type(const QSqlDatabase &db)
KSERVICE_EXPORT KService::List query(FilterFunc filterFunc)
KGuiItem ok()
Category category(StandardShortcut id)
void setEnabled(bool)
void setIcon(const QIcon &icon)
void setText(const QString &text)
applicationName
void quit()
QDBusPendingCall asyncCall(const QDBusMessage &message, int timeout) const const
QDBusConnection sessionBus()
QDBusMessage createMethodCall(const QString &service, const QString &path, const QString &interface, const QString &method)
void setArguments(const QList< QVariant > &arguments)
void finished(QDBusPendingCallWatcher *self)
bool isError() const const
typename Select< 0 >::Type value() const const
WatchForOwnerChange
void accepted()
Show
void setBold(bool enable)
void setPointSizeF(qreal pointSize)
GeneralFont
QFont systemFont(SystemFont type)
applicationDisplayName
desktopFileName
platformName
QPixmap pixmap(QWindow *window, const QSize &size, Mode mode, State state) const const
QList< QSize > availableSizes(Mode mode, State state) const const
qint64 cacheKey() const const
QIcon fromTheme(const QString &name)
Format_ARGB32
uchar * bits()
QImage convertToFormat(Format format, Qt::ImageConversionFlags flags) &&
Format format() const const
QSize size() const const
qsizetype sizeInBytes() const const
AcceptRole
Question
NoButton
Q_EMITQ_EMIT
QMetaObject::Connection connect(const QObject *sender, PointerToMemberFunction signal, Functor functor)
void deleteLater()
bool disconnect(const QMetaObject::Connection &connection)
virtual bool event(QEvent *e)
void installEventFilter(QObject *filterObj)
virtual const QMetaObject * metaObject() const const
QString tr(const char *sourceText, const char *disambiguation, int n)
void drawPixmap(const QPoint &point, const QPixmap &pixmap)
bool end()
int height() const const
QImage toImage() const const
int width() const const
Qt::MouseButton button() const const
int height() const const
int width() const const
LocateDirectory
AppDataLocation
QString locate(StandardLocation type, const QString &fileName, LocateOptions options)
QString arg(Args &&... args) const const
void chop(qsizetype n)
bool endsWith(QChar c, Qt::CaseSensitivity cs) const const
QString fromLatin1(QByteArrayView str)
bool isEmpty() const const
ByteOrder
ActivationReason
Information
bool isSystemTrayAvailable()
AlignRight
NoBrush
transparent
LeftButton
WA_DeleteOnClose
WindowMinimized
typedef WindowFlags
singleShot
QWidget * window() const const
QWindow * windowHandle() const const
This file is part of the KDE documentation.
Documentation copyright © 1996-2024 The KDE developers.
Generated on Mon Nov 18 2024 12:15:27 by doxygen 1.12.0 written by Dimitri van Heesch, © 1997-2006
Documentation copyright © 1996-2024 The KDE developers.
Generated on Mon Nov 18 2024 12:15:27 by doxygen 1.12.0 written by Dimitri van Heesch, © 1997-2006
KDE's Doxygen guidelines are available online.