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

Support deletion of multiple sources #2252

Draft
wants to merge 7 commits into
base: main
Choose a base branch
from
Draft

Conversation

rocodes
Copy link
Contributor

@rocodes rocodes commented Oct 4, 2024

Status

WIP and not yet runnable

Description

Still WIP - probably not yet runnable.

  • Add support for selecting multiple sources in the SourceList (styling tk)
  • Add pyqtSignal/Slot listener/requester so the top bar (actions/toolbar) can request updates on sourcelist selection status
  • Add another view in EmptyConversationView that instructs the user that multiple sources are selected. This is to avoid ambiguity where a single source conversation is previewed, but multiple sources are selected in the sourcelist.
  • "Naive"/straightforward multi delete implementation that sequentially sends DeleteSourceJob (this approach for now, pending server changes that allow for true batch delete will be an easy addition)

Fixes #2160. Details TK

Test Plan

TK

Checklist

If these changes modify code paths involving cryptography, the opening of files in VMs or network (via the RPC service) traffic, Qubes testing in the staging environment is required. For fine tuning of the graphical user interface, testing in any environment in Qubes is required. Please check as applicable:

  • I have tested these changes in the appropriate Qubes environment
  • I do not have an appropriate Qubes OS workstation set up (the reviewer will need to test these changes)
  • These changes should not need testing in Qubes

If these changes add or remove files other than client code, the AppArmor profile may need to be updated. Please check as applicable:

  • I have updated the AppArmor profile
  • No update to the AppArmor profile is required for these changes
  • I don't know and would appreciate guidance

If these changes modify the database schema, you should include a database migration. Please check as applicable:

  • I have written a migration and upgraded a test database based on main and confirmed that the migration is self-contained and applies cleanly
  • I have written a migration but have not upgraded a test database based on main and would like the reviewer to do so
  • I need help writing a database migration
  • No database schema changes are needed

MainView layout to QVBoxLayout and add inner horizontal container to
accommodate inner top bar.

Update strings
MainView layout to QVBoxLayout and add inner horizontal container to
accommodate inner top bar.

Update strings
@@ -74,26 +74,24 @@ def _set_enabled_initial_value(self) -> None:


class DeleteSourceAction(QAction):
Copy link
Contributor Author

@rocodes rocodes Oct 4, 2024

Choose a reason for hiding this comment

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

(these changes aren't strictly needed and I might revert them; I initially was thinking we could use a single DeleteSourceAction for both the source menu and the toolbar, but in the case of the source menu, the target sources are supplied when the action is created, but in the case of the toolbar, the action is created before the target sources are available. The benefit to keeping the changes in is that they will work for if/when we do eventually deprecate the source menu and consolidate around one deletion mechanism.)

@@ -75,6 +80,13 @@ def __init__(
self.main_pane.setLayout(layout)
self.left_pane = LeftPane()
self.main_view = MainView(self.main_pane, app_state)
Copy link
Contributor Author

Choose a reason for hiding this comment

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

(I think I've introduced a bug here that I need to fix - there's a logline about attempting to apply a layout to MainView when a layout has already been applied. It doesn't have any ill effects, but it's on my radar to find + fix before this PR is ready for review.)

self.main_view.add_sourcelist_listener(
self.top_pane._source_requester(), self.top_pane._source_listener()
)

Copy link
Contributor Author

@rocodes rocodes Oct 4, 2024

Choose a reason for hiding this comment

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

There's a couple different ways we can do this, this one felt like the least-worst way, but I'm open to opinions.

Basically, the main view (holds the sourcelist) and the top bar (holds the toolbar) need a way of communicating; either the top bar receives a constant feed of events as the selected item of the sourcelist changes (in which case it would just connect to onItemChanged in the sourcelist and would not need to have a request signal, but it would need to push or pop items from the selected set all the time to keep track of the list); or, on demand it requests the selected set when it needs them (what I have implemented here). I felt like this way was a little less error-prone than that way.

I could have/could still skip the main_view and top_pane abstraction, and go for self.main_view.source_list.connect.... etc, but that felt like reaching quite far into the business of another gui element; similarly, top_pane.batch_actions.toolbar. could be accessed directly. I have no strong preferences and was trying make things fairly easy to read/follow. feedback welcome.

msgid "Select or de-select sources using Ctrl+click, Shift+click, or by dragging the mouse."
msgstr ""

msgid "Use the top toolbar to delete multiple sources at once."
Copy link
Contributor Author

Choose a reason for hiding this comment

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

(When/if we add more options, this text will change. I'm not attached to it)

#InnerTopPane {
background-color: #f3f5f9;
}

Copy link
Contributor Author

Choose a reason for hiding this comment

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

These colours aren't right, someone please help me, this is a cry for help :) (I will try and make some changes to the button disabled state and the active states to make them less jarring, but help slash a reminder that I don't do a good job at visual things)

…pdated list of selected sources from sourcelist. Disable toolbar unless logged in. Change list selection method of SourceList to allow for multi-select.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
Status: In Progress
Development

Successfully merging this pull request may close these issues.

Upstream "Delete Sources" (batch-delete) implementation
1 participant