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 * Refreshes the view to get synchronized with the settings (e.g. icons size,
35 void readSettings() override
;
38 void urlActivated(const QUrl
&url
);
42 * This is invoked to inform the panel that the user has selected a new
45 void setSelection(const KFileItemList
&selection
);
48 * Does a delayed request of information for the item \a item.
49 * If within this delay InformationPanel::setUrl() or InformationPanel::setSelection()
50 * are invoked, then the request will be skipped. Requesting a delayed item information
51 * makes sense when hovering items.
53 void requestDelayedItemInfo(const KFileItem
&item
);
55 void slotFilesItemChanged(const KFileItemList
&changedFileItems
);
58 /** @see Panel::urlChanged() */
59 bool urlChanged() override
;
61 /** @see QWidget::showEvent() */
62 void showEvent(QShowEvent
*event
) override
;
64 /** @see QWidget::resizeEvent() */
65 void resizeEvent(QResizeEvent
*event
) override
;
67 /** @see QWidget::contextMenuEvent() */
68 void contextMenuEvent(QContextMenuEvent
*event
) override
;
72 * Shows the information for the item of the URL which has been provided by
73 * InformationPanel::requestDelayedItemInfo() and provides default actions.
78 * Shows the information for the currently displayed folder as a result from
79 * a stat job issued in showItemInfo().
81 void slotFolderStatFinished(KJob
*job
);
84 * Triggered if the request for item information has timed out.
85 * @see InformationPanel::requestDelayedItemInfo()
87 void slotInfoTimeout();
90 * Resets the information panel to show the current
91 * URL (InformationPanel::url()). Is called by
92 * DolphinInformationPanel::markUrlAsInvalid().
96 void slotFileRenamed(const QString
&source
, const QString
&dest
);
97 void slotFilesAdded(const QString
&directory
);
98 void slotFilesChanged(const QStringList
&files
);
99 void slotFilesRemoved(const QStringList
&files
);
100 void slotEnteredDirectory(const QString
&directory
);
101 void slotLeftDirectory(const QString
&directory
);
104 /** Assures that any pending item information request is cancelled. */
105 void cancelRequest();
108 * Returns true, if \a url is equal to the shown URL m_shownUrl.
110 bool isEqualToShownUrl(const QUrl
&url
) const;
113 * Marks the URL as invalid and will reset the Information Panel
114 * after a short delay. The reset is not done synchronously to
115 * prevent expensive updates during temporary invalid URLs by
116 * e. g. changing the directory.
118 void markUrlAsInvalid();
121 * Opens a menu which allows to configure which meta information
124 void showContextMenu(const QPoint
&point
);
131 QTimer
*m_urlChangedTimer
;
132 QTimer
*m_resetUrlTimer
;
134 // URL that is currently shown in the Information Panel.
137 // URL candidate that will replace m_shownURL after a delay.
138 // Used to remember URLs when hovering items.
141 // URL candidate that is marked as invalid (e. g. because the directory
142 // has been deleted or the shown item has been renamed). The Information
143 // Panel will be reset asynchronously to prevent unnecessary resets when
144 // a directory has been changed.
145 QUrl m_invalidUrlCandidate
;
147 KFileItem m_hoveredItem
;
148 KFileItemList m_selection
;
150 KIO::Job
*m_folderStatJob
;
152 InformationPanelContent
*m_content
;
153 bool m_inConfigurationMode
= false;
156 #endif // INFORMATIONPANEL_H