kdecore Library API Documentation

kstartupinfo.h

00001 /**************************************************************************** 00002 00003 $Id: kstartupinfo.h,v 1.30 2004/05/26 09:22:40 lunakl Exp $ 00004 00005 Copyright (C) 2001-2003 Lubos Lunak <l.lunak@kde.org> 00006 00007 Permission is hereby granted, free of charge, to any person obtaining a 00008 copy of this software and associated documentation files (the "Software"), 00009 to deal in the Software without restriction, including without limitation 00010 the rights to use, copy, modify, merge, publish, distribute, sublicense, 00011 and/or sell copies of the Software, and to permit persons to whom the 00012 Software is furnished to do so, subject to the following conditions: 00013 00014 The above copyright notice and this permission notice shall be included in 00015 all copies or substantial portions of the Software. 00016 00017 THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 00018 IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 00019 FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL 00020 THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 00021 LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING 00022 FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER 00023 DEALINGS IN THE SOFTWARE. 00024 00025 ****************************************************************************/ 00026 00027 #ifndef __KSTARTUPINFO_H 00028 #define __KSTARTUPINFO_H 00029 00030 #include <sys/types.h> 00031 #include <qobject.h> 00032 00033 //#ifdef Q_WS_X11 // FIXME(E): Redo in a less X11-specific way 00034 #include <qcstring.h> 00035 #include <qstring.h> 00036 #include <qvaluelist.h> 00037 00038 class KStartupInfoId; 00039 class KStartupInfoData; 00040 00041 class KStartupInfoPrivate; 00042 00064 class KStartupInfo 00065 : public QObject 00066 { 00067 Q_OBJECT 00068 public: 00077 static void disableAutoAppStartedSending( bool disable = true ); 00078 00086 static void appStarted(); 00087 00093 static void appStarted( const QCString& startup_id ); 00094 00104 static void setNewStartupId( QWidget* window, const QCString& startup_id ); 00105 00115 static void silenceStartup( bool silence ); 00116 00122 static QCString createNewStartupId(); 00126 enum { 00127 CleanOnCantDetect = 1 << 0, 00128 DisableKWinModule = 1 << 1, 00129 AnnounceSilenceChanges = 1 << 2 00130 }; 00131 00150 KStartupInfo( int flags, QObject* parent = NULL, const char* name = NULL ); 00162 KStartupInfo( bool clean_on_cantdetect, QObject* parent = 0, const char* name = 0 ); 00163 virtual ~KStartupInfo(); 00176 static bool sendStartup( const KStartupInfoId& id, const KStartupInfoData& data ); 00177 00186 static bool sendStartupX( Display* dpy, const KStartupInfoId& id, 00187 const KStartupInfoData& data ); 00188 00199 static bool sendChange( const KStartupInfoId& id, const KStartupInfoData& data ); 00200 00208 static bool sendChangeX( Display* dpy, const KStartupInfoId& id, 00209 const KStartupInfoData& data ); 00210 00216 static bool sendFinish( const KStartupInfoId& id ); 00217 00224 static bool sendFinishX( Display* dpy, const KStartupInfoId& id ); 00225 00233 static bool sendFinish( const KStartupInfoId& id, const KStartupInfoData& data ); 00234 00242 static bool sendFinishX( Display* dpy, const KStartupInfoId& id, 00243 const KStartupInfoData& data ); 00244 00251 static KStartupInfoId currentStartupIdEnv(); 00255 static void resetStartupEnv(); 00262 enum startup_t { NoMatch, Match, CantDetect }; 00268 startup_t checkStartup( WId w ); 00276 startup_t checkStartup( WId w, KStartupInfoId& id ); 00284 startup_t checkStartup( WId w, KStartupInfoData& data ); 00293 startup_t checkStartup( WId w, KStartupInfoId& id, KStartupInfoData& data ); 00298 void setTimeout( unsigned int secs ); 00304 static void setWindowStartupId( WId window, const QCString& id ); 00310 static QCString windowStartupId( WId w ); 00314 static void handleAutoAppStartedSending(); 00318 class Data; 00319 signals: 00326 void gotNewStartup( const KStartupInfoId& id, const KStartupInfoData& data ); 00332 void gotStartupChange( const KStartupInfoId& id, const KStartupInfoData& data ); 00339 void gotRemoveStartup( const KStartupInfoId& id, const KStartupInfoData& data ); 00340 protected: 00344 virtual void customEvent( QCustomEvent* e_P ); 00345 private slots: 00346 void startups_cleanup(); 00347 void startups_cleanup_no_age(); 00348 void got_message( const QString& msg ); 00349 void window_added( WId w ); 00350 void slot_window_added( WId w ); 00351 private: 00352 void init( int flags ); 00353 friend class KStartupInfoPrivate; 00354 void got_startup_info( const QString& msg_P, bool update_only_P ); 00355 void got_remove_startup_info( const QString& msg_P ); 00356 void new_startup_info_internal( const KStartupInfoId& id_P, 00357 Data& data_P, bool update_only_P ); 00358 void remove_startup_info_internal( const KStartupInfoId& id_P ); 00359 void remove_startup_pids( const KStartupInfoId& id, const KStartupInfoData& data ); 00360 void remove_startup_pids( const KStartupInfoData& data ); 00361 startup_t check_startup_internal( WId w, KStartupInfoId* id, KStartupInfoData* data ); 00362 bool find_id( const QCString& id_P, KStartupInfoId* id_O, 00363 KStartupInfoData* data_O ); 00364 bool find_pid( pid_t pid_P, const QCString& hostname, KStartupInfoId* id_O, 00365 KStartupInfoData* data_O ); 00366 bool find_wclass( QCString res_name_P, QCString res_class_P, 00367 KStartupInfoId* id_O, KStartupInfoData* data_O ); 00368 static QCString get_window_hostname( WId w_P ); 00369 void startups_cleanup_internal( bool age_P ); 00370 void clean_all_noncompliant(); 00371 static QString check_required_startup_fields( const QString& msg, 00372 const KStartupInfoData& data, int screen ); 00373 bool clean_on_cantdetect_; // KDE4 remove unused 00374 unsigned int timeout; 00375 KStartupInfoPrivate* d; 00376 }; 00377 00378 class KStartupInfoIdPrivate; 00379 00392 class KStartupInfoId 00393 { 00394 public: 00399 bool operator==( const KStartupInfoId& id ) const; 00404 bool operator!=( const KStartupInfoId& id ) const; 00409 bool none() const; 00417 void initId( const QCString& id = "" ); 00422 const QCString& id() const; 00428 unsigned long timestamp() const; 00433 bool setupStartupEnv() const; 00437 KStartupInfoId(); 00441 KStartupInfoId( const KStartupInfoId& data ); 00442 ~KStartupInfoId(); 00443 KStartupInfoId& operator=( const KStartupInfoId& data ); 00444 bool operator<( const KStartupInfoId& id ) const; 00445 private: 00446 KStartupInfoId( const QString& txt ); 00447 QString to_text() const; 00448 friend class KStartupInfo; 00449 KStartupInfoIdPrivate* d; 00450 }; 00451 00452 class KStartupInfoDataPrivate; 00453 00466 class KStartupInfoData 00467 { 00468 public: 00473 void setBin( const QString& bin ); 00478 const QString& bin() const; 00482 void setName( const QString& name ); 00488 const QString& findName() const; 00494 const QString& name() const; 00501 void setDescription( const QString& descr ); 00508 const QString& findDescription() const; 00515 const QString& description() const; 00520 void setIcon( const QString& icon ); 00527 const QString& findIcon() const; 00532 const QString& icon() const; 00538 void setDesktop( int desktop ); 00543 int desktop() const; 00550 void setWMClass( const QCString& wmclass ); 00557 const QCString findWMClass() const; 00563 const QCString& WMClass() const; 00571 void addPid( pid_t pid ); 00576 const QValueList< pid_t >& pids() const; 00582 bool is_pid( pid_t pid ) const; 00588 void setHostname( const QCString& hostname = QCString()); 00593 const QCString& hostname() const; 00594 00598 enum TriState { Yes, No, Unknown }; 00599 00605 void setSilent( TriState state ); 00606 00612 TriState silent() const; 00613 00622 void setTimestamp( unsigned long time ); 00623 00629 unsigned long timestamp() const; 00630 00634 int screen() const; 00635 00640 void setScreen( int screen ); 00641 00647 void update( const KStartupInfoData& data ); 00648 00652 KStartupInfoData(); 00653 00657 KStartupInfoData( const KStartupInfoData& data ); 00658 ~KStartupInfoData(); 00659 KStartupInfoData& operator=( const KStartupInfoData& data ); 00660 private: 00661 KStartupInfoData( const QString& txt ); 00662 QString to_text() const; 00663 void remove_pid( pid_t pid ); 00664 friend class KStartupInfo; 00665 friend class KStartupInfo::Data; 00666 KStartupInfoDataPrivate* d; 00667 }; 00668 00669 #endif
KDE Logo
This file is part of the documentation for kdecore Library Version 3.3.1.
Documentation copyright © 1996-2004 the KDE developers.
Generated on Sun Oct 17 11:26:10 2004 by doxygen 1.3.8 written by Dimitri van Heesch, © 1997-2003