]>
cloud.milkyroute.net Git - dolphin.git/blob - src/bookmarkselector.h
1 /***************************************************************************
2 * Copyright (C) 2006 by Peter Penz (peter.penz@gmx.at) *
4 * This program is free software; you can redistribute it and/or modify *
5 * it under the terms of the GNU General Public License as published by *
6 * the Free Software Foundation; either version 2 of the License, or *
7 * (at your option) any later version. *
9 * This program is distributed in the hope that it will be useful, *
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of *
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
12 * GNU General Public License for more details. *
14 * You should have received a copy of the GNU General Public License *
15 * along with this program; if not, write to the *
16 * Free Software Foundation, Inc., *
17 * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA *
18 ***************************************************************************/
20 #ifndef BOOKMARKSELECTOR_H
21 #define BOOKMARKSELECTOR_H
23 #include <kbookmark.h>
24 #include <urlbutton.h>
31 * @brief Allows to select a bookmark from a popup menu.
33 * The icon from the current selected bookmark is shown
34 * inside the bookmark selector.
38 class BookmarkSelector
: public UrlButton
44 * @param parent Parent widget where the bookmark selector
47 BookmarkSelector(UrlNavigator
* parent
);
49 virtual ~BookmarkSelector();
52 * Updates the selection dependent from the given Url \a url. The
53 * Url must not match exactly to one of the available bookmarks:
54 * The bookmark which is equal to the Url or at least is a parent Url
55 * is selected. If there are more than one possible parent Url candidates,
56 * the bookmark which covers the bigger range of the Url is selected.
58 void updateSelection(const KUrl
& url
);
61 * Returns the index of the selected bookmark. To get
62 * the bookmark, use BookmarkSelector::selectedBookmark().
64 int selectedIndex() const { return m_selectedIndex
; }
66 /** Returns the selected bookmark. */
67 KBookmark
selectedBookmark() const;
69 /** @see QWidget::sizeHint() */
70 virtual QSize
sizeHint() const;
74 * Is send when a bookmark has been activated by the user.
75 * @param url URL of the selected bookmark.
77 void bookmarkActivated(const KUrl
& url
);
81 * Draws the icon of the selected Url as content of the Url
84 virtual void paintEvent(QPaintEvent
* event
);
88 * Updates the selected index and the icon to the bookmark
89 * which is indicated by the triggered action \a action.
91 void activateBookmark(QAction
* action
);
95 UrlNavigator
* m_urlNavigator
;
96 KMenu
* m_bookmarksMenu
;