Rename KStartup for enhanced compatibility with KDE4

pull/16/head
Timothy Pearson 12 years ago
parent d3afa6baf9
commit 8bc199f487

@ -318,7 +318,7 @@ const char* get_env_var( const char* var, int envc, const char* envs )
#if defined Q_WS_X11 && ! defined K_WS_QTONLY #if defined Q_WS_X11 && ! defined K_WS_QTONLY
//#ifdef Q_WS_X11 // FIXME(E): Implement for Qt/Embedded //#ifdef Q_WS_X11 // FIXME(E): Implement for Qt/Embedded
static void init_startup_info( KStartupInfoId& id, const char* bin, static void init_startup_info( TDEStartupInfoId& id, const char* bin,
int envc, const char* envs ) int envc, const char* envs )
{ {
const char* dpy = get_env_var( DISPLAY"=", envc, envs ); const char* dpy = get_env_var( DISPLAY"=", envc, envs );
@ -328,26 +328,26 @@ static void init_startup_info( KStartupInfoId& id, const char* bin,
if( X11_startup_notify_display == NULL ) if( X11_startup_notify_display == NULL )
return; return;
X11_startup_notify_fd = XConnectionNumber( X11_startup_notify_display ); X11_startup_notify_fd = XConnectionNumber( X11_startup_notify_display );
KStartupInfoData data; TDEStartupInfoData data;
int desktop = get_current_desktop( X11_startup_notify_display ); int desktop = get_current_desktop( X11_startup_notify_display );
data.setDesktop( desktop ); data.setDesktop( desktop );
data.setBin( bin ); data.setBin( bin );
KStartupInfo::sendChangeX( X11_startup_notify_display, id, data ); TDEStartupInfo::sendChangeX( X11_startup_notify_display, id, data );
XFlush( X11_startup_notify_display ); XFlush( X11_startup_notify_display );
} }
static void complete_startup_info( KStartupInfoId& id, pid_t pid ) static void complete_startup_info( TDEStartupInfoId& id, pid_t pid )
{ {
if( X11_startup_notify_display == NULL ) if( X11_startup_notify_display == NULL )
return; return;
if( pid == 0 ) // failure if( pid == 0 ) // failure
KStartupInfo::sendFinishX( X11_startup_notify_display, id ); TDEStartupInfo::sendFinishX( X11_startup_notify_display, id );
else else
{ {
KStartupInfoData data; TDEStartupInfoData data;
data.addPid( pid ); data.addPid( pid );
data.setHostname(); data.setHostname();
KStartupInfo::sendChangeX( X11_startup_notify_display, id, data ); TDEStartupInfo::sendChangeX( X11_startup_notify_display, id, data );
} }
XCloseDisplay( X11_startup_notify_display ); XCloseDisplay( X11_startup_notify_display );
X11_startup_notify_display = NULL; X11_startup_notify_display = NULL;
@ -482,7 +482,7 @@ static pid_t launch(int argc, const char *_name, const char *args,
#if defined Q_WS_X11 && ! defined K_WS_QTONLY #if defined Q_WS_X11 && ! defined K_WS_QTONLY
//#ifdef Q_WS_X11 //#ifdef Q_WS_X11
KStartupInfoId startup_id; TDEStartupInfoId startup_id;
startup_id.initId( startup_id_str ); startup_id.initId( startup_id_str );
if( !startup_id.none()) if( !startup_id.none())
init_startup_info( startup_id, name, envc, envs ); init_startup_info( startup_id, name, envc, envs );
@ -551,7 +551,7 @@ static pid_t launch(int argc, const char *_name, const char *args,
#if defined Q_WS_X11 && ! defined K_WS_QTONLY #if defined Q_WS_X11 && ! defined K_WS_QTONLY
//#ifdef Q_WS_X11 //#ifdef Q_WS_X11
if( startup_id.none()) if( startup_id.none())
KStartupInfo::resetStartupEnv(); TDEStartupInfo::resetStartupEnv();
else else
startup_id.setupStartupEnv(); startup_id.setupStartupEnv();
#endif #endif

@ -758,9 +758,9 @@ KLauncher::requestDone(KLaunchRequest *request)
dpy = XOpenDisplay( request->startup_dpy ); dpy = XOpenDisplay( request->startup_dpy );
if( dpy ) if( dpy )
{ {
KStartupInfoId id; TDEStartupInfoId id;
id.initId( request->startup_id ); id.initId( request->startup_id );
KStartupInfo::sendFinishX( dpy, id ); TDEStartupInfo::sendFinishX( dpy, id );
if( mCached_dpy != dpy && mCached_dpy != NULL ) if( mCached_dpy != dpy && mCached_dpy != NULL )
XCloseDisplay( mCached_dpy ); XCloseDisplay( mCached_dpy );
mCached_dpy = dpy; mCached_dpy = dpy;
@ -1051,7 +1051,7 @@ KLauncher::send_service_startup_info( KLaunchRequest *request, KService::Ptr ser
const TQValueList<TQCString> &envs ) const TQValueList<TQCString> &envs )
{ {
#if defined Q_WS_X11 && ! defined K_WS_QTONLY #if defined Q_WS_X11 && ! defined K_WS_QTONLY
//#ifdef Q_WS_X11 // KStartup* isn't implemented for Qt/Embedded yet //#ifdef Q_WS_X11 // TDEStartup* isn't implemented for Qt/Embedded yet
request->startup_id = "0"; request->startup_id = "0";
if( startup_id == "0" ) if( startup_id == "0" )
return; return;
@ -1059,7 +1059,7 @@ KLauncher::send_service_startup_info( KLaunchRequest *request, KService::Ptr ser
TQCString wmclass; TQCString wmclass;
if( !KRun::checkStartupNotify( TQString::null, service, &silent, &wmclass )) if( !KRun::checkStartupNotify( TQString::null, service, &silent, &wmclass ))
return; return;
KStartupInfoId id; TDEStartupInfoId id;
id.initId( startup_id ); id.initId( startup_id );
const char* dpy_str = NULL; const char* dpy_str = NULL;
for( TQValueList<TQCString>::ConstIterator it = envs.begin(); for( TQValueList<TQCString>::ConstIterator it = envs.begin();
@ -1082,16 +1082,16 @@ KLauncher::send_service_startup_info( KLaunchRequest *request, KService::Ptr ser
request->startup_dpy = dpy_str; request->startup_dpy = dpy_str;
KStartupInfoData data; TDEStartupInfoData data;
data.setName( service->name()); data.setName( service->name());
data.setIcon( service->icon()); data.setIcon( service->icon());
data.setDescription( i18n( "Launching %1" ).arg( service->name())); data.setDescription( i18n( "Launching %1" ).arg( service->name()));
if( !wmclass.isEmpty()) if( !wmclass.isEmpty())
data.setWMClass( wmclass ); data.setWMClass( wmclass );
if( silent ) if( silent )
data.setSilent( KStartupInfoData::Yes ); data.setSilent( TDEStartupInfoData::Yes );
// the rest will be sent by tdeinit // the rest will be sent by tdeinit
KStartupInfo::sendStartupX( dpy, id, data ); TDEStartupInfo::sendStartupX( dpy, id, data );
if( mCached_dpy != dpy && mCached_dpy != NULL ) if( mCached_dpy != dpy && mCached_dpy != NULL )
XCloseDisplay( mCached_dpy ); XCloseDisplay( mCached_dpy );
mCached_dpy = dpy; mCached_dpy = dpy;
@ -1106,7 +1106,7 @@ KLauncher::cancel_service_startup_info( KLaunchRequest* request, const TQCString
const TQValueList<TQCString> &envs ) const TQValueList<TQCString> &envs )
{ {
#if defined Q_WS_X11 && ! defined K_WS_QTONLY #if defined Q_WS_X11 && ! defined K_WS_QTONLY
//#ifdef Q_WS_X11 // KStartup* isn't implemented for Qt/Embedded yet //#ifdef Q_WS_X11 // TDEStartup* isn't implemented for Qt/Embedded yet
if( request != NULL ) if( request != NULL )
request->startup_id = "0"; request->startup_id = "0";
if( !startup_id.isEmpty() && startup_id != "0" ) if( !startup_id.isEmpty() && startup_id != "0" )
@ -1125,9 +1125,9 @@ KLauncher::cancel_service_startup_info( KLaunchRequest* request, const TQCString
dpy = XOpenDisplay( dpy_str ); dpy = XOpenDisplay( dpy_str );
if( dpy == NULL ) if( dpy == NULL )
return; return;
KStartupInfoId id; TDEStartupInfoId id;
id.initId( startup_id ); id.initId( startup_id );
KStartupInfo::sendFinishX( dpy, id ); TDEStartupInfo::sendFinishX( dpy, id );
if( mCached_dpy != dpy && mCached_dpy != NULL ) if( mCached_dpy != dpy && mCached_dpy != NULL )
XCloseDisplay( mCached_dpy ); XCloseDisplay( mCached_dpy );
mCached_dpy = dpy; mCached_dpy = dpy;

@ -152,7 +152,7 @@ void KCMShellMultiDialog::activate( TQCString asn_id )
{ {
kdDebug(780) << k_funcinfo << endl; kdDebug(780) << k_funcinfo << endl;
KStartupInfo::setNewStartupId( this, asn_id ); TDEStartupInfo::setNewStartupId( this, asn_id );
} }
void KCMShell::setDCOPName(const TQCString &dcopName, bool rootMode ) void KCMShell::setDCOPName(const TQCString &dcopName, bool rootMode )

@ -84,16 +84,16 @@ value, and for apps which need it also X-TDE-WMClass should be set. This
sometimes gives slightly better behavior than when these entries are not set. sometimes gives slightly better behavior than when these entries are not set.
The KStartupInfo classes : The TDEStartupInfo classes :
-------------------------- --------------------------
In some cases, or if you are interested in getting the ASN information, you In some cases, or if you are interested in getting the ASN information, you
have to use the KStartupInfo classes in tdelibs/tdecore. have to use the TDEStartupInfo classes in tdelibs/tdecore.
Receiving the application startup notification information : Receiving the application startup notification information :
------------------------------------------------------------ ------------------------------------------------------------
Create an instance of class KStartupInfo and connect to its slots, they Create an instance of class TDEStartupInfo and connect to its slots, they
will be emitted whenever a ASN info is received. will be emitted whenever a ASN info is received.
The clean_on_cantdetect argument to the constructor means whether all The clean_on_cantdetect argument to the constructor means whether all
ASN info for non-compliant apps should be removed when a window is mapped ASN info for non-compliant apps should be removed when a window is mapped
@ -125,8 +125,8 @@ about the finished process should be sent. Since the application may
have forked into background, the finish info should include the PID have forked into background, the finish info should include the PID
and hostname, and the notification will be stopped only if there's and hostname, and the notification will be stopped only if there's
no other PID for it. On the other hand, if you simply really need no other PID for it. On the other hand, if you simply really need
to stop ASN, send only the identification ( KStartupInfo::sendFinish() to stop ASN, send only the identification ( TDEStartupInfo::sendFinish()
with only KStartupInfoId argument ). with only TDEStartupInfoId argument ).
@ -171,11 +171,11 @@ is 'xemacs', but WM_CLASS is 'emacs', 'Emacs', so its X-TDE-WMClass
in its .desktop file should be set to 'emacs' - the case doesn't in its .desktop file should be set to 'emacs' - the case doesn't
matter ). matter ).
The ASN identification string must be a unique string for every ASN. The ASN identification string must be a unique string for every ASN.
In KStartupInfo class, it's created as 'hostname;tm.sec;tm.usec;pid', In TDEStartupInfo class, it's created as 'hostname;tm.sec;tm.usec;pid',
tm being the current time. If the identification string is set to "0", tm being the current time. If the identification string is set to "0",
it means no ASN should be done ( e.g. for things like tdeio_uiserver, it means no ASN should be done ( e.g. for things like tdeio_uiserver,
which shouldn't get ASN ). Empty identification string means the same which shouldn't get ASN ). Empty identification string means the same
like "0", except for the call to KStartupInfoId::initId(), where it means like "0", except for the call to TDEStartupInfoId::initId(), where it means
to create a new one. to create a new one.

@ -552,7 +552,7 @@ bool TDEApplication::notify(TQObject *receiver, TQEvent *event)
TQWidget* w = TQT_TQWIDGET( receiver ); TQWidget* w = TQT_TQWIDGET( receiver );
#if defined Q_WS_X11 #if defined Q_WS_X11
if( w->isTopLevel() && !startupId().isEmpty() && !TQT_TQSHOWEVENT(event)->spontaneous()) // TODO better done using window group leader? if( w->isTopLevel() && !startupId().isEmpty() && !TQT_TQSHOWEVENT(event)->spontaneous()) // TODO better done using window group leader?
KStartupInfo::setWindowStartupId( w->winId(), startupId()); TDEStartupInfo::setWindowStartupId( w->winId(), startupId());
#endif #endif
if( w->isTopLevel() && !w->testWFlags( WX11BypassWM ) && !w->isPopup() && !event->spontaneous()) if( w->isTopLevel() && !w->testWFlags( WX11BypassWM ) && !w->isPopup() && !event->spontaneous())
{ {
@ -586,7 +586,7 @@ bool TDEApplication::notify(TQObject *receiver, TQEvent *event)
void TDEApplication::checkAppStartedSlot() void TDEApplication::checkAppStartedSlot()
{ {
#if defined Q_WS_X11 #if defined Q_WS_X11
KStartupInfo::handleAutoAppStartedSending(); TDEStartupInfo::handleAutoAppStartedSending();
#endif #endif
} }
@ -3024,7 +3024,7 @@ startServiceInternal( const TQCString &function,
stream << envs; stream << envs;
#if defined Q_WS_X11 #if defined Q_WS_X11
// make sure there is id, so that user timestamp exists // make sure there is id, so that user timestamp exists
stream << ( startup_id.isEmpty() ? KStartupInfo::createNewStartupId() : startup_id ); stream << ( startup_id.isEmpty() ? TDEStartupInfo::createNewStartupId() : startup_id );
#endif #endif
if( function.left( 12 ) != "tdeinit_exec" ) if( function.left( 12 ) != "tdeinit_exec" )
stream << noWait; stream << noWait;
@ -3266,7 +3266,7 @@ void TDEApplication::setTopWidget( TQWidget *topWidget )
KWin::setIcons(topWidget->winId(), icon(), miniIcon() ); // NET_WM hints for KWin KWin::setIcons(topWidget->winId(), icon(), miniIcon() ); // NET_WM hints for KWin
// set the app startup notification window property // set the app startup notification window property
KStartupInfo::setWindowStartupId( topWidget->winId(), startupId()); TDEStartupInfo::setWindowStartupId( topWidget->winId(), startupId());
#endif #endif
} }
@ -3280,7 +3280,7 @@ void TDEApplication::setStartupId( const TQCString& startup_id )
if( startup_id == d->startup_id ) if( startup_id == d->startup_id )
return; return;
#if defined Q_WS_X11 #if defined Q_WS_X11
KStartupInfo::handleAutoAppStartedSending(); // finish old startup notification if needed TDEStartupInfo::handleAutoAppStartedSending(); // finish old startup notification if needed
#endif #endif
if( startup_id.isEmpty()) if( startup_id.isEmpty())
d->startup_id = "0"; d->startup_id = "0";
@ -3288,7 +3288,7 @@ void TDEApplication::setStartupId( const TQCString& startup_id )
{ {
d->startup_id = startup_id; d->startup_id = startup_id;
#if defined Q_WS_X11 #if defined Q_WS_X11
KStartupInfoId id; TDEStartupInfoId id;
id.initId( startup_id ); id.initId( startup_id );
long timestamp = id.timestamp(); long timestamp = id.timestamp();
if( timestamp != 0 ) if( timestamp != 0 )
@ -3302,8 +3302,8 @@ void TDEApplication::setStartupId( const TQCString& startup_id )
void TDEApplication::read_app_startup_id() void TDEApplication::read_app_startup_id()
{ {
#if defined Q_WS_X11 #if defined Q_WS_X11
KStartupInfoId id = KStartupInfo::currentStartupIdEnv(); TDEStartupInfoId id = TDEStartupInfo::currentStartupIdEnv();
KStartupInfo::resetStartupEnv(); TDEStartupInfo::resetStartupEnv();
d->startup_id = id.id(); d->startup_id = id.id();
#endif #endif
} }

@ -1071,7 +1071,7 @@ public:
* Sets a new value for the application startup notification window property for newly * Sets a new value for the application startup notification window property for newly
* created toplevel windows. * created toplevel windows.
* @param startup_id the startup notification identifier * @param startup_id the startup notification identifier
* @see KStartupInfo::setNewStartupId * @see TDEStartupInfo::setNewStartupId
*/ */
void setStartupId( const TQCString& startup_id ); void setStartupId( const TQCString& startup_id );

@ -16,7 +16,7 @@
160 tdecore (KNotifyClient) 160 tdecore (KNotifyClient)
170 tdecore (KNetwork socket) 170 tdecore (KNetwork socket)
171 tdecore (KSocks) 171 tdecore (KSocks)
172 tdecore (KStartupInfo) 172 tdecore (TDEStartupInfo)
173 tdecore (KLocale) 173 tdecore (KLocale)
174 tdecore (KProcIO) 174 tdecore (KProcIO)
175 tdecore (TDEProcess) 175 tdecore (TDEProcess)

@ -44,7 +44,7 @@ InfoOutput=4
[129] [129]
InfoOutput=4 InfoOutput=4
# KStartupInfo debug info off # TDEStartupInfo debug info off
[172] [172]
InfoOutput=4 InfoOutput=4

@ -27,7 +27,7 @@ DEALINGS IN THE SOFTWARE.
// kdDebug() can't be turned off in tdeinit // kdDebug() can't be turned off in tdeinit
#if 0 #if 0
#define KSTARTUPINFO_ALL_DEBUG #define KSTARTUPINFO_ALL_DEBUG
#warning Extra KStartupInfo debug messages enabled. #warning Extra TDEStartupInfo debug messages enabled.
#endif #endif
#include <tqwidget.h> #include <tqwidget.h>
@ -80,31 +80,31 @@ static TQString escape_str( const TQString& str_P );
static Atom utf8_string_atom = None; static Atom utf8_string_atom = None;
class KStartupInfo::Data class TDEStartupInfo::Data
: public KStartupInfoData : public TDEStartupInfoData
{ {
public: public:
Data() : KStartupInfoData(), age(0) {} // just because it's in a QMap Data() : TDEStartupInfoData(), age(0) {} // just because it's in a QMap
Data( const TQString& txt_P ) Data( const TQString& txt_P )
: KStartupInfoData( txt_P ), age( 0 ) {} : TDEStartupInfoData( txt_P ), age( 0 ) {}
unsigned int age; unsigned int age;
}; };
struct KStartupInfoPrivate struct TDEStartupInfoPrivate
{ {
public: public:
TQMap< KStartupInfoId, KStartupInfo::Data > startups; TQMap< TDEStartupInfoId, TDEStartupInfo::Data > startups;
// contains silenced ASN's only if !AnnounceSilencedChanges // contains silenced ASN's only if !AnnounceSilencedChanges
TQMap< KStartupInfoId, KStartupInfo::Data > silent_startups; TQMap< TDEStartupInfoId, TDEStartupInfo::Data > silent_startups;
// contains ASN's that had change: but no new: yet // contains ASN's that had change: but no new: yet
TQMap< KStartupInfoId, KStartupInfo::Data > uninited_startups; TQMap< TDEStartupInfoId, TDEStartupInfo::Data > uninited_startups;
#ifdef Q_WS_X11 #ifdef Q_WS_X11
KWinModule* wm_module; KWinModule* wm_module;
KXMessages msgs; KXMessages msgs;
#endif #endif
TQTimer* cleanup; TQTimer* cleanup;
int flags; int flags;
KStartupInfoPrivate( int flags_P ) TDEStartupInfoPrivate( int flags_P )
: :
#ifdef Q_WS_X11 #ifdef Q_WS_X11
msgs( NET_STARTUP_MSG, NULL, false ), msgs( NET_STARTUP_MSG, NULL, false ),
@ -112,21 +112,21 @@ struct KStartupInfoPrivate
flags( flags_P ) {} flags( flags_P ) {}
}; };
KStartupInfo::KStartupInfo( int flags_P, TQObject* parent_P, const char* name_P ) TDEStartupInfo::TDEStartupInfo( int flags_P, TQObject* parent_P, const char* name_P )
: TQObject( parent_P, name_P ), : TQObject( parent_P, name_P ),
timeout( 60 ), d( NULL ) timeout( 60 ), d( NULL )
{ {
init( flags_P ); init( flags_P );
} }
KStartupInfo::KStartupInfo( bool clean_on_cantdetect_P, TQObject* parent_P, const char* name_P ) TDEStartupInfo::TDEStartupInfo( bool clean_on_cantdetect_P, TQObject* parent_P, const char* name_P )
: TQObject( parent_P, name_P ), : TQObject( parent_P, name_P ),
timeout( 60 ), d( NULL ) timeout( 60 ), d( NULL )
{ {
init( clean_on_cantdetect_P ? CleanOnCantDetect : 0 ); init( clean_on_cantdetect_P ? CleanOnCantDetect : 0 );
} }
void KStartupInfo::init( int flags_P ) void TDEStartupInfo::init( int flags_P )
{ {
// d == NULL means "disabled" // d == NULL means "disabled"
if( !TDEApplication::kApplication()) if( !TDEApplication::kApplication())
@ -134,7 +134,7 @@ void KStartupInfo::init( int flags_P )
if( !TDEApplication::kApplication()->getDisplay()) if( !TDEApplication::kApplication()->getDisplay())
return; return;
d = new KStartupInfoPrivate( flags_P ); d = new TDEStartupInfoPrivate( flags_P );
#ifdef Q_WS_X11 #ifdef Q_WS_X11
if( !( d->flags & DisableKWinModule )) if( !( d->flags & DisableKWinModule ))
{ {
@ -150,12 +150,12 @@ void KStartupInfo::init( int flags_P )
connect( d->cleanup, TQT_SIGNAL( timeout()), TQT_SLOT( startups_cleanup())); connect( d->cleanup, TQT_SIGNAL( timeout()), TQT_SLOT( startups_cleanup()));
} }
KStartupInfo::~KStartupInfo() TDEStartupInfo::~TDEStartupInfo()
{ {
delete d; delete d;
} }
void KStartupInfo::got_message( const TQString& msg_P ) void TDEStartupInfo::got_message( const TQString& msg_P )
{ {
// TODO do something with SCREEN= ? // TODO do something with SCREEN= ?
kdDebug( 172 ) << "got:" << msg_P << endl; kdDebug( 172 ) << "got:" << msg_P << endl;
@ -186,12 +186,12 @@ class DelayedWindowEvent
}; };
} }
void KStartupInfo::slot_window_added( WId w_P ) void TDEStartupInfo::slot_window_added( WId w_P )
{ {
kapp->postEvent( this, new DelayedWindowEvent( w_P )); kapp->postEvent( this, new DelayedWindowEvent( w_P ));
} }
void KStartupInfo::customEvent( TQCustomEvent* e_P ) void TDEStartupInfo::customEvent( TQCustomEvent* e_P )
{ {
if( e_P->type() == TQEvent::User + 15 ) if( e_P->type() == TQEvent::User + 15 )
window_added( static_cast< DelayedWindowEvent* >( e_P )->w ); window_added( static_cast< DelayedWindowEvent* >( e_P )->w );
@ -199,10 +199,10 @@ void KStartupInfo::customEvent( TQCustomEvent* e_P )
TQObject::customEvent( e_P ); TQObject::customEvent( e_P );
} }
void KStartupInfo::window_added( WId w_P ) void TDEStartupInfo::window_added( WId w_P )
{ {
KStartupInfoId id; TDEStartupInfoId id;
KStartupInfoData data; TDEStartupInfoData data;
startup_t ret = check_startup_internal( w_P, &id, &data ); startup_t ret = check_startup_internal( w_P, &id, &data );
switch( ret ) switch( ret )
{ {
@ -218,16 +218,16 @@ void KStartupInfo::window_added( WId w_P )
} }
} }
void KStartupInfo::got_startup_info( const TQString& msg_P, bool update_P ) void TDEStartupInfo::got_startup_info( const TQString& msg_P, bool update_P )
{ {
KStartupInfoId id( msg_P ); TDEStartupInfoId id( msg_P );
if( id.none()) if( id.none())
return; return;
KStartupInfo::Data data( msg_P ); TDEStartupInfo::Data data( msg_P );
new_startup_info_internal( id, data, update_P ); new_startup_info_internal( id, data, update_P );
} }
void KStartupInfo::new_startup_info_internal( const KStartupInfoId& id_P, void TDEStartupInfo::new_startup_info_internal( const TDEStartupInfoId& id_P,
Data& data_P, bool update_P ) Data& data_P, bool update_P )
{ {
if( d == NULL ) if( d == NULL )
@ -298,10 +298,10 @@ void KStartupInfo::new_startup_info_internal( const KStartupInfoId& id_P,
d->cleanup->start( 1000 ); // 1 sec d->cleanup->start( 1000 ); // 1 sec
} }
void KStartupInfo::got_remove_startup_info( const TQString& msg_P ) void TDEStartupInfo::got_remove_startup_info( const TQString& msg_P )
{ {
KStartupInfoId id( msg_P ); TDEStartupInfoId id( msg_P );
KStartupInfoData data( msg_P ); TDEStartupInfoData data( msg_P );
if( data.pids().count() > 0 ) if( data.pids().count() > 0 )
{ {
if( !id.none()) if( !id.none())
@ -313,7 +313,7 @@ void KStartupInfo::got_remove_startup_info( const TQString& msg_P )
remove_startup_info_internal( id ); remove_startup_info_internal( id );
} }
void KStartupInfo::remove_startup_info_internal( const KStartupInfoId& id_P ) void TDEStartupInfo::remove_startup_info_internal( const TDEStartupInfoId& id_P )
{ {
if( d == NULL ) if( d == NULL )
return; return;
@ -336,11 +336,11 @@ void KStartupInfo::remove_startup_info_internal( const KStartupInfoId& id_P )
return; return;
} }
void KStartupInfo::remove_startup_pids( const KStartupInfoData& data_P ) void TDEStartupInfo::remove_startup_pids( const TDEStartupInfoData& data_P )
{ // first find the matching info { // first find the matching info
if( d == NULL ) if( d == NULL )
return; return;
for( TQMap< KStartupInfoId, Data >::Iterator it = d->startups.begin(); for( TQMap< TDEStartupInfoId, Data >::Iterator it = d->startups.begin();
it != d->startups.end(); it != d->startups.end();
++it ) ++it )
{ {
@ -353,8 +353,8 @@ void KStartupInfo::remove_startup_pids( const KStartupInfoData& data_P )
} }
} }
void KStartupInfo::remove_startup_pids( const KStartupInfoId& id_P, void TDEStartupInfo::remove_startup_pids( const TDEStartupInfoId& id_P,
const KStartupInfoData& data_P ) const TDEStartupInfoData& data_P )
{ {
if( d == NULL ) if( d == NULL )
return; return;
@ -376,7 +376,7 @@ void KStartupInfo::remove_startup_pids( const KStartupInfoId& id_P,
remove_startup_info_internal( id_P ); remove_startup_info_internal( id_P );
} }
bool KStartupInfo::sendStartup( const KStartupInfoId& id_P, const KStartupInfoData& data_P ) bool TDEStartupInfo::sendStartup( const TDEStartupInfoId& id_P, const TDEStartupInfoData& data_P )
{ {
if( id_P.none()) if( id_P.none())
return false; return false;
@ -389,8 +389,8 @@ bool KStartupInfo::sendStartup( const KStartupInfoId& id_P, const KStartupInfoDa
return true; return true;
} }
bool KStartupInfo::sendStartupX( Display* disp_P, const KStartupInfoId& id_P, bool TDEStartupInfo::sendStartupX( Display* disp_P, const TDEStartupInfoId& id_P,
const KStartupInfoData& data_P ) const TDEStartupInfoData& data_P )
{ {
if( id_P.none()) if( id_P.none())
return false; return false;
@ -403,7 +403,7 @@ bool KStartupInfo::sendStartupX( Display* disp_P, const KStartupInfoId& id_P,
return KXMessages::broadcastMessageX( disp_P, NET_STARTUP_MSG, msg, -1, false ); return KXMessages::broadcastMessageX( disp_P, NET_STARTUP_MSG, msg, -1, false );
} }
TQString KStartupInfo::check_required_startup_fields( const TQString& msg, const KStartupInfoData& data_P, TQString TDEStartupInfo::check_required_startup_fields( const TQString& msg, const TDEStartupInfoData& data_P,
int screen ) int screen )
{ {
TQString ret = msg; TQString ret = msg;
@ -420,7 +420,7 @@ TQString KStartupInfo::check_required_startup_fields( const TQString& msg, const
return ret; return ret;
} }
bool KStartupInfo::sendChange( const KStartupInfoId& id_P, const KStartupInfoData& data_P ) bool TDEStartupInfo::sendChange( const TDEStartupInfoId& id_P, const TDEStartupInfoData& data_P )
{ {
if( id_P.none()) if( id_P.none())
return false; return false;
@ -432,8 +432,8 @@ bool KStartupInfo::sendChange( const KStartupInfoId& id_P, const KStartupInfoDat
return true; return true;
} }
bool KStartupInfo::sendChangeX( Display* disp_P, const KStartupInfoId& id_P, bool TDEStartupInfo::sendChangeX( Display* disp_P, const TDEStartupInfoId& id_P,
const KStartupInfoData& data_P ) const TDEStartupInfoData& data_P )
{ {
if( id_P.none()) if( id_P.none())
return false; return false;
@ -445,7 +445,7 @@ bool KStartupInfo::sendChangeX( Display* disp_P, const KStartupInfoId& id_P,
return KXMessages::broadcastMessageX( disp_P, NET_STARTUP_MSG, msg, -1, false ); return KXMessages::broadcastMessageX( disp_P, NET_STARTUP_MSG, msg, -1, false );
} }
bool KStartupInfo::sendFinish( const KStartupInfoId& id_P ) bool TDEStartupInfo::sendFinish( const TDEStartupInfoId& id_P )
{ {
if( id_P.none()) if( id_P.none())
return false; return false;
@ -456,7 +456,7 @@ bool KStartupInfo::sendFinish( const KStartupInfoId& id_P )
return true; return true;
} }
bool KStartupInfo::sendFinishX( Display* disp_P, const KStartupInfoId& id_P ) bool TDEStartupInfo::sendFinishX( Display* disp_P, const TDEStartupInfoId& id_P )
{ {
if( id_P.none()) if( id_P.none())
return false; return false;
@ -467,7 +467,7 @@ bool KStartupInfo::sendFinishX( Display* disp_P, const KStartupInfoId& id_P )
return KXMessages::broadcastMessageX( disp_P, NET_STARTUP_MSG, msg, -1, false ); return KXMessages::broadcastMessageX( disp_P, NET_STARTUP_MSG, msg, -1, false );
} }
bool KStartupInfo::sendFinish( const KStartupInfoId& id_P, const KStartupInfoData& data_P ) bool TDEStartupInfo::sendFinish( const TDEStartupInfoId& id_P, const TDEStartupInfoData& data_P )
{ {
// if( id_P.none()) // id may be none, the pids and hostname matter then // if( id_P.none()) // id may be none, the pids and hostname matter then
// return false; // return false;
@ -479,8 +479,8 @@ bool KStartupInfo::sendFinish( const KStartupInfoId& id_P, const KStartupInfoDat
return true; return true;
} }
bool KStartupInfo::sendFinishX( Display* disp_P, const KStartupInfoId& id_P, bool TDEStartupInfo::sendFinishX( Display* disp_P, const TDEStartupInfoId& id_P,
const KStartupInfoData& data_P ) const TDEStartupInfoData& data_P )
{ {
// if( id_P.none()) // id may be none, the pids and hostname matter then // if( id_P.none()) // id may be none, the pids and hostname matter then
// return false; // return false;
@ -492,58 +492,58 @@ bool KStartupInfo::sendFinishX( Display* disp_P, const KStartupInfoId& id_P,
return KXMessages::broadcastMessageX( disp_P, NET_STARTUP_MSG, msg, -1, false ); return KXMessages::broadcastMessageX( disp_P, NET_STARTUP_MSG, msg, -1, false );
} }
void KStartupInfo::appStarted() void TDEStartupInfo::appStarted()
{ {
if( kapp != NULL ) // TDEApplication constructor unsets the env. variable if( kapp != NULL ) // TDEApplication constructor unsets the env. variable
appStarted( kapp->startupId()); appStarted( kapp->startupId());
else else
appStarted( KStartupInfo::currentStartupIdEnv().id()); appStarted( TDEStartupInfo::currentStartupIdEnv().id());
} }
void KStartupInfo::appStarted( const TQCString& startup_id ) void TDEStartupInfo::appStarted( const TQCString& startup_id )
{ {
KStartupInfoId id; TDEStartupInfoId id;
id.initId( startup_id ); id.initId( startup_id );
if( id.none()) if( id.none())
return; return;
if( kapp != NULL ) if( kapp != NULL )
KStartupInfo::sendFinish( id ); TDEStartupInfo::sendFinish( id );
else if( getenv( "DISPLAY" ) != NULL ) // don't rely on tqt_xdisplay() else if( getenv( "DISPLAY" ) != NULL ) // don't rely on tqt_xdisplay()
{ {
#ifdef Q_WS_X11 #ifdef Q_WS_X11
Display* disp = XOpenDisplay( NULL ); Display* disp = XOpenDisplay( NULL );
if( disp != NULL ) if( disp != NULL )
{ {
KStartupInfo::sendFinishX( disp, id ); TDEStartupInfo::sendFinishX( disp, id );
XCloseDisplay( disp ); XCloseDisplay( disp );
} }
#endif #endif
} }
} }
void KStartupInfo::disableAutoAppStartedSending( bool disable ) void TDEStartupInfo::disableAutoAppStartedSending( bool disable )
{ {
auto_app_started_sending = !disable; auto_app_started_sending = !disable;
} }
void KStartupInfo::silenceStartup( bool silence ) void TDEStartupInfo::silenceStartup( bool silence )
{ {
KStartupInfoId id; TDEStartupInfoId id;
id.initId( kapp->startupId()); id.initId( kapp->startupId());
if( id.none()) if( id.none())
return; return;
KStartupInfoData data; TDEStartupInfoData data;
data.setSilent( silence ? KStartupInfoData::Yes : KStartupInfoData::No ); data.setSilent( silence ? TDEStartupInfoData::Yes : TDEStartupInfoData::No );
sendChange( id, data ); sendChange( id, data );
} }
void KStartupInfo::handleAutoAppStartedSending() void TDEStartupInfo::handleAutoAppStartedSending()
{ {
if( auto_app_started_sending ) if( auto_app_started_sending )
appStarted(); appStarted();
} }
void KStartupInfo::setNewStartupId( TQWidget* window, const TQCString& startup_id ) void TDEStartupInfo::setNewStartupId( TQWidget* window, const TQCString& startup_id )
{ {
bool activate = true; bool activate = true;
kapp->setStartupId( startup_id ); kapp->setStartupId( startup_id );
@ -554,7 +554,7 @@ void KStartupInfo::setNewStartupId( TQWidget* window, const TQCString& startup_i
NETRootInfo i( tqt_xdisplay(), NET::Supported ); NETRootInfo i( tqt_xdisplay(), NET::Supported );
if( i.isSupported( NET::WM2StartupId )) if( i.isSupported( NET::WM2StartupId ))
{ {
KStartupInfo::setWindowStartupId( window->winId(), startup_id ); TDEStartupInfo::setWindowStartupId( window->winId(), startup_id );
activate = false; // WM will take care of it activate = false; // WM will take care of it
} }
} }
@ -568,32 +568,32 @@ void KStartupInfo::setNewStartupId( TQWidget* window, const TQCString& startup_i
KWin::forceActiveWindow( window->winId()); KWin::forceActiveWindow( window->winId());
} }
} }
KStartupInfo::handleAutoAppStartedSending(); TDEStartupInfo::handleAutoAppStartedSending();
} }
KStartupInfo::startup_t KStartupInfo::checkStartup( WId w_P, KStartupInfoId& id_O, TDEStartupInfo::startup_t TDEStartupInfo::checkStartup( WId w_P, TDEStartupInfoId& id_O,
KStartupInfoData& data_O ) TDEStartupInfoData& data_O )
{ {
return check_startup_internal( w_P, &id_O, &data_O ); return check_startup_internal( w_P, &id_O, &data_O );
} }
KStartupInfo::startup_t KStartupInfo::checkStartup( WId w_P, KStartupInfoId& id_O ) TDEStartupInfo::startup_t TDEStartupInfo::checkStartup( WId w_P, TDEStartupInfoId& id_O )
{ {
return check_startup_internal( w_P, &id_O, NULL ); return check_startup_internal( w_P, &id_O, NULL );
} }
KStartupInfo::startup_t KStartupInfo::checkStartup( WId w_P, KStartupInfoData& data_O ) TDEStartupInfo::startup_t TDEStartupInfo::checkStartup( WId w_P, TDEStartupInfoData& data_O )
{ {
return check_startup_internal( w_P, NULL, &data_O ); return check_startup_internal( w_P, NULL, &data_O );
} }
KStartupInfo::startup_t KStartupInfo::checkStartup( WId w_P ) TDEStartupInfo::startup_t TDEStartupInfo::checkStartup( WId w_P )
{ {
return check_startup_internal( w_P, NULL, NULL ); return check_startup_internal( w_P, NULL, NULL );
} }
KStartupInfo::startup_t KStartupInfo::check_startup_internal( WId w_P, KStartupInfoId* id_O, TDEStartupInfo::startup_t TDEStartupInfo::check_startup_internal( WId w_P, TDEStartupInfoId* id_O,
KStartupInfoData* data_O ) TDEStartupInfoData* data_O )
{ {
if( d == NULL ) if( d == NULL )
return NoMatch; return NoMatch;
@ -661,13 +661,13 @@ KStartupInfo::startup_t KStartupInfo::check_startup_internal( WId w_P, KStartupI
return CantDetect; return CantDetect;
} }
bool KStartupInfo::find_id( const TQCString& id_P, KStartupInfoId* id_O, bool TDEStartupInfo::find_id( const TQCString& id_P, TDEStartupInfoId* id_O,
KStartupInfoData* data_O ) TDEStartupInfoData* data_O )
{ {
if( d == NULL ) if( d == NULL )
return false; return false;
kdDebug( 172 ) << "find_id:" << id_P << endl; kdDebug( 172 ) << "find_id:" << id_P << endl;
KStartupInfoId id; TDEStartupInfoId id;
id.initId( id_P ); id.initId( id_P );
if( d->startups.contains( id )) if( d->startups.contains( id ))
{ {
@ -681,13 +681,13 @@ bool KStartupInfo::find_id( const TQCString& id_P, KStartupInfoId* id_O,
return false; return false;
} }
bool KStartupInfo::find_pid( pid_t pid_P, const TQCString& hostname_P, bool TDEStartupInfo::find_pid( pid_t pid_P, const TQCString& hostname_P,
KStartupInfoId* id_O, KStartupInfoData* data_O ) TDEStartupInfoId* id_O, TDEStartupInfoData* data_O )
{ {
if( d == NULL ) if( d == NULL )
return false; return false;
kdDebug( 172 ) << "find_pid:" << pid_P << endl; kdDebug( 172 ) << "find_pid:" << pid_P << endl;
for( TQMap< KStartupInfoId, Data >::Iterator it = d->startups.begin(); for( TQMap< TDEStartupInfoId, Data >::Iterator it = d->startups.begin();
it != d->startups.end(); it != d->startups.end();
++it ) ++it )
{ {
@ -706,15 +706,15 @@ bool KStartupInfo::find_pid( pid_t pid_P, const TQCString& hostname_P,
return false; return false;
} }
bool KStartupInfo::find_wclass( TQCString res_name, TQCString res_class, bool TDEStartupInfo::find_wclass( TQCString res_name, TQCString res_class,
KStartupInfoId* id_O, KStartupInfoData* data_O ) TDEStartupInfoId* id_O, TDEStartupInfoData* data_O )
{ {
if( d == NULL ) if( d == NULL )
return false; return false;
res_name = res_name.lower(); res_name = res_name.lower();
res_class = res_class.lower(); res_class = res_class.lower();
kdDebug( 172 ) << "find_wclass:" << res_name << ":" << res_class << endl; kdDebug( 172 ) << "find_wclass:" << res_name << ":" << res_class << endl;
for( TQMap< KStartupInfoId, Data >::Iterator it = d->startups.begin(); for( TQMap< TDEStartupInfoId, Data >::Iterator it = d->startups.begin();
it != d->startups.end(); it != d->startups.end();
++it ) ++it )
{ {
@ -758,7 +758,7 @@ static TQCString read_startup_id_property( WId w_P )
#endif #endif
TQCString KStartupInfo::windowStartupId( WId w_P ) TQCString TDEStartupInfo::windowStartupId( WId w_P )
{ {
#ifdef Q_WS_X11 #ifdef Q_WS_X11
if( net_startup_atom == None ) if( net_startup_atom == None )
@ -780,7 +780,7 @@ TQCString KStartupInfo::windowStartupId( WId w_P )
#endif #endif
} }
void KStartupInfo::setWindowStartupId( WId w_P, const TQCString& id_P ) void TDEStartupInfo::setWindowStartupId( WId w_P, const TQCString& id_P )
{ {
#ifdef Q_WS_X11 #ifdef Q_WS_X11
if( id_P.isNull()) if( id_P.isNull())
@ -794,7 +794,7 @@ void KStartupInfo::setWindowStartupId( WId w_P, const TQCString& id_P )
#endif #endif
} }
TQCString KStartupInfo::get_window_hostname( WId w_P ) TQCString TDEStartupInfo::get_window_hostname( WId w_P )
{ {
#ifdef Q_WS_X11 #ifdef Q_WS_X11
XTextProperty tp; XTextProperty tp;
@ -816,19 +816,19 @@ TQCString KStartupInfo::get_window_hostname( WId w_P )
return TQCString(); return TQCString();
} }
void KStartupInfo::setTimeout( unsigned int secs_P ) void TDEStartupInfo::setTimeout( unsigned int secs_P )
{ {
timeout = secs_P; timeout = secs_P;
// schedule removing entries that are older than the new timeout // schedule removing entries that are older than the new timeout
TQTimer::singleShot( 0, this, TQT_SLOT( startups_cleanup_no_age())); TQTimer::singleShot( 0, this, TQT_SLOT( startups_cleanup_no_age()));
} }
void KStartupInfo::startups_cleanup_no_age() void TDEStartupInfo::startups_cleanup_no_age()
{ {
startups_cleanup_internal( false ); startups_cleanup_internal( false );
} }
void KStartupInfo::startups_cleanup() void TDEStartupInfo::startups_cleanup()
{ {
if( d == NULL ) if( d == NULL )
return; return;
@ -841,11 +841,11 @@ void KStartupInfo::startups_cleanup()
startups_cleanup_internal( true ); startups_cleanup_internal( true );
} }
void KStartupInfo::startups_cleanup_internal( bool age_P ) void TDEStartupInfo::startups_cleanup_internal( bool age_P )
{ {
if( d == NULL ) if( d == NULL )
return; return;
for( TQMap< KStartupInfoId, Data >::Iterator it = d->startups.begin(); for( TQMap< TDEStartupInfoId, Data >::Iterator it = d->startups.begin();
it != d->startups.end(); it != d->startups.end();
) )
{ {
@ -856,7 +856,7 @@ void KStartupInfo::startups_cleanup_internal( bool age_P )
tout *= 20; tout *= 20;
if( ( *it ).age >= tout ) if( ( *it ).age >= tout )
{ {
const KStartupInfoId& key = it.key(); const TDEStartupInfoId& key = it.key();
++it; ++it;
kdDebug( 172 ) << "startups entry timeout:" << key.id() << endl; kdDebug( 172 ) << "startups entry timeout:" << key.id() << endl;
remove_startup_info_internal( key ); remove_startup_info_internal( key );
@ -864,7 +864,7 @@ void KStartupInfo::startups_cleanup_internal( bool age_P )
else else
++it; ++it;
} }
for( TQMap< KStartupInfoId, Data >::Iterator it = d->silent_startups.begin(); for( TQMap< TDEStartupInfoId, Data >::Iterator it = d->silent_startups.begin();
it != d->silent_startups.end(); it != d->silent_startups.end();
) )
{ {
@ -875,7 +875,7 @@ void KStartupInfo::startups_cleanup_internal( bool age_P )
tout *= 20; tout *= 20;
if( ( *it ).age >= tout ) if( ( *it ).age >= tout )
{ {
const KStartupInfoId& key = it.key(); const TDEStartupInfoId& key = it.key();
++it; ++it;
kdDebug( 172 ) << "silent entry timeout:" << key.id() << endl; kdDebug( 172 ) << "silent entry timeout:" << key.id() << endl;
remove_startup_info_internal( key ); remove_startup_info_internal( key );
@ -883,7 +883,7 @@ void KStartupInfo::startups_cleanup_internal( bool age_P )
else else
++it; ++it;
} }
for( TQMap< KStartupInfoId, Data >::Iterator it = d->uninited_startups.begin(); for( TQMap< TDEStartupInfoId, Data >::Iterator it = d->uninited_startups.begin();
it != d->uninited_startups.end(); it != d->uninited_startups.end();
) )
{ {
@ -894,7 +894,7 @@ void KStartupInfo::startups_cleanup_internal( bool age_P )
tout *= 20; tout *= 20;
if( ( *it ).age >= tout ) if( ( *it ).age >= tout )
{ {
const KStartupInfoId& key = it.key(); const TDEStartupInfoId& key = it.key();
++it; ++it;
kdDebug( 172 ) << "uninited entry timeout:" << key.id() << endl; kdDebug( 172 ) << "uninited entry timeout:" << key.id() << endl;
remove_startup_info_internal( key ); remove_startup_info_internal( key );
@ -904,11 +904,11 @@ void KStartupInfo::startups_cleanup_internal( bool age_P )
} }
} }
void KStartupInfo::clean_all_noncompliant() void TDEStartupInfo::clean_all_noncompliant()
{ {
if( d == NULL ) if( d == NULL )
return; return;
for( TQMap< KStartupInfoId, Data >::Iterator it = d->startups.begin(); for( TQMap< TDEStartupInfoId, Data >::Iterator it = d->startups.begin();
it != d->startups.end(); it != d->startups.end();
) )
{ {
@ -917,14 +917,14 @@ void KStartupInfo::clean_all_noncompliant()
++it; ++it;
continue; continue;
} }
const KStartupInfoId& key = it.key(); const TDEStartupInfoId& key = it.key();
++it; ++it;
kdDebug( 172 ) << "entry cleaning:" << key.id() << endl; kdDebug( 172 ) << "entry cleaning:" << key.id() << endl;
remove_startup_info_internal( key ); remove_startup_info_internal( key );
} }
} }
TQCString KStartupInfo::createNewStartupId() TQCString TDEStartupInfo::createNewStartupId()
{ {
// Assign a unique id, use hostname+time+pid, that should be 200% unique. // Assign a unique id, use hostname+time+pid, that should be 200% unique.
// Also append the user timestamp (for focus stealing prevention). // Also append the user timestamp (for focus stealing prevention).
@ -941,26 +941,26 @@ TQCString KStartupInfo::createNewStartupId()
} }
struct KStartupInfoIdPrivate struct TDEStartupInfoIdPrivate
{ {
KStartupInfoIdPrivate() : id( "" ) {} TDEStartupInfoIdPrivate() : id( "" ) {}
TQCString id; // id TQCString id; // id
}; };
const TQCString& KStartupInfoId::id() const const TQCString& TDEStartupInfoId::id() const
{ {
return d->id; return d->id;
} }
TQString KStartupInfoId::to_text() const TQString TDEStartupInfoId::to_text() const
{ {
return TQString::fromLatin1( " ID=\"%1\" " ).arg( escape_str( id())); return TQString::fromLatin1( " ID=\"%1\" " ).arg( escape_str( id()));
} }
KStartupInfoId::KStartupInfoId( const TQString& txt_P ) TDEStartupInfoId::TDEStartupInfoId( const TQString& txt_P )
{ {
d = new KStartupInfoIdPrivate; d = new TDEStartupInfoIdPrivate;
TQStringList items = get_fields( txt_P ); TQStringList items = get_fields( txt_P );
const TQString id_str = TQString::fromLatin1( "ID=" ); const TQString id_str = TQString::fromLatin1( "ID=" );
for( TQStringList::Iterator it = items.begin(); for( TQStringList::Iterator it = items.begin();
@ -972,7 +972,7 @@ KStartupInfoId::KStartupInfoId( const TQString& txt_P )
} }
} }
void KStartupInfoId::initId( const TQCString& id_P ) void TDEStartupInfoId::initId( const TQCString& id_P )
{ {
if( !id_P.isEmpty()) if( !id_P.isEmpty())
{ {
@ -991,10 +991,10 @@ void KStartupInfoId::initId( const TQCString& id_P )
#endif #endif
return; return;
} }
d->id = KStartupInfo::createNewStartupId(); d->id = TDEStartupInfo::createNewStartupId();
} }
bool KStartupInfoId::setupStartupEnv() const bool TDEStartupInfoId::setupStartupEnv() const
{ {
if( id().isEmpty()) if( id().isEmpty())
{ {
@ -1004,10 +1004,10 @@ bool KStartupInfoId::setupStartupEnv() const
return setenv( NET_STARTUP_ENV, id(), true ) == 0; return setenv( NET_STARTUP_ENV, id(), true ) == 0;
} }
KStartupInfoId KStartupInfo::currentStartupIdEnv() TDEStartupInfoId TDEStartupInfo::currentStartupIdEnv()
{ {
const char* startup_env = getenv( NET_STARTUP_ENV ); const char* startup_env = getenv( NET_STARTUP_ENV );
KStartupInfoId id; TDEStartupInfoId id;
if( startup_env != NULL && *startup_env != '\0' ) if( startup_env != NULL && *startup_env != '\0' )
id.d->id = startup_env; id.d->id = startup_env;
else else
@ -1015,57 +1015,57 @@ KStartupInfoId KStartupInfo::currentStartupIdEnv()
return id; return id;
} }
void KStartupInfo::resetStartupEnv() void TDEStartupInfo::resetStartupEnv()
{ {
unsetenv( NET_STARTUP_ENV ); unsetenv( NET_STARTUP_ENV );
} }
KStartupInfoId::KStartupInfoId() TDEStartupInfoId::TDEStartupInfoId()
{ {
d = new KStartupInfoIdPrivate; d = new TDEStartupInfoIdPrivate;
} }
KStartupInfoId::~KStartupInfoId() TDEStartupInfoId::~TDEStartupInfoId()
{ {
delete d; delete d;
} }
KStartupInfoId::KStartupInfoId( const KStartupInfoId& id_P ) TDEStartupInfoId::TDEStartupInfoId( const TDEStartupInfoId& id_P )
{ {
d = new KStartupInfoIdPrivate( *id_P.d ); d = new TDEStartupInfoIdPrivate( *id_P.d );
} }
KStartupInfoId& KStartupInfoId::operator=( const KStartupInfoId& id_P ) TDEStartupInfoId& TDEStartupInfoId::operator=( const TDEStartupInfoId& id_P )
{ {
if( &id_P == this ) if( &id_P == this )
return *this; return *this;
delete d; delete d;
d = new KStartupInfoIdPrivate( *id_P.d ); d = new TDEStartupInfoIdPrivate( *id_P.d );
return *this; return *this;
} }
bool KStartupInfoId::operator==( const KStartupInfoId& id_P ) const bool TDEStartupInfoId::operator==( const TDEStartupInfoId& id_P ) const
{ {
return id() == id_P.id(); return id() == id_P.id();
} }
bool KStartupInfoId::operator!=( const KStartupInfoId& id_P ) const bool TDEStartupInfoId::operator!=( const TDEStartupInfoId& id_P ) const
{ {
return !(*this == id_P ); return !(*this == id_P );
} }
// needed for QMap // needed for QMap
bool KStartupInfoId::operator<( const KStartupInfoId& id_P ) const bool TDEStartupInfoId::operator<( const TDEStartupInfoId& id_P ) const
{ {
return id() < id_P.id(); return id() < id_P.id();
} }
bool KStartupInfoId::none() const bool TDEStartupInfoId::none() const
{ {
return d->id.isEmpty() || d->id == "0"; return d->id.isEmpty() || d->id == "0";
} }
unsigned long KStartupInfoId::timestamp() const unsigned long TDEStartupInfoId::timestamp() const
{ {
if( none()) if( none())
return 0; return 0;
@ -1097,14 +1097,14 @@ unsigned long KStartupInfoId::timestamp() const
return time; return time;
} }
} }
// bah ... old KStartupInfo or a problem // bah ... old TDEStartupInfo or a problem
return 0; return 0;
} }
struct KStartupInfoDataPrivate struct TDEStartupInfoDataPrivate
{ {
KStartupInfoDataPrivate() : desktop( 0 ), wmclass( "" ), hostname( "" ), TDEStartupInfoDataPrivate() : desktop( 0 ), wmclass( "" ), hostname( "" ),
silent( KStartupInfoData::Unknown ), timestamp( -1U ), screen( -1 ), xinerama( -1 ), launched_by( 0 ) {} silent( TDEStartupInfoData::Unknown ), timestamp( -1U ), screen( -1 ), xinerama( -1 ), launched_by( 0 ) {}
TQString bin; TQString bin;
TQString name; TQString name;
TQString description; TQString description;
@ -1113,14 +1113,14 @@ struct KStartupInfoDataPrivate
TQValueList< pid_t > pids; TQValueList< pid_t > pids;
TQCString wmclass; TQCString wmclass;
TQCString hostname; TQCString hostname;
KStartupInfoData::TriState silent; TDEStartupInfoData::TriState silent;
unsigned long timestamp; unsigned long timestamp;
int screen; int screen;
int xinerama; int xinerama;
WId launched_by; WId launched_by;
}; };
TQString KStartupInfoData::to_text() const TQString TDEStartupInfoData::to_text() const
{ {
TQString ret = ""; TQString ret = "";
if( !d->bin.isEmpty()) if( !d->bin.isEmpty())
@ -1155,9 +1155,9 @@ TQString KStartupInfoData::to_text() const
return ret; return ret;
} }
KStartupInfoData::KStartupInfoData( const TQString& txt_P ) TDEStartupInfoData::TDEStartupInfoData( const TQString& txt_P )
{ {
d = new KStartupInfoDataPrivate; d = new TDEStartupInfoDataPrivate;
TQStringList items = get_fields( txt_P ); TQStringList items = get_fields( txt_P );
const TQString bin_str = TQString::fromLatin1( "BIN=" ); const TQString bin_str = TQString::fromLatin1( "BIN=" );
const TQString name_str = TQString::fromLatin1( "NAME=" ); const TQString name_str = TQString::fromLatin1( "NAME=" );
@ -1209,21 +1209,21 @@ KStartupInfoData::KStartupInfoData( const TQString& txt_P )
} }
} }
KStartupInfoData::KStartupInfoData( const KStartupInfoData& data ) TDEStartupInfoData::TDEStartupInfoData( const TDEStartupInfoData& data )
{ {
d = new KStartupInfoDataPrivate( *data.d ); d = new TDEStartupInfoDataPrivate( *data.d );
} }
KStartupInfoData& KStartupInfoData::operator=( const KStartupInfoData& data ) TDEStartupInfoData& TDEStartupInfoData::operator=( const TDEStartupInfoData& data )
{ {
if( &data == this ) if( &data == this )
return *this; return *this;
delete d; delete d;
d = new KStartupInfoDataPrivate( *data.d ); d = new TDEStartupInfoDataPrivate( *data.d );
return *this; return *this;
} }
void KStartupInfoData::update( const KStartupInfoData& data_P ) void TDEStartupInfoData::update( const TDEStartupInfoData& data_P )
{ {
if( !data_P.bin().isEmpty()) if( !data_P.bin().isEmpty())
d->bin = data_P.bin(); d->bin = data_P.bin();
@ -1255,105 +1255,105 @@ void KStartupInfoData::update( const KStartupInfoData& data_P )
d->launched_by = data_P.launchedBy(); d->launched_by = data_P.launchedBy();
} }
KStartupInfoData::KStartupInfoData() TDEStartupInfoData::TDEStartupInfoData()
{ {
d = new KStartupInfoDataPrivate; d = new TDEStartupInfoDataPrivate;
} }
KStartupInfoData::~KStartupInfoData() TDEStartupInfoData::~TDEStartupInfoData()
{ {
delete d; delete d;
} }
void KStartupInfoData::setBin( const TQString& bin_P ) void TDEStartupInfoData::setBin( const TQString& bin_P )
{ {
d->bin = bin_P; d->bin = bin_P;
} }
const TQString& KStartupInfoData::bin() const const TQString& TDEStartupInfoData::bin() const
{ {
return d->bin; return d->bin;
} }
void KStartupInfoData::setName( const TQString& name_P ) void TDEStartupInfoData::setName( const TQString& name_P )
{ {
d->name = name_P; d->name = name_P;
} }
const TQString& KStartupInfoData::name() const const TQString& TDEStartupInfoData::name() const
{ {
return d->name; return d->name;
} }
const TQString& KStartupInfoData::findName() const const TQString& TDEStartupInfoData::findName() const
{ {
if( !name().isEmpty()) if( !name().isEmpty())
return name(); return name();
return bin(); return bin();
} }
void KStartupInfoData::setDescription( const TQString& desc_P ) void TDEStartupInfoData::setDescription( const TQString& desc_P )
{ {
d->description = desc_P; d->description = desc_P;
} }
const TQString& KStartupInfoData::description() const const TQString& TDEStartupInfoData::description() const
{ {
return d->description; return d->description;
} }
const TQString& KStartupInfoData::findDescription() const const TQString& TDEStartupInfoData::findDescription() const
{ {
if( !description().isEmpty()) if( !description().isEmpty())
return description(); return description();
return name(); return name();
} }
void KStartupInfoData::setIcon( const TQString& icon_P ) void TDEStartupInfoData::setIcon( const TQString& icon_P )
{ {
d->icon = icon_P; d->icon = icon_P;
} }
const TQString& KStartupInfoData::findIcon() const const TQString& TDEStartupInfoData::findIcon() const
{ {
if( !icon().isEmpty()) if( !icon().isEmpty())
return icon(); return icon();
return bin(); return bin();
} }
const TQString& KStartupInfoData::icon() const const TQString& TDEStartupInfoData::icon() const
{ {
return d->icon; return d->icon;
} }
void KStartupInfoData::setDesktop( int desktop_P ) void TDEStartupInfoData::setDesktop( int desktop_P )
{ {
d->desktop = desktop_P; d->desktop = desktop_P;
} }
int KStartupInfoData::desktop() const int TDEStartupInfoData::desktop() const
{ {
return d->desktop; return d->desktop;
} }
void KStartupInfoData::setWMClass( const TQCString& wmclass_P ) void TDEStartupInfoData::setWMClass( const TQCString& wmclass_P )
{ {
d->wmclass = wmclass_P; d->wmclass = wmclass_P;
} }
const TQCString KStartupInfoData::findWMClass() const const TQCString TDEStartupInfoData::findWMClass() const
{ {
if( !WMClass().isEmpty() && WMClass() != "0" ) if( !WMClass().isEmpty() && WMClass() != "0" )
return WMClass(); return WMClass();
return bin().utf8(); return bin().utf8();
} }
const TQCString& KStartupInfoData::WMClass() const const TQCString& TDEStartupInfoData::WMClass() const
{ {
return d->wmclass; return d->wmclass;
} }
void KStartupInfoData::setHostname( const TQCString& hostname_P ) void TDEStartupInfoData::setHostname( const TQCString& hostname_P )
{ {
if( !hostname_P.isNull()) if( !hostname_P.isNull())
d->hostname = hostname_P; d->hostname = hostname_P;
@ -1367,78 +1367,78 @@ void KStartupInfoData::setHostname( const TQCString& hostname_P )
} }
} }
const TQCString& KStartupInfoData::hostname() const const TQCString& TDEStartupInfoData::hostname() const
{ {
return d->hostname; return d->hostname;
} }
void KStartupInfoData::addPid( pid_t pid_P ) void TDEStartupInfoData::addPid( pid_t pid_P )
{ {
if( !d->pids.contains( pid_P )) if( !d->pids.contains( pid_P ))
d->pids.append( pid_P ); d->pids.append( pid_P );
} }
void KStartupInfoData::remove_pid( pid_t pid_P ) void TDEStartupInfoData::remove_pid( pid_t pid_P )
{ {
d->pids.remove( pid_P ); d->pids.remove( pid_P );
} }
const TQValueList< pid_t >& KStartupInfoData::pids() const const TQValueList< pid_t >& TDEStartupInfoData::pids() const
{ {
return d->pids; return d->pids;
} }
bool KStartupInfoData::is_pid( pid_t pid_P ) const bool TDEStartupInfoData::is_pid( pid_t pid_P ) const
{ {
return d->pids.contains( pid_P ); return d->pids.contains( pid_P );
} }
void KStartupInfoData::setSilent( TriState state_P ) void TDEStartupInfoData::setSilent( TriState state_P )
{ {
d->silent = state_P; d->silent = state_P;
} }
KStartupInfoData::TriState KStartupInfoData::silent() const TDEStartupInfoData::TriState TDEStartupInfoData::silent() const
{ {
return d->silent; return d->silent;
} }
void KStartupInfoData::setTimestamp( unsigned long time ) void TDEStartupInfoData::setTimestamp( unsigned long time )
{ {
d->timestamp = time; d->timestamp = time;
} }
unsigned long KStartupInfoData::timestamp() const unsigned long TDEStartupInfoData::timestamp() const
{ {
return d->timestamp; return d->timestamp;
} }
void KStartupInfoData::setScreen( int screen ) void TDEStartupInfoData::setScreen( int screen )
{ {
d->screen = screen; d->screen = screen;
} }
int KStartupInfoData::screen() const int TDEStartupInfoData::screen() const
{ {
return d->screen; return d->screen;
} }
void KStartupInfoData::setXinerama( int xinerama ) void TDEStartupInfoData::setXinerama( int xinerama )
{ {
d->xinerama = xinerama; d->xinerama = xinerama;
} }
int KStartupInfoData::xinerama() const int TDEStartupInfoData::xinerama() const
{ {
return d->xinerama; return d->xinerama;
} }
void KStartupInfoData::setLaunchedBy( WId window ) void TDEStartupInfoData::setLaunchedBy( WId window )
{ {
d->launched_by = window; d->launched_by = window;
} }
WId KStartupInfoData::launchedBy() const WId TDEStartupInfoData::launchedBy() const
{ {
return d->launched_by; return d->launched_by;
} }

@ -39,10 +39,10 @@ DEALINGS IN THE SOFTWARE.
#include <tqvaluelist.h> #include <tqvaluelist.h>
#include "tdelibs_export.h" #include "tdelibs_export.h"
class KStartupInfoId; class TDEStartupInfoId;
class KStartupInfoData; class TDEStartupInfoData;
class KStartupInfoPrivate; class TDEStartupInfoPrivate;
/** /**
* Class for manipulating the application startup notification. * Class for manipulating the application startup notification.
@ -59,12 +59,12 @@ class KStartupInfoPrivate;
* to its slots. It will automatically detect started applications and when * to its slots. It will automatically detect started applications and when
* they are ready. * they are ready.
* *
* @see KStartupInfoId * @see TDEStartupInfoId
* @see KStartupInfoData * @see TDEStartupInfoData
* *
* @author Lubos Lunak <l.lunak@kde.org> * @author Lubos Lunak <l.lunak@kde.org>
*/ */
class TDECORE_EXPORT KStartupInfo class TDECORE_EXPORT TDEStartupInfo
: public TQObject : public TQObject
{ {
Q_OBJECT Q_OBJECT
@ -151,7 +151,7 @@ class TDECORE_EXPORT KStartupInfo
* @param name the name of the TQObject (can be 0 for no name) * @param name the name of the TQObject (can be 0 for no name)
* *
*/ */
KStartupInfo( int flags, TQObject* parent = NULL, const char* name = NULL ); TDEStartupInfo( int flags, TQObject* parent = NULL, const char* name = NULL );
/** /**
* Creates an instance that will receive the startup notifications. * Creates an instance that will receive the startup notifications.
* *
@ -163,8 +163,8 @@ class TDECORE_EXPORT KStartupInfo
* *
* @obsolete * @obsolete
*/ */
KStartupInfo( bool clean_on_cantdetect, TQObject* parent = 0, const char* name = 0 ); TDEStartupInfo( bool clean_on_cantdetect, TQObject* parent = 0, const char* name = 0 );
virtual ~KStartupInfo(); virtual ~TDEStartupInfo();
/** /**
* Sends given notification data about started application * Sends given notification data about started application
* with the given startup identification. If no notification for this identification * with the given startup identification. If no notification for this identification
@ -174,10 +174,10 @@ class TDECORE_EXPORT KStartupInfo
* @param id the id of the application * @param id the id of the application
* @param data the application's data * @param data the application's data
* @return true if successful, false otherwise * @return true if successful, false otherwise
* @see KStartupInfoId * @see TDEStartupInfoId
* @see KStartupInfoData * @see TDEStartupInfoData
*/ */
static bool sendStartup( const KStartupInfoId& id, const KStartupInfoData& data ); static bool sendStartup( const TDEStartupInfoId& id, const TDEStartupInfoData& data );
/** /**
* Like sendStartup , uses dpy instead of tqt_xdisplay() for sending the info. * Like sendStartup , uses dpy instead of tqt_xdisplay() for sending the info.
@ -187,8 +187,8 @@ class TDECORE_EXPORT KStartupInfo
* @param data the application's data * @param data the application's data
* @return true if successful, false otherwise * @return true if successful, false otherwise
*/ */
static bool sendStartupX( Display* dpy, const KStartupInfoId& id, static bool sendStartupX( Display* dpy, const TDEStartupInfoId& id,
const KStartupInfoData& data ); const TDEStartupInfoData& data );
/** /**
* Sends given notification data about started application * Sends given notification data about started application
@ -197,10 +197,10 @@ class TDECORE_EXPORT KStartupInfo
* @param id the id of the application * @param id the id of the application
* @param data the application's data * @param data the application's data
* @return true if successful, false otherwise * @return true if successful, false otherwise
* @see KStartupInfoId * @see TDEStartupInfoId
* @see KStartupInfoData * @see TDEStartupInfoData
*/ */
static bool sendChange( const KStartupInfoId& id, const KStartupInfoData& data ); static bool sendChange( const TDEStartupInfoId& id, const TDEStartupInfoData& data );
/** /**
* Like sendChange , uses dpy instead of tqt_xdisplay() for sending the info. * Like sendChange , uses dpy instead of tqt_xdisplay() for sending the info.
@ -209,15 +209,15 @@ class TDECORE_EXPORT KStartupInfo
* @param data the application's data * @param data the application's data
* @return true if successful, false otherwise * @return true if successful, false otherwise
*/ */
static bool sendChangeX( Display* dpy, const KStartupInfoId& id, static bool sendChangeX( Display* dpy, const TDEStartupInfoId& id,
const KStartupInfoData& data ); const TDEStartupInfoData& data );
/** /**
* Ends startup notification with the given identification. * Ends startup notification with the given identification.
* @param id the id of the application * @param id the id of the application
* @return true if successful, false otherwise * @return true if successful, false otherwise
*/ */
static bool sendFinish( const KStartupInfoId& id ); static bool sendFinish( const TDEStartupInfoId& id );
/** /**
* Like sendFinish , uses dpy instead of tqt_xdisplay() for sending the info. * Like sendFinish , uses dpy instead of tqt_xdisplay() for sending the info.
@ -225,7 +225,7 @@ class TDECORE_EXPORT KStartupInfo
* @param id the id of the application * @param id the id of the application
* @return true if successful, false otherwise * @return true if successful, false otherwise
*/ */
static bool sendFinishX( Display* dpy, const KStartupInfoId& id ); static bool sendFinishX( Display* dpy, const TDEStartupInfoId& id );
/** /**
* Ends startup notification with the given identification and the given data ( e.g. * Ends startup notification with the given identification and the given data ( e.g.
@ -234,7 +234,7 @@ class TDECORE_EXPORT KStartupInfo
* @param data the application's data * @param data the application's data
* @return true if successful, false otherwise * @return true if successful, false otherwise
*/ */
static bool sendFinish( const KStartupInfoId& id, const KStartupInfoData& data ); static bool sendFinish( const TDEStartupInfoId& id, const TDEStartupInfoData& data );
/** /**
* Like sendFinish , uses dpy instead of tqt_xdisplay() for sending the info. * Like sendFinish , uses dpy instead of tqt_xdisplay() for sending the info.
@ -243,8 +243,8 @@ class TDECORE_EXPORT KStartupInfo
* @param data the application's data * @param data the application's data
* @return true if successful, false otherwise * @return true if successful, false otherwise
*/ */
static bool sendFinishX( Display* dpy, const KStartupInfoId& id, static bool sendFinishX( Display* dpy, const TDEStartupInfoId& id,
const KStartupInfoData& data ); const TDEStartupInfoData& data );
/** /**
* Returns the current startup notification identification for the current * Returns the current startup notification identification for the current
@ -252,7 +252,7 @@ class TDECORE_EXPORT KStartupInfo
* unsets the variable and you have to use TDEApplication::startupId . * unsets the variable and you have to use TDEApplication::startupId .
* @return the current startup notification identification * @return the current startup notification identification
*/ */
static KStartupInfoId currentStartupIdEnv(); static TDEStartupInfoId currentStartupIdEnv();
/** /**
* Unsets the startup notification environment variable. * Unsets the startup notification environment variable.
*/ */
@ -277,7 +277,7 @@ class TDECORE_EXPORT KStartupInfo
* @param id if found, the id of the startup notification will be written here * @param id if found, the id of the startup notification will be written here
* @return the result of the operation * @return the result of the operation
*/ */
startup_t checkStartup( WId w, KStartupInfoId& id ); startup_t checkStartup( WId w, TDEStartupInfoId& id );
/** /**
* Checks if the given windows matches any existing startup notification, and * Checks if the given windows matches any existing startup notification, and
* if yes, returns the notification data in data. * if yes, returns the notification data in data.
@ -285,7 +285,7 @@ class TDECORE_EXPORT KStartupInfo
* @param data if found, the data of the startup notification will be written here * @param data if found, the data of the startup notification will be written here
* @return the result of the operation * @return the result of the operation
*/ */
startup_t checkStartup( WId w, KStartupInfoData& data ); startup_t checkStartup( WId w, TDEStartupInfoData& data );
/** /**
* Checks if the given windows matches any existing startup notification, and * Checks if the given windows matches any existing startup notification, and
* if yes, returns the identification in id and notification data in data. * if yes, returns the identification in id and notification data in data.
@ -294,7 +294,7 @@ class TDECORE_EXPORT KStartupInfo
* @param data if found, the data of the startup notification will be written here * @param data if found, the data of the startup notification will be written here
* @return the result of the operation * @return the result of the operation
*/ */
startup_t checkStartup( WId w, KStartupInfoId& id, KStartupInfoData& data ); startup_t checkStartup( WId w, TDEStartupInfoId& id, TDEStartupInfoData& data );
/** /**
* Sets the timeout for notifications, after this timeout a notification is removed. * Sets the timeout for notifications, after this timeout a notification is removed.
* @param secs the new timeout in seconds * @param secs the new timeout in seconds
@ -327,20 +327,20 @@ class TDECORE_EXPORT KStartupInfo
* @param id the notification identification * @param id the notification identification
* @param data the notification data * @param data the notification data
*/ */
void gotNewStartup( const KStartupInfoId& id, const KStartupInfoData& data ); void gotNewStartup( const TDEStartupInfoId& id, const TDEStartupInfoData& data );
/** /**
* Emitted when a startup notification changes. * Emitted when a startup notification changes.
* @param id the notification identification * @param id the notification identification
* @param data the notification data * @param data the notification data
*/ */
void gotStartupChange( const KStartupInfoId& id, const KStartupInfoData& data ); void gotStartupChange( const TDEStartupInfoId& id, const TDEStartupInfoData& data );
/** /**
* Emitted when a startup notification is removed (either because it was detected * Emitted when a startup notification is removed (either because it was detected
* that the application is ready or because of a timeout). * that the application is ready or because of a timeout).
* @param id the notification identification * @param id the notification identification
* @param data the notification data * @param data the notification data
*/ */
void gotRemoveStartup( const KStartupInfoId& id, const KStartupInfoData& data ); void gotRemoveStartup( const TDEStartupInfoId& id, const TDEStartupInfoData& data );
protected: protected:
/** /**
* *
@ -354,32 +354,32 @@ class TDECORE_EXPORT KStartupInfo
void slot_window_added( WId w ); void slot_window_added( WId w );
private: private:
void init( int flags ); void init( int flags );
friend class KStartupInfoPrivate; friend class TDEStartupInfoPrivate;
void got_startup_info( const TQString& msg_P, bool update_only_P ); void got_startup_info( const TQString& msg_P, bool update_only_P );
void got_remove_startup_info( const TQString& msg_P ); void got_remove_startup_info( const TQString& msg_P );
void new_startup_info_internal( const KStartupInfoId& id_P, void new_startup_info_internal( const TDEStartupInfoId& id_P,
Data& data_P, bool update_only_P ); Data& data_P, bool update_only_P );
void remove_startup_info_internal( const KStartupInfoId& id_P ); void remove_startup_info_internal( const TDEStartupInfoId& id_P );
void remove_startup_pids( const KStartupInfoId& id, const KStartupInfoData& data ); void remove_startup_pids( const TDEStartupInfoId& id, const TDEStartupInfoData& data );
void remove_startup_pids( const KStartupInfoData& data ); void remove_startup_pids( const TDEStartupInfoData& data );
startup_t check_startup_internal( WId w, KStartupInfoId* id, KStartupInfoData* data ); startup_t check_startup_internal( WId w, TDEStartupInfoId* id, TDEStartupInfoData* data );
bool find_id( const TQCString& id_P, KStartupInfoId* id_O, bool find_id( const TQCString& id_P, TDEStartupInfoId* id_O,
KStartupInfoData* data_O ); TDEStartupInfoData* data_O );
bool find_pid( pid_t pid_P, const TQCString& hostname, KStartupInfoId* id_O, bool find_pid( pid_t pid_P, const TQCString& hostname, TDEStartupInfoId* id_O,
KStartupInfoData* data_O ); TDEStartupInfoData* data_O );
bool find_wclass( TQCString res_name_P, TQCString res_class_P, bool find_wclass( TQCString res_name_P, TQCString res_class_P,
KStartupInfoId* id_O, KStartupInfoData* data_O ); TDEStartupInfoId* id_O, TDEStartupInfoData* data_O );
static TQCString get_window_hostname( WId w_P ); static TQCString get_window_hostname( WId w_P );
void startups_cleanup_internal( bool age_P ); void startups_cleanup_internal( bool age_P );
void clean_all_noncompliant(); void clean_all_noncompliant();
static TQString check_required_startup_fields( const TQString& msg, static TQString check_required_startup_fields( const TQString& msg,
const KStartupInfoData& data, int screen ); const TDEStartupInfoData& data, int screen );
bool clean_on_cantdetect_; // KDE4 remove unused bool clean_on_cantdetect_; // KDE4 remove unused
unsigned int timeout; unsigned int timeout;
KStartupInfoPrivate* d; TDEStartupInfoPrivate* d;
}; };
class KStartupInfoIdPrivate; class TDEStartupInfoIdPrivate;
/** /**
* Class representing an identification of application startup notification. * Class representing an identification of application startup notification.
@ -387,24 +387,24 @@ class KStartupInfoIdPrivate;
* Every existing notification about a starting application has its own unique * Every existing notification about a starting application has its own unique
* identification, that's used to identify and manipulate the notification. * identification, that's used to identify and manipulate the notification.
* *
* @see KStartupInfo * @see TDEStartupInfo
* @see KStartupInfoData * @see TDEStartupInfoData
* *
* @author Lubos Lunak <l.lunak@kde.org> * @author Lubos Lunak <l.lunak@kde.org>
*/ */
class TDECORE_EXPORT KStartupInfoId class TDECORE_EXPORT TDEStartupInfoId
{ {
public: public:
/** /**
* Overloaded operator. * Overloaded operator.
* @return true if the notification identifications are the same * @return true if the notification identifications are the same
*/ */
bool operator==( const KStartupInfoId& id ) const; bool operator==( const TDEStartupInfoId& id ) const;
/** /**
* Overloaded operator. * Overloaded operator.
* @return true if the notification identifications are different * @return true if the notification identifications are different
*/ */
bool operator!=( const KStartupInfoId& id ) const; bool operator!=( const TDEStartupInfoId& id ) const;
/** /**
* Checks whether the identifier is valid. * Checks whether the identifier is valid.
* @return true if this object doesn't represent a valid notification identification * @return true if this object doesn't represent a valid notification identification
@ -437,22 +437,22 @@ class TDECORE_EXPORT KStartupInfoId
/** /**
* Creates an empty identification * Creates an empty identification
*/ */
KStartupInfoId(); TDEStartupInfoId();
/** /**
* Copy constructor. * Copy constructor.
*/ */
KStartupInfoId( const KStartupInfoId& data ); TDEStartupInfoId( const TDEStartupInfoId& data );
~KStartupInfoId(); ~TDEStartupInfoId();
KStartupInfoId& operator=( const KStartupInfoId& data ); TDEStartupInfoId& operator=( const TDEStartupInfoId& data );
bool operator<( const KStartupInfoId& id ) const; bool operator<( const TDEStartupInfoId& id ) const;
private: private:
KStartupInfoId( const TQString& txt ); TDEStartupInfoId( const TQString& txt );
TQString to_text() const; TQString to_text() const;
friend class KStartupInfo; friend class TDEStartupInfo;
KStartupInfoIdPrivate* d; TDEStartupInfoIdPrivate* d;
}; };
class KStartupInfoDataPrivate; class TDEStartupInfoDataPrivate;
/** /**
* Class representing data about an application startup notification. * Class representing data about an application startup notification.
@ -460,12 +460,12 @@ class KStartupInfoDataPrivate;
* Such data include the icon of the starting application, the desktop on which * Such data include the icon of the starting application, the desktop on which
* the application should start, the binary name of the application, etc. * the application should start, the binary name of the application, etc.
* *
* @see KStartupInfo * @see TDEStartupInfo
* @see KStartupInfoId * @see TDEStartupInfoId
* *
* @author Lubos Lunak <l.lunak@kde.org> * @author Lubos Lunak <l.lunak@kde.org>
*/ */
class TDECORE_EXPORT KStartupInfoData class TDECORE_EXPORT TDEStartupInfoData
{ {
public: public:
/** /**
@ -608,13 +608,13 @@ class TDECORE_EXPORT KStartupInfoData
/** /**
* Return the silence status for the startup notification. * Return the silence status for the startup notification.
* @return KStartupInfoData::Yes if visual feedback is silenced * @return TDEStartupInfoData::Yes if visual feedback is silenced
* @since 3.1.1 * @since 3.1.1
*/ */
TriState silent() const; TriState silent() const;
/** /**
* @obsolete Timestamp is already assigned in KStartupInfoId::initId(). * @obsolete Timestamp is already assigned in TDEStartupInfoId::initId().
* Sets timestamp for the startup notification. The timestamp is expressed * Sets timestamp for the startup notification. The timestamp is expressed
* as XServer time, and is used to prevent activation of the matching * as XServer time, and is used to prevent activation of the matching
* window if user interaction took place after this timestamp. * window if user interaction took place after this timestamp.
@ -624,7 +624,7 @@ class TDECORE_EXPORT KStartupInfoData
void setTimestamp( unsigned long time ); void setTimestamp( unsigned long time );
/** /**
* @obsolete Use KStartupInfoId::timestamp(). * @obsolete Use TDEStartupInfoId::timestamp().
* Return the timestamp for the startup notification, or -1 if no timestamp * Return the timestamp for the startup notification, or -1 if no timestamp
* is set. * is set.
*/ */
@ -670,26 +670,26 @@ class TDECORE_EXPORT KStartupInfoData
* or the name, won't be rewritten if already set. * or the name, won't be rewritten if already set.
* @param data the data to update * @param data the data to update
*/ */
void update( const KStartupInfoData& data ); void update( const TDEStartupInfoData& data );
/** /**
* Constructor. Initializes all the data to their default empty values. * Constructor. Initializes all the data to their default empty values.
*/ */
KStartupInfoData(); TDEStartupInfoData();
/** /**
* Copy constructor. * Copy constructor.
*/ */
KStartupInfoData( const KStartupInfoData& data ); TDEStartupInfoData( const TDEStartupInfoData& data );
~KStartupInfoData(); ~TDEStartupInfoData();
KStartupInfoData& operator=( const KStartupInfoData& data ); TDEStartupInfoData& operator=( const TDEStartupInfoData& data );
private: private:
KStartupInfoData( const TQString& txt ); TDEStartupInfoData( const TQString& txt );
TQString to_text() const; TQString to_text() const;
void remove_pid( pid_t pid ); void remove_pid( pid_t pid );
friend class KStartupInfo; friend class TDEStartupInfo;
friend class KStartupInfo::Data; friend class TDEStartupInfo::Data;
KStartupInfoDataPrivate* d; TDEStartupInfoDataPrivate* d;
}; };
#endif //Q_WS_X11 #endif //Q_WS_X11

@ -186,17 +186,17 @@ KUniqueApplication::start()
#if 0 #if 0
#ifdef Q_WS_X11 #ifdef Q_WS_X11
// say we're up and running ( probably no new window will appear ) // say we're up and running ( probably no new window will appear )
KStartupInfoId id; TDEStartupInfoId id;
if( kapp != NULL ) // TDEApplication constructor unsets the env. variable if( kapp != NULL ) // TDEApplication constructor unsets the env. variable
id.initId( kapp->startupId()); id.initId( kapp->startupId());
else else
id = KStartupInfo::currentStartupIdEnv(); id = TDEStartupInfo::currentStartupIdEnv();
if( !id.none()) if( !id.none())
{ {
Display* disp = XOpenDisplay( NULL ); Display* disp = XOpenDisplay( NULL );
if( disp != NULL ) // use extra X connection if( disp != NULL ) // use extra X connection
{ {
KStartupInfo::sendFinishX( disp, id ); TDEStartupInfo::sendFinishX( disp, id );
XCloseDisplay( disp ); XCloseDisplay( disp );
} }
} }
@ -210,19 +210,19 @@ KUniqueApplication::start()
{ {
#ifdef Q_WS_X11 #ifdef Q_WS_X11
KStartupInfoId id; TDEStartupInfoId id;
if( kapp != NULL ) // TDEApplication constructor unsets the env. variable if( kapp != NULL ) // TDEApplication constructor unsets the env. variable
id.initId( kapp->startupId()); id.initId( kapp->startupId());
else else
id = KStartupInfo::currentStartupIdEnv(); id = TDEStartupInfo::currentStartupIdEnv();
if( !id.none()) if( !id.none())
{ // notice about pid change { // notice about pid change
Display* disp = XOpenDisplay( NULL ); Display* disp = XOpenDisplay( NULL );
if( disp != NULL ) // use extra X connection if( disp != NULL ) // use extra X connection
{ {
KStartupInfoData data; TDEStartupInfoData data;
data.addPid( getpid()); data.addPid( getpid());
KStartupInfo::sendChangeX( disp, id, data ); TDEStartupInfo::sendChangeX( disp, id, data );
XCloseDisplay( disp ); XCloseDisplay( disp );
} }
} }
@ -273,11 +273,11 @@ KUniqueApplication::start()
TQCString new_asn_id; TQCString new_asn_id;
#if defined Q_WS_X11 #if defined Q_WS_X11
KStartupInfoId id; TDEStartupInfoId id;
if( kapp != NULL ) // TDEApplication constructor unsets the env. variable if( kapp != NULL ) // TDEApplication constructor unsets the env. variable
id.initId( kapp->startupId()); id.initId( kapp->startupId());
else else
id = KStartupInfo::currentStartupIdEnv(); id = TDEStartupInfo::currentStartupIdEnv();
if( !id.none()) if( !id.none())
new_asn_id = id.id(); new_asn_id = id.id();
#endif #endif
@ -381,11 +381,11 @@ void KUniqueApplication::newInstanceNoFork()
// KDE4 remove // KDE4 remove
// A hack to make startup notification stop for apps which override newInstance() // A hack to make startup notification stop for apps which override newInstance()
// and reuse an already existing window there, but use KWin::activateWindow() // and reuse an already existing window there, but use KWin::activateWindow()
// instead of KStartupInfo::setNewStartupId(). Therefore KWin::activateWindow() // instead of TDEStartupInfo::setNewStartupId(). Therefore KWin::activateWindow()
// for now sets this flag. Automatically ending startup notification always // for now sets this flag. Automatically ending startup notification always
// would cause problem if the new window would show up with a small delay. // would cause problem if the new window would show up with a small delay.
if( s_handleAutoStarted ) if( s_handleAutoStarted )
KStartupInfo::handleAutoAppStartedSending(); TDEStartupInfo::handleAutoAppStartedSending();
#endif #endif
// What to do with the return value ? // What to do with the return value ?
} }
@ -445,7 +445,7 @@ KUniqueApplication::processDelayed()
d->firstInstance = false; d->firstInstance = false;
#if defined Q_WS_X11 #if defined Q_WS_X11
if( s_handleAutoStarted ) if( s_handleAutoStarted )
KStartupInfo::handleAutoAppStartedSending(); // KDE4 remove? TDEStartupInfo::handleAutoAppStartedSending(); // KDE4 remove?
#endif #endif
TQDataStream rs(replyData, IO_WriteOnly); TQDataStream rs(replyData, IO_WriteOnly);
rs << exitCode; rs << exitCode;
@ -476,7 +476,7 @@ int KUniqueApplication::newInstance()
// and what's important, it does it properly. If you reimplement newInstance(), // and what's important, it does it properly. If you reimplement newInstance(),
// and don't call the inherited one, use this (but NOT when newInstance() // and don't call the inherited one, use this (but NOT when newInstance()
// is called for the first time, like here). // is called for the first time, like here).
KStartupInfo::setNewStartupId( mainWidget(), kapp->startupId()); TDEStartupInfo::setNewStartupId( mainWidget(), kapp->startupId());
#endif #endif
} }
} }

@ -43,12 +43,12 @@ class KXMessagesPrivate;
/** /**
* Sending string messages to other applications using the X Client Messages. * Sending string messages to other applications using the X Client Messages.
* *
* Used internally by KStartupInfo. You usually don't want to use this, use DCOP * Used internally by TDEStartupInfo. You usually don't want to use this, use DCOP
* instead. * instead.
* *
* @author Lubos Lunak <l.lunak@kde.org> * @author Lubos Lunak <l.lunak@kde.org>
*/ */
// KDE4 - make this internal for KStartupInfo only? // KDE4 - make this internal for TDEStartupInfo only?
class TDECORE_EXPORT KXMessages class TDECORE_EXPORT KXMessages
: public TQWidget : public TQWidget
{ {

@ -731,7 +731,7 @@ void KWin::lowerWindow( WId win )
void KWin::appStarted() void KWin::appStarted()
{ {
#ifdef Q_WS_X11 #ifdef Q_WS_X11
KStartupInfo::appStarted(); TDEStartupInfo::appStarted();
#endif #endif
} }

@ -509,7 +509,7 @@ private:
#endif #endif
/** /**
* @deprecated * @deprecated
* Use KStartupInfo::appStarted * Use TDEStartupInfo::appStarted
*/ */
static void appStarted() KDE_DEPRECATED; static void appStarted() KDE_DEPRECATED;
}; };

@ -563,13 +563,13 @@ static pid_t runCommandInternal( TDEProcess* proc, const KService* service, cons
#ifdef Q_WS_X11 // Startup notification doesn't work with QT/E, service isn't needed without Startup notification #ifdef Q_WS_X11 // Startup notification doesn't work with QT/E, service isn't needed without Startup notification
bool silent; bool silent;
TQCString wmclass; TQCString wmclass;
KStartupInfoId id; TDEStartupInfoId id;
bool startup_notify = ( asn != "0" && KRun::checkStartupNotify( binName, service, &silent, &wmclass )); bool startup_notify = ( asn != "0" && KRun::checkStartupNotify( binName, service, &silent, &wmclass ));
if( startup_notify ) if( startup_notify )
{ {
id.initId( asn ); id.initId( asn );
id.setupStartupEnv(); id.setupStartupEnv();
KStartupInfoData data; TDEStartupInfoData data;
data.setHostname(); data.setHostname();
data.setBin( bin ); data.setBin( bin );
if( !execName.isEmpty()) if( !execName.isEmpty())
@ -584,19 +584,19 @@ static pid_t runCommandInternal( TDEProcess* proc, const KService* service, cons
if( !wmclass.isEmpty()) if( !wmclass.isEmpty())
data.setWMClass( wmclass ); data.setWMClass( wmclass );
if( silent ) if( silent )
data.setSilent( KStartupInfoData::Yes ); data.setSilent( TDEStartupInfoData::Yes );
data.setDesktop( KWin::currentDesktop()); data.setDesktop( KWin::currentDesktop());
if( window ) if( window )
data.setLaunchedBy( window->winId()); data.setLaunchedBy( window->winId());
KStartupInfo::sendStartup( id, data ); TDEStartupInfo::sendStartup( id, data );
} }
pid_t pid = TDEProcessRunner::run( proc, binName, id ); pid_t pid = TDEProcessRunner::run( proc, binName, id );
if( startup_notify && pid ) if( startup_notify && pid )
{ {
KStartupInfoData data; TDEStartupInfoData data;
data.addPid( pid ); data.addPid( pid );
KStartupInfo::sendChange( id, data ); TDEStartupInfo::sendChange( id, data );
KStartupInfo::resetStartupEnv(); TDEStartupInfo::resetStartupEnv();
} }
return pid; return pid;
#else #else
@ -807,14 +807,14 @@ pid_t KRun::run( const KService& _service, const KURL::List& _urls, TQWidget* wi
if( window != NULL ) if( window != NULL )
{ {
if( myasn.isEmpty()) if( myasn.isEmpty())
myasn = KStartupInfo::createNewStartupId(); myasn = TDEStartupInfo::createNewStartupId();
if( myasn != "0" ) if( myasn != "0" )
{ {
KStartupInfoId id; TDEStartupInfoId id;
id.initId( myasn ); id.initId( myasn );
KStartupInfoData data; TDEStartupInfoData data;
data.setLaunchedBy( window->winId()); data.setLaunchedBy( window->winId());
KStartupInfo::sendChange( id, data ); TDEStartupInfo::sendChange( id, data );
} }
} }
@ -1484,7 +1484,7 @@ TDEProcessRunner::run(TDEProcess * p, const TQString & binName)
#ifdef Q_WS_X11 #ifdef Q_WS_X11
pid_t pid_t
TDEProcessRunner::run(TDEProcess * p, const TQString & binName, const KStartupInfoId& id ) TDEProcessRunner::run(TDEProcess * p, const TQString & binName, const TDEStartupInfoId& id )
{ {
return (new TDEProcessRunner(p, binName, id))->pid(); return (new TDEProcessRunner(p, binName, id))->pid();
} }
@ -1505,7 +1505,7 @@ TDEProcessRunner::TDEProcessRunner(TDEProcess * p, const TQString & _binName )
} }
#ifdef Q_WS_X11 #ifdef Q_WS_X11
TDEProcessRunner::TDEProcessRunner(TDEProcess * p, const TQString & _binName, const KStartupInfoId& id ) TDEProcessRunner::TDEProcessRunner(TDEProcess * p, const TQString & _binName, const TDEStartupInfoId& id )
: TQObject(), : TQObject(),
process_(p), process_(p),
binName( _binName ), binName( _binName ),
@ -1559,10 +1559,10 @@ TDEProcessRunner::slotProcessExited(TDEProcess * p)
#ifdef Q_WS_X11 #ifdef Q_WS_X11
if( !id_.none()) if( !id_.none())
{ {
KStartupInfoData data; TDEStartupInfoData data;
data.addPid( pid()); // announce this pid for the startup notification has finished data.addPid( pid()); // announce this pid for the startup notification has finished
data.setHostname(); data.setHostname();
KStartupInfo::sendFinish( id_, data ); TDEStartupInfo::sendFinish( id_, data );
} }
#endif #endif
deleteLater(); deleteLater();

@ -482,8 +482,8 @@ class TDEIO_EXPORT TDEProcessRunner : public TQObject
public: public:
static pid_t run(TDEProcess *, const TQString & binName); static pid_t run(TDEProcess *, const TQString & binName);
#ifdef Q_WS_X11 // We don't have KStartupInfo in Qt/Embedded #ifdef Q_WS_X11 // We don't have TDEStartupInfo in Qt/Embedded
static pid_t run(TDEProcess *, const TQString & binName, const KStartupInfoId& id ); static pid_t run(TDEProcess *, const TQString & binName, const TDEStartupInfoId& id );
#endif #endif
virtual ~TDEProcessRunner(); virtual ~TDEProcessRunner();
@ -497,15 +497,15 @@ class TDEIO_EXPORT TDEProcessRunner : public TQObject
private: private:
TDEProcessRunner(TDEProcess *, const TQString & binName); TDEProcessRunner(TDEProcess *, const TQString & binName);
#ifdef Q_WS_X11 // We don't have KStartupInfo in Qt/Embedded #ifdef Q_WS_X11 // We don't have TDEStartupInfo in Qt/Embedded
TDEProcessRunner(TDEProcess *, const TQString & binName, const KStartupInfoId& id ); TDEProcessRunner(TDEProcess *, const TQString & binName, const TDEStartupInfoId& id );
#endif #endif
TDEProcessRunner(); TDEProcessRunner();
TDEProcess * process_; TDEProcess * process_;
TQString binName; TQString binName;
#ifdef Q_WS_X11 // We don't have KStartupInfo in Qt/Embedded #ifdef Q_WS_X11 // We don't have TDEStartupInfo in Qt/Embedded
KStartupInfoId id_; TDEStartupInfoId id_;
#endif #endif
}; };

@ -206,7 +206,7 @@ void KIOExec::slotRunApp()
#ifdef Q_WS_X11 #ifdef Q_WS_X11
// propagate the startup indentification to the started process // propagate the startup indentification to the started process
KStartupInfoId id; TDEStartupInfoId id;
id.initId( kapp->startupId()); id.initId( kapp->startupId());
id.setupStartupEnv(); id.setupStartupEnv();
#endif #endif
@ -216,7 +216,7 @@ void KIOExec::slotRunApp()
proc.start( TDEProcess::Block ); proc.start( TDEProcess::Block );
#ifdef Q_WS_X11 #ifdef Q_WS_X11
KStartupInfo::resetStartupEnv(); TDEStartupInfo::resetStartupEnv();
#endif #endif
kdDebug() << "EXEC done" << endl; kdDebug() << "EXEC done" << endl;

Loading…
Cancel
Save