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