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 } |
| enum | ShutdownType { ShutdownTypeDefault = -1, ShutdownTypeNone = 0, ShutdownTypeReboot = 1, ShutdownTypeHalt = 2 } |
| enum | ShutdownMode { ShutdownModeDefault = -1, ShutdownModeSchedule = 0, ShutdownModeTryNow = 1, ShutdownModeForceNow = 2, ShutdownModeInteractive = 3 } |
| 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 } |
Public Slots | |
| void | invokeBrowser (const QString &url, const QCString &startup_id) |
| void | invokeBrowser (const QString &url) |
| void | cut () |
| void | copy () |
| void | paste () |
| void | clear () |
| void | selectAll () |
| void | ref () |
| void | deref () |
Signals | |
| void | kdisplayPaletteChanged () |
| void | kdisplayStyleChanged () |
| void | kdisplayFontChanged () |
| void | appearanceChanged () |
| void | toolbarAppearanceChanged (int) |
| void | backgroundChanged (int desk) |
| void | settingsChanged (int category) |
| void | iconChanged (int group) |
| void | kipcMessage (int id, int data) |
| void | saveYourself () |
| void | shutDown () |
Public Member Functions | |
| KApplication (bool allowStyles=true, bool GUIenabled=true) | |
| KApplication (Display *display, Qt::HANDLE visual=0, Qt::HANDLE colormap=0, bool allowStyles=true) | |
| KApplication (Display *display, int &argc, char **argv, const QCString &rAppName, bool allowStyles=true, bool GUIenabled=true) | |
| KApplication (int &argc, char **argv, const QCString &rAppName, bool allowStyles=true, bool GUIenabled=true) KDE_DEPRECATED | |
| KConfig * | sessionConfig () |
| bool | isRestored () const |
| void | disableSessionManagement () |
| void | enableSessionManagement () |
| bool | requestShutDown (ShutdownConfirm confirm=ShutdownConfirmDefault, ShutdownType sdtype=ShutdownTypeDefault, ShutdownMode sdmode=ShutdownModeDefault) |
| void | propagateSessionManager () |
| void | commitData (QSessionManager &sm) |
| void | saveState (QSessionManager &sm) |
| bool | sessionSaving () const |
| QPixmap | icon () const |
| QString | iconName () const |
| QPixmap | miniIcon () const |
| QString | miniIconName () const |
| void | setTopWidget (QWidget *topWidget) |
| void | invokeHelp (const QString &anchor, const QString &appname, const QCString &startup_id) const |
| void | invokeHelp (const QString &anchor=QString::null, const QString &appname=QString::null) const |
| void | invokeHTMLHelp (const QString &aFilename, const QString &aTopic=QString::null) const KDE_DEPRECATED |
| void | invokeMailer (const QString &address, const QString &subject, const QCString &startup_id) |
| void | invokeMailer (const QString &address, const QString &subject) |
| void | invokeMailer (const KURL &mailtoURL, const QCString &startup_id, bool allowAttachments) |
| void | invokeMailer (const KURL &mailtoURL, const QCString &startup_id) |
| void | invokeMailer (const KURL &mailtoURL) |
| void | invokeMailer (const QString &to, const QString &cc, const QString &bcc, const QString &subject, const QString &body, const QString &messageFile, const QStringList &attachURLs, const QCString &startup_id) |
| 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()) |
| QString | caption () const |
| KDE_DEPRECATED KStyle * | kstyle () const |
| QString | makeStdCaption (const QString &userCaption, bool withAppName=true, bool modified=false) const |
| QString | tempSaveName (const QString &pFilename) const |
| QString | checkRecoverFile (const QString &pFilename, bool &bRecover) const |
| Display * | getDisplay () |
| void | enableStyles () |
| void | disableStyles () |
| void | installX11EventFilter (QWidget *filter) |
| void | removeX11EventFilter (const QWidget *filter) |
| void | addKipcEventMask (int id) |
| void | removeKipcEventMask (int id) |
| QCString | startupId () const |
| void | setStartupId (const QCString &startup_id) |
| void | updateUserTimestamp (unsigned long time=0) |
| unsigned long | userTimestamp () const |
| void | updateRemoteUserTimestamp (const QCString &dcopId, unsigned long time=0) |
| QString | geometryArgument () const |
| void | installKDEPropertyMap () |
| bool | authorize (const QString &genericAction) |
| bool | authorizeKAction (const char *action) |
| bool | authorizeURLAction (const QString &action, const KURL &baseURL, const KURL &destURL) |
| void | allowURLAction (const QString &action, const KURL &_baseURL, const KURL &_destURL) |
| bool | authorizeControlModule (const QString &menuId) |
| QStringList | authorizeControlModules (const QStringList &menuIds) |
| bool | notify (QObject *receiver, QEvent *event) |
| int | xErrhandler (Display *, void *) |
| int | xioErrhandler (Display *) |
| void | iceIOErrorHandler (_IceConn *conn) |
Static Public Member Functions | |
| void | addCmdLineOptions () |
| KApplication * | kApplication () |
| DCOPClient * | dcopClient () |
| void | disableAutoDcopRegistration () |
| QCString | 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) |
| 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) |
| int | startServiceByDesktopPath (const QString &_name, const QString &URL, QString *error=0, QCString *dcopService=0, int *pid=0, const QCString &startup_id="", bool noWait=false) |
| 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) |
| int | startServiceByDesktopName (const QString &_name, const QString &URL, QString *error=0, QCString *dcopService=0, int *pid=0, const QCString &startup_id="", bool noWait=false) |
| 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) |
| int | kdeinitExec (const QString &name, const QStringList &args, QString *error, int *pid, const QCString &startup_id) |
| int | kdeinitExec (const QString &name, const QStringList &args=QStringList(), QString *error=0, int *pid=0) |
| int | kdeinitExecWait (const QString &name, const QStringList &args, QString *error, int *pid, const QCString &startup_id) |
| int | kdeinitExecWait (const QString &name, const QStringList &args=QStringList(), QString *error=0, int *pid=0) |
| int | random () |
| QString | randomString (int length) |
| uint | keyboardModifiers () |
| uint | mouseState () |
| void | startKdeinit () |
| QPalette | createApplicationPalette () |
| QPalette | createApplicationPalette (KConfig *config, int contrast) |
| void | installSigpipeHandler () |
| bool | guiEnabled () |
Static Public Attributes | |
| bool | loadedByKdeinit = false |
Protected Member Functions | |
| KApplication (bool allowStyles, bool GUIenabled, KInstance *_instance) | |
| KApplication (Display *display, Qt::HANDLE visual, Qt::HANDLE colormap, bool allowStyles, KInstance *_instance) | |
| bool | x11EventFilter (XEvent *) |
| void | invokeEditSlot (const char *slot) |
| virtual void | virtual_hook (int id, void *data) |
Protected Attributes | |
| Display * | display |
| Atom | kipcCommAtom |
| int | kipcEventMask |
| int | pArgc |
Static Protected Attributes | |
| KApplication * | KApp = 0L |
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.
- Installs an empty signal handler for the SIGPIPE signal using installSigpipeHandler(). 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
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.312 2004/07/22 16:50:04 waba Exp
Definition at line 96 of file kapplication.h.
Member Enumeration Documentation
|
|
The possible values for the
Definition at line 257 of file kapplication.h. |
|
|
The possible values for the
Definition at line 275 of file kapplication.h. |
|
|
The possible values for the
Definition at line 297 of file kapplication.h. |
|
|
Valid values for the settingsChanged signal.
Definition at line 1215 of file kapplication.h. Referenced by x11EventFilter(). |
Constructor & Destructor Documentation
|
||||||||||||
|
This constructor takes aboutData and command line arguments from KCmdLineArgs.
Definition at line 560 of file kapplication.cpp. References installSigpipeHandler(), and KInstance::instanceName(). |
|
||||||||||||||||||||
|
Constructor. Parses command-line arguments. Use this constructor when you you need to use a non-default visual or colormap.
Definition at line 582 of file kapplication.cpp. References installSigpipeHandler(), and KInstance::instanceName(). |
|
||||||||||||||||||||||||||||
|
Constructor. Parses command-line arguments. Use this constructor to use KApplication in a Motif or Xt program.
Definition at line 635 of file kapplication.cpp. References installSigpipeHandler(), QCString::isEmpty(), and QApplication::Q_ASSERT(). |
|
||||||||||||||||||||||||
|
Definition at line 538 of file kapplication.cpp. References installSigpipeHandler(), QCString::isEmpty(), and QApplication::Q_ASSERT(). |
Member Function Documentation
|
|
Add Qt and KDE command line options to KCmdLineArgs.
Reimplemented in KUniqueApplication. Definition at line 1357 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 217 of file kapplication.h. References KApp. |
|
|
Returns the application session config object.
Definition at line 934 of file kapplication.cpp. |
|
|
Is the application restored from the session manager?
Definition at line 236 of file kapplication.h. References QApplication::isSessionRestored(). Referenced by KUniqueApplication::restoringSession(). |
|
|
Disables session management for this application. Useful in case your application is started by the initial "startkde" script. Definition at line 980 of file kapplication.cpp. |
|
|
Enables again session management for this application, formerly disabled by calling disableSessionManagement(). You usually shouldn't call this function, as the session management is enabled by default. Definition at line 984 of file kapplication.cpp. |
|
||||||||||||||||
|
Asks the session manager to shut the session down.
Using
Definition at line 1006 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 1069 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 1242 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 884 of file kapplication.cpp. References KCmdLineArgs::getOption(), KCmdLineArgs::isSet(), KCmdLineArgs::parsedArgs(), DCOPClient::setMainClient(), and DCOPClient::setServerAddress(). Referenced by invokeHelp(), invokeHTMLHelp(), requestShutDown(), and KUniqueApplication::start(). |
|
|
Disable automatic dcop registration Must be called before creating a KApplication instance to have an effect.
Definition at line 929 of file kapplication.cpp. |
|
|
Returns a QPixmap with the application icon.
Definition at line 1465 of file kapplication.cpp. References aIconPixmap, KInstance::instanceName(), and QPixmap::isNull(). Referenced by setTopWidget(). |
|
|
Returns the name of the application icon.
Definition at line 1474 of file kapplication.cpp. References KInstance::instanceName(), and QString::isNull(). |
|
|
Returns the mini-icon for the application as a QPixmap.
Definition at line 1479 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 1488 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 2589 of file kapplication.cpp. References caption(), icon(), miniIcon(), QWidget::setCaption(), QWidget::setIcon(), KWin::setIcons(), KStartupInfo::setWindowStartupId(), startupId(), and QWidget::winId(). |
|
||||||||||||||||
|
Invokes the KHelpCenter HTML help viewer from docbook sources.
Definition at line 2062 of file kapplication.cpp. References QString::arg(), QMessageBox::critical(), dcopClient(), endl(), DCOPClient::isApplicationRegistered(), QString::isEmpty(), and startServiceByDesktopName(). |
|
||||||||||||
|
Definition at line 2095 of file kapplication.cpp. References QString::arg(), QMessageBox::critical(), dcopClient(), endl(), DCOPClient::isApplicationRegistered(), QString::isEmpty(), and startServiceByDesktopName(). |
|
||||||||||||||||
|
Convenience method; invokes the standard email application.
Definition at line 2135 of file kapplication.cpp. Referenced by invokeMailer(). |
|
||||||||||||||||
|
Invokes the standard email application.
Definition at line 2151 of file kapplication.cpp. References KURL::decode_string(), invokeMailer(), QString::isEmpty(), 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 2191 of file kapplication.cpp. References QString::arg(), KInstance::config(), QMessageBox::critical(), endl(), QString::endsWith(), KMacroExpander::expandMacros(), QString::fromLatin1(), QString::insert(), QMap::insert(), QString::isEmpty(), kdeinitExec(), KConfigBase::readBoolEntry(), KConfigBase::readEntry(), KConfigBase::readPathEntry(), QString::remove(), KConfigBase::setGroup(), and KShell::splitArgs(). |
|
||||||||||||
|
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 2272 of file kapplication.cpp. References QString::arg(), QMessageBox::critical(), endl(), and startServiceByDesktopName(). |
|
|
If the widget with focus provides a cut() slot, call that slot. Thus for a simple application cut can be implemented as:
Definition at line 2287 of file kapplication.cpp. References invokeEditSlot(). |
|
|
If the widget with focus provides a copy() slot, call that slot. Thus for a simple application copy can be implemented as:
Definition at line 2292 of file kapplication.cpp. References invokeEditSlot(). |
|
|
If the widget with focus provides a paste() slot, call that slot. Thus for a simple application copy can be implemented as:
Definition at line 2297 of file kapplication.cpp. References invokeEditSlot(). |
|
|
If the widget with focus provides a clear() slot, call that slot. Thus for a simple application clear() can be implemented as: Note that for some widgets, this may not provide the intended bahavior. For example if you make use of the code above and a KListView has the focus, clear() will clear all of the items in the list. If this is not the intened behavior and you want to make use of this slot, you can subclass KListView and reimplement this slot. For example the following code would implement a KListView without this behavior:
Definition at line 2302 of file kapplication.cpp. References invokeEditSlot(). |
|
|
If the widget with focus provides a selectAll() slot, call that slot. Thus for a simple application select all can be implemented as:
Definition at line 2307 of file kapplication.cpp. References invokeEditSlot(). |
|
