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 * 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 * \internal
26 *
27 * \sa KUrlNavigator
28 */
29class KUrlNavigatorSchemeCombo : public KUrlNavigatorButtonBase
30{
31 Q_OBJECT
32
33public:
34 explicit KUrlNavigatorSchemeCombo(const QString &scheme, KUrlNavigator *parent = nullptr);
35
36 QString currentScheme() const;
37
38 void setSupportedSchemes(const QStringList &schemes);
39
40 QSize sizeHint() const override;
41
42public Q_SLOTS:
43 void setScheme(const QString &scheme);
44
45Q_SIGNALS:
46 void activated(const QString &scheme);
47
48protected:
49 void showEvent(QShowEvent *event) override;
50 void paintEvent(QPaintEvent *event) override;
51
52private Q_SLOTS:
53 void setSchemeFromMenu(QAction *action);
54
55private:
56 void updateMenu();
57 void initializeCategories();
58
59 enum SchemeCategory {
60 CoreCategory,
61 PlacesCategory,
62 DevicesCategory,
63 SubversionCategory,
64 OtherCategory,
65 CategoryCount, // mandatory last entry
66 };
67
68 QMenu *m_menu;
69 QStringList m_schemes;
70 QHash<QString, SchemeCategory> m_categories;
71};
72
73} // namespace KDEPrivate
74
75#endif
76

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