mirror of
https://github.com/RetroShare/RetroShare.git
synced 2024-12-19 21:04:32 -05:00
Forwarding a message keep the attached recommended files.
git-svn-id: http://svn.code.sf.net/p/retroshare/code/trunk@2788 b45a01b8-16f6-495d-af2f-9b41ad6348cc
This commit is contained in:
parent
31fb4ce06a
commit
906cca8012
@ -429,6 +429,17 @@ void MessagesDialog::forwardmessage()
|
|||||||
std::string cited_text(doc.toPlainText().toStdString()) ;
|
std::string cited_text(doc.toPlainText().toStdString()) ;
|
||||||
|
|
||||||
nMsgDialog->insertForwardPastedText(cited_text) ;
|
nMsgDialog->insertForwardPastedText(cited_text) ;
|
||||||
|
|
||||||
|
std::list<FileInfo>& files_info = msgInfo.files;
|
||||||
|
|
||||||
|
/* enable all files for sending */
|
||||||
|
std::list<FileInfo>::iterator it;
|
||||||
|
for(it = files_info.begin(); it != files_info.end(); it++)
|
||||||
|
{
|
||||||
|
it->inRecommend = true;
|
||||||
|
}
|
||||||
|
|
||||||
|
nMsgDialog->insertFileList(files_info);
|
||||||
//nMsgDialog->addRecipient( msgInfo.srcId ) ;
|
//nMsgDialog->addRecipient( msgInfo.srcId ) ;
|
||||||
nMsgDialog->show();
|
nMsgDialog->show();
|
||||||
nMsgDialog->activateWindow();
|
nMsgDialog->activateWindow();
|
||||||
|
@ -60,7 +60,7 @@
|
|||||||
|
|
||||||
/** Constructor */
|
/** Constructor */
|
||||||
ChanMsgDialog::ChanMsgDialog(bool msg, QWidget *parent, Qt::WFlags flags)
|
ChanMsgDialog::ChanMsgDialog(bool msg, QWidget *parent, Qt::WFlags flags)
|
||||||
: mIsMsg(msg), QMainWindow(parent, flags), mCheckAttachment(true)
|
: QMainWindow(parent, flags), mIsMsg(msg), mCheckAttachment(true)
|
||||||
{
|
{
|
||||||
/* Invoke the Qt Designer generated object setup routine */
|
/* Invoke the Qt Designer generated object setup routine */
|
||||||
ui.setupUi(this);
|
ui.setupUi(this);
|
||||||
@ -408,14 +408,34 @@ RsCertId getSenderRsCertId(QTreeWidgetItem *i)
|
|||||||
|
|
||||||
|
|
||||||
/* get the list of peers from the RsIface. */
|
/* get the list of peers from the RsIface. */
|
||||||
void ChanMsgDialog::insertFileList(const std::list<DirDetails>& files_info)
|
void ChanMsgDialog::insertFileList(const std::list<DirDetails>& dir_info)
|
||||||
|
{
|
||||||
|
std::list<FileInfo> files_info;
|
||||||
|
std::list<DirDetails>::const_iterator it;
|
||||||
|
|
||||||
|
/* convert dir_info to files_info */
|
||||||
|
for(it = dir_info.begin(); it != dir_info.end(); it++)
|
||||||
|
{
|
||||||
|
FileInfo info ;
|
||||||
|
info.fname = it->name ;
|
||||||
|
info.hash = it->hash ;
|
||||||
|
info.rank = 0;//it->rank ;
|
||||||
|
info.size = it->count ;
|
||||||
|
info.inRecommend = true;
|
||||||
|
files_info.push_back(info) ;
|
||||||
|
}
|
||||||
|
|
||||||
|
insertFileList(files_info);
|
||||||
|
}
|
||||||
|
|
||||||
|
void ChanMsgDialog::insertFileList(const std::list<FileInfo>& files_info)
|
||||||
{
|
{
|
||||||
// rsiface->lockData(); /* Lock Interface */
|
// rsiface->lockData(); /* Lock Interface */
|
||||||
|
|
||||||
_recList.clear() ;
|
_recList.clear() ;
|
||||||
|
|
||||||
// const std::list<FileInfo> &recList = rsiface->getRecommendList();
|
// const std::list<FileInfo> &recList = rsiface->getRecommendList();
|
||||||
std::list<DirDetails>::const_iterator it;
|
std::list<FileInfo>::const_iterator it;
|
||||||
|
|
||||||
/* get a link to the table */
|
/* get a link to the table */
|
||||||
QTreeWidget *tree = ui.msgFileList;
|
QTreeWidget *tree = ui.msgFileList;
|
||||||
@ -426,23 +446,17 @@ void ChanMsgDialog::insertFileList(const std::list<DirDetails>& files_info)
|
|||||||
QList<QTreeWidgetItem *> items;
|
QList<QTreeWidgetItem *> items;
|
||||||
for(it = files_info.begin(); it != files_info.end(); it++)
|
for(it = files_info.begin(); it != files_info.end(); it++)
|
||||||
{
|
{
|
||||||
FileInfo info ;
|
_recList.push_back(*it) ;
|
||||||
info.fname = it->name ;
|
|
||||||
info.hash = it->hash ;
|
|
||||||
info.rank = 0;//it->rank ;
|
|
||||||
info.size = it->count ;
|
|
||||||
info.inRecommend = true;
|
|
||||||
_recList.push_back(info) ;
|
|
||||||
|
|
||||||
/* make a widget per person */
|
/* make a widget per person */
|
||||||
QTreeWidgetItem *item = new QTreeWidgetItem((QTreeWidget*)0);
|
QTreeWidgetItem *item = new QTreeWidgetItem((QTreeWidget*)0);
|
||||||
|
|
||||||
item->setText(0, QString::fromStdString(it->name)); /* (0) Filename */
|
item->setText(0, QString::fromStdString(it->fname)); /* (0) Filename */
|
||||||
item->setText(1, misc::friendlyUnit(it->count)); /* (1) Size */
|
item->setText(1, misc::friendlyUnit(it->size)); /* (1) Size */
|
||||||
item->setText(2, QString::number(0)) ;//it->rank));
|
item->setText(2, QString::number(0)) ;//it->rank));
|
||||||
item->setText(3, QString::fromStdString(it->hash));
|
item->setText(3, QString::fromStdString(it->hash));
|
||||||
item->setFlags(Qt::ItemIsUserCheckable | Qt::ItemIsEnabled);
|
item->setFlags(Qt::ItemIsUserCheckable | Qt::ItemIsEnabled);
|
||||||
item->setCheckState(0, Qt::Checked);
|
item->setCheckState(0, it->inRecommend ? Qt::Checked : Qt::Unchecked);
|
||||||
|
|
||||||
/* add to the list */
|
/* add to the list */
|
||||||
items.append(item);
|
items.append(item);
|
||||||
@ -456,7 +470,6 @@ void ChanMsgDialog::insertFileList(const std::list<DirDetails>& files_info)
|
|||||||
tree->update(); /* update display */
|
tree->update(); /* update display */
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void ChanMsgDialog::newMsg()
|
void ChanMsgDialog::newMsg()
|
||||||
{
|
{
|
||||||
/* clear all */
|
/* clear all */
|
||||||
@ -1233,13 +1246,13 @@ void ChanMsgDialog::fileHashingFinished(AttachFileItem* file) {
|
|||||||
|
|
||||||
//convert char massageString to w_char
|
//convert char massageString to w_char
|
||||||
wchar_t* message;
|
wchar_t* message;
|
||||||
int requiredSize = mbstowcs(NULL, messageString, 0); // C4996
|
size_t requiredSize = mbstowcs(NULL, messageString, 0); // C4996
|
||||||
/* Add one to leave room for the NULL terminator */
|
/* Add one to leave room for the NULL terminator */
|
||||||
message = (wchar_t *)malloc( (requiredSize + 1) * sizeof( wchar_t ));
|
message = (wchar_t *)malloc( (requiredSize + 1) * sizeof( wchar_t ));
|
||||||
if (! message) {
|
if (! message) {
|
||||||
std::cerr << ("Memory allocation failure.\n");
|
std::cerr << ("Memory allocation failure.\n");
|
||||||
}
|
}
|
||||||
int size = mbstowcs( message, messageString, requiredSize + 1); // C4996
|
size_t size = mbstowcs( message, messageString, requiredSize + 1); // C4996
|
||||||
if (size == (size_t) (-1)) {
|
if (size == (size_t) (-1)) {
|
||||||
printf("Couldn't convert string--invalid multibyte character.\n");
|
printf("Couldn't convert string--invalid multibyte character.\n");
|
||||||
}
|
}
|
||||||
|
@ -53,6 +53,7 @@ public:
|
|||||||
void insertSendList(); /* for Msgs */
|
void insertSendList(); /* for Msgs */
|
||||||
void insertChannelSendList(); /* for Channels */
|
void insertChannelSendList(); /* for Channels */
|
||||||
void insertFileList(const std::list<DirDetails>&); /* for Both */
|
void insertFileList(const std::list<DirDetails>&); /* for Both */
|
||||||
|
void insertFileList(const std::list<FileInfo>&);
|
||||||
void insertTitleText(std::string title);
|
void insertTitleText(std::string title);
|
||||||
void insertPastedText(std::string msg) ;
|
void insertPastedText(std::string msg) ;
|
||||||
void insertForwardPastedText(std::string msg);
|
void insertForwardPastedText(std::string msg);
|
||||||
|
Loading…
Reference in New Issue
Block a user