class KApplication

A base class for all KDE applications. More...

Definition#include <kapp.h>
InheritsQApplication (qt)
List of all Methods
Annotated List
Files
Globals
Hierarchy
Index

Public Types

Public Methods

Signals

Public Static Methods

Public Members

Protected Methods

Protected Static Methods

Protected Members


Detailed Description

A base class for all KDE applications.

KApplication provides the application with KDE defaults such as accelerators, common menu entries, a KConfig object etc. KApplication installs a signal handler for the SIGCHLD signal in order to avoid zombie children. If you want to catch this signal yourself or don't want it to be caught at all, you have set a new signal handler (or SIG_IGN) after KApplication's constructor has run.

 KApplication ( int& argc, char** argv )

Constructor. Pass command-line arguments.

A KConfig object is created that contains an application-specific config file whose name is "~/." + argv[0] + "rc". This constructor should be considered obsolete. The state of the application-specific config file may be queried afterwards with getConfigState().

 KApplication ( int& argc, char** argv, const QString& rAppName )

Constructor. Pass command-line arguments.

A KConfig object is created that contains an application-specific config file whose name is "~/." + rAppName + "rc". The state of the application-specific config file may be queried afterwards with getConfigState().

KApplication ()

[virtual]

Destructor

bool  eventFilter ( QObject*, QEvent* )

[virtual]

A global event filter for KApplication. Filters out Ctrl-Alt-F12 for KDebug.

Reimplemented from QObject

KApplication*  getKApplication ()

[static]

Return 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 the trouble of having to pass the pointer to it explicitly to every function that may require it.

const QString&  appName ()

[const]

Return the logical application name as set in the constructor.

KConfig*  getConfig ()

[const]

Retrieve the application config object.

Returns: a pointer to the application's global KConfig object.

KConfig*  getSessionConfig ()

Retrieve the application session config object.

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

bool  isRestored ()

[const]

Is the application restored from the session manager?

Returns: If true, this application was restored by the session manager. Note that this may mean the config object returned by getSessionConfig() contains data saved by a session closedown.

void  enableSessionManagement (bool userdefined = FALSE)

Enable session management

If userdefined = True then the WmCommand can be defined with setWmCommand. Note that you do not get an instance specific config object with getSessionConfig in this case!

Session management will apply to the top widget.

void  setWmCommand (const char*)

Set the WmCommand for the session manager.

This has an effect if either session management is disabled (then it is used for pseudo session management) or if session management is enabled with userdefined=True.

QPopupMenu*  getHelpMenu ( bool bAboutQtMenu, const char* appAboutText )

Return a standard help menu

Parameters:
bAboutQtMenunot used anymore
appAboutTexta little text about the application

Returns: a standard help menu

KIconLoader*  getIconLoader ()

Get an iconloader for the application. If it does not yet exist, create one.

Returns: a pointer to the Iconloader of the application

KLocale*  getLocale ()

Get a KLocale object for the application. If it does not yet exist, create one.

Returns: a pointer to the KLocale object of the application

KCharsets*  getCharsets ()

[const]

Get a KCharsets object for the application.

Returns: a pointer to the KCharsets object of the application

QPixmap  getIcon ()

[const]

Get the icon for the application.

Returns: a QPixmap with the icon.

QPixmap  getMiniIcon ()

[const]

Get the mini-icon for the application.

Returns: a QPixmap with the icon.

void  setTopWidget ( QWidget *topWidget )

Sets the top widget of the application . This widget will be used for communication with the session manager. You must not call this function manually if you are using the KTopLevelWidget.

enum ConfigState {APPCONFIG_NONE, APPCONFIG_READONLY, APPCONFIG_READWRITE }

Possible return values for getConfigState().

ConfigState  getConfigState ()

[const]

Retrieve the state of the app-config object.

Possible return values are APPCONFIG_NONE (the application-specific config file could not be opened neither read-write nor read-only), APPCONFIG_READONLY (the application-specific config file is opened read-only, but not read-write) and APPCONFIG_READWRITE (the application-specific config file is opened read-write).

void  invokeHTMLHelp ( QString aFilename, QString aTopic )

[const]

Invoke the kdehelp HTML help viewer.

Parameters:
aFilenameThe filename that is to be loaded. Its location is computed automatically according to the KFSSTND. If aFilename is empty, the logical appname with .html appended to it is used.
aTopicThis allows context-sensitive help. Its value will be appended to the filename, prefixed with a "#" (hash) character.

const QString&  kde_htmldir ()

[static]

Returns the directory where KDE stores its HTML documentation

The default for this directory is $KDEDIR/share/doc/HTML

Returns: the name of the directory

const QString&  kde_appsdir ()

[static]

Returns the directory where KDE applications store their .kdelnk file

The default for this directory is $KDEDIR/share/applnk

Returns: the name of the directory

const QString&  kde_icondir ()

[static]

Returns the directory where KDE icons are stored

The default for this directory is $KDEDIR/share/icons

Returns: the name of the directory

const QString&  kde_datadir ()

[static]

Returns the directory where KDE applications store their specific data

The default for this directory is $KDEDIR/share/apps

Returns: the name of the directory

const QString&  kde_localedir ()

[static]

