KApplication Class Reference
Controls and provides information to all KDE applications. Controls and provides information to all KDE applications. More...
#include <kapplication.h>
Inheritance diagram for KApplication:


Public Types | |
| enum | CaptionLayout { CaptionAppLast = 1, CaptionAppFirst, CaptionNoApp } |
| enum | ShutdownConfirm { ShutdownConfirmDefault = -1, ShutdownConfirmNo = 0, ShutdownConfirmYes = 1 } |
The possible values for the confirm parameter of requestShutDown(). More... | |
| enum | ShutdownType { ShutdownTypeDefault = -1, ShutdownTypeNone = 0, ShutdownTypeReboot = 1, ShutdownTypeHalt = 2 } |
The possible values for the sdtype parameter of requestShutDown(). More... | |
| enum | ShutdownMode { ShutdownModeDefault = -1, ShutdownModeSchedule = 0, ShutdownModeTryNow = 1, ShutdownModeForceNow = 2, ShutdownModeInteractive = 3 } |
The possible values for the sdmode parameter of requestShutDown(). More... | |
| enum | { ShiftModifier = 1<<0, LockModifier = 1<<1, ControlModifier = 1<<2, Modifier1 = 1<<3, Modifier2 = 1<<4, Modifier3 = 1<<5, Modifier4 = 1<<6, Modifier5 = 1<<7 } |
| enum | { Button1Pressed = 1<<8, Button2Pressed = 1<<9, Button3Pressed = 1<<10, Button4Pressed = 1<<11, Button5Pressed = 1<<12 } |
| enum | SettingsCategory { SETTINGS_MOUSE, SETTINGS_COMPLETION, SETTINGS_PATHS, SETTINGS_POPUPMENU, SETTINGS_QT, SETTINGS_SHORTCUTS } |
| Valid values for the settingsChanged signal. More... | |
Public Slots | |
| void | invokeBrowser (const QString &url) |
| Invokes the standard browser. | |
| void | ref () |
| Tells KApplication about one more operation that should be finished before the application exits. | |
| void | deref () |
| Tells KApplication that one operation such as those described in just finished. | |
Signals | |
| void | kdisplayPaletteChanged () |
| Emitted when KApplication has changed its palette due to a KControl request. | |
| void | kdisplayStyleChanged () |
| Emitted when KApplication has changed its GUI style in response to a KControl request. | |
| void | kdisplayFontChanged () |
| Emitted when KApplication has changed its font in response to a KControl request. | |
| void | appearanceChanged () |
| Emitted when KApplication has changed either its GUI style, its font or its palette in response to a kdisplay request. | |
| void | toolbarAppearanceChanged (int) |
| Emitted when the settings for toolbars have been changed. | |
| void | backgroundChanged (int desk) |
Emitted when the desktop background has been changed by kcmdisplay. | |
| void | settingsChanged (int category) |
| Emitted when the global settings have been changed - see KGlobalSettings KApplication takes care of calling reparseConfiguration on KGlobal::config() so that applications/classes using this only have to re-read the configuration. | |
| void | iconChanged (int group) |
| Emitted when the global icon settings have been changed. | |
| void | kipcMessage (int id, int data) |
| Emitted when a KIPC user message has been received. | |
| void | saveYourself () |
| Session management asks you to save the state of your application. | |
| void | shutDown () |
| Your application is killed. | |
Public Member Functions | |
| KApplication (bool allowStyles=true, bool GUIenabled=true) | |
| This constructor takes aboutData and command line arguments from KCmdLineArgs. | |
| KApplication (Display *display, int &argc, char **argv, const QCString &rAppName, bool allowStyles=true, bool GUIenabled=true) | |
| Constructor. | |
| KApplication (int &argc, char **argv, const QCString &rAppName, bool allowStyles=true, bool GUIenabled=true) | |
| This class or method is obsolete, it is provided for compatibility only. // REMOVE FOR KDE 4.0 - using it only gives crashing applications because // KCmdLineArgs::init isn't called | |
| KConfig * | sessionConfig () |
| Returns the application session config object. | |
| bool | isRestored () const |
| Is the application restored from the session manager? | |
| void | disableSessionManagement () |
| Disables session management for this application. | |
| bool | requestShutDown (ShutdownConfirm confirm=ShutdownConfirmDefault, ShutdownType sdtype=ShutdownTypeDefault, ShutdownMode sdmode=ShutdownModeDefault) |
| Asks the session manager to shut the session down. | |
| void | propagateSessionManager () |
| Propagates the network address of the session manager in the SESSION_MANAGER environment variable so that child processes can pick it up. | |
| void | commitData (QSessionManager &sm) |
| void | saveState (QSessionManager &sm) |
| bool | sessionSaving () const |
| Returns true if the application is currently saving its session data (most probably before KDE logout). | |
| QPixmap | icon () const |
| Returns a QPixmap with the application icon. | |
| QString | iconName () const |
| Returns the name of the application icon. | |
| QPixmap | miniIcon () const |
| Returns the mini-icon for the application as a QPixmap. | |
| QString | miniIconName () const |
| Returns the name of the mini-icon for the application. | |
| void | setTopWidget (QWidget *topWidget) |
| Sets the top widget of the application. | |
| void | invokeHelp (const QString &anchor=QString::null, const QString &appname=QString::null) const |
| Invokes the KHelpCenter HTML help viewer from docbook sources. | |
| void | invokeHTMLHelp (const QString &aFilename, const QString &aTopic=QString::null) const |
| This class or method is obsolete, it is provided for compatibility only. Invoke the khelpcenter HTML help viewer from HTML sources. | |
| void | invokeMailer (const QString &address, const QString &subject) |
| Convenience method; invokes the standard email application. | |
| void | invokeMailer (const KURL &mailtoURL) |
| Invokes the standard email application. | |
| void | invokeMailer (const QString &to, const QString &cc, const QString &bcc, const QString &subject, const QString &body, const QString &messageFile=QString::null, const QStringList &attachURLs=QStringList()) |
| Convenience method; invokes the standard email application. | |
| QString | caption () const |
| Returns a text for the window caption. | |
| KStyle * | kstyle () const |
| This class or method is obsolete, it is provided for compatibility only. | |
| QString | makeStdCaption (const QString &userCaption, bool withAppName=true, bool modified=false) const |
| Builds a caption that contains the application name along with the userCaption() using a standard layout. | |
| QString | tempSaveName (const QString &pFilename) const |
| Get a file name in order to make a temporary copy of your document. | |
| QString | checkRecoverFile (const QString &pFilename, bool &bRecover) const |
| Check whether an auto-save file exists for the document you want to open. | |
| void | enableStyles () |
| Enables style plugins. | |
| void | disableStyles () |
| Disables style plugins. | |
| void | installX11EventFilter (QWidget *filter) |
| Installs widget filter as global X11 event filter. | |
| void | addKipcEventMask (int id) |
| Adds a message type to the KIPC event mask. | |
| void | removeKipcEventMask (int id) |
| Removes a message type from the KIPC event mask. | |
| QCString | startupId () const |
| Returns the app startup notification identifier for this running application. | |
| void | setStartupId (const QCString &startup_id) |
| Sets a new value for the application startup notification window property for newly created toplevel windows. | |
| QString | geometryArgument () const |
| Returns the argument to --geometry if any, so the geometry can be set wherever necessary. | |
| void | installKDEPropertyMap () |
| Install a Qt SQL property map with entries for all KDE widgets Call this in any application using KDE widgets in QSqlForm or QDataView. | |
| bool | authorize (const QString &genericAction) |
| Returns whether a certain action is authorized. | |
| bool | authorizeKAction (const char *action) |
| Returns whether a certain KAction is authorized. | |
| bool | authorizeURLAction (const QString &action, const KURL &baseURL, const KURL &destURL) |
| Returns whether a certain URL related action is authorized. | |
| bool | notify (QObject *receiver, QEvent *event) |
| int | xioErrhandler () |
| void | iceIOErrorHandler (_IceConn *conn) |
Static Public Member Functions | |
| void | addCmdLineOptions () |
| Add Qt and KDE command line options to KCmdLineArgs. | |
| KApplication * | kApplication () |
| Returns the current application object. | |
| DCOPClient * | dcopClient () |
| Returns a pointer to a DCOPClient for the application. | |
| void | disableAutoDcopRegistration () |
| Disable automatic dcop registration Must be called before creating a KApplication instance to have an effect. | |
| QCString | launcher () |
| Returns the DCOP name of the service launcher. | |
| int | startServiceByName (const QString &_name, const QString &URL, QString *error=0, QCString *dcopService=0, int *pid=0, const QCString &startup_id="", bool noWait=false) |
| Starts a service based on the (translated) name of the service. | |
| int | startServiceByName (const QString &_name, const QStringList &URLs=QStringList(), QString *error=0, QCString *dcopService=0, int *pid=0, const QCString &startup_id="", bool noWait=false) |
| Starts a service based on the (translated) name of the service. | |
| int | startServiceByDesktopPath (const QString &_name, const QString &URL, QString *error=0, QCString *dcopService=0, int *pid=0, const QCString &startup_id="", bool noWait=false) |
| Starts a service based on the desktop path of the service. | |
| int | startServiceByDesktopPath (const QString &_name, const QStringList &URLs=QStringList(), QString *error=0, QCString *dcopService=0, int *pid=0, const QCString &startup_id="", bool noWait=false) |
| Starts a service based on the desktop path of the service. | |
| int | startServiceByDesktopName (const QString &_name, const QString &URL, QString *error=0, QCString *dcopService=0, int *pid=0, const QCString &startup_id="", bool noWait=false) |
| Starts a service based on the desktop name of the service. | |
| int | startServiceByDesktopName (const QString &_name, const QStringList &URLs=QStringList(), QString *error=0, QCString *dcopService=0, int *pid=0, const QCString &startup_id="", bool noWait=false) |
| Starts a service based on the desktop name of the service. | |
| int | kdeinitExec (const QString &name, const QStringList &args=QStringList(), QString *error=0, int *pid=0) |
| Starts a program via kdeinit. | |
| int | kdeinitExecWait (const QString &name, const QStringList &args=QStringList(), QString *error=0, int *pid=0) |
| Starts a program via kdeinit and wait for it to finish. | |
| int | random () |
| Generates a uniform random number. | |
| QString | randomString (int length) |
| Generates a random string. | |
| uint | keyboardModifiers () |
| Returns the currently pressed keyboard modifiers (e.g. | |
| uint | mouseState () |
| Returns the currently pressed mouse buttons. | |
| void | startKdeinit () |
| QPalette | createApplicationPalette () |
| Used to obtain the QPalette that will be used to set the application palette. | |
| QPalette | createApplicationPalette (KConfig *config, int contrast) |
Static Public Attributes | |
| bool | loadedByKdeinit = false |
Protected Member Functions | |
| KApplication (bool allowStyles, bool GUIenabled, KInstance *_instance) | |
| virtual void | virtual_hook (int id, void *data) |
Protected Attributes | |
| Atom | kipcCommAtom |
| int | kipcEventMask |
| int | pArgc |
Static Protected Attributes | |
| KApplication * | KApp = 0L |
| Current application object. | |
Detailed Description
Controls and provides information to all KDE applications. 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() method.
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 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.
- It can start new services
There are three possibilities:
- X-DCOP-ServiceType=None (default) Always start a new service, don't wait till the service registers with dcop.
- X-DCOP-ServiceType=Multi Always start a new service, wait until the service has registered with dcop.
- X-DCOP-ServiceType=Unique Only start the service if it isn't already running, wait until the service has registered with dcop.
- Author:
- Matthias Kalle Dalheimer <kalle@kde.org>
- Version:
- Id
- kapplication.h,v 1.278.2.1 2003/03/03 14:39:42 lunakl Exp
Definition at line 91 of file kapplication.h.
Member Enumeration Documentation
|
|
The possible values for the
Definition at line 210 of file kapplication.h. |
|
|
The possible values for the
Definition at line 228 of file kapplication.h. |
|
|
The possible values for the
Definition at line 250 of file kapplication.h. |
|
|
Valid values for the settingsChanged signal.
Definition at line 956 of file kapplication.h. |
Constructor & Destructor Documentation
|
||||||||||||
|
This constructor takes aboutData and command line arguments from KCmdLineArgs.
Definition at line 515 of file kapplication.cpp. References KInstance::instanceName(). |
|
||||||||||||||||||||||||||||
|
Constructor. Parses command-line arguments. Use this constructor to use KApplication in a Motif or Xt program.
|
|
||||||||||||||||||||||||
|
This class or method is obsolete, it is provided for compatibility only. // REMOVE FOR KDE 4.0 - using it only gives crashing applications because // KCmdLineArgs::init isn't called Constructor. Parses command-line arguments.
Definition at line 494 of file kapplication.cpp. References QCString::isEmpty(), and QApplication::Q_ASSERT(). |
Member Function Documentation
|
|
Add Qt and KDE command line options to KCmdLineArgs.
Reimplemented in KUniqueApplication. Definition at line 1213 of file kapplication.cpp. References KCmdLineArgs::addCmdLineOptions(). Referenced by KCmdLineArgs::init(). |
|
|
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.
Definition at line 178 of file kapplication.h. References KApp. |
|
|
Returns the application session config object.
Definition at line 817 of file kapplication.cpp. |
|
|
Is the application restored from the session manager?
Definition at line 197 of file kapplication.h. References QApplication::isSessionRestored(). |
|
|
Disables session management for this application. Useful in case your application is started by the initial "startkde" script. Definition at line 863 of file kapplication.cpp. |
|
||||||||||||||||
|
Asks the session manager to shut the session down.
Using
Definition at line 868 of file kapplication.cpp. References dcopClient(), QCString::isEmpty(), propagateSessionManager(), DCOPClient::send(), ShutdownConfirmNo, ShutdownConfirmYes, ShutdownModeDefault, ShutdownTypeDefault, and QApplication::syncX(). |
|
|
Propagates the network address of the session manager in the SESSION_MANAGER environment variable so that child processes can pick it up. If SESSION_MANAGER isn't defined yet, the address is searched in $HOME/.KSMserver. This function is called by clients that are started outside the session ( i.e. before ksmserver is started), but want to launch other processes that should participate in the session. Examples are kdesktop or kicker. Definition at line 931 of file kapplication.cpp. References QFile::close(), QFile::encodeName(), QCString::find(), QCString::isEmpty(), QFileInfo::lastModified(), QString::latin1(), QFile::open(), QTextStream::readLine(), QCString::replace(), and QTextStream::setEncoding(). Referenced by requestShutDown(). |
|
|
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().
Definition at line 1098 of file kapplication.cpp. |
|
|
Returns a pointer to a DCOPClient for the application. If a client does not exist yet, it is created when this function is called.
Definition at line 767 of file kapplication.cpp. References KCmdLineArgs::getOption(), KCmdLineArgs::isSet(), KCmdLineArgs::parsedArgs(), DCOPClient::setMainClient(), and DCOPClient::setServerAddress(). Referenced by requestShutDown(), and KUniqueApplication::start(). |
|
|
Disable automatic dcop registration Must be called before creating a KApplication instance to have an effect.
Definition at line 812 of file kapplication.cpp. |
|
|
Returns a QPixmap with the application icon.
Definition at line 1319 of file kapplication.cpp. References aIconPixmap, KInstance::instanceName(), and QPixmap::isNull(). Referenced by setTopWidget(). |
|
|
Returns the name of the application icon.
Definition at line 1328 of file kapplication.cpp. References KInstance::instanceName(), and QString::isNull(). |
|
|
Returns the mini-icon for the application as a QPixmap.
Definition at line 1333 of file kapplication.cpp. References aMiniIconPixmap, KInstance::instanceName(), and QPixmap::isNull(). Referenced by setTopWidget(). |
|
|
Returns the name of the mini-icon for the application.
Definition at line 1342 of file kapplication.cpp. References KInstance::instanceName(), and QString::isNull(). |
|
|
Sets the top widget of the application. This means basically applying the right window caption and icon. An application may have several top widgets. You don't need to call this function manually when using KMainWindow.
Definition at line 2247 of file kapplication.cpp. References KCmdLineArgs::appName(), caption(), icon(), miniIcon(), QWidget::setCaption(), QWidget::setIcon(), KWin::setIcons(), startupId(), QString::utf8(), and QWidget::winId(). |
|
||||||||||||
|
Invokes the KHelpCenter HTML help viewer from docbook sources.
Definition at line 1818 of file kapplication.cpp. References QString::arg(), QString::isEmpty(), KStdAction::name(), and startServiceByDesktopName(). |
|
||||||||||||
|
This class or method is obsolete, it is provided for compatibility only. Invoke the khelpcenter HTML help viewer from HTML sources. Please use invokeHelp() instead.
Definition at line 1842 of file kapplication.cpp. References QString::arg(), QString::isEmpty(), KStdAction::name(), and startServiceByDesktopName(). |
|
||||||||||||
|
Convenience method; invokes the standard email application.
Definition at line 1869 of file kapplication.cpp. Referenced by invokeMailer(). |
|
|
Invokes the standard email application.
Definition at line 1874 of file kapplication.cpp. References KURL::decode_string(), invokeMailer(), QString::mid(), KURL::path(), KURL::query(), QStringList::split(), and QString::startsWith(). |
|
||||||||||||||||||||||||||||||||
|
Convenience method; invokes the standard email application. All parameters are optional.
Definition at line 1900 of file kapplication.cpp. References KInstance::config(), QString::fromLatin1(), QString::insert(), QString::isEmpty(), kdeinitExec(), KConfigBase::readBoolEntry(), KConfigBase::readPathEntry(), QString::remove(), QString::right(), KConfigBase::setGroup(), QString::simplifyWhiteSpace(), and QStringList::split(). |
|
|
Invokes the standard browser. Note that you should only do this when you know for sure that the browser can handle the URL (i.e. its mimetype). In doubt, if the URL can point to an image or anything else than directory or HTML, prefer to use new KRun( url ).
Definition at line 1975 of file kapplication.cpp. References startServiceByDesktopName(). |
|
|
Returns the DCOP name of the service launcher. This will be something like klaucher_$host_$uid.
Definition at line 1987 of file kapplication.cpp. |
|
||||||||||||||||||||||||||||||||
|
Starts a service based on the (translated) name of the service. E.g. "Web Browser"
Definition at line 2069 of file kapplication.cpp. References QString::isEmpty(). |
|
||||||||||||||||||||||||||||||||
|
Starts a service based on the (translated) name of the service. E.g. "Web Browser"
Definition at line 2081 of file kapplication.cpp. |
|
||||||||||||||||||||||||||||||||
|
Starts a service based on the desktop path of the service. E.g. "Applications/konqueror.desktop" or "/home/user/bla/myfile.desktop"
Definition at line 2090 of file kapplication.cpp. References QString::isEmpty(). |
|
||||||||||||||||||||||||||||||||
|
Starts a service based on the desktop path of the service. E.g. "Applications/konqueror.desktop" or "/home/user/bla/myfile.desktop"
|
