1 | /* This file is part of the KDE project |
2 | Copyright (C) 1998, 1999 Torben Weis <weis@kde.org> |
3 | Copyright (C) 2006 Daniel Teske <teske@squorn.de> |
4 | |
5 | This library is free software; you can redistribute it and/or |
6 | modify it under the terms of the GNU Library 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 | Library General Public License for more details. |
14 | |
15 | You should have received a copy of the GNU Library General Public License |
16 | along with this library; see the file COPYING.LIB. If not, write to |
17 | the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, |
18 | Boston, MA 02110-1301, USA. |
19 | */ |
20 | |
21 | #ifndef __konqbookmarkmenu_h__ |
22 | #define __konqbookmarkmenu_h__ |
23 | #include "kbookmarkmenu.h" |
24 | |
25 | class KIO_EXPORT KonqBookmarkOwner : public KBookmarkOwner // KDE5 TODO: merge with KBookmarkOwner |
26 | { |
27 | public: |
28 | virtual ~KonqBookmarkOwner(); |
29 | virtual void openInNewTab(const KBookmark &bm) = 0; |
30 | virtual void openInNewWindow(const KBookmark &bm) = 0; |
31 | }; |
32 | |
33 | class KIO_EXPORT : public KBookmarkMenu |
34 | { |
35 | //friend class KBookmarkBar; |
36 | Q_OBJECT |
37 | public: |
38 | /** |
39 | * Fills a bookmark menu with konquerors bookmarks |
40 | * (one instance of KonqBookmarkMenu is created for the toplevel menu, |
41 | * but also one per submenu). |
42 | * |
43 | * @param mgr The bookmark manager to use (i.e. for reading and writing) |
44 | * @param owner implementation of the KonqBookmarkOwner callback interface. |
45 | * Note: If you pass a null KonqBookmarkOwner to the constructor, the |
46 | * URLs are openend by KRun and "Add Bookmark" is disabled. |
47 | * @param parentMenu menu to be filled |
48 | * @param collec parent collection for the KActions. |
49 | */ |
50 | ( KBookmarkManager* mgr, KonqBookmarkOwner * owner, KBookmarkActionMenu * , KActionCollection *collec) |
51 | : KBookmarkMenu( mgr, owner, parentMenu->menu(), collec) |
52 | { |
53 | } |
54 | () |
55 | {} |
56 | |
57 | /** |
58 | * Creates a bookmark submenu. |
59 | * Only used internally and for bookmark toolbar. |
60 | */ |
61 | ( KBookmarkManager* mgr, KonqBookmarkOwner * owner, KBookmarkActionMenu * , QString parentAddress) |
62 | : KBookmarkMenu( mgr, owner, parentMenu->menu(), parentAddress) |
63 | { |
64 | } |
65 | |
66 | protected: |
67 | /** |
68 | * Structure used for storing information about |
69 | * the dynamic menu setting |
70 | */ |
71 | struct { |
72 | bool ; |
73 | QString ; |
74 | QString ; |
75 | QString ; |
76 | class *; |
77 | }; |
78 | |
79 | /** |
80 | * @return dynmenu info block for the given dynmenu name |
81 | */ |
82 | static DynMenuInfo ( const QString &id ); |
83 | |
84 | /** |
85 | * Shows an extra menu for the given bookmarks file and type. |
86 | * Upgrades from option inside XBEL to option in rc file |
87 | * on first call of this function. |
88 | * @param id the unique identification for the dynamic menu |
89 | * @param info a DynMenuInfo struct containing the to be added/modified data |
90 | */ |
91 | static void ( const QString &id, const DynMenuInfo &info ); |
92 | |
93 | /** |
94 | * @return list of dynamic menu ids |
95 | */ |
96 | static QStringList (); |
97 | |
98 | virtual void (); |
99 | virtual QAction* (const KBookmark &bm); |
100 | virtual KMenu * (QAction * act); |
101 | void (); |
102 | private: |
103 | KonqBookmarkOwner * () |
104 | { return static_cast<KonqBookmarkOwner *>(KBookmarkMenu::owner());} |
105 | }; |
106 | |
107 | class KIO_EXPORT : public KBookmarkContextMenu |
108 | { |
109 | Q_OBJECT |
110 | public: |
111 | (const KBookmark & bm, KBookmarkManager * mgr, KonqBookmarkOwner * owner ); |
112 | virtual (); |
113 | virtual void (); |
114 | |
115 | public Q_SLOTS: |
116 | void (); |
117 | void (); |
118 | void (); |
119 | private: |
120 | KonqBookmarkOwner * () |
121 | { return static_cast<KonqBookmarkOwner *>(KBookmarkContextMenu::owner());} |
122 | }; |
123 | #endif |
124 | |
125 | |