fixes for gmail, fixed crash when editing email
This commit is contained in:
parent
4aa59e7915
commit
76c7dd1703
@ -30,11 +30,13 @@ QColor ColorToolButton::color() const {
|
|||||||
return m_color;
|
return m_color;
|
||||||
}
|
}
|
||||||
|
|
||||||
void ColorToolButton::setColor(const QColor& color) {
|
void ColorToolButton::setColor(const QColor& color, bool inform_about_changes) {
|
||||||
m_color = color;
|
m_color = color;
|
||||||
repaint();
|
repaint();
|
||||||
|
|
||||||
emit colorChanged(m_color);
|
if (inform_about_changes) {
|
||||||
|
emit colorChanged(m_color);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void ColorToolButton::setRandomColor() {
|
void ColorToolButton::setRandomColor() {
|
||||||
|
@ -12,7 +12,7 @@ class ColorToolButton : public QToolButton {
|
|||||||
explicit ColorToolButton(QWidget* parent = nullptr);
|
explicit ColorToolButton(QWidget* parent = nullptr);
|
||||||
|
|
||||||
QColor color() const;
|
QColor color() const;
|
||||||
void setColor(const QColor& color);
|
void setColor(const QColor& color, bool inform_about_changes = true);
|
||||||
|
|
||||||
QColor alternateColor() const;
|
QColor alternateColor() const;
|
||||||
void setAlternateColor(const QColor& alt_color);
|
void setAlternateColor(const QColor& alt_color);
|
||||||
|
@ -555,9 +555,11 @@ void MRichTextEdit::fontChanged(const QFont& f) {
|
|||||||
void MRichTextEdit::onCurrentCharFormatChanged(const QTextCharFormat& format) {
|
void MRichTextEdit::onCurrentCharFormatChanged(const QTextCharFormat& format) {
|
||||||
fontChanged(format.font());
|
fontChanged(format.font());
|
||||||
m_ui.f_bgcolor->setColor(format.background().isOpaque() ? format.background().color()
|
m_ui.f_bgcolor->setColor(format.background().isOpaque() ? format.background().color()
|
||||||
: m_ui.f_bgcolor->alternateColor());
|
: m_ui.f_bgcolor->alternateColor(),
|
||||||
|
false);
|
||||||
m_ui.f_fgcolor->setColor(format.foreground().isOpaque() ? format.foreground().color()
|
m_ui.f_fgcolor->setColor(format.foreground().isOpaque() ? format.foreground().color()
|
||||||
: m_ui.f_fgcolor->alternateColor());
|
: m_ui.f_fgcolor->alternateColor(),
|
||||||
|
false);
|
||||||
m_ui.f_link->setChecked(format.isAnchor());
|
m_ui.f_link->setChecked(format.isAnchor());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -688,7 +688,7 @@ QMap<QString, QString> GmailNetworkFactory::getMessageMetadata(const QString& ms
|
|||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
throw ApplicationException(tr("failed to get metadata"));
|
throw NetworkException(res.m_networkError);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -59,11 +59,6 @@ void FormAddEditEmail::execForReply(Message* original_message) {
|
|||||||
m_ui.m_txtSubject->setEnabled(false);
|
m_ui.m_txtSubject->setEnabled(false);
|
||||||
m_ui.m_txtMessage->setFocus();
|
m_ui.m_txtMessage->setFocus();
|
||||||
|
|
||||||
auto from_header =
|
|
||||||
m_root->network()->getMessageMetadata(original_message->m_customId, {QSL("FROM")}, m_root->networkProxy());
|
|
||||||
|
|
||||||
// TODO: konverze html > plain
|
|
||||||
// QTextDocumentFragment::fromHtml(m_originalMessage->m_contents).toPlainText()
|
|
||||||
m_ui.m_txtMessage->setText(m_originalMessage->m_contents);
|
m_ui.m_txtMessage->setText(m_originalMessage->m_contents);
|
||||||
m_ui.m_txtMessage->editor()->moveCursor(QTextCursor::MoveOperation::Start);
|
m_ui.m_txtMessage->editor()->moveCursor(QTextCursor::MoveOperation::Start);
|
||||||
m_ui.m_txtMessage->editor()->insertHtml(QSL("<p>"
|
m_ui.m_txtMessage->editor()->insertHtml(QSL("<p>"
|
||||||
@ -71,7 +66,15 @@ void FormAddEditEmail::execForReply(Message* original_message) {
|
|||||||
"</p><br/>"));
|
"</p><br/>"));
|
||||||
m_ui.m_txtMessage->editor()->moveCursor(QTextCursor::MoveOperation::Start);
|
m_ui.m_txtMessage->editor()->moveCursor(QTextCursor::MoveOperation::Start);
|
||||||
|
|
||||||
addRecipientRow(from_header[QSL("From")]);
|
try {
|
||||||
|
auto from_header =
|
||||||
|
m_root->network()->getMessageMetadata(original_message->m_customId, {QSL("FROM")}, m_root->networkProxy());
|
||||||
|
addRecipientRow(from_header.value(QSL("From")));
|
||||||
|
}
|
||||||
|
catch (const ApplicationException& ex) {
|
||||||
|
qWarningNN << LOGSEC_GMAIL << "Failed to get message metadata:" << QUOTE_W_SPACE_DOT(ex.message());
|
||||||
|
}
|
||||||
|
|
||||||
exec();
|
exec();
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -187,6 +190,10 @@ void FormAddEditEmail::onOkClicked() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
EmailRecipientControl* FormAddEditEmail::addRecipientRow(const QString& recipient) {
|
EmailRecipientControl* FormAddEditEmail::addRecipientRow(const QString& recipient) {
|
||||||
|
if (recipient.isEmpty()) {
|
||||||
|
return nullptr;
|
||||||
|
}
|
||||||
|
|
||||||
auto* mail_rec = new EmailRecipientControl(recipient, this);
|
auto* mail_rec = new EmailRecipientControl(recipient, this);
|
||||||
|
|
||||||
connect(mail_rec, &EmailRecipientControl::removalRequested, this, &FormAddEditEmail::removeRecipientRow);
|
connect(mail_rec, &EmailRecipientControl::removalRequested, this, &FormAddEditEmail::removeRecipientRow);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user