diff --git a/retroshare-gui/src/gui/MessagesDialog.cpp b/retroshare-gui/src/gui/MessagesDialog.cpp index ac46c6f37..67ba72b84 100644 --- a/retroshare-gui/src/gui/MessagesDialog.cpp +++ b/retroshare-gui/src/gui/MessagesDialog.cpp @@ -429,6 +429,17 @@ void MessagesDialog::forwardmessage() std::string cited_text(doc.toPlainText().toStdString()) ; nMsgDialog->insertForwardPastedText(cited_text) ; + + std::list& files_info = msgInfo.files; + + /* enable all files for sending */ + std::list::iterator it; + for(it = files_info.begin(); it != files_info.end(); it++) + { + it->inRecommend = true; + } + + nMsgDialog->insertFileList(files_info); //nMsgDialog->addRecipient( msgInfo.srcId ) ; nMsgDialog->show(); nMsgDialog->activateWindow(); diff --git a/retroshare-gui/src/gui/msgs/ChanMsgDialog.cpp b/retroshare-gui/src/gui/msgs/ChanMsgDialog.cpp index b931853d3..3acac56f4 100644 --- a/retroshare-gui/src/gui/msgs/ChanMsgDialog.cpp +++ b/retroshare-gui/src/gui/msgs/ChanMsgDialog.cpp @@ -60,7 +60,7 @@ /** Constructor */ 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 */ ui.setupUi(this); @@ -408,41 +408,55 @@ RsCertId getSenderRsCertId(QTreeWidgetItem *i) /* get the list of peers from the RsIface. */ -void ChanMsgDialog::insertFileList(const std::list& files_info) +void ChanMsgDialog::insertFileList(const std::list& dir_info) { -// rsiface->lockData(); /* Lock Interface */ - - _recList.clear() ; - -// const std::list &recList = rsiface->getRecommendList(); + std::list files_info; std::list::const_iterator it; - /* get a link to the table */ - QTreeWidget *tree = ui.msgFileList; - - tree->clear(); - tree->setColumnCount(5); - - QList items; - for(it = files_info.begin(); it != files_info.end(); 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; - _recList.push_back(info) ; + info.inRecommend = true; + files_info.push_back(info) ; + } + + insertFileList(files_info); +} + +void ChanMsgDialog::insertFileList(const std::list& files_info) +{ +// rsiface->lockData(); /* Lock Interface */ + + _recList.clear() ; + +// const std::list &recList = rsiface->getRecommendList(); + std::list::const_iterator it; + + /* get a link to the table */ + QTreeWidget *tree = ui.msgFileList; + + tree->clear(); + tree->setColumnCount(5); + + QList items; + for(it = files_info.begin(); it != files_info.end(); it++) + { + _recList.push_back(*it) ; /* make a widget per person */ QTreeWidgetItem *item = new QTreeWidgetItem((QTreeWidget*)0); - item->setText(0, QString::fromStdString(it->name)); /* (0) Filename */ - item->setText(1, misc::friendlyUnit(it->count)); /* (1) Size */ + item->setText(0, QString::fromStdString(it->fname)); /* (0) Filename */ + item->setText(1, misc::friendlyUnit(it->size)); /* (1) Size */ item->setText(2, QString::number(0)) ;//it->rank)); item->setText(3, QString::fromStdString(it->hash)); item->setFlags(Qt::ItemIsUserCheckable | Qt::ItemIsEnabled); - item->setCheckState(0, Qt::Checked); + item->setCheckState(0, it->inRecommend ? Qt::Checked : Qt::Unchecked); /* add to the list */ items.append(item); @@ -456,7 +470,6 @@ void ChanMsgDialog::insertFileList(const std::list& files_info) tree->update(); /* update display */ } - void ChanMsgDialog::newMsg() { /* clear all */ @@ -1233,13 +1246,13 @@ void ChanMsgDialog::fileHashingFinished(AttachFileItem* file) { //convert char massageString to w_char 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 */ message = (wchar_t *)malloc( (requiredSize + 1) * sizeof( wchar_t )); if (! message) { 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)) { printf("Couldn't convert string--invalid multibyte character.\n"); } diff --git a/retroshare-gui/src/gui/msgs/ChanMsgDialog.h b/retroshare-gui/src/gui/msgs/ChanMsgDialog.h index 8541c8552..9b5d42b55 100644 --- a/retroshare-gui/src/gui/msgs/ChanMsgDialog.h +++ b/retroshare-gui/src/gui/msgs/ChanMsgDialog.h @@ -53,6 +53,7 @@ public: void insertSendList(); /* for Msgs */ void insertChannelSendList(); /* for Channels */ void insertFileList(const std::list&); /* for Both */ + void insertFileList(const std::list&); void insertTitleText(std::string title); void insertPastedText(std::string msg) ; void insertForwardPastedText(std::string msg);