KDEUI
kapplication.h
Go to the documentation of this file.
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 // TODO: KDE5 -#include "kdeversion.h" 00026 #include "kdeversion.h" 00027 #include <kdeui_export.h> 00028 00029 class KConfig; 00030 00031 #ifdef KDE3_SUPPORT 00032 #include <krandom.h> 00033 #include <kcmdlineargs.h> 00034 #include <kiconloader.h> 00035 #include <kicontheme.h> 00036 #include <QtGui/QPixmap> 00037 #include <QtGui/QIcon> 00038 #endif 00039 00040 typedef unsigned long Atom; 00041 #if !defined(Q_WS_X11) 00042 typedef void Display; 00043 #endif 00044 00045 #include <QtGui/QApplication> 00046 #include <kcomponentdata.h> 00047 #include <kglobal.h> 00048 00049 #ifdef Q_WS_X11 00050 #include <QtGui/QX11Info> 00051 #endif 00052 00053 struct _IceConn; 00054 class QPixmap; 00055 00056 #define kapp KApplication::kApplication() 00057 00058 class KApplicationPrivate; 00059 00082 class KDEUI_EXPORT KApplication : public QApplication 00083 { 00084 Q_OBJECT 00085 Q_CLASSINFO("D-Bus Interface", "org.kde.KApplication") 00086 public: 00100 explicit KApplication(bool GUIenabled = true); 00101 00102 #ifdef Q_WS_X11 00103 00118 explicit KApplication(Display *display, Qt::HANDLE visual = 0, Qt::HANDLE colormap = 0); 00119 00137 KApplication(Display *display, int& argc, char** argv, const QByteArray& rAppName, 00138 bool GUIenabled=true); 00139 #endif 00140 00141 virtual ~KApplication(); 00142 00153 static KApplication* kApplication(); 00154 00162 KConfig* sessionConfig(); 00163 00164 #ifdef KDE3_SUPPORT 00165 00174 inline KDE_DEPRECATED bool isRestored() const { return QApplication::isSessionRestored(); } 00175 #endif 00176 00183 void disableSessionManagement(); 00184 00191 void enableSessionManagement(); 00192 00198 void commitData( QSessionManager& sm ); 00199 00205 void saveState( QSessionManager& sm ); 00206 00215 bool sessionSaving() const; 00216 00217 #ifdef KDE3_SUPPORT 00218 00223 inline KDE_DEPRECATED QPixmap icon() const { 00224 int size = IconSize(KIconLoader::Desktop); 00225 return windowIcon().pixmap(size,size); 00226 } 00227 00233 inline KDE_DEPRECATED QPixmap miniIcon() const { 00234 int size = IconSize(KIconLoader::Small); 00235 return windowIcon().pixmap(size,size); 00236 } 00237 #endif 00238 00249 void setTopWidget( QWidget *topWidget ); 00250 00259 #ifndef KDE_NO_DEPRECATED 00260 static KDE_DEPRECATED QString tempSaveName( const QString& pFilename ); 00261 #endif 00262 00272 static QString checkRecoverFile( const QString& pFilename, bool& bRecover ); 00273 00274 #ifdef KDE3_SUPPORT 00275 #ifdef Q_WS_X11 00276 00281 static inline KDE_DEPRECATED Display *getDisplay() { return QX11Info::display(); } 00282 #endif 00283 #endif 00284 00294 void installX11EventFilter( QWidget* filter ); 00295 00300 void removeX11EventFilter( const QWidget* filter ); 00301 00302 #ifdef KDE3_SUPPORT 00303 00308 static inline KDE_DEPRECATED int random() { return KRandom::random(); } 00309 00316 static inline KDE_DEPRECATED QString randomString(int length) { return KRandom::randomString(length); } 00317 #endif 00318 00324 QByteArray startupId() const; 00325 00333 void setStartupId( const QByteArray& startup_id ); 00338 void clearStartupId(); 00339 00343 void setSynchronizeClipboard(bool synchronize); 00344 00349 unsigned long userTimestamp() const; 00350 00358 void updateRemoteUserTimestamp( const QString& service, int time = 0 ); 00359 00360 #ifdef KDE3_SUPPORT 00361 00375 static inline KDE_DEPRECATED QString geometryArgument() { 00376 KCmdLineArgs *args = KCmdLineArgs::parsedArgs("kde"); 00377 return args->isSet("geometry") ? args->getOption("geometry") : QString(); 00378 } 00379 #endif 00380 00384 bool notify( QObject* receiver, QEvent* event ); 00385 00389 int xErrhandler( Display*, void* ); 00390 00394 int xioErrhandler( Display* ); 00395 00399 void iceIOErrorHandler( _IceConn *conn ); 00400 00404 static bool loadedByKdeinit; 00405 00406 public Q_SLOTS: 00412 Q_SCRIPTABLE void updateUserTimestamp( int time = 0 ); 00413 00414 // D-Bus slots: 00415 Q_SCRIPTABLE void reparseConfiguration(); 00416 Q_SCRIPTABLE void quit(); 00417 00418 Q_SIGNALS: 00446 void saveYourself(); 00447 00448 protected: 00452 KApplication(bool GUIenabled, const KComponentData &cData); 00453 00454 #ifdef Q_WS_X11 00455 00458 KApplication(Display *display, Qt::HANDLE visual, Qt::HANDLE colormap, 00459 const KComponentData &cData); 00460 00464 bool x11EventFilter( XEvent * ); 00465 #endif 00466 00468 static KApplication *KApp; 00469 00470 private: 00471 KApplication(const KApplication&); 00472 KApplication& operator=(const KApplication&); 00473 00474 private: 00475 //### KDE4: This is to catch invalid implicit conversions, may want to reconsider 00476 KApplication(bool, bool); 00477 00478 friend class KApplicationPrivate; 00479 KApplicationPrivate* const d; 00480 00481 Q_PRIVATE_SLOT(d, void _k_x11FilterDestroyed()) 00482 Q_PRIVATE_SLOT(d, void _k_checkAppStartedSlot()) 00483 Q_PRIVATE_SLOT(d, void _k_slot_KToolInvocation_hook(QStringList&, QByteArray&)) 00484 }; 00485 00486 #endif 00487
KDE 4.6 API Reference