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

kdecore

kapplication.h
00001 /* This file is part of the KDE libraries
00002     Copyright (C) 1997 Matthias Kalle Dalheimer (kalle@kde.org)
00003     Copyright (c) 1998, 1999 KDE Team
00004 
00005     This library is free software; you can redistribute it and/or
00006     modify it under the terms of the GNU Library General Public
00007     License as published by the Free Software Foundation; either
00008     version 2 of the License, or (at your option) any later version.
00009 
00010     This library is distributed in the hope that it will be useful,
00011     but WITHOUT ANY WARRANTY; without even the implied warranty of
00012     MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
00013     Library General Public License for more details.
00014 
00015     You should have received a copy of the GNU Library General Public License
00016     along with this library; see the file COPYING.LIB.  If not, write to
00017     the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
00018     Boston, MA 02110-1301, USA.
00019 */
00020 
00021 #ifndef _KAPP_H
00022 #define _KAPP_H
00023 
00024 // Version macros. Never put this further down.
00025 #include "kdeversion.h"
00026 #include "kdelibs_export.h"
00027 
00028 class KConfig;
00029 class KCharsets;
00030 class DCOPClient;
00031 class DCOPObject;
00032 
00033 #include <tqtglobaldefines.h>
00034 
00035 typedef unsigned long Atom;
00036 #if !defined(Q_WS_X11)
00037 typedef void Display;
00038 #endif
00039 
00040 #include <tqapplication.h>
00041 #include <tqpixmap.h>
00042 #include <kinstance.h>
00043 
00044 struct _IceConn;
00045 class TQPopupMenu;
00046 class TQStrList;
00047 class KSessionManaged;
00048 class KStyle;
00049 class KURL;
00050 
00051 #define kapp KApplication::kApplication()
00052 
00053 class KApplicationPrivate;
00054 
00096 class KDECORE_EXPORT KApplication : public TQApplication, public KInstance
00097 {
00098 
00099   Q_OBJECT
00100 public:
00106   enum CaptionLayout {
00107     CaptionAppLast=1 , 
00108     CaptionAppFirst  , 
00109     CaptionNoApp  
00110   };
00111 
00131   KApplication( bool allowStyles=true, bool GUIenabled=true, bool SMenabled=true);
00132 
00133 #ifdef Q_QDOC
00134 #else // Q_QDOC
00135 #ifdef TDEAPPLICATION_BINARY_COMPAT_HACK
00136   // FIXME
00137   // FOR BINARY COMPATIBILITY ONLY
00138   // REMOVE WHEN PRACTICAL!
00139   KApplication( bool allowStyles=true, bool GUIenabled=true);
00140 #endif // TDEAPPLICATION_BINARY_COMPAT_HACK
00141 #endif // Q_QDOC
00142 
00143 #ifdef Q_WS_X11
00144 
00161   KApplication(Display *display, bool allowStyles);
00162 
00190   KApplication(Display *display, bool disable_argb, Qt::HANDLE visual, Qt::HANDLE colormap, bool allowStyles);
00191 
00215   KApplication(Display *display, Qt::HANDLE visual = 0, Qt::HANDLE colormap = 0,
00216                bool allowStyles=true);
00217 
00242   KApplication(Display *display, int& argc, char** argv, const TQCString& rAppName,
00243                bool allowStyles=true, bool GUIenabled=true);
00244 #endif
00245 
00268   // REMOVE FOR KDE 4.0 - using it only gives crashing applications because
00269   // KCmdLineArgs::init isn't called
00270   KApplication(int& argc, char** argv,
00271               const TQCString& rAppName, bool allowStyles=true, bool GUIenabled=true, bool SMenabled=true) KDE_DEPRECATED;
00272 
00273 #ifdef Q_QDOC
00274 #else // Q_QDOC
00275 #ifdef TDEAPPLICATION_BINARY_COMPAT_HACK
00276   // FIXME
00277   // FOR BINARY COMPATIBILITY ONLY
00278   // REMOVE WHEN PRACTICAL!
00279   KApplication(int& argc, char** argv,
00280               const TQCString& rAppName, bool allowStyles, bool GUIenabled) KDE_DEPRECATED;
00281 #endif // TDEAPPLICATION_BINARY_COMPAT_HACK
00282 #endif // Q_QDOC
00283 
00287   static void addCmdLineOptions();
00288 
00289   virtual ~KApplication();
00290 
00301   static KApplication* kApplication() { return KApp; }
00302 
00310   KConfig* sessionConfig();
00311 
00320   bool isRestored() const { return TQApplication::isSessionRestored(); }
00321 
00328   void disableSessionManagement();
00329 
00336   void enableSessionManagement();
00337 
00341   enum ShutdownConfirm {
00345     ShutdownConfirmDefault = -1,
00349     ShutdownConfirmNo = 0,
00353     ShutdownConfirmYes = 1
00354   };
00355 
00359   enum ShutdownType {
00363     ShutdownTypeDefault = -1,
00367     ShutdownTypeNone = 0,
00371     ShutdownTypeReboot = 1,
00375     ShutdownTypeHalt = 2
00376   };
00377 
00381   enum ShutdownMode {
00385     ShutdownModeDefault = -1,
00390     ShutdownModeSchedule = 0,
00394     ShutdownModeTryNow = 1,
00398     ShutdownModeForceNow = 2,
00402     ShutdownModeInteractive = 3
00403   };
00404 
00420   bool requestShutDown( ShutdownConfirm confirm = ShutdownConfirmDefault,
00421                         ShutdownType sdtype = ShutdownTypeDefault,
00422             ShutdownMode sdmode = ShutdownModeDefault );
00423 
00437     void propagateSessionManager();
00438 
00444   void commitData( TQSessionManager& sm );
00445 
00451   void saveState( TQSessionManager& sm );
00452 
00462   bool sessionSaving() const;
00463 
00470   static DCOPClient *dcopClient();
00471 
00476   static void disableAutoDcopRegistration();
00477 
00482   TQPixmap icon() const;
00483 
00488   TQString iconName() const;
00489 
00494   TQPixmap miniIcon() const;
00495 
00500   TQString miniIconName() const;
00501 
00512   void setTopWidget( TQWidget *topWidget );
00513 
00526   void invokeHelp( const TQString& anchor,
00527                    const TQString& appname,
00528                    const TQCString& startup_id ) const;
00529 
00530   // KDE4 merge with above with startup_id = ""
00531   void invokeHelp( const TQString& anchor = TQString::null,
00532                    const TQString& appname = TQString::null ) const;
00533 
00548   void invokeHTMLHelp( const TQString& aFilename, const TQString& aTopic = TQString::null ) const KDE_DEPRECATED;
00549 
00558   void invokeMailer( const TQString &address, const TQString &subject, const TQCString& startup_id );
00559   // KDE4 merge with above with startup_id = ""
00560   void invokeMailer( const TQString &address, const TQString &subject );
00561 
00571   void invokeMailer( const KURL &mailtoURL, const TQCString& startup_id, bool allowAttachments );
00572   // KDE4 merge with above with allowAttachments = false
00573   void invokeMailer( const KURL &mailtoURL, const TQCString& startup_id );
00574   // KDE4 merge with above with startup_id = ""
00575   void invokeMailer( const KURL &mailtoURL );
00576 
00592   void invokeMailer(const TQString &to, const TQString &cc, const TQString &bcc,
00593                     const TQString &subject, const TQString &body,
00594                     const TQString &messageFile, const TQStringList &attachURLs,
00595                     const TQCString& startup_id );
00596   // KDE4 merge with above with startup_id = ""
00597   void invokeMailer(const TQString &to, const TQString &cc, const TQString &bcc,
00598                     const TQString &subject, const TQString &body,
00599                     const TQString &messageFile = TQString::null, const TQStringList &attachURLs = TQStringList());
00600 
00601 public slots:
00612   void invokeBrowser( const TQString &url, const TQCString& startup_id );
00613   // KDE4 merge with above with startup_id = ""
00618   void invokeBrowser( const TQString &url );
00619 
00627   void cut();
00628 
00636   void copy();
00637 
00645   void paste();
00646 
00672   void clear();
00673 
00681   void selectAll();
00682 
00689   void broadcastKeyCode(unsigned int keyCode);
00690 
00691 public:
00697   static TQCString launcher();
00698 
00719   static int startServiceByName( const TQString& _name, const TQString &URL,
00720                 TQString *error=0, TQCString *dcopService=0, int *pid=0, const TQCString &startup_id = "", bool noWait = false );
00721 
00742   static int startServiceByName( const TQString& _name, const TQStringList &URLs=TQStringList(),
00743                 TQString *error=0, TQCString *dcopService=0, int *pid=0, const TQCString &startup_id = "", bool noWait = false );
00744 
00765   static int startServiceByDesktopPath( const TQString& _name, const TQString &URL,
00766                 TQString *error=0, TQCString *dcopService=0, int *pid = 0, const TQCString &startup_id = "", bool noWait = false );
00767 
00788   static int startServiceByDesktopPath( const TQString& _name, const TQStringList &URLs=TQStringList(),
00789                 TQString *error=0, TQCString *dcopService=0, int *pid = 0, const TQCString &startup_id = "", bool noWait = false );
00790 
00811   static int startServiceByDesktopName( const TQString& _name, const TQString &URL,
00812                 TQString *error=0, TQCString *dcopService=0, int *pid = 0, const TQCString &startup_id = "", bool noWait = false );
00813 
00834   static int startServiceByDesktopName( const TQString& _name, const TQStringList &URLs=TQStringList(),
00835                 TQString *error=0, TQCString *dcopService=0, int *pid = 0, const TQCString &startup_id = "", bool noWait = false );
00836 
00854   static int kdeinitExec( const TQString& name, const TQStringList &args,
00855                 TQString *error, int *pid, const TQCString& startup_id );
00856   // KDE4 merge with above with startup_id = ""
00857   static int kdeinitExec( const TQString& name, const TQStringList &args=TQStringList(),
00858                 TQString *error=0, int *pid = 0 );
00859 
00877   static int kdeinitExecWait( const TQString& name, const TQStringList &args,
00878                 TQString *error, int *pid, const TQCString& startup_id );
00879   // KDE4 merge with above with startup_id = ""
00880   static int kdeinitExecWait( const TQString& name, const TQStringList &args=TQStringList(),
00881                 TQString *error=0, int *pid = 0 );
00882 
00891   TQString caption() const;
00892 
00896   KDE_DEPRECATED KStyle* kstyle() const { return 0; }
00897 
00915   TQString makeStdCaption( const TQString &userCaption,
00916                           bool withAppName=true, bool modified=false ) const;
00917 
00925   TQString tempSaveName( const TQString& pFilename ) const;
00926 
00936   TQString checkRecoverFile( const TQString& pFilename, bool& bRecover ) const;
00937 
00938 #if defined(Q_WS_X11)
00939 
00944    Display *getDisplay() { return display; }
00945 #endif
00946 
00951    void getX11RGBAInformation(Display *dpy);
00952 
00960    static bool isCompositionManagerAvailable();
00961 
00970    bool detectCompositionManagerAvailable(bool force_available=false, bool available=true);
00971 
00980    static Display* openX11RGBADisplay();
00981 
00987    Qt::HANDLE getX11RGBAVisual(Display *dpy);
00988 
00994    Qt::HANDLE getX11RGBAColormap(Display *dpy);
00995 
01012    bool isX11CompositionAvailable();
01013 
01021   void enableStyles();
01022 
01030   void disableStyles();
01031 
01041   void installX11EventFilter( TQWidget* filter );
01042 
01047   void removeX11EventFilter( const TQWidget* filter );
01048 
01053   static int random();
01054 
01060   static TQString randomString(int length);
01061 
01071   void addKipcEventMask(int id);
01072 
01081   void removeKipcEventMask(int id);
01082 
01088   TQCString startupId() const;
01089 
01097   void setStartupId( const TQCString& startup_id );
01098 
01105   void updateUserTimestamp( unsigned long time = 0 );
01106   
01112   unsigned long userTimestamp() const;
01113 
01122   void updateRemoteUserTimestamp( const TQCString& dcopId, unsigned long time = 0 );
01123   
01129   TQString geometryArgument() const;
01130 
01135   void installKDEPropertyMap();
01136 
01142   bool authorize(const TQString &genericAction);
01143 
01151   bool authorizeKAction(const char *action);
01152 
01166   bool authorizeURLAction(const TQString &action, const KURL &baseURL, const KURL &destURL);
01167 
01177   void allowURLAction(const TQString &action, const KURL &_baseURL, const KURL &_destURL);
01178 
01186   bool authorizeControlModule(const TQString &menuId);
01187   
01196   TQStringList authorizeControlModules(const TQStringList &menuIds);
01197 
01207   static ButtonState keyboardMouseState();
01208 
01209   // Same values as ShiftMask etc. in X.h
01210   enum { ShiftModifier = 1<<0,
01211          LockModifier = 1<<1,
01212          ControlModifier = 1<<2,
01213          Modifier1 = 1<<3,
01214          Modifier2 = 1<<4,
01215          Modifier3 = 1<<5,
01216          Modifier4 = 1<<6,
01217          Modifier5 = 1<<7 };
01222   static uint keyboardModifiers() KDE_DEPRECATED;
01223 
01225   enum { Button1Pressed = 1<<8,
01226          Button2Pressed = 1<<9,
01227          Button3Pressed = 1<<10,
01228          Button4Pressed = 1<<11,
01229          Button5Pressed = 1<<12 };
01234   static uint mouseState() KDE_DEPRECATED;
01235 
01236 
01237 public slots:
01244   void ref();
01245 
01250   void deref();
01251 
01252 protected:
01256   KApplication( bool allowStyles, bool GUIenabled, KInstance* _instance );
01257 
01258 #ifdef Q_WS_X11
01259 
01262   KApplication( Display *display, Qt::HANDLE visual, Qt::HANDLE colormap,
01263           bool allowStyles, KInstance* _instance );
01264 
01268   bool x11EventFilter( XEvent * );
01269 
01270   Display *display;
01271 #endif
01272   Atom kipcCommAtom;
01273   int kipcEventMask;
01274 
01276   static KApplication *KApp;
01277   int pArgc;
01278 
01310   void invokeEditSlot( const char *slot );
01311 
01312 private slots:
01313   void dcopFailure(const TQString &);
01314   void dcopBlockUserInput( bool );
01315   void x11FilterDestroyed();
01316   void checkAppStartedSlot();
01317 
01318 private:
01319   TQString sessionConfigName() const;
01320   KConfig* pSessionConfig; //instance specific application config object
01321   static DCOPClient *s_DCOPClient; // app specific application communication client
01322   static bool s_dcopClientNeedsPostInit;
01323   TQString aCaption; // the name for the window title
01324   bool bSessionManagement;
01325   struct oldPixmapType { TQPixmap a, b; };
01326   mutable union {
01327     struct {
01328       TQPixmap *icon, *miniIcon;
01329     } pm;
01330     char unused[sizeof(oldPixmapType)];
01331   } aIconPixmap; // KDE4: remove me
01332   TQString aIconName;
01333   TQString aMiniIconName;
01334   bool useStyles;
01335   TQWidget *smw;
01336 
01337   void init( bool GUIenabled );
01338 
01339   void parseCommandLine( ); // Handle KDE arguments (Using KCmdLineArgs)
01340 
01341   void read_app_startup_id();
01342 
01343   void dcopAutoRegistration();
01344   void dcopClientPostInit();
01345   void initUrlActionRestrictions();
01346 
01347   bool argb_visual;
01348 #if defined(Q_WS_X11)
01349   Qt::HANDLE argb_x11_visual;
01350   Qt::HANDLE argb_x11_colormap;
01351 #endif
01352 
01353 public:
01357   bool notify(TQObject *receiver, TQEvent *event);
01358 
01362   int xErrhandler( Display*, void* );
01363 
01367   int xioErrhandler( Display* );
01368 
01372   void iceIOErrorHandler( _IceConn *conn );
01373 
01377   static bool loadedByKdeinit;
01378 
01382   static void startKdeinit();
01383 
01387   enum SettingsCategory { SETTINGS_MOUSE, SETTINGS_COMPLETION, SETTINGS_PATHS,
01388          SETTINGS_POPUPMENU, SETTINGS_QT, SETTINGS_SHORTCUTS };
01389 
01398   static TQPalette createApplicationPalette();
01399 
01404   static TQPalette createApplicationPalette( KConfig *config, int contrast );
01405 
01413   static void installSigpipeHandler();
01414 
01421   static bool guiEnabled();
01422 
01423 signals:
01430   void kdisplayPaletteChanged();
01431 
01439   void kdisplayStyleChanged();
01440 
01452   void kdisplayFontChanged();
01453 
01459   void appearanceChanged();
01460 
01464   void toolbarAppearanceChanged(int);
01465 
01471   void backgroundChanged(int desk);
01472 
01479   void settingsChanged(int category);
01480 
01485   void iconChanged(int group);
01486 
01496   void kipcMessage(int id, int data);
01497 
01527   void saveYourself();
01528 
01536   void shutDown();
01537 
01542   void updateIconLoaders();
01543 
01548   void coreFakeKeyPress(unsigned int keyCode);
01549 
01550 private:
01551   void propagateSettings(SettingsCategory category);
01552   void kdisplaySetPalette();
01553   void kdisplaySetStyle();
01554   void kdisplaySetFont();
01555   void applyGUIStyle();
01556   static void sigpipeHandler(int);
01557 
01558   int captionLayout;
01559 
01560   KApplication(const KApplication&);
01561   KApplication& operator=(const KApplication&);
01562 protected:
01563   virtual void virtual_hook( int id, void* data );
01564 private:
01565   KApplicationPrivate* d;
01566 };
01567 
01568 
01586 KDECORE_EXPORT bool checkAccess(const TQString& pathname, int mode);
01587 
01588 class KSessionManagedPrivate;
01589 
01606 class KDECORE_EXPORT KSessionManaged
01607 {
01608 public:
01609   KSessionManaged();
01610   virtual ~KSessionManaged();
01611 
01621   virtual bool saveState( TQSessionManager& sm );
01631   virtual bool commitData( TQSessionManager& sm );
01632 
01633 protected:
01634   virtual void virtual_hook( int id, void* data );
01635 private:
01636   KSessionManagedPrivate *d;
01637 };
01638 
01639 
01640 #endif
01641 

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