~ubuntu-branches/ubuntu/gutsy/kde4libs/gutsy

« back to all changes in this revision

Viewing changes to kdecore/kstartupinfo.h

  • Committer: Bazaar Package Importer
  • Author(s): Jonathan Riddell
  • Date: 2007-02-21 11:00:12 UTC
  • mfrom: (1.1.1 upstream)
  • Revision ID: james.westby@ubuntu.com-20070221110012-6kw8khr9knv6lmg1
Tags: 3.80.3-0ubuntu1
New upstream unstable release

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
/****************************************************************************
2
 
 
3
 
 Copyright (C) 2001-2003 Lubos Lunak        <l.lunak@kde.org>
4
 
 
5
 
Permission is hereby granted, free of charge, to any person obtaining a
6
 
copy of this software and associated documentation files (the "Software"),
7
 
to deal in the Software without restriction, including without limitation
8
 
the rights to use, copy, modify, merge, publish, distribute, sublicense,
9
 
and/or sell copies of the Software, and to permit persons to whom the
10
 
Software is furnished to do so, subject to the following conditions:
11
 
 
12
 
The above copyright notice and this permission notice shall be included in
13
 
all copies or substantial portions of the Software.
14
 
 
15
 
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
 
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
 
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT SHALL
18
 
THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
 
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
20
 
FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
21
 
DEALINGS IN THE SOFTWARE.
22
 
 
23
 
****************************************************************************/
24
 
 
25
 
#ifndef KSTARTUPINFO_H
26
 
#define KSTARTUPINFO_H
27
 
 
28
 
#include <sys/types.h>
29
 
#include <qobject.h>
30
 
 
31
 
#include <qstring.h>
32
 
#include <qcoreevent.h>
33
 
#include <qwindowdefs.h>
34
 
#include <kdelibs_export.h>
35
 
 
36
 
#if !defined(Q_WS_X11)
37
 
typedef void Display;
38
 
#endif
39
 
 
40
 
class KStartupInfoId;
41
 
class KStartupInfoData;
42
 
 
43
 
/**
44
 
 * Class for manipulating the application startup notification.
45
 
 *
46
 
 * This class can be used to send information about started application,
47
 
 * change the information and receive this information. For detailed
48
 
 * description, see kdelibs/kdecore/README.kstartupinfo.
49
 
 *
50
 
 * You usually don't need to use this class for sending the notification
51
 
 * information, as KDE libraries should do this when an application is
52
 
 * started (e.g. KRun class).
53
 
 *
54
 
 * For receiving the startup notification info, create an instance and connect
55
 
 * to its slots. It will automatically detect started applications and when
56
 
 * they are ready.
57
 
 *
58
 
 * @see KStartupInfoId
59
 
 * @see KStartupInfoData
60
 
 *
61
 
 * @author Lubos Lunak <l.lunak@kde.org>
62
 
 */
63
 
class KDECORE_EXPORT KStartupInfo
64
 
    : public QObject
