Skip to content

Commit 2a69953

Browse files
committed
#2462 shortcuts: fix build for old Qt5 versions
Signed-off-by: Patrizio Bekerle <patrizio@bekerle.com>
1 parent ccd2abf commit 2a69953

File tree

2 files changed

+17
-0
lines changed

2 files changed

+17
-0
lines changed

CHANGELOG.md

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,12 @@
11
# QOwnNotes Changelog
22

3+
## 26.3.10
4+
5+
- Improved portal handle token generation compatibility for older Qt5
6+
distributions (e.g. Debian 9.0, SLE 15) by using `QUuid` on Qt5 and
7+
keeping `QRandomGenerator` on Qt6 builds
8+
(for [#2462](https://github.com/pbek/QOwnNotes/issues/2462))
9+
310
## 26.3.9
411

512
- Fixed heading order in the Navigation panel's "Headings" tab to keep the

src/services/xdgglobalshortcutmanager.cpp

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,11 @@
2121
#include <QDBusReply>
2222
#include <QDebug>
2323
#include <QGuiApplication>
24+
#if QT_VERSION >= QT_VERSION_CHECK(6, 0, 0)
2425
#include <QRandomGenerator>
26+
#else
27+
#include <QUuid>
28+
#endif
2529

2630
XdgGlobalShortcutManager::XdgGlobalShortcutManager(QObject *parent) : QObject(parent) {
2731
// Register D-Bus metatypes for the a(sa{sv}) shortcut list argument
@@ -399,7 +403,13 @@ QString XdgGlobalShortcutManager::qtKeyToXkbName(int key) {
399403
}
400404

401405
QString XdgGlobalShortcutManager::generateToken() {
406+
#if QT_VERSION >= QT_VERSION_CHECK(6, 0, 0)
402407
return QStringLiteral("qownnotes_%1").arg(QRandomGenerator::global()->generate());
408+
#else
409+
QString token = QUuid::createUuid().toString(QUuid::WithoutBraces);
410+
token.remove(QLatin1Char('-'));
411+
return QStringLiteral("qownnotes_%1").arg(token);
412+
#endif
403413
}
404414

405415
QString XdgGlobalShortcutManager::computeRequestPath(const QString &handleToken) const {

0 commit comments

Comments
 (0)