Merge pull request #1968 from defnax/added-mail-settings-for-emoticons

Added mail settings for emoticons
This commit is contained in:
defnax 2020-05-29 18:27:01 +02:00 committed by GitHub
commit 28508c47ce
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 29 additions and 12 deletions

View File

@ -669,10 +669,14 @@ void MessageWidget::fill(const std::string &msgId)
}
ui.subjectText->setText(QString::fromUtf8(msgInfo.title.c_str()));
unsigned int formatTextFlag = RSHTML_FORMATTEXT_EMBED_LINKS ;
// emoticons disabled because of crazy cost.
//text = RsHtmlMsg(msgInfo.msgflags).formatText(ui.msgText->document(), QString::fromUtf8(msgInfo.msg.c_str()), RSHTML_FORMATTEXT_EMBED_SMILEYS | RSHTML_FORMATTEXT_EMBED_LINKS);
text = RsHtmlMsg(msgInfo.msgflags).formatText(ui.msgText->document(), QString::fromUtf8(msgInfo.msg.c_str()), RSHTML_FORMATTEXT_EMBED_LINKS);
// embed smileys ?
if (Settings->valueFromGroup(QString("Messages"), QString::fromUtf8("Emoticons"), true).toBool()) {
formatTextFlag |= RSHTML_FORMATTEXT_EMBED_SMILEYS ;
}
text = RsHtmlMsg(msgInfo.msgflags).formatText(ui.msgText->document(), QString::fromUtf8(msgInfo.msg.c_str()), formatTextFlag);
ui.msgText->resetImagesStatus(Settings->getMsgLoadEmbeddedImages() || (msgInfo.msgflags & RS_MSG_LOAD_EMBEDDED_IMAGES));
ui.msgText->setHtml(text);

View File

@ -39,7 +39,6 @@ MessagePage::MessagePage(QWidget * parent, Qt::WindowFlags flags)
connect (ui.editpushButton, SIGNAL(clicked(bool)), this, SLOT (editTag()));
connect (ui.deletepushButton, SIGNAL(clicked(bool)), this, SLOT (deleteTag()));
connect (ui.defaultTagButton, SIGNAL(clicked(bool)), this, SLOT (defaultTag()));
//connect (ui.encryptedMsgs_CB, SIGNAL(toggled(bool)), this, SLOT (toggleEnableEncryptedDistantMsgs(bool)));
connect (ui.tags_listWidget, SIGNAL(currentRowChanged(int)), this, SLOT(currentRowChangedTag(int)));
@ -54,6 +53,7 @@ MessagePage::MessagePage(QWidget * parent, Qt::WindowFlags flags)
connect(ui.setMsgToReadOnActivate,SIGNAL(toggled(bool)), this,SLOT(updateMsgToReadOnActivate()));
connect(ui.loadEmbeddedImages, SIGNAL(toggled(bool)), this,SLOT(updateLoadEmbededImages() ));
connect(ui.openComboBox, SIGNAL(currentIndexChanged(int)),this,SLOT(updateMsgOpen() ));
connect(ui.emoticonscheckBox, SIGNAL(toggled(bool)), this,SLOT(updateLoadEmoticons() ));
}
MessagePage::~MessagePage()
@ -84,6 +84,7 @@ void MessagePage::updateMsgToReadOnActivate() { Settings->setMsgSetToReadOnActiv
void MessagePage::updateLoadEmbededImages() { Settings->setMsgLoadEmbeddedImages(ui.loadEmbeddedImages->isChecked()); }
void MessagePage::updateMsgOpen() { Settings->setMsgOpen( static_cast<RshareSettings::enumMsgOpen>(ui.openComboBox->itemData(ui.openComboBox->currentIndex()).toInt()) ); }
void MessagePage::updateDistantMsgs() { Settings->setValue("DistantMessages", ui.comboBox->currentIndex()); }
void MessagePage::updateLoadEmoticons() { Settings->setValueToGroup("Messages", "Emoticons", ui.emoticonscheckBox->isChecked()); }
void MessagePage::updateMsgTags()
{
@ -110,9 +111,12 @@ void MessagePage::updateMsgTags()
void
MessagePage::load()
{
Settings->beginGroup(QString("Messages"));
whileBlocking(ui.setMsgToReadOnActivate)->setChecked(Settings->getMsgSetToReadOnActivate());
whileBlocking(ui.loadEmbeddedImages)->setChecked(Settings->getMsgLoadEmbeddedImages());
whileBlocking(ui.openComboBox)->setCurrentIndex(ui.openComboBox->findData(Settings->getMsgOpen()));
whileBlocking(ui.emoticonscheckBox)->setChecked(Settings->value("Emoticons", true).toBool());
Settings->endGroup();
// state of filter combobox
@ -267,3 +271,4 @@ void MessagePage::currentRowChangedTag(int row)
ui.editpushButton->setEnabled(bEditEnable);
ui.deletepushButton->setEnabled(bDeleteEnable);
}

View File

@ -58,6 +58,7 @@ private slots:
void updateMsgOpen() ;
void updateDistantMsgs() ;
void updateMsgTags() ;
void updateLoadEmoticons();
private:
void fillTags();

View File

@ -65,14 +65,7 @@
</property>
</widget>
</item>
<item row="1" column="0">
<widget class="QCheckBox" name="loadEmbeddedImages">
<property name="text">
<string>Load embedded images</string>
</property>
</widget>
</item>
<item row="2" column="0">
<item row="3" column="0">
<layout class="QHBoxLayout" name="horizontalLayout">
<item>
<widget class="QLabel" name="openLabel">
@ -86,6 +79,20 @@
</item>
</layout>
</item>
<item row="1" column="0">
<widget class="QCheckBox" name="loadEmbeddedImages">
<property name="text">
<string>Load embedded images</string>
</property>
</widget>
</item>
<item row="2" column="0">
<widget class="QCheckBox" name="emoticonscheckBox">
<property name="text">
<string>Load Emoticons</string>
</property>
</widget>
</item>
</layout>
</widget>
</item>