• 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 __TDEAPPLICATION_H__
22 #define __TDEAPPLICATION_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 typedef unsigned long Atom;
34 #if !defined(TQ_WS_X11)
35 typedef void Display;
36 #endif
37 
38 #include <tqapplication.h>
39 #include <tqpixmap.h>
40 #include <kinstance.h>
41 
42 struct _IceConn;
43 class TQPopupMenu;
44 class TQStrList;
45 class KSessionManaged;
46 class TDEStyle;
47 class KURL;
48 
49 #define kapp TDEApplication::kApplication()
50 
51 class TDEApplicationPrivate;
52 
94 class TDECORE_EXPORT TDEApplication : public TQApplication, public TDEInstance
95 {
96 
97  TQ_OBJECT
98 public:
104  enum CaptionLayout {
105  CaptionAppLast=1 ,
106  CaptionAppFirst ,
107  CaptionNoApp
108  };
109 
129  TDEApplication( bool allowStyles=true, bool GUIenabled=true, bool SMenabled=true);
130 
131 #ifdef Q_QDOC
132 #else // Q_QDOC
133 #ifdef TDEAPPLICATION_BINARY_COMPAT_HACK
134  // FIXME
135  // FOR BINARY COMPATIBILITY ONLY
136  // REMOVE WHEN PRACTICAL!
137  TDEApplication( bool allowStyles=true, bool GUIenabled=true);
138 #endif // TDEAPPLICATION_BINARY_COMPAT_HACK
139 #endif // Q_QDOC
140 
141 #ifdef TQ_WS_X11
159  TDEApplication(Display *display, bool allowStyles);
160 
188  TDEApplication(Display *display, bool disable_argb, TQt::HANDLE visual, TQt::HANDLE colormap, bool allowStyles);
189 
213  TDEApplication(Display *display, TQt::HANDLE visual = 0, TQt::HANDLE colormap = 0,
214  bool allowStyles=true);
215 
240  TDEApplication(Display *display, int& argc, char** argv, const TQCString& rAppName,
241  bool allowStyles=true, bool GUIenabled=true);
242 #endif
243 
266  // REMOVE FOR KDE 4.0 - using it only gives crashing applications because
267  // TDECmdLineArgs::init isn't called
268  TDEApplication(int& argc, char** argv,
269  const TQCString& rAppName, bool allowStyles=true, bool GUIenabled=true, bool SMenabled=true) TDE_DEPRECATED;
270 
271 #ifdef Q_QDOC
272 #else // Q_QDOC
273 #ifdef TDEAPPLICATION_BINARY_COMPAT_HACK
274  // FIXME
275  // FOR BINARY COMPATIBILITY ONLY
276  // REMOVE WHEN PRACTICAL!
277  TDEApplication(int& argc, char** argv,
278  const TQCString& rAppName, bool allowStyles, bool GUIenabled) TDE_DEPRECATED;
279 #endif // TDEAPPLICATION_BINARY_COMPAT_HACK
280 #endif // Q_QDOC
281 
285  static void addCmdLineOptions();
286 
287  virtual ~TDEApplication();
288 
299  static TDEApplication* kApplication() { return KApp; }
300 
308  TDEConfig* sessionConfig();
309 
318  bool isRestored() const { return TQApplication::isSessionRestored(); }
319 
326  void disableSessionManagement();
327 
334  void enableSessionManagement();
335 
339  enum ShutdownConfirm {
343  ShutdownConfirmDefault = -1,
347  ShutdownConfirmNo = 0,
351  ShutdownConfirmYes = 1
352  };
353 
357  enum ShutdownType {
361  ShutdownTypeDefault = -1,
365  ShutdownTypeNone = 0,
369  ShutdownTypeReboot = 1,
373  ShutdownTypeHalt = 2
374  };
375 
379  enum ShutdownMode {
383  ShutdownModeDefault = -1,
388  ShutdownModeSchedule = 0,
392  ShutdownModeTryNow = 1,
396  ShutdownModeForceNow = 2,
400  ShutdownModeInteractive = 3
401  };
402 
418  bool requestShutDown( ShutdownConfirm confirm = ShutdownConfirmDefault,
419  ShutdownType sdtype = ShutdownTypeDefault,
420  ShutdownMode sdmode = ShutdownModeDefault );
421 
435  void propagateSessionManager();
436 
442  void commitData( TQSessionManager& sm );
443 
449  void saveState( TQSessionManager& sm );
450 
460  bool sessionSaving() const;
461 
468  static DCOPClient *dcopClient();
469 
474  static void disableAutoDcopRegistration();
475 
480  TQPixmap icon() const;
481 
486  TQString iconName() const;
487 
492  TQPixmap miniIcon() const;
493 
498  TQString miniIconName() const;
499 
510  void setTopWidget( TQWidget *topWidget );
511 
524  void invokeHelp( const TQString& anchor,
525  const TQString& appname,
526  const TQCString& startup_id ) const;
527 
528  // KDE4 merge with above with startup_id = ""
529  void invokeHelp( const TQString& anchor = TQString::null,
530  const TQString& appname = TQString::null ) const;
531 
546  void invokeHTMLHelp( const TQString& aFilename, const TQString& aTopic = TQString::null ) const TDE_DEPRECATED;
547 
556  void invokeMailer( const TQString &address, const TQString &subject, const TQCString& startup_id );
557  // KDE4 merge with above with startup_id = ""
558  void invokeMailer( const TQString &address, const TQString &subject );
559 
569  void invokeMailer( const KURL &mailtoURL, const TQCString& startup_id, bool allowAttachments );
570  // KDE4 merge with above with allowAttachments = false
571  void invokeMailer( const KURL &mailtoURL, const TQCString& startup_id );
572  // KDE4 merge with above with startup_id = ""
573  void invokeMailer( const KURL &mailtoURL );
574 
590  void invokeMailer(const TQString &to, const TQString &cc, const TQString &bcc,
591  const TQString &subject, const TQString &body,
592  const TQString &messageFile, const TQStringList &attachURLs,
593  const TQCString& startup_id );
594  // KDE4 merge with above with startup_id = ""
595  void invokeMailer(const TQString &to, const TQString &cc, const TQString &bcc,
596  const TQString &subject, const TQString &body,
597  const TQString &messageFile = TQString::null, const TQStringList &attachURLs = TQStringList());
598 
599 public slots:
610  void invokeBrowser( const TQString &url, const TQCString& startup_id );
611  // KDE4 merge with above with startup_id = ""
616  void invokeBrowser( const TQString &url );
617 
625  void cut();
626 
634  void copy();
635 
643  void paste();
644 
670  void clear();
671 
679  void selectAll();
680 
687  void broadcastKeyCode(unsigned int keyCode);
688 
689 public:
695  static TQCString launcher();
696 
717  static int startServiceByName( const TQString& _name, const TQString &URL,
718  TQString *error=0, TQCString *dcopService=0, int *pid=0, const TQCString &startup_id = "", bool noWait = false );
719 
740  static int startServiceByName( const TQString& _name, const TQStringList &URLs=TQStringList(),
741  TQString *error=0, TQCString *dcopService=0, int *pid=0, const TQCString &startup_id = "", bool noWait = false );
742 
763  static int startServiceByDesktopPath( const TQString& _name, const TQString &URL,
764  TQString *error=0, TQCString *dcopService=0, int *pid = 0, const TQCString &startup_id = "", bool noWait = false );
765 
786  static int startServiceByDesktopPath( const TQString& _name, const TQStringList &URLs=TQStringList(),
787  TQString *error=0, TQCString *dcopService=0, int *pid = 0, const TQCString &startup_id = "", bool noWait = false );
788 
809  static int startServiceByDesktopName( const TQString& _name, const TQString &URL,
810  TQString *error=0, TQCString *dcopService=0, int *pid = 0, const TQCString &startup_id = "", bool noWait = false );
811 
832  static int startServiceByDesktopName( const TQString& _name, const TQStringList &URLs=TQStringList(),
833  TQString *error=0, TQCString *dcopService=0, int *pid = 0, const TQCString &startup_id = "", bool noWait = false );
834 
852  static int tdeinitExec( const TQString& name, const TQStringList &args,
853  TQString *error, int *pid, const TQCString& startup_id );
854  // KDE4 merge with above with startup_id = ""
855  static int tdeinitExec( const TQString& name, const TQStringList &args=TQStringList(),
856  TQString *error=0, int *pid = 0 );
857 
875  static int tdeinitExecWait( const TQString& name, const TQStringList &args,
876  TQString *error, int *pid, const TQCString& startup_id );
877  // KDE4 merge with above with startup_id = ""
878  static int tdeinitExecWait( const TQString& name, const TQStringList &args=TQStringList(),
879  TQString *error=0, int *pid = 0 );
880 
889  TQString caption() const;
890 
894  TDE_DEPRECATED TDEStyle* tdestyle() const { return 0; }
895 
913  TQString makeStdCaption( const TQString &userCaption,
914  bool withAppName=true, bool modified=false ) const;
915 
923  TQString tempSaveName( const TQString& pFilename ) const;
924 
934  TQString checkRecoverFile( const TQString& pFilename, bool& bRecover ) const;
935 
936 #if defined(TQ_WS_X11)
942  Display *getDisplay() { return display; }
943 #endif
944 
949  void getX11RGBAInformation(Display *dpy);
950 
958  static bool isCompositionManagerAvailable();
959 
968  bool detectCompositionManagerAvailable(bool force_available=false, bool available=true);
969 
978  static Display* openX11RGBADisplay();
979 
985  TQt::HANDLE getX11RGBAVisual(Display *dpy);
986 
992  TQt::HANDLE getX11RGBAColormap(Display *dpy);
993 
1010  bool isX11CompositionAvailable();
1011 
1019  void enableStyles();
1020 
1028  void disableStyles();
1029 
1039  void installX11EventFilter( TQWidget* filter );
1040 
1045  void removeX11EventFilter( const TQWidget* filter );
1046 
1051  static int random();
1052 
1058  static TQString randomString(int length);
1059 
1069  void addKipcEventMask(int id);
1070 
1079  void removeKipcEventMask(int id);
1080 
1086  TQCString startupId() const;
1087 
1095  void setStartupId( const TQCString& startup_id );
1096 
1103  void updateUserTimestamp( unsigned long time = 0 );
1104 
1110  unsigned long userTimestamp() const;
1111 
1120  void updateRemoteUserTimestamp( const TQCString& dcopId, unsigned long time = 0 );
1121 
1127  TQString geometryArgument() const;
1128 
1133  void installKDEPropertyMap();
1134 
1140  bool authorize(const TQString &genericAction);
1141 
1149  bool authorizeTDEAction(const char *action);
1150 
1164  bool authorizeURLAction(const TQString &action, const KURL &baseURL, const KURL &destURL);
1165 
1175  void allowURLAction(const TQString &action, const KURL &_baseURL, const KURL &_destURL);
1176 
1184  bool authorizeControlModule(const TQString &menuId);
1185 
1194  TQStringList authorizeControlModules(const TQStringList &menuIds);
1195 
1205  static ButtonState keyboardMouseState();
1206 
1207  // Same values as ShiftMask etc. in X.h
1208  enum { ShiftModifier = 1<<0,
1209  LockModifier = 1<<1,
1210  ControlModifier = 1<<2,
1211  Modifier1 = 1<<3,
1212  Modifier2 = 1<<4,
1213  Modifier3 = 1<<5,
1214  Modifier4 = 1<<6,
1215  Modifier5 = 1<<7 };
1220  static uint keyboardModifiers() TDE_DEPRECATED;
1221 
1223  enum { Button1Pressed = 1<<8,
1224  Button2Pressed = 1<<9,
1225  Button3Pressed = 1<<10,
1226  Button4Pressed = 1<<11,
1227  Button5Pressed = 1<<12 };
1232  static uint mouseState() TDE_DEPRECATED;
1233 
1239  static int currentX11VT();
1240 
1241 
1242 public slots:
1249  void ref();
1250 
1255  void deref();
1256 
1257 protected:
1261  TDEApplication( bool allowStyles, bool GUIenabled, TDEInstance* _instance );
1262 
1263 #ifdef TQ_WS_X11
1267  TDEApplication( Display *display, TQt::HANDLE visual, TQt::HANDLE colormap,
1268  bool allowStyles, TDEInstance* _instance );
1269 
1273  bool x11EventFilter( XEvent * );
1274 
1275  Display *display;
1276 #endif
1277  Atom kipcCommAtom;
1278  int kipcEventMask;
1279 
1281  static TDEApplication *KApp;
1282  int pArgc;
1283 
1315  void invokeEditSlot( const char *slot );
1316 
1317 private slots:
1318  void dcopFailure(const TQString &);
1319  void dcopBlockUserInput( bool );
1320  void x11FilterDestroyed();
1321  void checkAppStartedSlot();
1322 
1323 private:
1324  TQString sessionConfigName() const;
1325  TDEConfig* pSessionConfig; //instance specific application config object
1326  static DCOPClient *s_DCOPClient; // app specific application communication client
1327  static bool s_dcopClientNeedsPostInit;
1328  TQString aCaption; // the name for the window title
1329  bool bSessionManagement;
1330  struct oldPixmapType { TQPixmap a, b; };
1331  mutable union {
1332  struct {
1333  TQPixmap *icon, *miniIcon;
1334  } pm;
1335  char unused[sizeof(oldPixmapType)];
1336  } aIconPixmap; // KDE4: remove me
1337  TQString aIconName;
1338  TQString aMiniIconName;
1339  bool useStyles;
1340  TQWidget *smw;
1341 
1342  void init( bool GUIenabled );
1343 
1344  void parseCommandLine( ); // Handle KDE arguments (Using TDECmdLineArgs)
1345 
1346  void read_app_startup_id();
1347 
1348  void dcopAutoRegistration();
1349  void dcopClientPostInit();
1350  void initUrlActionRestrictions();
1351 
1352  bool argb_visual;
1353 #if defined(TQ_WS_X11)
1354  TQt::HANDLE argb_x11_visual;
1355  TQt::HANDLE argb_x11_colormap;
1356 #endif
1357 
1358 public:
1362  bool notify(TQObject *receiver, TQEvent *event);
1363 
1367  int xErrhandler( Display*, void* );
1368 
1372  int xioErrhandler( Display* );
1373 
1377  void iceIOErrorHandler( _IceConn *conn );
1378 
1382  static bool loadedByKdeinit;
1383 
1387  static void startKdeinit();
1388 
1392  enum SettingsCategory { SETTINGS_MOUSE, SETTINGS_COMPLETION, SETTINGS_PATHS,
1393  SETTINGS_POPUPMENU, SETTINGS_QT, SETTINGS_SHORTCUTS };
1394 
1403  static TQPalette createApplicationPalette();
1404 
1409  static TQPalette createApplicationPalette( TDEConfig *config, int contrast );
1410 
1418  static void installSigpipeHandler();
1419 
1426  static bool guiEnabled();
1427 
1428 signals:
1435  void tdedisplayPaletteChanged();
1436 
1444  void tdedisplayStyleChanged();
1445 
1457  void tdedisplayFontChanged();
1458 
1464  void appearanceChanged();
1465 
1469  void toolbarAppearanceChanged(int);
1470 
1476  void backgroundChanged(int desk);
1477 
1484  void settingsChanged(int category);
1485 
1490  void iconChanged(int group);
1491 
1501  void kipcMessage(int id, int data);
1502 
1532  void saveYourself();
1533 
1541  void shutDown();
1542 
1547  void updateIconLoaders();
1548 
1553  void coreFakeKeyPress(unsigned int keyCode);
1554 
1555 private:
1556  void propagateSettings(SettingsCategory category);
1557  void tdedisplaySetPalette();
1558  void tdedisplaySetStyle();
1559  void tdedisplaySetFont();
1560  void applyGUIStyle();
1561  static void sigpipeHandler(int);
1562 
1563  int captionLayout;
1564 
1565  TDEApplication(const TDEApplication&);
1566  TDEApplication& operator=(const TDEApplication&);
1567 protected:
1568  virtual void virtual_hook( int id, void* data );
1569 private:
1570  TDEApplicationPrivate* d;
1571 };
1572 
1573 
1591 TDECORE_EXPORT bool checkAccess(const TQString& pathname, int mode);
1592 
1593 class KSessionManagedPrivate;
1594 
1611 class TDECORE_EXPORT KSessionManaged
1612 {
1613 public:
1614  KSessionManaged();
1615  virtual ~KSessionManaged();
1616 
1626  virtual bool saveState( TQSessionManager& sm );
1636  virtual bool commitData( TQSessionManager& sm );
1637 
1638 protected:
1639  virtual void virtual_hook( int id, void* data );
1640 private:
1641  KSessionManagedPrivate *d;
1642 };
1643 
1644 
1645 #endif
1646 
DCOPClient
DCOPObject
KCharsets
Charset font and encoder/decoder handling.
Definition: kcharsets.h:44
KSessionManaged
Provides highlevel access to session management on a per-object base.
Definition: tdeapplication.h:1612
KURL
Represents and parses a URL.
Definition: kurl.h:128
TDEApplication
Controls and provides information to all KDE applications.
Definition: tdeapplication.h:95
TDEApplication::KApp
static TDEApplication * KApp
Current application object.
Definition: tdeapplication.h:1281
TDEApplication::appearanceChanged
void appearanceChanged()
Emitted when TDEApplication has changed either its GUI style, its font or its palette in response to ...
TDEApplication::settingsChanged
void settingsChanged(int category)
Emitted when the global settings have been changed - see TDEGlobalSettings TDEApplication takes care ...
TDEApplication::ShutdownType
ShutdownType
The possible values for the sdtype parameter of requestShutDown().
Definition: tdeapplication.h:357
TDEApplication::tdedisplayStyleChanged
void tdedisplayStyleChanged()
Emitted when TDEApplication has changed its GUI style in response to a KControl request.
TDEApplication::ShutdownMode
ShutdownMode
The possible values for the sdmode parameter of requestShutDown().
Definition: tdeapplication.h:379
TDEApplication::CaptionLayout
CaptionLayout
Position of the caption (presumably in the application window's title bar).
Definition: tdeapplication.h:104
TDEApplication::toolbarAppearanceChanged
void toolbarAppearanceChanged(int)
Emitted when the settings for toolbars have been changed.
TDEApplication::tdedisplayPaletteChanged
void tdedisplayPaletteChanged()
Emitted when TDEApplication has changed its palette due to a KControl request.
TDEApplication::shutDown
void shutDown()
Your application is killed.
TDEApplication::miniIcon
TQPixmap miniIcon() const
Returns the mini-icon for the application as a TQPixmap.
TDEApplication::icon
TQPixmap icon() const
Returns a TQPixmap with the application icon.
TDEApplication::tdedisplayFontChanged
void tdedisplayFontChanged()
Emitted when TDEApplication has changed its font in response to a KControl request.
TDEApplication::saveYourself
void saveYourself()
TDEApplication::kApplication
static TDEApplication * kApplication()
Returns the current application object.
Definition: tdeapplication.h:299
TDEApplication::kipcMessage
void kipcMessage(int id, int data)
Emitted when a KIPC user message has been received.
TDEApplication::backgroundChanged
void backgroundChanged(int desk)
Emitted when the desktop background has been changed by kcmdisplay.
TDEApplication::SettingsCategory
SettingsCategory
Valid values for the settingsChanged signal.
Definition: tdeapplication.h:1392
TDEApplication::iconChanged
void iconChanged(int group)
Emitted when the global icon settings have been changed.
TDEApplication::ShutdownConfirm
ShutdownConfirm
The possible values for the confirm parameter of requestShutDown().
Definition: tdeapplication.h:339
TDEApplication::isRestored
bool isRestored() const
Is the application restored from the session manager?
Definition: tdeapplication.h:318
TDEApplication::tdestyle
TDE_DEPRECATED TDEStyle * tdestyle() const
Definition: tdeapplication.h:894
TDEConfig
Access KDE Configuration entries.
Definition: tdeconfig.h:44
TDEGlobal::checkAccess
bool checkAccess(const TQString &pathname, int mode)
Check, if a file may be accessed in a given mode.
Definition: tdeapplication.cpp:3300
TDEInstance
Access to KDE global objects for use in shared libraries.
Definition: kinstance.h:48

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
  • tdeabc
  • tdecmshell
  • tdecore
  • tdefx
  • tdehtml
  • tdeinit
  • tdeio
  •   bookmarks
  •   httpfilter
  •   kpasswdserver
  •   kssl
  •   tdefile
  •   tdeio
  •   tdeioexec
  • tdeioslave
  •   http
  • tdemdi
  •   tdemdi
  • tdenewstuff
  • tdeparts
  • tdeprint
  • tderandr
  • tderesources
  • tdespell2
  • tdesu
  • tdeui
  • tdeunittest
  • tdeutils
  • tdewallet
Generated for tdecore by doxygen 1.9.1
This website is maintained by Timothy Pearson.