diff --git a/tools/chatgui/src/inputbar.cpp b/tools/chatgui/src/inputbar.cpp index f358d984..70d92e23 100644 --- a/tools/chatgui/src/inputbar.cpp +++ b/tools/chatgui/src/inputbar.cpp @@ -330,7 +330,7 @@ void InputBar::cancelEdit() { m_input->setPlainText(m_savedText); m_savedText.clear(); m_replyTo = m_savedReply; m_savedReply.clear(); m_replyLabel->setText(m_savedReplyLabel); m_savedReplyLabel.clear(); m_replyPreview->setVisible(!m_replyTo.isEmpty()); m_attachPreview->setVisible(!m_pendingAttachSrc.isEmpty()); - m_attachBtn->setEnabled(true); m_pttBtn->setEnabled(true); + m_attachBtn->setEnabled(m_mediaEnabled); m_pttBtn->setEnabled(m_mediaEnabled); m_sendBtn->setToolTip(QCoreApplication::translate("ChatGui", "Send")); } @@ -560,9 +560,10 @@ void InputBar::setDmMode(bool enabled) { } void InputBar::setMediaEnabled(bool enabled) { + m_mediaEnabled = enabled; if (m_encryptCheck) m_encryptCheck->setEnabled(enabled); - if (m_pttBtn) m_pttBtn->setEnabled(enabled); - if (m_attachBtn) m_attachBtn->setEnabled(enabled); + if (m_pttBtn) m_pttBtn->setEnabled(enabled && m_editId.isEmpty()); + if (m_attachBtn) m_attachBtn->setEnabled(enabled && m_editId.isEmpty()); if (!enabled && m_dropHint) m_dropHint->hide(); } diff --git a/tools/chatgui/src/inputbar.h b/tools/chatgui/src/inputbar.h index 4ef687e9..d1997fc4 100644 --- a/tools/chatgui/src/inputbar.h +++ b/tools/chatgui/src/inputbar.h @@ -105,6 +105,7 @@ private: QPushButton *m_attachClearBtn = nullptr; bool m_pttActive = false; bool m_dmMode = false; + bool m_mediaEnabled = true; quint64 m_dmGeneration = 0, m_recordDmGeneration = 0; /* Поколения текущего composer и начатой записи PM. */ QString m_mediaDirBase; QString m_channelIdForRecord; diff --git a/tools/chatgui/src/messagedelegate.cpp b/tools/chatgui/src/messagedelegate.cpp index 47bf8f0a..ee484a63 100644 --- a/tools/chatgui/src/messagedelegate.cpp +++ b/tools/chatgui/src/messagedelegate.cpp @@ -668,7 +668,7 @@ MessageDelegate::Layout MessageDelegate::calcBodyLayout( } L.emojiCount = detectEmojiOnly(text); - L.emojiOnly = (L.emojiCount >= 1); + L.emojiOnly = L.emojiCount >= 1 && !index.data(MsgEditedRole).toBool(); if (L.emojiOnly) { QFontMetrics fm(option.font); @@ -703,6 +703,8 @@ MessageDelegate::Layout MessageDelegate::calcBodyLayout( QFontMetrics fm(option.font); int contentW = calcMaxLineWidth(option.font, text, limitW); + QFont statusFont = option.font; statusFont.setPointSize(qMax(1, statusFont.pointSize() - 2)); + contentW = qMax(contentW, QFontMetrics(statusFont).horizontalAdvance(index.data(MsgTimeRole).toString()) + 4); if (!L.isOutgoing) { QString author = index.data(MsgAuthorRole).toString();