# class KApplication

###

Module | kdeui
Namespace |
Class | KApplication
Inherits | QApplication

Controls and provides information to all KDE applications.

Only one object of this class can be instantiated in a single app. This instance is always accessible via the 'KApplication.kApplication()' global variable.

This class provides the following services to all KDE applications.

- It controls the event queue (see QApplication ).
- It provides the application with KDE resources such as
accelerators, common menu entries, a KConfig object. session management events, help invocation etc.
- Installs an empty signal handler for the SIGPIPE signal.
If you want to catch this signal yourself, you have set a new signal handler after KApplication's constructor has run.
- It can start new services

Controls and provides information to all KDE applications. Author Matthias Kalle Dalheimer <kalle@kde.org>

### methods

- KApplication (GUIenabled)

  returns ctor
  KDE 4.1.0 and later only

  Argument | Type | Default
  --- | --- | ---
  GUIenabled | bool | 1

  This constructor is the one you should use. It takes aboutData and command line arguments from KCmdLineArgs.

  GUIenabled - Set to false to disable all GUI stuff.

- KApplication (display, visual, colormap)

  returns ctor
  KDE 4.1.0 and later only

  Argument | Type | Default
  --- | --- | ---
  display | Display |
  visual | Qt.HANDLE | 0
  colormap | Qt.HANDLE | 0

  Constructor. Parses command-line arguments. Use this constructor when you you need to use a non-default visual or colormap.

  display - Will be passed to Qt as the X display. The display must be valid and already opened.

  visual - A pointer to the X11 visual that should be used by the application. Note that only TrueColor visuals are supported on depths greater than 8 bpp. If this parameter is NULL, the default visual will be used instead.

  colormap - The colormap that should be used by the application. If this parameter is 0, the default colormap will be used instead.

- KApplication (a0, a1, a2, a3)

  returns ctor

  Argument | Type | Default
  --- | --- | ---
  a0 | Display |
  a1 | SIP_PYLIST |
  a2 | QByteArray |
  a3 | bool | 1

  Constructor. Parses command-line arguments. Use this constructor to use KApplication in a Motif or Xt program.

  display - Will be passed to Qt as the X display. The display must be valid and already opened.

  argc - command line argument count

  argv - command line argument value(s)

  rAppName - application name. Will be used for finding the associated message files and icon files, and as the default registration name for DCOP. This is a mandatory parameter.

  GUIenabled - Set to false to disable all GUI stuff.

- KApplication (GUIenabled, cData)

  returns ctor

  Argument | Type | Default
  --- | --- | ---
  GUIenabled | bool |
  cData | KComponentData |

  Internal Used by KUniqueApplication

- KApplication (display, visual, colormap, cData)

  returns ctor

  Argument | Type | Default
  --- | --- | ---
  display | Display |
  visual | Qt.HANDLE |
  colormap | Qt.HANDLE |
  cData | KComponentData |

  Internal Used by KUniqueApplication

- KApplication (a0)

  returns ctor
  Not implemented

  Argument | Type | Default
  --- | --- | ---
  a0 | KApplication |

- KApplication (a0, a1)

  returns ctor
  Not implemented

  Argument | Type | Default
  --- | --- | ---
  a0 | bool |
  a1 | bool |

- KApplication (a0)

  returns ctor
  before KDE 4.1.0 only

  Argument | Type | Default
  --- | --- | ---
  a0 | bool | 1

- KApplication (a0, a1, a2)

  returns ctor
  before KDE 4.1.0 only

  Argument | Type | Default
  --- | --- | ---
  a0 | Display |
  a1 | Qt.HANDLE | 0
  a2 | Qt.HANDLE | 0

- checkRecoverFile (pFilename)

  returns QString, bool (bRecover)
  static

  Argument | Type | Default
  --- | --- | ---
  pFilename | QString |

  Check whether an auto-save file exists for the document you want to open.

  pFilename - The full path to the document you want to open.

  bRecover - This gets set to true if there was a recover file. Returns The full path of the file to open.

- clearStartupId ( )

  returns Nothing

  Internal Used only by KStartupId.

- commitData (sm)

  returns Nothing

  Argument | Type | Default
  --- | --- | ---
  sm | QSessionManager |

  Reimplemented for internal purposes, mainly the highlevel handling of session management with KSessionManager. Internal

- disableSessionManagement ( )

  returns Nothing

  Disables session management for this application.

  Useful in case your application is started by the initial "startkde" script.

- enableSessionManagement ( )

  returns Nothing

  Enables session management for this application, formerly disabled by calling disableSessionManagement(). You usually shouldn't call this function, as session management is enabled by default.

- getDisplay ( )

  returns Display
  Not implemented

  Get the X11 display Returns the X11 Display Deprecated use QX11Info.display()

- iceIOErrorHandler (conn)

  returns Nothing
  Not implemented

  Argument | Type | Default
  --- | --- | ---
  conn | _IceConn |

  Internal

- installX11EventFilter (filter)

  returns Nothing

  Argument | Type | Default
  --- | --- | ---
  filter | QWidget |

  Installs widget filter as global X11 event filter.

  The widget filter receives XEvents in its standard QWidget.x11Event() function.

  Warning: Only do this when absolutely necessary. An installed X11 filter can slow things down.

