Implement message editing
The UI still looks ugly, but I have no good idea atm. fixes #134
This commit is contained in:
parent
00fd4eecec
commit
9b7d33e847
9 changed files with 90 additions and 15 deletions
|
|
@ -1529,11 +1529,33 @@ TimelineModel::setEdit(QString newEdit)
|
|||
if (ev) {
|
||||
setReply(QString::fromStdString(
|
||||
mtx::accessors::relations(*ev).reply_to().value_or("")));
|
||||
// input()->setText(mtx::accessors::body(*ev));
|
||||
|
||||
auto msgType = mtx::accessors::msg_type(*ev);
|
||||
if (msgType == mtx::events::MessageType::Text ||
|
||||
msgType == mtx::events::MessageType::Notice) {
|
||||
input()->setText(relatedInfo(newEdit).quoted_body);
|
||||
} else if (msgType == mtx::events::MessageType::Emote) {
|
||||
input()->setText("/me " + relatedInfo(newEdit).quoted_body);
|
||||
} else {
|
||||
input()->setText("");
|
||||
}
|
||||
} else {
|
||||
input()->setText("");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
TimelineModel::resetEdit()
|
||||
{
|
||||
if (!edit_.isEmpty()) {
|
||||
edit_ = "";
|
||||
emit editChanged(edit_);
|
||||
input()->setText("");
|
||||
resetReply();
|
||||
}
|
||||
}
|
||||
|
||||
QString
|
||||
TimelineModel::roomName() const
|
||||
{
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue