Verify poll clicks preserve selection and message controls
This commit is contained in:
1 parent
ddcc36aa26
commit
b6d8e822b4
3 files changed
+73
-2
No files matched your search
@@ -189,9 +189,15 @@ void MessageList::createPoll() {
|
||||
}
|
||||
|
||||
void MessageList::showPoll(const QString& messageId) {
|
||||
if (m_pollDialog) { m_pollDialog->raise(); return; }
|
||||
if (m_pollDialog) {
|
||||
GUI_DEBUG("poll: raising open dialog message=%s", qPrintable(m_pollDialogMessage));
|
||||
m_pollDialog->raise(); return;
|
||||
}
|
||||
auto state = m_feedback.value(messageId), poll = state.value("poll").toObject();
|
||||
if (poll.isEmpty()) { m_pendingPoll = messageId; sendFeedback({{"cmd", "feedback"}, {"message_id", messageId}}); return; }
|
||||
if (poll.isEmpty()) {
|
||||
GUI_DEBUG("poll: requesting state ch=%s message=%s", qPrintable(m_currentChannelId), qPrintable(messageId));
|
||||
m_pendingPoll = messageId; sendFeedback({{"cmd", "feedback"}, {"message_id", messageId}}); return;
|
||||
}
|
||||
QDialog dialog(this); dialog.setWindowTitle(feedbackText("Vote / results"));
|
||||
m_pollDialog = &dialog; m_pollDialogMessage = messageId; auto* layout = new QVBoxLayout(&dialog);
|
||||
auto* title = new QLabel(poll.value("question").toString(), &dialog); title->setTextFormat(Qt::PlainText); title->setWordWrap(true);
|
||||
@@ -236,5 +242,7 @@ void MessageList::showPoll(const QString& messageId) {
|
||||
}
|
||||
sendFeedback({{"cmd", "vote"}, {"message_id", messageId}, {"choices", ids}, {"custom", text}}); dialog.accept();
|
||||
});
|
||||
GUI_INFO("poll: opening dialog ch=%s message=%s options=%d", qPrintable(m_currentChannelId), qPrintable(messageId), int(values.size()));
|
||||
applyFeedback(state); dialog.resize(450, 560); dialog.exec(); m_pollDialog = nullptr; m_pollDialogMessage.clear();
|
||||
GUI_DEBUG("poll: dialog closed message=%s", qPrintable(messageId));
|
||||
}
|
||||
Reference in new issue
Block a user