]>
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;
75 * Is send when a bookmark has been activated by the user.
76 * @param index Index of the selected bookmark.
78 void bookmarkActivated(int index
);
82 * Draws the icon of the selected URL as content of the URL
85 virtual void drawButton(QPainter
* painter
);
89 * Updates the selected index and the icon if a bookmark
90 * has been activated by the user.
92 void slotBookmarkActivated(int index
);
96 Q3PopupMenu
* m_bookmarksMenu
;