]>
cloud.milkyroute.net Git - dolphin.git/blob - src/bookmarkssidebarpage.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 ***************************************************************************/
19 #ifndef _BOOKMARKSSIDEBARPAGE_H_
20 #define _BOOKMARKSSIDEBARPAGE_H_
22 #include <q3listbox.h>
24 #include <QPaintEvent>
27 #include "sidebarpage.h"
30 class BookmarksListBox
;
33 * @brief Sidebar page for accessing bookmarks.
35 * It is possible to add, remove and edit bookmarks
36 * by a context menu. The selection of the bookmark
37 * is automatically adjusted to the Url given by
40 class BookmarksSidebarPage
: public SidebarPage
45 BookmarksSidebarPage(QWidget
* parent
=0);
46 virtual ~BookmarksSidebarPage();
49 void setUrl(const KUrl
& url
);
52 /** Fills the listbox with the bookmarks stored in DolphinSettings. */
53 void updateBookmarks();
56 * Checks whether the left mouse button has been clicked above a bookmark.
57 * If this is the case, the Url for the currently active view is adjusted.
59 void slotMouseButtonClicked(int button
, Q3ListBoxItem
* item
);
61 /** @see QListBox::slotContextMenuRequested */
62 void slotContextMenuRequested(Q3ListBoxItem
* item
, const QPoint
& pos
);
66 * Updates the selection dependent from the given Url \a url. The
67 * Url must not match exactly to one of the available bookmarks:
68 * The bookmark which is equal to the Url or at least is a parent Url
69 * is selected. If there are more than one possible parent Url candidates,
70 * the bookmark which covers the bigger range of the Url is selected.
72 void adjustSelection(const KUrl
& url
);
74 BookmarksListBox
* m_bookmarksList
;
78 * @brief Listbox which contains a list of bookmarks.
80 * Only QListBox::paintEvent() has been overwritten to prevent
81 * that a (not wanted) frameborder is drawn.
83 class BookmarksListBox
: public Q3ListBox
88 BookmarksListBox(QWidget
* parent
);
89 virtual ~BookmarksListBox();
92 /** @see QWidget::paintEvent() */
93 virtual void paintEvent(QPaintEvent
* event
);
97 * @brief Item which can be added to a BookmarksListBox.
99 * Only QListBoxPixmap::height() has been overwritten to get
100 * a spacing between the items.
102 class BookmarkItem
: public Q3ListBoxPixmap
105 BookmarkItem(const QPixmap
& pixmap
, const QString
& text
);
106 virtual ~BookmarkItem();
107 virtual int height(const Q3ListBox
* listBox
) const;
110 #endif // _BOOKMARKSSIDEBARPAGE_H_