• Skip to content
  • Skip to link menu
Trinity API Reference
  • Trinity API Reference
  • kdecore
 

kdecore

  • kdecore
kapplication.h
1 /* This file is part of the KDE libraries
2  Copyright (C) 1997 Matthias Kalle Dalheimer (kalle@kde.org)
3  Copyright (c) 1998, 1999 KDE Team
4 
5  This library is free software; you can redistribute it and/or
6  modify it under the terms of the GNU Library General Public
7  License as published by the Free Software Foundation; either
8  version 2 of the License, or (at your option) any later version.
9 
10  This library is distributed in the hope that it will be useful,
11  but WITHOUT ANY WARRANTY; without even the implied warranty of
12  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13  Library General Public License for more details.
14 
15  You should have received a copy of the GNU Library General Public License
16  along with this library; see the file COPYING.LIB. If not, write to
17  the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
18  Boston, MA 02110-1301, USA.
19 */
20 
21 #ifndef _KAPP_H
22 #define _KAPP_H
23 
24 // Version macros. Never put this further down.
25 #include "kdeversion.h"
26 #include "kdelibs_export.h"
27 
28 class KConfig;
29 class KCharsets;
30 class DCOPClient;
31 class DCOPObject;
32 
33 #include <tqtglobaldefines.h>
34 
35 typedef unsigned long Atom;
36 #if !defined(Q_WS_X11)
37 typedef void Display;
38 #endif
39 
40 #include <tqapplication.h>
41 #include <tqpixmap.h>
42 #include <kinstance.h>
43 
44 struct _IceConn;
45 class TQPopupMenu;
46 class TQStrList;
47 class KSessionManaged;
48 class KStyle;
49 class KURL;
50 
51 #define kapp KApplication::kApplication()
52 
53 class KApplicationPrivate;
54 
96 class KDECORE_EXPORT KApplication : public TQApplication, public KInstance
97 {
98 
99  Q_OBJECT
100 public:
106  enum CaptionLayout {
107  CaptionAppLast=1 ,
108  CaptionAppFirst ,
109  CaptionNoApp
110  };
111 
131  KApplication( bool allowStyles=true, bool GUIenabled=true, bool SMenabled=true);
132 
133 #ifdef Q_QDOC
134 #else // Q_QDOC
135 #ifdef TDEAPPLICATION_BINARY_COMPAT_HACK
136  // FIXME
137  // FOR BINARY COMPATIBILITY ONLY
138  // REMOVE WHEN PRACTICAL!
139  KApplication( bool allowStyles=true, bool GUIenabled=true);
140 #endif // TDEAPPLICATION_BINARY_COMPAT_HACK
141 #endif // Q_QDOC
142 
143 #ifdef Q_WS_X11
144 
161  KApplication(Display *display, bool allowStyles);
162 
190  KApplication(Display *display, bool disable_argb, Qt::HANDLE visual, Qt::HANDLE colormap, bool allowStyles);
191 
215  KApplication(Display *display, Qt::HANDLE visual = 0, Qt::HANDLE colormap = 0,
216  bool allowStyles=true);
217 
242  KApplication(Display *display, int& argc, char** argv, const TQCString& rAppName,
243  bool allowStyles=true, bool GUIenabled=true);
244 #endif
245 
268  // REMOVE FOR KDE 4.0 - using it only gives crashing applications because
269  // KCmdLineArgs::init isn't called
270  KApplication(int& argc, char** argv,
271  const TQCString& rAppName, bool allowStyles=true, bool GUIenabled=true, bool SMenabled=true) KDE_DEPRECATED;
272 
273 #ifdef Q_QDOC
274 #else // Q_QDOC
275 #ifdef TDEAPPLICATION_BINARY_COMPAT_HACK
276  // FIXME
277  // FOR BINARY COMPATIBILITY ONLY
278  // REMOVE WHEN PRACTICAL!
279  KApplication(int& argc, char** argv,
280  const TQCString& rAppName, bool allowStyles, bool GUIenabled) KDE_DEPRECATED;
281 #endif // TDEAPPLICATION_BINARY_COMPAT_HACK
282 #endif // Q_QDOC
283 
287  static void addCmdLineOptions();
288 
289  virtual ~KApplication();
290 
301  static KApplication* kApplication() { return KApp; }
302 
310  KConfig* sessionConfig();
311 
320  bool isRestored() const { return TQApplication::isSessionRestored(); }
321 
328  void disableSessionManagement();
329 
336  void enableSessionManagement();
337 
341  enum ShutdownConfirm {
345  ShutdownConfirmDefault = -1,
349  ShutdownConfirmNo = 0,
353  ShutdownConfirmYes = 1
354  };
355 
359  enum ShutdownType {
363  ShutdownTypeDefault = -1,
367  ShutdownTypeNone = 0,
371  ShutdownTypeReboot = 1,
375  ShutdownTypeHalt = 2
376  };
377 
381  enum ShutdownMode {
385  ShutdownModeDefault = -1,
390  ShutdownModeSchedule = 0,
394  ShutdownModeTryNow = 1,
398  ShutdownModeForceNow = 2,
402  ShutdownModeInteractive = 3
403  };
404 
420  bool requestShutDown( ShutdownConfirm confirm = ShutdownConfirmDefault,
421  ShutdownType sdtype = ShutdownTypeDefault,
422  ShutdownMode sdmode = ShutdownModeDefault );
423 
437  void propagateSessionManager();
438 
444  void commitData( TQSessionManager& sm );
445 
451  void saveState( TQSessionManager& sm );
452 
462  bool sessionSaving() const;
463 
470  static DCOPClient *dcopClient();
471 
476  static void disableAutoDcopRegistration();
477 
482  TQPixmap icon() const;
483 
488  TQString iconName() const;
489 
494  TQPixmap miniIcon() const;
495 
500  TQString miniIconName() const;
501 
512  void setTopWidget( TQWidget *topWidget );
513 
526  void invokeHelp( const TQString& anchor,
527  const TQString& appname,
528  const TQCString& startup_id ) const;
529 
530  // KDE4 merge with above with startup_id = ""
531  void invokeHelp( const TQString& anchor = TQString::null,
532  const TQString& appname = TQString::null ) const;
533 
548  void invokeHTMLHelp( const TQString& aFilename, const TQString& aTopic = TQString::null ) const KDE_DEPRECATED;
549 
558  void invokeMailer( const TQString &address, const TQString &subject, const TQCString& startup_id );
559  // KDE4 merge with above with startup_id = ""
560  void invokeMailer( const TQString &address, const TQString &subject );
561 
571  void invokeMailer( const KURL &mailtoURL, const TQCString& startup_id, bool allowAttachments );
572  // KDE4 merge with above with allowAttachments = false
573  void invokeMailer( const KURL &mailtoURL, const TQCString& startup_id );
574  // KDE4 merge with above with startup_id = ""
575  void invokeMailer( const KURL &mailtoURL );
576 
592  void invokeMailer(const TQString &to, const TQString &cc, const TQString &bcc,
593  const TQString &subject, const TQString &body,
594  const TQString &messageFile, const TQStringList &attachURLs,
595  const TQCString& startup_id );
596  // KDE4 merge with above with startup_id = ""
597  void invokeMailer(const TQString &to, const TQString &cc, const TQString &bcc,
598  const TQString &subject, const TQString &body,
599  const TQString &messageFile = TQString::null, const TQStringList &attachURLs = TQStringList());
600 
601 public slots:
612  void invokeBrowser( const TQString &url, const TQCString& startup_id );
613  // KDE4 merge with above with startup_id = ""
618  void invokeBrowser( const TQString &url );
619 
627  void cut();
628 
636  void copy();
637 
645  void paste();
646 
672  void clear();
673 
681  void selectAll();
682 
689  void broadcastKeyCode(unsigned int keyCode);
690 
691 public:
697  static TQCString launcher();
698 
719  static int startServiceByName( const TQString& _name, const TQString &URL,
720  TQString *error=0, TQCString *dcopService=0, int *pid=0, const TQCString &startup_id = "", bool noWait = false );
721 
742  static int startServiceByName( const TQString& _name, const TQStringList &URLs=TQStringList(),
743  TQString *error=0, TQCString *dcopService=0, int *pid=0, const TQCString &startup_id = "", bool noWait = false );
744 
765  static int startServiceByDesktopPath( const TQString& _name, const TQString &URL,
766  TQString *error=0, TQCString *dcopService=0, int *pid = 0, const TQCString &startup_id = "", bool noWait = false );
767 
788  static int startServiceByDesktopPath( const TQString& _name, const TQStringList &URLs=TQStringList(),
789  TQString *error=0, TQCString *dcopService=0, int *pid = 0, const TQCString &startup_id = "", bool noWait = false );
790 
811  static int startServiceByDesktopName( const TQString& _name, const TQString &URL,
812  TQString *error=0, TQCString *dcopService=0, int *pid = 0, const TQCString &startup_id = "", bool noWait = false );
813 
834  static int startServiceByDesktopName( const TQString& _name, const TQStringList &URLs=TQStringList(),
835  TQString *error=0, TQCString *dcopService=0, int *pid = 0, const TQCString &startup_id = "", bool noWait = false );
836 
854  static int kdeinitExec( const TQString& name, const TQStringList &args,
855  TQString *error, int *pid, const TQCString& startup_id );
856  // KDE4 merge with above with startup_id = ""
857  static int kdeinitExec( const TQString& name, const TQStringList &args=TQStringList(),
858  TQString *error=0, int *pid = 0 );
859 
877  static int kdeinitExecWait( const TQString& name, const TQStringList &args,
878  TQString *error, int *pid, const TQCString& startup_id );
879  // KDE4 merge with above with startup_id = ""
880  static int kdeinitExecWait( const TQString& name, const TQStringList &args=TQStringList(),
881  TQString *error=0, int *pid = 0 );
882 
891  TQString caption() const;
892 
896  KDE_DEPRECATED KStyle* kstyle() const { return 0; }
897 
915  TQString makeStdCaption( const TQString &userCaption,
916  bool withAppName=true, bool modified=false ) const;
917 
925  TQString tempSaveName( const TQString& pFilename ) const;
926 
936  TQString checkRecoverFile( const TQString& pFilename, bool& bRecover ) const;
937 
938 #if defined(Q_WS_X11)
939 
944  Display *getDisplay() { return display; }
945 #endif
946 
951  void getX11RGBAInformation(Display *dpy);
952 
960  static bool isCompositionManagerAvailable();
961 
970  bool detectCompositionManagerAvailable(bool force_available=false, bool available=true);
971 
980  static Display* openX11RGBADisplay();
981 
987  Qt::HANDLE getX11RGBAVisual(Display *dpy);
988 
994  Qt::HANDLE getX11RGBAColormap(Display *dpy);
995 
1012  bool isX11CompositionAvailable();
1013 
1021  void enableStyles();
1022 
1030  void disableStyles();
1031 
1041  void installX11EventFilter( TQWidget* filter );
1042 
1047  void removeX11EventFilter( const TQWidget* filter );
1048 
1053  static int random();
1054 
1060  static TQString randomString(int length);
1061 
1071  void addKipcEventMask(int id);
1072 
1081  void removeKipcEventMask(int id);
1082 
1088  TQCString startupId() const;
1089 
1097  void setStartupId( const TQCString& startup_id );
1098 
1105  void updateUserTimestamp( unsigned long time = 0 );
1106 
1112  unsigned long userTimestamp() const;
1113 
1122  void updateRemoteUserTimestamp( const TQCString& dcopId, unsigned long time = 0 );
1123 
1129  TQString geometryArgument() const;
1130 
1135  void installKDEPropertyMap();
1136 
1142  bool authorize(const TQString &genericAction);
1143 
1151  bool authorizeKAction(const char *action);
1152 
1166  bool authorizeURLAction(const TQString &action, const KURL &baseURL, const KURL &destURL);
1167 
1177  void allowURLAction(const TQString &action, const KURL &_baseURL, const KURL &_destURL);
1178 
1186  bool authorizeControlModule(const TQString &menuId);
1187 
1196  TQStringList authorizeControlModules(const TQStringList &menuIds);
1197 
1207  static ButtonState keyboardMouseState();
1208 
1209  // Same values as ShiftMask etc. in X.h
1210  enum { ShiftModifier = 1<<0,
1211  LockModifier = 1<<1,
1212  ControlModifier = 1<<2,
1213  Modifier1 = 1<<3,
1214  Modifier2 = 1<<4,
1215  Modifier3 = 1<<5,
1216  Modifier4 = 1<<6,
1217  Modifier5 = 1<<7 };
1222  static uint keyboardModifiers() KDE_DEPRECATED;
1223 
1225  enum { Button1Pressed = 1<<8,
1226  Button2Pressed = 1<<9,
1227  Button3Pressed = 1<<10,
1228  Button4Pressed = 1<<11,
1229  Button5Pressed = 1<<12 };
1234  static uint mouseState() KDE_DEPRECATED;
1235 
1236 
1237 public slots:
1244  void ref();
1245 
1250  void deref();
1251 
1252 protected:
1256  KApplication( bool allowStyles, bool GUIenabled, KInstance* _instance );
1257 
1258 #ifdef Q_WS_X11
1259 
1262  KApplication( Display *display, Qt::HANDLE visual, Qt::HANDLE colormap,
1263  bool allowStyles, KInstance* _instance );
1264 
1268  bool x11EventFilter( XEvent * );
1269 
1270  Display *display;
1271 #endif
1272  Atom kipcCommAtom;
1273  int kipcEventMask;
1274 
1276  static KApplication *KApp;
1277  int pArgc;
1278 
1310  void invokeEditSlot( const char *slot );
1311 
1312 private slots:
1313  void dcopFailure(const TQString &);
1314  void dcopBlockUserInput( bool );
1315  void x11FilterDestroyed();
1316  void checkAppStartedSlot();
1317 
1318 private:
1319  TQString sessionConfigName() const;
1320  KConfig* pSessionConfig; //instance specific application config object
1321  static DCOPClient *s_DCOPClient; // app specific application communication client
1322  static bool s_dcopClientNeedsPostInit;
1323  TQString aCaption; // the name for the window title
1324  bool bSessionManagement;
1325  struct oldPixmapType { TQPixmap a, b; };
1326  mutable union {
1327  struct {
1328  TQPixmap *icon, *miniIcon;
1329  } pm;
1330  char unused[sizeof(oldPixmapType)];
1331  } aIconPixmap; // KDE4: remove me
1332  TQString aIconName;
1333  TQString aMiniIconName;
1334  bool useStyles;
1335  TQWidget *smw;
1336 
1337  void init( bool GUIenabled );
1338 
1339  void parseCommandLine( ); // Handle KDE arguments (Using KCmdLineArgs)
1340 
1341  void read_app_startup_id();
1342 
1343  void dcopAutoRegistration();
1344  void dcopClientPostInit();
1345  void initUrlActionRestrictions();
1346 
1347  bool argb_visual;
1348 #if defined(Q_WS_X11)
1349  Qt::HANDLE argb_x11_visual;
1350  Qt::HANDLE argb_x11_colormap;
1351 #endif
1352 
1353 public:
1357  bool notify(TQObject *receiver, TQEvent *event);
1358 
1362  int xErrhandler( Display*, void* );
1363 
1367  int xioErrhandler( Display* );
1368 
1372  void iceIOErrorHandler( _IceConn *conn );
1373 
1377  static bool loadedByKdeinit;
1378 
1382  static void startKdeinit();
1383 
1387  enum SettingsCategory { SETTINGS_MOUSE, SETTINGS_COMPLETION, SETTINGS_PATHS,
1388  SETTINGS_POPUPMENU, SETTINGS_QT, SETTINGS_SHORTCUTS };
1389 
1398  static TQPalette createApplicationPalette();
1399 
1404  static TQPalette createApplicationPalette( KConfig *config, int contrast );
1405 
1413  static void installSigpipeHandler();
1414 
1421  static bool guiEnabled();
1422 
1423 signals:
1430  void kdisplayPaletteChanged();
1431 
1439  void kdisplayStyleChanged();
1440 
1452  void kdisplayFontChanged();
1453 
1459  void appearanceChanged();
1460 
1464  void toolbarAppearanceChanged(int);
1465 
1471  void backgroundChanged(int desk);
1472 
1479  void settingsChanged(int category);
1480 
1485  void iconChanged(int group);
1486 
1496  void kipcMessage(int id, int data);
1497 
1527  void saveYourself();
1528 
1536  void shutDown();
1537 
1542  void updateIconLoaders();
1543 
1548  void coreFakeKeyPress(unsigned int keyCode);
1549 
1550 private:
1551  void propagateSettings(SettingsCategory category);
1552  void kdisplaySetPalette();
1553  void kdisplaySetStyle();
1554  void kdisplaySetFont();
1555  void applyGUIStyle();
1556  static void sigpipeHandler(int);
1557 
1558  int captionLayout;
1559 
1560  KApplication(const KApplication&);
1561  KApplication& operator=(const KApplication&);
1562 protected:
1563  virtual void virtual_hook( int id, void* data );
1564 private:
1565  KApplicationPrivate* d;
1566 };
1567 
1568 
1586 KDECORE_EXPORT bool checkAccess(const TQString& pathname, int mode);
1587 
1588 class KSessionManagedPrivate;
1589 
1606 class KDECORE_EXPORT KSessionManaged
1607 {
1608 public:
1609  KSessionManaged();
1610  virtual ~KSessionManaged();
1611 
1621  virtual bool saveState( TQSessionManager& sm );
1631  virtual bool commitData( TQSessionManager& sm );
1632 
1633 protected:
1634  virtual void virtual_hook( int id, void* data );
1635 private:
1636  KSessionManagedPrivate *d;
1637 };
1638 
1639 
1640 #endif
1641 
KURL
Represents and parses a URL.
Definition: kurl.h:127
KApplication
Controls and provides information to all KDE applications.
Definition: kapplication.h:96
KApplication::ShutdownConfirm
ShutdownConfirm
The possible values for the confirm parameter of requestShutDown().
Definition: kapplication.h:341
KApplication::ShutdownType
ShutdownType
The possible values for the sdtype parameter of requestShutDown().
Definition: kapplication.h:359
KCharsets
Charset font and encoder/decoder handling.
Definition: kcharsets.h:43
KApplication::SettingsCategory
SettingsCategory
Valid values for the settingsChanged signal.
Definition: kapplication.h:1387
KApplication::KApp
static KApplication * KApp
Current application object.
Definition: kapplication.h:1276
DCOPClient
KGlobal::checkAccess
bool checkAccess(const TQString &pathname, int mode)
Definition: kapplication.cpp:3238
KInstance
Access to KDE global objects for use in shared libraries.
Definition: kinstance.h:43
KApplication::isRestored
bool isRestored() const
Is the application restored from the session manager?
Definition: kapplication.h:320
KConfig
Access KDE Configuration entries.
Definition: kconfig.h:43
KApplication::kApplication
static KApplication * kApplication()
Returns the current application object.
Definition: kapplication.h:301
KApplication::CaptionLayout
CaptionLayout
Position of the caption (presumably in the application window's title bar).
Definition: kapplication.h:106
DCOPObject
KSessionManaged
Provides highlevel access to session management on a per-object base.
Definition: kapplication.h:1606
KApplication::ShutdownMode
ShutdownMode
The possible values for the sdmode parameter of requestShutDown().
Definition: kapplication.h:381

kdecore

Skip menu "kdecore"
  • Main Page
  • Modules
  • Namespace List
  • Class Hierarchy
  • Alphabetical List
  • Class List
  • File List
  • Namespace Members
  • Class Members
  • Related Pages

kdecore

Skip menu "kdecore"
  • arts
  • dcop
  • dnssd
  • interfaces
  •     interface
  •     library
  •   kspeech
  •   ktexteditor
  • kabc
  • kate
  • kcmshell
  • kdecore
  • kded
  • kdefx
  • kdeprint
  • kdesu
  • kdeui
  • kdoctools
  • khtml
  • kimgio
  • kinit
  • kio
  •   bookmarks
  •   httpfilter
  •   kfile
  •   kio
  •   kioexec
  •   kpasswdserver
  •   kssl
  • kioslave
  •   http
  • kjs
  • kmdi
  •   kmdi
  • knewstuff
  • kparts
  • krandr
  • kresources
  • kspell2
  • kunittest
  • kutils
  • kwallet
  • libkmid
  • libkscreensaver
Generated for kdecore by doxygen 1.8.6
This website is maintained by Timothy Pearson.
KDE® and the K Desktop Environment® logo are registered trademarks of KDE e.V. |