• Skip to content
  • Skip to link menu
  • KDE API Reference
  • kdelibs-4.14.38 API Reference
  • KDE Home
  • Contact Us
 

KDEUI

  • kdeui
  • notifications
kstatusnotifieritem.h
Go to the documentation of this file.
1/* This file is part of the KDE libraries
2 Copyright 2009 by Marco Martin <notmart@gmail.com>
3
4 This library is free software; you can redistribute it and/or
5 modify it under the terms of the GNU Library General Public
6 License (LGPL) as published by the Free Software Foundation;
7 either version 2 of the License, or (at your option) any later
8 version.
9
10 This library is distributed in the hope that it will be useful,
11 but WITHOUT ANY WARRANTY; without even the implied warranty of
12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13 Library General Public License for more details.
14
15 You should have received a copy of the GNU Library General Public License
16 along with this library; see the file COPYING.LIB. If not, write to
17 the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
18 Boston, MA 02110-1301, USA.
19*/
20
21#ifndef KSTATUSNOTIFIERITEM_H
22#define KSTATUSNOTIFIERITEM_H
23
24#include <QtCore/QObject>
25#include <QtCore/QString>
26#include <QtDBus/QDBusArgument>
27#include <QtCore/QPoint>
28
29#include "kdeui_export.h"
30
31class KActionCollection;
32class KMenu;
33class QMovie;
34
35
36class KStatusNotifierItemPrivate;
37
72class KDEUI_EXPORT KStatusNotifierItem : public QObject
73{
74 Q_OBJECT
75
76 Q_ENUMS(ItemStatus)
77 Q_ENUMS(ItemCategory)
78 Q_PROPERTY( ItemCategory category READ category WRITE setCategory )
79 Q_PROPERTY( QString title READ title WRITE setTitle )
80 Q_PROPERTY( ItemStatus status READ status WRITE setStatus )
81 Q_PROPERTY( QString iconName READ iconName WRITE setIconByName )
82 Q_PROPERTY( QString overlayIconName READ overlayIconName WRITE setOverlayIconByName )
83 Q_PROPERTY( QString attentionIconName READ attentionIconName WRITE setAttentionIconByName )
84 Q_PROPERTY( QString toolTipIconName READ toolTipIconName WRITE setToolTipIconByName )
85 Q_PROPERTY( QString toolTipTitle READ toolTipTitle WRITE setToolTipTitle )
86 Q_PROPERTY( QString toolTipSubTitle READ toolTipSubTitle WRITE setToolTipSubTitle )
87
88 friend class KStatusNotifierItemDBus;
89 friend class KStatusNotifierItemPrivate;
90public:
95 enum ItemStatus {
97 Passive = 1,
100 Active = 2,
103 NeedsAttention = 3
104 };
105
110 enum ItemCategory {
112 ApplicationStatus = 1,
115 Communications = 2,
119 SystemServices = 3,
121 Hardware = 4,
122 Reserved = 129
123 };
124
133 explicit KStatusNotifierItem(QObject *parent = 0);
134
153 explicit KStatusNotifierItem(const QString &id, QObject *parent = 0);
154
155 ~KStatusNotifierItem();
156
163 QString id() const;
164
170 void setCategory(const ItemCategory category);
171
175 ItemCategory category() const;
176
180 void setTitle(const QString &title);
181
185 QString title() const;
186
190 void setStatus(const ItemStatus status);
191
195 ItemStatus status() const;
196
197 //Main icon related functions
204 void setIconByName(const QString &name);
205
210 QString iconName() const;
211
217 void setIconByPixmap(const QIcon &icon);
218
222 QIcon iconPixmap() const;
223
229 void setOverlayIconByName(const QString &name);
230
234 QString overlayIconName() const;
235
243 void setOverlayIconByPixmap(const QIcon &icon);
244
248 QIcon overlayIconPixmap() const;
249
250 //Requesting attention icon
251
259 void setAttentionIconByName(const QString &name);
260
266 QString attentionIconName() const;
267
274 void setAttentionIconByPixmap(const QIcon &icon);
275
279 QIcon attentionIconPixmap() const;
280
285 void setAttentionMovieByName(const QString &name);
286
291 QString attentionMovieName() const;
292
293
294 //ToolTip handling
303 void setToolTip(const QString &iconName, const QString &title, const QString &subTitle);
304
309 void setToolTip(const QIcon &icon, const QString &title, const QString &subTitle);
310
316 void setToolTipIconByName(const QString &name);
317
322 QString toolTipIconName() const;
323
330 void setToolTipIconByPixmap(const QIcon &icon);
331
335 QIcon toolTipIconPixmap() const;
336
340 void setToolTipTitle(const QString &title);
341
345 QString toolTipTitle() const;
346
350 void setToolTipSubTitle(const QString &subTitle);
351
355 QString toolTipSubTitle() const;
356
364 void setContextMenu(KMenu *menu);
365
369 KMenu *contextMenu() const;
370
381 void setAssociatedWidget(QWidget *parent);
382
386 QWidget *associatedWidget() const;
387
391 KActionCollection *actionCollection() const;
392
396 void setStandardActionsEnabled(bool enabled);
397
401 bool standardActionsEnabled() const;
402
411 void showMessage(const QString &title, const QString &message, const QString &icon, int timeout = 10000);
412
413
414public Q_SLOTS:
415
422 virtual void activate(const QPoint &pos = QPoint());
423
424Q_SIGNALS:
432 void scrollRequested(int delta, Qt::Orientation orientation);
433
443 void activateRequested(bool active, const QPoint &pos);
444
453 void secondaryActivateRequested(const QPoint &pos);
454
455protected:
456 bool eventFilter(QObject *watched, QEvent *event);
457
458private:
459 KStatusNotifierItemPrivate *const d;
460
461 Q_PRIVATE_SLOT(d, void serviceChange(const QString& name,
462 const QString& oldOwner,
463 const QString& newOwner))
464 Q_PRIVATE_SLOT(d, void checkForRegisteredHosts())
465 Q_PRIVATE_SLOT(d, void registerToDaemon())
466 Q_PRIVATE_SLOT(d, void contextMenuAboutToShow())
467 Q_PRIVATE_SLOT(d, void maybeQuit())
468 Q_PRIVATE_SLOT(d, void minimizeRestore())
469 Q_PRIVATE_SLOT(d, void hideMenu())
470 Q_PRIVATE_SLOT(d, void legacyWheelEvent(int))
471 Q_PRIVATE_SLOT(d, void legacyActivated(QSystemTrayIcon::ActivationReason))
472};
473
474#endif
KActionCollection
A container for a set of QAction objects.
Definition: kactioncollection.h:57
KMenu
A menu with keyboard searching.
Definition: kmenu.h:42
KStatusNotifierItem
KDE Status notifier Item protocol implementation
Definition: kstatusnotifieritem.h:73
KStatusNotifierItem::ItemCategory
ItemCategory
Different kinds of applications announce their type to the systemtray, so can be drawn in a different...
Definition: kstatusnotifieritem.h:110
KStatusNotifierItem::activateRequested
void activateRequested(bool active, const QPoint &pos)
Inform the host application that an activation has been requested, for instance left mouse click,...
KStatusNotifierItem::ItemStatus
ItemStatus
All the possible status this icon can have, depending on the importance of the events that happens in...
Definition: kstatusnotifieritem.h:95
KStatusNotifierItem::scrollRequested
void scrollRequested(int delta, Qt::Orientation orientation)
Inform the host application that the mouse wheel (or another mean of scrolling that the visualization...
KStatusNotifierItem::secondaryActivateRequested
void secondaryActivateRequested(const QPoint &pos)
Alternate activate action, for instance right mouse click, but this is not guaranteed since it's depe...
QObject
QSystemTrayIcon
QWidget
kdeui_export.h
This file is part of the KDE documentation.
Documentation copyright © 1996-2023 The KDE developers.
Generated on Mon Feb 20 2023 00:00:00 by doxygen 1.9.6 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.

KDEUI

Skip menu "KDEUI"
  • Main Page
  • Namespace List
  • Namespace Members
  • Alphabetical List
  • Class List
  • Class Hierarchy
  • Class Members
  • File List
  • File Members
  • Modules
  • Related Pages

kdelibs-4.14.38 API Reference

Skip menu "kdelibs-4.14.38 API Reference"
  • DNSSD
  • Interfaces
  •   KHexEdit
  •   KMediaPlayer
  •   KSpeech
  •   KTextEditor
  • kconf_update
  • KDE3Support
  •   KUnitTest
  • KDECore
  • KDED
  • KDEsu
  • KDEUI
  • KDEWebKit
  • KDocTools
  • KFile
  • KHTML
  • KImgIO
  • KInit
  • kio
  • KIOSlave
  • KJS
  •   KJS-API
  •   WTF
  • kjsembed
  • KNewStuff
  • KParts
  • KPty
  • Kross
  • KUnitConversion
  • KUtils
  • Nepomuk
  • Plasma
  • Solid
  • Sonnet
  • ThreadWeaver
Report problems with this website to our bug tracking system.
Contact the specific authors with questions and comments about the page contents.

KDE® and the K Desktop Environment® logo are registered trademarks of KDE e.V. | Legal