From: Ivailo Monev Date: Mon, 20 Jul 2015 01:11:42 +0000 (+0300) Subject: kdontchangethehostname: fixup, it was utterly broken X-Git-Tag: 4.22.0~1694 X-Git-Url: http://git.osdn.net/view?a=commitdiff_plain;h=b4f88e36e49f58c154016740d5a85be815384da1;p=kde%2Fkde-workspace.git kdontchangethehostname: fixup, it was utterly broken it seems the the compiler got confused by the 3-space identation and due to double space field separation the parsing code was not working at all. now if kded starts monitoring for hostname change (the code for that is only a comment) changing the hostname should not prevent X11 apps from working. --- diff --git a/kdontchangethehostname/khostname.cpp b/kdontchangethehostname/khostname.cpp index 41955fae..b4b4b9fe 100644 --- a/kdontchangethehostname/khostname.cpp +++ b/kdontchangethehostname/khostname.cpp @@ -128,32 +128,37 @@ void KHostName::changeX() foreach ( const QByteArray &it, lines ) { QList entries = split(it); - if (entries.count() != 3) + if (entries.count() != 3) { continue; + } - QByteArray netId = entries[0]; - QByteArray authName = entries[1]; - QByteArray authKey = entries[2]; + QByteArray netId = entries[0].trimmed(); + QByteArray authName = entries[1].trimmed(); + QByteArray authKey = entries[2].trimmed(); int i = netId.lastIndexOf(':'); - if (i == -1) + if (i == -1) { continue; + } QByteArray netDisplay = netId.mid(i); - if (netDisplay != display) + if (netDisplay != display) { continue; + } i = netId.indexOf('/'); - if (i == -1) + if (i == -1) { continue; + } QString newNetId = newName+netId.mid(i); QString oldNetId = netId.left(i); - if (oldNetId != oldName) - continue; + if (oldNetId != oldName) { + continue; + } - QProcess::execute("xauth", QStringList() << "-n" << "remove" << netId); - QProcess::execute("xauth", QStringList() << "-n" << "add" << newNetId << authName << authKey); + QProcess::execute("xauth", QStringList() << "remove" << netId); + QProcess::execute("xauth", QStringList() << "add" << newNetId << authName << authKey); } }