65
 
    {
66
 
    Q_OBJECT
67
 
    public:
68
 
        /**
69
 
         * By default, the startup notification is ended for the application
70
 
         * after it shows its first toplevel window. If you app e.g. has
71
 
         * several toplevel windows after its startup, you can disable
72
 
         * the automatic handling, and call appStarted() manually after
73
 
         * all toplevel windows have been shown.
74
 
         */
75
 
        static void disableAutoAppStartedSending( bool disable = true );
76
 
 
77
 
        /**
78
 
         * Manual notification that the application has started.
79
 
         * If you do not map a (toplevel) window, then startup
80
 
         * notification will not disappear for the application
81
 
         * until a timeout. You can use this as an alternative
82
 
         * method in this case.
83
 
         */
84
 
        static void appStarted();
85
 
 
86
 
        /**
87
 
         * Sends explicit notification that the startup notification
88
 
         * with id startup_id should end.
89
 
         */
90
 
        static void appStarted( const QByteArray& startup_id );
91
 
 
92
 
        /**
93
 
         * Use this function if the application got a request with startup
94
 
         * notification from outside (for example, when KUniqueApplication::newInstance()
95
 
         * is called, or e.g. when khelpcenter opens new URL in its window).
96
 
         * The window can be either an already existing and visible window,
97
 
         * or a new one, before being shown. Note that this function is usually
98
 
         * needed only when a window is reused.
99
 
         */
100
 
        static void setNewStartupId( QWidget* window, const QByteArray& startup_id );
101
 
 
102
 
        /**
103
 
         * If your application shows temporarily some window during its startup,
104
 
         * for example a dialog, and only after closing it shows the main window,
105
 
         * startup notification would normally be shown while the dialog is visible.
106
 
         * To temporarily suspend and resume the notification, use this function.
107
 
         * Note that this is cumulative, i.e. after suspending twice, you have to
108
 
         * resume twice.
109
 
         */
110
 
        static void silenceStartup( bool silence );
111
 
 
112
 
        /**
113
 
         * Creates and returns new startup id. The id includes properly setup
114
 
         * user timestamp.
115
 
         */
116
 
        static QByteArray createNewStartupId();
117
 
        /**
118
 
         *
119
 
         */
120
 
        enum {
121
 
            CleanOnCantDetect           = 1 << 0,
122
 
            DisableKWinModule           = 1 << 1,
123
 
            AnnounceSilenceChanges      = 1 << 2
124
 
            };
125
 
 
126
 
        /**
127
 
         * Creates an instance that will receive the startup notifications.
128
 
         * The various flags passed may be
129
 
         * @li CleanOnCantDetect - when a new unknown window appears, all startup
130
 
         *     notifications for applications that are not compliant with
131
 
         *     the startup protocol are removed
132
 
         * @li DisableKWinModule - KWinModule, which is normally used to detect
133
 
         *     new windows, is disabled. With this flag, checkStartup() must be
134
 
         *     called in order to check newly mapped windows.
135
 
         * @li AnnounceSilenceChanges - normally, startup notifications are
136
 
         *     "removed" when they're silenced, and "recreated" when they're resumed.
137
 
         *     With this flag, the change is normally announced with gotStartupChange().
138
 
         *
139
 
         * @param flags OR-ed combination of flags
140
 
         * @param parent the parent of this QObject (can be 0 for no parent)
141
 
         *
142
 
         */
143
 
        KStartupInfo( int flags, QObject* parent = NULL );
144
 
        /**
145
 
         * Creates an instance that will receive the startup notifications.
146
 
         *
147
 
         * @param clean_on_cantdetect if true, and a new unknown window appears,
148
 
         *  removes all notification for applications that are not compliant
149
 
         *  with the app startup protocol
150
 
         * @param parent the parent of this QObject (can be 0 for no parent)
151
 
         *
152
 
         * @obsolete
153
 
         */
154
 
        KStartupInfo( bool clean_on_cantdetect, QObject* parent = 0 );
155
 
        virtual ~KStartupInfo();
156
 
        /**
157
 
         * Sends given notification data about started application
158
 
         * with the given startup identification. If no notification for this identification
159
 
         * exists yet, it is created, otherwise it's updated. Note that the name field
160
 
         * in data is required.
161
 
         *
162
 
         * @param id the id of the application
163
 
         * @param data the application's data
164
 
         * @return true if successful, false otherwise
165
 
         * @see KStartupInfoId
166
 
         * @see KStartupInfoData
167
 
         */
168
 
        static bool sendStartup( const KStartupInfoId& id, const KStartupInfoData& data );
169
 
 
170
 
        /**
171
 
         * Like sendStartup , uses dpy instead of qt_x11display() for sending the info.
172
 
         * @param dpy the display of the application. Note that the name field
173
 
         * in data is required.
174
 
         * @param id the id of the application
175
 
         * @param data the application's data
176
 
         * @return true if successful, false otherwise
177
 
         */
178
 
        static bool sendStartupX( Display* dpy, const KStartupInfoId& id,
179
 
            const KStartupInfoData& data );
180
 
 
181
 
        /**
182
 
         * Sends given notification data about started application
183
 
         * with the given startup identification. This is used for updating the notification
184
 
         * info, if no notification for this identification exists, it's ignored.
185
 
         * @param id the id of the application
186
 
         * @param data the application's data
187
 
         * @return true if successful, false otherwise
188
 
         * @see KStartupInfoId
189
 
         * @see KStartupInfoData
190
 
         */
191
 
        static bool sendChange( const KStartupInfoId& id, const KStartupInfoData& data );
192
 
 
193
 
        /**
194
 
         * Like sendChange , uses dpy instead of qt_x11display() for sending the info.
195
 
         * @param dpy the display of the application.
196
 
         * @param id the id of the application
197
 
         * @param data the application's data
198
 
         * @return true if successful, false otherwise
199
 
         */
200
 
        static bool sendChangeX( Display* dpy, const KStartupInfoId& id,
201
 
            const KStartupInfoData& data );
202
 
 
203
 
        /**
204
 
         * Ends startup notification with the given identification.
205
 
         * @param id the id of the application
206
 
         * @return true if successful, false otherwise
207
 
         */
208
 
        static bool sendFinish( const KStartupInfoId& id );
209
 
 
210
 
        /**
211
 
         * Like sendFinish , uses dpy instead of qt_x11display() for sending the info.
212
 
         * @param dpy the display of the application.
213
 
         * @param id the id of the application
214
 
         * @return true if successful, false otherwise
215
 
         */
216
 
        static bool sendFinishX( Display* dpy, const KStartupInfoId& id );
217
 
 
218
 
        /**
219
 
         * Ends startup notification with the given identification and the given data ( e.g.
220
 
         * PIDs of processes for this startup notification that exited ).
221
 
         * @param id the id of the application
222
 
         * @param data the application's data
223
 
         * @return true if successful, false otherwise
224
 
         */
225
 
        static bool sendFinish( const KStartupInfoId& id, const KStartupInfoData& data );
226
 
 
227
 
        /**
228
 
         * Like sendFinish , uses dpy instead of qt_x11display() for sending the info.
229
 
         * @param dpy the display of the application.
230
 
         * @param id the id of the application
231
 
         * @param data the application's data
232
 
         * @return true if successful, false otherwise
233
 
         */
234
 
        static bool sendFinishX( Display* dpy, const KStartupInfoId& id,
235
 
            const KStartupInfoData& data );
236
 
 
237
 
        /**
238
 
         * Returns the current startup notification identification for the current
239
 
         * startup notification environment variable. Note that KApplication constructor
240
 
         * unsets the variable and you have to use KApplication::startupId .
241
 
         * @return the current startup notification identification
242
 
         */
243
 
        static KStartupInfoId currentStartupIdEnv();
244
 
        /**
245
 
         * Unsets the startup notification environment variable.
246
 
         */
247
 
        static void resetStartupEnv();
248
 
        /**
249
 
         * @li NoMatch    - the window doesn't match any existing startup notification
250
 
         * @li Match      - the window matches an existing startup notification
251
 
         * @li CantDetect - unable to detect if the window matches any existing
252
 
         *                      startup notification
253
 
         */
254
 
        enum startup_t { NoMatch, Match, CantDetect };
255
 
        /**
256
 
         * Checks if the given windows matches any existing startup notification.
257
 
         * @param w the window id to check
258
 
         * @return the result of the operation
259
 
         */
260
 
        startup_t checkStartup( WId w );
261
 
        /**
262
 
         * Checks if the given windows matches any existing startup notification, and
263
 
         * if yes, returns the identification in id.
264
 
         * @param w the window id to check
265
 
         * @param id if found, the id of the startup notification will be written here
266
 
         * @return the result of the operation
267
 
         */
268
 
        startup_t checkStartup( WId w, KStartupInfoId& id );
269
 
        /**
270
 
         * Checks if the given windows matches any existing startup notification, and
271
 
         * if yes, returns the notification data in data.
272
 
         * @param w the window id to check
273
 
         * @param data if found, the data of the startup notification will be written here
274
 
         * @return the result of the operation
275
 
         */
276
 
        startup_t checkStartup( WId w, KStartupInfoData& data );
277
 
        /**
278
 
         * Checks if the given windows matches any existing startup notification, and
279
 
         * if yes, returns the identification in id and notification data in data.
280
 
         * @param w the window id to check
281
 
         * @param id if found, the id of the startup notification will be written here
282
 
         * @param data if found, the data of the startup notification will be written here
283
 
         * @return the result of the operation
284
 
         */
285
 
        startup_t checkStartup( WId w, KStartupInfoId& id, KStartupInfoData& data );
286
 
        /**
287
 
         * Sets the timeout for notifications, after this timeout a notification is removed.
288
 
         * @param secs the new timeout in seconds
289
 
         */
290
 
        void setTimeout( unsigned int secs );
291
 
        /**
292
 
         * Sets the startup notification window property on the given window.
293
 
         * @param window the id of the window
294
 
         * @param id the startup notification id
295
 
         */
296
 
        static void setWindowStartupId( WId window, const QByteArray& id );
297
 
        /**
298
 
         * Returns startup notification identification of the given window.
299
 
         * @param w the id of the window
300
 
         * @return the startup notification id. Can be null if not found.
301
 
         */
302
 
        static QByteArray windowStartupId( WId w );
303
 
        /**
304
 
         * @internal
305
 
         */
306
 
        static void handleAutoAppStartedSending();
307
 
        /**
308
 
         * @internal
309
 
         */
310
 
        class Data;
311
 
    Q_SIGNALS:
312
 
        /**
313
 
         * Emitted when a new startup notification is created (i.e. a new application is
314
 
         * being started).
315
 
         * @param id the notification identification
316
 
         * @param data the notification data
317
 
         */
318
 
        void gotNewStartup( const KStartupInfoId& id, const KStartupInfoData& data );
319
 
        /**
320
 
         * Emitted when a startup notification changes.
321
 
         * @param id the notification identification
322
 
         * @param data the notification data
323
 
         */
324
 
        void gotStartupChange( const KStartupInfoId& id, const KStartupInfoData& data );
325
 
        /**
326
 
         * Emitted when a startup notification is removed (either because it was detected
327
 
         * that the application is ready or because of a timeout).
328
 
         * @param id the notification identification
329
 
         * @param data the notification data
330
 
         */
331
 
        void gotRemoveStartup( const KStartupInfoId& id, const KStartupInfoData& data );
332
 
    protected:
333
 
        /**
334
 
         *
335
 
         */
336
 
        virtual void customEvent( QEvent* e_P );
337
 
    private Q_SLOTS:
338
 
        void startups_cleanup();
339
 
        void startups_cleanup_no_age();
340
 
        void got_message( const QString& msg );
341
 
        void window_added( WId w );
342
 
        void slot_window_added( WId w );
343
 
    private:
344
 
        void init( int flags );
345
 
        friend class KStartupInfoPrivate;
346
 
        void got_startup_info( const QString& msg_P, bool update_only_P );
347
 
        void got_remove_startup_info( const QString& msg_P );
348
 
        void new_startup_info_internal( const KStartupInfoId& id_P,
349
 
            Data& data_P, bool update_only_P );
350
 
        void remove_startup_info_internal( const KStartupInfoId& id_P );
351
 
        void remove_startup_pids( const KStartupInfoId& id, const KStartupInfoData& data );
352
 
        void remove_startup_pids( const KStartupInfoData& data );
353
 
        startup_t check_startup_internal( WId w, KStartupInfoId* id, KStartupInfoData* data );
354
 
        bool find_id( const QByteArray& id_P, KStartupInfoId* id_O,
355
 
            KStartupInfoData* data_O );
356
 
        bool find_pid( pid_t pid_P, const QByteArray& hostname, KStartupInfoId* id_O,
357
 
            KStartupInfoData* data_O );
358
 
        bool find_wclass( QByteArray res_name_P, QByteArray res_class_P,
359
 
            KStartupInfoId* id_O, KStartupInfoData* data_O );
360
 
        static QByteArray get_window_hostname( WId w_P );
361
 
        void startups_cleanup_internal( bool age_P );
362
 
        void clean_all_noncompliant();
363
 
        static QString check_required_startup_fields( const QString& msg,
364
 
            const KStartupInfoData& data, int screen );
365
 
        unsigned int timeout;
366
 
        class Private;
367
 
        Private* d;
368
 
    };
369
 
 
370
 
/**
371
 
 * Class representing an identification of application startup notification.
372
 
 *
373
 
 * Every existing notification about a starting application has its own unique
374
 
 * identification, that's used to identify and manipulate the notification.
375
 
 *
376
 
 * @see KStartupInfo
377
 
 * @see KStartupInfoData
378
 
 *
379
 
 * @author Lubos Lunak <l.lunak@kde.org>
380
 
 */
381
 
class KDECORE_EXPORT KStartupInfoId
382
 
    {
383
 
    public:
384
 
        /**
385
 
         * Overloaded operator.
386
 
         * @return true if the notification identifications are the same
387
 
         */
388
 
        bool operator==( const KStartupInfoId& id ) const;
389
 
        /**
390
 
         * Overloaded operator.
391
 
         * @return true if the notification identifications are different
392
 
         */
393
 
        bool operator!=( const KStartupInfoId& id ) const;
394
 
        /**
395
 
         * Checks whether the identifier is valid.
396
 
         * @return true if this object doesn't represent a valid notification identification
397
 
         */
398
 
        bool none() const;
399
 
        /**
400
 
         * Initializes this object with the given identification ( which may be also "0"
401
 
         * for no notification ), or if "" is given, tries to read it from the startup
402
 
         * notification environment variable, and if it's not set, creates a new one.
403
 
         * @param id the new identification, "0" for no notification or "" to read
404
 
         *           the environment variable
405
 
         */
406
 
        void initId( const QByteArray& id = "" );
407
 
        /**
408
 
         * Returns the notification identifier as string.
409
 
         * @return the identification string for the notification
410
 
         */
411
 
        const QByteArray& id() const;
412
 
        /**
413
 
         * Return the user timestamp for the startup notification, or 0 if no timestamp
414
 
         * is set.
415
 
         */
416
 
        unsigned long timestamp() const;
417
 
        /**
418
 
         * Sets the startup notification environment variable to this identification.
419
 
         * @return true if successful, false otherwise
420
 
         */
421
 
        bool setupStartupEnv() const;
422
 
        /**
423
 
         * Creates an empty identification
424
 
         */
425
 
        KStartupInfoId();
426
 
        /**
427
 
         * Copy constructor.
428
 
         */
429
 
        KStartupInfoId( const KStartupInfoId& data );
430
 
        ~KStartupInfoId();
431
 
        KStartupInfoId& operator=( const KStartupInfoId& data );
432
 
        bool operator<( const KStartupInfoId& id ) const;
433
 
    private:
434
 
        KStartupInfoId( const QString& txt );
435
 
        QString to_text() const;
436
 
        friend class KStartupInfo;
437
 
        class Private;
438
 
        Private *const d;
439
 
    };
