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);
}
}
}

View File

@ -5612,12 +5612,12 @@ Willst Du die Nachricht speichern ?</translation>
<translation>Von</translation>
</message>
<message>
<location line="+709"/>
<location line="+778"/>
<source>Size</source>
<translation>Grösse</translation>
</message>
<message>
<location line="-324"/>
<location line="-393"/>
<source>&lt;html&gt;&lt;head&gt;&lt;meta name=&quot;qrichtext&quot; content=&quot;1&quot; /&gt;&lt;style type=&quot;text/css&quot;&gt;
p, li { white-space: pre-wrap; }
&lt;/style&gt;&lt;/head&gt;&lt;body style=&quot; font-family:&apos;Arial&apos;; font-size:8pt; font-weight:400; font-style:normal; text-decoration:none;&quot;&gt;
@ -5692,15 +5692,15 @@ p, li { white-space: pre-wrap; }
<message>
<location line="+171"/>
<location filename="../gui/MessagesDialog.cpp" line="-44"/>
<location line="+914"/>
<location line="+932"/>
<location line="+10"/>
<source>Inbox</source>
<translation>Posteingang</translation>
</message>
<message>
<location line="+9"/>
<location filename="../gui/MessagesDialog.cpp" line="-919"/>
<location line="+932"/>
<location filename="../gui/MessagesDialog.cpp" line="-937"/>
<location line="+950"/>
<location line="+8"/>
<source>Outbox</source>
<translation>Postausgang</translation>
@ -5712,12 +5712,22 @@ p, li { white-space: pre-wrap; }
</message>
<message>
<location line="+9"/>
<location filename="../gui/MessagesDialog.cpp" line="-930"/>
<location filename="../gui/MessagesDialog.cpp" line="-948"/>
<source>Sent</source>
<translation>Gesendet</translation>
</message>
<message>
<location line="+545"/>
<location line="+513"/>
<source>Cc:</source>
<translation>Cc:</translation>
</message>
<message>
<location line="+35"/>
<source>Bcc:</source>
<translation>Bcc:</translation>
</message>
<message>
<location line="+66"/>
<location line="+3"/>
<source>Print...</source>
<translation>Drucken...</translation>
@ -5759,13 +5769,13 @@ p, li { white-space: pre-wrap; }
<translation>Speichern unter...</translation>
</message>
<message>
<location filename="../gui/MessagesDialog.cpp" line="+679"/>
<location filename="../gui/MessagesDialog.cpp" line="+697"/>
<source>Print Document</source>
<translation>Dokument drucken</translation>
</message>
<message>
<location filename="../gui/MessagesDialog.ui" line="-775"/>
<location filename="../gui/MessagesDialog.cpp" line="-1561"/>
<location filename="../gui/MessagesDialog.ui" line="-844"/>
<location filename="../gui/MessagesDialog.cpp" line="-1579"/>
<source>Subject</source>
<translation>Betreff</translation>
</message>
@ -5780,12 +5790,12 @@ p, li { white-space: pre-wrap; }
<translation>Von:</translation>
</message>
<message>
<location line="+68"/>
<location line="+65"/>
<source>To:</source>
<translation>An:</translation>
</message>
<message>
<location line="+59"/>
<location line="+131"/>
<source>File Name</source>
<translation>Dateiname</translation>
</message>
@ -5800,7 +5810,7 @@ p, li { white-space: pre-wrap; }
<translation>Prüfsumme</translation>
</message>
<message>
<location line="-858"/>
<location line="-927"/>
<source>Print</source>
<translation>Drucken</translation>
</message>
@ -5849,13 +5859,13 @@ p, li { white-space: pre-wrap; }
<message>
<location line="+437"/>
<location line="+325"/>
<location line="+13"/>
<location line="+13"/>
<location line="+17"/>
<location line="+22"/>
<source>Anonymous</source>
<translation>Anonym</translation>
</message>
<message>
<location line="+174"/>
<location line="+179"/>
<source>Save as...</source>
<translation>Speichern unter...</translation>
</message>
@ -5865,7 +5875,7 @@ p, li { white-space: pre-wrap; }
<translation>HTML-Dateien (*.htm *.html);;Alle Dateien (*)</translation>
</message>
<message>
<location line="-1545"/>
<location line="-1563"/>
<location line="+267"/>
<source>Reply to All</source>
<translation>Allen antworten</translation>
@ -5905,7 +5915,7 @@ p, li { white-space: pre-wrap; }
<message>
<location line="+171"/>
<location filename="../gui/MessagesDialog.cpp" line="+710"/>
<location line="+956"/>
<location line="+974"/>
<location line="+5"/>
<source>Trash</source>
<translation>Papierkorb</translation>
@ -5921,7 +5931,7 @@ p, li { white-space: pre-wrap; }
<translation>Ordner</translation>
</message>
<message>
<location filename="../gui/MessagesDialog.cpp" line="-1660"/>
<location filename="../gui/MessagesDialog.cpp" line="-1678"/>
<source>Remove All Tags</source>
<translation>Alle Schlagwörter entfernen</translation>
</message>
@ -5957,13 +5967,13 @@ p, li { white-space: pre-wrap; }
</message>
<message>
<location line="+275"/>
<location line="+947"/>
<location line="+965"/>
<location line="+8"/>
<source>Drafts</source>
<translation>Entwürfe</translation>
</message>
<message>
<location line="-919"/>
<location line="-937"/>
<source>To</source>
<translation>An</translation>
</message>
@ -5973,7 +5983,7 @@ p, li { white-space: pre-wrap; }
<translation>Editieren...</translation>
</message>
<message>
<location line="+1416"/>
<location line="+1434"/>
<location line="+4"/>
<location line="+4"/>
<location line="+4"/>