File indexing completed on 2024-04-28 04:58:27
0001 /* This file is part of the KDE project 0002 SPDX-FileCopyrightText: 2000 David Faure <faure@kde.org> 0003 0004 SPDX-License-Identifier: LGPL-2.0-only 0005 */ 0006 0007 #ifndef KONQ_SIDEBARTREEMODULE_H 0008 #define KONQ_SIDEBARTREEMODULE_H 0009 0010 #include <QObject> 0011 #include "konq_sidebartree.h" 0012 0013 class KonqSidebarTreeTopLevelItem; 0014 class KonqSidebarTree; 0015 0016 /** 0017 * The base class for KonqSidebarTree Modules. It defines the interface 0018 * between the generic KonqSidebarTree and the particular modules 0019 * (directory tree, history, bookmarks, ...) 0020 */ 0021 class KonqSidebarTreeModule 0022 { 0023 public: 0024 explicit KonqSidebarTreeModule(KonqSidebarTree *parentTree, bool showHidden = false) 0025 : m_pTree(parentTree), m_showHidden(showHidden) {} 0026 virtual ~KonqSidebarTreeModule() {} 0027 0028 // Handle this new toplevel item [can only be called once currently] 0029 virtual void addTopLevelItem(KonqSidebarTreeTopLevelItem *item) = 0; 0030 0031 // Open this toplevel item - you don't need to reimplement if 0032 // you create the item's children right away 0033 virtual void openTopLevelItem(KonqSidebarTreeTopLevelItem *) {} 0034 0035 // Follow a URL opened in another view - only implement if the module 0036 // has anything to do with URLs 0037 virtual void followURL(const QUrl &) {} 0038 0039 KonqSidebarTree *tree() const 0040 { 0041 return m_pTree; 0042 } 0043 bool showHidden() 0044 { 0045 return m_showHidden; 0046 } 0047 virtual void setShowHidden(bool showhidden) 0048 { 0049 m_showHidden = showhidden; 0050 } 0051 0052 virtual bool handleTopLevelContextMenu(KonqSidebarTreeTopLevelItem *, const QPoint &) 0053 { 0054 return false; 0055 } 0056 0057 protected: 0058 KonqSidebarTree *m_pTree; 0059 bool m_showHidden; 0060 }; 0061 0062 #endif // KONQ_SIDEBARTREEMODULE_H