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

tdecore

  • tdecore
tdeapplication.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 _TDEAPP_H
22 #define _TDEAPP_H
23 
24 // Version macros. Never put this further down.
25 #include "tdeversion.h"
26 #include "tdelibs_export.h"
27 
28 class TDEConfig;
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 TDEStyle;
49 class KURL;
50 
51 #define kapp TDEApplication::kApplication()
52 
53 class TDEApplicationPrivate;
54 
96 class TDECORE_EXPORT TDEApplication : public TQApplication, public TDEInstance
97 {
98 
99  Q_OBJECT
100 public:
106  enum CaptionLayout {
107  CaptionAppLast=1 ,
108  CaptionAppFirst ,
109  CaptionNoApp
110  };
111 
131  TDEApplication( 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  TDEApplication( bool allowStyles=true, bool GUIenabled=true);
140 #endif // TDEAPPLICATION_BINARY_COMPAT_HACK
141 #endif // Q_QDOC
142 
143 #ifdef Q_WS_X11
144 
161  TDEApplication(Display *display, bool allowStyles);
162 
190  TDEApplication(Display *display, bool disable_argb, Qt::HANDLE visual, Qt::HANDLE colormap, bool allowStyles);
191 
215  TDEApplication(Display *display, Qt::HANDLE visual = 0, Qt::HANDLE colormap = 0,
216  bool allowStyles=true);
217 
242  TDEApplication(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  // TDECmdLineArgs::init isn't called
270  TDEApplication(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  TDEApplication(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 ~TDEApplication();
290 
301  static TDEApplication* kApplication() { return KApp; }
302 
310  TDEConfig* 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 tdeinitExec( 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 tdeinitExec( const TQString& name, const TQStringList &args=TQStringList(),
858  TQString *error=0, int *pid = 0 );
859 
877  static int tdeinitExecWait( 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 tdeinitExecWait( const TQString& name, const TQStringList &args=TQStringList(),
881  TQString *error=0, int *pid = 0 );
882 
891  TQString caption() const;
892 
896  KDE_DEPRECATED TDEStyle* tdestyle() 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 authorizeTDEAction(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 
1241  static int currentX11VT();
1242 
1243 
1244 public slots:
1251  void ref();
1252 
1257  void deref();
1258 
1259 protected:
1263  TDEApplication( bool allowStyles, bool GUIenabled, TDEInstance* _instance );
1264 
1265 #ifdef Q_WS_X11
1266 
1269  TDEApplication( Display *display, Qt::HANDLE visual, Qt::HANDLE colormap,
1270  bool allowStyles, TDEInstance* _instance );
1271 
1275  bool x11EventFilter( XEvent * );
1276 
1277  Display *display;
1278 #endif
1279  Atom kipcCommAtom;
1280  int kipcEventMask;
1281 
1283  static TDEApplication *KApp;
1284  int pArgc;
1285 
1317  void invokeEditSlot( const char *slot );
1318 
1319 private slots:
1320  void dcopFailure(const TQString &);
1321  void dcopBlockUserInput( bool );
1322  void x11FilterDestroyed();
1323  void checkAppStartedSlot();
1324 
1325 private:
1326  TQString sessionConfigName() const;
1327  TDEConfig* pSessionConfig; //instance specific application config object
1328  static DCOPClient *s_DCOPClient; // app specific application communication client
1329  static bool s_dcopClientNeedsPostInit;
1330  TQString aCaption; // the name for the window title
1331  bool bSessionManagement;
1332  struct oldPixmapType { TQPixmap a, b; };
1333  mutable union {
1334  struct {
1335  TQPixmap *icon, *miniIcon;
1336  } pm;
1337  char unused[sizeof(oldPixmapType)];
1338  } aIconPixmap; // KDE4: remove me
1339  TQString aIconName;
1340  TQString aMiniIconName;
1341  bool useStyles;
1342  TQWidget *smw;
1343 
1344  void init( bool GUIenabled );
1345 
1346  void parseCommandLine( ); // Handle KDE arguments (Using TDECmdLineArgs)
1347 
1348  void read_app_startup_id();
1349 
1350  void dcopAutoRegistration();
1351  void dcopClientPostInit();
1352  void initUrlActionRestrictions();
1353 
1354  bool argb_visual;
1355 #if defined(Q_WS_X11)
1356  Qt::HANDLE argb_x11_visual;
1357  Qt::HANDLE argb_x11_colormap;
1358 #endif
1359 
1360 public:
1364  bool notify(TQObject *receiver, TQEvent *event);
1365 
1369  int xErrhandler( Display*, void* );
1370 
1374  int xioErrhandler( Display* );
1375 
1379  void iceIOErrorHandler( _IceConn *conn );
1380 
1384  static bool loadedByKdeinit;
1385 
1389  static void startKdeinit();
1390 
1394  enum SettingsCategory { SETTINGS_MOUSE, SETTINGS_COMPLETION, SETTINGS_PATHS,
1395  SETTINGS_POPUPMENU, SETTINGS_QT, SETTINGS_SHORTCUTS };
1396 
1405  static TQPalette createApplicationPalette();
1406 
1411  static TQPalette createApplicationPalette( TDEConfig *config, int contrast );
1412 
1420  static void installSigpipeHandler();
1421 
1428  static bool guiEnabled();
1429 
1430 signals:
1437  void tdedisplayPaletteChanged();
1438 
1446  void tdedisplayStyleChanged();
1447 
1459  void tdedisplayFontChanged();
1460 
1466  void appearanceChanged();
1467 
1471  void toolbarAppearanceChanged(int);
1472 
1478  void backgroundChanged(int desk);
1479 
1486  void settingsChanged(int category);
1487 
1492  void iconChanged(int group);
1493 
1503  void kipcMessage(int id, int data);
1504 
1534  void saveYourself();
1535 
1543  void shutDown();
1544 
1549  void updateIconLoaders();
1550 
1555  void coreFakeKeyPress(unsigned int keyCode);
1556 
1557 private:
1558  void propagateSettings(SettingsCategory category);
1559  void tdedisplaySetPalette();
1560  void tdedisplaySetStyle();
1561  void tdedisplaySetFont();
1562  void applyGUIStyle();
1563  static void sigpipeHandler(int);
1564 
1565  int captionLayout;
1566 
1567  TDEApplication(const TDEApplication&);
1568  TDEApplication& operator=(const TDEApplication&);
1569 protected:
1570  virtual void virtual_hook( int id, void* data );
1571 private:
1572  TDEApplicationPrivate* d;
1573 };
1574 
1575 
1593 TDECORE_EXPORT bool checkAccess(const TQString& pathname, int mode);
1594 
1595 class KSessionManagedPrivate;
1596 
1613 class TDECORE_EXPORT KSessionManaged
1614 {
1615 public:
1616  KSessionManaged();
1617  virtual ~KSessionManaged();
1618 
1628  virtual bool saveState( TQSessionManager& sm );
1638  virtual bool commitData( TQSessionManager& sm );
1639 
1640 protected:
1641  virtual void virtual_hook( int id, void* data );
1642 private:
1643  KSessionManagedPrivate *d;
1644 };
1645 
1646 
1647 #endif
1648 
TDEConfig
Access KDE Configuration entries.
Definition: tdeconfig.h:43
TDEApplication::KApp
static TDEApplication * KApp
Current application object.
Definition: tdeapplication.h:1283
KURL
Represents and parses a URL.
Definition: kurl.h:127
KCharsets
Charset font and encoder/decoder handling.
Definition: kcharsets.h:43
TDEApplication::ShutdownType
ShutdownType
The possible values for the sdtype parameter of requestShutDown().
Definition: tdeapplication.h:359
TDEApplication::CaptionLayout
CaptionLayout
Position of the caption (presumably in the application window's title bar).
Definition: tdeapplication.h:106
DCOPClient
TDEApplication
Controls and provides information to all KDE applications.
Definition: tdeapplication.h:96
TDEApplication::ShutdownConfirm
ShutdownConfirm
The possible values for the confirm parameter of requestShutDown().
Definition: tdeapplication.h:341
TDEApplication::ShutdownMode
ShutdownMode
The possible values for the sdmode parameter of requestShutDown().
Definition: tdeapplication.h:381
TDEGlobal::checkAccess
bool checkAccess(const TQString &pathname, int mode)
Definition: tdeapplication.cpp:3302
TDEApplication::isRestored
bool isRestored() const
Is the application restored from the session manager?
Definition: tdeapplication.h:320
TDEApplication::kApplication
static TDEApplication * kApplication()
Returns the current application object.
Definition: tdeapplication.h:301
TDEApplication::SettingsCategory
SettingsCategory
Valid values for the settingsChanged signal.
Definition: tdeapplication.h:1394
DCOPObject
KSessionManaged
Provides highlevel access to session management on a per-object base.
Definition: tdeapplication.h:1613
TDEInstance
Access to KDE global objects for use in shared libraries.
Definition: kinstance.h:47

tdecore

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

tdecore

Skip menu "tdecore"
  • arts
  • dcop
  • dnssd
  • interfaces
  •   kspeech
  •     interface
  •     library
  •   tdetexteditor
  • kate
  • kded
  • kdoctools
  • kimgio
  • kjs
  • libtdemid
  • libtdescreensaver
  •     tdecore
  • tdeabc
  • tdecmshell
  • tdecore
  • tdefx
  • tdehtml
  • tdeinit
  • tdeio
  •   bookmarks
  •   httpfilter
  •   kpasswdserver
  •   kssl
  • tdeioslave
  •   http
  •   tdefile
  •   tdeio
  •   tdeioexec
  • tdemdi
  •   tdemdi
  • tdenewstuff
  • tdeparts
  • tdeprint
  • tderandr
  • tderesources
  • tdespell2
  • tdesu
  • tdeui
  • tdeunittest
  • tdeutils
  • tdewallet
Generated for tdecore by doxygen 1.8.8
This website is maintained by Timothy Pearson.