aboutsummaryrefslogtreecommitdiffstats
path: root/src/tagrulesdialog.h
AgeCommit message (Collapse)AuthorFilesLines
12 daysfix(rules): keep the text-mode toggle reachableDanilo M.1-0/+6
Ticking "Edit as text" was a one-way trip: the only way back to the rows was closing the dialog and reopening it. The checkbox was parented to the builder widget and sat on the match row, and switching to text mode hides that widget, so the toggle disappeared along with the rows it governs. Move it to the query row, which is visible in both modes. The existing tests all passed against this, because they drove the toggle through setChecked and then asserted on the checked STATE. A hidden checkbox reports its state perfectly well, so every one of those assertions held while the widget was unreachable. The new test asks the question that matters, whether the toggle would be on screen, and it uses isVisibleTo since nothing is isVisible on a dialog that was never shown. Worth recording how close the mutation check came to endorsing this too. Reparenting the checkbox alone left it in the query row's layout, so it stayed visible and the test still passed. Only restoring the full shipped shape, parent and layout together, reproduced the fault and failed the test. A mutation that does not reproduce the original bug proves nothing about the test that is meant to catch it. The spec's layout sketch carried the same error and is corrected, with the reason, so the next reader does not reintroduce it.
12 daysfeat(rules): a folder dropdown, so the path suffix is never typedDanilo M.1-0/+15
12 daysfeat(rules): report the text-mode refusal without a modalDanilo M.1-0/+7
Leaving text mode with a query the builder cannot represent has to refuse, since there are no rows that mean that query. It announced this with a QMessageBox, which made the branch untestable: a modal blocks the test that reaches it, so the one path that can strand a user was the one path shipping unverified. Say it in the warning label the dialog already has instead. That also suits the moment better, since it does not interrupt someone mid-edit to tell them something the label can hold while they keep typing, and it matches how the tag dialog reports a bad tag. Returning to the rows now calls showWarnings(), because the refusal writes into the same label the load warnings use and a stale complaint would otherwise outlive the query that caused it. The test drives the refusal and the recovery, and asserts the warning appears and then clears. Verified by mutation: letting the checkbox clear regardless fails it. warningTextForTest uses isVisibleTo rather than isVisible. Every child of a dialog that was never shown reports isVisible() false, so the seam would have reported no warning whatever the label held, which is a probe that cannot see the thing it checks.
12 daysfeat(rules): text mode, and leave untouched rules unwrittenDanilo M.1-0/+7
12 daysfeat(rules): load a rule into the builder rowsDanilo M.1-0/+18
Selecting a rule now parses its stored query and rebuilds the builder rows from it, and a row edit compiles back onto the query line and into the working copy. Populating the form was already able to write the rule just loaded over whichever rule is current: m_enabled's toggled runs applyEditsToCurrentRule while m_query still holds the previous rule's text, which emptied the first rule's query on open. The existing m_reloading guard now covers the whole load rather than one signal blocker on the note, which also covers the combo boxes rebuildRows populates.
12 daysfeat(rules): add the builder row widgetsDanilo M.1-0/+31
13 daysfeat(rules): a dialog to view and edit the tagging rulesDanilo M.1-0/+98
Edits land on a working copy and reach the file only on Save. The dialog never opens a notmuch database of its own: it publishes the queries it wants counted and MainWindow runs them through the worker, because the worker owns the only handle. Two departures from the drafted version, both of which lost edits. QPlainTextEdit has no editingFinished, so the note reached the working copy only for whichever row was current at Save; it is driven from textChanged instead, with the selection handler blocking the signal so loading a rule cannot write itself back over the one now current. And reloadList()'s setCurrentItem emits currentItemChanged, so New and Copy repopulated the form from m_working before the pending edit had been flushed into it. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>