Returns the directory where locale-specific information (like translated on-screen messages are stored

The default for this directory is $KDEDIR/share/locale

Returns: the name of the directory

const QString&  kde_cgidir ()

[static]

Returns the directory where cgi scripts are stored

The default for this directory is $KDEDIR/cgi-bin

Returns: the name of the directory

const QString&  kde_sounddir ()

[static]

Returns the directory where sound data are stored. This directory is for KDE specific sounds. Sound data of Applications should go into kde_datadir()

The default for this directory is $KDEDIR/share/sounds

Returns: the name of the directory

const QString&  kde_toolbardir ()

[static]

Returns the directory where toolbar icons are stored

The default for this directory is $KDEDIR/share/toolbar

Returns: the name of the directory

const QString&  kde_wallpaperdir ()

[static]

Returns the directory where wallpapers are stored

The default for this directory is $KDEDIR/share/wallpapers

Returns: the name of the directory

const QString&  kde_bindir ()

[static]

Returns the directory where executable programs are stored

The default for this directory is $KDEDIR/bin

Returns: the name of the directory

const QString&  kde_partsdir ()

[static]

Returns the directory where KParts are stored

The default for this directory is $KDEDIR/parts

Returns: the name of the directory

const QString&  kde_configdir ()

[static]

Returns the directory where config files are stored

The default for this directory is $KDEDIR/share/config

Returns: the name of the directory

const QString&  kde_mimedir ()

[static]

Returns the directory where mimetypes are stored

The default for this directory is $KDEDIR/share/mimelnk

Returns: the name of the directory

QString  localkdedir ()

[static]

Get the local KDE base dir

This is usually $HOME/.kde

Returns: the name of the directory

QString  localconfigdir ()

[static]

Get the local KDE config dir

This is usually $HOME/.kde/share/config

QString  findFile ( const char *file )

[static]

Find a file using standard KDE search paths.

Possible search paths include $KDEDIR, $KDEPATH, and "[KDE Setup]:Path=" entry in a config file. If file is not found, isEmpty() will return True

bool  getKDEFonts (QStrList *fontlist)

Get the KDE font list.

This method allows you to get the KDE font list which was composed by the user with kfontmanager. Usually you should work only with those fonts in your kapplication.

Returns: true on success.

const char*  getCaption ()

[const]

Return a text for the window caption.

This would be set either by "-caption", otherwise it will be equivalent to the name of the executable.

const char*  tempSaveName ( const char* pFilename )

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

Parameters:
pFilenameThe full path to the current file of your document.

Returns: A new filename for auto-saving. You have to free() this yourself, otherwise you have a memory leak!

const char*  checkRecoverFile ( const char* pFilename, bool& bRecover )

Check if there is an auto-save file for the document you want to open.

Parameters:
pFilenameThe full path to the document you want to open.
bRecoverThis gets set to true if there was a recover file.

Returns: The full path of the file to open. You must free() this pointer yourself, otherwise you have a memory leak.

bool  localeConstructed ()

[const]

Returns true if the KLocale object for this application has already been constructed

Returns: whether the KLocale object has already been constructed

Atom  getDndSelectionAtom ()

An X11 atom used for IPC

Atom  getDndProtocolAtom ()

An X11 atom used for IPC

Atom  getDndEnterProtocolAtom ()

An X11 atom used for IPC

Atom  getDndLeaveProtocolAtom ()

An X11 atom used for IPC

Atom  getDndRootProtocolAtom ()

An X11 atom used for IPC

Display * getDisplay ()

Get the X11 display

void  addDropZone ( KDNDDropZone *_z )

[virtual]

Used by KDNDDropZone to register

void  removeDropZone ( KDNDDropZone *_z )

[virtual]

Used by KDNDDropZone during shutdown

void  setRootDropZone ( KDNDDropZone *_z )

[virtual]

Set the DropZone which receives root drop events.

QList<KDNDDropZone> dropZones

[protected]

List of all DropZones.

KDNDDropZone * lastEnteredDropZone

[protected]

The last drop zone the mouse was over.

If we get a DndLeaveProtocol we must inform 'lastEnteredDropZone' that the mouse left the DropZone.

KDNDDropZone * rootDropZone

[protected]

The DropZone which receives root drop events.

bool  x11EventFilter ( XEvent * )

[protected]

Used to catch X11 events

Atom WM_SAVE_YOURSELF

[protected]

Two X11 atoms used for session management

Atom DndSelection

[protected]

X11 atoms used for IPC

Display * display

[protected]

The X11 display

QString  kdedir ()

[protected static]

Get the KDE base dir.

This is the value of the KDEDIR environment variable if it is set in the process' environment, the compile time default of, if this was not present, either, /usr/local/kde.

Returns: the KDE base dir

int  xioErrhandler ()

for internal purposes only

void  kdisplayPaletteChanged ()

[signal]

KApplication has changed its Palette due to a KDisplay request.

Normally, widgets will update their palettes automatically, but you should connect to this to program special behaviour.

void  kdisplayStyleChanged ()

[signal]

KApplication has changed its GUI Style due to a KDisplay request.

Normally, widgets will update their styles automatically (as they would respond to an explicit setGUIStyle() call), but you should connect to this to program special behaviour.

void  kdisplayFontChanged ()

[signal]

KApplication has changed its Font due to a KDisplay request.

Normally widgets will update their fonts automatically, but you should connect to this to monitor global font changes, especially if you are using explicit fonts.

void  appearanceChanged ()

[signal]

KApplication has changed either its GUI style, its font or its palette due to a kdisplay request. Normally, widgets will update their styles automatically, but you should connect to this to program special behavior.

void  saveYourself ()

[signal]

Session management is about to close your application.

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

Use the ::getSessionConfig KConfig object to store all your instance specific datas.

Do not do any closing at this point! The user may still select "cancel" and then he wants to continue working with your application. Cleanups could be done after shutDown() (see below)

Note: You should not use this if you are using the KTopLevelWidget. Overload KTopLevelWidget::saveProperties and KTopLevelWidget::readProperties in that case. This allows you to simply handle applications with multiple toplevel windows.

void  shutDown ()

[signal]

Your application is killed. Either by kwm's killwindow function, xkill or (the usual case) by KDE's logout.