mirror of
https://github.com/RetroShare/RetroShare.git
synced 2025-01-05 12:51:08 -05:00
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:
parent
502e006352
commit
ed73533862
@ -2535,24 +2535,27 @@ bool p3ConnectMgr::setLocalAddress(std::string id, struct sockaddr_in addr)
|
||||
|
||||
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 *******/
|
||||
ownState.currentlocaladdr = addr;
|
||||
//avoid 0 for port and address
|
||||
if (ownState.currentlocaladdr.sin_addr.s_addr == 0) {
|
||||
ownState.currentlocaladdr.sin_addr.s_addr = 1;
|
||||
}
|
||||
if (addr.sin_port == 0) {
|
||||
ownState.currentlocaladdr.sin_port = 1;
|
||||
}
|
||||
RsStackMutex stack(connMtx); /****** STACK LOCK MUTEX *******/
|
||||
ownState.currentlocaladdr = addr;
|
||||
//avoid 0 for port and address
|
||||
if (ownState.currentlocaladdr.sin_addr.s_addr == 0) {
|
||||
ownState.currentlocaladdr.sin_addr.s_addr = 1;
|
||||
}
|
||||
if (addr.sin_port == 0) {
|
||||
ownState.currentlocaladdr.sin_port = 1;
|
||||
}
|
||||
}
|
||||
IndicateConfigChanged(); /**** INDICATE MSG CONFIG CHANGED! *****/
|
||||
if ((ownState.netMode & RS_NET_MODE_ACTUAL) == RS_NET_MODE_EXT ||
|
||||
(ownState.netMode & RS_NET_MODE_ACTUAL) == RS_NET_MODE_UDP) {
|
||||
netReset();
|
||||
}
|
||||
return true;
|
||||
}
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
RsStackMutex stack(connMtx); /****** STACK LOCK MUTEX *******/
|
||||
/* check if it is a friend */
|
||||
|
@ -429,6 +429,17 @@ void MessagesDialog::forwardmessage()
|
||||
std::string cited_text(doc.toPlainText().toStdString()) ;
|
||||
|
||||
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->show();
|
||||
nMsgDialog->activateWindow();
|
||||
|
@ -859,7 +859,7 @@ void PopupChatDialog::anchorClicked (const QUrl& link )
|
||||
|
||||
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.exec();
|
||||
return ;
|
||||
|
@ -260,9 +260,23 @@ void ConfCertDialog::loadDialog()
|
||||
ui.radioButton_trust_marginnaly->setIcon(QIcon(":/images/security-medium-off-48.png"));
|
||||
} else {
|
||||
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_marginnaly->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"));
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -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<DirDetails>& files_info)
|
||||
void ChanMsgDialog::insertFileList(const std::list<DirDetails>& dir_info)
|
||||
{
|
||||
// rsiface->lockData(); /* Lock Interface */
|
||||
|
||||
_recList.clear() ;
|
||||
|
||||
// const std::list<FileInfo> &recList = rsiface->getRecommendList();
|
||||
std::list<FileInfo> files_info;
|
||||
std::list<DirDetails>::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++)
|
||||
/* 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<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 */
|
||||
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<DirDetails>& 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");
|
||||
}
|
||||
|
@ -53,6 +53,7 @@ public:
|
||||
void insertSendList(); /* for Msgs */
|
||||
void insertChannelSendList(); /* for Channels */
|
||||
void insertFileList(const std::list<DirDetails>&); /* for Both */
|
||||
void insertFileList(const std::list<FileInfo>&);
|
||||
void insertTitleText(std::string title);
|
||||
void insertPastedText(std::string msg) ;
|
||||
void insertForwardPastedText(std::string msg);
|
||||
|
@ -84,7 +84,7 @@ RSettingsWin::closeEvent (QCloseEvent * event)
|
||||
|
||||
if (update_local) {
|
||||
if (_instance->stackedWidget->currentIndex() == Directories) {
|
||||
ConfigPage *Page = (ConfigPage*) _instance->stackedWidget->currentWidget();
|
||||
ConfigPage *Page = dynamic_cast<ConfigPage *> (_instance->stackedWidget->currentWidget());
|
||||
if (Page) {
|
||||
Page->load();
|
||||
}
|
||||
@ -110,6 +110,8 @@ RSettingsWin::initStackedWidget()
|
||||
stackedWidget->addWidget(new SoundPage() );
|
||||
#endif
|
||||
|
||||
loadSettings(); /* load saved settings */
|
||||
|
||||
setNewPage(General);
|
||||
}
|
||||
|
||||
@ -163,7 +165,6 @@ RSettingsWin::setNewPage(int page)
|
||||
}
|
||||
|
||||
pageName->setText(text);
|
||||
loadSettings(); /* load saved settings */
|
||||
stackedWidget->setCurrentIndex(page);
|
||||
listWidget->setCurrentRow(page);
|
||||
}
|
||||
@ -171,12 +172,14 @@ RSettingsWin::setNewPage(int page)
|
||||
void
|
||||
RSettingsWin::loadSettings()
|
||||
{
|
||||
/* Call each config page's load() method to load its data */
|
||||
int i, count = stackedWidget->count();
|
||||
for (i = 0; i < count; i++) {
|
||||
ConfigPage *page = (ConfigPage *) stackedWidget->widget(i);
|
||||
page->load();
|
||||
}
|
||||
/* Call each config page's load() method to load its data */
|
||||
int i, count = stackedWidget->count();
|
||||
for (i = 0; i < count; i++) {
|
||||
ConfigPage *page = dynamic_cast<ConfigPage *> (stackedWidget->widget(i));
|
||||
if (page) {
|
||||
page->load();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/** Saves changes made to settings. */
|
||||
@ -191,7 +194,7 @@ RSettingsWin::saveChanges()
|
||||
{
|
||||
ConfigPage *page = dynamic_cast<ConfigPage *>(stackedWidget->widget(i));
|
||||
|
||||
if(!page->save(errmsg))
|
||||
if(page && !page->save(errmsg))
|
||||
{
|
||||
/* Display the offending page */
|
||||
stackedWidget->setCurrentWidget(page);
|
||||
|
Loading…
Reference in New Issue
Block a user