# kdecore Library API Documentation

Overview | Class Hierarchy | Classes | Classes (annotated) | Members | Source Files

# kstartupinfo.h

    00001 /****************************************************************************
    00002
    00003  $Id: kstartupinfo.h,v 1.15.2.4 2003/02/25 08:05:13 lunakl 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:
    00068         enum {
    00069             CleanOnCantDetect           = 1 << 0,
    00070             DisableKWinModule           = 1 << 1,
    00071             AnnounceSilenceChanges      = 1 << 2
    00072             };
    00073
    00092         KStartupInfo( int flags, QObject* parent = NULL, const char* name = NULL );
    00104         KStartupInfo( bool clean_on_cantdetect, QObject* parent = 0, const char* name = 0 );
    00105         virtual ~KStartupInfo();
    00117         static bool sendStartup( const KStartupInfoId& id, const KStartupInfoData& data );
    00118
    00126         static bool sendStartupX( Display* dpy, const KStartupInfoId& id,
    00127             const KStartupInfoData& data );
    00128
    00139         static bool sendChange( const KStartupInfoId& id, const KStartupInfoData& data );
    00140
    00148         static bool sendChangeX( Display* dpy, const KStartupInfoId& id,
    00149             const KStartupInfoData& data );
    00150
    00156         static bool sendFinish( const KStartupInfoId& id );
    00157
    00164         static bool sendFinishX( Display* dpy, const KStartupInfoId& id );
    00165
    00173         static bool sendFinish( const KStartupInfoId& id, const KStartupInfoData& data );
    00174
    00182         static bool sendFinishX( Display* dpy, const KStartupInfoId& id,
    00183             const KStartupInfoData& data );
    00184
    00191         static KStartupInfoId currentStartupIdEnv();
    00195         static void resetStartupEnv();
    00203         static void appStarted();
    00210         enum startup_t { NoMatch, Match, CantDetect };
    00218         startup_t checkStartup( WId w );
    00227         startup_t checkStartup( WId w, KStartupInfoId& id );
    00237         startup_t checkStartup( WId w, KStartupInfoData& data );
    00248         startup_t checkStartup( WId w, KStartupInfoId& id, KStartupInfoData& data );
    00253         void setTimeout( unsigned int secs );
    00259         static void setWindowStartupId( WId window, const QCString& id );
    00265         static QCString windowStartupId( WId w );
    00269         class Data;
    00270     signals:
    00277         void gotNewStartup( const KStartupInfoId& id, const KStartupInfoData& data );
    00283         void gotStartupChange( const KStartupInfoId& id, const KStartupInfoData& data );
    00290         void gotRemoveStartup( const KStartupInfoId& id, const KStartupInfoData& data );
    00291     protected:
    00292         virtual void customEvent( QCustomEvent* e_P );
    00293     private slots:
    00294         void startups_cleanup();
    00295         void startups_cleanup_no_age();
    00296         void got_message( const QString& msg );
    00297         void window_added( WId w );
    00298         void slot_window_added( WId w );
    00299     private:
    00300         void init( int flags );
    00301         friend class KStartupInfoPrivate;
    00302         void got_startup_info( const QString& msg_P, bool update_only_P );
    00303         void got_remove_startup_info( const QString& msg_P );
    00304         void new_startup_info_internal( const KStartupInfoId& id_P,
    00305             Data& data_P, bool update_only_P );
    00306         void remove_startup_info_internal( const KStartupInfoId& id_P );
    00307         void remove_startup_pids( const KStartupInfoId& id, const KStartupInfoData& data );
    00308         void remove_startup_pids( const KStartupInfoData& data );
    00309         startup_t check_startup_internal( WId w, KStartupInfoId* id, KStartupInfoData* data,
    00310             bool remove );
    00311         bool find_id( const QCString& id_P, KStartupInfoId* id_O,
    00312             KStartupInfoData* data_O, bool remove );
    00313         bool find_pid( pid_t pid_P, const QCString& hostname, KStartupInfoId* id_O,
    00314             KStartupInfoData* data_O, bool remove );
    00315         bool find_wclass( QCString res_name_P, QCString res_class_P,
    00316             KStartupInfoId* id_O, KStartupInfoData* data_O, bool remove );
    00317         static QCString get_window_startup_id( WId w_P );
    00318         static QCString get_window_hostname( WId w_P );
    00319         void startups_cleanup_internal( bool age_P );
    00320         void clean_all_noncompliant();
    00321         bool clean_on_cantdetect_; // KDE4 remove unused
    00322         unsigned int timeout;
    00323         KStartupInfoPrivate* d;
    00324     };
    00325
    00326 class KStartupInfoIdPrivate;
    00327
    00340 class KStartupInfoId
    00341     {
    00342     public:
    00347         bool operator==( const KStartupInfoId& id ) const;
    00352         bool operator!=( const KStartupInfoId& id ) const;
    00357         bool none() const;
    00365         void initId( const QCString& id = "" );
    00370         const QCString& id() const;
    00375         bool setupStartupEnv() const;
    00379         KStartupInfoId();
    00383         KStartupInfoId( const KStartupInfoId& data );
    00384         ~KStartupInfoId();
    00385         KStartupInfoId& operator=( const KStartupInfoId& data );
    00386         bool operator<( const KStartupInfoId& id ) const;
    00387     private:
    00388         KStartupInfoId( const QString& txt );
    00389         QString to_text() const;
    00390         friend class KStartupInfo;
    00391         KStartupInfoIdPrivate* d;
    00392     };
    00393
    00394 class KStartupInfoDataPrivate;
    00395
    00408 class KStartupInfoData
    00409     {
    00410     public:
    00415         void setBin( const QString& bin );
    00420         const QString& bin() const;
    00424         void setName( const QString& name );
    00431         const QString& findName() const;
    00437         const QString& name() const;
    00442         void setIcon( const QString& icon );
    00449         const QString& findIcon() const;
    00454         const QString& icon() const;
    00460         void setDesktop( int desktop );
    00465         int desktop() const;
    00472         void setWMClass( const QCString& wmclass );
    00479         const QCString findWMClass() const;
    00485         const QCString& WMClass() const;
    00493         void addPid( pid_t pid );
    00498         const QValueList< pid_t >& pids() const;
    00504         bool is_pid( pid_t pid ) const;
    00510         void setHostname( const QCString& hostname = QCString());
    00515         const QCString& hostname() const;
    00516
    00517         enum TriState { Yes, No, Unknown };
    00518
    00524         void setSilent( TriState state );
    00525
    00531         TriState silent() const;
    00532
    00538         void update( const KStartupInfoData& data );
    00542         KStartupInfoData();
    00543
    00547         KStartupInfoData( const KStartupInfoData& data );
    00548         ~KStartupInfoData();
    00549         KStartupInfoData& operator=( const KStartupInfoData& data );
    00550     private:
    00551         KStartupInfoData( const QString& txt );
    00552         QString to_text() const;
    00553         void remove_pid( pid_t pid );
    00554         friend class KStartupInfo;
    00555         friend class KStartupInfo::Data;
    00556         KStartupInfoDataPrivate* d;
    00557     };
    00558
    00559 #endif
    00560 #endif

This file is part of the documentation for kdelibs Version 3.1.5.
Documentation copyright © 1996-2002 the KDE developers.
Generated on Wed Jan 28 12:46:57 2004 by doxygen 1.3.4 written by Dimitri van Heesch, © 1997-2001