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

Undo functionality #156

Open
AlexHalbesleben opened this issue Aug 30, 2022 · 4 comments
Open

Undo functionality #156

AlexHalbesleben opened this issue Aug 30, 2022 · 4 comments

Comments

@AlexHalbesleben
Copy link
Owner

This will be a pain to implement, but it's probably necessary.

@AlexHalbesleben
Copy link
Owner Author

Some thoughts on implementation:

There is a core Action class. User actions that can be undone/redone can be represented by Actions. An action can be carried out and undone.

Undo functionality is accomplished through the use of an Action chain. This involves an array of Actions and a pointer representing the most recently completed action. Undoing moves the pointer backwards; redoing moves the pointer forwards, if possible. Completing a new action removes any existing actions after the pointer, adds the action to the array, and increments the pointer.

@AlexHalbesleben
Copy link
Owner Author

AlexHalbesleben commented Oct 6, 2022

There are a few subclasses of Action, each representing a specific type of action:

  • SettingsAction: updates the settings. The action will need to know the new and old values of the settings (so that it can undo and redo). This one should be pretty easy.
  • NewReminderAction: creates a new reminder. Will need the new reminder ID. Will require Event and reminder IDs #250 to be resolved.

@AlexHalbesleben
Copy link
Owner Author

  • EditReminderAction: edits an existing reminder. Will need the old and new reminders. Dependent on the resolution of Event and reminder IDs #250.

@AlexHalbesleben
Copy link
Owner Author

  • NewEventAction and EditEventAction: same as NewReminderAction and EditReminderAction, respectively, only for events instead of reminders.
  • NewTaskAction and EditTaskAction: same as NewReminderAction and EditReminderAction, respectively, only for tasks instead of reminders.
  • LockChunkAction: locks/unlocks a chunk. If the chunk is locked, includes the chunk date. Needs the chunk's number and task.
  • EditDayAction: edits the start/end time of a day. Contains the locked/unlocked status of the start and end time and, for those that are locked, their values.
  • CompleteChunkAction: completes a chunk. Needs the chunk number and parent task.
  • CompleteTaskAction: completes a task. Needs the task ID.
  • `DeleteReminderAction: deletes a reminder. Needs a copy (not just a reference) to the task.
  • DeleteEventAction and DeleteTaskAction: delete events and tasks, respectively, like DeleteReminderAction

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant