Commit 10a18679 authored by Àlex Fiestas's avatar Àlex Fiestas

Adapt coding style to kdelibs

Using kdelibs style is not enforced but it is nice to use so all
kde hackers can work on this code without feeling out of place.
parent 566a671b
......@@ -46,8 +46,7 @@ Kded::~Kded()
bool Kded::start()
{
if (m_daemon)
{
if (m_daemon) {
return true;
}
......@@ -61,8 +60,7 @@ bool Kded::start()
m_daemon->setProgram(daemon);
m_daemon->setOutputChannelMode(KProcess::SeparateChannels);
m_daemon->start();
if (!m_daemon->waitForStarted(2000)) //FIXME: KDEDs should be non-blocking, do we really need to wait for it to start?
{
if (!m_daemon->waitForStarted(2000)) {//FIXME: KDEDs should be non-blocking, do we really need to wait for it to start?
kError(kdeconnect_kded()) << "Can't start " << daemon;
return false;
}
......@@ -75,20 +73,18 @@ bool Kded::start()
void Kded::stop()
{
if (m_daemon)
{
if (!m_daemon) {
return true;
}
m_daemon->terminate();
if (m_daemon->waitForFinished(10000))
{
if (m_daemon->waitForFinished(10000)) {
kDebug(kdeconnect_kded()) << "Daemon successfuly stopped";
}
else
{
} else {
m_daemon->kill();
kWarning(kdeconnect_kded()) << "Daemon killed";
}
m_daemon = 0;
}
}
bool Kded::restart()
......@@ -104,17 +100,15 @@ void Kded::onError(QProcess::ProcessError errorCode)
void Kded::onFinished(int exitCode, QProcess::ExitStatus status)
{
if (status == QProcess::CrashExit)
{
if (status == QProcess::CrashExit) {
kError(kdeconnect_kded()) << "Process crashed with code=" << exitCode;
kError(kdeconnect_kded()) << m_daemon->readAllStandardError();
kWarning(kdeconnect_kded()) << "Restarting in 5 sec...";
QTimer::singleShot(5000, this, SLOT(start()));
}
else
{
} else {
kWarning(kdeconnect_kded()) << "Process finished with code=" << exitCode;
}
m_daemon = 0;
}
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment