diff --git a/retroshare-gui/src/gui/MessagesDialog.cpp b/retroshare-gui/src/gui/MessagesDialog.cpp index 7d8ef4082..68da78247 100644 --- a/retroshare-gui/src/gui/MessagesDialog.cpp +++ b/retroshare-gui/src/gui/MessagesDialog.cpp @@ -40,6 +40,7 @@ #include "common/TagDefs.h" #include "common/PeerDefs.h" #include "common/RSItemDelegate.h" +#include "common/Emoticons.h" #include #include @@ -1664,27 +1665,27 @@ void MessagesDialog::insertMsgTxtAndFiles(QModelIndex Index, bool bSetToRead) /* iterate through the sources */ std::list::const_iterator pit; - QString msgTxt; + QString text; QString name; QString rsid; for(pit = msgInfo.msgto.begin(); pit != msgInfo.msgto.end(); pit++) { rsid = PeerDefs::rsidFromId(*pit, &name); - msgTxt += " " + name + "" + " "; + text += " " + name + "" + " "; } - ui.toText->setText(msgTxt); + ui.toText->setText(text); if (msgInfo.msgcc.size() > 0) { ui.cclabel->setVisible(true); ui.ccText->setVisible(true); - msgTxt.clear(); + text.clear(); for(pit = msgInfo.msgcc.begin(); pit != msgInfo.msgcc.end(); pit++) { rsid = PeerDefs::rsidFromId(*pit, &name); - msgTxt += " " + name + "" + " "; + text += " " + name + "" + " "; } - ui.ccText->setText(msgTxt); + ui.ccText->setText(text); } else { ui.cclabel->setVisible(false); ui.ccText->setVisible(false); @@ -1695,13 +1696,13 @@ void MessagesDialog::insertMsgTxtAndFiles(QModelIndex Index, bool bSetToRead) ui.bcclabel->setVisible(true); ui.bccText->setVisible(true); - msgTxt.clear(); + text.clear(); for(pit = msgInfo.msgbcc.begin(); pit != msgInfo.msgbcc.end(); pit++) { rsid = PeerDefs::rsidFromId(*pit, &name); - msgTxt += " " + name + "" + " "; + text += " " + name + "" + " "; } - ui.bccText->setText(msgTxt); + ui.bccText->setText(text); } else { ui.bcclabel->setVisible(false); ui.bccText->setVisible(false); @@ -1723,13 +1724,16 @@ void MessagesDialog::insertMsgTxtAndFiles(QModelIndex Index, bool bSetToRead) sSrcId = msgInfo.srcId; } rsid = PeerDefs::rsidFromId(sSrcId, &name); - msgTxt += " " + name + "" + " "; + text += " " + name + "" + " "; ui.fromText->setText(" " + name +""); ui.fromText->setToolTip(rsid); ui.subjectText->setText(QString::fromStdWString(msgInfo.title)); - ui.msgText->setHtml(QString::fromStdWString(msgInfo.msg)); + + text = QString::fromStdWString(msgInfo.msg); + Emoticons::formatText(text); + ui.msgText->setHtml(text); { std::ostringstream out; diff --git a/retroshare-gui/src/gui/msgs/MessageComposer.cpp b/retroshare-gui/src/gui/msgs/MessageComposer.cpp index 7b53d45bd..891735f75 100644 --- a/retroshare-gui/src/gui/msgs/MessageComposer.cpp +++ b/retroshare-gui/src/gui/msgs/MessageComposer.cpp @@ -50,6 +50,7 @@ #include "gui/RetroShareLink.h" #include "gui/settings/rsharesettings.h" #include "gui/feeds/AttachFileItem.h" +#include "gui/common/Emoticons.h" #include "textformat.h" #include "util/misc.h" @@ -131,6 +132,7 @@ MessageComposer::MessageComposer(QWidget *parent, Qt::WFlags flags) connect(ui.italicbtn, SIGNAL(clicked()), this, SLOT(textItalic())); connect(ui.colorbtn, SIGNAL(clicked()), this, SLOT(textColor())); connect(ui.imagebtn, SIGNAL(clicked()), this, SLOT(addImage())); + connect(ui.emoticonButton, SIGNAL(clicked()), this, SLOT(smileyWidget())); //connect(ui.linkbtn, SIGNAL(clicked()), this, SLOT(insertLink())); connect(ui.actionContactsView, SIGNAL(triggered()), this, SLOT(toggleContacts())); connect(ui.actionSaveas, SIGNAL(triggered()), this, SLOT(saveasDraft())); @@ -1777,6 +1779,16 @@ void MessageComposer::textAlign(QAction *a) ui.msgText->setAlignment(Qt::AlignJustify); } +void MessageComposer::smileyWidget() +{ + Emoticons::showSmileyWidget(this, ui.emoticonButton, SLOT(addSmileys()), false); +} + +void MessageComposer::addSmileys() +{ + ui.msgText->textCursor().insertText(qobject_cast(sender())->toolTip().split("|").first()); +} + void MessageComposer::currentCharFormatChanged(const QTextCharFormat &format) { fontChanged(format.font()); diff --git a/retroshare-gui/src/gui/msgs/MessageComposer.h b/retroshare-gui/src/gui/msgs/MessageComposer.h index e6b4a4609..95e8e55fa 100644 --- a/retroshare-gui/src/gui/msgs/MessageComposer.h +++ b/retroshare-gui/src/gui/msgs/MessageComposer.h @@ -107,6 +107,8 @@ private slots: void textStyle(int styleIndex); void textColor(); void textAlign(QAction *a); + void smileyWidget(); + void addSmileys(); void currentCharFormatChanged(const QTextCharFormat &format); void cursorPositionChanged(); diff --git a/retroshare-gui/src/gui/msgs/MessageComposer.ui b/retroshare-gui/src/gui/msgs/MessageComposer.ui index fea0cbd76..4b835db42 100644 --- a/retroshare-gui/src/gui/msgs/MessageComposer.ui +++ b/retroshare-gui/src/gui/msgs/MessageComposer.ui @@ -17,7 +17,7 @@ Compose - + :/images/folder-draft.png:/images/folder-draft.png @@ -364,7 +364,7 @@ border: 1px solid #CCCCCC;} - + @@ -379,7 +379,7 @@ border: 1px solid #CCCCCC;} - + :/images/textedit/format_font_size_more.png:/images/textedit/format_font_size_more.png @@ -393,7 +393,7 @@ border: 1px solid #CCCCCC;} - + @@ -408,7 +408,7 @@ border: 1px solid #CCCCCC;} - + :/images/textedit/format_font_size_less.png:/images/textedit/format_font_size_less.png @@ -422,7 +422,7 @@ border: 1px solid #CCCCCC;} - + @@ -443,7 +443,7 @@ border: 1px solid #CCCCCC;} - + :/images/textedit/textbold.png:/images/textedit/textbold.png @@ -460,7 +460,7 @@ border: 1px solid #CCCCCC;} - + @@ -481,7 +481,7 @@ border: 1px solid #CCCCCC;} - + :/images/textedit/textunder.png:/images/textedit/textunder.png @@ -498,7 +498,7 @@ border: 1px solid #CCCCCC;} - + @@ -519,7 +519,7 @@ border: 1px solid #CCCCCC;} - + :/images/textedit/textitalic.png:/images/textedit/textitalic.png @@ -536,7 +536,7 @@ border: 1px solid #CCCCCC;} - + @@ -561,7 +561,7 @@ border: 1px solid #CCCCCC;} - + @@ -595,7 +595,7 @@ border: 1px solid #CCCCCC;} - + @@ -616,7 +616,7 @@ border: 1px solid #CCCCCC;} - + :/images/add_image24.png:/images/add_image24.png @@ -630,7 +630,7 @@ border: 1px solid #CCCCCC;} - + Sets text font to code style @@ -639,7 +639,7 @@ border: 1px solid #CCCCCC;} - + :/images/textedit/hi22-action-format-text-code.png:/images/textedit/hi22-action-format-text-code.png @@ -653,7 +653,7 @@ border: 1px solid #CCCCCC;} - + Qt::Horizontal @@ -666,6 +666,23 @@ border: 1px solid #CCCCCC;} + + + + + :/images/emoticons/kopete/kopete020.png:/images/emoticons/kopete/kopete020.png + + + + 24 + 24 + + + + true + + + @@ -861,7 +878,7 @@ border: 1px solid #CCCCCC;} - + :/images/send24.png:/images/send24.png @@ -873,7 +890,7 @@ border: 1px solid #CCCCCC;} - + :/images/replymail24.png:/images/replymail24.png @@ -882,7 +899,7 @@ border: 1px solid #CCCCCC;} - + :/images/contacts24.png:/images/contacts24.png @@ -894,7 +911,7 @@ border: 1px solid #CCCCCC;} - + :/images/save24.png:/images/save24.png @@ -906,7 +923,7 @@ border: 1px solid #CCCCCC;} - + :/images/attach.png:/images/attach.png @@ -921,7 +938,7 @@ border: 1px solid #CCCCCC;} true - + :/images/quote_24.png:/images/quote_24.png @@ -937,6 +954,8 @@ border: 1px solid #CCCCCC;} msgText msgFileList - + + +