Skip to content

Commit adceaa2

Browse files
committed
#3260 note: apply handleNoteNameHook when new note is created
Signed-off-by: Patrizio Bekerle <[email protected]>
1 parent efcf4de commit adceaa2

File tree

2 files changed

+11
-0
lines changed

2 files changed

+11
-0
lines changed

CHANGELOG.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,8 @@
66
`Note 2025-04-18 11h54s09` to be visually more pleasing and containing no `.`
77
characters (for [#3259](https://github.com/pbek/QOwnNotes/issues/3259))
88
- The text `Note` will now also be translated
9+
- When a new note is created, now [handleNoteNameHook](https://www.qownnotes.org/scripting/hooks.html#handlenewnoteheadlinehook)
10+
is also applied (for [#3260](https://github.com/pbek/QOwnNotes/issues/3260))
911

1012
## 25.4.3
1113

src/mainwindow.cpp

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6039,6 +6039,15 @@ void MainWindow::jumpToNoteOrCreateNew(bool disableLoadNoteDirectoryList) {
60396039
: tr("Current note could not be stored to disk"),
60406040
noteWasStored ? QStringLiteral("💾") : QStringLiteral(""), 3000);
60416041

6042+
// Check if a name was set in a script
6043+
// We need to do that in the end or the changed name will leak into the note filename
6044+
const QString hookName = ScriptingService::instance()->callHandleNoteNameHook(&note);
6045+
6046+
if (!hookName.isEmpty()) {
6047+
note.setName(hookName);
6048+
note.store();
6049+
}
6050+
60426051
{
60436052
const QSignalBlocker blocker2(ui->noteTreeWidget);
60446053
Q_UNUSED(blocker2)

0 commit comments

Comments
 (0)