File indexing completed on 2024-04-28 17:06:05

0001 /*
0002     SPDX-FileCopyrightText: 2005 Csaba Karai <cskarai@freemail.hu>
0003     SPDX-FileCopyrightText: 2005-2022 Krusader Krew <https://krusader.org>
0004 
0005     Based on KrRemoteEncodingMenu (© Csaba Karai and Krusader Krew)
0006     from Krusader and DolphinRecentTabsMenu (© Emmanuel Pescosta)
0007     from Dolphin.
0008 
0009     SPDX-License-Identifier: GPL-2.0-or-later
0010 */
0011 
0012 #ifndef RECENTLYCLOSEDTABSMENU_H
0013 #define RECENTLYCLOSEDTABSMENU_H
0014 
0015 #include <KWidgetsAddons/KActionMenu>
0016 
0017 class KActionCollection;
0018 class TabActions;
0019 
0020 /**
0021  * A menu to perform operations with a list of recently closed tabs
0022  */
0023 class RecentlyClosedTabsMenu : public KActionMenu
0024 {
0025     Q_OBJECT
0026     friend class PanelManager;
0027 
0028 public:
0029     explicit RecentlyClosedTabsMenu(const QString &text, const QString &iconName, KActionCollection *parent = nullptr);
0030 
0031 protected slots:
0032     void slotTriggered(QAction *action);
0033 
0034 private:
0035     QAction *updateAfterClosingATab(const QUrl &urlClosedTab, const QByteArray &backedUpData, TabActions *argTabActions);
0036     QAction *actClearTheList;
0037     TabActions *tabActions = nullptr;
0038 
0039     //! Krusader saves information about closed tabs until its quantity reaches that limit
0040     const int maxClosedTabs = 6;
0041 
0042     //! The quantity of fixed menu entries (the "Empty Recently Closed Tabs" one and a separator)
0043     const int quantFixedMenuEntries = 2;
0044 };
0045 
0046 #endif // RECENTLYCLOSEDTABSMENU_H