]> cloud.milkyroute.net Git - dolphin.git/blob - src/bookmarkssettingspage.h
becf67654e426525d74ca5d48aa9996c3770d0c9
[dolphin.git] / src / bookmarkssettingspage.h
1 /***************************************************************************
2 * Copyright (C) 2006 by Peter Penz *
3 * peter.penz@gmx.at *
4 * *
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. *
9 * *
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. *
14 * *
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 ***************************************************************************/
20
21 #ifndef BOOKMARKSSETTINGSPAGE_H
22 #define BOOKMARKSSETTINGSPAGE_H
23
24 #include <settingspagebase.h>
25 #include <q3valuelist.h>
26
27 class DolphinMainWindow;
28 class K3ListView;
29 class KPushButton;
30 class Q3ListViewItem;
31
32 /**
33 * @brief Represents the page from the Dolphin Settings which allows
34 * to modify the bookmarks.
35 */
36 class BookmarksSettingsPage : public SettingsPageBase
37 {
38 Q_OBJECT
39
40 public:
41 explicit BookmarksSettingsPage(DolphinMainWindow* mainWindow, QWidget* parent);
42
43 virtual ~BookmarksSettingsPage();
44
45 /** @see SettingsPageBase::applySettings */
46 virtual void applySettings();
47
48 private slots:
49 void updateButtons();
50 void slotBookmarkDoubleClicked(Q3ListViewItem*, const QPoint&, int);
51 void slotAddButtonClicked();
52 void slotEditButtonClicked();
53 void slotRemoveButtonClicked();
54 void slotMoveUpButtonClicked();
55 void slotMoveDownButtonClicked();
56
57 /**
58 * Is connected with the signal QListView::pressed(QListViewItem* item)
59 * and assures that always one bookmarks stays selected although a
60 * click has been done on the viewport area.
61 * TODO: this is a workaround, possibly there is a more easy approach
62 * doing this...
63 */
64 void slotBookmarkPressed(Q3ListViewItem* item);
65
66 private:
67 enum ColumnIndex {
68 PixmapIdx = 0,
69 NameIdx = 1,
70 UrlIdx = 2,
71 IconIdx = 3
72 };
73
74 DolphinMainWindow* m_mainWindow;
75 K3ListView* m_listView;
76 KPushButton* m_addButton;
77 KPushButton* m_editButton;
78 KPushButton* m_removeButton;
79 KPushButton* m_moveUpButton;
80 KPushButton* m_moveDownButton;
81
82 /**
83 * Returns the index of the selected bookmark
84 * inside the bookmarks listview.
85 */
86 int selectedBookmarkIndex() const;
87
88 /**
89 * Moves the currently selected bookmark up, if 'direction'
90 * is < 0, otherwise the bookmark is moved down.
91 */
92 void moveBookmark(int direction);
93 };
94
95 #endif