Ported trunk commits:

2781: 
		- fix a gui bug
	2786: 
		- The settings in the settings window are only loaded once.
		- Saving the settings without changing the network settings doesn't
		  shutdown the connections
	6788:
		- Forwarding a message keep the attached recommended files.



git-svn-id: http://svn.code.sf.net/p/retroshare/code/branches/v0.5.0@2803 b45a01b8-16f6-495d-af2f-9b41ad6348cc
This commit is contained in:
csoler 2010-04-27 19:07:00 +00:00
parent 502e006352
commit ed73533862
7 changed files with 89 additions and 44 deletions

View file

@ -2535,24 +2535,27 @@ bool p3ConnectMgr::setLocalAddress(std::string id, struct sockaddr_in addr)
if (id == AuthSSL::getAuthSSL()->OwnId()) if (id == AuthSSL::getAuthSSL()->OwnId())
{ {
if (ownState.currentlocaladdr.sin_addr.s_addr != addr.sin_addr.s_addr ||
ownState.currentlocaladdr.sin_port != addr.sin_port) {
{ {
RsStackMutex stack(connMtx); /****** STACK LOCK MUTEX *******/ RsStackMutex stack(connMtx); /****** STACK LOCK MUTEX *******/
ownState.currentlocaladdr = addr; ownState.currentlocaladdr = addr;
//avoid 0 for port and address //avoid 0 for port and address
if (ownState.currentlocaladdr.sin_addr.s_addr == 0) { if (ownState.currentlocaladdr.sin_addr.s_addr == 0) {
ownState.currentlocaladdr.sin_addr.s_addr = 1; ownState.currentlocaladdr.sin_addr.s_addr = 1;
} }
if (addr.sin_port == 0) { if (addr.sin_port == 0) {
ownState.currentlocaladdr.sin_port = 1; ownState.currentlocaladdr.sin_port = 1;
} }
} }
IndicateConfigChanged(); /**** INDICATE MSG CONFIG CHANGED! *****/ IndicateConfigChanged(); /**** INDICATE MSG CONFIG CHANGED! *****/
if ((ownState.netMode & RS_NET_MODE_ACTUAL) == RS_NET_MODE_EXT || if ((ownState.netMode & RS_NET_MODE_ACTUAL) == RS_NET_MODE_EXT ||
(ownState.netMode & RS_NET_MODE_ACTUAL) == RS_NET_MODE_UDP) { (ownState.netMode & RS_NET_MODE_ACTUAL) == RS_NET_MODE_UDP) {
netReset(); netReset();
} }
return true; }
} return true;
}
RsStackMutex stack(connMtx); /****** STACK LOCK MUTEX *******/ RsStackMutex stack(connMtx); /****** STACK LOCK MUTEX *******/
/* check if it is a friend */ /* check if it is a friend */

View file

@ -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();

View file

@ -859,7 +859,7 @@ void PopupChatDialog::anchorClicked (const QUrl& link )
if(!rslink.valid()) if(!rslink.valid())
{ {
QMessageBox mb(tr("Badly formed RS link"), tr("This RetroShare link is malformed. This is bug. Please contact the developers."),QMessageBox::Information,QMessageBox::Ok,0,0); QMessageBox mb(tr("Badly formed RS link"), tr("This RetroShare link is malformed. This is bug. Please contact the developers.\n\nNote: this possibly comes from a bug in Qt4.6. Try to right-click + copy link location."),QMessageBox::Information,QMessageBox::Ok,0,0);
mb.setButtonText( QMessageBox::Ok, "OK" ); mb.setButtonText( QMessageBox::Ok, "OK" );
mb.exec(); mb.exec();
return ; return ;

View file

@ -260,9 +260,23 @@ void ConfCertDialog::loadDialog()
ui.radioButton_trust_marginnaly->setIcon(QIcon(":/images/security-medium-off-48.png")); ui.radioButton_trust_marginnaly->setIcon(QIcon(":/images/security-medium-off-48.png"));
} else { } else {
ui.web_of_trust_label->setText(tr("Your trust in this peer is not set.")); ui.web_of_trust_label->setText(tr("Your trust in this peer is not set."));
//we have to set up the set exclusive to false in order to uncheck it all
ui.radioButton_trust_fully->setAutoExclusive(false);
ui.radioButton_trust_marginnaly->setAutoExclusive(false);
ui.radioButton_trust_never->setAutoExclusive(false);
ui.radioButton_trust_fully->setChecked(false); ui.radioButton_trust_fully->setChecked(false);
ui.radioButton_trust_marginnaly->setChecked(false); ui.radioButton_trust_marginnaly->setChecked(false);
ui.radioButton_trust_never->setChecked(false); ui.radioButton_trust_never->setChecked(false);
ui.radioButton_trust_fully->setAutoExclusive(true);
ui.radioButton_trust_marginnaly->setAutoExclusive(true);
ui.radioButton_trust_never->setAutoExclusive(true);
ui.radioButton_trust_never->setIcon(QIcon(":/images/security-low-off-48.png"));
ui.radioButton_trust_fully->setIcon(QIcon(":/images/security-high-off-48.png"));
ui.radioButton_trust_marginnaly->setIcon(QIcon(":/images/security-medium-off-48.png"));
} }
} }

