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

bugfix: save collapse-state for note tree #2928

Merged
merged 3 commits into from
Dec 23, 2023
Merged

Conversation

discapes
Copy link
Contributor

Part of the feature #790
Fixes #2924, #2520, #2204 and #2181
Woah, four in one!

@@ -2123,6 +2123,8 @@ void MainWindow::loadNoteDirectoryList() {

ui->noteSubFolderTreeWidget->buildTreeForParentItem(noteFolderItem);
noteFolderItem->setExpanded(true);
connect(ui->noteTreeWidget, &QTreeWidget::itemExpanded, ui->noteSubFolderTreeWidget, &NoteSubFolderTree::onItemExpanded);
Copy link
Owner

Choose a reason for hiding this comment

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

Since loadNoteDirectoryList() is called quite often, aren't those connect statements executed multiple times too?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Yeah they should probably be moved someplace better. But I'm wondering why in the firstplace is the note list used for the tree, and not the directory view. Then no extra connect calls would be needed.

Copy link
Owner

Choose a reason for hiding this comment

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

It doesn't even make sense to me that the NoteSubFolderTree is involved at all, the notes are also added to the NoteSubFolderTree now. I suspect that might be a big regression from a pull request from two years ago that moved lots of stuff around.

Copy link
Owner

Choose a reason for hiding this comment

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

the notes are also added to the NoteSubFolderTree now

Ok, the note sub-folder tree is disabled when I restart the application. Still strange.

Copy link
Owner

Choose a reason for hiding this comment

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

But I'm wondering why in the firstplace is the note list used for the tree, and not the directory view.

Because the directory view lacks far more interaction for making notes work there than the notetree widget.

Copy link
Contributor Author

@discapes discapes Dec 20, 2023

Choose a reason for hiding this comment

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

Because the directory view lacks far more interaction for making notes work there than the notetree widget.

Got it. I guess NoteSubFolderTree is involved because the buildTreeForParentItem method was found useful. It confused me at first since it's getting called on an item that's not a part of the NoteSubFolderTree, and I'm surprised it works. But that's fine. Anyway, I moved the connect() calls to a better place in the last commit.

Copy link
Owner

Choose a reason for hiding this comment

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

I think a lot got mixed up in the "cleanup contribution" two years ago...

@@ -506,6 +506,8 @@ void MainWindow::initTreeWidgets() {
&MainWindow::onMultipleSubfoldersSelected);
connect(ui->noteSubFolderTreeWidget, &NoteSubFolderTree::currentSubFolderChanged, this,
&MainWindow::onCurrentSubFolderChanged);
connect(ui->noteTreeWidget, &QTreeWidget::itemExpanded, ui->noteSubFolderTreeWidget, &NoteSubFolderTree::onItemExpanded);
Copy link
Owner

Choose a reason for hiding this comment

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

This only should be done in the experimental note tree mode!

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'm not sure the notelist can be expanded if not in experimental note tree mode?

Copy link
Owner

Choose a reason for hiding this comment

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

No, the note list is a list by default.

Copy link
Owner

Choose a reason for hiding this comment

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

This only should be done in the experimental note tree mode!

Do you want to add the check? There is a method for it.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Done !

Copy link
Owner

Choose a reason for hiding this comment

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

Thank you!

@pbek pbek merged commit 045efb1 into pbek:main Dec 23, 2023
24 of 30 checks passed
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

Successfully merging this pull request may close these issues.

[BUG] Notes list view resets when changing note name
2 participants