From 68be52a8ca5d450bba4a63ed40e250e1563167fb Mon Sep 17 00:00:00 2001 From: Simon Danner Date: Thu, 29 Sep 2022 18:49:53 +0200 Subject: [PATCH] Make it possible to add to selection menu in parental mode --- src/nickelmenu.cc | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/src/nickelmenu.cc b/src/nickelmenu.cc index bf08554..7eb9f5e 100644 --- a/src/nickelmenu.cc +++ b/src/nickelmenu.cc @@ -86,6 +86,7 @@ typedef void SelectionMenuController; // note: items are re-initialized every ti typedef QWidget SelectionMenuView; typedef void WebSearchMixinBase; void (*SelectionMenuController_lookupWikipedia)(SelectionMenuController*); +void (*SelectionMenuController_onSearchInBook) (SelectionMenuController*); void (*SelectionMenuController_lookupWeb)(SelectionMenuController*); // 14622-18838 void (*SelectionMenuController_lookupGoogle)(SelectionMenuController*); // 19086+ (replaces lookupWeb, alternative 1) void (*SelectionMenuController_lookupBaidu)(SelectionMenuController*); // 19086+ (replaces lookupWeb, alternative 2) @@ -148,6 +149,9 @@ static struct nh_dlsym NickelMenuDlsym[] = { {.name = "_ZN23SelectionMenuController12lookupGoogleEv", .out = nh_symoutptr(SelectionMenuController_lookupGoogle), .desc = "selection menu injection (19086+, alt 1)", .optional = true}, //libnickel 4.31.19086 * _ZN23SelectionMenuController12lookupGoogleEv {.name = "_ZN23SelectionMenuController11lookupBaiduEv", .out = nh_symoutptr(SelectionMenuController_lookupBaidu), .desc = "selection menu injection (19086+, alt 2)", .optional = true}, //libnickel 4.31.19086 * _ZN23SelectionMenuController11lookupBaiduEv + // selection menu injection parental mode + {.name = "_ZN23SelectionMenuController14onSearchInBookEv", .out = nh_symoutptr(SelectionMenuController_onSearchInBook), .desc = "selection menu injection parental mode", .optional = true}, + // null {0}, }; @@ -425,7 +429,7 @@ extern "C" __attribute__((visibility("default"))) void _nm_menu_hook3(SelectionM NM_LOG("hook3: %p %p %p %s", _this, smv, mti, slot); SelectionMenuController_addMenuItem(_this, smv, mti, slot); - if (!SelectionMenuView_addMenuItem || !SelectionMenuController_lookupWikipedia || !(SelectionMenuController_lookupWeb || (SelectionMenuController_lookupGoogle && SelectionMenuController_lookupBaidu))) { + if (!SelectionMenuView_addMenuItem || !SelectionMenuController_onSearchInBook || !SelectionMenuController_lookupWikipedia || !(SelectionMenuController_lookupWeb || (SelectionMenuController_lookupGoogle && SelectionMenuController_lookupBaidu))) { NM_LOG("could not find required SelectionMenuView and SelectionMenuController symbols for adding selection menu items"); ConfirmationDialogFactory_showOKDialog(QLatin1String("NickelMenu"), QLatin1String("Could not find required SelectionMenuView and SelectionMenuController symbols for adding selection menu items (this is a bug).")); return; @@ -435,6 +439,8 @@ extern "C" __attribute__((visibility("default"))) void _nm_menu_hook3(SelectionM nm_menu_location_t loc; if (!strcmp(slot, "1showSearchOptions()")) //libnickel 4.20.14622 * _ZN23SelectionMenuController17showSearchOptionsEv loc = NM_MENU_LOCATION(selection); + else if (!strcmp(slot, "1onSearchInBook()")) + loc = NM_MENU_LOCATION(selection); else if (!strcmp(slot, "2lookupWeb()")) //libnickel 4.20.14622 4.30.18838 _ZN23SelectionMenuController9lookupWebEv loc = NM_MENU_LOCATION(selection_search); else if (!strcmp(slot, "2lookupGoogle()")) //libnickel 4.31.19086 * _ZN23SelectionMenuController12lookupGoogleEv