mirror of
https://github.com/RetroShare/RetroShare.git
synced 2025-01-26 15:28:28 -05:00
Merge pull request #1450 from csoler/v0.6-ForumModel3
added a "show author in People" function in mails
This commit is contained in:
commit
3527382dbe
@ -852,7 +852,7 @@ bool p3MsgService::getMessage(const std::string &mId, MessageInfo &msg)
|
||||
|
||||
std::map<uint32_t, RsMsgSrcId*>::const_iterator it = mSrcIds.find(msgId) ;
|
||||
if(it != mSrcIds.end())
|
||||
msg.rsgxsid_srcId = RsGxsId(it->second->srcId) ;
|
||||
msg.rsgxsid_srcId = RsGxsId(it->second->srcId) ; // (cyril) this is a hack. Not good. I'm not removing it because it may have consequences, but I dont like this.
|
||||
|
||||
return true;
|
||||
}
|
||||
|
@ -33,6 +33,8 @@
|
||||
#include "common/RSElidedItemDelegate.h"
|
||||
#include "gxs/GxsIdTreeWidgetItem.h"
|
||||
#include "gxs/GxsIdDetails.h"
|
||||
#include "gui/Identity/IdDialog.h"
|
||||
#include "gui/MainWindow.h"
|
||||
#include "msgs/MessageComposer.h"
|
||||
#include "msgs/MessageInterface.h"
|
||||
#include "msgs/MessageUserNotify.h"
|
||||
@ -55,7 +57,8 @@
|
||||
#define IMAGE_STAR_ON ":/images/star-on-16.png"
|
||||
#define IMAGE_STAR_OFF ":/images/star-off-16.png"
|
||||
#define IMAGE_SYSTEM ":/images/user/user_request16.png"
|
||||
#define IMAGE_DECRYPTMESSAGE ":/images/decrypt-mail.png"
|
||||
#define IMAGE_DECRYPTMESSAGE ":/images/decrypt-mail.png"
|
||||
#define IMAGE_AUTHOR_INFO ":/images/info16.png"
|
||||
|
||||
#define COLUMN_STAR 0
|
||||
#define COLUMN_ATTACHEMENTS 1
|
||||
@ -555,6 +558,7 @@ void MessagesDialog::messageTreeWidgetCustomPopupMenu(QPoint /*point*/)
|
||||
QMenu contextMnu( this );
|
||||
|
||||
QAction *action = contextMnu.addAction(QIcon(":/images/view_split_top_bottom.png"), tr("Open in a new window"), this, SLOT(openAsWindow()));
|
||||
|
||||
if (nCount != 1) {
|
||||
action->setDisabled(true);
|
||||
}
|
||||
@ -583,6 +587,7 @@ void MessagesDialog::messageTreeWidgetCustomPopupMenu(QPoint /*point*/)
|
||||
}
|
||||
|
||||
action = contextMnu.addAction(QIcon(":/images/message-mail.png"), tr("Mark as unread"), this, SLOT(markAsUnread()));
|
||||
|
||||
if (itemsRead.isEmpty()) {
|
||||
action->setDisabled(true);
|
||||
}
|
||||
@ -628,11 +633,49 @@ void MessagesDialog::messageTreeWidgetCustomPopupMenu(QPoint /*point*/)
|
||||
contextMnu.addAction(ui.actionPrint);
|
||||
contextMnu.addSeparator();
|
||||
|
||||
RsIdentityDetails details;
|
||||
|
||||
// test if identity is known. If not, no need to call the people tab. Also some mails come from nodes and we wont show that node in the people tab either.
|
||||
// The problem here is that the field rsgxsid_srcId is always populated with either the GxsId or the node of the source, which is inconsistent.
|
||||
|
||||
if(nCount==1 && rsIdentity->getIdDetails(msgInfo.rsgxsid_srcId,details))
|
||||
{
|
||||
std::cerr << "Src ID = " << msgInfo.rsgxsid_srcId << std::endl;
|
||||
|
||||
contextMnu.addAction(QIcon(IMAGE_AUTHOR_INFO),tr("Show author in People"),this,SLOT(showAuthorInPeopleTab()));
|
||||
contextMnu.addSeparator();
|
||||
}
|
||||
|
||||
contextMnu.addAction(QIcon(IMAGE_MESSAGE), tr("New Message"), this, SLOT(newmessage()));
|
||||
|
||||
contextMnu.exec(QCursor::pos());
|
||||
}
|
||||
|
||||
void MessagesDialog::showAuthorInPeopleTab()
|
||||
{
|
||||
std::string cid;
|
||||
std::string mid;
|
||||
|
||||
if(!getCurrentMsg(cid, mid))
|
||||
return ;
|
||||
|
||||
MessageInfo msgInfo;
|
||||
if (!rsMail->getMessage(mid, msgInfo))
|
||||
return;
|
||||
|
||||
if(msgInfo.rsgxsid_srcId.isNull())
|
||||
return ;
|
||||
|
||||
/* window will destroy itself! */
|
||||
IdDialog *idDialog = dynamic_cast<IdDialog*>(MainWindow::getPage(MainWindow::People));
|
||||
|
||||
if (!idDialog)
|
||||
return ;
|
||||
|
||||
MainWindow::showWindow(MainWindow::People);
|
||||
idDialog->navigate(RsGxsId(msgInfo.rsgxsid_srcId)) ;
|
||||
}
|
||||
|
||||
void MessagesDialog::folderlistWidgetCustomPopupMenu(QPoint /*point*/)
|
||||
{
|
||||
if (ui.listWidget->currentRow() != ROW_TRASHBOX) {
|
||||
|
@ -68,6 +68,7 @@ private slots:
|
||||
/** Create the context popup menu and it's submenus */
|
||||
void messageTreeWidgetCustomPopupMenu(QPoint point);
|
||||
void folderlistWidgetCustomPopupMenu(QPoint);
|
||||
void showAuthorInPeopleTab();
|
||||
|
||||
void changeBox(int newrow);
|
||||
void changeQuickView(int newrow);
|
||||
|
Loading…
x
Reference in New Issue
Block a user