File indexing completed on 2024-04-21 04:58:08
0001 /* 0002 SPDX-FileCopyrightText: 2019 Raphael Rosch <kde-dev@insaner.com> 0003 0004 SPDX-License-Identifier: LGPL-2.0-only OR LGPL-3.0-only OR LicenseRef-KDE-Accepted-LGPL 0005 */ 0006 0007 #ifndef TREE_MODULE_H 0008 #define TREE_MODULE_H 0009 0010 #include <konqsidebarplugin.h> 0011 0012 #include <QTreeView> 0013 #include <QDebug> 0014 0015 #include <QUrl> 0016 #include <QDir> 0017 #include <KParts/PartActivateEvent> 0018 0019 #include <KDirModel> 0020 #include <KDirLister> 0021 #include <KDirSortFilterProxyModel> 0022 #include <QDirIterator> 0023 0024 #include <kio_version.h> 0025 0026 0027 class KonqSideBarTreeModule : public KonqSidebarModule 0028 { 0029 Q_OBJECT 0030 0031 public: 0032 KonqSideBarTreeModule(QWidget *parent, 0033 const KConfigGroup &configGroup); 0034 ~KonqSideBarTreeModule() override; 0035 0036 QWidget *getWidget() override; 0037 void handleURL(const QUrl &hand_url) override; 0038 0039 private slots: 0040 void slotSelectionChanged(const QItemSelection &selected, const QItemSelection &deselected); 0041 void slotUpdateColWidth(); 0042 void slotKDirExpand_setRootIndex(); 0043 void slotKDirExpand_setSelection(const QModelIndex &index); 0044 void customEvent(QEvent *ev) override; 0045 0046 private: 0047 void setSelection(const QUrl &target_url, bool do_openURLreq=true); 0048 void setSelectionIndex(const QModelIndex &index); 0049 QUrl getUrlFromIndex(const QModelIndex &index); 0050 QModelIndex resolveIndex(const QModelIndex &index); 0051 QModelIndex getIndexFromUrl(const QUrl &url) const; 0052 QUrl cleanupURL(const QUrl &url); 0053 0054 QTreeView *treeView; 0055 QUrl m_lastURL; 0056 QUrl m_initURL; 0057 bool m_ignoreHandle = false; 0058 0059 KDirModel *model; 0060 KDirSortFilterProxyModel *sorted_model; 0061 }; 0062 0063 #endif