--- a/src/qtgui/advsearch_w.cpp
+++ b/src/qtgui/advsearch_w.cpp
@@ -86,7 +86,7 @@
// Create preconfigured clauses
for (unsigned int i = 0; i < iclausescnt; i++) {
- addClause(initclausetypes[i]);
+ addClause(initclausetypes[i], false);
}
// Tune initial state according to last saved
{
@@ -97,7 +97,7 @@
(*cit)->tpChange(prefs.advSearchClauses[i]);
cit++;
} else {
- addClause(prefs.advSearchClauses[i]);
+ addClause(prefs.advSearchClauses[i], false);
}
}
}
@@ -158,18 +158,17 @@
{
// Save my state
prefs.advSearchClauses.clear();
- for (vector<SearchClauseW *>::iterator cit = m_clauseWins.begin();
- cit != m_clauseWins.end(); cit++) {
- prefs.advSearchClauses.push_back((*cit)->sTpCMB->currentIndex());
- }
-}
-
-void AdvSearch::addClause()
-{
- addClause(0);
-}
-
-void AdvSearch::addClause(int tp)
+ for (const auto& clause : m_clauseWins) {
+ prefs.advSearchClauses.push_back(clause->sTpCMB->currentIndex());
+ }
+}
+
+void AdvSearch::addClause(bool updsaved)
+{
+ addClause(0, updsaved);
+}
+
+void AdvSearch::addClause(int tp, bool updsaved)
{
SearchClauseW *w = new SearchClauseW(clauseFRM);
m_clauseWins.push_back(w);
@@ -181,9 +180,12 @@
} else {
delClausePB->setEnabled(false);
}
-}
-
-void AdvSearch::delClause()
+ if (updsaved) {
+ saveCnf();
+ }
+}
+
+void AdvSearch::delClause(bool updsaved)
{
if (m_clauseWins.size() <= iclausescnt)
return;
@@ -193,6 +195,9 @@
delClausePB->setEnabled(true);
} else {
delClausePB->setEnabled(false);
+ }
+ if (updsaved) {
+ saveCnf();
}
}