1 /***************************************************************************
2 * Copyright (C) 2006-2009 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 INFORMATIONPANEL_H
21 #define INFORMATIONPANEL_H
23 #include "panels/panel.h"
27 class InformationPanelContent
;
34 * @brief Panel for showing meta information of one ore more selected items.
36 class InformationPanel
: public Panel
41 explicit InformationPanel(QWidget
* parent
= nullptr);
42 ~InformationPanel() override
;
45 void urlActivated(const QUrl
& url
);
49 * This is invoked to inform the panel that the user has selected a new
52 void setSelection(const KFileItemList
& selection
);
55 * Does a delayed request of information for the item \a item.
56 * If within this delay InformationPanel::setUrl() or InformationPanel::setSelection()
57 * are invoked, then the request will be skipped. Requesting a delayed item information
58 * makes sense when hovering items.
60 void requestDelayedItemInfo(const KFileItem
& item
);
63 /** @see Panel::urlChanged() */
64 bool urlChanged() override
;
66 /** @see QWidget::showEvent() */
67 void showEvent(QShowEvent
* event
) override
;
69 /** @see QWidget::resizeEvent() */
70 void resizeEvent(QResizeEvent
* event
) override
;
72 /** @see QWidget::contextMenuEvent() */
73 void contextMenuEvent(QContextMenuEvent
* event
) override
;
77 * Shows the information for the item of the URL which has been provided by
78 * InformationPanel::requestDelayedItemInfo() and provides default actions.
83 * Shows the information for the currently displayed folder as a result from
84 * a stat job issued in showItemInfo().
86 void slotFolderStatFinished(KJob
* job
);
89 * Triggered if the request for item information has timed out.
90 * @see InformationPanel::requestDelayedItemInfo()
92 void slotInfoTimeout();
95 * Resets the information panel to show the current
96 * URL (InformationPanel::url()). Is called by
97 * DolphinInformationPanel::markUrlAsInvalid().
101 void slotFileRenamed(const QString
& source
, const QString
& dest
);
102 void slotFilesAdded(const QString
& directory
);
103 void slotFilesChanged(const QStringList
& files
);
104 void slotFilesRemoved(const QStringList
& files
);
105 void slotEnteredDirectory(const QString
& directory
);
106 void slotLeftDirectory(const QString
& directory
);
109 /** Assures that any pending item information request is cancelled. */
110 void cancelRequest();
113 * Shows the meta information for the current shown item inside
119 * Returns true, if \a url is equal to the shown URL m_shownUrl.
121 bool isEqualToShownUrl(const QUrl
& url
) const;
124 * Marks the URL as invalid and will reset the Information Panel
125 * after a short delay. The reset is not done synchronously to
126 * prevent expensive updates during temporary invalid URLs by
127 * e. g. changing the directory.
129 void markUrlAsInvalid();
132 * Opens a menu which allows to configure which meta information
135 void showContextMenu(const QPoint
&point
);
142 QTimer
* m_urlChangedTimer
;
143 QTimer
* m_resetUrlTimer
;
145 // URL that is currently shown in the Information Panel.
148 // URL candidate that will replace m_shownURL after a delay.
149 // Used to remember URLs when hovering items.
152 // URL candidate that is marked as invalid (e. g. because the directory
153 // has been deleted or the shown item has been renamed). The Information
154 // Panel will be reset asynchronously to prevent unnecessary resets when
155 // a directory has been changed.
156 QUrl m_invalidUrlCandidate
;
158 KFileItem m_fileItem
; // file item for m_shownUrl if available (otherwise null)
159 KFileItemList m_selection
;
161 KIO::Job
* m_folderStatJob
;
163 InformationPanelContent
* m_content
;
164 bool m_inConfigurationMode
= false;
167 #endif // INFORMATIONPANEL_H