kstartupinfo.h
/****************************************************************************
Copyright (C) 2001-2003 Lubos Lunak <l.lunak@kde.org>
Permission is hereby granted, free of charge, to any person obtaining a
copy of this software and associated documentation files (the "Software"),
to deal in the Software without restriction, including without limitation
the rights to use, copy, modify, merge, publish, distribute, sublicense,
and/or sell copies of the Software, and to permit persons to whom the
Software is furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in
all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
DEALINGS IN THE SOFTWARE.
****************************************************************************/
#ifndef __KSTARTUPINFO_H
#define __KSTARTUPINFO_H
#include <sys/types.h>
#include <qobject.h>
#ifdef Q_WS_X11 // FIXME(E): Redo in a less X11-specific way
#include <qcstring.h>
#include <qstring.h>
#include <qvaluelist.h>
#include "kdelibs_export.h"
class KStartupInfoId;
class KStartupInfoData;
class KStartupInfoPrivate;
class KDECORE_EXPORT KStartupInfo
: public QObject
{
Q_OBJECT
public:
static void disableAutoAppStartedSending( bool disable = true );
static void appStarted();
static void appStarted( const QCString& startup_id );
static void setNewStartupId( QWidget* window, const QCString& startup_id );
static void silenceStartup( bool silence );
static QCString createNewStartupId();
enum {
CleanOnCantDetect = 1 << 0,
DisableKWinModule = 1 << 1,
AnnounceSilenceChanges = 1 << 2
};
KStartupInfo( int flags, QObject* parent = NULL, const char* name = NULL );
KStartupInfo( bool clean_on_cantdetect, QObject* parent = 0, const char* name = 0 );
virtual ~KStartupInfo();
static bool sendStartup( const KStartupInfoId& id, const KStartupInfoData& data );
static bool sendStartupX( Display* dpy, const KStartupInfoId& id,
const KStartupInfoData& data );
static bool sendChange( const KStartupInfoId& id, const KStartupInfoData& data );
static bool sendChangeX( Display* dpy, const KStartupInfoId& id,
const KStartupInfoData& data );
static bool sendFinish( const KStartupInfoId& id );
static bool sendFinishX( Display* dpy, const KStartupInfoId& id );
static bool sendFinish( const KStartupInfoId& id, const KStartupInfoData& data );
static bool sendFinishX( Display* dpy, const KStartupInfoId& id,
const KStartupInfoData& data );
static KStartupInfoId currentStartupIdEnv();
static void resetStartupEnv();
enum startup_t { NoMatch, Match, CantDetect };
startup_t checkStartup( WId w );
startup_t checkStartup( WId w, KStartupInfoId& id );
startup_t checkStartup( WId w, KStartupInfoData& data );
startup_t checkStartup( WId w, KStartupInfoId& id, KStartupInfoData& data );
void setTimeout( unsigned int secs );
static void setWindowStartupId( WId window, const QCString& id );
static QCString windowStartupId( WId w );
static void handleAutoAppStartedSending();
class Data;
signals:
void gotNewStartup( const KStartupInfoId& id, const KStartupInfoData& data );
void gotStartupChange( const KStartupInfoId& id, const KStartupInfoData& data );
void gotRemoveStartup( const KStartupInfoId& id, const KStartupInfoData& data );
protected:
virtual void customEvent( QCustomEvent* e_P );
private slots:
void startups_cleanup();
void startups_cleanup_no_age();
void got_message( const QString& msg );
void window_added( WId w );
void slot_window_added( WId w );
private:
void init( int flags );
friend class KStartupInfoPrivate;
void got_startup_info( const QString& msg_P, bool update_only_P );
void got_remove_startup_info( const QString& msg_P );
void new_startup_info_internal( const KStartupInfoId& id_P,
Data& data_P, bool update_only_P );
void remove_startup_info_internal( const KStartupInfoId& id_P );
void remove_startup_pids( const KStartupInfoId& id, const KStartupInfoData& data );
void remove_startup_pids( const KStartupInfoData& data );
startup_t check_startup_internal( WId w, KStartupInfoId* id, KStartupInfoData* data );
bool find_id( const QCString& id_P, KStartupInfoId* id_O,
KStartupInfoData* data_O );
bool find_pid( pid_t pid_P, const QCString& hostname, KStartupInfoId* id_O,
KStartupInfoData* data_O );
bool find_wclass( QCString res_name_P, QCString res_class_P,
KStartupInfoId* id_O, KStartupInfoData* data_O );
static QCString get_window_hostname( WId w_P );
void startups_cleanup_internal( bool age_P );
void clean_all_noncompliant();
static QString check_required_startup_fields( const QString& msg,
const KStartupInfoData& data, int screen );
bool clean_on_cantdetect_; // KDE4 remove unused
unsigned int timeout;
KStartupInfoPrivate* d;
};
class KStartupInfoIdPrivate;
class KDECORE_EXPORT KStartupInfoId
{
public:
bool operator==( const KStartupInfoId& id ) const;
bool operator!=( const KStartupInfoId& id ) const;
bool none() const;
void initId( const QCString& id = "" );
const QCString& id() const;
unsigned long timestamp() const;
bool setupStartupEnv() const;
KStartupInfoId();
KStartupInfoId( const KStartupInfoId& data );
~KStartupInfoId();
KStartupInfoId& operator=( const KStartupInfoId& data );
bool operator<( const KStartupInfoId& id ) const;
private:
KStartupInfoId( const QString& txt );
QString to_text() const;
friend class KStartupInfo;
KStartupInfoIdPrivate* d;
};
class KStartupInfoDataPrivate;
class KDECORE_EXPORT KStartupInfoData
{
public:
void setBin( const QString& bin );
const QString& bin() const;
void setName( const QString& name );
const QString& findName() const;
const QString& name() const;
void setDescription( const QString& descr );
const QString& findDescription() const;
const QString& description() const;
void setIcon( const QString& icon );
const QString& findIcon() const;
const QString& icon() const;
void setDesktop( int desktop );
int desktop() const;
void setWMClass( const QCString& wmclass );
const QCString findWMClass() const;
const QCString& WMClass() const;
void addPid( pid_t pid );
const QValueList< pid_t >& pids() const;
bool is_pid( pid_t pid ) const;
void setHostname( const QCString& hostname = QCString());
const QCString& hostname() const;
enum TriState { Yes, No, Unknown };
void setSilent( TriState state );
TriState silent() const;
void setTimestamp( unsigned long time );
unsigned long timestamp() const;
int screen() const;
void setScreen( int screen );
void update( const KStartupInfoData& data );
KStartupInfoData();
KStartupInfoData( const KStartupInfoData& data );
~KStartupInfoData();
KStartupInfoData& operator=( const KStartupInfoData& data );
private:
KStartupInfoData( const QString& txt );
QString to_text() const;
void remove_pid( pid_t pid );
friend class KStartupInfo;
friend class KStartupInfo::Data;
KStartupInfoDataPrivate* d;
};
#endif //Q_WS_X11
#endif
KStdAccel::description
QString description(StdAccel id)
Definition: kstdaccel.cpp:381
KStdAction::name
const char * name(StdAction id)

KDE Home | KDE Accessibility Home | Description of Access Keys