• 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);
132 
133 #ifdef Q_WS_X11
134 
151  KApplication(Display *display, bool allowStyles);
152 
180  KApplication(Display *display, bool disable_argb, Qt::HANDLE visual, Qt::HANDLE colormap, bool allowStyles);
181 
205  KApplication(Display *display, Qt::HANDLE visual = 0, Qt::HANDLE colormap = 0,
206  bool allowStyles=true);
207 
232  KApplication(Display *display, int& argc, char** argv, const TQCString& rAppName,
233  bool allowStyles=true, bool GUIenabled=true);
234 #endif
235 
258  // REMOVE FOR KDE 4.0 - using it only gives crashing applications because
259  // KCmdLineArgs::init isn't called
260  KApplication(int& argc, char** argv,
261  const TQCString& rAppName, bool allowStyles=true, bool GUIenabled=true) KDE_DEPRECATED;
262 
266  static void addCmdLineOptions();
267 
268  virtual ~KApplication();
269 
280  static KApplication* kApplication() { return KApp; }
281 
289  KConfig* sessionConfig();
290 
299  bool isRestored() const { return TQApplication::isSessionRestored(); }
300 
307  void disableSessionManagement();
308 
315  void enableSessionManagement();
316 
320  enum ShutdownConfirm {
324  ShutdownConfirmDefault = -1,
328  ShutdownConfirmNo = 0,
332  ShutdownConfirmYes = 1
333  };
334 
338  enum ShutdownType {
342  ShutdownTypeDefault = -1,
346  ShutdownTypeNone = 0,
350  ShutdownTypeReboot = 1,
354  ShutdownTypeHalt = 2
355  };
356 
360  enum ShutdownMode {
364  ShutdownModeDefault = -1,
369  ShutdownModeSchedule = 0,
373  ShutdownModeTryNow = 1,
377  ShutdownModeForceNow = 2,
381  ShutdownModeInteractive = 3
382  };
383 
399  bool requestShutDown( ShutdownConfirm confirm = ShutdownConfirmDefault,
400  ShutdownType sdtype = ShutdownTypeDefault,
401  ShutdownMode sdmode = ShutdownModeDefault );
402 
416  void propagateSessionManager();
417 
423  void commitData( TQSessionManager& sm );
424 
430  void saveState( TQSessionManager& sm );
431 
441  bool sessionSaving() const;
442 
449  static DCOPClient *dcopClient();
450 
455  static void disableAutoDcopRegistration();
456 
461  TQPixmap icon() const;
462 
467  TQString iconName() const;
468 
473  TQPixmap miniIcon() const;
474 
479  TQString miniIconName() const;
480 
491  void setTopWidget( TQWidget *topWidget );
492 
505  void invokeHelp( const TQString& anchor,
506  const TQString& appname,
507  const TQCString& startup_id ) const;
508 
509  // KDE4 merge with above with startup_id = ""
510  void invokeHelp( const TQString& anchor = TQString::null,
511  const TQString& appname = TQString::null ) const;
512 
527  void invokeHTMLHelp( const TQString& aFilename, const TQString& aTopic = TQString::null ) const KDE_DEPRECATED;
528 
537  void invokeMailer( const TQString &address, const TQString &subject, const TQCString& startup_id );
538  // KDE4 merge with above with startup_id = ""
539  void invokeMailer( const TQString &address, const TQString &subject );
540 
550  void invokeMailer( const KURL &mailtoURL, const TQCString& startup_id, bool allowAttachments );
551  // KDE4 merge with above with allowAttachments = false
552  void invokeMailer( const KURL &mailtoURL, const TQCString& startup_id );
553  // KDE4 merge with above with startup_id = ""
554  void invokeMailer( const KURL &mailtoURL );
555 
571  void invokeMailer(const TQString &to, const TQString &cc, const TQString &bcc,
572  const TQString &subject, const TQString &body,
573  const TQString &messageFile, const TQStringList &attachURLs,
574  const TQCString& startup_id );
575  // KDE4 merge with above with startup_id = ""
576  void invokeMailer(const TQString &to, const TQString &cc, const TQString &bcc,
577  const TQString &subject, const TQString &body,
578  const TQString &messageFile = TQString::null, const TQStringList &attachURLs = TQStringList());
579 
580 public slots:
591  void invokeBrowser( const TQString &url, const TQCString& startup_id );
592  // KDE4 merge with above with startup_id = ""
597  void invokeBrowser( const TQString &url );
598 
606  void cut();
607 
615  void copy();
616 
624  void paste();
625 
651  void clear();
652 
660  void selectAll();
661 
668  void broadcastKeyCode(unsigned int keyCode);
669 
670 public:
676  static TQCString launcher();
677 
698  static int startServiceByName( const TQString& _name, const TQString &URL,
699  TQString *error=0, TQCString *dcopService=0, int *pid=0, const TQCString &startup_id = "", bool noWait = false );
700 
721  static int startServiceByName( const TQString& _name, const TQStringList &URLs=TQStringList(),
722  TQString *error=0, TQCString *dcopService=0, int *pid=0, const TQCString &startup_id = "", bool noWait = false );
723 
744  static int startServiceByDesktopPath( const TQString& _name, const TQString &URL,
745  TQString *error=0, TQCString *dcopService=0, int *pid = 0, const TQCString &startup_id = "", bool noWait = false );
746 
767  static int startServiceByDesktopPath( const TQString& _name, const TQStringList &URLs=TQStringList(),
768  TQString *error=0, TQCString *dcopService=0, int *pid = 0, const TQCString &startup_id = "", bool noWait = false );
769 
790  static int startServiceByDesktopName( const TQString& _name, const TQString &URL,
791  TQString *error=0, TQCString *dcopService=0, int *pid = 0, const TQCString &startup_id = "", bool noWait = false );
792 
813  static int startServiceByDesktopName( const TQString& _name, const TQStringList &URLs=TQStringList(),
814  TQString *error=0, TQCString *dcopService=0, int *pid = 0, const TQCString &startup_id = "", bool noWait = false );
815 
833  static int kdeinitExec( const TQString& name, const TQStringList &args,
834  TQString *error, int *pid, const TQCString& startup_id );
835  // KDE4 merge with above with startup_id = ""
836  static int kdeinitExec( const TQString& name, const TQStringList &args=TQStringList(),
837  TQString *error=0, int *pid = 0 );
838 
856  static int kdeinitExecWait( const TQString& name, const TQStringList &args,
857  TQString *error, int *pid, const TQCString& startup_id );
858  // KDE4 merge with above with startup_id = ""
859  static int kdeinitExecWait( const TQString& name, const TQStringList &args=TQStringList(),
860  TQString *error=0, int *pid = 0 );
861 
870  TQString caption() const;
871 
875  KDE_DEPRECATED KStyle* kstyle() const { return 0; }
876 
894  TQString makeStdCaption( const TQString &userCaption,
895  bool withAppName=true, bool modified=false ) const;
896 
904  TQString tempSaveName( const TQString& pFilename ) const;
905 
915  TQString checkRecoverFile( const TQString& pFilename, bool& bRecover ) const;
916 
917 #if defined(Q_WS_X11)
918 
923  Display *getDisplay() { return display; }
924 #endif
925 
930  void getX11RGBAInformation(Display *dpy);
931 
939  static bool isCompositionManagerAvailable();
940 
949  bool detectCompositionManagerAvailable(bool force_available=false, bool available=true);
950 
959  static Display* openX11RGBADisplay();
960 
966  Qt::HANDLE getX11RGBAVisual(Display *dpy);
967 
973  Qt::HANDLE getX11RGBAColormap(Display *dpy);
974 
991  bool isX11CompositionAvailable();
992 
1000  void enableStyles();
1001 
1009  void disableStyles();
1010 
1020  void installX11EventFilter( TQWidget* filter );
1021 
1026  void removeX11EventFilter( const TQWidget* filter );
1027 
1032  static int random();
1033 
1039  static TQString randomString(int length);
1040 
1050  void addKipcEventMask(int id);
1051 
1060  void removeKipcEventMask(int id);
1061 
1067  TQCString startupId() const;
1068 
1076  void setStartupId( const TQCString& startup_id );
1077 
1084  void updateUserTimestamp( unsigned long time = 0 );
1085 
1091  unsigned long userTimestamp() const;
1092 
1101  void updateRemoteUserTimestamp( const TQCString& dcopId, unsigned long time = 0 );
1102 
1108  TQString geometryArgument() const;
1109 
1114  void installKDEPropertyMap();
1115 
1121  bool authorize(const TQString &genericAction);
1122 
1130  bool authorizeKAction(const char *action);
1131 
1145  bool authorizeURLAction(const TQString &action, const KURL &baseURL, const KURL &destURL);
1146 
1156  void allowURLAction(const TQString &action, const KURL &_baseURL, const KURL &_destURL);
1157 
1165  bool authorizeControlModule(const TQString &menuId);
1166 
1175  TQStringList authorizeControlModules(const TQStringList &menuIds);
1176 
1186  static ButtonState keyboardMouseState();
1187 
1188  // Same values as ShiftMask etc. in X.h
1189  enum { ShiftModifier = 1<<0,
1190  LockModifier = 1<<1,
1191  ControlModifier = 1<<2,
1192  Modifier1 = 1<<3,
1193  Modifier2 = 1<<4,
1194  Modifier3 = 1<<5,
1195  Modifier4 = 1<<6,
1196  Modifier5 = 1<<7 };
1201  static uint keyboardModifiers() KDE_DEPRECATED;
1202 
1204  enum { Button1Pressed = 1<<8,
1205  Button2Pressed = 1<<9,
1206  Button3Pressed = 1<<10,
1207  Button4Pressed = 1<<11,
1208  Button5Pressed = 1<<12 };
1213  static uint mouseState() KDE_DEPRECATED;
1214 
1215 
1216 public slots:
1223  void ref();
1224 
1229  void deref();
1230 
1231 protected:
1235  KApplication( bool allowStyles, bool GUIenabled, KInstance* _instance );
1236 
1237 #ifdef Q_WS_X11
1238 
1241  KApplication( Display *display, Qt::HANDLE visual, Qt::HANDLE colormap,
1242  bool allowStyles, KInstance* _instance );
1243 
1247  bool x11EventFilter( XEvent * );
1248 
1249  Display *display;
1250 #endif
1251  Atom kipcCommAtom;
1252  int kipcEventMask;
1253 
1255  static KApplication *KApp;
1256  int pArgc;
1257 
1289  void invokeEditSlot( const char *slot );
1290 
1291 private slots:
1292  void dcopFailure(const TQString &);
1293  void dcopBlockUserInput( bool );
1294  void x11FilterDestroyed();
1295  void checkAppStartedSlot();
1296 
1297 private:
1298  TQString sessionConfigName() const;
1299  KConfig* pSessionConfig; //instance specific application config object
1300  static DCOPClient *s_DCOPClient; // app specific application communication client
1301  static bool s_dcopClientNeedsPostInit;
1302  TQString aCaption; // the name for the window title
1303  bool bSessionManagement;
1304  struct oldPixmapType { TQPixmap a, b; };
1305  mutable union {
1306  struct {
1307  TQPixmap *icon, *miniIcon;
1308  } pm;
1309  char unused[sizeof(oldPixmapType)];
1310  } aIconPixmap; // KDE4: remove me
1311  TQString aIconName;
1312  TQString aMiniIconName;
1313  bool useStyles;
1314  TQWidget *smw;
1315 
1316  void init( bool GUIenabled );
1317 
1318  void parseCommandLine( ); // Handle KDE arguments (Using KCmdLineArgs)
1319 
1320  void read_app_startup_id();
1321 
1322  void dcopAutoRegistration();
1323  void dcopClientPostInit();
1324  void initUrlActionRestrictions();
1325 
1326  bool argb_visual;
1327 #if defined(Q_WS_X11)
1328  Qt::HANDLE argb_x11_visual;
1329  Qt::HANDLE argb_x11_colormap;
1330 #endif
1331 
1332 public:
1336  bool notify(TQObject *receiver, TQEvent *event);
1337 
1341  int xErrhandler( Display*, void* );
1342 
1346  int xioErrhandler( Display* );
1347 
1351  void iceIOErrorHandler( _IceConn *conn );
1352 
1356  static bool loadedByKdeinit;
1357 
1361  static void startKdeinit();
1362 
1366  enum SettingsCategory { SETTINGS_MOUSE, SETTINGS_COMPLETION, SETTINGS_PATHS,
1367  SETTINGS_POPUPMENU, SETTINGS_QT, SETTINGS_SHORTCUTS };
1368 
1377  static TQPalette createApplicationPalette();
1378 
1383  static TQPalette createApplicationPalette( KConfig *config, int contrast );
1384 
1392  static void installSigpipeHandler();
1393 
1400  static bool guiEnabled();
1401 
1402 signals:
1409  void kdisplayPaletteChanged();
1410 
1418  void kdisplayStyleChanged();
1419 
1431  void kdisplayFontChanged();
1432 
1438  void appearanceChanged();
1439 
1443  void toolbarAppearanceChanged(int);
1444 
1450  void backgroundChanged(int desk);
1451 
1458  void settingsChanged(int category);
1459 
1464  void iconChanged(int group);
1465 
1475  void kipcMessage(int id, int data);
1476 
1506  void saveYourself();
1507 
1515  void shutDown();
1516 
1521  void updateIconLoaders();
1522 
1527  void coreFakeKeyPress(unsigned int keyCode);
1528 
1529 private:
1530  void propagateSettings(SettingsCategory category);
1531  void kdisplaySetPalette();
1532  void kdisplaySetStyle();
1533  void kdisplaySetFont();
1534  void applyGUIStyle();
1535  static void sigpipeHandler(int);
1536 
1537  int captionLayout;
1538 
1539  KApplication(const KApplication&);
1540  KApplication& operator=(const KApplication&);
1541 protected:
1542  virtual void virtual_hook( int id, void* data );
1543 private:
1544  KApplicationPrivate* d;
1545 };
1546 
1547 
1565 KDECORE_EXPORT bool checkAccess(const TQString& pathname, int mode);
1566 
1567 class KSessionManagedPrivate;
1568 
1585 class KDECORE_EXPORT KSessionManaged
1586 {
1587 public:
1588  KSessionManaged();
1589  virtual ~KSessionManaged();
1590 
1600  virtual bool saveState( TQSessionManager& sm );
1610  virtual bool commitData( TQSessionManager& sm );
1611 
1612 protected:
1613  virtual void virtual_hook( int id, void* data );
1614 private:
1615  KSessionManagedPrivate *d;
1616 };
1617 
1618 
1619 #endif
1620 

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.3.1
This website is maintained by Timothy Pearson.
KDE® and the K Desktop Environment® logo are registered trademarks of KDE e.V. |