Skip to content
This repository has been archived by the owner on Feb 12, 2023. It is now read-only.

Commit

Permalink
fix: Call 'tr' in place, where text is accessible
Browse files Browse the repository at this point in the history
  • Loading branch information
Diadlo committed Apr 21, 2019
1 parent 8e13d96 commit 15d72a9
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 12 deletions.
8 changes: 1 addition & 7 deletions src/widget/form/chatform.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -72,12 +72,6 @@ const QString ChatForm::ACTION_PREFIX = QStringLiteral("/me ");

namespace
{
QString statusToString(const Status status)
{
QString result;
return ChatForm::tr(Widget::getStatusTitle(status).toLatin1().data(), "contact status");
}

QString secondsToDHMS(quint32 duration)
{
QString res;
Expand Down Expand Up @@ -635,7 +629,7 @@ void ChatForm::onFriendStatusChanged(uint32_t friendId, Status status)
updateCallButtons();

if (Settings::getInstance().getStatusChangeNotificationEnabled()) {
QString fStatus = statusToString(status);
QString fStatus = Widget::getStatusTitle(status);
addSystemInfoMessage(tr("%1 is now %2", "e.g. \"Dubslow is now online\"")
.arg(f->getDisplayedName())
.arg(fStatus),
Expand Down
10 changes: 5 additions & 5 deletions src/widget/widget.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2266,15 +2266,15 @@ QString Widget::getStatusTitle(Status status)
{
switch (status) {
case Status::Online:
return QStringLiteral("online");
return tr("online", "contact status");
case Status::Away:
return QStringLiteral("away");
return tr("away", "contact status");
case Status::Busy:
return QStringLiteral("busy");
return tr("busy", "contact status");
case Status::Offline:
return QStringLiteral("offline");
return tr("offline", "contact status");
case Status::Blocked:
return QStringLiteral("blocked");
return tr("blocked", "contact status");
}

assert(false);
Expand Down

0 comments on commit 15d72a9

Please sign in to comment.