Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat(empty-cards): Add 'keep notes' checkbox #17815

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

david-allison
Copy link
Member

@david-allison david-allison commented Jan 14, 2025

Purpose / Description

Hey all, I found a possible improvement to avoid some data loss as of 2.20.0.

In Anki desktop, the Empty Cards feature asks if it should not only delete cards that are empty, but also associated notes that would remain without any valid cards.

On AnkiDroid, this is on by default. Notes with no valid cards get deleted when I press the Empty Cards.

I noticed because I made blank placeholder notes that I wanted to later fill in with questions & answers.

It'd be nice if the mobile version also asked first

Fixes

Approach

  • Extract to a DialogFragment
  • Implement the feature using a custom layout and a checkbox
  • Fixup the dialog a bit (Material theme + fix title)

How Has This Been Tested?

Unit tested, somewhat

image

Learning (optional, can help others)

  • A custom view is needed if you want a message AND checkboxes

Checklist

  • You have a descriptive commit message with a short title (first line, max 50 chars).
  • You have commented your code, particularly in hard-to-understand areas
  • You have performed a self-review of your own code
  • UI changes: include screenshots of all affected screens (in particular showing any new or changed strings)
  • UI Changes: You have tested your change using the Google Accessibility Scanner

Copy link
Member

@mikehardy mikehardy left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

one question use of Bundle as message passing mechanism in face of possibly unbounded data to pass, otherwise LGTM

@mikehardy mikehardy added the Needs Author Reply Waiting for a reply from the original author label Jan 14, 2025
@david-allison david-allison force-pushed the empty-cards branch 2 times, most recently from 672f455 to 6c3c5c5 Compare January 20, 2025 18:41
@david-allison david-allison removed Needs Author Reply Waiting for a reply from the original author Has Conflicts labels Jan 20, 2025
Copy link
Member

@lukstbit lukstbit left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM, with a note for the error state when searching the cards.

@lukstbit lukstbit added Needs Author Reply Waiting for a reply from the original author Needs Second Approval Has one approval, one more approval to merge and removed Needs Review labels Jan 21, 2025
fix(empty-cards): window title casing
improvement(empty-cards): use Material Dialog

TR.emptyCardsPreserveNotesCheckbox()

https://github.com/ankitects/anki/blob/39e293b27d36318e00131fd10144755eec8d1922/qt/aqt/emptycards.py#L98-L109

A view is used as dialogs don't support both Checkboxes and a 'message'

Co-authored-by: lukstbit <[email protected]>
@david-allison david-allison removed the Needs Author Reply Waiting for a reply from the original author label Jan 22, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Needs Second Approval Has one approval, one more approval to merge
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants