Skip to content

Commit f70efd7

Browse files
committed
Fix: Auto-activate new triggers/aliases/scripts/keys on save (#8529)
<!-- Keep the title short & concise so anyone non-technical can understand it, the title appears in PTB changelogs --> #### Brief overview of PR changes/additions Auto-activate new triggers/aliases/scripts/keys on save as it was the case previously. #### Motivation for adding to Mudlet Fix #8453 #### Other info (issues closed, discussion etc) Co-authored-by: Vadim Peretokin <vadi2@users.noreply.github.com> (cherry picked from commit 1bbf944)
1 parent 5331311 commit f70efd7

File tree

1 file changed

+8
-12
lines changed

1 file changed

+8
-12
lines changed

src/dlgTriggerEditor.cpp

Lines changed: 8 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -4947,6 +4947,7 @@ void dlgTriggerEditor::addTrigger(bool isFolder)
49474947
pNewTrigger->setScript(script);
49484948
pNewTrigger->setIsFolder(isFolder);
49494949
pNewTrigger->setIsActive(false);
4950+
pNewTrigger->setShouldBeActive(true);
49504951
pNewTrigger->setIsMultiline(false);
49514952
pNewTrigger->mStayOpen = 0;
49524953
pNewTrigger->setConditionLineDelta(0);
@@ -5173,6 +5174,7 @@ void dlgTriggerEditor::addKey(bool isFolder)
51735174
pNewKey->setScript(script);
51745175
pNewKey->setIsFolder(isFolder);
51755176
pNewKey->setIsActive(false);
5177+
pNewKey->setShouldBeActive(true);
51765178
pNewKey->registerKey();
51775179

51785180
// Initialize tree item properties
@@ -5250,6 +5252,7 @@ void dlgTriggerEditor::addAlias(bool isFolder)
52505252
pNewAlias->setScript(script);
52515253
pNewAlias->setIsFolder(isFolder);
52525254
pNewAlias->setIsActive(false);
5255+
pNewAlias->setShouldBeActive(true);
52535256
pNewAlias->registerAlias();
52545257

52555258
// Initialize tree item properties
@@ -5408,6 +5411,7 @@ void dlgTriggerEditor::addScript(bool isFolder)
54085411
pNewScript->setScript(script);
54095412
pNewScript->setIsFolder(isFolder);
54105413
pNewScript->setIsActive(false);
5414+
pNewScript->setShouldBeActive(true);
54115415
pNewScript->registerScript();
54125416

54135417
// Initialize tree item properties
@@ -5825,8 +5829,7 @@ void dlgTriggerEditor::saveTrigger()
58255829
icon.addPixmap(QPixmap(qsl(":/icons/folder-blue-locked.png")), QIcon::Normal, QIcon::Off);
58265830
}
58275831
} else {
5828-
// Set visual appearance based on actual active state, not "new" status
5829-
if (pT->isActive()) {
5832+
if (pT->shouldBeActive()) {
58305833
itemDescription = descActive;
58315834
if (pT->ancestorsActive()) {
58325835
icon.addPixmap(QPixmap(qsl(":/icons/tag_checkbox_checked.png")), QIcon::Normal, QIcon::Off);
@@ -5842,7 +5845,6 @@ void dlgTriggerEditor::saveTrigger()
58425845
pItem->setIcon(0, icon);
58435846
pItem->setText(0, name);
58445847

5845-
// Only enable truly new triggers, not existing disabled ones being loaded
58465848
if (pT->shouldBeActive()) {
58475849
pT->setIsActive(true);
58485850
}
@@ -6104,8 +6106,7 @@ void dlgTriggerEditor::saveAlias()
61046106
icon.addPixmap(QPixmap(qsl(":/icons/folder-violet-locked.png")), QIcon::Normal, QIcon::Off);
61056107
}
61066108
} else {
6107-
// Set visual appearance based on actual active state, not "new" status
6108-
if (pT->isActive()) {
6109+
if (pT->shouldBeActive()) {
61096110
itemDescription = descActive;
61106111
if (pT->ancestorsActive()) {
61116112
icon.addPixmap(QPixmap(qsl(":/icons/tag_checkbox_checked.png")), QIcon::Normal, QIcon::Off);
@@ -6121,7 +6122,6 @@ void dlgTriggerEditor::saveAlias()
61216122
pItem->setIcon(0, icon);
61226123
pItem->setText(0, name);
61236124

6124-
// Only enable truly new aliases, not existing disabled ones being loaded
61256125
if (pT->shouldBeActive()) {
61266126
pT->setIsActive(true);
61276127
}
@@ -6427,8 +6427,7 @@ void dlgTriggerEditor::saveScript()
64276427
itemDescription = descInactiveParent.arg(itemDescription);
64286428
}
64296429
} else {
6430-
// Set visual appearance based on actual active state, not "new" status
6431-
if (pT->isActive()) {
6430+
if (pT->shouldBeActive()) {
64326431
itemDescription = descActive;
64336432
if (pT->ancestorsActive()) {
64346433
icon.addPixmap(QPixmap(qsl(":/icons/tag_checkbox_checked.png")), QIcon::Normal, QIcon::Off);
@@ -6444,7 +6443,6 @@ void dlgTriggerEditor::saveScript()
64446443
pItem->setIcon(0, icon);
64456444
pItem->setText(0, name);
64466445

6447-
// Only enable truly new scripts, not existing disabled ones being loaded
64486446
if (pT->shouldBeActive()) {
64496447
pT->setIsActive(true);
64506448
}
@@ -6818,8 +6816,7 @@ void dlgTriggerEditor::saveKey()
68186816
icon.addPixmap(QPixmap(qsl(":/icons/folder-pink-locked.png")), QIcon::Normal, QIcon::Off);
68196817
}
68206818
} else {
6821-
// Set visual appearance based on actual active state, not "new" status
6822-
if (pT->isActive()) {
6819+
if (pT->shouldBeActive()) {
68236820
itemDescription = descActive;
68246821
if (pT->ancestorsActive()) {
68256822
icon.addPixmap(QPixmap(qsl(":/icons/tag_checkbox_checked.png")), QIcon::Normal, QIcon::Off);
@@ -6835,7 +6832,6 @@ void dlgTriggerEditor::saveKey()
68356832
pItem->setIcon(0, icon);
68366833
pItem->setText(0, name);
68376834

6838-
// Only enable truly new keys, not existing disabled ones being loaded
68396835
if (pT->shouldBeActive()) {
68406836
pT->setIsActive(true);
68416837
}

0 commit comments

Comments
 (0)