SocketAPI: don't trim the command #3297
authorOlivier Goffart <ogoffart@woboq.com>
Mon, 26 Oct 2015 09:06:10 +0000 (10:06 +0100)
committerOlivier Goffart <ogoffart@woboq.com>
Mon, 26 Oct 2015 09:15:50 +0000 (10:15 +0100)
src/gui/socketapi.cpp

index 5305d00fac9a44989f54244457c761ad9d0e8a96..75190f710566f00f8bc94a8faf1f609a3e47dd3f 100644 (file)
@@ -164,14 +164,15 @@ void SocketApi::slotReadSocket()
     Q_ASSERT(socket);
 
     while(socket->canReadLine()) {
-        QString line = QString::fromUtf8(socket->readLine()).trimmed();
-        QString command = line.split(":").first();
+        QString line = QString::fromUtf8(socket->readLine());
+        line.chop(1); // remove the '\n'
+        QString command = line.split(":").value(0);
         QString function = QString(QLatin1String("command_")).append(command);
 
         QString functionWithArguments = function + QLatin1String("(QString,QIODevice*)");
         int indexOfMethod = this->metaObject()->indexOfMethod(functionWithArguments.toAscii());
 
-        QString argument = line.remove(0, command.length()+1).trimmed();
+        QString argument = line.remove(0, command.length()+1);
         if(indexOfMethod != -1) {
             QMetaObject::invokeMethod(this, function.toAscii(), Q_ARG(QString, argument), Q_ARG(QIODevice*, socket));
         } else {