File indexing completed on 2024-05-05 03:55:58
0001 /* 0002 SPDX-FileCopyrightText: 2006 Aaron J. Seigo <aseigo@kde.org> 0003 SPDX-FileCopyrightText: 2009 Peter Penz <peter.penz@kde.org> 0004 0005 SPDX-License-Identifier: LGPL-2.0-or-later 0006 */ 0007 0008 #ifndef KURLNAVIGATORSCHEMECOMBO_P_H 0009 #define KURLNAVIGATORSCHEMECOMBO_P_H 0010 0011 #include "kurlnavigatorbuttonbase_p.h" 0012 0013 #include <QHash> 0014 0015 class QMenu; 0016 0017 namespace KDEPrivate 0018 { 0019 /** 0020 * @brief A combobox listing available schemes. 0021 * 0022 * The widget is used by the URL navigator for offering the available 0023 * schemes for non-local URLs. 0024 * 0025 * @see KUrlNavigator 0026 */ 0027 class KUrlNavigatorSchemeCombo : public KUrlNavigatorButtonBase 0028 { 0029 Q_OBJECT 0030 0031 public: 0032 explicit KUrlNavigatorSchemeCombo(const QString &scheme, KUrlNavigator *parent = nullptr); 0033 0034 QString currentScheme() const; 0035 0036 void setSupportedSchemes(const QStringList &schemes); 0037 0038 QSize sizeHint() const override; 0039 0040 public Q_SLOTS: 0041 void setScheme(const QString &scheme); 0042 0043 Q_SIGNALS: 0044 void activated(const QString &scheme); 0045 0046 protected: 0047 void showEvent(QShowEvent *event) override; 0048 void paintEvent(QPaintEvent *event) override; 0049 0050 private Q_SLOTS: 0051 void setSchemeFromMenu(QAction *action); 0052 0053 private: 0054 void updateMenu(); 0055 void initializeCategories(); 0056 0057 enum SchemeCategory { 0058 CoreCategory, 0059 PlacesCategory, 0060 DevicesCategory, 0061 SubversionCategory, 0062 OtherCategory, 0063 CategoryCount, // mandatory last entry 0064 }; 0065 0066 QMenu *m_menu; 0067 QStringList m_schemes; 0068 QHash<QString, SchemeCategory> m_categories; 0069 }; 0070 0071 } // namespace KDEPrivate 0072 0073 #endif