# kdecore Library API Documentation

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

# kstartupinfo.h

    00001 /****************************************************************************
    00002
    00003  Copyright (C) 2001-2003 Lubos Lunak        <l.lunak@kde.org>
    00004
    00005 Permission is hereby granted, free of charge, to any person obtaining a
    00006 copy of this software and associated documentation files (the "Software"),
    00007 to deal in the Software without restriction, including without limitation
    00008 the rights to use, copy, modify, merge, publish, distribute, sublicense,
    00009 and/or sell copies of the Software, and to permit persons to whom the
    00010 Software is furnished to do so, subject to the following conditions:
    00011
    00012 The above copyright notice and this permission notice shall be included in
    00013 all copies or substantial portions of the Software.
    00014
    00015 THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
    00016 IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
    00017 FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT SHALL
    00018 THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
    00019 LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
    00020 FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
    00021 DEALINGS IN THE SOFTWARE.
    00022
    00023 ****************************************************************************/
    00024
    00025 #ifndef __KSTARTUPINFO_H
    00026 #define __KSTARTUPINFO_H
    00027
    00028 #include <sys/types.h>
    00029 #include <qobject.h>
    00030
    00031 #ifdef Q_WS_X11 // FIXME(E): Redo in a less X11-specific way
    00032
    00033 #include <qcstring.h>
    00034 #include <qstring.h>
    00035 #include <qvaluelist.h>
    00036 #include "kdelibs_export.h"
    00037
    00038 class KStartupInfoId;
    00039 class KStartupInfoData;
    00040
    00041 class KStartupInfoPrivate;
    00042
    00063 class KDECORE_EXPORT KStartupInfo
    00064     : public QObject
    00065     {
    00066     Q_OBJECT
    00067     public:
    00076         static void disableAutoAppStartedSending( bool disable = true );
    00077
    00085         static void appStarted();
    00086
    00092         static void appStarted( const QCString& startup_id );
    00093
    00103         static void setNewStartupId( QWidget* window, const QCString& startup_id );
    00104
    00114         static void silenceStartup( bool silence );
    00115
    00121         static QCString createNewStartupId();
    00125     enum {
    00126         CleanOnCantDetect       = 1 << 0,
    00127         DisableKWinModule       = 1 << 1,
    00128         AnnounceSilenceChanges  = 1 << 2
    00129         };
    00130
    00149     KStartupInfo( int flags, QObject* parent = NULL, const char* name = NULL );
    00161         KStartupInfo( bool clean_on_cantdetect, QObject* parent = 0, const char* name = 0 );
    00162         virtual ~KStartupInfo();
    00175         static bool sendStartup( const KStartupInfoId& id, const KStartupInfoData& data );
    00176
    00185         static bool sendStartupX( Display* dpy, const KStartupInfoId& id,
    00186             const KStartupInfoData& data );
    00187
    00198         static bool sendChange( const KStartupInfoId& id, const KStartupInfoData& data );
    00199
    00207         static bool sendChangeX( Display* dpy, const KStartupInfoId& id,
    00208             const KStartupInfoData& data );
    00209
    00215         static bool sendFinish( const KStartupInfoId& id );
    00216
    00223         static bool sendFinishX( Display* dpy, const KStartupInfoId& id );
    00224
    00232         static bool sendFinish( const KStartupInfoId& id, const KStartupInfoData& data );
    00233
    00241         static bool sendFinishX( Display* dpy, const KStartupInfoId& id,
    00242             const KStartupInfoData& data );
    00243
    00250         static KStartupInfoId currentStartupIdEnv();
    00254         static void resetStartupEnv();
    00261         enum startup_t { NoMatch, Match, CantDetect };
    00267         startup_t checkStartup( WId w );
    00275         startup_t checkStartup( WId w, KStartupInfoId& id );
    00283         startup_t checkStartup( WId w, KStartupInfoData& data );
    00292         startup_t checkStartup( WId w, KStartupInfoId& id, KStartupInfoData& data );
    00297         void setTimeout( unsigned int secs );
    00303         static void setWindowStartupId( WId window, const QCString& id );
    00309         static QCString windowStartupId( WId w );
    00313         static void handleAutoAppStartedSending();
    00317         class Data;
    00318     signals:
    00325         void gotNewStartup( const KStartupInfoId& id, const KStartupInfoData& data );
    00331         void gotStartupChange( const KStartupInfoId& id, const KStartupInfoData& data );
    00338         void gotRemoveStartup( const KStartupInfoId& id, const KStartupInfoData& data );
    00339     protected:
    00343     virtual void customEvent( QCustomEvent* e_P );
    00344     private slots:
    00345         void startups_cleanup();
    00346         void startups_cleanup_no_age();
    00347         void got_message( const QString& msg );
    00348         void window_added( WId w );
    00349     void slot_window_added( WId w );
    00350     private:
    00351         void init( int flags );
    00352         friend class KStartupInfoPrivate;
    00353         void got_startup_info( const QString& msg_P, bool update_only_P );
    00354         void got_remove_startup_info( const QString& msg_P );
    00355         void new_startup_info_internal( const KStartupInfoId& id_P,
    00356             Data& data_P, bool update_only_P );
    00357         void remove_startup_info_internal( const KStartupInfoId& id_P );
    00358         void remove_startup_pids( const KStartupInfoId& id, const KStartupInfoData& data );
    00359         void remove_startup_pids( const KStartupInfoData& data );
    00360         startup_t check_startup_internal( WId w, KStartupInfoId* id, KStartupInfoData* data );
    00361         bool find_id( const QCString& id_P, KStartupInfoId* id_O,
    00362             KStartupInfoData* data_O );
    00363         bool find_pid( pid_t pid_P, const QCString& hostname, KStartupInfoId* id_O,
    00364             KStartupInfoData* data_O );
    00365         bool find_wclass( QCString res_name_P, QCString res_class_P,
    00366             KStartupInfoId* id_O, KStartupInfoData* data_O );
    00367         static QCString get_window_hostname( WId w_P );
    00368         void startups_cleanup_internal( bool age_P );
    00369         void clean_all_noncompliant();
    00370         static QString check_required_startup_fields( const QString& msg,
    00371             const KStartupInfoData& data, int screen );
    00372         bool clean_on_cantdetect_; // KDE4 remove unused
    00373         unsigned int timeout;
    00374         KStartupInfoPrivate* d;
    00375     };
    00376
    00377 class KStartupInfoIdPrivate;
    00378
    00390 class KDECORE_EXPORT KStartupInfoId
    00391     {
    00392     public:
    00397         bool operator==( const KStartupInfoId& id ) const;
    00402         bool operator!=( const KStartupInfoId& id ) const;
    00407         bool none() const;
    00415         void initId( const QCString& id = "" );
    00420         const QCString& id() const;
    00426         unsigned long timestamp() const;
    00431         bool setupStartupEnv() const;
    00435         KStartupInfoId();
    00439         KStartupInfoId( const KStartupInfoId& data );
    00440         ~KStartupInfoId();
    00441         KStartupInfoId& operator=( const KStartupInfoId& data );
    00442         bool operator<( const KStartupInfoId& id ) const;
    00443     private:
    00444         KStartupInfoId( const QString& txt );
    00445         QString to_text() const;
    00446         friend class KStartupInfo;
    00447         KStartupInfoIdPrivate* d;
    00448     };
    00449
    00450 class KStartupInfoDataPrivate;
    00451
    00463 class KDECORE_EXPORT KStartupInfoData
    00464     {
    00465     public:
    00470         void setBin( const QString& bin );
    00475         const QString& bin() const;
    00479         void setName( const QString& name );
    00485         const QString& findName() const;
    00491         const QString& name() const;
    00498         void setDescription( const QString& descr );
    00505         const QString& findDescription() const;
    00512         const QString& description() const;
    00517         void setIcon( const QString& icon );
    00524         const QString& findIcon() const;
    00529         const QString& icon() const;
    00535         void setDesktop( int desktop );
    00540         int desktop() const;
    00547         void setWMClass( const QCString& wmclass );
    00554         const QCString findWMClass() const;
    00560         const QCString& WMClass() const;
    00568         void addPid( pid_t pid );
    00573         const QValueList< pid_t >& pids() const;
    00579         bool is_pid( pid_t pid ) const;
    00585         void setHostname( const QCString& hostname = QCString());
    00590         const QCString& hostname() const;
    00591
    00595     enum TriState { Yes, No, Unknown };
    00596
    00602     void setSilent( TriState state );
    00603
    00609     TriState silent() const;
    00610
    00619         void setTimestamp( unsigned long time );
    00620
    00626         unsigned long timestamp() const;
    00627
    00631         int screen() const;
    00632
    00637         void setScreen( int screen );
    00638
    00644         void update( const KStartupInfoData& data );
    00645
    00649         KStartupInfoData();
    00650
    00654         KStartupInfoData( const KStartupInfoData& data );
    00655         ~KStartupInfoData();
    00656         KStartupInfoData& operator=( const KStartupInfoData& data );
    00657     private:
    00658         KStartupInfoData( const QString& txt );
    00659         QString to_text() const;
    00660         void remove_pid( pid_t pid );
    00661         friend class KStartupInfo;
    00662         friend class KStartupInfo::Data;
    00663         KStartupInfoDataPrivate* d;
    00664     };
    00665
    00666 #endif //Q_WS_X11
    00667
    00668 #endif

This file is part of the documentation for kdecore Library Version 3.4.1.
Documentation copyright © 1996-2004 the KDE developers.
Generated on Sat Jun 11 20:18:11 2005 by doxygen 1.4.1 written by Dimitri van Heesch, © 1997-2003