forked from blue/squawk
Bug with the edited message fixed, some further work on message correction
This commit is contained in:
parent
0823b35148
commit
bf4a27f35d
6 changed files with 61 additions and 3 deletions
|
@ -110,7 +110,7 @@ Conversation::Conversation(bool muc, Models::Account* acc, Models::Element* el,
|
|||
|
||||
initializeOverlay();
|
||||
|
||||
m_ui->currentActionBadge->setVisible(false);;
|
||||
m_ui->currentActionBadge->setVisible(false);
|
||||
// m_ui->currentActionBadge->setText(tr("Editing message..."));
|
||||
}
|
||||
|
||||
|
@ -476,10 +476,10 @@ void Conversation::onFeedContext(const QPoint& pos)
|
|||
Shared::Message* item = static_cast<Shared::Message*>(index.internalPointer());
|
||||
|
||||
contextMenu->clear();
|
||||
QString id = item->getId();
|
||||
bool showMenu = false;
|
||||
if (item->getState() == Shared::Message::State::error) {
|
||||
showMenu = true;
|
||||
QString id = item->getId();
|
||||
QAction* resend = contextMenu->addAction(Shared::icon("view-refresh"), tr("Try sending again"));
|
||||
connect(resend, &QAction::triggered, [this, id]() {
|
||||
element->feed->registerUpload(id);
|
||||
|
@ -500,6 +500,12 @@ void Conversation::onFeedContext(const QPoint& pos)
|
|||
Shared::Global::highlightInFileManager(path);
|
||||
});
|
||||
}
|
||||
|
||||
if (item->getOutgoing()) {
|
||||
showMenu = true;
|
||||
QAction* edit = contextMenu->addAction(Shared::icon("edit-rename"), tr("Edit"));
|
||||
connect(edit, &QAction::triggered, this, std::bind(&Conversation::onMessageEditRequested, this, id));
|
||||
}
|
||||
|
||||
if (showMenu) {
|
||||
contextMenu->popup(feed->viewport()->mapToGlobal(pos));
|
||||
|
@ -517,3 +523,23 @@ void Conversation::onMessageEditorContext(const QPoint& pos)
|
|||
|
||||
editorMenu->exec(this->m_ui->messageEditor->mapToGlobal(pos));
|
||||
}
|
||||
|
||||
void Conversation::onMessageEditRequested(const QString& id)
|
||||
{
|
||||
if (currentAction == CurrentAction::edit) {
|
||||
//todo;
|
||||
}
|
||||
|
||||
try {
|
||||
Shared::Message msg = element->feed->getMessage(id);
|
||||
|
||||
m_ui->currentActionBadge->setVisible(true);
|
||||
m_ui->currentActionBadge->setText(tr("Editing message..."));
|
||||
currentAction = CurrentAction::edit;
|
||||
m_ui->messageEditor->setText(msg.getBody());
|
||||
|
||||
} catch (const Models::MessageFeed::NotFound& e) {
|
||||
qDebug() << "The message requested to be edited was not found" << e.getMessage().c_str();
|
||||
qDebug() << "Ignoring";
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue