Fixed #79 (Macro Editor: Replace function enabled also for read-only macros)

This commit is contained in:
Matthias Koefferlein 2018-02-23 23:04:21 +01:00
parent 594d090fb8
commit eea53b3091
2 changed files with 10 additions and 0 deletions

View File

@ -1621,6 +1621,8 @@ MacroEditorDialog::current_tab_changed (int index)
// clear the search
searchEditBox->clear ();
replaceFrame->setEnabled (page && page->macro () && !page->macro ()->is_readonly ());
apply_search ();
do_update_ui_to_run_mode ();

View File

@ -971,6 +971,10 @@ static QString interpolate_string (const QString &replace, const QRegExp &re)
void
MacroEditorPage::replace_and_find_next (const QString &replace)
{
if (! mp_macro || mp_macro->is_readonly ()) {
return;
}
QTextCursor c = mp_text->textCursor ();
if (c.hasSelection ()) {
c.insertText (interpolate_string (replace, m_current_search));
@ -982,6 +986,10 @@ MacroEditorPage::replace_and_find_next (const QString &replace)
void
MacroEditorPage::replace_all (const QString &replace)
{
if (! mp_macro || mp_macro->is_readonly ()) {
return;
}
const QTextDocument *doc = mp_text->document ();
QTextCursor c = mp_text->textCursor ();