Make a branch to make krunner Good Enough For Aaron™.
[kdebase/uwolfer.git] / apps / konqueror / sidebar / trees / konq_sidebartreetoplevelitem.h
blobe3691a224079574ce68a0b7ed91bfd7da87b0cc0
1 /* This file is part of the KDE project
2 Copyright (C) 2000 David Faure <faure@kde.org>
4 This library is free software; you can redistribute it and/or
5 modify it under the terms of the GNU Library General Public
6 License version 2 as published by the Free Software Foundation.
8 This library is distributed in the hope that it will be useful,
9 but WITHOUT ANY WARRANTY; without even the implied warranty of
10 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
11 Library General Public License for more details.
13 You should have received a copy of the GNU Library General Public License
14 along with this library; see the file COPYING.LIB. If not, write to
15 the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
16 Boston, MA 02110-1301, USA.
19 #ifndef KONQ_SIDEBARTREETOPLEVELITEM_H
20 #define KONQ_SIDEBARTREETOPLEVELITEM_H
22 #include "konq_sidebartreeitem.h"
23 #include <konq_operations.h>
25 class QMimeData;
26 class KonqSidebarTreeModule;
28 /**
29 * Each toplevel item (created from a desktop file)
30 * points to the module that handles it
31 --> this doesn't prevent the same module from handling multiple toplevel items,
32 but we don't do that currently.
34 class KonqSidebarTreeTopLevelItem : public KonqSidebarTreeItem
36 public:
37 /**
38 * Create a toplevel toplevel-item :)
39 * @param module the module handling this toplevel item
40 * @param path the path to the desktop file that was the reason for creating this item
42 KonqSidebarTreeTopLevelItem( KonqSidebarTree *parent, KonqSidebarTreeModule * module, const QString & path )
43 : KonqSidebarTreeItem(parent, 0L), m_module(module), m_path(path), m_bTopLevelGroup(false) { init(); }
45 /**
46 * Create a toplevel-item under a toplevel group
47 * @param module the module handling this toplevel item
48 * @param path the path to the desktop file that was the reason for creating this item
50 KonqSidebarTreeTopLevelItem( KonqSidebarTreeItem *parentItem, KonqSidebarTreeModule * module, const QString & path )
51 : KonqSidebarTreeItem( parentItem, 0L), m_module(module), m_path(path), m_bTopLevelGroup(false) { init(); }
53 void init();
55 virtual bool acceptsDrops( const Q3StrList & formats );
56 virtual void drop( QDropEvent * ev );
57 virtual bool populateMimeData( QMimeData* mimeData, bool move );
58 virtual void middleButtonClicked();
59 virtual void rightButtonPressed();
61 virtual void paste();
62 virtual void trash();
63 virtual void del();
64 virtual void rename(); // start a rename operation
65 virtual void rename( const QString & name ); // do the actual renaming
67 virtual void setOpen( bool open );
69 // Whether the item is a toplevel item - true
70 virtual bool isTopLevelItem() const { return true; }
72 virtual KUrl externalURL() const { return m_externalURL; }
74 virtual QString toolTipText() const;
76 virtual void itemSelected();
78 // The module should call this for each toplevel item that is passed to it
79 // unless it calls setClickable(false)
80 void setExternalURL( const KUrl & url ) { m_externalURL = url; }
82 // Whether the item is a toplevel group. [Only matters for dnd]
83 void setTopLevelGroup( bool b ) { m_bTopLevelGroup = b; }
84 bool isTopLevelGroup() const { return m_bTopLevelGroup; }
86 // The module that handles the subtree below this toplevel item
87 KonqSidebarTreeModule *module() const { return m_module; }
89 // The path to the desktop file responsible for this toplevel item
90 QString path() const { return m_path; }
92 protected:
93 void delOperation( KonqOperations::Operation method );
94 KonqSidebarTreeModule *m_module;
95 QString m_path;
96 QString m_comment;
97 KUrl m_externalURL;
98 bool m_bTopLevelGroup;
101 #endif // KONQ_SIDEBARTREETOPLEVELITEM_H