KDECore
KApplication Class Reference
Controls and provides information to all KDE applications. More...
#include <kapplication.h>
Public Types | |
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 | CaptionLayout { CaptionAppLast = 1, CaptionAppFirst, CaptionNoApp } |
enum | SettingsCategory { SETTINGS_MOUSE, SETTINGS_COMPLETION, SETTINGS_PATHS, SETTINGS_POPUPMENU, SETTINGS_QT, SETTINGS_SHORTCUTS } |
enum | ShutdownConfirm { ShutdownConfirmDefault = -1, ShutdownConfirmNo = 0, ShutdownConfirmYes = 1 } |
enum | ShutdownMode { ShutdownModeDefault = -1, ShutdownModeSchedule = 0, ShutdownModeTryNow = 1, ShutdownModeForceNow = 2, ShutdownModeInteractive = 3 } |
enum | ShutdownType { ShutdownTypeDefault = -1, ShutdownTypeNone = 0, ShutdownTypeReboot = 1, ShutdownTypeHalt = 2 } |
Public Slots | |
void | clear () |
void | copy () |
void | cut () |
void | deref () |
void | invokeBrowser (const QString &url) |
void | invokeBrowser (const QString &url, const QCString &startup_id) |
void | paste () |
void | ref () |
void | selectAll () |
Signals | |
void | appearanceChanged () |
void | backgroundChanged (int desk) |
void | iconChanged (int group) |
void | kdisplayFontChanged () |
void | kdisplayPaletteChanged () |
void | kdisplayStyleChanged () |
void | kipcMessage (int id, int data) |
void | saveYourself () |
void | settingsChanged (int category) |
void | shutDown () |
void | toolbarAppearanceChanged (int) |
void | updateIconLoaders () |
Public Member Functions | |
void | addKipcEventMask (int id) |
void | allowURLAction (const QString &action, const KURL &_baseURL, const KURL &_destURL) |
bool | authorize (const QString &genericAction) |
bool | authorizeControlModule (const QString &menuId) |
QStringList | authorizeControlModules (const QStringList &menuIds) |
bool | authorizeKAction (const char *action) |
bool | authorizeURLAction (const QString &action, const KURL &baseURL, const KURL &destURL) |
QString | caption () const |
QString | checkRecoverFile (const QString &pFilename, bool &bRecover) const |
void | commitData (QSessionManager &sm) |
void | disableSessionManagement () |
void | disableStyles () |
void | enableSessionManagement () |
void | enableStyles () |
QString | geometryArgument () const |
void | iceIOErrorHandler (_IceConn *conn) |
QPixmap | icon () const |
QString | iconName () const |
void | installKDEPropertyMap () |
void | installX11EventFilter (QWidget *filter) |
void | invokeHelp (const QString &anchor=QString::null, const QString &appname=QString::null) const |
void | invokeHelp (const QString &anchor, const QString &appname, const QCString &startup_id) const |
void | invokeHTMLHelp (const QString &aFilename, const QString &aTopic=QString::null) const KDE_DEPRECATED |
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()) |
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 KURL &mailtoURL) |
void | invokeMailer (const KURL &mailtoURL, const QCString &startup_id) |
void | invokeMailer (const KURL &mailtoURL, const QCString &startup_id, bool allowAttachments) |
void | invokeMailer (const QString &address, const QString &subject) |
void | invokeMailer (const QString &address, const QString &subject, const QCString &startup_id) |
bool | isRestored () const |
KApplication (int &argc, char **argv, const QCString &rAppName, bool allowStyles=true, bool GUIenabled=true) KDE_DEPRECATED | |
KApplication (bool allowStyles=true, bool GUIenabled=true) | |
KDE_DEPRECATED KStyle * | kstyle () const |
QString | makeStdCaption (const QString &userCaption, bool withAppName=true, bool modified=false) const |
QPixmap | miniIcon () const |
QString | miniIconName () const |
bool | notify (QObject *receiver, QEvent *event) |
void | propagateSessionManager () |
void | removeKipcEventMask (int id) |
void | removeX11EventFilter (const QWidget *filter) |
bool | requestShutDown (ShutdownConfirm confirm=ShutdownConfirmDefault, ShutdownType sdtype=ShutdownTypeDefault, ShutdownMode sdmode=ShutdownModeDefault) |
void | saveState (QSessionManager &sm) |
KConfig * | sessionConfig () |
bool | sessionSaving () const |
void | setStartupId (const QCString &startup_id) |
void | setTopWidget (QWidget *topWidget) |
QCString | startupId () const |
QString | tempSaveName (const QString &pFilename) const |
void | updateRemoteUserTimestamp (const QCString &dcopId, unsigned long time=0) |
void | updateUserTimestamp (unsigned long time=0) |
unsigned long | userTimestamp () const |
int | xErrhandler (Display *, void *) |
int | xioErrhandler (Display *) |
virtual | ~KApplication () |
Static Public Member Functions | |
static void | addCmdLineOptions () |
static QPalette | createApplicationPalette (KConfig *config, int contrast) |
static QPalette | createApplicationPalette () |
static DCOPClient * | dcopClient () |
static void | disableAutoDcopRegistration () |
static bool | guiEnabled () |
static void | installSigpipeHandler () |
static KApplication * | kApplication () |
static int | kdeinitExec (const QString &name, const QStringList &args=QStringList(), QString *error=0, int *pid=0) |
static int | kdeinitExec (const QString &name, const QStringList &args, QString *error, int *pid, const QCString &startup_id) |
static int | kdeinitExecWait (const QString &name, const QStringList &args=QStringList(), QString *error=0, int *pid=0) |
static int | kdeinitExecWait (const QString &name, const QStringList &args, QString *error, int *pid, const QCString &startup_id) |
static uint | keyboardModifiers () KDE_DEPRECATED |
static ButtonState | keyboardMouseState () |
static QCString | launcher () |
static uint | mouseState () KDE_DEPRECATED |
static int | random () |
static QString | randomString (int length) |
static void | startKdeinit () |
static 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) |
static int | startServiceByDesktopName (const QString &_name, const QString &URL, QString *error=0, QCString *dcopService=0, int *pid=0, const QCString &startup_id="", bool noWait=false) |
static 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) |
static int | startServiceByDesktopPath (const QString &_name, const QString &URL, QString *error=0, QCString *dcopService=0, int *pid=0, const QCString &startup_id="", bool noWait=false) |
static 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) |
static int | startServiceByName (const QString &_name, const QString &URL, QString *error=0, QCString *dcopService=0, int *pid=0, const QCString &startup_id="", bool noWait=false) |
Static Public Attributes | |
static bool | loadedByKdeinit = false |
Protected Member Functions | |
void | invokeEditSlot (const char *slot) |
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 | |
static KApplication * | KApp = 0L |
Detailed Description
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 'kapp' global variable. See cut() for an example.
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.
Definition at line 94 of file kapplication.h.
Member Enumeration Documentation
anonymous enum |
- Enumerator:
-
ShiftModifier LockModifier ControlModifier Modifier1 Modifier2 Modifier3 Modifier4 Modifier5
Definition at line 1057 of file kapplication.h.
anonymous enum |
Position of the caption (presumably in the application window's title bar).
This enum appears to be unused.
- Todo:
- Find out if this is used anywhere.
- Enumerator:
-
CaptionAppLast Display the application name last (before document name). CaptionAppFirst Display the application name first. CaptionNoApp Do not display application name at all.
Definition at line 104 of file kapplication.h.
Valid values for the settingsChanged signal.
- Enumerator:
-
SETTINGS_MOUSE SETTINGS_COMPLETION SETTINGS_PATHS SETTINGS_POPUPMENU SETTINGS_QT SETTINGS_SHORTCUTS
Definition at line 1228 of file kapplication.h.
The possible values for the confirm
parameter of requestShutDown().
- Enumerator:
-
ShutdownConfirmDefault Obey the user's confirmation setting. ShutdownConfirmNo Don't confirm, shutdown without asking. ShutdownConfirmYes Always confirm, ask even if the user turned it off.
Definition at line 264 of file kapplication.h.
The possible values for the sdmode
parameter of requestShutDown().
- Enumerator:
Definition at line 304 of file kapplication.h.
The possible values for the sdtype
parameter of requestShutDown().
- Enumerator:
Definition at line 282 of file kapplication.h.
Constructor & Destructor Documentation
This constructor takes aboutData and command line arguments from KCmdLineArgs.
- Parameters:
-
allowStyles Set to false to disable the loading on plugin based styles. This is only useful to applications that do not display a GUI normally. If you do create an application with allowStyles
set to false it normally runs in the background but under special circumstances displays widgets. Call enableStyles() before displaying any widgets.GUIenabled Set to false to disable all GUI stuff. This implies no styles either.
Definition at line 615 of file kapplication.cpp.
KApplication::KApplication | ( | int & | argc, | |
char ** | argv, | |||
const QCString & | rAppName, | |||
bool | allowStyles = true , |
|||
bool | GUIenabled = true | |||
) |
- Deprecated:
- do not use it at all, it will make your application crash, use KCmdLineArgs
- Parameters:
-
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. allowStyles Set to false to disable the loading on plugin based styles. This is only useful to applications that do not display a GUI normally. If you do create an application with allowStyles
set to false that normally runs in the background but under special circumstances displays widgets call enableStyles() before displaying any widgets.GUIenabled Set to false to disable all GUI stuff. This implies no styles either.
Definition at line 591 of file kapplication.cpp.
KApplication::~KApplication | ( | ) | [virtual] |
Definition at line 1635 of file kapplication.cpp.
Member Function Documentation
void KApplication::addCmdLineOptions | ( | ) | [static] |
Add Qt and KDE command line options to KCmdLineArgs.
Reimplemented in KUniqueApplication.
Definition at line 1484 of file kapplication.cpp.
void KApplication::addKipcEventMask | ( | int | id | ) |
Adds a message type to the KIPC event mask.
You can only add "system messages" to the event mask. These are the messages with id < 32. Messages with id >= 32 are user messages.
- Parameters:
-
id The message id. See KIPC::Message.
- See also:
- KIPC
Definition at line 1891 of file kapplication.cpp.
void KApplication::allowURLAction | ( | const QString & | action, | |
const KURL & | _baseURL, | |||
const KURL & | _destURL | |||
) |
Allow a certain URL action.
This can be useful if your application needs to ensure access to an application specific directory that may otherwise be subject to KIOSK restrictions.
- Parameters:
-
action The name of the action. _baseURL The url where the action originates from _destURL The object of the action
- Since:
- 3.2
Definition at line 3105 of file kapplication.cpp.
void KApplication::appearanceChanged | ( | ) | [signal] |
Emitted when KApplication has changed either its GUI style, its font or its palette in response to a kdisplay request.
Normally, widgets will update their styles automatically, but you should connect to this to program special behavior.
Returns whether a certain action is authorized.
- Parameters:
-
genericAction The name of a generic action
- Returns:
- true if the action is authorized
Definition at line 2985 of file kapplication.cpp.
Returns whether access to a certain control module is authorized.
- Parameters:
-
menuId identifying the control module, e.g. kde-mouse.desktop
- Returns:
- true if access to the module is authorized, false otherwise.
- Since:
- 3.2
Definition at line 3005 of file kapplication.cpp.
QStringList KApplication::authorizeControlModules | ( | const QStringList & | menuIds | ) |
Returns whether access to a certain control modules is authorized.
- Parameters:
-
menuIds list of menu-ids of control module, an example of a menu-id is kde-mouse.desktop.
- Returns:
- Those control modules for which access has been authorized.
- Since:
- 3.2
Definition at line 3014 of file kapplication.cpp.
bool KApplication::authorizeKAction | ( | const char * | action | ) |
Returns whether a certain KAction is authorized.
- Parameters:
-
action The name of a KAction action. The name is prepended with "action/" before being passed to authorize()
- Returns:
- true if the KAction is authorized
Definition at line 2995 of file kapplication.cpp.
bool KApplication::authorizeURLAction | ( | const QString & | action, | |
const KURL & | baseURL, | |||
const KURL & | destURL | |||
) |
Returns whether a certain URL related action is authorized.
- Parameters:
-
action The name of the action. Known actions are list (may be listed (e.g. in file selection dialog)), link (may be linked to), open (may open) and redirect (may be redirected to) baseURL The url where the action originates from destURL The object of the action
- Returns:
- true when the action is authorized, false otherwise.
- Since:
- 3.1
Definition at line 3115 of file kapplication.cpp.
void KApplication::backgroundChanged | ( | int | desk | ) | [signal] |
Emitted when the desktop background has been changed by kcmdisplay
.
- Parameters:
-
desk The desktop whose background has changed.
QString KApplication::caption | ( | ) | const |
Returns a text for the window caption.
This may be set by "-caption", otherwise it will be equivalent to the name of the executable.
- Returns:
- the text for the window caption
Definition at line 1952 of file kapplication.cpp.
Check whether an auto-save file exists for the document you want to open.
- Parameters:
-
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.
Definition at line 2816 of file kapplication.cpp.
void KApplication::clear | ( | ) | [slot] |
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:
class MyListView : public KListView { Q_OBJECT public: MyListView( QWidget * parent = 0, const char * name = 0, WFlags f = 0 ) : KListView( parent, name, f ) {} virtual ~MyListView() {} public slots: virtual void clear() {} };
Definition at line 2596 of file kapplication.cpp.
void KApplication::commitData | ( | QSessionManager & | sm | ) |
Reimplemented for internal purposes, mainly the highlevel handling of session management with KSessionManaged.
For internal use only.
Reimplemented from QApplication.
Definition at line 1203 of file kapplication.cpp.
void KApplication::copy | ( | ) | [slot] |
If the widget with focus provides a copy() slot, call that slot.
Thus for a simple application copy can be implemented as:
KStdAction::copy( kapp, SLOT( copy() ), actionCollection() );
Definition at line 2586 of file kapplication.cpp.
QPalette KApplication::createApplicationPalette | ( | ) | [static] |
Used to obtain the QPalette that will be used to set the application palette.
This is only useful for configuration modules such as krdb and should not be used in normal circumstances.
- Returns:
- the QPalette
- Since:
- 3.1
Definition at line 1990 of file kapplication.cpp.
void KApplication::cut | ( | ) | [slot] |
If the widget with focus provides a cut() slot, call that slot.
Thus for a simple application cut can be implemented as:
KStdAction::cut( kapp, SLOT( cut() ), actionCollection() );
Definition at line 2581 of file kapplication.cpp.
DCOPClient * KApplication::dcopClient | ( | ) | [static] |
Returns a pointer to a DCOPClient for the application.
If a client does not exist yet, it is created when this function is called.
- Returns:
- the DCOPClient for the application
Definition at line 981 of file kapplication.cpp.
void KApplication::deref | ( | ) | [slot] |
Tells KApplication that one operation such as those described in ref() just finished.
The application exits if the counter is back to 0.
Definition at line 1047 of file kapplication.cpp.
void KApplication::disableAutoDcopRegistration | ( | ) | [static] |
Disable automatic dcop registration Must be called before creating a KApplication instance to have an effect.
Definition at line 1026 of file kapplication.cpp.
void KApplication::disableSessionManagement | ( | ) |
Disables session management for this application.
Useful in case your application is started by the initial "startkde" script.
Definition at line 1077 of file kapplication.cpp.
void KApplication::disableStyles | ( | ) |
Disables style plugins.
Current style plugins do not get unloaded.
This is only useful when used in combination with enableStyles().
Definition at line 1920 of file kapplication.cpp.
void KApplication::enableSessionManagement | ( | ) |
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 1081 of file kapplication.cpp.
void KApplication::enableStyles | ( | ) |
Enables style plugins.
This is useful only to applications that normally do not display a GUI and create the KApplication with allowStyles set to false.
Definition at line 1911 of file kapplication.cpp.
QString KApplication::geometryArgument | ( | ) | const |
Returns the argument to --geometry if any, so the geometry can be set wherever necessary.
- Returns:
- the geometry argument, or QString::null if there is none
Definition at line 1596 of file kapplication.cpp.
bool KApplication::guiEnabled | ( | ) | [static] |
For internal use only.
Whether widgets can be used.
- Since:
- 3.2
Definition at line 3261 of file kapplication.cpp.
void KApplication::iceIOErrorHandler | ( | _IceConn * | conn | ) |
QPixmap KApplication::icon | ( | ) | const |
void KApplication::iconChanged | ( | int | group | ) | [signal] |
Emitted when the global icon settings have been changed.
- Parameters:
-
group the new group
QString KApplication::iconName | ( | ) | const |
Returns the name of the application icon.
- Returns:
- the icon's name
Definition at line 1612 of file kapplication.cpp.
void KApplication::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.
If you are adding a widget that was missing please make sure to also add it to KConfigDialogManager's retrieveSettings() function. Thanks.
Definition at line 2171 of file kapplication.cpp.
void KApplication::installSigpipeHandler | ( | ) | [static] |
Installs a handler for the SIGPIPE signal.
It is thrown when you write to a pipe or socket that has been closed. The handler is installed automatically in the constructor, but you may need it if your application or component does not have a KApplication instance.
Definition at line 3236 of file kapplication.cpp.
void KApplication::installX11EventFilter | ( | QWidget * | filter | ) |
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.
Definition at line 409 of file kapplication.cpp.
void KApplication::invokeBrowser | ( | const QString & | url | ) | [slot] |
Invoke the standard browser.
Uses a startup_id
of "" (empty) and is otherwise the same as the above function.
Definition at line 2557 of file kapplication.cpp.
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 ).
- Parameters:
-
url The destination address startup_id for app startup notification, "0" for none, "" ( empty string ) is the default
Definition at line 2565 of file kapplication.cpp.
void KApplication::invokeEditSlot | ( | const char * | slot | ) | [protected] |
This method is used internally to determine which edit slots are implemented by the widget that has the focus, and to invoke those slots if available.
- Parameters:
-
slot is the slot as returned using the SLOT() macro, for example SLOT( cut() )
void MyApplication::deselect()
{
invokeEditSlot( SLOT( deselect() ) );
}
Now in your application calls to MyApplication::deselect() will call this slot on the focused widget if it provides this slot. You can combine this with KAction with:
- See also:
- cut()
- Since:
- 3.2
Definition at line 1876 of file kapplication.cpp.
void KApplication::invokeHelp | ( | const QString & | anchor = QString::null , |
|
const QString & | appname = QString::null | |||
) | const |
Definition at line 2213 of file kapplication.cpp.
void KApplication::invokeHelp | ( | const QString & | anchor, | |
const QString & | appname, | |||
const QCString & | startup_id | |||
) | const |
Invokes the KHelpCenter HTML help viewer from docbook sources.
- Parameters:
-
anchor This has to be a defined anchor in your docbook sources. If empty the main index is loaded appname This allows you to show the help of another application. If empty the current name() is used startup_id for app startup notification, "0" for none, "" ( empty string ) is the default
Definition at line 2222 of file kapplication.cpp.
void KApplication::invokeHTMLHelp | ( | const QString & | aFilename, | |
const QString & | aTopic = QString::null | |||
) | const |
- Deprecated:
- Invoke the khelpcenter HTML help viewer from HTML sources. Please use invokeHelp() instead.
- Parameters:
-
aFilename The 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.aTopic This allows context-sensitive help. Its value will be appended to the filename, prefixed with a "#" (hash) character.
Definition at line 2256 of file kapplication.cpp.
void KApplication::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() | |||
) |
Definition at line 2345 of file kapplication.cpp.
void KApplication::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 | |||
) |
Convenience method; invokes the standard email application.
All parameters are optional.
- Parameters:
-
to The destination address. cc The Cc field bcc The Bcc field subject Subject string body A string containing the body of the mail (exclusive with messageFile) messageFile A file (URL) containing the body of the mail (exclusive with body) - currently unsupported attachURLs List of URLs to be attached to the mail. startup_id for app startup notification, "0" for none, "" ( empty string ) is the default
Definition at line 2427 of file kapplication.cpp.
void KApplication::invokeMailer | ( | const KURL & | mailtoURL | ) |
Definition at line 2302 of file kapplication.cpp.
Definition at line 2307 of file kapplication.cpp.
void KApplication::invokeMailer | ( | const KURL & | mailtoURL, | |
const QCString & | startup_id, | |||
bool | allowAttachments | |||
) |
Invokes the standard email application.
- Parameters:
-
mailtoURL A mailto URL. startup_id for app startup notification, "0" for none, "" ( empty string ) is the default allowAttachments whether attachments specified in mailtoURL should be honoured. The default is false; do not honour requests for attachments.
Definition at line 2312 of file kapplication.cpp.
Definition at line 2291 of file kapplication.cpp.
void KApplication::invokeMailer | ( | const QString & | address, | |
const QString & | subject, | |||
const QCString & | startup_id | |||
) |
Convenience method; invokes the standard email application.
- Parameters:
-
address The destination address subject Subject string. Can be QString::null. startup_id for app startup notification, "0" for none, "" ( empty string ) is the default
Definition at line 2296 of file kapplication.cpp.
bool KApplication::isRestored | ( | ) | const [inline] |
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 sessionConfig() contains data saved by a session closedown.
- See also:
- sessionConfig()
Definition at line 243 of file kapplication.h.
static KApplication* KApplication::kApplication | ( | ) | [inline, 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
Definition at line 224 of file kapplication.h.
int KApplication::kdeinitExec | ( | const QString & | name, | |
const QStringList & | args = QStringList() , |
|||
QString * | error = 0 , |
|||
int * | pid = 0 | |||
) | [static] |
Definition at line 2759 of file kapplication.cpp.
int KApplication::kdeinitExec | ( | const QString & | name, | |
const QStringList & | args, | |||
QString * | error, | |||
int * | pid, | |||
const QCString & | startup_id | |||
) | [static] |
Starts a program via kdeinit.
program name and arguments are converted to according to the local encoding and passed as is to kdeinit.
- Parameters:
-
name Name of the program to start args Arguments to pass to the program error On failure, error
contains a description of the error that occurred. If the pointer is 0, the argument will be ignoredpid On success, the process id of the new service will be written here. If the pointer is 0, the argument will be ignored. startup_id for app startup notification, "0" for none, "" ( empty string ) is the default
- Returns:
- an error code indicating success (== 0) or failure (> 0).
Definition at line 2766 of file kapplication.cpp.
int KApplication::kdeinitExecWait | ( | const QString & | name, | |
const QStringList & | args = QStringList() , |
|||
QString * | error = 0 , |
|||
int * | pid = 0 | |||
) | [static] |
Definition at line 2774 of file kapplication.cpp.
int KApplication::kdeinitExecWait | ( | const QString & | name, | |
const QStringList & | args, | |||
QString * | error, | |||
int * | pid, | |||
const QCString & | startup_id | |||
) | [static] |
Starts a program via kdeinit and wait for it to finish.
Like kdeinitExec(), but it waits till the program is finished. As such it behaves similar to the system(...) function.
- Parameters:
-
name Name of the program to start args Arguments to pass to the program error On failure, error
contains a description of the error that occurred. If the pointer is 0, the argument will be ignoredpid On success, the process id of the new service will be written here. If the pointer is 0, the argument will be ignored. startup_id for app startup notification, "0" for none, "" ( empty string ) is the default
- Returns:
- an error code indicating success (== 0) or failure (> 0).
Definition at line 2781 of file kapplication.cpp.
void KApplication::kdisplayFontChanged | ( | ) | [signal] |
Emitted when KApplication has changed its font in response to a KControl 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.
Note: If you derive from a QWidget-based class, a faster method is to reimplement QWidget::fontChange(). This is the preferred way to get informed about font updates.
void KApplication::kdisplayPaletteChanged | ( | ) | [signal] |
Emitted when KApplication has changed its palette due to a KControl request.
Normally, widgets will update their palette automatically, but you should connect to this to program special behavior.
void KApplication::kdisplayStyleChanged | ( | ) | [signal] |
Emitted when KApplication has changed its GUI style in response to a KControl 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 behavior.
uint KApplication::keyboardModifiers | ( | ) | [static] |
Qt::ButtonState KApplication::keyboardMouseState | ( | ) | [static] |
Returns the state of the currently pressed keyboard modifiers (e.g.
shift, control, etc.) and mouse buttons, similarly to QKeyEvent::state() and QMouseEvent::state(). You usually should simply use the information provided by QKeyEvent and QMouseEvent, but it can be useful to query for the status of the modifiers at another moment (e.g. some KDE apps do that upon a drop event).
- Returns:
- the keyboard modifiers and mouse buttons state
- Since:
- 3.4
Definition at line 3189 of file kapplication.cpp.
void KApplication::kipcMessage | ( | int | id, | |
int | data | |||
) | [signal] |
KDE_DEPRECATED KStyle* KApplication::kstyle | ( | ) | const [inline] |
QCString KApplication::launcher | ( | ) | [static] |
Returns the DCOP name of the service launcher.
This will be something like klaucher_$host_$uid.
- Returns:
- the name of the service launcher
Definition at line 2607 of file kapplication.cpp.
QString KApplication::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.
To make a compliant caption for your window, simply do: setCaption
(kapp->makeStdCaption(yourCaption));
- Parameters:
-
userCaption The caption string you want to display in the window caption area. Do not include the application name! withAppName Indicates that the method shall include or ignore the application name when making the caption string. You are not compliant if you set this to false
.modified If true, a 'modified' sign will be included in the returned string. This is useful when indicating that a file is modified, i.e., it contains data that has not been saved.
- Returns:
- the created caption
Definition at line 1971 of file kapplication.cpp.
QPixmap KApplication::miniIcon | ( | ) | const |
QString KApplication::miniIconName | ( | ) | const |
Returns the name of the mini-icon for the application.
- Returns:
- the mini icon's name
Definition at line 1628 of file kapplication.cpp.
uint KApplication::mouseState | ( | ) | [static] |
For internal use only.
Reimplemented from QApplication.
Definition at line 441 of file kapplication.cpp.
void KApplication::paste | ( | ) | [slot] |
If the widget with focus provides a paste() slot, call that slot.
Thus for a simple application copy can be implemented as:
KStdAction::paste( kapp, SLOT( paste() ), actionCollection() );
Definition at line 2591 of file kapplication.cpp.
void KApplication::propagateSessionManager | ( | ) |
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 1168 of file kapplication.cpp.
int KApplication::random | ( | ) | [static] |
Generates a uniform random number.
- Returns:
- A truly unpredictable number in the range [0, RAND_MAX)
Definition at line 2947 of file kapplication.cpp.
QString KApplication::randomString | ( | int | length | ) | [static] |
Generates a random string.
It operates in the range [A-Za-z0-9]
- Parameters:
-
length Generate a string of this length.
- Returns:
- the random string
Definition at line 2967 of file kapplication.cpp.
void KApplication::ref | ( | ) | [slot] |
Tells KApplication about one more operation that should be finished before the application exits.
The standard behavior is to exit on the "last window closed" event, but some events should outlive the last window closed (e.g. a file copy for a file manager, or 'compacting folders on exit' for a mail client).
Definition at line 1041 of file kapplication.cpp.
void KApplication::removeKipcEventMask | ( | int | id | ) |
Removes a message type from the KIPC event mask.
This message will not be handled anymore.
- Parameters:
-
id The message id.
- See also:
- KIPC
Definition at line 1901 of file kapplication.cpp.
void KApplication::removeX11EventFilter | ( | const QWidget * | filter | ) |
Removes global X11 event filter previously installed by installX11EventFilter().
Definition at line 424 of file kapplication.cpp.
bool KApplication::requestShutDown | ( | ShutdownConfirm | confirm = ShutdownConfirmDefault , |
|
ShutdownType | sdtype = ShutdownTypeDefault , |
|||
ShutdownMode | sdmode = ShutdownModeDefault | |||
) |
Asks the session manager to shut the session down.
Using confirm
== ShutdownConfirmYes or sdtype
!= ShutdownTypeDefault or sdmode
!= ShutdownModeDefault causes the use of ksmserver's DCOP interface. The remaining two combinations use the standard XSMP and will work with any session manager compliant with it.
- Parameters:
-
confirm Whether to ask the user if he really wants to log out. ShutdownConfirm sdtype The action to take after logging out. ShutdownType sdmode If/When the action should be taken. ShutdownMode
- Returns:
- true on success, false if the session manager could not be contacted.
Definition at line 1105 of file kapplication.cpp.
void KApplication::saveState | ( | QSessionManager & | sm | ) |
Reimplemented for internal purposes, mainly the highlevel handling of session management with KSessionManaged.
For internal use only.
Reimplemented from QApplication.
Definition at line 1276 of file kapplication.cpp.
void KApplication::saveYourself | ( | ) | [signal] |
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 KSessionManaged and reimplement the functions KSessionManaged::commitData() and/or KSessionManaged::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 shutDown() (see the following).
void KApplication::selectAll | ( | ) | [slot] |
If the widget with focus provides a selectAll() slot, call that slot.
Thus for a simple application select all can be implemented as:
KStdAction::selectAll( kapp, SLOT( selectAll() ), actionCollection() );
Definition at line 2601 of file kapplication.cpp.
KConfig * KApplication::sessionConfig | ( | ) |
Returns the application session config object.
- Returns:
- A pointer to the application's instance specific KConfig object.
- See also:
- KConfig
Definition at line 1031 of file kapplication.cpp.
bool KApplication::sessionSaving | ( | ) | const |
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
KMainWindow::queryExit
- Since:
- 3.1.1
Definition at line 1358 of file kapplication.cpp.
void KApplication::setStartupId | ( | const QCString & | startup_id | ) |
For internal use only.
Sets a new value for the application startup notification window property for newly created toplevel windows.
- Parameters:
-
startup_id the startup notification identifier
- See also:
- KStartupInfo::setNewStartupId
Definition at line 2914 of file kapplication.cpp.
void KApplication::settingsChanged | ( | int | category | ) | [signal] |
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.
- Parameters:
-
category the category among the enum above
void KApplication::setTopWidget | ( | QWidget * | topWidget | ) |
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.
- Parameters:
-
topWidget A top widget of the application.
Definition at line 2888 of file kapplication.cpp.
void KApplication::shutDown | ( | ) | [signal] |
Your application is killed.
Either by your program itself, xkill
or (the usual case) by KDE's logout.
The signal is particularly useful if your application has to do some last-second cleanups. Note that no user interaction is possible at this state.
void KApplication::startKdeinit | ( | ) | [static] |
int KApplication::startServiceByDesktopName | ( | const QString & | _name, | |
const QStringList & | URLs = QStringList() , |
|||
QString * | error = 0 , |
|||
QCString * | dcopService = 0 , |
|||
int * | pid = 0 , |
|||
const QCString & | startup_id = "" , |
|||
bool | noWait = false | |||
) | [static] |
Starts a service based on the desktop name of the service.
E.g. "konqueror"
- Parameters:
-
_name the desktop name of the service URLs if not empty these URLs will be passed to the service error On failure, error
contains a description of the error that occurred. If the pointer is 0, the argument will be ignoreddcopService On success, dcopService
contains the DCOP name under which this service is available. If empty, the service does not provide DCOP services. If the pointer is 0 the argument will be ignoredpid On success, the process id of the new service will be written here. If the pointer is 0, the argument will be ignored. startup_id for app startup notification, "0" for none, "" ( empty string ) is the default noWait if set, the function does not wait till the service is running.
- Returns:
- an error code indicating success (== 0) or failure (> 0).
Definition at line 2750 of file kapplication.cpp.
int KApplication::startServiceByDesktopName | ( | const QString & | _name, | |
const QString & | URL, | |||
QString * | error = 0 , |
|||
QCString * | dcopService = 0 , |
|||
int * | pid = 0 , |
|||
const QCString & | startup_id = "" , |
|||
bool | noWait = false | |||
) | [static] |
Starts a service based on the desktop name of the service.
E.g. "konqueror"
- Parameters:
-
_name the desktop name of the service URL if not empty this URL is passed to the service error On failure, error
contains a description of the error that occurred. If the pointer is 0, the argument will be ignoreddcopService On success, dcopService
contains the DCOP name under which this service is available. If empty, the service does not provide DCOP services. If the pointer is 0 the argument will be ignoredpid On success, the process id of the new service will be written here. If the pointer is 0, the argument will be ignored. startup_id for app startup notification, "0" for none, "" ( empty string ) is the default noWait if set, the function does not wait till the service is running.
- Returns:
- an error code indicating success (== 0) or failure (> 0).
Definition at line 2738 of file kapplication.cpp.
int KApplication::startServiceByDesktopPath | ( | const QString & | _name, | |
const QStringList & | URLs = QStringList() , |
|||
QString * | error = 0 , |
|||
QCString * | dcopService = 0 , |
|||
int * | pid = 0 , |
|||
const QCString & | startup_id = "" , |
|||
bool | noWait = false | |||
) | [static] |
Starts a service based on the desktop path of the service.
E.g. "Applications/konqueror.desktop" or "/home/user/bla/myfile.desktop"
- Parameters:
-
_name the path of the desktop file URLs if not empty these URLs will be passed to the service error On failure, error
contains a description of the error that occurred. If the pointer is 0, the argument will be ignoreddcopService On success, dcopService
contains the DCOP name under which this service is available. If empty, the service does not provide DCOP services. If the pointer is 0 the argument will be ignoredpid On success, the process id of the new service will be written here. If the pointer is 0, the argument will be ignored. startup_id for app startup notification, "0" for none, "" ( empty string ) is the default noWait if set, the function does not wait till the service is running.
- Returns:
- an error code indicating success (== 0) or failure (> 0).
Definition at line 2729 of file kapplication.cpp.
int KApplication::startServiceByDesktopPath | ( | const QString & | _name, | |
const QString & | URL, | |||
QString * | error = 0 , |
|||
QCString * | dcopService = 0 , |
|||
int * | pid = 0 , |
|||
const QCString & | startup_id = "" , |
|||
bool | noWait = false | |||
) | [static] |
Starts a service based on the desktop path of the service.
E.g. "Applications/konqueror.desktop" or "/home/user/bla/myfile.desktop"
- Parameters:
-
_name the path of the desktop file URL if not empty this URL is passed to the service error On failure, error
contains a description of the error that occurred. If the pointer is 0, the argument will be ignoreddcopService On success, dcopService
contains the DCOP name under which this service is available. If empty, the service does not provide DCOP services. If the pointer is 0 the argument will be ignoredpid On success, the process id of the new service will be written here. If the pointer is 0, the argument will be ignored. startup_id for app startup notification, "0" for none, "" ( empty string ) is the default noWait if set, the function does not wait till the service is running.
- Returns:
- an error code indicating success (== 0) or failure (> 0).
Definition at line 2717 of file kapplication.cpp.
int KApplication::startServiceByName | ( | const QString & | _name, | |
const QStringList & | URLs = QStringList() , |
|||
QString * | error = 0 , |
|||
QCString * | dcopService = 0 , |
|||
int * | pid = 0 , |
|||
const QCString & | startup_id = "" , |
|||
bool | noWait = false | |||
) | [static] |
Starts a service based on the (translated) name of the service.
E.g. "Web Browser"
- Parameters:
-
_name the name of the service URLs if not empty these URLs will be passed to the service error On failure, error
contains a description of the error that occurred. If the pointer is 0, the argument will be ignoreddcopService On success, dcopService
contains the DCOP name under which this service is available. If empty, the service does not provide DCOP services. If the pointer is 0 the argument will be ignoredpid On success, the process id of the new service will be written here. If the pointer is 0, the argument will be ignored. startup_id for app startup notification, "0" for none, "" ( empty string ) is the default noWait if set, the function does not wait till the service is running.
- Returns:
- an error code indicating success (== 0) or failure (> 0).
Definition at line 2708 of file kapplication.cpp.
int KApplication::startServiceByName | ( | const QString & | _name, | |
const QString & | URL, | |||
QString * | error = 0 , |
|||
QCString * | dcopService = 0 , |
|||
int * | pid = 0 , |
|||
const QCString & | startup_id = "" , |
|||
bool | noWait = false | |||
) | [static] |
Starts a service based on the (translated) name of the service.
E.g. "Web Browser"
- Parameters:
-
_name the name of the service URL if not empty this URL is passed to the service error On failure, error
contains a description of the error that occurred. If the pointer is 0, the argument will be ignoreddcopService On success, dcopService
contains the DCOP name under which this service is available. If empty, the service does not provide DCOP services. If the pointer is 0 the argument will be ignoredpid On success, the process id of the new service will be written here. If the pointer is 0, the argument will be ignored. startup_id for app startup notification, "0" for none, "" ( empty string ) is the default noWait if set, the function does not wait till the service is running.
- Returns:
- an error code indicating success (== 0) or failure (> 0).
Definition at line 2696 of file kapplication.cpp.
QCString KApplication::startupId | ( | ) | const |
Returns the app startup notification identifier for this running application.
- Returns:
- the startup notification identifier
Definition at line 2909 of file kapplication.cpp.
Get a file name in order to make a temporary copy of your document.
- Parameters:
-
pFilename The full path to the current file of your document.
- Returns:
- A new filename for auto-saving.
Definition at line 2788 of file kapplication.cpp.
void KApplication::toolbarAppearanceChanged | ( | int | ) | [signal] |
Emitted when the settings for toolbars have been changed.
KToolBar will know what to do.
void KApplication::updateIconLoaders | ( | ) | [signal] |
Updates the last user action timestamp in the application registered to DCOP with dcopId 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.
- Since:
- 3.3
Definition at line 1867 of file kapplication.cpp.
void KApplication::updateUserTimestamp | ( | unsigned long | time = 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.
- Since:
- 3.2
Definition at line 1838 of file kapplication.cpp.
unsigned long KApplication::userTimestamp | ( | ) | const |
Returns the last user action timestamp or 0 if no user activity has taken place yet.
- Since:
- 3.2.3
- See also:
- updateuserTimestamp
Definition at line 1858 of file kapplication.cpp.
void KApplication::virtual_hook | ( | int | id, | |
void * | data | |||
) | [protected, virtual] |
Reimplemented from KInstance.
Reimplemented in KUniqueApplication.
Definition at line 3266 of file kapplication.cpp.
int KApplication::xErrhandler | ( | Display * | dpy, | |
void * | err_ | |||
) |
int KApplication::xioErrhandler | ( | Display * | dpy | ) |
Member Data Documentation
Definition at line 1175 of file kapplication.h.
KApplication * KApplication::KApp = 0L [static, protected] |
Atom KApplication::kipcCommAtom [protected] |
Definition at line 1119 of file kapplication.h.
int KApplication::kipcEventMask [protected] |
Definition at line 1120 of file kapplication.h.
bool KApplication::loadedByKdeinit = false [static] |
Definition at line 1175 of file kapplication.h.
int KApplication::pArgc [protected] |
Definition at line 1124 of file kapplication.h.
struct { ... } KApplication::pm |
char KApplication::unused[sizeof(oldPixmapType)] |
Definition at line 1177 of file kapplication.h.
The documentation for this class was generated from the following files: