2 * SPDX-FileCopyrightText: 2006-2009 Peter Penz <peter.penz19@gmail.com>
4 * SPDX-License-Identifier: GPL-2.0-or-later
7 #ifndef INFORMATIONPANEL_H
8 #define INFORMATIONPANEL_H
10 #include "panels/panel.h"
14 class InformationPanelContent
;
21 * @brief Panel for showing meta information of one ore more selected items.
23 class InformationPanel
: public Panel
28 explicit InformationPanel(QWidget
* parent
= nullptr);
29 ~InformationPanel() override
;
32 void urlActivated(const QUrl
& url
);
36 * This is invoked to inform the panel that the user has selected a new
39 void setSelection(const KFileItemList
& selection
);
42 * Does a delayed request of information for the item \a item.
43 * If within this delay InformationPanel::setUrl() or InformationPanel::setSelection()
44 * are invoked, then the request will be skipped. Requesting a delayed item information
45 * makes sense when hovering items.
47 void requestDelayedItemInfo(const KFileItem
& item
);
50 /** @see Panel::urlChanged() */
51 bool urlChanged() override
;
53 /** @see QWidget::showEvent() */
54 void showEvent(QShowEvent
* event
) override
;
56 /** @see QWidget::resizeEvent() */
57 void resizeEvent(QResizeEvent
* event
) override
;
59 /** @see QWidget::contextMenuEvent() */
60 void contextMenuEvent(QContextMenuEvent
* event
) override
;
64 * Shows the information for the item of the URL which has been provided by
65 * InformationPanel::requestDelayedItemInfo() and provides default actions.
70 * Shows the information for the currently displayed folder as a result from
71 * a stat job issued in showItemInfo().
73 void slotFolderStatFinished(KJob
* job
);
76 * Triggered if the request for item information has timed out.
77 * @see InformationPanel::requestDelayedItemInfo()
79 void slotInfoTimeout();
82 * Resets the information panel to show the current
83 * URL (InformationPanel::url()). Is called by
84 * DolphinInformationPanel::markUrlAsInvalid().
88 void slotFileRenamed(const QString
& source
, const QString
& dest
);
89 void slotFilesAdded(const QString
& directory
);
90 void slotFilesChanged(const QStringList
& files
);
91 void slotFilesRemoved(const QStringList
& files
);
92 void slotEnteredDirectory(const QString
& directory
);
93 void slotLeftDirectory(const QString
& directory
);
96 /** Assures that any pending item information request is cancelled. */
100 * Shows the meta information for the current shown item inside
106 * Returns true, if \a url is equal to the shown URL m_shownUrl.
108 bool isEqualToShownUrl(const QUrl
& url
) const;
111 * Marks the URL as invalid and will reset the Information Panel
112 * after a short delay. The reset is not done synchronously to
113 * prevent expensive updates during temporary invalid URLs by
114 * e. g. changing the directory.
116 void markUrlAsInvalid();
119 * Opens a menu which allows to configure which meta information
122 void showContextMenu(const QPoint
&point
);
129 QTimer
* m_urlChangedTimer
;
130 QTimer
* m_resetUrlTimer
;
132 // URL that is currently shown in the Information Panel.
135 // URL candidate that will replace m_shownURL after a delay.
136 // Used to remember URLs when hovering items.
139 // URL candidate that is marked as invalid (e. g. because the directory
140 // has been deleted or the shown item has been renamed). The Information
141 // Panel will be reset asynchronously to prevent unnecessary resets when
142 // a directory has been changed.
143 QUrl m_invalidUrlCandidate
;
145 KFileItem m_fileItem
; // file item for m_shownUrl if available (otherwise null)
146 KFileItemList m_selection
;
148 KIO::Job
* m_folderStatJob
;
150 InformationPanelContent
* m_content
;
151 bool m_inConfigurationMode
= false;
154 #endif // INFORMATIONPANEL_H