File indexing completed on 2024-09-01 03:46:18
0001 /* 0002 SPDX-FileCopyrightText: 2015 Montel Laurent <montel@kde.org> 0003 0004 SPDX-License-Identifier: LGPL-2.0-or-later 0005 */ 0006 0007 #ifndef KURIFILTERSEARCHPROVIDERACTIONS_H 0008 #define KURIFILTERSEARCHPROVIDERACTIONS_H 0009 0010 #include "kiowidgets_export.h" 0011 #include <QObject> 0012 0013 #include <memory> 0014 0015 class QMenu; 0016 class QAction; 0017 namespace KIO 0018 { 0019 class WebShortcutsMenuManagerPrivate; 0020 /** 0021 * @class KUriFilterSearchProviderActions kurifiltersearchprovideractions.h <KIO/KUriFilterSearchProviderActions> 0022 * 0023 * This class is a manager for web shortcuts 0024 * 0025 * It will provide a list of web shortcuts against a selected text 0026 * 0027 * You can set the selected text with setSelectedText() function 0028 * 0029 * @since 5.16 0030 */ 0031 class KIOWIDGETS_EXPORT KUriFilterSearchProviderActions : public QObject 0032 { 0033 Q_OBJECT 0034 public: 0035 /** 0036 * Constructs a webshorts menu manager. 0037 * 0038 * @param parent The QObject parent. 0039 */ 0040 0041 explicit KUriFilterSearchProviderActions(QObject *parent = nullptr); 0042 ~KUriFilterSearchProviderActions() override; 0043 0044 /** 0045 * @brief return the selected text 0046 */ 0047 QString selectedText() const; 0048 /** 0049 * @brief Set selected text 0050 * @param selectedText the text to search for 0051 */ 0052 void setSelectedText(const QString &selectedText); 0053 0054 /** 0055 * @brief addWebShortcutsToMenu Manage to add web shortcut actions to existing menu. 0056 * @param menu menu to add shortcuts to 0057 */ 0058 void addWebShortcutsToMenu(QMenu *menu); 0059 0060 private Q_SLOTS: 0061 KIOWIDGETS_NO_EXPORT void slotConfigureWebShortcuts(); 0062 KIOWIDGETS_NO_EXPORT void slotHandleWebShortcutAction(QAction *action); 0063 0064 private: 0065 std::unique_ptr<WebShortcutsMenuManagerPrivate> const d; 0066 }; 0067 } 0068 0069 #endif // WEBSHORTCUTSMENUMANAGER_H