mirror of
https://github.com/tnodir/fort
synced 2024-11-15 11:55:09 +00:00
UI: ConfManager: Remove "immediateFlags" arg from save().
This commit is contained in:
parent
ec5d5c2864
commit
b6eb4e2c41
@ -476,7 +476,7 @@ bool ConfManager::load(bool onlyFlags)
|
||||
return true;
|
||||
}
|
||||
|
||||
bool ConfManager::saveToDbIni(FirewallConf &newConf, bool onlyFlags)
|
||||
bool ConfManager::saveConf(FirewallConf &newConf, bool onlyFlags)
|
||||
{
|
||||
if (!onlyFlags && !saveToDb(newConf))
|
||||
return false;
|
||||
@ -486,36 +486,34 @@ bool ConfManager::saveToDbIni(FirewallConf &newConf, bool onlyFlags)
|
||||
return true;
|
||||
}
|
||||
|
||||
void ConfManager::applySavedConf(FirewallConf *newConf, bool onlyFlags, bool immediateFlags)
|
||||
void ConfManager::applySavedConf(FirewallConf *newConf, bool onlyFlags)
|
||||
{
|
||||
if (conf() != newConf) {
|
||||
if (!onlyFlags) {
|
||||
setConf(newConf);
|
||||
} else if (!immediateFlags) {
|
||||
if (onlyFlags) {
|
||||
conf()->copyFlags(*newConf);
|
||||
} else {
|
||||
conf()->copyImmediateFlags(*newConf);
|
||||
setConf(newConf);
|
||||
}
|
||||
}
|
||||
|
||||
emit confChanged(onlyFlags);
|
||||
}
|
||||
|
||||
bool ConfManager::save(FirewallConf *newConf, bool onlyFlags, bool immediateFlags)
|
||||
bool ConfManager::save(FirewallConf *newConf, bool onlyFlags)
|
||||
{
|
||||
++m_confVersion; // change version on each save attempt
|
||||
|
||||
if (!saveToDbIni(*newConf, onlyFlags))
|
||||
if (!saveConf(*newConf, onlyFlags))
|
||||
return false;
|
||||
|
||||
applySavedConf(newConf, onlyFlags, immediateFlags);
|
||||
applySavedConf(newConf, onlyFlags);
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
bool ConfManager::saveFlags(bool immediateFlags)
|
||||
bool ConfManager::saveFlags()
|
||||
{
|
||||
return save(conf(), true, immediateFlags);
|
||||
return save(conf(), true);
|
||||
}
|
||||
|
||||
bool ConfManager::saveVariant(const QVariant &v, int confVersion, bool onlyFlags)
|
||||
@ -523,7 +521,7 @@ bool ConfManager::saveVariant(const QVariant &v, int confVersion, bool onlyFlags
|
||||
auto conf = createConf();
|
||||
conf->fromVariant(v, onlyFlags);
|
||||
|
||||
if (!saveToDbIni(*conf, onlyFlags)) {
|
||||
if (!saveConf(*conf, onlyFlags)) {
|
||||
delete conf;
|
||||
return false;
|
||||
}
|
||||
|
@ -45,11 +45,11 @@ public:
|
||||
|
||||
bool load(bool onlyFlags = false);
|
||||
|
||||
virtual bool saveToDbIni(FirewallConf &newConf, bool onlyFlags);
|
||||
void applySavedConf(FirewallConf *newConf, bool onlyFlags = false, bool immediateFlags = false);
|
||||
bool save(FirewallConf *newConf, bool onlyFlags = false, bool immediateFlags = false);
|
||||
virtual bool saveConf(FirewallConf &newConf, bool onlyFlags);
|
||||
void applySavedConf(FirewallConf *newConf, bool onlyFlags = false);
|
||||
bool save(FirewallConf *newConf, bool onlyFlags = false);
|
||||
bool saveFlags();
|
||||
|
||||
bool saveFlags(bool immediateFlags = false);
|
||||
bool saveVariant(const QVariant &v, int confVersion, bool onlyFlags = false);
|
||||
|
||||
bool loadTasks(const QList<TaskInfo *> &taskInfos);
|
||||
|
@ -235,7 +235,7 @@ void ConnectionsWindow::setupLogAllowedIp()
|
||||
|
||||
conf()->setLogAllowedIp(checked);
|
||||
|
||||
confManager()->saveFlags(true);
|
||||
confManager()->saveFlags();
|
||||
});
|
||||
|
||||
m_cbLogAllowedIp->setVisible(false); // TODO: Collect allowed connections
|
||||
@ -249,7 +249,7 @@ void ConnectionsWindow::setupLogBlockedIp()
|
||||
|
||||
conf()->setLogBlockedIp(checked);
|
||||
|
||||
confManager()->saveFlags(true);
|
||||
confManager()->saveFlags();
|
||||
});
|
||||
}
|
||||
|
||||
|
@ -110,7 +110,7 @@ void OptionsController::save(bool closeOnSuccess)
|
||||
bool onlyFlags = true;
|
||||
if (confFlagsEdited() || confEdited()) {
|
||||
onlyFlags = confFlagsEdited() && !confEdited();
|
||||
if (!confManager()->saveToDbIni(*conf(), onlyFlags))
|
||||
if (!confManager()->saveConf(*conf(), onlyFlags))
|
||||
return;
|
||||
}
|
||||
|
||||
@ -130,7 +130,10 @@ void OptionsController::save(bool closeOnSuccess)
|
||||
|
||||
void OptionsController::applyImmediateFlags()
|
||||
{
|
||||
confManager()->save(conf(), true, true);
|
||||
FirewallConf *originConf = confManager()->conf();
|
||||
originConf->copyImmediateFlags(*conf());
|
||||
|
||||
confManager()->saveFlags();
|
||||
}
|
||||
|
||||
void OptionsController::emitEditedChanged()
|
||||
|
@ -253,7 +253,7 @@ void ProgramsWindow::setupLogBlocked()
|
||||
|
||||
conf()->setLogBlocked(checked);
|
||||
|
||||
confManager()->saveFlags(true);
|
||||
confManager()->saveFlags();
|
||||
});
|
||||
|
||||
m_cbLogBlocked->setFont(ControlUtil::fontDemiBold());
|
||||
|
@ -34,7 +34,7 @@ void ConfManagerRpc::onConfChanged(int confVersion, bool onlyFlags)
|
||||
fortManager()->reloadOptionsWindow(tr("Settings changed by someone else"));
|
||||
}
|
||||
|
||||
bool ConfManagerRpc::saveToDbIni(FirewallConf &newConf, bool onlyFlags)
|
||||
bool ConfManagerRpc::saveConf(FirewallConf &newConf, bool onlyFlags)
|
||||
{
|
||||
rpcManager()->invokeOnServer(Control::Rpc_ConfManager_save,
|
||||
{ newConf.toVariant(onlyFlags), confVersion(), onlyFlags });
|
||||
|
@ -20,7 +20,7 @@ public:
|
||||
protected:
|
||||
void setupAppEndTimer() override { }
|
||||
|
||||
bool saveToDbIni(FirewallConf &newConf, bool onlyFlags) override;
|
||||
bool saveConf(FirewallConf &newConf, bool onlyFlags) override;
|
||||
};
|
||||
|
||||
#endif // CONFMANAGERRPC_H
|
||||
|
Loading…
Reference in New Issue
Block a user