1/*
2 SPDX-FileCopyrightText: 2006 Aaron J. Seigo <aseigo@kde.org>
3 SPDX-FileCopyrightText: 2009 Peter Penz <peter.penz@kde.org>
4
5 SPDX-License-Identifier: LGPL-2.0-or-later
6*/
7
8#ifndef KURLNAVIGATORSCHEMECOMBO_P_H
9#define KURLNAVIGATORSCHEMECOMBO_P_H
10
11#include "kurlnavigatorbuttonbase_p.h"
12
13#include <QHash>
14
15class QMenu;
16
17namespace KDEPrivate
18{
19/**
20 * @brief A combobox listing available schemes.
21 *
22 * The widget is used by the URL navigator for offering the available
23 * schemes for non-local URLs.
24 *
25 * @see KUrlNavigator
26 */
27class KUrlNavigatorSchemeCombo : public KUrlNavigatorButtonBase
28{
29 Q_OBJECT
30
31public:
32 explicit KUrlNavigatorSchemeCombo(const QString &scheme, KUrlNavigator *parent = nullptr);
33
34 QString currentScheme() const;
35
36 void setSupportedSchemes(const QStringList &schemes);
37
38 QSize sizeHint() const override;
39
40public Q_SLOTS:
41 void setScheme(const QString &scheme);
42
43Q_SIGNALS:
44 void activated(const QString &scheme);
45
46protected:
47 void showEvent(QShowEvent *event) override;
48 void paintEvent(QPaintEvent *event) override;
49
50private Q_SLOTS:
51 void setSchemeFromMenu(QAction *action);
52
53private:
54 void updateMenu();
55 void initializeCategories();
56
57 enum SchemeCategory {
58 CoreCategory,
59 PlacesCategory,
60 DevicesCategory,
61 SubversionCategory,
62 OtherCategory,
63 CategoryCount, // mandatory last entry
64 };
65
66 QMenu *m_menu;
67 QStringList m_schemes;
68 QHash<QString, SchemeCategory> m_categories;
69};
70
71} // namespace KDEPrivate
72
73#endif
74

source code of kio/src/filewidgets/kurlnavigatorschemecombo_p.h