KSMServer: Do not autostart files

Currently KLauncher is responsible for starting all of the autostart
files. It intelligently starts only the files which should be started in
the KDE environment.

Once this is done, KLauncher then decides to also start all the files
in the autostart folder, but does that without checking which should be
started. I'm not sure why both KSMServer and KLauncher are overlaping
and doing the same thing. But it seems that KLauncher is the correct
place to do this. Specially since ksmserver uses kioclient5 in order to
start the applications.

BUG: 335878
REVIEW: 118977
wilder-5.14
Vishesh Handa 12 years ago
parent 9e761d3139
commit f913e251fe
  1. 2
      ksmserver/server.h
  2. 36
      ksmserver/startup.cpp

@ -160,8 +160,6 @@ private:
void killingCompleted();
void createLogoutEffectWidget();
void runUserAutostart();
void discardSession();
void storeSession();

@ -399,7 +399,9 @@ void KSMServer::autoStart2()
kDebug() << "kded" << t.elapsed();
#endif
runUserAutostart();
// Create dir so that users can find it :-)
QDir().mkpath(QStandardPaths::writableLocation(QStandardPaths::GenericConfigLocation)
+ QDir::separator() + QStringLiteral("autostart"));
if (kcminitSignals) {
connect( kcminitSignals, SIGNAL(phase2Done()), SLOT(kcmPhase2Done()));
@ -418,38 +420,6 @@ void KSMServer::autoStart2()
// KNotification::DefaultEvent ); // this is the time KDE is up, more or less
}
void KSMServer::runUserAutostart()
{
// now let's execute all the stuff in the autostart folder.
// the stuff will actually be really executed when the event loop is
// entered, since KRun internally uses a QTimer
QDir dir(QStandardPaths::writableLocation(QStandardPaths::GenericConfigLocation) + QDir::separator() + QStringLiteral("autostart"));
if (dir.exists()) {
const QStringList entries = dir.entryList( QDir::Files );
foreach (const QString& file, entries) {
// Don't execute backup files
if ( !file.endsWith( QLatin1Char( '~' ) ) && !file.endsWith( QStringLiteral( ".bak" ) ) &&
( file[0] != QLatin1Char( '%' ) || !file.endsWith( QLatin1Char( '%' ) ) ) &&
( file[0] != QLatin1Char( '#' ) || !file.endsWith( QLatin1Char( '#' ) ) ) )
{
QUrl url = QUrl::fromLocalFile( dir.absolutePath() + QLatin1Char( '/' ) + file );
//KRun is synchronous so if we use it here it will produce a deadlock.
//So isntead we use kioclient for now.
//(void) new KRun( url, 0, true );
QProcess::startDetached(QStringLiteral("kioclient5"),
QStringList()
<< QStringLiteral("exec")
<< url.path()
);
}
}
} else {
// Create dir so that users can find it :-)
dir.mkpath(QStandardPaths::writableLocation(QStandardPaths::GenericConfigLocation)
+ QDir::separator() + QStringLiteral("autostart"));
}
}
void KSMServer::autoStart2Done()
{
if( state != FinishingStartup )

Loading…
Cancel
Save