Show Cc and Bcc in MessagesDialog if available.

Send message to friend with a click on To, Cc or Bcc label.

git-svn-id: http://svn.code.sf.net/p/retroshare/code/trunk@3546 b45a01b8-16f6-495d-af2f-9b41ad6348cc
This commit is contained in:
thunder2 2010-09-28 00:03:12 +00:00
parent 89314af64e
commit e8d22e2940
6 changed files with 204 additions and 53 deletions

View file

@ -272,6 +272,10 @@ MessagesDialog::MessagesDialog(QWidget *parent)
connect(ui.filterColumnComboBox, SIGNAL(currentIndexChanged(int)), this, SLOT(filterColumnChanged()));
connect(ui.toText, SIGNAL(linkActivated(QString)), this, SLOT(linkActivated(QString)));
connect(ui.ccText, SIGNAL(linkActivated(QString)), this, SLOT(linkActivated(QString)));
connect(ui.bccText, SIGNAL(linkActivated(QString)), this, SLOT(linkActivated(QString)));
ui.msgText->setOpenLinks(false);
m_eListMode = LIST_NOTHING;
@ -362,6 +366,11 @@ MessagesDialog::MessagesDialog(QWidget *parent)
ui.clearButton->hide();
ui.bcclabel->setVisible(false);
ui.bccText->setVisible(false);
ui.cclabel->setVisible(false);
ui.ccText->setVisible(false);
// load settings
processSettings(true);
@ -1688,31 +1697,50 @@ void MessagesDialog::insertMsgTxtAndFiles(QModelIndex Index, bool bSetToRead)
else
msgTxt += "<a style='color: black;'href='" + sPeer + "@" + QString::fromStdString(*pit) + "'> " + sPeer + "</a>" + " ";
}
ui.toText->setText(msgTxt);
if (msgInfo.msgcc.size() > 0)
msgTxt += "\nCc: ";
for(pit = msgInfo.msgcc.begin(); pit != msgInfo.msgcc.end(); pit++)
{
QString sPeer = QString::fromStdString(rsPeers->getPeerName(*pit));
if (sPeer.isEmpty())
if (msgInfo.msgcc.size() > 0) {
ui.cclabel->setVisible(true);
ui.ccText->setVisible(true);
msgTxt.clear();
for(pit = msgInfo.msgcc.begin(); pit != msgInfo.msgcc.end(); pit++)
{
msgTxt += "<a style='color: black;'href='" + tr("Anonymous") + "@" + QString::fromStdString(*pit) + "'> " + tr("Anonymous") + "</a>" + " ";
QString sPeer = QString::fromStdString(rsPeers->getPeerName(*pit));
if (sPeer.isEmpty())
{
msgTxt += "<a style='color: black;'href='" + tr("Anonymous") + "@" + QString::fromStdString(*pit) + "'> " + tr("Anonymous") + "</a>" + " ";
}
else
msgTxt += "<a style='color: black;'href='" + sPeer + "@" + QString::fromStdString(*pit) + "'> " + sPeer + "</a>" + " ";
}
else
msgTxt += "<a style='color: black;'href='" + sPeer + "@" + QString::fromStdString(*pit) + "'> " + sPeer + "</a>" + " ";
ui.ccText->setText(msgTxt);
} else {
ui.cclabel->setVisible(false);
ui.ccText->setVisible(false);
ui.ccText->clear();
}
if (msgInfo.msgbcc.size() > 0)
msgTxt += "\nBcc: ";
for(pit = msgInfo.msgbcc.begin(); pit != msgInfo.msgbcc.end(); pit++)
{
QString sPeer = QString::fromStdString(rsPeers->getPeerName(*pit));
if (sPeer.isEmpty())
if (msgInfo.msgbcc.size() > 0) {
ui.bcclabel->setVisible(true);
ui.bccText->setVisible(true);
msgTxt.clear();
for(pit = msgInfo.msgbcc.begin(); pit != msgInfo.msgbcc.end(); pit++)
{
msgTxt += "<a style='color: black;'href='" + tr("Anonymous") + "@" + QString::fromStdString(*pit) + "'> " + tr("Anonymous") + "</a>" + " ";
QString sPeer = QString::fromStdString(rsPeers->getPeerName(*pit));
if (sPeer.isEmpty())
{
msgTxt += "<a style='color: black;'href='" + tr("Anonymous") + "@" + QString::fromStdString(*pit) + "'> " + tr("Anonymous") + "</a>" + " ";
}
else
msgTxt += "<a style='color: black;'href='" + sPeer + "@" + QString::fromStdString(*pit) + "'> " + sPeer + "</a>" + " ";
}
else
msgTxt += "<a style='color: black;'href='" + sPeer + "@" + QString::fromStdString(*pit) + "'> " + sPeer + "</a>" + " ";
ui.bccText->setText(msgTxt);
} else {
ui.bcclabel->setVisible(false);
ui.bccText->setVisible(false);
ui.bccText->clear();
}
{
@ -1721,7 +1749,6 @@ void MessagesDialog::insertMsgTxtAndFiles(QModelIndex Index, bool bSetToRead)
QString timestamp = qtime.toString("dd.MM.yyyy hh:mm:ss");
ui.dateText-> setText(timestamp);
}
ui.toText->setText(msgTxt);
std::string sSrcId;
if ((msgInfo.msgflags & RS_MSG_BOXMASK) == RS_MSG_OUTBOX) {
@ -2265,3 +2292,28 @@ void MessagesDialog::tagTriggered(QAction *pAction)
// LockUpdate -> insertMessages();
}
void MessagesDialog::linkActivated(QString link)
{
if (link.isEmpty() == false) {
// search for cert id in string
std::string certidstr;
int nIndex = link.indexOf("@");
if (nIndex >= 0)
{
// found "@", extract cert id from string
certidstr = link.mid(nIndex + 1).toStdString();
}
else
{
// maybe its only the cert id
certidstr = link.toStdString();
}
RsPeerDetails detail;
if (rsPeers->getPeerDetails(certidstr, detail) && detail.accept_connection) {
MessageComposer::msgFriend(detail.id, false);
}
}
}

View file

@ -55,7 +55,8 @@ public slots:
private slots:
/** Create the context popup menu and it's submenus */
void messageslistWidgetCostumPopupMenu( QPoint point );
void linkActivated(QString link);
void messageslistWidgetCostumPopupMenu( QPoint point );
void msgfilelistWidgetCostumPopupMenu(QPoint);
void changeBox( int newrow );

View file

@ -1546,9 +1546,6 @@ p, li { white-space: pre-wrap; }
<pointsize>9</pointsize>
</font>
</property>
<property name="text">
<string/>
</property>
<property name="scaledContents">
<bool>true</bool>
</property>
@ -1612,9 +1609,93 @@ p, li { white-space: pre-wrap; }
</item>
<item row="2" column="2" colspan="2">
<widget class="QLabel" name="toText">
<property name="text">
<string/>
<property name="wordWrap">
<bool>true</bool>
</property>
</widget>
</item>
<item row="3" column="0">
<widget class="QLabel" name="cclabel">
<property name="sizePolicy">
<sizepolicy hsizetype="Expanding" vsizetype="Fixed">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="minimumSize">
<size>
<width>0</width>
<height>12</height>
</size>
</property>
<property name="maximumSize">
<size>
<width>16777215</width>
<height>10</height>
</size>
</property>
<property name="font">
<font>
<pointsize>10</pointsize>
<weight>75</weight>
<bold>true</bold>
</font>
</property>
<property name="text">
<string>Cc:</string>
</property>
<property name="alignment">
<set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set>
</property>
<property name="wordWrap">
<bool>false</bool>
</property>
</widget>
</item>
<item row="4" column="0">
<widget class="QLabel" name="bcclabel">
<property name="sizePolicy">
<sizepolicy hsizetype="Expanding" vsizetype="Fixed">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="minimumSize">
<size>
<width>0</width>
<height>12</height>
</size>
</property>
<property name="maximumSize">
<size>
<width>16777215</width>
<height>10</height>
</size>
</property>
<property name="font">
<font>
<pointsize>10</pointsize>
<weight>75</weight>
<bold>true</bold>
</font>
</property>
<property name="text">
<string>Bcc:</string>
</property>
<property name="alignment">
<set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set>
</property>
</widget>
</item>
<item row="3" column="2" colspan="2">
<widget class="QLabel" name="ccText">
<property name="wordWrap">
<bool>true</bool>
</property>
</widget>
</item>
<item row="4" column="2" colspan="2">
<widget class="QLabel" name="bccText">
<property name="wordWrap">
<bool>true</bool>
</property>

View file

@ -338,13 +338,20 @@ void MessageComposer::processSettings(bool bLoad)
if (group) {
pMsgDialog->addRecipient(TO, id, true);
} else {
//put all sslChilds in message list
std::list<std::string> sslIds;
rsPeers->getSSLChildListOfGPGId(id, sslIds);
RsPeerDetails detail;
if (rsPeers->getPeerDetails(id, detail) && detail.accept_connection) {
if (detail.isOnlyGPGdetail) {
//put all sslChilds in message list
std::list<std::string> sslIds;
rsPeers->getSSLChildListOfGPGId(id, sslIds);
std::list<std::string>::const_iterator it;
for (it = sslIds.begin(); it != sslIds.end(); it++) {
pMsgDialog->addRecipient(TO, *it, false);
std::list<std::string>::const_iterator it;
for (it = sslIds.begin(); it != sslIds.end(); it++) {
pMsgDialog->addRecipient(TO, *it, false);
}
} else {
pMsgDialog->addRecipient(TO, detail.id, false);
}
}
}