View file

@ -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,41 +408,55 @@ 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)
{ {
// rsiface->lockData(); /* Lock Interface */ std::list<FileInfo> files_info;
_recList.clear() ;
// const std::list<FileInfo> &recList = rsiface->getRecommendList();
std::list<DirDetails>::const_iterator it; std::list<DirDetails>::const_iterator it;
/* get a link to the table */ /* convert dir_info to files_info */
QTreeWidget *tree = ui.msgFileList; for(it = dir_info.begin(); it != dir_info.end(); it++)
tree->clear();
tree->setColumnCount(5);
QList<QTreeWidgetItem *> items;
for(it = files_info.begin(); it != files_info.end(); it++)
{ {
FileInfo info ; FileInfo info ;
info.fname = it->name ; info.fname = it->name ;
info.hash = it->hash ; info.hash = it->hash ;
info.rank = 0;//it->rank ; info.rank = 0;//it->rank ;
info.size = it->count ; info.size = it->count ;
info.inRecommend = true; info.inRecommend = true;
_recList.push_back(info) ; files_info.push_back(info) ;
}
insertFileList(files_info);
}
void ChanMsgDialog::insertFileList(const std::list<FileInfo>& files_info)
{
// rsiface->lockData(); /* Lock Interface */
_recList.clear() ;
// const std::list<FileInfo> &recList = rsiface->getRecommendList();
std::list<FileInfo>::const_iterator it;
/* get a link to the table */
QTreeWidget *tree = ui.msgFileList;
tree->clear();
tree->setColumnCount(5);
QList<QTreeWidgetItem *> items;
for(it = files_info.begin(); it != files_info.end(); it++)
{
_recList.push_back(*it) ;
/* 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");
} }

View file

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

View file

@ -84,7 +84,7 @@ RSettingsWin::closeEvent (QCloseEvent * event)
if (update_local) { if (update_local) {
if (_instance->stackedWidget->currentIndex() == Directories) { if (_instance->stackedWidget->currentIndex() == Directories) {
ConfigPage *Page = (ConfigPage*) _instance->stackedWidget->currentWidget(); ConfigPage *Page = dynamic_cast<ConfigPage *> (_instance->stackedWidget->currentWidget());
if (Page) { if (Page) {
Page->load(); Page->load();
} }
@ -110,6 +110,8 @@ RSettingsWin::initStackedWidget()
stackedWidget->addWidget(new SoundPage() ); stackedWidget->addWidget(new SoundPage() );
#endif #endif
loadSettings(); /* load saved settings */
setNewPage(General); setNewPage(General);
} }
@ -163,7 +165,6 @@ RSettingsWin::setNewPage(int page)
} }
pageName->setText(text); pageName->setText(text);
loadSettings(); /* load saved settings */
stackedWidget->setCurrentIndex(page); stackedWidget->setCurrentIndex(page);
listWidget->setCurrentRow(page); listWidget->setCurrentRow(page);
} }
@ -171,12 +172,14 @@ RSettingsWin::setNewPage(int page)
void void
RSettingsWin::loadSettings() RSettingsWin::loadSettings()
{ {
/* Call each config page's load() method to load its data */ /* Call each config page's load() method to load its data */
int i, count = stackedWidget->count(); int i, count = stackedWidget->count();
for (i = 0; i < count; i++) { for (i = 0; i < count; i++) {
ConfigPage *page = (ConfigPage *) stackedWidget->widget(i); ConfigPage *page = dynamic_cast<ConfigPage *> (stackedWidget->widget(i));
page->load(); if (page) {
} page->load();
}
}
} }
/** Saves changes made to settings. */ /** Saves changes made to settings. */
@ -191,7 +194,7 @@ RSettingsWin::saveChanges()
{ {
ConfigPage *page = dynamic_cast<ConfigPage *>(stackedWidget->widget(i)); ConfigPage *page = dynamic_cast<ConfigPage *>(stackedWidget->widget(i));
if(!page->save(errmsg)) if(page && !page->save(errmsg))
{ {
/* Display the offending page */ /* Display the offending page */
stackedWidget->setCurrentWidget(page); stackedWidget->setCurrentWidget(page);