From 0e4a626b8235ffa7659ad34e7bc6e6dd8312a917 Mon Sep 17 00:00:00 2001 From: Patrizio Bekerle Date: Sat, 14 Sep 2024 07:22:35 +0200 Subject: [PATCH] #3072 fix: note selection when selecting subfolder in note tree mode Signed-off-by: Patrizio Bekerle --- CHANGELOG.md | 5 +++++ src/mainwindow.cpp | 10 ++++++++-- 2 files changed, 13 insertions(+), 2 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index e82540aa6d..c1cbf2d57b 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -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) diff --git a/src/mainwindow.cpp b/src/mainwindow.cpp index 967188b038..fe1867358f 100644 --- a/src/mainwindow.cpp +++ b/src/mainwindow.cpp @@ -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);