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:
00092 explicit KApplication(bool GUIenabled = true);
00093
00094 #ifdef Q_WS_X11
00095
00110 explicit KApplication(Display *display, Qt::HANDLE visual = 0, Qt::HANDLE colormap = 0);
00111
00129 KApplication(Display *display, int& argc, char** argv, const QByteArray& rAppName,
00130 bool GUIenabled=true);
00131 #endif
00132
00133 virtual ~KApplication();
00134
00145 static KApplication* kApplication();
00146
00154 KConfig* sessionConfig();
00155
00156 #ifdef KDE3_SUPPORT
00157
00166 inline KDE_DEPRECATED bool isRestored() const { return QApplication::isSessionRestored(); }
00167 #endif
00168
00175 void disableSessionManagement();
00176
00183 void enableSessionManagement();
00184
00190 void commitData( QSessionManager& sm );
00191
00197 void saveState( QSessionManager& sm );
00198
00207 bool sessionSaving() const;
00208
00209 #ifdef KDE3_SUPPORT
00210
00215 inline KDE_DEPRECATED QPixmap icon() const {
00216 int size = IconSize(KIconLoader::Desktop);
00217 return windowIcon().pixmap(size,size);
00218 }
00219
00225 inline KDE_DEPRECATED QPixmap miniIcon() const {
00226 int size = IconSize(KIconLoader::Small);
00227 return windowIcon().pixmap(size,size);
00228 }
00229 #endif
00230
00241 void setTopWidget( QWidget *topWidget );
00242
00251 static KDE_DEPRECATED QString tempSaveName( const QString& pFilename );
00252
00262 static QString checkRecoverFile( const QString& pFilename, bool& bRecover );
00263
00264 #ifdef KDE3_SUPPORT
00265 #ifdef Q_WS_X11
00266
00271 static inline KDE_DEPRECATED Display *getDisplay() { return QX11Info::display(); }
00272 #endif
00273 #endif
00274
00284 void installX11EventFilter( QWidget* filter );
00285
00290 void removeX11EventFilter( const QWidget* filter );
00291
00292 #ifdef KDE3_SUPPORT
00293
00298 static inline KDE_DEPRECATED int random() { return KRandom::random(); }
00299
00306 static inline KDE_DEPRECATED QString randomString(int length) { return KRandom::randomString(length); }
00307 #endif
00308
00314 QByteArray startupId() const;
00315
00323 void setStartupId( const QByteArray& startup_id );
00328 void clearStartupId();
00329
00333 void setSynchronizeClipboard(bool synchronize);
00334
00339 unsigned long userTimestamp() const;
00340
00348 void updateRemoteUserTimestamp( const QString& service, int time = 0 );
00349
00350 #ifdef KDE3_SUPPORT
00351
00365 static inline KDE_DEPRECATED QString geometryArgument() {
00366 KCmdLineArgs *args = KCmdLineArgs::parsedArgs("kde");
00367 return args->isSet("geometry") ? args->getOption("geometry") : QString();
00368 }
00369 #endif
00370
00374 bool notify( QObject* receiver, QEvent* event );
00375
00379 int xErrhandler( Display*, void* );
00380
00384 int xioErrhandler( Display* );
00385
00389 void iceIOErrorHandler( _IceConn *conn );
00390
00394 static bool loadedByKdeinit;
00395
00396 public Q_SLOTS:
00402 Q_SCRIPTABLE void updateUserTimestamp( int time = 0 );
00403
00404
00405 Q_SCRIPTABLE void reparseConfiguration();
00406 Q_SCRIPTABLE void quit();
00407
00408 Q_SIGNALS:
00436 void saveYourself();
00437
00438 protected:
00442 KApplication(bool GUIenabled, const KComponentData &cData);
00443
00444 #ifdef Q_WS_X11
00445
00448 KApplication(Display *display, Qt::HANDLE visual, Qt::HANDLE colormap,
00449 const KComponentData &cData);
00450
00454 bool x11EventFilter( XEvent * );
00455 #endif
00456
00458 static KApplication *KApp;
00459
00460 private:
00461 KApplication(const KApplication&);
00462 KApplication& operator=(const KApplication&);
00463
00464 private:
00465
00466 KApplication(bool, bool);
00467
00468 friend class KApplicationPrivate;
00469 KApplicationPrivate* const d;
00470
00471 Q_PRIVATE_SLOT(d, void _k_x11FilterDestroyed())
00472 Q_PRIVATE_SLOT(d, void _k_checkAppStartedSlot())
00473 Q_PRIVATE_SLOT(d, void _k_slot_KToolInvocation_hook(QStringList&, QByteArray&))
00474 };
00475
00476 #endif
00477