1 | /*************************************************************************** |
2 | * Copyright (C) 2006 by Aaron J. Seigo (<aseigo@kde.org>) * |
3 | * Copyright (C) 2009 by Peter Penz (<peter.penz@kde.org>) * |
4 | * * |
5 | * This library is free software; you can redistribute it and/or * |
6 | * modify it under the terms of the GNU Lesser General Public * |
7 | * License as published by the Free Software Foundation; either * |
8 | * version 2 of the License, or (at your option) any later version. * |
9 | * * |
10 | * This library is distributed in the hope that it will be useful, * |
11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of * |
12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * |
13 | * Lesser General Public License for more details. * |
14 | * * |
15 | * You should have received a copy of the GNU Lesser General Public * |
16 | * License along with this library; if not, write to the * |
17 | * Free Software Foundation, Inc., * |
18 | * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA * |
19 | ***************************************************************************/ |
20 | |
21 | #ifndef KURLNAVIGATORPROTOCOLCOMBO_P_H |
22 | #define KURLNAVIGATORPROTOCOLCOMBO_P_H |
23 | |
24 | #include "kurlnavigatorbuttonbase_p.h" |
25 | |
26 | #include <QtCore/QHash> |
27 | |
28 | class ; |
29 | |
30 | namespace KDEPrivate |
31 | { |
32 | |
33 | /** |
34 | * @brief A combobox listing available protocols. |
35 | * |
36 | * The widget is used by the URL navigator for offering the available |
37 | * protocols for non-local URLs. |
38 | * |
39 | * @see KUrlNavigator |
40 | */ |
41 | class KUrlNavigatorProtocolCombo : public KUrlNavigatorButtonBase |
42 | { |
43 | Q_OBJECT |
44 | |
45 | public: |
46 | explicit KUrlNavigatorProtocolCombo(const QString& protocol, QWidget* parent = 0); |
47 | |
48 | QString currentProtocol() const; |
49 | |
50 | void setCustomProtocols(const QStringList &protocols); |
51 | |
52 | virtual QSize sizeHint() const; |
53 | |
54 | public Q_SLOTS: |
55 | void setProtocol(const QString& protocol); |
56 | |
57 | Q_SIGNALS: |
58 | void activated(const QString& protocol); |
59 | |
60 | protected: |
61 | virtual void showEvent(QShowEvent* event); |
62 | virtual void paintEvent(QPaintEvent* event); |
63 | |
64 | private Q_SLOTS: |
65 | void setProtocol(QAction* action); |
66 | |
67 | private: |
68 | void (); |
69 | void initializeCategories(); |
70 | |
71 | enum ProtocolCategory |
72 | { |
73 | CoreCategory, |
74 | PlacesCategory, |
75 | DevicesCategory, |
76 | SubversionCategory, |
77 | OtherCategory, |
78 | CategoryCount // mandatory last entry |
79 | }; |
80 | |
81 | QMenu* ; |
82 | QStringList m_protocols; |
83 | QHash<QString, ProtocolCategory> m_categories; |
84 | }; |
85 | |
86 | } // namespace KDEPrivate |
87 | |
88 | #endif |
89 | |