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