summaryrefslogtreecommitdiffstats
path: root/src/bookmarkssettingspage.h
blob: 1d8ce93ff8b646918f66098b0731e7ff6231c0f3 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
/***************************************************************************
 *   Copyright (C) 2006 by Peter Penz                                      *
 *   [email protected]                                                     *
 *                                                                         *
 *   This program is free software; you can redistribute it and/or modify  *
 *   it under the terms of the GNU General Public License as published by  *
 *   the Free Software Foundation; either version 2 of the License, or     *
 *   (at your option) any later version.                                   *
 *                                                                         *
 *   This program is distributed in the hope that it will be useful,       *
 *   but WITHOUT ANY WARRANTY; without even the implied warranty of        *
 *   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the         *
 *   GNU General Public License for more details.                          *
 *                                                                         *
 *   You should have received a copy of the GNU General Public License     *
 *   along with this program; if not, write to the                         *
 *   Free Software Foundation, Inc.,                                       *
 *   51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.             *
 ***************************************************************************/

#ifndef BOOKMARKSSETTINGSPAGE_H
#define BOOKMARKSSETTINGSPAGE_H

#include <settingspagebase.h>
#include <tqvaluelist.h>

class KListView;
class KPushButton;
class TQListViewItem;

/**
 * @brief Represents the page from the Dolphin Settings which allows
 *        to modify the bookmarks.
 */
class BookmarksSettingsPage : public SettingsPageBase
{
    Q_OBJECT
  TQ_OBJECT

public:
    BookmarksSettingsPage(TQWidget* parent);

    virtual ~BookmarksSettingsPage();

    /** @see SettingsPageBase::applySettings */
    virtual void applySettings();

private slots:
    void updateButtons();
    void slotBookmarkDoubleClicked(TQListViewItem*, const TQPoint&, int);
    void slotAddButtonClicked();
    void slotEditButtonClicked();
    void slotRemoveButtonClicked();
    void slotMoveUpButtonClicked();
    void slotMoveDownButtonClicked();

    /**
     * Is connected with the signal TQListView::pressed(TQListViewItem* item)
     * and assures that always one bookmarks stays selected although a
     * click has been done on the viewport area.
     * TODO: this is a workaround, possibly there is a more easy approach
     * doing this...
     */
    void slotBookmarkPressed(TQListViewItem* item);

private:
    enum ColumnIndex {
        PixmapIdx = 0,
        NameIdx   = 1,
        URLIdx    = 2,
        IconIdx   = 3
    };

    KListView* m_listView;
    KPushButton* m_addButton;
    KPushButton* m_editButton;
    KPushButton* m_removeButton;
    KPushButton* m_moveUpButton;
    KPushButton* m_moveDownButton;

    /**
     * Returns the index of the selected bookmark
     * inside the bookmarks listview.
     */
    int selectedBookmarkIndex() const;

    /**
     * Moves the currently selected bookmark up, if 'direction'
     * is < 0, otherwise the bookmark is moved down.
     */
    void moveBookmark(int direction);
};

#endif