mirror of
https://github.com/evilsocket/opensnitch.git
synced 2025-03-04 08:34:40 +01:00
ui: delete temp rules only if enabled
This commit is contained in:
parent
649e1cceac
commit
1790c80e03
3 changed files with 7 additions and 2 deletions
|
@ -475,6 +475,9 @@ class Database:
|
|||
return True
|
||||
|
||||
def delete_rules_by_field(self, field, values):
|
||||
if len(values) == 0:
|
||||
return True
|
||||
|
||||
qstr = "DELETE FROM rules WHERE "
|
||||
for v in values:
|
||||
qstr += field + "=? OR "
|
||||
|
|
|
@ -406,7 +406,8 @@ class PreferencesDialog(QtWidgets.QDialog, uic.loadUiType(DIALOG_UI_PATH)[0]):
|
|||
bool(self.checkUIRules.isChecked()),
|
||||
int(self.comboUIRules.currentIndex())
|
||||
)
|
||||
self._nodes.delete_rule_by_field(Config.DURATION_FIELD, Config.RULES_DURATION_FILTER)
|
||||
if self.checkUIRules.isChecked():
|
||||
self._nodes.delete_rule_by_field(Config.DURATION_FIELD, Config.RULES_DURATION_FILTER)
|
||||
|
||||
self._cfg.setSettings(self._cfg.DEFAULT_ACTION_KEY, self.comboUIAction.currentIndex())
|
||||
self._cfg.setSettings(self._cfg.DEFAULT_DURATION_KEY, int(self.comboUIDuration.currentIndex()))
|
||||
|
|
|
@ -116,7 +116,8 @@ class UIService(ui_pb2_grpc.UIServicer, QtWidgets.QGraphicsObject):
|
|||
self._cfg.getBool(self._cfg.DEFAULT_IGNORE_RULES),
|
||||
self._cfg.getInt(self._cfg.DEFAULT_IGNORE_TEMPORARY_RULES)
|
||||
)
|
||||
self._nodes.delete_rule_by_field(Config.DURATION_FIELD, Config.RULES_DURATION_FILTER)
|
||||
if self._cfg.getBool(self._cfg.DEFAULT_IGNORE_RULES):
|
||||
self._nodes.delete_rule_by_field(Config.DURATION_FIELD, Config.RULES_DURATION_FILTER)
|
||||
|
||||
# https://gist.github.com/pklaus/289646
|
||||
def _setup_interfaces(self):
|
||||
|
|
Loading…
Add table
Reference in a new issue