summaryrefslogtreecommitdiffstats
path: root/konqueror/sidebar/trees/bookmark_module/bookmark_module.h
blob: ba78a2b967dcceb11c426844da27d45cb845d99c (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
95
96
97
98
/* This file is part of the KDE project
   Copyright (C) 2000 David Faure <faure@kde.org>

   This library is free software; you can redistribute it and/or
   modify it under the terms of the GNU Library General Public
   License version 2 as published by the Free Software Foundation.

   This library 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
   Library General Public License for more details.

   You should have received a copy of the GNU Library General Public License
   along with this library; see the file COPYING.LIB.  If not, write to
   the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
   Boston, MA 02110-1301, USA.
*/

#ifndef bookmark_module_h
#define bookmark_module_h

#include <tqmap.h>
#include <tqobject.h>
#include <konq_sidebartreemodule.h>
#include <kbookmark.h>
#include <kdialogbase.h>
class KonqSidebarBookmarkItem;

class TDEActionCollection;
class KLineEdit;

/**
 * This module displays bookmarks in the tree
 */
class KonqSidebarBookmarkModule : public TQObject, public KonqSidebarTreeModule
{
    Q_OBJECT
public:
    KonqSidebarBookmarkModule( KonqSidebarTree * parentTree );
    virtual ~KonqSidebarBookmarkModule();

    // Handle this new toplevel item [can only be called once currently]
    virtual void addTopLevelItem( KonqSidebarTreeTopLevelItem * item );
    virtual bool handleTopLevelContextMenu( KonqSidebarTreeTopLevelItem *, const TQPoint& );

    void showPopupMenu();


protected slots:
    void slotBookmarksChanged( const TQString & );
    void slotMoved(TQListViewItem*,TQListViewItem*,TQListViewItem*);
    void slotDropped(TDEListView*,TQDropEvent*,TQListViewItem*,TQListViewItem*);
    void slotCreateFolder();
    void slotDelete();
    void slotProperties(KonqSidebarBookmarkItem *bi = 0);
    void slotOpenNewWindow();
    void slotOpenTab();
    void slotCopyLocation();

protected:
    void fillListView();
    void fillGroup( KonqSidebarTreeItem * parentItem, KBookmarkGroup group );
    KonqSidebarBookmarkItem * findByAddress( const TQString & address ) const;

private slots:
    void slotOpenChange(TQListViewItem*);

private:
    KonqSidebarTreeTopLevelItem * m_topLevelItem;
    KonqSidebarBookmarkItem * m_rootItem;

    TDEActionCollection *m_collection;

    bool m_ignoreOpenChange;
    TQMap<TQString, bool> m_folderOpenState;
};

class BookmarkEditDialog : public KDialogBase
{
    Q_OBJECT

public:
    BookmarkEditDialog( const TQString& title, const TQString& url,
                        TQWidget * = 0, const char * = 0,
                        const TQString& caption = i18n( "Add Bookmark" ) );

    TQString finalUrl() const;
    TQString finalTitle() const;

protected slots:
    void slotOk();
    void slotCancel();

private:
    KLineEdit *m_title, *m_location;
};

#endif