kdecore Library API Documentation

kstartupinfo.h

00001 /****************************************************************************
00002 
00003  $Id: kstartupinfo.h,v 1.15 2002/09/16 20:47:12 tjansen Exp $
00004 
00005  Copyright (C) 2001 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 #ifdef Q_WS_X11 // FIXME(E): Redo in a less X11-specific way
00033 #include <qcstring.h>
00034 #include <qstring.h>
00035 #include <qvaluelist.h>
00036 
00037 class KStartupInfoId;
00038 class KStartupInfoData;
00039 
00040 class KStartupInfoPrivate;
00041 
00063 class KStartupInfo
00064     : public QObject
00065     {
00066     Q_OBJECT
00067     public:
00077         KStartupInfo( bool clean_on_cantdetect, QObject* parent = 0, const char* name = 0 );
00078         virtual ~KStartupInfo();
00090         static bool sendStartup( const KStartupInfoId& id, const KStartupInfoData& data );
00091 
00099         static bool sendStartupX( Display* dpy, const KStartupInfoId& id,
00100             const KStartupInfoData& data );
00101 
00112         static bool sendChange( const KStartupInfoId& id, const KStartupInfoData& data );
00113 
00121         static bool sendChangeX( Display* dpy, const KStartupInfoId& id,
00122             const KStartupInfoData& data );
00123 
00129         static bool sendFinish( const KStartupInfoId& id );
00130 
00137         static bool sendFinishX( Display* dpy, const KStartupInfoId& id );
00138 
00146         static bool sendFinish( const KStartupInfoId& id, const KStartupInfoData& data );
00147 
00155         static bool sendFinishX( Display* dpy, const KStartupInfoId& id,
00156             const KStartupInfoData& data );
00157 
00164         static KStartupInfoId currentStartupIdEnv();
00168         static void resetStartupEnv();
00176         static void appStarted();
00183         enum startup_t { NoMatch, Match, CantDetect };
00190         startup_t checkStartup( WId w );
00198         startup_t checkStartup( WId w, KStartupInfoId& id );
00207         startup_t checkStartup( WId w, KStartupInfoData& data );
00217         startup_t checkStartup( WId w, KStartupInfoId& id, KStartupInfoData& data );
00222         void setTimeout( unsigned int secs );
00228         static void setWindowStartupId( WId window, const QCString& id );
00234         static QCString windowStartupId( WId w );
00238         class Data;
00239     signals:
00246         void gotNewStartup( const KStartupInfoId& id, const KStartupInfoData& data );
00252         void gotStartupChange( const KStartupInfoId& id, const KStartupInfoData& data );
00259         void gotRemoveStartup( const KStartupInfoId& id, const KStartupInfoData& data );
00260     protected:
00261     virtual void customEvent( QCustomEvent* e_P );
00262     private slots:
00263         void startups_cleanup();
00264         void startups_cleanup_no_age();
00265         void got_message( const QString& msg );
00266         void window_added( WId w );
00267     void slot_window_added( WId w );
00268     private:
00269         friend class KStartupInfoPrivate;
00270         void got_startup_info( const QString& msg_P, bool update_only_P );
00271         void got_remove_startup_info( const QString& msg_P );
00272         void new_startup_info_internal( const KStartupInfoId& id_P,
00273             Data& data_P, bool update_only_P );
00274         void remove_startup_info_internal( const KStartupInfoId& id_P );
00275         void remove_startup_pids( const KStartupInfoId& id, const KStartupInfoData& data );
00276         void remove_startup_pids( const KStartupInfoData& data );
00277         startup_t check_startup_internal( WId w, KStartupInfoId* id, KStartupInfoData* data,
00278             bool remove );
00279         bool find_id( const QCString& id_P, KStartupInfoId* id_O,
00280             KStartupInfoData* data_O, bool remove );
00281         bool find_pid( pid_t pid_P, const QCString& hostname, KStartupInfoId* id_O,
00282             KStartupInfoData* data_O, bool remove );
00283         bool find_wclass( QCString res_name_P, QCString res_class_P,
00284             KStartupInfoId* id_O, KStartupInfoData* data_O, bool remove );
00285         static QCString get_window_startup_id( WId w_P );
00286         static QCString get_window_hostname( WId w_P );
00287         void startups_cleanup_internal( bool age_P );
00288         void clean_all_noncompliant();
00289         bool clean_on_cantdetect;
00290         unsigned int timeout;
00291         KStartupInfoPrivate* d;
00292     };
00293 
00294 class KStartupInfoIdPrivate;
00295 
00308 class KStartupInfoId
00309     {
00310     public:
00315         bool operator==( const KStartupInfoId& id ) const;
00320         bool operator!=( const KStartupInfoId& id ) const;
00325         bool none() const;
00333         void initId( const QCString& id = "" );
00338         const QCString& id() const;
00343         bool setupStartupEnv() const;
00347         KStartupInfoId();
00351         KStartupInfoId( const KStartupInfoId& data );
00352         ~KStartupInfoId();
00353         KStartupInfoId& operator=( const KStartupInfoId& data );
00354         bool operator<( const KStartupInfoId& id ) const;
00355     private:
00356         KStartupInfoId( const QString& txt );
00357         QString to_text() const;
00358         friend class KStartupInfo;
00359         KStartupInfoIdPrivate* d;
00360     };
00361 
00362 class KStartupInfoDataPrivate;
00363 
00376 class KStartupInfoData
00377     {
00378     public:
00383         void setBin( const QString& bin );
00388         const QString& bin() const;
00392         void setName( const QString& name );
00399         const QString& findName() const;
00405         const QString& name() const;
00410         void setIcon( const QString& icon );
00417         const QString& findIcon() const;
00422         const QString& icon() const;
00428         void setDesktop( int desktop );
00433         int desktop() const;
00440         void setWMClass( const QCString& wmclass );
00447         const QCString findWMClass() const;
00453         const QCString& WMClass() const;
00461         void addPid( pid_t pid );
00466         const QValueList< pid_t >& pids() const;
00472         bool is_pid( pid_t pid ) const;
00478         void setHostname( const QCString& hostname = QCString());
00483         const QCString& hostname() const;
00489         void update( const KStartupInfoData& data );
00493         KStartupInfoData();
00494 
00498         KStartupInfoData( const KStartupInfoData& data );
00499         ~KStartupInfoData();
00500         KStartupInfoData& operator=( const KStartupInfoData& data );
00501     private:
00502         KStartupInfoData( const QString& txt );
00503         QString to_text() const;
00504         void remove_pid( pid_t pid );
00505         friend class KStartupInfo;
00506         friend class KStartupInfo::Data;
00507         KStartupInfoDataPrivate* d;
00508     };
00509 
00510 #endif
00511 #endif
KDE Logo
This file is part of the documentation for kdelibs Version 3.1.0.
Documentation copyright © 1996-2002 the KDE developers.
Generated on Wed Oct 8 12:20:42 2003 by doxygen 1.2.18 written by Dimitri van Heesch, © 1997-2001