diff --git a/lib/Session.cpp b/lib/Session.cpp index 3077a24..b7bd03e 100644 --- a/lib/Session.cpp +++ b/lib/Session.cpp @@ -451,10 +451,7 @@ void Session::monitorTimerDone() void Session::activityStateSet(int state) { if (state==NOTIFYBELL) { - QString s; - s.sprintf("Bell in session '%s'",_nameTitle.toUtf8().data()); - - emit bellRequest( s ); + emit bellRequest(tr("Bell in session '%1'").arg(_nameTitle)); } else if (state==NOTIFYACTIVITY) { if (_monitorSilence) { _monitorTimer->start(_silenceSeconds*1000); @@ -598,21 +595,22 @@ void Session::done(int exitStatus) return; } + // message is not being used. But in the original kpty.cpp file + // (https://cgit.kde.org/kpty.git/) it's part of a notification. + // So, we make it translatable, hoping that in the future it will + // be used in some kind of notification. QString message; if (!_wantedClose || exitStatus != 0) { if (_shellProcess->exitStatus() == QProcess::NormalExit) { - message.sprintf("Session '%s' exited with status %d.", - _nameTitle.toUtf8().data(), exitStatus); + message = tr("Session '%1' exited with status %2.").arg(_nameTitle).arg(exitStatus); } else { - message.sprintf("Session '%s' crashed.", - _nameTitle.toUtf8().data()); + message = tr("Session '%1' crashed.").arg(_nameTitle); } } if ( !_wantedClose && _shellProcess->exitStatus() != QProcess::NormalExit ) - message.sprintf("Session '%s' exited unexpectedly.", - _nameTitle.toUtf8().data()); + message = tr("Session '%1' exited unexpectedly.").arg(_nameTitle); else emit finished(); diff --git a/lib/kpty.cpp b/lib/kpty.cpp index 4bf81c5..9efd3dd 100644 --- a/lib/kpty.cpp +++ b/lib/kpty.cpp @@ -279,8 +279,8 @@ bool KPty::open() // Linux device names, FIXME: Trouble on other systems? for (const char * s3 = "pqrstuvwxyzabcde"; *s3; s3++) { for (const char * s4 = "0123456789abcdef"; *s4; s4++) { - ptyName = QString().sprintf("/dev/pty%c%c", *s3, *s4).toUtf8(); - d->ttyName = QString().sprintf("/dev/tty%c%c", *s3, *s4).toUtf8(); + ptyName = QByteArrayLiteral("/dev/pty") + *s3 + *s4; + d->ttyName = QByteArrayLiteral("/dev/tty") + *s3 + *s4; d->masterFd = ::open(ptyName.data(), O_RDWR); if (d->masterFd >= 0) {