diff --git a/src/widget/form/groupinviteform.cpp b/src/widget/form/groupinviteform.cpp index 7dc27b31d..feb652fb8 100644 --- a/src/widget/form/groupinviteform.cpp +++ b/src/widget/form/groupinviteform.cpp @@ -105,14 +105,18 @@ void GroupInviteForm::addGroupInvite(int32_t friendId, uint8_t type, QByteArray QWidget* groupWidget = new QWidget(this); QHBoxLayout* groupLayout = new QHBoxLayout(groupWidget); + GroupInvite group; + group.friendId = friendId; + group.type = type; + group.invite = invite; + group.time = QDateTime::currentDateTime(); + groupInvites.push_front(group); + CroppingLabel* groupLabel = new CroppingLabel(this); groupLabels.insert(groupLabel); - QString name = Nexus::getCore()->getFriendUsername(friendId); - QDateTime currentDateTime = QDateTime::currentDateTime(); - QString date = currentDateTime.toString(Settings::getInstance().getDateFormat()); - QString time = currentDateTime.toString(Settings::getInstance().getTimestampFormat()); - groupLabel->setText(tr("Invited by %1 on %2 at %3.").arg(name.toHtmlEscaped(), date, time)); groupLayout->addWidget(groupLabel); + scroll->widget()->layout()->addWidget(groupWidget); + retranslateGroupLabel(groupLabel); QPushButton* acceptButton = new QPushButton(this); acceptButtons.insert(acceptButton); @@ -126,15 +130,6 @@ void GroupInviteForm::addGroupInvite(int32_t friendId, uint8_t type, QByteArray groupLayout->addWidget(rejectButton); retranslateRejectButton(rejectButton); - scroll->widget()->layout()->addWidget(groupWidget); - - GroupInvite group; - group.friendId = friendId; - group.type = type; - group.invite = invite; - group.time = QDateTime::currentDateTime(); - groupInvites.push_front(group); - if (isVisible()) emit groupInvitesSeen(); } @@ -212,7 +207,7 @@ void GroupInviteForm::retranslateGroupLabel(CroppingLabel* label) QString date = invite.time.toString(Settings::getInstance().getDateFormat()); QString time = invite.time.toString(Settings::getInstance().getTimestampFormat()); - label->setText(tr("Invited by %1 on %2 at %3.").arg(name.toHtmlEscaped(), date, time)); + label->setText(tr("Invited by %1 on %2 at %3.").arg("" + name.toHtmlEscaped() + "", date, time)); } void GroupInviteForm::retranslateAcceptButton(QPushButton* acceptButton)