mirror of
https://github.com/RetroShare/RetroShare.git
synced 2024-10-01 02:35:48 -04:00
suppressed bug in settings
git-svn-id: http://svn.code.sf.net/p/retroshare/code/branches/v0.5.0@2670 b45a01b8-16f6-495d-af2f-9b41ad6348cc
This commit is contained in:
parent
3c3d459e28
commit
1df9ebd5e3
@ -70,6 +70,7 @@ ServerPage::ServerPage(QWidget * parent, Qt::WFlags flags)
|
||||
#ifdef Q_WS_WIN
|
||||
|
||||
#endif
|
||||
_changed = false ;
|
||||
}
|
||||
|
||||
void ServerPage::toggleIpDetermination(bool b)
|
||||
@ -165,13 +166,13 @@ void ServerPage::load()
|
||||
/** Loads the settings for this page */
|
||||
void ServerPage::updateStatus()
|
||||
{
|
||||
if(!isVisible())
|
||||
return ;
|
||||
|
||||
/* load up configuration from rsPeers */
|
||||
RsPeerDetails detail;
|
||||
if (!rsPeers->getPeerDetails(rsPeers->getOwnId(), detail))
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
/* only update if can't edit */
|
||||
if (!ui.localPort->isEnabled())
|
||||
@ -185,8 +186,6 @@ void ServerPage::updateStatus()
|
||||
ui.localAddress->setText(QString::fromStdString(detail.localAddr));
|
||||
/* set the server address */
|
||||
ui.extAddress->setText(QString::fromStdString(detail.extAddr));
|
||||
|
||||
|
||||
}
|
||||
|
||||
void ServerPage::toggleUPnP()
|
||||
@ -214,20 +213,22 @@ void ServerPage::toggleUPnP()
|
||||
}
|
||||
}
|
||||
|
||||
void ServerPage::changed()
|
||||
{
|
||||
_changed = true ;
|
||||
}
|
||||
|
||||
void ServerPage::saveAddresses()
|
||||
{
|
||||
QString str;
|
||||
|
||||
bool saveAddr = false;
|
||||
|
||||
|
||||
RsPeerDetails detail;
|
||||
std::string ownId = rsPeers->getOwnId();
|
||||
|
||||
if (!rsPeers->getPeerDetails(ownId, detail))
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
int netIndex = ui.netModeComboBox->currentIndex();
|
||||
|
||||
@ -248,26 +249,18 @@ void ServerPage::saveAddresses()
|
||||
}
|
||||
|
||||
if (detail.tryNetMode != netMode)
|
||||
{
|
||||
rsPeers->setNetworkMode(ownId, netMode);
|
||||
}
|
||||
|
||||
int visState = 0;
|
||||
/* Check if vis has changed */
|
||||
if (0 == ui.discComboBox->currentIndex())
|
||||
{
|
||||
visState |= RS_VS_DISC_ON;
|
||||
}
|
||||
|
||||
if (visState != detail.visState)
|
||||
{
|
||||
rsPeers->setVisState(ownId, visState);
|
||||
}
|
||||
|
||||
if (0 != netIndex)
|
||||
{
|
||||
saveAddr = true;
|
||||
}
|
||||
|
||||
if (saveAddr)
|
||||
{
|
||||
|
@ -36,7 +36,7 @@ class TransferPage: public ConfigPage
|
||||
~TransferPage() {}
|
||||
|
||||
/** Saves the changes on this page */
|
||||
virtual bool save(QString &errmsg) {}
|
||||
virtual bool save(QString &errmsg) { return true ; }
|
||||
/** Loads the settings for this page */
|
||||
virtual void load() {}
|
||||
|
||||
|
@ -145,22 +145,22 @@ RSettingsWin::loadSettings()
|
||||
void
|
||||
RSettingsWin::saveChanges()
|
||||
{
|
||||
bool saveOk;
|
||||
QString errmsg;
|
||||
|
||||
/* Call each config page's save() method to save its data */
|
||||
int i, count = stackedWidget->count();
|
||||
for (i = 0; i < count; i++) {
|
||||
ConfigPage *page = (ConfigPage *) stackedWidget->widget(i);
|
||||
saveOk = page->save(errmsg);
|
||||
for (i = 0; i < count; i++)
|
||||
{
|
||||
ConfigPage *page = dynamic_cast<ConfigPage *>(stackedWidget->widget(i));
|
||||
|
||||
if (!saveOk) {
|
||||
if(!page->save(errmsg))
|
||||
{
|
||||
/* Display the offending page */
|
||||
stackedWidget->setCurrentWidget(page);
|
||||
|
||||
/* Show the user what went wrong */
|
||||
QMessageBox::warning(this,
|
||||
tr("Error Saving Configuration"), errmsg,
|
||||
tr("Error Saving Configuration on page ")+QString::number(i), errmsg,
|
||||
QMessageBox::Ok, QMessageBox::NoButton);
|
||||
|
||||
/* Don't process the rest of the pages */
|
||||
@ -173,3 +173,4 @@ RSettingsWin::saveChanges()
|
||||
|
||||
QDialog::close();
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user