Introduce KiwixApp::OpenMultiZimAction

Shortcut and Icon for MultiZim. Since window is popup, toggle is not possible.
This commit is contained in:
ShaopengLin 2024-10-31 21:39:46 -04:00
parent f5e8f22eac
commit 85bbd91216
6 changed files with 10 additions and 2 deletions

View File

@ -172,5 +172,6 @@
"portable-disabled-tooltip": "Function disabled in portable mode", "portable-disabled-tooltip": "Function disabled in portable mode",
"scroll-next-tab": "Scroll to next tab", "scroll-next-tab": "Scroll to next tab",
"scroll-previous-tab": "Scroll to previous tab", "scroll-previous-tab": "Scroll to previous tab",
"kiwix-search": "Kiwix search" "kiwix-search": "Kiwix search",
"search-options": "Search Options"
} }

View File

@ -180,5 +180,6 @@
"portable-disabled-tooltip": "Tooltip used to explain disabled components in the portable version.", "portable-disabled-tooltip": "Tooltip used to explain disabled components in the portable version.",
"scroll-next-tab": "Represents the action of scrolling to the next tab of the current tab which toward the end of the tab bar.", "scroll-next-tab": "Represents the action of scrolling to the next tab of the current tab which toward the end of the tab bar.",
"scroll-previous-tab": "Represents the action of scrolling to the previous tab of the current tab which toward the start of the tab bar.", "scroll-previous-tab": "Represents the action of scrolling to the previous tab of the current tab which toward the start of the tab bar.",
"kiwix-search": "Title text for a list of search results, which notes to the user those are from Kiwix's Search Engine" "kiwix-search": "Title text for a list of search results, which notes to the user those are from Kiwix's Search Engine",
"search-options": "The term for a collection of additional search filtering options to help users narrow down search results."
} }

View File

@ -438,6 +438,8 @@ void KiwixApp::createActions()
CREATE_ACTION_SHORTCUT(ToggleTOCAction, gt("table-of-content"), QKeySequence(Qt::CTRL | Qt::SHIFT | Qt::Key_1)); CREATE_ACTION_SHORTCUT(ToggleTOCAction, gt("table-of-content"), QKeySequence(Qt::CTRL | Qt::SHIFT | Qt::Key_1));
HIDE_ACTION(ToggleTOCAction); HIDE_ACTION(ToggleTOCAction);
CREATE_ACTION_ICON_SHORTCUT(OpenMultiZimAction, "filter", gt("search-options"), QKeySequence(Qt::CTRL | Qt::Key_M));
CREATE_ACTION_ONOFF_ICON_SHORTCUT(ToggleReadingListAction, "reading-list-active", "reading-list", gt("reading-list"), QKeySequence(Qt::CTRL | Qt::Key_B)); CREATE_ACTION_ONOFF_ICON_SHORTCUT(ToggleReadingListAction, "reading-list-active", "reading-list", gt("reading-list"), QKeySequence(Qt::CTRL | Qt::Key_B));
CREATE_ACTION(ExportReadingListAction, gt("export-reading-list")); CREATE_ACTION(ExportReadingListAction, gt("export-reading-list"));

View File

@ -39,6 +39,7 @@ public:
BrowseLibraryAction, BrowseLibraryAction,
OpenFileAction, OpenFileAction,
OpenRecentAction, OpenRecentAction,
OpenMultiZimAction,
SavePageAsAction, SavePageAsAction,
SearchArticleAction, SearchArticleAction,
SearchLibraryAction, SearchLibraryAction,

View File

@ -35,6 +35,7 @@ MainMenu::MainMenu(QWidget *parent) :
m_editMenu.ADD_ACTION(SearchLibraryAction); m_editMenu.ADD_ACTION(SearchLibraryAction);
m_editMenu.ADD_ACTION(FindInPageAction); m_editMenu.ADD_ACTION(FindInPageAction);
m_editMenu.ADD_ACTION(ToggleAddBookmarkAction); m_editMenu.ADD_ACTION(ToggleAddBookmarkAction);
m_editMenu.ADD_ACTION(OpenMultiZimAction);
addMenu(&m_editMenu); addMenu(&m_editMenu);
m_viewMenu.setTitle(gt("view")); m_viewMenu.setTitle(gt("view"));

View File

@ -13,6 +13,8 @@ MultiZimButton::MultiZimButton(QWidget *parent) :
{ {
setMenu(new QMenu(this)); setMenu(new QMenu(this));
setPopupMode(QToolButton::InstantPopup); setPopupMode(QToolButton::InstantPopup);
setDefaultAction(KiwixApp::instance()->getAction(KiwixApp::OpenMultiZimAction));
connect(this, &QToolButton::triggered, this, &MultiZimButton::showMenu);
const auto popupAction = new QWidgetAction(menu()); const auto popupAction = new QWidgetAction(menu());
popupAction->setDefaultWidget(mp_buttonList); popupAction->setDefaultWidget(mp_buttonList);