1
res/doc
1
res/doc
@@ -18,6 +18,7 @@
|
||||
# main - the menu in the top-left corner of the home screen
|
||||
# reader - the overflow menu in the reader
|
||||
# browser - the menu in the bottom-right of the web browser
|
||||
# library - the menu in the filter bar for the "My Books" and "My Articles" library views
|
||||
# <label> the label to show on the menu item (must not contain :)
|
||||
# <action> the type of action to run, one of:
|
||||
# cmd_spawn - starts a command in the background
|
||||
|
||||
@@ -305,7 +305,7 @@ nm_config_t *nm_config_parse(nm_config_file_t *files) {
|
||||
}))) RETERR("error appending default action to empty config: %s", nm_config_parse__strerror(ret));
|
||||
}
|
||||
|
||||
size_t mm = 0, rm = 0, bm = 0;
|
||||
size_t mm = 0, rm = 0, bm = 0, lm = 0;
|
||||
for (nm_config_t *cur = state.cfg_s; cur; cur = cur->next) {
|
||||
switch (cur->type) {
|
||||
case NM_CONFIG_TYPE_MENU_ITEM:
|
||||
@@ -316,6 +316,7 @@ nm_config_t *nm_config_parse(nm_config_file_t *files) {
|
||||
case NM_MENU_LOCATION_MAIN_MENU: mm++; break;
|
||||
case NM_MENU_LOCATION_READER_MENU: rm++; break;
|
||||
case NM_MENU_LOCATION_BROWSER_MENU: bm++; break;
|
||||
case NM_MENU_LOCATION_LIBRARY_MENU: lm++; break;
|
||||
}
|
||||
break;
|
||||
case NM_CONFIG_TYPE_GENERATOR:
|
||||
@@ -330,6 +331,8 @@ nm_config_t *nm_config_parse(nm_config_file_t *files) {
|
||||
RETERR("too many menu items in reader menu (> %d)", NM_CONFIG_MAX_MENU_ITEMS_PER_MENU);
|
||||
if (bm > NM_CONFIG_MAX_MENU_ITEMS_PER_MENU)
|
||||
RETERR("too many menu items in browser menu (> %d)", NM_CONFIG_MAX_MENU_ITEMS_PER_MENU);
|
||||
if (lm > NM_CONFIG_MAX_MENU_ITEMS_PER_MENU)
|
||||
RETERR("too many menu items in library menu (> %d)", NM_CONFIG_MAX_MENU_ITEMS_PER_MENU);
|
||||
|
||||
return state.cfg_s;
|
||||
}
|
||||
@@ -347,6 +350,7 @@ static bool nm_config_parse__line_item(const char *type, char **line, nm_menu_it
|
||||
else if (!strcmp(s_loc, "main")) it_out->loc = NM_MENU_LOCATION_MAIN_MENU;
|
||||
else if (!strcmp(s_loc, "reader")) it_out->loc = NM_MENU_LOCATION_READER_MENU;
|
||||
else if (!strcmp(s_loc, "browser")) it_out->loc = NM_MENU_LOCATION_BROWSER_MENU;
|
||||
else if (!strcmp(s_loc, "library")) it_out->loc = NM_MENU_LOCATION_LIBRARY_MENU;
|
||||
else NM_ERR_RET(NULL, "field 2: unknown location '%s'", s_loc);
|
||||
|
||||
char *p_lbl = strtrim(strsep(line, ":"));
|
||||
|
||||
@@ -13,6 +13,7 @@ typedef enum {
|
||||
NM_MENU_LOCATION_MAIN_MENU = 1,
|
||||
NM_MENU_LOCATION_READER_MENU = 2,
|
||||
NM_MENU_LOCATION_BROWSER_MENU = 3,
|
||||
NM_MENU_LOCATION_LIBRARY_MENU = 4,
|
||||
} nm_menu_location_t;
|
||||
|
||||
typedef struct nm_menu_action_t {
|
||||
|
||||
@@ -142,7 +142,8 @@ extern "C" __attribute__((visibility("default"))) MenuTextItem* _nm_menu_hook(vo
|
||||
QString trmm = QCoreApplication::translate("StatusBarMenuController", "Settings");
|
||||
QString trrm = QCoreApplication::translate("DictionaryActionProxy", "Dictionary");
|
||||
QString trbm = QCoreApplication::translate("N3BrowserSettingsMenuController", "Keyboard");
|
||||
NM_LOG("Comparing against '%s', '%s', '%s'", qPrintable(trmm), qPrintable(trrm), qPrintable(trbm));
|
||||
QString trlm = QCoreApplication::translate("LibraryViewMenuController", "Manage downloads");
|
||||
NM_LOG("Comparing against '%s', '%s', '%s', '%s'", qPrintable(trmm), qPrintable(trrm), qPrintable(trbm), qPrintable(trlm));
|
||||
|
||||
nm_menu_location_t loc = {};
|
||||
if (label == trmm && !checkable) {
|
||||
@@ -154,6 +155,9 @@ extern "C" __attribute__((visibility("default"))) MenuTextItem* _nm_menu_hook(vo
|
||||
} else if (label == trbm && !checkable) {
|
||||
NM_LOG("Intercepting browser menu (label=Keyboard, checkable=false)...");
|
||||
loc = NM_MENU_LOCATION_BROWSER_MENU;
|
||||
} else if (label == trlm && !checkable) {
|
||||
NM_LOG("Intercepting library menu (label=Manage downloads, checkable=false)..."); // this is actually two menus: in "My Books", and in "My Articles"
|
||||
loc = NM_MENU_LOCATION_LIBRARY_MENU;
|
||||
}
|
||||
|
||||
if (loc)
|
||||
|
||||
Reference in New Issue
Block a user