1010mbServerDialogFindReplace::Strings::Strings () :
1111 cachePrefix (QStringLiteral(" Ui.Dialogs.FindReplace." )),
1212 findComboBox (QStringLiteral(" findComboBox" )),
13- replaceComboBox(QStringLiteral(" replaceComboBox" ))
13+ replaceComboBox(QStringLiteral(" replaceComboBox" )),
14+ flags (QStringLiteral(" flags" ))
1415{
1516}
1617
@@ -57,6 +58,7 @@ MBSETTINGS mbServerDialogFindReplace::cachedSettings() const
5758 MBSETTINGS m = mbCoreDialogBase::cachedSettings ();
5859 m[prefix+ds.findComboBox ] = lsFindComboBox ;
5960 m[prefix+ds.replaceComboBox ] = lsReplaceComboBox;
61+ m[prefix+ds.flags ] = getFindFlags () ;
6062 return m;
6163}
6264
@@ -68,6 +70,7 @@ void mbServerDialogFindReplace::setCachedSettings(const MBSETTINGS &settings)
6870
6971 MBSETTINGS::const_iterator it;
7072 MBSETTINGS::const_iterator end = settings.end ();
73+ bool ok;
7174
7275 it = settings.find (prefix+ds.findComboBox );
7376 if (it != end)
@@ -92,6 +95,14 @@ void mbServerDialogFindReplace::setCachedSettings(const MBSETTINGS &settings)
9295 ++i;
9396 }
9497 }
98+
99+ it = settings.find (prefix+ds.flags );
100+ if (it != end)
101+ {
102+ int flags = it.value ().toInt (&ok);
103+ if (ok)
104+ setFindFlags (flags);
105+ }
95106}
96107
97108void mbServerDialogFindReplace::execFindReplace (bool replace)
@@ -189,7 +200,7 @@ void mbServerDialogFindReplace::replaceAll()
189200 }
190201}
191202
192- int mbServerDialogFindReplace::getFindFlags ()
203+ int mbServerDialogFindReplace::getFindFlags () const
193204{
194205 int flags = 0 ;
195206 flags |= mb::FindCaseSensitively * (ui->chbMatchCase ->isChecked ());
@@ -200,6 +211,15 @@ int mbServerDialogFindReplace::getFindFlags()
200211 return flags;
201212}
202213
214+ void mbServerDialogFindReplace::setFindFlags (int flags)
215+ {
216+ ui->chbMatchCase ->setChecked (flags & mb::FindCaseSensitively );
217+ ui->chbMatchWord ->setChecked (flags & mb::FindWholeWords );
218+ ui->chbEscapeSequence ->setChecked (flags & mb::FindEscapeSequence );
219+ ui->chbRegularExpression ->setChecked (flags & mb::FindRegularExpression);
220+ ui->chbLoopSearch ->setChecked (flags & mb::FindLoopSearch );
221+ }
222+
203223void mbServerDialogFindReplace::processCombo (QComboBox *cmb)
204224{
205225 QString text = cmb->currentText ();
0 commit comments