Drop deprecated QString::sprintf()

Made obsolete in Qt5.14.
This commit is contained in:
Luís Pereira
2020-01-22 22:47:49 +00:00
committed by Alf Gaida
parent 911ae03ccf
commit 59ac023f60
2 changed files with 10 additions and 12 deletions
+8 -10
View File
@@ -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();