@@ -420,7 +420,9 @@ void KiwixApp::createActions()
420420 CREATE_ACTION_SHORTCUTS (CloseCurrentTabAction, gt (" close-tab" ), QList<QKeySequence>({QKeySequence (Qt::CTRL | Qt::Key_F4), QKeySequence (Qt::CTRL | Qt::Key_W)}));
421421
422422 CREATE_ACTION_SHORTCUT (ReopenClosedTabAction, gt (" reopen-closed-tab" ), QKeySequence (Qt::CTRL | Qt::SHIFT | Qt::Key_T));
423- HIDE_ACTION (ReopenClosedTabAction);
423+ mpa_actions[ReopenClosedTabAction]->setEnabled (false );
424+ connect (mpa_actions[ReopenClosedTabAction], &QAction::triggered,
425+ this , &KiwixApp::reopenLastClosedTab);
424426
425427 CREATE_ACTION_SHORTCUT (BrowseLibraryAction, gt (" browse-library" ), QKeySequence (Qt::CTRL | Qt::Key_E));
426428 HIDE_ACTION (BrowseLibraryAction);
@@ -620,3 +622,20 @@ QString KiwixApp::getPrevSaveDir() const
620622 QDir dir (prevSaveDir);
621623 return dir.exists () ? prevSaveDir : DEFAULT_SAVE_DIR;
622624}
625+
626+ void KiwixApp::pushClosedTab (const QString& url, const QString& title) {
627+ if (url.isEmpty () || title.isEmpty ())
628+ return ;
629+ m_closedTabs.push ({url, title});
630+ mpa_actions[ReopenClosedTabAction]->setEnabled (true );
631+ }
632+
633+ void KiwixApp::reopenLastClosedTab () {
634+ if (m_closedTabs.isEmpty ())
635+ return ;
636+
637+ auto tab = m_closedTabs.pop ();
638+ openUrl (tab.url , true );
639+ if (m_closedTabs.isEmpty ())
640+ mpa_actions[ReopenClosedTabAction]->setEnabled (false );
641+ }
0 commit comments