@@ -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);
@@ -623,3 +625,20 @@ QString KiwixApp::getPrevSaveDir() const
623625 QDir dir (prevSaveDir);
624626 return dir.exists () ? prevSaveDir : DEFAULT_SAVE_DIR ;
625627}
628+
629+ void KiwixApp::pushClosedTab (const QString& url, const QString& title) {
630+ if (url.isEmpty () || title.isEmpty ())
631+ return ;
632+ m_closedTabs.push ({url, title});
633+ mpa_actions[ReopenClosedTabAction]->setEnabled (true );
634+ }
635+
636+ void KiwixApp::reopenLastClosedTab () {
637+ if (m_closedTabs.isEmpty ())
638+ return ;
639+
640+ auto tab = m_closedTabs.pop ();
641+ openUrl (tab.url , true );
642+ if (m_closedTabs.isEmpty ())
643+ mpa_actions[ReopenClosedTabAction]->setEnabled (false );
644+ }
0 commit comments