mirror of
https://github.com/RetroShare/RetroShare.git
synced 2025-05-20 23:10:39 -04:00
Changed style of the reply/forwarded message.
git-svn-id: http://svn.code.sf.net/p/retroshare/code/trunk@5141 b45a01b8-16f6-495d-af2f-9b41ad6348cc
This commit is contained in:
parent
173ce82099
commit
2611da2f72
10 changed files with 296 additions and 175 deletions
|
@ -1517,6 +1517,27 @@ void ForumsDialog::editForumDetails()
|
|||
editUi.exec();
|
||||
}
|
||||
|
||||
static QString buildReplyHeader(const ForumMsgInfo &msgInfo)
|
||||
{
|
||||
RetroShareLink link;
|
||||
link.createMessage(msgInfo.srcId, "");
|
||||
QString from = link.toHtml();
|
||||
|
||||
QDateTime qtime;
|
||||
qtime.setTime_t(msgInfo.ts);
|
||||
|
||||
QString header = QString("<span>-----%1-----").arg(QApplication::translate("ForumsDialog", "Original Message"));
|
||||
header += QString("<br><font size='3'><strong>%1: </strong>%2</font><br>").arg(QApplication::translate("ForumsDialog", "From"), from);
|
||||
|
||||
header += QString("<br><font size='3'><strong>%1: </strong>%2</font><br>").arg(QApplication::translate("ForumsDialog", "Sent"), qtime.toString(Qt::SystemLocaleLongDate));
|
||||
header += QString("<font size='3'><strong>%1: </strong>%2</font></span><br>").arg(QApplication::translate("ForumsDialog", "Subject"), QString::fromStdWString(msgInfo.title));
|
||||
header += "<br>";
|
||||
|
||||
header += QApplication::translate("ForumsDialog", "On %1, %2 wrote:").arg(qtime.toString(Qt::SystemLocaleShortDate), from);
|
||||
|
||||
return header;
|
||||
}
|
||||
|
||||
void ForumsDialog::replytomessage()
|
||||
{
|
||||
if (mCurrForumId.empty()) {
|
||||
|
@ -1532,13 +1553,11 @@ void ForumsDialog::replytomessage()
|
|||
if (rsPeers->getPeerName(msgInfo.srcId) !="")
|
||||
{
|
||||
MessageComposer *nMsgDialog = MessageComposer::newMsg();
|
||||
nMsgDialog->insertTitleText(QString::fromStdWString(msgInfo.title), MessageComposer::REPLY);
|
||||
nMsgDialog->setTitleText(QString::fromStdWString(msgInfo.title), MessageComposer::REPLY);
|
||||
|
||||
QTextDocument doc ;
|
||||
doc.setHtml(QString::fromStdWString(msgInfo.msg)) ;
|
||||
|
||||
nMsgDialog->insertPastedText(doc.toPlainText());
|
||||
nMsgDialog->setQuotedMsg(QString::fromStdWString(msgInfo.msg), buildReplyHeader(msgInfo));
|
||||
nMsgDialog->addRecipient(MessageComposer::TO, msgInfo.srcId, false);
|
||||
|
||||
nMsgDialog->show();
|
||||
nMsgDialog->activateWindow();
|
||||
|
||||
|
|
|
@ -1133,7 +1133,7 @@ static void processList(QStringList &list, const QString &textSingular, const QS
|
|||
MessageComposer *msg = MessageComposer::newMsg();
|
||||
msg->addRecipient(MessageComposer::TO, detail.id, false);
|
||||
if (link.subject().isEmpty() == false) {
|
||||
msg->insertTitleText(link.subject());
|
||||
msg->setTitleText(link.subject());
|
||||
}
|
||||
msg->show();
|
||||
messageStarted.append(PeerDefs::nameWithLocation(detail));
|
||||
|
|
|
@ -1251,9 +1251,9 @@ void SearchDialog::sendLinkTo( )
|
|||
return;
|
||||
}
|
||||
|
||||
nMsgDialog->insertTitleText(tr("New RetroShare Link(s)"));
|
||||
nMsgDialog->setTitleText(tr("New RetroShare Link(s)"));
|
||||
nMsgDialog->setMsgText(RSLinkClipboard::toHtml(), true) ;
|
||||
|
||||
nMsgDialog->insertMsgText(RSLinkClipboard::toHtml()) ;
|
||||
nMsgDialog->show();
|
||||
|
||||
/* window will destroy itself! */
|
||||
|
|
|
@ -222,8 +222,6 @@ SharedFilesDialog::SharedFilesDialog(QWidget *parent)
|
|||
connect( copylinklocalhtmlAct , SIGNAL( triggered() ), this, SLOT( copyLinkhtml() ) );
|
||||
sendlinkAct = new QAction(QIcon(IMAGE_COPYLINK), tr( "Send retroshare Links" ), this );
|
||||
connect( sendlinkAct , SIGNAL( triggered() ), this, SLOT( sendLinkTo( ) ) );
|
||||
sendhtmllinkAct = new QAction(QIcon(IMAGE_COPYLINK), tr( "Send retroshare Links (HTML)" ), this );
|
||||
connect( sendhtmllinkAct , SIGNAL( triggered() ), this, SLOT( sendHtmlLinkTo( ) ) );
|
||||
#ifdef RS_USE_LINKS
|
||||
sendlinkCloudAct = new QAction(QIcon(IMAGE_COPYLINK), tr( "Send retroshare Links to Cloud" ), this );
|
||||
connect( sendlinkCloudAct , SIGNAL( triggered() ), this, SLOT( sendLinkToCloud( ) ) );
|
||||
|
@ -535,8 +533,8 @@ void SharedFilesDialog::sendremoteLinkTo()
|
|||
* just need to set peers
|
||||
*/
|
||||
std::cerr << "SharedFilesDialog::sendremoteLinkTo()" << std::endl;
|
||||
nMsgDialog->insertTitleText(tr("RetroShare Link"));
|
||||
nMsgDialog->insertMsgText(RSLinkClipboard::toHtml());
|
||||
nMsgDialog->setTitleText(tr("RetroShare Link"));
|
||||
nMsgDialog->setMsgText(RSLinkClipboard::toHtml(), true);
|
||||
|
||||
nMsgDialog->show();
|
||||
|
||||
|
@ -558,33 +556,8 @@ void SharedFilesDialog::sendLinkTo()
|
|||
* just need to set peers
|
||||
*/
|
||||
std::cerr << "SharedFilesDialog::sendLinkTo()" << std::endl;
|
||||
nMsgDialog->insertTitleText(tr("RetroShare Link"));
|
||||
|
||||
nMsgDialog->insertMsgText(RSLinkClipboard::toHtml());
|
||||
|
||||
nMsgDialog->show();
|
||||
|
||||
/* window will destroy itself! */
|
||||
}
|
||||
|
||||
void SharedFilesDialog::sendHtmlLinkTo()
|
||||
{
|
||||
copyLinkLocal ();
|
||||
|
||||
/* create a message */
|
||||
MessageComposer *nMsgDialog = MessageComposer::newMsg();
|
||||
if (nMsgDialog == NULL) {
|
||||
return;
|
||||
}
|
||||
|
||||
/* fill it in
|
||||
* files are receommended already
|
||||
* just need to set peers
|
||||
*/
|
||||
std::cerr << "SharedFilesDialog::sendLinkTo()" << std::endl;
|
||||
nMsgDialog->insertTitleText(tr("RetroShare Link"));
|
||||
// nMsgDialog->insertHtmlText(QApplication::clipboard()->text().toStdString());// not compatible with multiple links
|
||||
nMsgDialog->insertMsgText(RSLinkClipboard::toHtml());
|
||||
nMsgDialog->setTitleText(tr("RetroShare Link"));
|
||||
nMsgDialog->setMsgText(RSLinkClipboard::toHtml(), true);
|
||||
|
||||
nMsgDialog->show();
|
||||
|
||||
|
@ -661,9 +634,9 @@ void SharedFilesDialog::addMsgRemoteSelected()
|
|||
return;
|
||||
}
|
||||
|
||||
nMsgDialog->insertFileList(files_info) ;
|
||||
nMsgDialog->insertTitleText(tr("Recommendation(s)"));
|
||||
nMsgDialog->insertMsgText(tr("Recommendation(s)"));
|
||||
nMsgDialog->setFileList(files_info) ;
|
||||
nMsgDialog->setTitleText(tr("Recommendation(s)"));
|
||||
nMsgDialog->setMsgText(tr("Recommendation(s)"));
|
||||
nMsgDialog->show();
|
||||
|
||||
/* window will destroy itself! */
|
||||
|
@ -685,9 +658,9 @@ void SharedFilesDialog::recommendFilesToMsg()
|
|||
return;
|
||||
}
|
||||
|
||||
nMsgDialog->insertFileList(files_info) ;
|
||||
nMsgDialog->insertTitleText(tr("Recommendation(s)"));
|
||||
nMsgDialog->insertMsgText(tr("Recommendation(s)"));
|
||||
nMsgDialog->setFileList(files_info) ;
|
||||
nMsgDialog->setTitleText(tr("Recommendation(s)"));
|
||||
nMsgDialog->setMsgText(tr("Recommendation(s)"));
|
||||
nMsgDialog->show();
|
||||
|
||||
/* window will destroy itself! */
|
||||
|
|
|
@ -66,7 +66,6 @@ private slots:
|
|||
void copyLinkhtml();
|
||||
void sendLinkTo();
|
||||
void sendremoteLinkTo();
|
||||
void sendHtmlLinkTo();
|
||||
#ifdef RS_USE_LINKS
|
||||
void sendLinkToCloud();
|
||||
void addLinkToCloud();
|
||||
|
@ -121,7 +120,6 @@ private:
|
|||
QAction* copyremotelinkAct;
|
||||
QAction* copylinklocalAct;
|
||||
QAction* sendlinkAct;
|
||||
QAction* sendhtmllinkAct;
|
||||
#ifdef RS_USE_LINKS
|
||||
QAction* sendlinkCloudAct;
|
||||
QAction* addlinkCloudAct;
|
||||
|
|
|
@ -337,11 +337,10 @@ static void optimizeHtml(QDomDocument& doc, QDomElement& currentElement, unsigne
|
|||
// <p>
|
||||
if (element.tagName().toLower() == "p") {
|
||||
// <p style="...">
|
||||
//styleNode = element.attributes().namedItem("style");
|
||||
if (element.attributes().size() == 1 && styleNode.isAttr()) {
|
||||
QString value = styleNode.toAttr().value().simplified();
|
||||
if (value == "margin:0px 0px 0px 0px;-qt-block-indent:0;text-indent:0px;" ||
|
||||
value.startsWith("-qt-paragraph-type:empty;margin:0px 0px 0px 0px;-qt-block-indent:0;text-indent:0px;")) {
|
||||
QString style = styleNode.toAttr().value().simplified();
|
||||
if (style == "margin:0px 0px 0px 0px;-qt-block-indent:0;text-indent:0px;" ||
|
||||
style.startsWith("-qt-paragraph-type:empty;margin:0px 0px 0px 0px;-qt-block-indent:0;text-indent:0px;")) {
|
||||
|
||||
if (addBR) {
|
||||
// add <br> after a removed <p> before a removed <p>
|
||||
|
@ -354,7 +353,49 @@ static void optimizeHtml(QDomDocument& doc, QDomElement& currentElement, unsigne
|
|||
removeElement(currentElement, element);
|
||||
addBR = true;
|
||||
continue;
|
||||
}
|
||||
}
|
||||
|
||||
// check for blockquote (not ready)
|
||||
// style="margin-top:12px;margin-bottom:12px;margin-left:40px;margin-right:40px;-qt-block-indent:0;text-indent:0px;"
|
||||
// int count = 0; // should be 6
|
||||
// QStringList styles = style.split(';');
|
||||
// foreach (QString pair, styles) {
|
||||
// if (!pair.trimmed().isEmpty()) {
|
||||
// QStringList keyvalue = pair.split(':');
|
||||
// if (keyvalue.length() == 2) {
|
||||
// QString key = keyvalue.at(0).trimmed();
|
||||
// QString value = keyvalue.at(1).trimmed();
|
||||
|
||||
// if ((key == "margin-top" || key == "margin-bottom") && value == "12px") {
|
||||
// ++count;
|
||||
// continue;
|
||||
// }
|
||||
// if (key == "margin-left" || key == "margin-right") {
|
||||
// ++count;
|
||||
// continue;
|
||||
// }
|
||||
// if (key == "-qt-block-indent" && value == "0") {
|
||||
// ++count;
|
||||
// continue;
|
||||
// }
|
||||
// if (key == "text-indent" && value == "0px") {
|
||||
// ++count;
|
||||
// continue;
|
||||
// }
|
||||
// count = 0;
|
||||
// break;
|
||||
// } else {
|
||||
// count = 0;
|
||||
// break;
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
// if (count == 6) {
|
||||
// // change to "blockquote"
|
||||
// element.setTagName("blockquote");
|
||||
// element.attributes().removeNamedItem("style");
|
||||
// element.setAttribute("type", "cite");
|
||||
// }
|
||||
}
|
||||
addBR = false;
|
||||
}
|
||||
|
|
|
@ -424,7 +424,7 @@ void MessageComposer::recommendFriend(const std::list <std::string> &sslIds, con
|
|||
/* create a message */
|
||||
MessageComposer *pMsgDialog = MessageComposer::newMsg();
|
||||
|
||||
pMsgDialog->insertTitleText(tr("Friend Recommendation(s)"));
|
||||
pMsgDialog->setTitleText(tr("Friend Recommendation(s)"));
|
||||
|
||||
if (!to.empty()) {
|
||||
pMsgDialog->addRecipient(TO, to, false);
|
||||
|
@ -433,7 +433,7 @@ void MessageComposer::recommendFriend(const std::list <std::string> &sslIds, con
|
|||
QString sMsgText = msg.isEmpty() ? recommendMessage() : msg;
|
||||
sMsgText += "<br><br>";
|
||||
sMsgText += recommendHtml;
|
||||
pMsgDialog->insertMsgText(sMsgText);
|
||||
pMsgDialog->setMsgText(sMsgText);
|
||||
|
||||
std::list <std::string>::const_iterator peerIt;
|
||||
for (peerIt = sslIds.begin(); peerIt != sslIds.end(); peerIt++) {
|
||||
|
@ -675,7 +675,7 @@ void MessageComposer::peerStatusChanged(const QString& peer_id, int status)
|
|||
}
|
||||
}
|
||||
|
||||
void MessageComposer::insertFileList(const std::list<DirDetails>& dir_info)
|
||||
void MessageComposer::setFileList(const std::list<DirDetails>& dir_info)
|
||||
{
|
||||
std::list<FileInfo> files_info;
|
||||
std::list<DirDetails>::const_iterator it;
|
||||
|
@ -690,10 +690,10 @@ void MessageComposer::insertFileList(const std::list<DirDetails>& dir_info)
|
|||
files_info.push_back(info) ;
|
||||
}
|
||||
|
||||
insertFileList(files_info);
|
||||
setFileList(files_info);
|
||||
}
|
||||
|
||||
void MessageComposer::insertFileList(const std::list<FileInfo>& files_info)
|
||||
void MessageComposer::setFileList(const std::list<FileInfo>& files_info)
|
||||
{
|
||||
_recList.clear() ;
|
||||
|
||||
|
@ -860,11 +860,9 @@ MessageComposer *MessageComposer::newMsg(const std::string &msgId /* = ""*/)
|
|||
// needed to send system flags with reply
|
||||
//msgComposer->systemFlags = (msgInfo.msgflags & RS_MSG_SYSTEM);
|
||||
|
||||
msgComposer->insertTitleText(QString::fromStdWString(msgInfo.title));
|
||||
|
||||
msgComposer->insertMsgText(QString::fromStdWString(msgInfo.msg));
|
||||
|
||||
msgComposer->insertFileList(msgInfo.files);
|
||||
msgComposer->setTitleText(QString::fromStdWString(msgInfo.title));
|
||||
msgComposer->setMsgText(QString::fromStdWString(msgInfo.msg), true);
|
||||
msgComposer->setFileList(msgInfo.files);
|
||||
|
||||
// get existing groups
|
||||
std::list<RsGroupInfo> groupInfoList;
|
||||
|
@ -912,6 +910,91 @@ MessageComposer *MessageComposer::newMsg(const std::string &msgId /* = ""*/)
|
|||
return msgComposer;
|
||||
}
|
||||
|
||||
QString MessageComposer::buildReplyHeader(const MessageInfo &msgInfo)
|
||||
{
|
||||
RetroShareLink link;
|
||||
link.createMessage(msgInfo.srcId, "");
|
||||
QString from = link.toHtml();
|
||||
|
||||
QString to;
|
||||
std::list<std::string>::const_iterator it;
|
||||
for (it = msgInfo.msgto.begin(); it != msgInfo.msgto.end(); it++) {
|
||||
if (link.createMessage(*it, "")) {
|
||||
if (!to.isEmpty()) {
|
||||
to += ", ";
|
||||
}
|
||||
to += link.toHtml();
|
||||
}
|
||||
}
|
||||
|
||||
QString cc;
|
||||
for (it = msgInfo.msgcc.begin(); it != msgInfo.msgcc.end(); it++) {
|
||||
if (link.createMessage(*it, "")) {
|
||||
if (!cc.isEmpty()) {
|
||||
cc += ", ";
|
||||
}
|
||||
cc += link.toHtml();
|
||||
}
|
||||
}
|
||||
|
||||
QDateTime qtime;
|
||||
qtime.setTime_t(msgInfo.ts);
|
||||
|
||||
QString header = QString("<span>-----%1-----").arg(tr("Original Message"));
|
||||
header += QString("<br><font size='3'><strong>%1: </strong>%2</font><br>").arg(tr("From"), from);
|
||||
header += QString("<font size='3'><strong>%1: </strong>%2</font><br>").arg(tr("To"), to);
|
||||
|
||||
if (!cc.isEmpty()) {
|
||||
header += QString("<font size='3'><strong>%1: </strong>%2</font><br>").arg(tr("Cc"), cc);
|
||||
}
|
||||
|
||||
header += QString("<br><font size='3'><strong>%1: </strong>%2</font><br>").arg(tr("Sent"), qtime.toString(Qt::SystemLocaleLongDate));
|
||||
header += QString("<font size='3'><strong>%1: </strong>%2</font></span><br>").arg(tr("Subject"), QString::fromStdWString(msgInfo.title));
|
||||
header += "<br>";
|
||||
|
||||
header += tr("On %1, %2 wrote:").arg(qtime.toString(Qt::SystemLocaleShortDate), from);
|
||||
|
||||
return header;
|
||||
}
|
||||
|
||||
void MessageComposer::setQuotedMsg(const QString &msg, const QString &header)
|
||||
{
|
||||
ui.msgText->setUndoRedoEnabled(false);
|
||||
|
||||
ui.msgText->setHtml(msg);
|
||||
|
||||
QTextBlock block = ui.msgText->document()->firstBlock();
|
||||
while (block.isValid()) {
|
||||
QTextCursor cursor = ui.msgText->textCursor();
|
||||
cursor.setPosition(block.position());
|
||||
|
||||
QTextBlockFormat format;
|
||||
format.setProperty(TextFormat::IsBlockQuote, true);
|
||||
format.setLeftMargin(block.blockFormat().leftMargin() + 20);
|
||||
format.setRightMargin(block.blockFormat().rightMargin() + 20);
|
||||
cursor.mergeBlockFormat(format);
|
||||
|
||||
block = block.next();
|
||||
}
|
||||
|
||||
ui.msgText->moveCursor(QTextCursor::Start);
|
||||
ui.msgText->textCursor().insertBlock();
|
||||
ui.msgText->moveCursor(QTextCursor::Start);
|
||||
|
||||
if (header.isEmpty()) {
|
||||
ui.msgText->insertHtml("<br><br>");
|
||||
} else {
|
||||
ui.msgText->insertHtml("<br><br>" + header + "<br>");
|
||||
}
|
||||
|
||||
ui.msgText->moveCursor(QTextCursor::Start);
|
||||
|
||||
ui.msgText->setUndoRedoEnabled(true);
|
||||
ui.msgText->document()->setModified(true);
|
||||
|
||||
ui.msgText->setFocus( Qt::OtherFocusReason );
|
||||
}
|
||||
|
||||
MessageComposer *MessageComposer::replyMsg(const std::string &msgId, bool all)
|
||||
{
|
||||
MessageInfo msgInfo;
|
||||
|
@ -925,12 +1008,9 @@ MessageComposer *MessageComposer::replyMsg(const std::string &msgId, bool all)
|
|||
|
||||
/* fill it in */
|
||||
|
||||
msgComposer->insertTitleText(QString::fromStdWString(msgInfo.title), REPLY);
|
||||
msgComposer->setTitleText(QString::fromStdWString(msgInfo.title), REPLY);
|
||||
msgComposer->setQuotedMsg(QString::fromStdWString(msgInfo.msg), buildReplyHeader(msgInfo));
|
||||
|
||||
QTextDocument doc ;
|
||||
doc.setHtml(RsHtml::toHtml(QString::fromStdWString(msgInfo.msg), false));
|
||||
|
||||
msgComposer->insertPastedText(doc.toPlainText());
|
||||
msgComposer->addRecipient(MessageComposer::TO, msgInfo.srcId, false);
|
||||
|
||||
if (all) {
|
||||
|
@ -972,16 +1052,12 @@ MessageComposer *MessageComposer::forwardMsg(const std::string &msgId)
|
|||
|
||||
/* fill it in */
|
||||
|
||||
msgComposer->insertTitleText(QString::fromStdWString(msgInfo.title), FORWARD);
|
||||
|
||||
QTextDocument doc ;
|
||||
doc.setHtml(RsHtml::toHtml(QString::fromStdWString(msgInfo.msg), false));
|
||||
|
||||
msgComposer->insertForwardPastedText(doc.toPlainText());
|
||||
msgComposer->setTitleText(QString::fromStdWString(msgInfo.title), FORWARD);
|
||||
msgComposer->setQuotedMsg(QString::fromStdWString(msgInfo.msg), buildReplyHeader(msgInfo));
|
||||
|
||||
std::list<FileInfo>& files_info = msgInfo.files;
|
||||
|
||||
msgComposer->insertFileList(files_info);
|
||||
msgComposer->setFileList(files_info);
|
||||
|
||||
// needed to send system flags with reply
|
||||
//msgComposer->systemFlags = (msgInfo.msgflags & RS_MSG_SYSTEM);
|
||||
|
@ -993,7 +1069,7 @@ MessageComposer *MessageComposer::forwardMsg(const std::string &msgId)
|
|||
return msgComposer;
|
||||
}
|
||||
|
||||
void MessageComposer::insertTitleText(const QString &title, enumMessageType type)
|
||||
void MessageComposer::setTitleText(const QString &title, enumMessageType type)
|
||||
{
|
||||
QString titleText;
|
||||
|
||||
|
@ -1020,37 +1096,7 @@ void MessageComposer::insertTitleText(const QString &title, enumMessageType type
|
|||
ui.titleEdit->setText(misc::removeNewLine(titleText));
|
||||
}
|
||||
|
||||
void MessageComposer::insertPastedText(QString msg)
|
||||
{
|
||||
msg.replace("\n", "\n<BR>> ");
|
||||
|
||||
ui.msgText->setHtml("<HTML><font color=\"blue\"> > " + msg + "</font><br><br></HTML>");
|
||||
|
||||
ui.msgText->setFocus( Qt::OtherFocusReason );
|
||||
|
||||
QTextCursor c = ui.msgText->textCursor();
|
||||
c.movePosition(QTextCursor::End);
|
||||
ui.msgText->setTextCursor(c);
|
||||
|
||||
ui.msgText->document()->setModified(true);
|
||||
}
|
||||
|
||||
void MessageComposer::insertForwardPastedText(QString msg)
|
||||
{
|
||||
msg.replace("\n", "\n<BR>> ");
|
||||
|
||||
ui.msgText->setHtml("<HTML><blockquote [type=cite]><font color=\"blue\">> " + msg + "</font><br><br></blockquote></HTML>");
|
||||
|
||||
ui.msgText->setFocus( Qt::OtherFocusReason );
|
||||
|
||||
QTextCursor c = ui.msgText->textCursor();
|
||||
c.movePosition(QTextCursor::End);
|
||||
ui.msgText->setTextCursor(c);
|
||||
|
||||
ui.msgText->document()->setModified(true);
|
||||
}
|
||||
|
||||
void MessageComposer::insertMsgText(const QString &msg, bool asHtml)
|
||||
void MessageComposer::setMsgText(const QString &msg, bool asHtml)
|
||||
{
|
||||
if (asHtml) {
|
||||
ui.msgText->setHtml(msg);
|
||||
|
@ -1067,13 +1113,6 @@ void MessageComposer::insertMsgText(const QString &msg, bool asHtml)
|
|||
ui.msgText->document()->setModified(true);
|
||||
}
|
||||
|
||||
void MessageComposer::insertHtmlText(const QString &msg)
|
||||
{
|
||||
ui.msgText->setHtml("<a href='" + msg + "'> " + msg + "</a>");
|
||||
|
||||
ui.msgText->document()->setModified(true);
|
||||
}
|
||||
|
||||
void MessageComposer::sendMessage()
|
||||
{
|
||||
if (sendMessage_internal(false)) {
|
||||
|
@ -1087,14 +1126,13 @@ bool MessageComposer::sendMessage_internal(bool bDraftbox)
|
|||
MessageInfo mi;
|
||||
|
||||
mi.title = misc::removeNewLine(ui.titleEdit->text()).toStdWString();
|
||||
mi.msg = ui.msgText->toHtml().toStdWString();
|
||||
// needed to send system flags with reply
|
||||
//mi.msgflags = systemFlags;
|
||||
mi.msgflags = 0;
|
||||
|
||||
QString text;
|
||||
RsHtml::optimizeHtml(ui.msgText, text);
|
||||
mi.msg = text.toStdWString() ;
|
||||
mi.msg = text.toStdWString();
|
||||
|
||||
/* check for existing title */
|
||||
if (bDraftbox == false && mi.title.empty()) {
|
||||
|
|
|
@ -32,6 +32,7 @@ class QFontComboBox;
|
|||
class QTextEdit;
|
||||
class QTextCharFormat;
|
||||
class RSTreeWidgetItemCompareRole;
|
||||
struct MessageInfo;
|
||||
|
||||
class MessageComposer : public QMainWindow
|
||||
{
|
||||
|
@ -57,16 +58,13 @@ public:
|
|||
static MessageComposer *forwardMsg(const std::string &msgId);
|
||||
|
||||
/* worker fns */
|
||||
void insertFileList(const std::list<DirDetails>&);
|
||||
void insertFileList(const std::list<FileInfo>&);
|
||||
void setFileList(const std::list<DirDetails>&);
|
||||
void setFileList(const std::list<FileInfo>&);
|
||||
void addFile(const FileInfo &fileInfo);
|
||||
void insertTitleText(const QString &title, enumMessageType type = NORMAL);
|
||||
void insertPastedText(QString msg) ;
|
||||
void insertForwardPastedText(QString msg);
|
||||
void insertHtmlText(const QString &msg);
|
||||
void insertMsgText(const QString &msg, bool asHtml = false);
|
||||
void setTitleText(const QString &title, enumMessageType type = NORMAL);
|
||||
void setQuotedMsg(const QString &msg, const QString &header);
|
||||
void setMsgText(const QString &msg, bool asHtml = false);
|
||||
void addRecipient(enumType type, const std::string &id, bool group);
|
||||
void Create_New_Image_Tag(const QString urlremoteorlocal);
|
||||
|
||||
public slots:
|
||||
/* actions to take.... */
|
||||
|
@ -145,6 +143,8 @@ private slots:
|
|||
void tagRemoveAll();
|
||||
|
||||
private:
|
||||
static QString buildReplyHeader(const MessageInfo &msgInfo);
|
||||
|
||||
void processSettings(bool bLoad);
|
||||
|
||||
void addContact(enumType type);
|
||||
|
@ -176,6 +176,8 @@ private:
|
|||
void clearTagLabels();
|
||||
void showTagLabels();
|
||||
|
||||
void Create_New_Image_Tag(const QString urlremoteorlocal);
|
||||
|
||||
QAction *actionSave,
|
||||
*actionAlignLeft,
|
||||
*actionAlignCenter,
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue