Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Make it possible to add to selection menu in parental mode #131

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 7 additions & 1 deletion src/nickelmenu.cc
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down Expand Up @@ -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}, //libnickel 4.20.14601 * _ZN23SelectionMenuController14onSearchInBookEv

// null
{0},
};
Expand Down Expand Up @@ -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;
Expand All @@ -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()")) //libnickel 4.20.14601 * _ZN23SelectionMenuController14onSearchInBookEv
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
Expand Down