mirror of
https://github.com/RetroShare/RetroShare.git
synced 2025-08-08 22:32:34 -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
3 changed files with 16 additions and 22 deletions
|
@ -70,6 +70,7 @@ ServerPage::ServerPage(QWidget * parent, Qt::WFlags flags)
|
||||||
#ifdef Q_WS_WIN
|
#ifdef Q_WS_WIN
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
_changed = false ;
|
||||||
}
|
}
|
||||||
|
|
||||||
void ServerPage::toggleIpDetermination(bool b)
|
void ServerPage::toggleIpDetermination(bool b)
|
||||||
|
@ -165,13 +166,13 @@ void ServerPage::load()
|
||||||
/** Loads the settings for this page */
|
/** Loads the settings for this page */
|
||||||
void ServerPage::updateStatus()
|
void ServerPage::updateStatus()
|
||||||
{
|
{
|
||||||
|
if(!isVisible())
|
||||||
|
return ;
|
||||||
|
|
||||||
/* load up configuration from rsPeers */
|
/* load up configuration from rsPeers */
|
||||||
RsPeerDetails detail;
|
RsPeerDetails detail;
|
||||||
if (!rsPeers->getPeerDetails(rsPeers->getOwnId(), detail))
|
if (!rsPeers->getPeerDetails(rsPeers->getOwnId(), detail))
|
||||||
{
|
|
||||||
return;
|
return;
|
||||||
}
|
|
||||||
|
|
||||||
/* only update if can't edit */
|
/* only update if can't edit */
|
||||||
if (!ui.localPort->isEnabled())
|
if (!ui.localPort->isEnabled())
|
||||||
|
@ -185,8 +186,6 @@ void ServerPage::updateStatus()
|
||||||
ui.localAddress->setText(QString::fromStdString(detail.localAddr));
|
ui.localAddress->setText(QString::fromStdString(detail.localAddr));
|
||||||
/* set the server address */
|
/* set the server address */
|
||||||
ui.extAddress->setText(QString::fromStdString(detail.extAddr));
|
ui.extAddress->setText(QString::fromStdString(detail.extAddr));
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void ServerPage::toggleUPnP()
|
void ServerPage::toggleUPnP()
|
||||||
|
@ -214,20 +213,22 @@ void ServerPage::toggleUPnP()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void ServerPage::changed()
|
||||||
|
{
|
||||||
|
_changed = true ;
|
||||||
|
}
|
||||||
|
|
||||||
void ServerPage::saveAddresses()
|
void ServerPage::saveAddresses()
|
||||||
{
|
{
|
||||||
QString str;
|
QString str;
|
||||||
|
|
||||||
bool saveAddr = false;
|
bool saveAddr = false;
|
||||||
|
|
||||||
|
|
||||||
RsPeerDetails detail;
|
RsPeerDetails detail;
|
||||||
std::string ownId = rsPeers->getOwnId();
|
std::string ownId = rsPeers->getOwnId();
|
||||||
|
|
||||||
if (!rsPeers->getPeerDetails(ownId, detail))
|
if (!rsPeers->getPeerDetails(ownId, detail))
|
||||||
{
|
|
||||||
return;
|
return;
|
||||||
}
|
|
||||||
|
|
||||||
int netIndex = ui.netModeComboBox->currentIndex();
|
int netIndex = ui.netModeComboBox->currentIndex();
|
||||||
|
|
||||||
|
@ -248,26 +249,18 @@ void ServerPage::saveAddresses()
|
||||||
}
|
}
|
||||||
|
|
||||||
if (detail.tryNetMode != netMode)
|
if (detail.tryNetMode != netMode)
|
||||||
{
|
|
||||||
rsPeers->setNetworkMode(ownId, netMode);
|
rsPeers->setNetworkMode(ownId, netMode);
|
||||||
}
|
|
||||||
|
|
||||||
int visState = 0;
|
int visState = 0;
|
||||||
/* Check if vis has changed */
|
/* Check if vis has changed */
|
||||||
if (0 == ui.discComboBox->currentIndex())
|
if (0 == ui.discComboBox->currentIndex())
|
||||||
{
|
|
||||||
visState |= RS_VS_DISC_ON;
|
visState |= RS_VS_DISC_ON;
|
||||||
}
|
|
||||||
|
|
||||||
if (visState != detail.visState)
|
if (visState != detail.visState)
|
||||||
{
|
|
||||||
rsPeers->setVisState(ownId, visState);
|
rsPeers->setVisState(ownId, visState);
|
||||||
}
|
|
||||||
|
|
||||||
if (0 != netIndex)
|
if (0 != netIndex)
|
||||||
{
|
|
||||||
saveAddr = true;
|
saveAddr = true;
|
||||||
}
|
|
||||||
|
|
||||||
if (saveAddr)
|
if (saveAddr)
|
||||||
{
|
{
|
||||||
|
|
|
@ -36,7 +36,7 @@ class TransferPage: public ConfigPage
|
||||||
~TransferPage() {}
|
~TransferPage() {}
|
||||||
|
|
||||||
/** Saves the changes on this page */
|
/** Saves the changes on this page */
|
||||||
virtual bool save(QString &errmsg) {}
|
virtual bool save(QString &errmsg) { return true ; }
|
||||||
/** Loads the settings for this page */
|
/** Loads the settings for this page */
|
||||||
virtual void load() {}
|
virtual void load() {}
|
||||||
|
|
||||||
|
|
|
@ -145,22 +145,22 @@ RSettingsWin::loadSettings()
|
||||||
void
|
void
|
||||||
RSettingsWin::saveChanges()
|
RSettingsWin::saveChanges()
|
||||||
{
|
{
|
||||||
bool saveOk;
|
|
||||||
QString errmsg;
|
QString errmsg;
|
||||||
|
|
||||||
/* Call each config page's save() method to save its data */
|
/* Call each config page's save() method to save 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);
|
{
|
||||||
saveOk = page->save(errmsg);
|
ConfigPage *page = dynamic_cast<ConfigPage *>(stackedWidget->widget(i));
|
||||||
|
|
||||||
if (!saveOk) {
|
if(!page->save(errmsg))
|
||||||
|
{
|
||||||
/* Display the offending page */
|
/* Display the offending page */
|
||||||
stackedWidget->setCurrentWidget(page);
|
stackedWidget->setCurrentWidget(page);
|
||||||
|
|
||||||
/* Show the user what went wrong */
|
/* Show the user what went wrong */
|
||||||
QMessageBox::warning(this,
|
QMessageBox::warning(this,
|
||||||
tr("Error Saving Configuration"), errmsg,
|
tr("Error Saving Configuration on page ")+QString::number(i), errmsg,
|
||||||
QMessageBox::Ok, QMessageBox::NoButton);
|
QMessageBox::Ok, QMessageBox::NoButton);
|
||||||
|
|
||||||
/* Don't process the rest of the pages */
|
/* Don't process the rest of the pages */
|
||||||
|
@ -173,3 +173,4 @@ RSettingsWin::saveChanges()
|
||||||
|
|
||||||
QDialog::close();
|
QDialog::close();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue