]>
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 * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. *
19 ***************************************************************************/
21 #ifndef BOOKMARKSELECTOR_H
22 #define BOOKMARKSELECTOR_H
24 #include <kbookmark.h>
25 #include <urlbutton.h>
27 #include <Q3PopupMenu>
34 * @brief Allows to select a bookmark from a popup menu.
36 * The icon from the current selected bookmark is shown
37 * inside the bookmark selector.
40 * @author Peter Penz <peter.penz@gmx.at>
42 class BookmarkSelector
: public UrlButton
48 * @param parent Parent widget where the bookmark selector
51 BookmarkSelector(UrlNavigator
* parent
);
53 virtual ~BookmarkSelector();
56 * Updates the selection dependent from the given Url \a url. The
57 * Url must not match exactly to one of the available bookmarks:
58 * The bookmark which is equal to the Url or at least is a parent Url
59 * is selected. If there are more than one possible parent Url candidates,
60 * the bookmark which covers the bigger range of the Url is selected.
62 void updateSelection(const KUrl
& url
);
65 * Returns the index of the selected bookmark. To get
66 * the bookmark, use BookmarkSelector::selectedBookmark().
68 int selectedIndex() const { return m_selectedIndex
; }
70 /** Returns the selected bookmark. */
71 KBookmark
selectedBookmark() const;
73 /** @see QWidget::sizeHint() */
74 virtual QSize
sizeHint() const;
78 * Is send when a bookmark has been activated by the user.
79 * @param index Index of the selected bookmark.
81 void bookmarkActivated(int index
);
85 * Draws the icon of the selected Url as content of the Url
88 virtual void paintEvent(QPaintEvent
* event
);
92 * Updates the selected index and the icon if a bookmark
93 * has been activated by the user.
95 void slotBookmarkActivated(int index
);
99 Q3PopupMenu
* m_bookmarksMenu
;