440
 
 
441
 
/**
442
 
 * Class representing data about an application startup notification.
443
 
 *
444
 
 * Such data include the icon of the starting application, the desktop on which
445
 
 * the application should start, the binary name of the application, etc.
446
 
 *
447
 
 * @see KStartupInfo
448
 
 * @see KStartupInfoId
449
 
 *
450
 
 * @author Lubos Lunak <l.lunak@kde.org>
451
 
 */
452
 
class KDECORE_EXPORT KStartupInfoData
453
 
    {
454
 
    public:
455
 
        /**
456
 
         * Sets the binary name of the application ( e.g. 'kcontrol' ).
457
 
         * @param bin the new binary name of the application
458
 
         */
459
 
        void setBin( const QString& bin );
460
 
        /**
461
 
         * Returns the binary name of the starting application
462
 
         * @return the new binary name of the application
463
 
         */
464
 
        const QString& bin() const;
465
 
        /**
466
 
         * Sets the name for the notification (e.g. 'Control Center')
467
 
         */
468
 
        void setName( const QString& name );
469
 
        /**
470
 
         * Returns the name of the startup notification. If it's not available,
471
 
         * it tries to use other information (binary name).
472
 
         * @return the name of the startup notification
473
 
         */
474
 
        const QString& findName() const;
475
 
        /**
476
 
         * Returns the name of the startup notification, or empty if not available.
477
 
         * @return the name of the startup notification, or an empty string
478
 
         *         if not set.
479
 
         */
480
 
        const QString& name() const;
481
 
        /**
482
 
         * Sets the description for the notification (e.g. 'Launching Control Center').
483
 
         * I.e. name() describes what is being started, while description() is
484
 
         * the actual action performed by the starting.
485
 
         */
486
 
        void setDescription( const QString& descr );
487
 
        /**
488
 
         * Returns the description of the startup notification. If it's not available,
489
 
         * it returns name().
490
 
         * @return the description of the startup notification
491
 
         */
492
 
        const QString& findDescription() const;
493
 
        /**
494
 
         * Returns the name of the startup notification, or empty if not available.
495
 
         * @return the name of the startup notificaiton, or an empty string
496
 
         *         if not set.
497
 
         */
498
 
        const QString& description() const;
499
 
        /**
500
 
         * Sets the icon for the startup notification ( e.g. 'kcontrol' )
501
 
         * @param icon the name of the icon
502
 
         */
503
 
        void setIcon( const QString& icon );
504
 
        /**
505
 
         * Returns the icon of the startup notification, and if it's not available,
506
 
         * tries to get it from the binary name.
507
 
         * @return the name of the startup notification's icon, or the name of
508
 
         *         the binary if not set
509
 
         */
510
 
        const QString& findIcon() const;
511
 
        /**
512
 
         * Returns the icon of the startup notification, or empty if not available.
513
 
         * @return the name of the icon, or an empty string if not set.
514
 
         */
515
 
        const QString& icon() const;
516
 
        /**
517
 
         * Sets the desktop for the startup notification ( i.e. the desktop on which
518
 
         * the starting application should appear ).
519
 
         * @param desktop the desktop for the startup notification
520
 
         */
521
 
        void setDesktop( int desktop );
522
 
        /**
523
 
         * Returns the desktop for the startup notification.
524
 
         * @return the desktop for the startup notification
525
 
         */
526
 
        int desktop() const;
527
 
        /**
528
 
         * Sets a WM_CLASS value for the startup notification, it may be used for increasing
529
 
         * the chance that the windows created by the starting application will be
530
 
         * detected correctly.
531
 
         * @param wmclass the WM_CLASS value for the startup notification
532
 
         */
533
 
        void setWMClass( const QByteArray& wmclass );
534
 
        /**
535
 
         * Returns the WM_CLASS value for the startup notification, or binary name if not
536
 
         * available.
537
 
         * @return the WM_CLASS value for the startup notification, or the binary name
538
 
         *         if not set
539
 
         */
540
 
        const QByteArray findWMClass() const;
541
 
        /**
542
 
         * Returns the WM_CLASS value for the startup notification, or empty if not available.
543
 
         * @return the WM_CLASS value for the startup notification, or empty
544
 
         *         if not set
545
 
         */
546
 
        const QByteArray& WMClass() const;
547
 
        /**
548
 
         * Adds a PID to the list of processes that belong to the startup notification. It
549
 
         * may be used to increase the chance that the windows created by the starting
550
 
         * application will be detected correctly, and also for detecting if the application
551
 
         * has quit without creating any window.
552
 
         * @param pid the PID to add
553
 
         */
554
 
        void addPid( pid_t pid );
555
 
        /**
556
 
         * Returns all PIDs for the startup notification.
557
 
         * @return the list of all PIDs
558
 
         */
559
 
        const QList< pid_t >& pids() const;
560
 
        /**
561
 
         * Checks whether the given @p pid is in the list of PIDs for starup
562
 
         * notification.
563
 
         * @return true if the given @p pid is in the list of PIDs for the startup notification
564
 
         */
565
 
        bool is_pid( pid_t pid ) const;
566
 
        /**
567
 
         * Sets the hostname on which the application is starting. It's necessary to set
568
 
         * it if PIDs are set.
569
 
         * @param hostname the application's hostname. If it's a null string, the current hostname is used
570
 
         */
571
 
        void setHostname( const QByteArray& hostname = QByteArray());
572
 
        /**
573
 
         * Returns the hostname for the startup notification.
574
 
         * @return the hostname
575
 
         */
576
 
        const QByteArray& hostname() const;
577
 
 
578
 
        /**
579
 
         *
580
 
         */
581
 
        enum TriState { Yes, No, Unknown };
582
 
 
583
 
        /**
584
 
         * Sets whether the visual feedback for this startup notification
585
 
         * should be silenced (temporarily suspended).
586
 
         */
587
 
        void setSilent( TriState state );
588
 
 
589
 
        /**
590
 
         * Return the silence status for the startup notification.
591
 
         * @return KStartupInfoData::Yes if visual feedback is silenced
592
 
         */
593
 
        TriState silent() const;
594
 
 
595
 
        /**
596
 
         * @obsolete Timestamp is already assigned in KStartupInfoId::initId().
597
 
         * Sets timestamp for the startup notification. The timestamp is expressed
598
 
         * as XServer time, and is used to prevent activation of the matching
599
 
         * window if user interaction took place after this timestamp.
600
 
         * Value -1 means no timestamp set, value 0 means that the window should
601
 
         * not be activated.
602
 
         */
603
 
        void setTimestamp( unsigned long time );
604
 
 
605
 
        /**
606
 
         * @obsolete Use KStartupInfoId::timestamp().
607
 
         * Return the timestamp for the startup notification, or -1 if no timestamp
608
 
         * is set.
609
 
         */
610
 
        unsigned long timestamp() const;
611
 
 
612
 
        /**
613
 
         * The X11 screen on which the startup notification is happening, -1 if unknown.
614
 
         */
615
 
        int screen() const;
616
 
 
617
 
        /**
618
 
         * Sets the X11 screen on which the startup notification should happen.
619
 
         * This is usually not necessary to set, as it's set by default to QX11Info::screen().
620
 
         */
621
 
        void setScreen( int screen );
622
 
 
623
 
        /**
624
 
         * Updates the notification data from the given data. Some data, such as the desktop
625
 
         * or the name, won't be rewritten if already set.
626
 
         * @param data the data to update
627
 
         */
628
 
        void update( const KStartupInfoData& data );
629
 
 
630
 
        /**
631
 
         * Constructor. Initializes all the data to their default empty values.
632
 
         */
633
 
        KStartupInfoData();
634
 
 
635
 
        /**
636
 
         * Copy constructor.
637
 
         */
638
 
        KStartupInfoData( const KStartupInfoData& data );
639
 
        ~KStartupInfoData();
640
 
        KStartupInfoData& operator=( const KStartupInfoData& data );
641
 
    private:
642
 
        KStartupInfoData( const QString& txt );
643
 
        QString to_text() const;
644
 
        void remove_pid( pid_t pid );
645
 
        friend class KStartupInfo;
646
 
        friend class KStartupInfo::Data;
647
 
        class Private;
648
 
        Private *const d;
649
 
    };
650
 
 
651
 
#endif
652