summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
Diffstat (limited to 'app-text/kjots/files/kjots-5.0.2-kf5bookmarks-5.69.patch')
-rw-r--r--app-text/kjots/files/kjots-5.0.2-kf5bookmarks-5.69.patch67
1 files changed, 67 insertions, 0 deletions
diff --git a/app-text/kjots/files/kjots-5.0.2-kf5bookmarks-5.69.patch b/app-text/kjots/files/kjots-5.0.2-kf5bookmarks-5.69.patch
new file mode 100644
index 000000000000..63bda683122f
--- /dev/null
+++ b/app-text/kjots/files/kjots-5.0.2-kf5bookmarks-5.69.patch
@@ -0,0 +1,67 @@
+From ca6f4b963e83ed91cc7314e1b60fe6607b61b53e Mon Sep 17 00:00:00 2001
+From: Igor Poboiko <igor.poboiko@gmail.com>
+Date: Sun, 12 Apr 2020 17:55:24 +0300
+Subject: [KJots] Fix bookmarks actions
+
+Summary:
+This patch ports KJots from deprecated `KBookmarksMenu` API (see {D25660}).
+
+On my machine, it also fixes a crash (`bm_action` was null for some reason,
+I did not investigate it though).
+
+It also fixes the shortcuts collision (`action->setShortcut` was not enough,
+one also needs to run `actionCollection->setDefaultShortcut`).
+
+BUG: 384000
+
+Test Plan:
+1) Start KJots
+2) It don't crash, and `Ambiguous shortcuts` dialog does not appear)
+3) Open `Bookmarks` menu, the shortcut is `Ctrl+Shift+B`.
+
+Reviewers: dvratil
+
+Reviewed By: dvratil
+
+Subscribers: winterz, kde-pim
+
+Tags: #kde_pim
+
+Differential Revision: https://phabricator.kde.org/D28775
+---
+ src/kjotswidget.cpp | 13 ++++++++-----
+ 1 file changed, 8 insertions(+), 5 deletions(-)
+
+diff --git a/src/kjotswidget.cpp b/src/kjotswidget.cpp
+index 865129b..e343bbd 100644
+--- a/src/kjotswidget.cpp
++++ b/src/kjotswidget.cpp
+@@ -353,17 +353,20 @@ KJotsWidget::KJotsWidget(QWidget *parent, KXMLGUIClient *xmlGuiClient, Qt::Windo
+ bookmarkMenu = actionCollection->add<KActionMenu>(QLatin1String("bookmarks"));
+ bookmarkMenu->setText(i18n("&Bookmarks"));
+ KJotsBookmarks *bookmarks = new KJotsBookmarks(treeview);
+- /*KBookmarkMenu *bmm =*/ new KBookmarkMenu(
++ KBookmarkMenu *bmm = new KBookmarkMenu(
+ KBookmarkManager::managerForFile(
+ QStandardPaths::standardLocations(QStandardPaths::AppDataLocation).first() + QStringLiteral("/kjots/bookmarks.xml"),
+ QStringLiteral("kjots")),
+- bookmarks, bookmarkMenu->menu(), actionCollection);
++ bookmarks, bookmarkMenu->menu());
+
+ // "Add bookmark" and "make text bold" actions have conflicting shortcuts (ctrl + b)
+ // Make add_bookmark use ctrl+shift+b to resolve that.
+- QAction *bm_action = qobject_cast<QAction *>(actionCollection->action(QLatin1String("add_bookmark")));
+- Q_ASSERT(bm_action);
+- bm_action->setShortcut(Qt::CTRL + Qt::SHIFT + Qt::Key_B);
++ QAction *bm_action = bmm->addBookmarkAction();
++ actionCollection->addAction(QStringLiteral("add_bookmark"), bm_action);
++ actionCollection->setDefaultShortcut(bm_action, Qt::CTRL | Qt::SHIFT | Qt::Key_B);
++ actionCollection->addAction(QStringLiteral("edit_bookmark"), bmm->editBookmarksAction());
++ actionCollection->addAction(QStringLiteral("add_bookmarks_list"), bmm->bookmarkTabsAsFolderAction());
++
+
+ KStandardAction::find(this, SLOT(onShowSearch()), actionCollection);
+ action = KStandardAction::findNext(this, SLOT(onRepeatSearch()), actionCollection);
+--
+cgit v1.1
+