mirror of
https://bitbucket.org/smil3y/kdelibs.git
synced 2025-02-23 18:32:49 +00:00
kinit: autostart optimizations
Signed-off-by: Ivailo Monev <xakepa10@gmail.com>
This commit is contained in:
parent
4fb8a1d674
commit
74ba680406
1 changed files with 9 additions and 6 deletions
|
@ -21,6 +21,7 @@
|
|||
#include "kstandarddirs.h"
|
||||
#include "kservice.h"
|
||||
#include "kautostart.h"
|
||||
#include "kshell.h"
|
||||
#include "kdebug.h"
|
||||
|
||||
#include <QDir>
|
||||
|
@ -83,6 +84,7 @@ KLauncherAdaptor::~KLauncherAdaptor()
|
|||
void KLauncherAdaptor::autoStart(int phase)
|
||||
{
|
||||
if (m_autostart.isEmpty()) {
|
||||
kDebug() << "finding autostart desktop files" << phase;
|
||||
m_autostart = KGlobal::dirs()->findAllResources(
|
||||
"autostart",
|
||||
QString::fromLatin1("*.desktop"),
|
||||
|
@ -92,17 +94,18 @@ void KLauncherAdaptor::autoStart(int phase)
|
|||
|
||||
kDebug() << "autostart phase" << phase;
|
||||
foreach(const QString &it, m_autostart) {
|
||||
kDebug() << "checking autostart" << it;
|
||||
KAutostart kautostart(it);
|
||||
if (!kautostart.autostarts(QString::fromLatin1("KDE"), KAutostart::CheckAll)) {
|
||||
continue;
|
||||
}
|
||||
if (kautostart.startPhase() != phase) {
|
||||
continue;
|
||||
}
|
||||
KService kservice(it);
|
||||
QStringList programandargs = KRun::processDesktopExec(kservice, KUrl::List());
|
||||
if (!kautostart.autostarts(QString::fromLatin1("KDE"), KAutostart::CheckAll)) {
|
||||
kDebug() << "not autostarting" << it;
|
||||
continue;
|
||||
}
|
||||
QStringList programandargs = KShell::splitArgs(kautostart.command());
|
||||
if (programandargs.isEmpty()) {
|
||||
kWarning() << "could not process service" << kservice.entryPath();
|
||||
kWarning() << "could not process autostart" << it;
|
||||
continue;
|
||||
}
|
||||
const QString program = programandargs.takeFirst();
|
||||
|
|
Loading…
Add table
Reference in a new issue