2 * SPDX-FileCopyrightText: 2006 Peter Penz <peter.penz19@gmail.com>
4 * SPDX-License-Identifier: GPL-2.0-or-later
10 #include "panels/panel.h"
15 class KItemListController
;
16 class QGraphicsSceneDragDropEvent
;
19 * @brief Shows a tree view of the directories starting from
20 * the currently selected place.
22 * The tree view is always synchronized with the currently active view
23 * from the main window.
25 class FoldersPanel
: public Panel
30 explicit FoldersPanel(QWidget
* parent
= nullptr);
31 ~FoldersPanel() override
;
33 void setShowHiddenFiles(bool show
);
34 void setLimitFoldersPanelToHome(bool enable
);
35 bool showHiddenFiles() const;
36 bool limitFoldersPanelToHome() const;
38 void setAutoScrolling(bool enable
);
39 bool autoScrolling() const;
41 void rename(const KFileItem
& item
);
44 void folderActivated(const QUrl
& url
);
45 void folderInNewTab(const QUrl
&url
);
46 void folderInNewActiveTab(const QUrl
&url
);
47 void errorMessage(const QString
& error
);
50 /** @see Panel::urlChanged() */
51 bool urlChanged() override
;
53 /** @see QWidget::showEvent() */
54 void showEvent(QShowEvent
* event
) override
;
56 /** @see QWidget::keyPressEvent() */
57 void keyPressEvent(QKeyEvent
* event
) override
;
60 void slotItemActivated(int index
);
61 void slotItemMiddleClicked(int index
);
62 void slotItemContextMenuRequested(int index
, const QPointF
& pos
);
63 void slotViewContextMenuRequested(const QPointF
& pos
);
64 void slotItemDropEvent(int index
, QGraphicsSceneDragDropEvent
* event
);
65 void slotRoleEditingFinished(int index
, const QByteArray
& role
, const QVariant
& value
);
67 void slotLoadingCompleted();
70 * Increases the opacity of the view step by step until it is fully
73 void startFadeInAnimation();
78 * Indicate if it is allowed to leave current location.
80 enum NavigationBehaviour
{
81 StayWhereYouAre
, ///< Don't leave current location.
82 AllowJumpHome
///< Go Home only when context menu option got checked.
85 * Initializes the base URL of the tree and expands all
86 * directories until \a url.
87 * @param url URL of the leaf directory that should get expanded.
88 * @param navigationBehaviour Navigation behaviour \see NavigationBehaviour
90 void loadTree(const QUrl
& url
, NavigationBehaviour navigationBehaviour
= StayWhereYouAre
);
95 * Sets the item with the index \a index as current item, selects
96 * the item and assures that the item will be visible.
98 void updateCurrentItem(int index
);
101 bool m_updateCurrentItem
;
102 KItemListController
* m_controller
;
103 KFileItemModel
* m_model
;
106 #endif // FOLDERSPANEL_H