kapplication.h Source File (kdecore Library)

| # kdecore Library API Documentation
Overview | Class Hierarchy | Classes | Classes (annotated) | Members | Source Files

# 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., 59 Temple Place - Suite 330,
    00018     Boston, MA 02111-1307, USA.
    00019 */
    00020
    00021 // $Id: kapplication.h,v 1.278.2.1 2003/03/03 14:39:42 lunakl Exp $
    00022
    00023 #ifndef _KAPP_H
    00024 #define _KAPP_H
    00025
    00026 // Version macros. Never put this further down.
    00027 #include "kdeversion.h"
    00028
    00029 class KConfig;
    00030 class KCharsets;
    00031 class DCOPClient;
    00032 class DCOPObject;
    00033
    00034 typedef unsigned long Atom;
    00035 #ifdef Q_WS_QWS
    00036 typedef void Display;
    00037 #endif
    00038
    00039 #include <qapplication.h>
    00040 #include <qpixmap.h>
    00041 #include <kinstance.h>
    00042
    00043 struct _IceConn;
    00044 class QPopupMenu;
    00045 class QStrList;
    00046 class KSessionManaged;
    00047 class KStyle;
    00048 class KURL;
    00049
    00050 #define kapp KApplication::kApplication()
    00051
    00052 class KApplicationPrivate;
    00053
    00091 class KApplication : public QApplication, public KInstance
    00092 {
    00093
    00094   Q_OBJECT
    00095 public:
    00096   enum CaptionLayout { CaptionAppLast=1, CaptionAppFirst, CaptionNoApp };
    00097
    00111   KApplication( bool allowStyles=true, bool GUIenabled=true);
    00112
    00113 #ifndef Q_WS_QWS
    00114
    00134   KApplication(Display *display, int& argc, char** argv, const QCString& rAppName,
    00135                bool allowStyles=true, bool GUIenabled=true);
    00136 #endif
    00137
    00158   KApplication(int& argc, char** argv,
    00159               const QCString& rAppName, bool allowStyles=true, bool GUIenabled=true);
    00160
    00164   static void addCmdLineOptions();
    00165
    00166   virtual ~KApplication();
    00167
    00178   static KApplication* kApplication() { return KApp; }
    00179
    00187   KConfig* sessionConfig();
    00188
    00197   bool isRestored() const { return QApplication::isSessionRestored(); }
    00198
    00205   void disableSessionManagement();
    00206
    00210   enum ShutdownConfirm {
    00214     ShutdownConfirmDefault = -1,
    00218     ShutdownConfirmNo = 0,
    00222     ShutdownConfirmYes = 1
    00223   };
    00224
    00228   enum ShutdownType {
    00232     ShutdownTypeDefault = -1,
    00236     ShutdownTypeNone = 0,
    00240     ShutdownTypeReboot = 1,
    00244     ShutdownTypeHalt = 2
    00245   };
    00246
    00250   enum ShutdownMode {
    00254     ShutdownModeDefault = -1,
    00259     ShutdownModeSchedule = 0,
    00263     ShutdownModeTryNow = 1,
    00267     ShutdownModeForceNow = 2,
    00271     ShutdownModeInteractive = 3
    00272   };
    00273
    00289   bool requestShutDown( ShutdownConfirm confirm = ShutdownConfirmDefault,
    00290                         ShutdownType sdtype = ShutdownTypeDefault,
    00291                         ShutdownMode sdmode = ShutdownModeDefault );
    00292
    00306     void propagateSessionManager();
    00307
    00308     /*
    00309      * Reimplemented for internal purposes, mainly the highlevel
    00310      *  handling of session management with @ref KSessionManaged.
    00311      * @internal
    00312      */
    00313   void commitData( QSessionManager& sm );
    00314
    00315     /*
    00316      * Reimplemented for internal purposes, mainly the highlevel
    00317      *  handling of session management with KSessionManaged.
    00318      * @internal
    00319      */
    00320   void saveState( QSessionManager& sm );
    00321
    00331   bool sessionSaving() const;
    00332
    00339   static DCOPClient *dcopClient();
    00340
    00345   static void disableAutoDcopRegistration();
    00346
    00351   QPixmap icon() const;
    00352
    00357   QString iconName() const;
    00358
    00363   QPixmap miniIcon() const;
    00364
    00369   QString miniIconName() const;
    00370
    00381   void setTopWidget( QWidget *topWidget );
    00382
    00393   void invokeHelp( const QString& anchor = QString::null,
    00394                    const QString& appname = QString::null ) const;
    00395
    00410   void invokeHTMLHelp( const QString& aFilename, const QString& aTopic = QString::null ) const;
    00411
    00418   void invokeMailer( const QString &address, const QString &subject );
    00419
    00425   void invokeMailer( const KURL &mailtoURL );
    00426
    00440   void invokeMailer(const QString &to, const QString &cc, const QString &bcc,
    00441                     const QString &subject, const QString &body,
    00442                     const QString &messageFile = QString::null, const QStringList &attachURLs = QStringList());
    00443
    00444 public slots:
    00453   void invokeBrowser( const QString &url );
    00454
    00455 public:
    00461   static QCString launcher();
    00462
    00483   static int startServiceByName( const QString& _name, const QString &URL,
    00484                 QString *error=0, QCString *dcopService=0, int *pid=0, const QCString &startup_id = "", bool noWait = false );
    00485
    00506   static int startServiceByName( const QString& _name, const QStringList &URLs=QStringList(),
    00507                 QString *error=0, QCString *dcopService=0, int *pid=0, const QCString &startup_id = "", bool noWait = false );
    00508
    00529   static int startServiceByDesktopPath( const QString& _name, const QString &URL,
    00530                 QString *error=0, QCString *dcopService=0, int *pid = 0, const QCString &startup_id = "", bool noWait = false );
    00531
    00552   static int startServiceByDesktopPath( const QString& _name, const QStringList &URLs=QStringList(),
    00553                 QString *error=0, QCString *dcopService=0, int *pid = 0, const QCString &startup_id = "", bool noWait = false );
    00554
    00575   static int startServiceByDesktopName( const QString& _name, const QString &URL,
    00576                 QString *error=0, QCString *dcopService=0, int *pid = 0, const QCString &startup_id = "", bool noWait = false );
    00577
    00598   static int startServiceByDesktopName( const QString& _name, const QStringList &URLs=QStringList(),
    00599                 QString *error=0, QCString *dcopService=0, int *pid = 0, const QCString &startup_id = "", bool noWait = false );
    00600
    00618   static int kdeinitExec( const QString& name, const QStringList &args=QStringList(),
    00619                 QString *error=0, int *pid = 0 );
    00620
    00636   static int kdeinitExecWait( const QString& name, const QStringList &args=QStringList(),
    00637                 QString *error=0, int *pid = 0 );
    00638
    00647   QString caption() const;
    00648
    00652   KStyle* kstyle() const { return 0; }
    00653
    00671   QString makeStdCaption( const QString &userCaption,
    00672                           bool withAppName=true, bool modified=false ) const;
    00673
    00681   QString tempSaveName( const QString& pFilename ) const;
    00682
    00692   QString checkRecoverFile( const QString& pFilename, bool& bRecover ) const;
    00693
    00694 #ifdef Q_WS_X11
    00695
    00699   Display *getDisplay() { return display; }
    00700 #endif
    00701
    00709   void enableStyles();
    00710
    00718   void disableStyles();
    00719
    00729   void installX11EventFilter( QWidget* filter );
    00730
    00735   static int random();
    00736
    00742   static QString randomString(int length);
    00743
    00753   void addKipcEventMask(int id);
    00754
    00763   void removeKipcEventMask(int id);
    00764
    00770   QCString startupId() const;
    00771
    00777   void setStartupId( const QCString& startup_id );
    00778
    00784   QString geometryArgument() const;
    00785
    00790   void installKDEPropertyMap();
    00791
    00797   bool authorize(const QString &genericAction);
    00798
    00806   bool authorizeKAction(const char *action);
    00807
    00821   bool authorizeURLAction(const QString &action, const KURL &baseURL, const KURL &destURL);
    00822
    00823
    00824   // Same values as ShiftMask etc. in X.h
    00825   enum { ShiftModifier = 1<<0,
    00826          LockModifier = 1<<1,
    00827          ControlModifier = 1<<2,
    00828          Modifier1 = 1<<3,
    00829          Modifier2 = 1<<4,
    00830          Modifier3 = 1<<5,
    00831          Modifier4 = 1<<6,
    00832          Modifier5 = 1<<7 };
    00843   static uint keyboardModifiers();
    00844
    00845   // Same values as Button1Mask etc. in X.h
    00846   enum { Button1Pressed = 1<<8,
    00847          Button2Pressed = 1<<9,
    00848          Button3Pressed = 1<<10,
    00849          Button4Pressed = 1<<11,
    00850          Button5Pressed = 1<<12 };
    00860   static uint mouseState();
    00861
    00862
    00863 public slots:
    00870   void ref();
    00871
    00876   void deref();
    00877
    00878 protected:
    00882   KApplication( bool allowStyles, bool GUIenabled, KInstance* _instance );
    00883
    00884 #ifdef Q_WS_X11
    00885
    00888   bool x11EventFilter( XEvent * );
    00889
    00890   Display *display;
    00891 #endif
    00892   Atom kipcCommAtom;
    00893   int kipcEventMask;
    00894
    00896   static KApplication *KApp;
    00897   int pArgc;
    00898
    00899 private slots:
    00900   void dcopFailure(const QString &);
    00901   void dcopBlockUserInput( bool );
    00902   void x11FilterDestroyed();
    00903
    00904 private:
    00905   QString sessionConfigName() const;
    00906   KConfig* pSessionConfig; //instance specific application config object
    00907   static DCOPClient *s_DCOPClient; // app specific application communication client
    00908   static bool s_dcopClientNeedsPostInit;
    00909   QString aCaption; // the name for the window title
    00910   bool bSessionManagement;
    00911   QPixmap aIconPixmap;
    00912   QPixmap aMiniIconPixmap;
    00913   QString aIconName;
    00914   QString aMiniIconName;
    00915   bool useStyles;
    00916   QWidget *smw;
    00917
    00918   void init( bool GUIenabled );
    00919
    00920   void parseCommandLine( ); // Handle KDE arguments (Using KCmdLineArgs)
    00921
    00922   void read_app_startup_id();
    00923
    00924   void dcopAutoRegistration();
    00925   void dcopClientPostInit();
    00926   void initUrlActionRestrictions();
    00927 public:
    00931   bool notify(QObject *receiver, QEvent *event);
    00932
    00936   int xioErrhandler();
    00937
    00941   void iceIOErrorHandler( _IceConn *conn );
    00942
    00946   static bool loadedByKdeinit;
    00947
    00951   static void startKdeinit();
    00952
    00956   enum SettingsCategory { SETTINGS_MOUSE, SETTINGS_COMPLETION, SETTINGS_PATHS,
    00957          SETTINGS_POPUPMENU, SETTINGS_QT, SETTINGS_SHORTCUTS };
    00958
    00967   static QPalette createApplicationPalette();
    00968
    00973   static QPalette createApplicationPalette( KConfig *config, int contrast );
    00974
    00975 signals:
    00982   void kdisplayPaletteChanged();
    00983
    00991   void kdisplayStyleChanged();
    00992
    01000   void kdisplayFontChanged();
    01001
    01007   void appearanceChanged();
    01008
    01012   void toolbarAppearanceChanged(int);
    01013
    01019   void backgroundChanged(int desk);
    01020
    01027   void settingsChanged(int category);
    01028
    01033   void iconChanged(int group);
    01034
    01044   void kipcMessage(int id, int data);
    01045
    01075   void saveYourself();
    01076
    01084   void shutDown();
    01085
    01086 private:
    01087   void propagateSettings(SettingsCategory category);
    01088   void kdisplaySetPalette();
    01089   void kdisplaySetStyle();
    01090   void kdisplaySetFont();
    01091   void applyGUIStyle();
    01092
    01093   int captionLayout;
    01094
    01095   KApplication(const KApplication&);
    01096   KApplication& operator=(const KApplication&);
    01097 protected:
    01098   virtual void virtual_hook( int id, void* data );
    01099 private:
    01100   KApplicationPrivate* d;
    01101 };
    01102
    01103
    01119 bool checkAccess(const QString& pathname, int mode);
    01120
    01121
    01122 class KSessionManagedPrivate;
    01123
    01140 class KSessionManaged
    01141 {
    01142 public:
    01143   KSessionManaged();
    01144   virtual ~KSessionManaged();
    01145
    01155   virtual bool saveState( QSessionManager& sm );
    01165   virtual bool commitData( QSessionManager& sm );
    01166
    01167 protected:
    01168   virtual void virtual_hook( int id, void* data );
    01169 private:
    01170   KSessionManagedPrivate *d;
    01171 };
    01172
    01173
    01174 #endif
    01175

This file is part of the documentation for kdelibs Version 3.1.5.
Documentation copyright © 1996-2002 the KDE developers.
Generated on Wed Jan 28 12:46:20 2004 by doxygen 1.3.4 written by Dimitri van Heesch, © 1997-2001