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 folderMiddleClicked(const QUrl
& url
);
46 void errorMessage(const QString
& error
);
49 /** @see Panel::urlChanged() */
50 bool urlChanged() override
;
52 /** @see QWidget::showEvent() */
53 void showEvent(QShowEvent
* event
) override
;
55 /** @see QWidget::keyPressEvent() */
56 void keyPressEvent(QKeyEvent
* event
) override
;
59 void slotItemActivated(int index
);
60 void slotItemMiddleClicked(int index
);
61 void slotItemContextMenuRequested(int index
, const QPointF
& pos
);
62 void slotViewContextMenuRequested(const QPointF
& pos
);
63 void slotItemDropEvent(int index
, QGraphicsSceneDragDropEvent
* event
);
64 void slotRoleEditingFinished(int index
, const QByteArray
& role
, const QVariant
& value
);
66 void slotLoadingCompleted();
69 * Increases the opacity of the view step by step until it is fully
72 void startFadeInAnimation();
77 * Indicate if it is allowed to leave current location.
79 enum NavigationBehaviour
{
80 StayWhereYouAre
, ///< Don't leave current location.
81 AllowJumpHome
///< Go Home only when context menu option got checked.
84 * Initializes the base URL of the tree and expands all
85 * directories until \a url.
86 * @param url URL of the leaf directory that should get expanded.
87 * @param navigationBehaviour Navigation behaviour \see NavigationBehaviour
89 void loadTree(const QUrl
& url
, NavigationBehaviour navigationBehaviour
= StayWhereYouAre
);
94 * Sets the item with the index \a index as current item, selects
95 * the item and assures that the item will be visible.
97 void updateCurrentItem(int index
);
100 bool m_updateCurrentItem
;
101 KItemListController
* m_controller
;
102 KFileItemModel
* m_model
;
105 #endif // FOLDERSPANEL_H