KWindowSystem

kstartupinfo.h
1 /*
2  SPDX-FileCopyrightText: 2001-2003 Lubos Lunak <[email protected]>
3 
4  SPDX-License-Identifier: MIT
5 */
6 
7 #ifndef KSTARTUPINFO_H
8 #define KSTARTUPINFO_H
9 
10 #include <kwindowsystem_export.h>
11 
12 #include <QChildEvent>
13 #include <QObject>
14 #include <QString>
15 #include <QWidgetList> // for WId
16 #include <QWindow>
17 
18 #include <sys/types.h>
19 
20 typedef struct _XDisplay Display;
21 
22 struct xcb_connection_t;
23 
24 #ifdef Q_CC_MSVC
25 typedef int pid_t;
26 #endif
27 
28 class KStartupInfoId;
29 class KStartupInfoData;
30 
31 /**
32  * Class for manipulating the application startup notification.
33  *
34  * This class can be used to send information about started application,
35  * change the information and receive this information. For detailed
36  * description, see kdelibs/kdecore/README.kstartupinfo.
37  *
38  * You usually don't need to use this class for sending the notification
39  * information, as KDE libraries should do this when an application is
40  * started (e.g. KRun class).
41  *
42  * For receiving the startup notification info, create an instance and connect
43  * to its slots. It will automatically detect started applications and when
44  * they are ready.
45  *
46  * @see KStartupInfoId
47  * @see KStartupInfoData
48  *
49  * @author Lubos Lunak <[email protected]>
50  */
51 class KWINDOWSYSTEM_EXPORT KStartupInfo : public QObject
52 {
53  Q_OBJECT
54 public:
55  /**
56  * Manual notification that the application has started.
57  * If you do not map a (toplevel) window, then startup
58  * notification will not disappear for the application
59  * until a timeout. You can use this as an alternative
60  * method in this case.
61  */
62  static void appStarted();
63 
64  /**
65  * Sends explicit notification that the startup notification
66  * with id startup_id should end.
67  */
68  static void appStarted(const QByteArray &startup_id);
69 
70  /**
71  * Returns the app startup notification identifier for this running
72  * application.
73  * @return the startup notification identifier
74  */
75  static QByteArray startupId();
76 
77  /**
78  * Sets a new value for the application startup notification window property for newly
79  * created toplevel windows.
80  * @param startup_id the startup notification identifier
81  * @see KStartupInfo::setNewStartupId
82  */
83  static void setStartupId(const QByteArray &startup_id);
84 
85  /**
86  * Use this function if the application got a request with startup
87  * notification from outside (for example, when KUniqueApplication::newInstance()
88  * is called, or e.g.\ when khelpcenter opens new URL in its window).
89  * The window can be either an already existing and visible window,
90  * or a new one, before being shown. Note that this function is usually
91  * needed only when a window is reused.
92  */
93  static void setNewStartupId(QWindow *window, const QByteArray &startup_id);
94 
95 #if KWINDOWSYSTEM_ENABLE_DEPRECATED_SINCE(5, 62)
96  /**
97  * Use this function if the application got a request with startup
98  * notification from outside (for example, when KUniqueApplication::newInstance()
99  * is called, or e.g.\ when khelpcenter opens new URL in its window).
100  * The window can be either an already existing and visible window,
101  * or a new one, before being shown. Note that this function is usually
102  * needed only when a window is reused.
103  * @deprecated since 5.62, use setNewStartupId(QWindow *) instead
104  * Note: if all you have is a QWidget*, you might need to call
105  * setAttribute(Qt::WA_NativeWindow, true); before calling window()->windowHandle().
106  */
107  KWINDOWSYSTEM_DEPRECATED_VERSION(5, 62, "Use KStartupInfo::setNewStartupId(QWindow*)")
108  static void setNewStartupId(QWidget *window, const QByteArray &startup_id);
109 #endif
110 
111  /**
112  * If your application shows temporarily some window during its startup,
113  * for example a dialog, and only after closing it shows the main window,
114  * startup notification would normally be shown while the dialog is visible.
115  * To temporarily suspend and resume the notification, use this function.
116  * Note that this is cumulative, i.e. after suspending twice, you have to
117  * resume twice.
118  */
119  static void silenceStartup(bool silence);
120 
121  /**
122  * Creates and returns new startup id. The id includes properly setup
123  * user timestamp.
124  *
125  * On the X11 platform the current timestamp will be fetched from the
126  * X-Server. If the caller has an adaquat timestamp (e.g. from a QMouseEvent)
127  * it should prefer using createNewStartupIdForTimestamp to not trigger a
128  * roundtrip to the X-Server
129  *
130  * @see createNewStartupIdForTimestamp
131  */
132  static QByteArray createNewStartupId();
133  /**
134  * Creates and returns new startup id with @p timestamp as user timestamp part.
135  *
136  * @param timestamp The timestamp for the startup id.
137  * @see createNewStartupId
138  * @since 5.5
139  **/
140  static QByteArray createNewStartupIdForTimestamp(quint32 timestamp);
141  /**
142  *
143  */
144  enum {
145  CleanOnCantDetect = 1 << 0,
146  DisableKWinModule = 1 << 1,
147  AnnounceSilenceChanges = 1 << 2,
148  };
149 
150  /**
151  * Creates an instance that will receive the startup notifications.
152  * The various flags passed may be
153  * @li CleanOnCantDetect - when a new unknown window appears, all startup
154  * notifications for applications that are not compliant with
155  * the startup protocol are removed
156  * @li DisableKWinModule - KWinModule, which is normally used to detect
157  * new windows, is disabled. With this flag, checkStartup() must be
158  * called in order to check newly mapped windows.
159  * @li AnnounceSilenceChanges - normally, startup notifications are
160  * "removed" when they're silenced, and "recreated" when they're resumed.
161  * With this flag, the change is normally announced with gotStartupChange().
162  *
163  * @param flags OR-ed combination of flags
164  * @param parent the parent of this QObject (can be @c nullptr for no parent)
165  *
166  */
167  explicit KStartupInfo(int flags, QObject *parent = nullptr);
168 #if KWINDOWSYSTEM_ENABLE_DEPRECATED_SINCE(5, 0)
169  /**
170  * Creates an instance that will receive the startup notifications.
171  *
172  * @param clean_on_cantdetect if true, and a new unknown window appears,
173  * removes all notification for applications that are not compliant
174  * with the app startup protocol
175  * @param parent the parent of this QObject (can be @c nullptr for no parent)
176  *
177  * @deprecated since 5.0
178  */
179  KWINDOWSYSTEM_DEPRECATED_VERSION(5, 0, "Use KStartupInfo(int, QObject *)")
180  explicit KStartupInfo(bool clean_on_cantdetect, QObject *parent = nullptr);
181 #endif
182  ~KStartupInfo() override;
183  /**
184  * Sends given notification data about started application
185  * with the given startup identification. If no notification for this identification
186  * exists yet, it is created, otherwise it's updated. Note that the name field
187  * in data is required.
188  *
189  * @param id the id of the application
190  * @param data the application's data
191  * @return true if successful, false otherwise
192  * @see KStartupInfoId
193  * @see KStartupInfoData
194  */
195  static bool sendStartup(const KStartupInfoId &id, const KStartupInfoData &data);
196 
197 #if KWINDOWSYSTEM_ENABLE_DEPRECATED_SINCE(5, 18)
198  /**
199  * Like sendStartup , uses dpy instead of qt_x11display() for sending the info.
200  * @param dpy the display of the application. Note that the name field
201  * in data is required.
202  * @param id the id of the application
203  * @param data the application's data
204  * @return true if successful, false otherwise
205  * @deprecated since 5.18 use sendStartupXcb
206  */
207  KWINDOWSYSTEM_DEPRECATED_VERSION(5, 18, "Use KStartupInfo::sendStartupXcb(xcb_connection_t *, int, const KStartupInfoId &, const KStartupInfoData &)")
208  static bool sendStartupX(Display *dpy, const KStartupInfoId &id, const KStartupInfoData &data);
209 #endif
210 
211  /**
212  * Like sendStartup , uses @p conn instead of QX11Info::connection() for sending the info.
213  * @param conn the xcb connection of the application. Note that the name field
214  * in data is required.
215  * @param screen The x11 screen the connection belongs to
216  * @param id the id of the application
217  * @param data the application's data
218  * @return true if successful, false otherwise
219  * @since 5.18
220  */
221  static bool sendStartupXcb(xcb_connection_t *conn, int screen, const KStartupInfoId &id, const KStartupInfoData &data);
222 
223  /**
224  * Sends given notification data about started application
225  * with the given startup identification. This is used for updating the notification
226  * info, if no notification for this identification exists, it's ignored.
227  * @param id the id of the application
228  * @param data the application's data
229  * @return true if successful, false otherwise
230  * @see KStartupInfoId
231  * @see KStartupInfoData
232  */
233  static bool sendChange(const KStartupInfoId &id, const KStartupInfoData &data);
234 
235 #if KWINDOWSYSTEM_ENABLE_DEPRECATED_SINCE(5, 18)
236  /**
237  * Like sendChange , uses dpy instead of qt_x11display() for sending the info.
238  * @param dpy the display of the application.
239  * @param id the id of the application
240  * @param data the application's data
241  * @return true if successful, false otherwise
242  * @deprecated since 5.18 use sendChangeXcb
243  */
244  KWINDOWSYSTEM_DEPRECATED_VERSION(5, 18, "Use KStartupInfo::sendChangeXcb(xcb_connection_t *, int, const KStartupInfoId &, const KStartupInfoData &)")
245  static bool sendChangeX(Display *dpy, const KStartupInfoId &id, const KStartupInfoData &data);
246 #endif
247 
248  /**
249  * Like sendChange , uses @p conn instead of QX11Info::connection() for sending the info.
250  * @param conn the xcb connection of the application.
251  * @param screen The x11 screen the connection belongs to
252  * @param id the id of the application
253  * @param data the application's data
254  * @return true if successful, false otherwise
255  * @since 5.18
256  */
257  static bool sendChangeXcb(xcb_connection_t *conn, int screen, const KStartupInfoId &id, const KStartupInfoData &data);
258 
259  /**
260  * Ends startup notification with the given identification.
261  * @param id the id of the application
262  * @return true if successful, false otherwise
263  */
264  static bool sendFinish(const KStartupInfoId &id);
265 
266 #if KWINDOWSYSTEM_ENABLE_DEPRECATED_SINCE(5, 18)
267  /**
268  * Like sendFinish , uses dpy instead of qt_x11display() for sending the info.
269  * @param dpy the display of the application.
270  * @param id the id of the application
271  * @return true if successful, false otherwise
272  * @deprecated since 5.18 use sendFinishXcb
273  */
274  KWINDOWSYSTEM_DEPRECATED_VERSION(5, 18, "Use KStartupInfo::sendFinishXcb(xcb_connection_t *, int, const KStartupInfoId &)")
275  static bool sendFinishX(Display *dpy, const KStartupInfoId &id);
276 #endif
277 
278  /**
279  * Like sendFinish , uses @p conn instead of QX11Info::connection() for sending the info.
280  * @param conn the xcb connection of the application.
281  * @param screen The x11 screen the connection belongs to
282  * @param id the id of the application
283  * @return true if successful, false otherwise
284  * @since 5.18
285  */
286  static bool sendFinishXcb(xcb_connection_t *conn, int screen, const KStartupInfoId &id);
287 
288  /**
289  * Ends startup notification with the given identification and the given data
290  * (e.g.\ PIDs of processes for this startup notification that exited).
291  * @param id the id of the application
292  * @param data the application's data
293  * @return true if successful, false otherwise
294  */
295  static bool sendFinish(const KStartupInfoId &id, const KStartupInfoData &data);
296 
297 #if KWINDOWSYSTEM_ENABLE_DEPRECATED_SINCE(5, 18)
298  /**
299  * Like sendFinish , uses dpy instead of qt_x11display() for sending the info.
300  * @param dpy the display of the application.
301  * @param id the id of the application
302  * @param data the application's data
303  * @return true if successful, false otherwise
304  * @deprecated since 5.18 use sendFinishXcb
305  */
306  KWINDOWSYSTEM_DEPRECATED_VERSION(5, 18, "Use KStartupInfo::sendFinishXcb(xcb_connection_t *, int, const KStartupInfoId &, const KStartupInfoData &)")
307  static bool sendFinishX(Display *dpy, const KStartupInfoId &id, const KStartupInfoData &data);
308 #endif
309 
310  /**
311  * Like sendFinish , uses @p conn instead of QX11Info::connection() for sending the info.
312  * @param conn the xcb connection of the application.
313  * @param screen The x11 screen the connection belongs to
314  * @param id the id of the application
315  * @param data the application's data
316  * @return true if successful, false otherwise
317  * @since 5.18
318  */
319  static bool sendFinishXcb(xcb_connection_t *conn, int screen, const KStartupInfoId &id, const KStartupInfoData &data);
320 
321  /**
322  * Returns the current startup notification identification for the current
323  * startup notification environment variable. Note that KApplication constructor
324  * unsets the variable and you have to use KApplication::startupId .
325  * @return the current startup notification identification
326  */
327  static KStartupInfoId currentStartupIdEnv();
328  /**
329  * Unsets the startup notification environment variable.
330  */
331  static void resetStartupEnv();
332  /**
333  * @li NoMatch - the window doesn't match any existing startup notification
334  * @li Match - the window matches an existing startup notification
335  * @li CantDetect - unable to detect if the window matches any existing
336  * startup notification
337  */
338  enum startup_t { NoMatch, Match, CantDetect };
339  /**
340  * Checks if the given windows matches any existing startup notification.
341  * @param w the window id to check
342  * @return the result of the operation
343  */
344  startup_t checkStartup(WId w);
345  /**
346  * Checks if the given windows matches any existing startup notification, and
347  * if yes, returns the identification in id.
348  * @param w the window id to check
349  * @param id if found, the id of the startup notification will be written here
350  * @return the result of the operation
351  */
352  startup_t checkStartup(WId w, KStartupInfoId &id);
353  /**
354  * Checks if the given windows matches any existing startup notification, and
355  * if yes, returns the notification data in data.
356  * @param w the window id to check
357  * @param data if found, the data of the startup notification will be written here
358  * @return the result of the operation
359  */
360  startup_t checkStartup(WId w, KStartupInfoData &data);
361  /**
362  * Checks if the given windows matches any existing startup notification, and
363  * if yes, returns the identification in id and notification data in data.
364  * @param w the window id to check
365  * @param id if found, the id of the startup notification will be written here
366  * @param data if found, the data of the startup notification will be written here
367  * @return the result of the operation
368  */
369  startup_t checkStartup(WId w, KStartupInfoId &id, KStartupInfoData &data);
370  /**
371  * Sets the timeout for notifications, after this timeout a notification is removed.
372  * @param secs the new timeout in seconds
373  */
374  void setTimeout(unsigned int secs);
375  /**
376  * Sets the startup notification window property on the given window.
377  * @param window the id of the window
378  * @param id the startup notification id
379  */
380  static void setWindowStartupId(WId window, const QByteArray &id);
381  /**
382  * Returns startup notification identification of the given window.
383  * @param w the id of the window
384  * @return the startup notification id. Can be null if not found.
385  */
386  static QByteArray windowStartupId(WId w);
387  /**
388  * @internal
389  */
390  class Data;
391 
392  /**
393  * @internal
394  */
395  class Private;
396 Q_SIGNALS:
397  /**
398  * Emitted when a new startup notification is created (i.e.\ a new application is
399  * being started).
400  * @param id the notification identification
401  * @param data the notification data
402  */
403  void gotNewStartup(const KStartupInfoId &id, const KStartupInfoData &data);
404  /**
405  * Emitted when a startup notification changes.
406  * @param id the notification identification
407  * @param data the notification data
408  */
409  void gotStartupChange(const KStartupInfoId &id, const KStartupInfoData &data);
410  /**
411  * Emitted when a startup notification is removed (either because it was detected
412  * that the application is ready or because of a timeout).
413  * @param id the notification identification
414  * @param data the notification data
415  */
416  void gotRemoveStartup(const KStartupInfoId &id, const KStartupInfoData &data);
417 
418 protected:
419  /**
420  *
421  */
422  void customEvent(QEvent *e_P) override;
423 
424 private:
425  Q_PRIVATE_SLOT(d, void startups_cleanup())
426  Q_PRIVATE_SLOT(d, void startups_cleanup_no_age())
427  Q_PRIVATE_SLOT(d, void got_message(const QString &msg))
428  Q_PRIVATE_SLOT(d, void window_added(WId w))
429  Q_PRIVATE_SLOT(d, void slot_window_added(WId w))
430 
431  Private *const d;
432 
434 };
435 
436 /**
437  * Class representing an identification of application startup notification.
438  *
439  * Every existing notification about a starting application has its own unique
440  * identification, that's used to identify and manipulate the notification.
441  *
442  * @see KStartupInfo
443  * @see KStartupInfoData
444  *
445  * @author Lubos Lunak <[email protected]>
446  */
447 class KWINDOWSYSTEM_EXPORT KStartupInfoId
448 {
449 public:
450  /**
451  * Overloaded operator.
452  * @return true if the notification identifications are the same
453  */
454  bool operator==(const KStartupInfoId &id) const;
455  /**
456  * Overloaded operator.
457  * @return true if the notification identifications are different
458  */
459  bool operator!=(const KStartupInfoId &id) const;
460  /**
461  * Checks whether the identifier is valid.
462  * @return true if this object doesn't represent a valid notification identification
463  */
464  bool isNull() const;
465 #if KWINDOWSYSTEM_ENABLE_DEPRECATED_SINCE(5, 0)
466  KWINDOWSYSTEM_DEPRECATED_VERSION(5, 0, "Use KStartupInfoId::isNull()")
467  bool none() const
468  {
469  return isNull();
470  }
471 #endif
472 
473  /**
474  * Initializes this object with the given identification ( which may be also "0"
475  * for no notification ), or if "" is given, tries to read it from the startup
476  * notification environment variable, and if it's not set, creates a new one.
477  * @param id the new identification, "0" for no notification or "" to read
478  * the environment variable
479  */
480  void initId(const QByteArray &id = "");
481  /**
482  * Returns the notification identifier as string.
483  * @return the identification string for the notification
484  */
485  const QByteArray &id() const;
486  /**
487  * Return the user timestamp for the startup notification, or 0 if no timestamp
488  * is set.
489  */
490  unsigned long timestamp() const;
491  /**
492  * Sets the startup notification environment variable to this identification.
493  * @return true if successful, false otherwise
494  */
495  bool setupStartupEnv() const;
496  /**
497  * Creates an empty identification
498  */
499  KStartupInfoId();
500  /**
501  * Copy constructor.
502  */
503  KStartupInfoId(const KStartupInfoId &data);
504  ~KStartupInfoId();
505  KStartupInfoId &operator=(const KStartupInfoId &data);
506  bool operator<(const KStartupInfoId &id) const;
507 
508 private:
509  explicit KStartupInfoId(const QString &txt);
510  friend class KStartupInfo;
511  friend class KStartupInfo::Private;
512  struct Private;
513  Private *const d;
514 };
515 
516 /**
517  * Class representing data about an application startup notification.
518  *
519  * Such data include the icon of the starting application, the desktop on which
520  * the application should start, the binary name of the application, etc.
521  *
522  * @see KStartupInfo
523  * @see KStartupInfoId
524  *
525  * @author Lubos Lunak <[email protected]>
526  */
527 class KWINDOWSYSTEM_EXPORT KStartupInfoData
528 {
529 public:
530  /**
531  * Sets the binary name of the application (e.g.\ 'kcontrol').
532  * @param bin the new binary name of the application
533  */
534  void setBin(const QString &bin);
535  /**
536  * Returns the binary name of the starting application
537  * @return the new binary name of the application
538  */
539  const QString &bin() const;
540  /**
541  * Sets the name for the notification (e.g.\ 'Control Center').
542  */
543  void setName(const QString &name);
544  /**
545  * Returns the name of the startup notification. If it's not available,
546  * it tries to use other information (binary name).
547  * @return the name of the startup notification
548  */
549  const QString &findName() const;
550  /**
551  * Returns the name of the startup notification, or empty if not available.
552  * @return the name of the startup notification, or an empty string
553  * if not set.
554  */
555  const QString &name() const;
556  /**
557  * Sets the description for the notification (e.g.\ 'Launching Control Center').
558  * I.e. name() describes what is being started, while description() is
559  * the actual action performed by the starting.
560  */
561  void setDescription(const QString &descr);
562  /**
563  * Returns the description of the startup notification. If it's not available,
564  * it returns name().
565  * @return the description of the startup notification
566  */
567  const QString &findDescription() const;
568  /**
569  * Returns the name of the startup notification, or empty if not available.
570  * @return the name of the startup notification, or an empty string
571  * if not set.
572  */
573  const QString &description() const;
574  /**
575  * Sets the icon for the startup notification (e.g.\ 'kcontrol').
576  * @param icon the name of the icon
577  */
578  void setIcon(const QString &icon);
579  /**
580  * Returns the icon of the startup notification, and if it's not available,
581  * tries to get it from the binary name.
582  * @return the name of the startup notification's icon, or the name of
583  * the binary if not set
584  */
585  const QString &findIcon() const;
586  /**
587  * Returns the icon of the startup notification, or empty if not available.
588  * @return the name of the icon, or an empty string if not set.
589  */
590  const QString &icon() const;
591  /**
592  * Sets the desktop for the startup notification (i.e.\ the desktop on which
593  * the starting application should appear ).
594  * @param desktop the desktop for the startup notification
595  */
596  void setDesktop(int desktop);
597  /**
598  * Returns the desktop for the startup notification.
599  * @return the desktop for the startup notification
600  */
601  int desktop() const;
602  /**
603  * Sets a WM_CLASS value for the startup notification, it may be used for increasing
604  * the chance that the windows created by the starting application will be
605  * detected correctly.
606  * @param wmclass the WM_CLASS value for the startup notification
607  */
608  void setWMClass(const QByteArray &wmclass);
609  /**
610  * Returns the WM_CLASS value for the startup notification, or binary name if not
611  * available.
612  * @return the WM_CLASS value for the startup notification, or the binary name
613  * if not set
614  */
615  const QByteArray findWMClass() const;
616  /**
617  * Returns the WM_CLASS value for the startup notification, or empty if not available.
618  * @return the WM_CLASS value for the startup notification, or empty
619  * if not set
620  */
621  QByteArray WMClass() const;
622  /**
623  * Adds a PID to the list of processes that belong to the startup notification. It
624  * may be used to increase the chance that the windows created by the starting
625  * application will be detected correctly, and also for detecting if the application
626  * has quit without creating any window.
627  * @param pid the PID to add
628  */
629  void addPid(pid_t pid);
630  /**
631  * Returns all PIDs for the startup notification.
632  * @return the list of all PIDs
633  */
634  QList<pid_t> pids() const;
635  /**
636  * Checks whether the given @p pid is in the list of PIDs for startup
637  * notification.
638  * @return true if the given @p pid is in the list of PIDs for the startup notification
639  */
640  bool is_pid(pid_t pid) const;
641  /**
642  * Sets the hostname on which the application is starting. It's necessary to set
643  * it if PIDs are set.
644  * @param hostname the application's hostname. If it's a null string, the current hostname is used
645  */
646  void setHostname(const QByteArray &hostname = QByteArray());
647  /**
648  * Returns the hostname for the startup notification.
649  * @return the hostname
650  */
651  QByteArray hostname() const;
652 
653  /**
654  *
655  */
656  enum TriState { Yes, No, Unknown };
657 
658  /**
659  * Sets whether the visual feedback for this startup notification
660  * should be silenced (temporarily suspended).
661  */
662  void setSilent(TriState state);
663 
664  /**
665  * Return the silence status for the startup notification.
666  * @return KStartupInfoData::Yes if visual feedback is silenced
667  */
668  TriState silent() const;
669 
670  /**
671  * The X11 screen on which the startup notification is happening, -1 if unknown.
672  */
673  int screen() const;
674 
675  /**
676  * Sets the X11 screen on which the startup notification should happen.
677  * This is usually not necessary to set, as it's set by default to QX11Info::screen().
678  */
679  void setScreen(int screen);
680 
681  /**
682  * The Xinerama screen for the startup notification, -1 if unknown.
683  */
684  int xinerama() const;
685 
686  /**
687  * Sets the Xinerama screen for the startup notification ( i.e. the screeen on which
688  * the starting application should appear ).
689  * @param xinerama the Xinerama screen for the startup notification
690  */
691  void setXinerama(int xinerama);
692 
693 #if KWINDOWSYSTEM_ENABLE_DEPRECATED_SINCE(5, 69)
694  /**
695  * The toplevel window of the application that caused this startup notification,
696  * 0 if unknown.
697  * @deprecated Since 5.69. No known users.
698  */
699  KWINDOWSYSTEM_DEPRECATED_VERSION(5, 69, "Deprecated because not used anywhere. Tell [email protected] if you disagree")
700  WId launchedBy() const;
701 #endif
702 
703 #if KWINDOWSYSTEM_ENABLE_DEPRECATED_SINCE(5, 69)
704  /**
705  * Sets the toplevel window of the application that caused this startup notification.
706  * @param window window ID of the toplevel window that is responsible for this startup
707  * @deprecated Since 5.69. No known users of launchedBy().
708  */
709  KWINDOWSYSTEM_DEPRECATED_VERSION(5, 69, "Deprecated because launchedBy() is not used anywhere. Tell [email protected] if you disagree")
710  void setLaunchedBy(WId window);
711 #endif
712 
713  /**
714  * The .desktop file used to initiate this startup notification, or empty. This information
715  * should be used only to identify the application, not to read any additional information.
716  * @since 4.5
717  **/
718  QString applicationId() const;
719 
720  /**
721  * Sets the .desktop file that was used to initiate the startup notification.
722  * @since 4.5
723  */
724  void setApplicationId(const QString &desktop);
725 
726  /**
727  * Updates the notification data from the given data. Some data, such as the desktop
728  * or the name, won't be rewritten if already set.
729  * @param data the data to update
730  */
731  void update(const KStartupInfoData &data);
732 
733  /**
734  * Constructor. Initializes all the data to their default empty values.
735  */
737 
738  /**
739  * Copy constructor.
740  */
741  KStartupInfoData(const KStartupInfoData &data);
742  ~KStartupInfoData();
743  KStartupInfoData &operator=(const KStartupInfoData &data);
744 
745 private:
746  explicit KStartupInfoData(const QString &txt);
747  friend class KStartupInfo;
748  friend class KStartupInfo::Data;
749  friend class KStartupInfo::Private;
750  struct Private;
751  Private *const d;
752 };
753 
754 #endif
Class for manipulating the application startup notification.
Definition: kstartupinfo.h:51
Class representing an identification of application startup notification.
Definition: kstartupinfo.h:447
Class representing data about an application startup notification.
Definition: kstartupinfo.h:527
virtual void customEvent(QEvent *event)
Q_DISABLE_COPY(Class)
This file is part of the KDE documentation.
Documentation copyright © 1996-2021 The KDE developers.
Generated on Thu Sep 23 2021 22:41:28 by doxygen 1.8.11 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.