KDEUI
kapplication.h
Go to the documentation of this file.00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021 #ifndef KAPP_H
00022 #define KAPP_H
00023
00024
00025 #include "kdeversion.h"
00026 #include <kdeui_export.h>
00027
00028 class KConfig;
00029
00030 #ifdef KDE3_SUPPORT
00031 #include <krandom.h>
00032 #include <kcmdlineargs.h>
00033 #include <kiconloader.h>
00034 #include <kicontheme.h>
00035 #include <QtGui/QPixmap>
00036 #include <QtGui/QIcon>
00037 #endif
00038
00039 typedef unsigned long Atom;
00040 #if !defined(Q_WS_X11)
00041 typedef void Display;
00042 #endif
00043
00044 #include <QtGui/QApplication>
00045 #include <kcomponentdata.h>
00046 #include <kglobal.h>
00047
00048 #ifdef Q_WS_X11
00049 #include <QtGui/QX11Info>
00050 #endif
00051
00052 struct _IceConn;
00053 class QPixmap;
00054
00055 #define kapp KApplication::kApplication()
00056
00057 class KApplicationPrivate;
00058
00081 class KDEUI_EXPORT KApplication : public QApplication
00082 {
00083 Q_OBJECT
00084 Q_CLASSINFO("D-Bus Interface", "org.kde.KApplication")
00085 public:
00096 explicit KApplication(bool GUIenabled = true);
00097
00098 #ifdef Q_WS_X11
00099
00114 explicit KApplication(Display *display, Qt::HANDLE visual = 0, Qt::HANDLE colormap = 0);
00115
00133 KApplication(Display *display, int& argc, char** argv, const QByteArray& rAppName,
00134 bool GUIenabled=true);
00135 #endif
00136
00137 virtual ~KApplication();
00138
00149 static KApplication* kApplication();
00150
00158 KConfig* sessionConfig();
00159
00160 #ifdef KDE3_SUPPORT
00161
00170 inline KDE_DEPRECATED bool isRestored() const { return QApplication::isSessionRestored(); }
00171 #endif
00172
00179 void disableSessionManagement();
00180
00187 void enableSessionManagement();
00188
00194 void commitData( QSessionManager& sm );
00195
00201 void saveState( QSessionManager& sm );
00202
00211 bool sessionSaving() const;
00212
00213 #ifdef KDE3_SUPPORT
00214
00219 inline KDE_DEPRECATED QPixmap icon() const {
00220 int size = IconSize(KIconLoader::Desktop);
00221 return windowIcon().pixmap(size,size);
00222 }
00223
00229 inline KDE_DEPRECATED QPixmap miniIcon() const {
00230 int size = IconSize(KIconLoader::Small);
00231 return windowIcon().pixmap(size,size);
00232 }
00233 #endif
00234
00245 void setTopWidget( QWidget *topWidget );
00246
00255 static KDE_DEPRECATED QString tempSaveName( const QString& pFilename );
00256
00266 static QString checkRecoverFile( const QString& pFilename, bool& bRecover );
00267
00268 #ifdef KDE3_SUPPORT
00269 #ifdef Q_WS_X11
00270
00275 static inline KDE_DEPRECATED Display *getDisplay() { return QX11Info::display(); }
00276 #endif
00277 #endif
00278
00288 void installX11EventFilter( QWidget* filter );
00289
00294 void removeX11EventFilter( const QWidget* filter );
00295
00296 #ifdef KDE3_SUPPORT
00297
00302 static inline KDE_DEPRECATED int random() { return KRandom::random(); }
00303
00310 static inline KDE_DEPRECATED QString randomString(int length) { return KRandom::randomString(length); }
00311 #endif
00312
00318 QByteArray startupId() const;
00319
00327 void setStartupId( const QByteArray& startup_id );
00332 void clearStartupId();
00333
00337 void setSynchronizeClipboard(bool synchronize);
00338
00343 unsigned long userTimestamp() const;
00344
00352 void updateRemoteUserTimestamp( const QString& service, int time = 0 );
00353
00354 #ifdef KDE3_SUPPORT
00355
00369 static inline KDE_DEPRECATED QString geometryArgument() {
00370 KCmdLineArgs *args = KCmdLineArgs::parsedArgs("kde");
00371 return args->isSet("geometry") ? args->getOption("geometry") : QString();
00372 }
00373 #endif
00374
00378 bool notify( QObject* receiver, QEvent* event );
00379
00383 int xErrhandler( Display*, void* );
00384
00388 int xioErrhandler( Display* );
00389
00393 void iceIOErrorHandler( _IceConn *conn );
00394
00398 static bool loadedByKdeinit;
00399
00400 public Q_SLOTS:
00406 Q_SCRIPTABLE void updateUserTimestamp( int time = 0 );
00407
00408
00409 Q_SCRIPTABLE void reparseConfiguration();
00410 Q_SCRIPTABLE void quit();
00411
00412 Q_SIGNALS:
00440 void saveYourself();
00441
00442 protected:
00446 KApplication(bool GUIenabled, const KComponentData &cData);
00447
00448 #ifdef Q_WS_X11
00449
00452 KApplication(Display *display, Qt::HANDLE visual, Qt::HANDLE colormap,
00453 const KComponentData &cData);
00454
00458 bool x11EventFilter( XEvent * );
00459 #endif
00460
00462 static KApplication *KApp;
00463
00464 private:
00465 KApplication(const KApplication&);
00466 KApplication& operator=(const KApplication&);
00467
00468 private:
00469
00470 KApplication(bool, bool);
00471
00472 friend class KApplicationPrivate;
00473 KApplicationPrivate* const d;
00474
00475 Q_PRIVATE_SLOT(d, void _k_x11FilterDestroyed())
00476 Q_PRIVATE_SLOT(d, void _k_checkAppStartedSlot())
00477 Q_PRIVATE_SLOT(d, void _k_slot_KToolInvocation_hook(QStringList&, QByteArray&))
00478 };
00479
00480 #endif
00481