Skip to content

Commit

Permalink
#3072 fix: note selection when selecting subfolder in note tree mode
Browse files Browse the repository at this point in the history
Signed-off-by: Patrizio Bekerle <[email protected]>
  • Loading branch information
pbek committed Sep 14, 2024
1 parent cd89386 commit 0e4a626
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 2 deletions.
5 changes: 5 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,10 @@
# QOwnNotes Changelog

## 24.9.6
- The note selection when selecting a note subfolder in the experimental
[note tree mode](https://github.com/pbek/QOwnNotes/issues/790) was fixed
(for [#3072](https://github.com/pbek/QOwnNotes/issues/3072))

## 24.9.5
- The name detection of links in checkbox list item for bookmarks for the
[Web Companion browser extension](https://github.com/qownnotes/web-companion)
Expand Down
10 changes: 8 additions & 2 deletions src/mainwindow.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -11295,8 +11295,14 @@ void MainWindow::on_noteTreeWidget_itemDoubleClicked(QTreeWidgetItem *item, int
*/
void MainWindow::on_noteTreeWidget_itemSelectionChanged() {
qDebug() << __func__;
if (ui->noteTreeWidget->selectedItems().size() == 1) {
int noteId = ui->noteTreeWidget->selectedItems()[0]->data(0, Qt::UserRole).toInt();
const auto &selectedItems = ui->noteTreeWidget->selectedItems();
if (selectedItems.size() == 1) {
// Don't tread folders as notes
if (selectedItems[0]->data(0, Qt::UserRole + 1).toInt() == FolderType) {
return;
}

int noteId = selectedItems[0]->data(0, Qt::UserRole).toInt();
Note note = Note::fetch(noteId);
bool currentNoteChanged = currentNote.getId() != noteId;
setCurrentNote(std::move(note), true, false);
Expand Down

0 comments on commit 0e4a626

Please sign in to comment.