]>
cloud.milkyroute.net Git - dolphin.git/blob - src/bookmarkselector.h
1 /***************************************************************************
2 * Copyright (C) 2006 by Peter Penz *
5 * This program is free software; you can redistribute it and/or modify *
6 * it under the terms of the GNU General Public License as published by *
7 * the Free Software Foundation; either version 2 of the License, or *
8 * (at your option) any later version. *
10 * This program 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 *
13 * GNU General Public License for more details. *
15 * You should have received a copy of the GNU General Public License *
16 * along with this program; if not, write to the *
17 * Free Software Foundation, Inc., *
18 * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA *
19 ***************************************************************************/
21 #ifndef BOOKMARKSELECTOR_H
22 #define BOOKMARKSELECTOR_H
24 #include <kbookmark.h>
25 #include <urlbutton.h>
32 * @brief Allows to select a bookmark from a popup menu.
34 * The icon from the current selected bookmark is shown
35 * inside the bookmark selector.
38 * @author Peter Penz <peter.penz@gmx.at>
40 class BookmarkSelector
: public UrlButton
46 * @param parent Parent widget where the bookmark selector
49 BookmarkSelector(UrlNavigator
* parent
);
51 virtual ~BookmarkSelector();
54 * Updates the selection dependent from the given Url \a url. The
55 * Url must not match exactly to one of the available bookmarks:
56 * The bookmark which is equal to the Url or at least is a parent Url
57 * is selected. If there are more than one possible parent Url candidates,
58 * the bookmark which covers the bigger range of the Url is selected.
60 void updateSelection(const KUrl
& url
);
63 * Returns the index of the selected bookmark. To get
64 * the bookmark, use BookmarkSelector::selectedBookmark().
66 int selectedIndex() const { return m_selectedIndex
; }
68 /** Returns the selected bookmark. */
69 KBookmark
selectedBookmark() const;
71 /** @see QWidget::sizeHint() */
72 virtual QSize
sizeHint() const;
76 * Is send when a bookmark has been activated by the user.
77 * @param index Index of the selected bookmark.
79 void bookmarkActivated(int index
);
83 * Draws the icon of the selected Url as content of the Url
86 virtual void paintEvent(QPaintEvent
* event
);
90 * Updates the selected index and the icon if a bookmark
91 * has been activated by the user.
93 void slotBookmarkActivated(int index
);
97 Q3PopupMenu
* m_bookmarksMenu
;