File indexing completed on 2024-04-28 17:06:24
0001 /* 0002 SPDX-FileCopyrightText: 2003 Shie Erlich <erlich@users.sourceforge.net> 0003 SPDX-FileCopyrightText: 2003 Rafi Yanai <yanai@users.sourceforge.net> 0004 SPDX-FileCopyrightText: 2004-2022 Krusader Krew <https://krusader.org> 0005 0006 SPDX-License-Identifier: GPL-2.0-or-later 0007 */ 0008 0009 #ifndef PANELCONTEXTMENU_H 0010 #define PANELCONTEXTMENU_H 0011 0012 // QtWidgets 0013 #include <QMenu> 0014 0015 #include <KIOWidgets/KFileItemActions> 0016 #include <KService/KService> 0017 0018 class KrPanel; 0019 0020 /** 0021 * The right-click context menu for files and folders in the panel view. 0022 * 0023 * An instance is created each time a menu is shown. 0024 */ 0025 class PanelContextMenu : public QMenu 0026 { 0027 Q_OBJECT 0028 public: 0029 static PanelContextMenu *run(const QPoint &pos, KrPanel *panel); 0030 0031 private: 0032 explicit PanelContextMenu(KrPanel *thePanel, QWidget *parent = nullptr); 0033 0034 void performAction(int id); 0035 void addEmptyMenuEntries(); // adds the choices for a menu without selected items 0036 void addCreateNewMenu(); // adds a "create new" submenu 0037 void addCompressAndExtractPluginActions(); // adds various plugin actions 0038 0039 enum ID { 0040 OPEN_ID, 0041 BROWSE_ID, 0042 OPEN_TERM_ID, 0043 OPEN_TAB_ID, 0044 PREVIEW_ID, 0045 CHOOSE_ID, 0046 DELETE_ID, 0047 MOUNT_ID, 0048 UNMOUNT_ID, 0049 TRASH_ID, 0050 NEW_LINK_ID, 0051 NEW_SYMLINK_ID, 0052 REDIRECT_LINK_ID, 0053 EMPTY_TRASH_ID, 0054 RESTORE_TRASHED_FILE_ID, 0055 SYNC_SELECTED_ID, 0056 SEND_BY_EMAIL_ID, 0057 EJECT_ID, 0058 SERVICE_LIST_ID // ALWAYS KEEP THIS ONE LAST!!! 0059 }; 0060 0061 private: 0062 KrPanel *const panel; 0063 KFileItemList _items; 0064 KService::List offers; 0065 }; 0066 0067 #endif