mirror of
https://bitbucket.org/smil3y/kde-workspace.git
synced 2025-02-23 18:32:50 +00:00
kgreeter: kill lightdm process at exit and before starting it again from KCM
Signed-off-by: Ivailo Monev <xakepa10@gmail.com>
This commit is contained in:
parent
23a76279ee
commit
d94357f98c
2 changed files with 25 additions and 3 deletions
|
@ -20,7 +20,6 @@
|
|||
|
||||
#include <QSettings>
|
||||
#include <QStyleFactory>
|
||||
#include <QProcess>
|
||||
#include <kdebug.h>
|
||||
#include <kconfiggroup.h>
|
||||
#include <klocale.h>
|
||||
|
@ -33,6 +32,9 @@
|
|||
#include <kpluginfactory.h>
|
||||
#include <kpluginloader.h>
|
||||
|
||||
#include <sys/types.h>
|
||||
#include <signal.h>
|
||||
|
||||
#include "config-workspace.h"
|
||||
|
||||
K_PLUGIN_FACTORY(KCMGreeterFactory, registerPlugin<KCMGreeter>();)
|
||||
|
@ -40,7 +42,8 @@ K_EXPORT_PLUGIN(KCMGreeterFactory("kcmgreeterconfig", "kcm_greeterconfig"))
|
|||
|
||||
KCMGreeter::KCMGreeter(QWidget* parent, const QVariantList& args)
|
||||
: KCModule(KCMGreeterFactory::componentData(), parent),
|
||||
m_lightdmexe(KStandardDirs::findRootExe("lightdm"))
|
||||
m_lightdmexe(KStandardDirs::findRootExe("lightdm")),
|
||||
m_lightdmpid(0)
|
||||
{
|
||||
Q_UNUSED(args);
|
||||
|
||||
|
@ -99,6 +102,7 @@ KCMGreeter::KCMGreeter(QWidget* parent, const QVariantList& args)
|
|||
|
||||
KCMGreeter::~KCMGreeter()
|
||||
{
|
||||
killLightDM();
|
||||
}
|
||||
|
||||
void KCMGreeter::load()
|
||||
|
@ -207,7 +211,15 @@ void KCMGreeter::slotURLChanged(const KUrl &url)
|
|||
|
||||
void KCMGreeter::slotTest()
|
||||
{
|
||||
if (!QProcess::startDetached(m_lightdmexe, QStringList() << QString::fromLatin1("--test-mode"))) {
|
||||
killLightDM();
|
||||
|
||||
const bool result = QProcess::startDetached(
|
||||
m_lightdmexe,
|
||||
QStringList() << QString::fromLatin1("--test-mode"),
|
||||
QDir::currentPath(),
|
||||
&m_lightdmpid
|
||||
);
|
||||
if (!result) {
|
||||
KMessageBox::error(this, i18n("Could not start LightDM"));
|
||||
}
|
||||
}
|
||||
|
@ -221,4 +233,11 @@ void KCMGreeter::enableTest(const bool enable)
|
|||
}
|
||||
}
|
||||
|
||||
void KCMGreeter::killLightDM()
|
||||
{
|
||||
if (m_lightdmpid > 0) {
|
||||
::kill(pid_t(m_lightdmpid), SIGTERM);
|
||||
}
|
||||
}
|
||||
|
||||
#include "moc_kgreeterconfig.cpp"
|
||||
|
|
|
@ -19,6 +19,7 @@
|
|||
#ifndef KGREETERCONFIG_H
|
||||
#define KGREETERCONFIG_H
|
||||
|
||||
#include <QProcess>
|
||||
#include <kcmodule.h>
|
||||
|
||||
#include "ui_kgreeterconfig.h"
|
||||
|
@ -51,8 +52,10 @@ private Q_SLOTS:
|
|||
|
||||
private:
|
||||
void enableTest(const bool enable);
|
||||
void killLightDM();
|
||||
|
||||
QString m_lightdmexe;
|
||||
Q_PID m_lightdmpid;
|
||||
};
|
||||
|
||||
#endif // KGREETERCONFIG_H
|
||||
|
|
Loading…
Add table
Reference in a new issue