- kApplication ( )

  returns KApplication
  static

  Returns the current application object.

  This is similar to the global QApplication pointer qApp. It allows access to the single global KApplication object, since more than one cannot be created in the same application. It saves you the trouble of having to pass the pointer explicitly to every function that may require it. Returns the current application object

- notify (receiver, event)

  returns bool

  Argument | Type | Default
  --- | --- | ---
  receiver | QObject |
  event | QEvent |

  Internal

- quit ( )

  returns Nothing

- removeX11EventFilter (filter)

  returns Nothing

  Argument | Type | Default
  --- | --- | ---
  filter | QWidget |

  Removes global X11 event filter previously installed by installX11EventFilter().

- reparseConfiguration ( )

  returns Nothing

- saveState (sm)

  returns Nothing

  Argument | Type | Default
  --- | --- | ---
  sm | QSessionManager |

  Reimplemented for internal purposes, mainly the highlevel handling of session management with KSessionManager. Internal

- saveYourself ( )

  returns Nothing
  SIGNAL ("saveYourself ()")

  Session management asks you to save the state of your application.

  This signal is provided for compatibility only. For new applications, simply use KMainWindow. By reimplementing KMainWindow.queryClose(), KMainWindow.saveProperties() and KMainWindow.readProperties() you can simply handle session management for applications with multiple toplevel windows.

  For purposes without KMainWindow, create an instance of KSessionManager and reimplement the functions KSessionManager.commitData() and/or KSessionManager.saveState()

  If you still want to use this signal, here is what you should do:

  Connect to this signal in order to save your data. Do NOT manipulate the UI in that slot, it is blocked by the session manager.

  Use the sessionConfig() KConfig object to store all your instance specific data.

  Do not do any closing at this point! The user may still select Cancel wanting to continue working with your application. Cleanups could be done after aboutToQuit().

- sessionConfig ( )

  returns KConfig

  Returns the application session config object.

  Returns A pointer to the application's instance specific KConfig object.

  See also KConfig

- sessionSaving ( )

  returns bool

  Returns true if the application is currently saving its session data (most probably before KDE logout). This is intended for use mainly in KMainWindow.queryClose() and KMainWindow.queryExit().

  See also KMainWindow.queryClose

  See also KMainWindow.queryExit

- setStartupId (startup_id)

  returns Nothing

  Argument | Type | Default
  --- | --- | ---
  startup_id | QByteArray |

  Internal Sets a new value for the application startup notification window property for newly created toplevel windows.

  startup_id - the startup notification identifier

  See also KStartupInfo.setNewStartupId

- setSynchronizeClipboard (synchronize)

  returns Nothing

  Argument | Type | Default
  --- | --- | ---
  synchronize | bool |

  Sets how the primary and clipboard selections are synchronized in an X11 environment

- setTopWidget (topWidget)

  returns Nothing

  Argument | Type | Default
  --- | --- | ---
  topWidget | QWidget |

  Sets the top widget of the application. This means basically applying the right window caption. An application may have several top widgets. You don't need to call this function manually when using KMainWindow.

  topWidget - A top widget of the application.

  See also icon(), caption()

- startupId ( )

  returns QByteArray

  Returns the app startup notification identifier for this running application. Returns the startup notification identifier

- tempSaveName (pFilename)

  returns QString
  static

  Argument | Type | Default
  --- | --- | ---
  pFilename | QString |

  Get a file name in order to make a temporary copy of your document.

  pFilename - The full path to the current file of your document. Returns A new filename for auto-saving. Deprecated use KTemporaryFile, KSaveFile or KAutoSaveFile instead

- updateRemoteUserTimestamp (service, time)

  returns Nothing

  Argument | Type | Default
  --- | --- | ---
  service | QString |
  time | int | 0

  Updates the last user action timestamp in the application registered to DBUS with id service to the given time, or to this application's user time, if 0 is given. Use before causing user interaction in the remote application, e.g. invoking a dialog in the application using a DCOP call. Consult focus stealing prevention section in kdebase/kwin/README.

- updateUserTimestamp (time)

  returns Nothing

  Argument | Type | Default
  --- | --- | ---
  time | int | 0

  Updates the last user action timestamp to the given time, or to the current time, if 0 is given. Do not use unless you're really sure what you're doing. Consult focus stealing prevention section in kdebase/kwin/README.

- userTimestamp ( )

  returns unsigned long

  Returns the last user action timestamp or 0 if no user activity has taken place yet.

  See also updateuserTimestamp

- x11EventFilter (a0)

  returns bool
  Not implemented

  Argument | Type | Default
  --- | --- | ---
  a0 | XEvent |

  Used to catch X11 events

- xErrhandler (a0, a1)

  returns int
  Not implemented

  Argument | Type | Default
  --- | --- | ---
  a0 | Display |
  a1 | void |

  Internal

- xioErrhandler (a0)

  returns int

  Argument | Type | Default
  --- | --- | ---
  a0 | Display |

  Internal

### variables

bool loadedByKdeinit | Internal
bool loadedByKdeinit |