1 /***************************************************************************
2 * Copyright (C) 2006 by Peter Penz <peter.penz19@gmail.com> *
4 * This program is free software; you can redistribute it and/or modify *
5 * it under the terms of the GNU General Public License as published by *
6 * the Free Software Foundation; either version 2 of the License, or *
7 * (at your option) any later version. *
9 * This program is distributed in the hope that it will be useful, *
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of *
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
12 * GNU General Public License for more details. *
14 * You should have received a copy of the GNU General Public License *
15 * along with this program; if not, write to the *
16 * Free Software Foundation, Inc., *
17 * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA *
18 ***************************************************************************/
20 #ifndef FOLDERSPANEL_H
21 #define FOLDERSPANEL_H
24 #include <panels/panel.h>
27 class KItemListController
;
28 class QGraphicsSceneDragDropEvent
;
31 * @brief Shows a tree view of the directories starting from
32 * the currently selected place.
34 * The tree view is always synchronized with the currently active view
35 * from the main window.
37 class FoldersPanel
: public Panel
42 explicit FoldersPanel(QWidget
* parent
= nullptr);
43 virtual ~FoldersPanel();
45 void setShowHiddenFiles(bool show
);
46 void setLimitFoldersPanelToHome(bool enable
);
47 bool showHiddenFiles() const;
48 bool limitFoldersPanelToHome() const;
50 void setAutoScrolling(bool enable
);
51 bool autoScrolling() const;
53 void rename(const KFileItem
& item
);
56 void folderActivated(const QUrl
& url
);
57 void folderMiddleClicked(const QUrl
& url
);
58 void errorMessage(const QString
& error
);
61 /** @see Panel::urlChanged() */
62 virtual bool urlChanged() Q_DECL_OVERRIDE
;
64 /** @see QWidget::showEvent() */
65 virtual void showEvent(QShowEvent
* event
) Q_DECL_OVERRIDE
;
67 /** @see QWidget::keyPressEvent() */
68 virtual void keyPressEvent(QKeyEvent
* event
) Q_DECL_OVERRIDE
;
71 void slotItemActivated(int index
);
72 void slotItemMiddleClicked(int index
);
73 void slotItemContextMenuRequested(int index
, const QPointF
& pos
);
74 void slotViewContextMenuRequested(const QPointF
& pos
);
75 void slotItemDropEvent(int index
, QGraphicsSceneDragDropEvent
* event
);
76 void slotRoleEditingFinished(int index
, const QByteArray
& role
, const QVariant
& value
);
78 void slotLoadingCompleted();
81 * Increases the opacity of the view step by step until it is fully
84 void startFadeInAnimation();
89 * Initializes the base URL of the tree and expands all
90 * directories until \a url.
91 * @param url URL of the leaf directory that should get expanded.
92 * @param allowJumpHome indicate context menu got checked.
94 void loadTree(const QUrl
& url
, bool allowJumpHome
= false);
99 * Sets the item with the index \a index as current item, selects
100 * the item and assures that the item will be visible.
102 void updateCurrentItem(int index
);
105 bool m_updateCurrentItem
;
106 KItemListController
* m_controller
;
107 KFileItemModel
* m_model
;
110 #endif // FOLDERSPANEL_H