Display message title as HTML too.
This commit is contained in:
parent
629dfec666
commit
58ff1d5f70
@ -1,3 +1,10 @@
|
|||||||
|
3.3.0 (not yet released)
|
||||||
|
—————
|
||||||
|
|
||||||
|
Changed:
|
||||||
|
|
||||||
|
▪ Internal message viewer now displays title as part of main HTML view.
|
||||||
|
|
||||||
3.2.0
|
3.2.0
|
||||||
—————
|
—————
|
||||||
|
|
||||||
|
@ -101,14 +101,9 @@ void MessagePreviewer::reloadFontSettings() {
|
|||||||
SETTING(Messages::PreviewerFontStandard)).toString());
|
SETTING(Messages::PreviewerFontStandard)).toString());
|
||||||
|
|
||||||
m_ui->m_txtMessage->setFont(fon);
|
m_ui->m_txtMessage->setFont(fon);
|
||||||
|
|
||||||
fon.setPointSize(fon.pointSize() + 5);
|
|
||||||
|
|
||||||
m_ui->m_lblTitle->setFont(fon);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void MessagePreviewer::clear() {
|
void MessagePreviewer::clear() {
|
||||||
m_ui->m_lblTitle->clear();
|
|
||||||
m_ui->m_txtMessage->clear();
|
m_ui->m_txtMessage->clear();
|
||||||
|
|
||||||
hide();
|
hide();
|
||||||
@ -121,11 +116,8 @@ void MessagePreviewer::loadMessage(const Message &message, RootItem *root) {
|
|||||||
if (!m_root.isNull()) {
|
if (!m_root.isNull()) {
|
||||||
updateButtons();
|
updateButtons();
|
||||||
m_actionSwitchImportance->setChecked(m_message.m_isImportant);
|
m_actionSwitchImportance->setChecked(m_message.m_isImportant);
|
||||||
|
|
||||||
m_ui->m_lblTitle->setText(m_message.m_title);
|
|
||||||
m_ui->m_txtMessage->setHtml(prepareHtmlForMessage(m_message));
|
m_ui->m_txtMessage->setHtml(prepareHtmlForMessage(m_message));
|
||||||
|
|
||||||
updateTitle();
|
|
||||||
show();
|
show();
|
||||||
|
|
||||||
m_ui->m_txtMessage->verticalScrollBar()->triggerAction(QScrollBar::SliderToMinimum);
|
m_ui->m_txtMessage->verticalScrollBar()->triggerAction(QScrollBar::SliderToMinimum);
|
||||||
@ -147,7 +139,6 @@ void MessagePreviewer::markMessageAsRead() {
|
|||||||
emit requestMessageListReload(false);
|
emit requestMessageListReload(false);
|
||||||
m_message.m_isRead = true;
|
m_message.m_isRead = true;
|
||||||
updateButtons();
|
updateButtons();
|
||||||
updateTitle();
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -167,7 +158,6 @@ void MessagePreviewer::markMessageAsUnread() {
|
|||||||
emit requestMessageListReload(false);
|
emit requestMessageListReload(false);
|
||||||
m_message.m_isRead = false;
|
m_message.m_isRead = false;
|
||||||
updateButtons();
|
updateButtons();
|
||||||
updateTitle();
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -199,23 +189,16 @@ void MessagePreviewer::updateButtons() {
|
|||||||
m_actionMarkUnread->setEnabled(m_message.m_isRead);
|
m_actionMarkUnread->setEnabled(m_message.m_isRead);
|
||||||
}
|
}
|
||||||
|
|
||||||
void MessagePreviewer::updateTitle() {
|
|
||||||
QFont fon = m_ui->m_lblTitle->font();
|
|
||||||
fon.setBold(!m_message.m_isRead);
|
|
||||||
m_ui->m_lblTitle->setFont(fon);
|
|
||||||
}
|
|
||||||
|
|
||||||
QString MessagePreviewer::prepareHtmlForMessage(const Message &message) {
|
QString MessagePreviewer::prepareHtmlForMessage(const Message &message) {
|
||||||
QString html = QString("<p>[url] <a href=\"%1\">%1</a></p>").arg(message.m_url);
|
QString html = QString("<h2 align=\"center\">%1</h2>").arg(message.m_title);
|
||||||
|
|
||||||
|
html += QString("<p>[url] <a href=\"%1\">%1</a></p>").arg(message.m_url);
|
||||||
|
|
||||||
foreach (const Enclosure &enc, message.m_enclosures) {
|
foreach (const Enclosure &enc, message.m_enclosures) {
|
||||||
html += QString("<p>[%2] <a href=\"%1\">%1</a></p>").arg(enc.m_url, enc.m_mimeType);
|
html += QString("<p>[%2] <a href=\"%1\">%1</a></p>").arg(enc.m_url, enc.m_mimeType);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!message.m_enclosures.isEmpty()) {
|
|
||||||
html += "<hr/>";
|
html += "<hr/>";
|
||||||
}
|
|
||||||
|
|
||||||
html += message.m_contents;
|
html += message.m_contents;
|
||||||
|
|
||||||
return html;
|
return html;
|
||||||
|
@ -57,7 +57,6 @@ class MessagePreviewer : public QWidget {
|
|||||||
|
|
||||||
private:
|
private:
|
||||||
void updateButtons();
|
void updateButtons();
|
||||||
void updateTitle();
|
|
||||||
QString prepareHtmlForMessage(const Message &message);
|
QString prepareHtmlForMessage(const Message &message);
|
||||||
|
|
||||||
QToolBar *m_toolBar;
|
QToolBar *m_toolBar;
|
||||||
|
@ -24,30 +24,6 @@
|
|||||||
<number>0</number>
|
<number>0</number>
|
||||||
</property>
|
</property>
|
||||||
<item row="0" column="1">
|
<item row="0" column="1">
|
||||||
<widget class="QLabel" name="m_lblTitle">
|
|
||||||
<property name="font">
|
|
||||||
<font>
|
|
||||||
<pointsize>18</pointsize>
|
|
||||||
</font>
|
|
||||||
</property>
|
|
||||||
<property name="autoFillBackground">
|
|
||||||
<bool>true</bool>
|
|
||||||
</property>
|
|
||||||
<property name="text">
|
|
||||||
<string/>
|
|
||||||
</property>
|
|
||||||
<property name="alignment">
|
|
||||||
<set>Qt::AlignCenter</set>
|
|
||||||
</property>
|
|
||||||
<property name="wordWrap">
|
|
||||||
<bool>true</bool>
|
|
||||||
</property>
|
|
||||||
<property name="textInteractionFlags">
|
|
||||||
<set>Qt::TextSelectableByKeyboard|Qt::TextSelectableByMouse</set>
|
|
||||||
</property>
|
|
||||||
</widget>
|
|
||||||
</item>
|
|
||||||
<item row="1" column="1">
|
|
||||||
<widget class="MessageTextBrowser" name="m_txtMessage">
|
<widget class="MessageTextBrowser" name="m_txtMessage">
|
||||||
<property name="autoFillBackground">
|
<property name="autoFillBackground">
|
||||||
<bool>true</bool>
|
<bool>true</bool>
|
||||||
|
Loading…
x
Reference in New Issue
Block a user