2 * SPDX-FileCopyrightText: 2006-2009 Peter Penz <peter.penz19@gmail.com>
3 * SPDX-FileCopyrightText: 2006 Gregor Kališnik <gregor@podnapisi.net>
5 * SPDX-License-Identifier: GPL-2.0-or-later
11 #include "dolphin_export.h"
12 #include "dolphintabwidget.h"
13 #include "tooltips/tooltipmanager.h"
15 #include "config-dolphin.h"
17 #include <KIO/StatJob>
18 #include <kio/fileundomanager.h>
19 #include <kparts/part.h>
28 typedef KIO::FileUndoManager::CommandType CommandType
;
30 class DolphinItemListView
;
32 class KItemListContainer
;
36 class VersionControlObserver
;
39 class QGraphicsSceneDragDropEvent
;
42 class QRegularExpression
;
45 * @short Represents a view for the directory content.
47 * View modes for icons, compact and details are supported. It's
57 class DOLPHIN_EXPORT DolphinView
: public QWidget
63 * Defines the view mode for a directory. The
64 * view mode is automatically updated if the directory itself
65 * defines a view mode (see class ViewProperties for details).
69 * The items are shown as icons with a name-label below.
74 * The icon, the name and the size of the items are
75 * shown per default as a table.
80 * The items are shown as icons with the name-label aligned
87 * @param url Specifies the content which should be shown.
88 * @param parent Parent widget of the view.
90 DolphinView(const QUrl
&url
, QWidget
*parent
);
92 ~DolphinView() override
;
95 * Returns the current active URL, where all actions are applied.
96 * The URL navigator is synchronized with this URL.
101 * If \a active is true, the view will marked as active. The active
102 * view is defined as view where all actions are applied to.
104 void setActive(bool active
);
105 bool isActive() const;
108 * Changes the view mode for the current directory to \a mode.
109 * If the view properties should be remembered for each directory
110 * (GeneralSettings::globalViewProps() returns false), then the
111 * changed view mode will be stored automatically.
113 void setViewMode(Mode mode
);
114 Mode
viewMode() const;
117 * Enables or disables a mode for quick and easy selection of items.
119 void setSelectionModeEnabled(bool enabled
);
120 bool selectionMode() const;
123 * Turns on the file preview for the all files of the current directory,
124 * if \a show is true.
125 * If the view properties should be remembered for each directory
126 * (GeneralSettings::globalViewProps() returns false), then the
127 * preview setting will be stored automatically.
129 void setPreviewsShown(bool show
);
130 bool previewsShown() const;
133 * Shows all hidden files of the current directory,
134 * if \a show is true.
135 * If the view properties should be remembered for each directory
136 * (GeneralSettings::globalViewProps() returns false), then the
137 * show hidden file setting will be stored automatically.
139 void setHiddenFilesShown(bool show
);
140 bool hiddenFilesShown() const;
143 * Turns on sorting by groups if \a enable is true.
145 void setGroupedSorting(bool grouped
);
146 bool groupedSorting() const;
149 * Returns the items of the view.
151 KFileItemList
items() const;
154 * @return The number of items. itemsCount() is faster in comparison
155 * to items().count().
157 int itemsCount() const;
160 * Returns the selected items. The list is empty if no item has been
163 KFileItemList
selectedItems() const;
166 * Returns the number of selected items (this is faster than
167 * invoking selectedItems().count()).
169 int selectedItemsCount() const;
172 * Marks the items indicated by \p urls to get selected after the
173 * directory DolphinView::url() has been loaded. Note that nothing
174 * gets selected if no loading of a directory has been triggered
175 * by DolphinView::setUrl() or DolphinView::reload().
177 void markUrlsAsSelected(const QList
<QUrl
> &urls
);
180 * Marks the item indicated by \p url to be scrolled to and as the
181 * current item after directory DolphinView::url() has been loaded.
183 void markUrlAsCurrent(const QUrl
&url
);
186 * All items that match the regular expression \a regexp will get selected
187 * if \a enabled is true and deselected if \a enabled is false.
189 * Note that to match the whole string the pattern should be anchored:
190 * - you can anchor the pattern with QRegularExpression::anchoredPattern()
191 * - if you use QRegularExpresssion::wildcardToRegularExpression(), don't use
192 * QRegularExpression::anchoredPattern() as the former already returns an
195 void selectItems(const QRegularExpression
®exp
, bool enabled
);
198 * Sets the zoom level to \a level. It is assured that the used
199 * level is adjusted to be inside the range ZoomLevelInfo::minimumLevel() and
200 * ZoomLevelInfo::maximumLevel().
202 void setZoomLevel(int level
);
203 int zoomLevel() const;
206 * Resets the view's icon size to the default value
208 void resetZoomLevel();
211 * Updates the view properties of the current URL to the
212 * sorting given by \a role.
214 void setSortRole(const QByteArray
&role
);
215 QByteArray
sortRole() const;
218 * Updates the view properties of the current URL to the
219 * sort order given by \a order.
221 void setSortOrder(Qt::SortOrder order
);
222 Qt::SortOrder
sortOrder() const;
225 * Updates the view properties of the current URL to the
226 * grouping given by \a role.
228 void setGroupRole(const QByteArray
&role
);
229 QByteArray
groupRole() const;
232 * Updates the view properties of the current URL to the
233 * sort order given by \a order.
235 void setGroupOrder(Qt::SortOrder order
);
236 Qt::SortOrder
groupOrder() const;
238 /** Sets a separate sorting with folders first (true) or a mixed sorting of files and folders (false). */
239 void setSortFoldersFirst(bool foldersFirst
);
240 bool sortFoldersFirst() const;
242 /** Sets a separate sorting with hidden files and folders last (true) or not (false). */
243 void setSortHiddenLast(bool hiddenLast
);
244 bool sortHiddenLast() const;
246 /** Sets the additional information which should be shown for the items. */
247 void setVisibleRoles(const QList
<QByteArray
> &roles
);
249 /** Returns the additional information which should be shown for the items. */
250 QList
<QByteArray
> visibleRoles() const;
253 * Refreshes the view to get synchronized with the settings (e.g. icons size,
259 * Saves the current settings (e.g. icons size, font, ..).
261 void writeSettings();
264 * Filters the currently shown items by \a nameFilter. All items
265 * which contain the given filter string will be shown.
267 void setNameFilter(const QString
&nameFilter
);
268 QString
nameFilter() const;
271 * Filters the currently shown items by \a filters. All items
272 * whose content-type matches those given by the list of filters
275 void setMimeTypeFilters(const QStringList
&filters
);
276 QStringList
mimeTypeFilters() const;
279 * Tells the view to generate an updated status bar text. The result
280 * is returned through the statusBarTextChanged(QString statusBarText) signal.
281 * It will carry a textual representation of the state of the current
282 * folder or selected items, suitable for use in the status bar.
283 * Any pending requests of status bar text are killed.
285 void requestStatusBarText();
288 * Returns the version control actions that are provided for the items \p items.
289 * Usually the actions are presented in the context menu.
291 QList
<QAction
*> versionControlActions(const KFileItemList
&items
) const;
294 * Returns the state of the paste action:
295 * first is whether the action should be enabled
296 * second is the text for the action
298 QPair
<bool, QString
> pasteInfo() const;
301 * If \a tabsForFiles is true, the signal tabRequested() will also
302 * emitted also for files. Per default tabs for files is disabled
303 * and hence the signal tabRequested() will only be emitted for
306 void setTabsForFilesEnabled(bool tabsForFiles
);
307 bool isTabsForFilesEnabled() const;
310 * Returns true if the current view allows folders to be expanded,
311 * i.e. presents a hierarchical view to the user.
313 bool itemsExpandable() const;
316 * @returns true if the @p item is one of the items() of this view and
317 * is currently expanded. false otherwise.
318 * Only directories in view modes that allow expanding can ever be expanded.
320 bool isExpanded(const KFileItem
&item
) const;
323 * Restores the view state (current item, contents position, details view expansion state)
325 void restoreState(QDataStream
&stream
);
328 * Saves the view state (current item, contents position, details view expansion state)
330 void saveState(QDataStream
&stream
);
333 * Returns the root item which represents the current URL.
335 KFileItem
rootItem() const;
338 * Sets a context that is used for remembering the view-properties.
339 * Per default the context is empty and the path of the currently set URL
340 * is used for remembering the view-properties. Setting a custom context
341 * makes sense if specific types of URLs (e.g. search-URLs) should
342 * share common view-properties.
344 void setViewPropertiesContext(const QString
&context
);
345 QString
viewPropertiesContext() const;
348 * Checks if the given \a item can be opened as folder (e.g. archives).
349 * This function will also adjust the \a url (e.g. change the protocol).
350 * @return a valid and adjusted url if the item can be opened as folder,
351 * otherwise return an empty url.
353 static QUrl
openItemAsFolderUrl(const KFileItem
&item
, const bool browseThroughArchives
= true);
356 * Hides tooltip displayed over element.
358 void hideToolTip(const ToolTipManager::HideBehavior behavior
= ToolTipManager::HideBehavior::Later
);
361 * Check if the space key should be handled as a normal key, even if it's
362 * used as a keyboard shortcut.
366 bool handleSpaceAsNormalKey() const;
368 /** Activates the view if the item list container gets focus. */
369 bool eventFilter(QObject
*watched
, QEvent
*event
) override
;
372 * Returns whether the folder represented by the current URL is writable.
374 bool isFolderWritable() const;
381 * Changes the directory to \a url. If the current directory is equal to
382 * \a url, nothing will be done (use DolphinView::reload() instead).
384 void setUrl(const QUrl
&url
);
388 * @see DolphinView::selectedItems()
393 * Inverts the current selection: selected items get unselected,
394 * unselected items get selected.
395 * @see DolphinView::selectedItems()
397 void invertSelection();
399 void clearSelection();
402 * Triggers the renaming of the currently selected items, where
403 * the user must input a new name for the items.
405 void renameSelectedItems();
408 * Moves all selected items to the trash.
410 void trashSelectedItems();
413 * Deletes all selected items.
415 void deleteSelectedItems();
418 * Copies all selected items to the clipboard and marks
421 void cutSelectedItemsToClipboard();
423 /** Copies all selected items to the clipboard. */
424 void copySelectedItemsToClipboard();
427 * Copies all selected items to @p destinationUrl.
429 void copySelectedItems(const KFileItemList
&selection
, const QUrl
&destinationUrl
);
432 * Moves all selected items to @p destinationUrl.
434 void moveSelectedItems(const KFileItemList
&selection
, const QUrl
&destinationUrl
);
436 /** Pastes the clipboard data to this view. */
440 * Pastes the clipboard data into the currently selected
441 * folder. If the current selection is not exactly one folder, no
442 * paste operation is done.
444 void pasteIntoFolder();
447 * Copies the path of the first selected KFileItem into Clipboard.
449 void copyPathToClipboard();
452 * Creates duplicates of selected items, appending "copy"
455 void duplicateSelectedItems();
458 * Handles a drop of @p dropEvent onto widget @p dropWidget and destination @p destUrl
460 void dropUrls(const QUrl
&destUrl
, QDropEvent
*dropEvent
, QWidget
*dropWidget
);
465 * Applies the state that has been restored by restoreViewState()
468 void updateViewState();
472 * Is emitted if the view has been activated by e. g. a mouse click.
476 /** Is emitted if the URL of the view has been changed to \a url. */
477 void urlChanged(const QUrl
&url
);
480 * Is emitted when clicking on an item with the left mouse button.
482 void itemActivated(const KFileItem
&item
);
485 * Is emitted when clicking on a file with the middle mouse button.
486 * @note: This will not be emitted for folders or file archives that will/can be opened like folders.
488 void fileMiddleClickActivated(const KFileItem
&item
);
491 * Is emitted when multiple items have been activated by e. g.
492 * context menu open with.
494 void itemsActivated(const KFileItemList
&items
);
497 * Is emitted if items have been added or deleted.
499 void itemCountChanged();
502 * Is emitted if a new tab should be opened for the URL \a url.
504 void tabRequested(const QUrl
&url
);
507 * Is emitted if a new tab should be opened for the URL \a url and set as active.
509 void activeTabRequested(const QUrl
&url
);
512 * Is emitted if a new window should be opened for the URL \a url.
514 void windowRequested(const QUrl
&url
);
517 * Is emitted if the view mode (IconsView, DetailsView,
518 * PreviewsView) has been changed.
520 void modeChanged(DolphinView::Mode current
, DolphinView::Mode previous
);
522 /** Is emitted if the 'show preview' property has been changed. */
523 void previewsShownChanged(bool shown
);
525 /** Is emitted if the 'show hidden files' property has been changed. */
526 void hiddenFilesShownChanged(bool shown
);
528 /** Is emitted if the 'grouped sorting' property has been changed. */
529 void groupedSortingChanged(bool groupedSorting
);
531 /** Is emitted in reaction to a requestStatusBarText() call.
532 * @see requestStatusBarText() */
533 void statusBarTextChanged(QString statusBarText
);
535 /** Is emitted if the sorting by name, size or date has been changed. */
536 void sortRoleChanged(const QByteArray
&role
);
538 /** Is emitted if the sort order (ascending or descending) has been changed. */
539 void sortOrderChanged(Qt::SortOrder order
);
541 /** Is emitted if the grouping by name, size or date has been changed. */
542 void groupRoleChanged(const QByteArray
&role
);
544 /** Is emitted if the group order (ascending or descending) has been changed. */
545 void groupOrderChanged(Qt::SortOrder order
);
548 * Is emitted if the sorting of files and folders (separate with folders
549 * first or mixed) has been changed.
551 void sortFoldersFirstChanged(bool foldersFirst
);
554 * Is emitted if the sorting of hidden files has been changed.
556 void sortHiddenLastChanged(bool hiddenLast
);
558 /** Is emitted if the additional information shown for this view has been changed. */
559 void visibleRolesChanged(const QList
<QByteArray
> ¤t
, const QList
<QByteArray
> &previous
);
561 /** Is emitted if the zoom level has been changed by zooming in or out. */
562 void zoomLevelChanged(int current
, int previous
);
565 * Is emitted if information of an item is requested to be shown e. g. in the panel.
566 * If item is null, no item information request is pending.
568 void requestItemInfo(const KFileItem
&item
);
571 * Is emitted whenever the selection has been changed.
573 void selectionChanged(const KFileItemList
&selection
);
576 * Is emitted if a context menu is requested for the item \a item,
577 * which is part of \a url. If the item is null, the context menu
578 * for the URL should be shown.
580 void requestContextMenu(const QPoint
&pos
, const KFileItem
&item
, const KFileItemList
&selectedItems
, const QUrl
&url
);
583 * Is emitted if an information message with the content \a msg
586 void infoMessage(const QString
&msg
);
589 * Is emitted if an error message with the content \a msg
592 void errorMessage(const QString
&message
, const int kioErrorCode
);
595 * Is emitted if an "operation completed" message with the content \a msg
598 void operationCompletedMessage(const QString
&msg
);
601 * Is emitted after DolphinView::setUrl() has been invoked and
602 * the current directory is loaded. If this signal is emitted,
603 * it is assured that the view contains already the correct root
604 * URL and property settings.
606 void directoryLoadingStarted();
609 * Is emitted after the directory triggered by DolphinView::setUrl()
612 void directoryLoadingCompleted();
615 * Is emitted after the directory loading triggered by DolphinView::setUrl()
618 void directoryLoadingCanceled();
621 * Is emitted after DolphinView::setUrl() has been invoked and provides
622 * the information how much percent of the current directory have been loaded.
624 void directoryLoadingProgress(int percent
);
627 * Is emitted if the sorting is done asynchronously and provides the
628 * progress information of the sorting.
630 void directorySortingProgress(int percent
);
633 * Emitted when the file-item-model emits redirection.
634 * Testcase: fish://localhost
636 void redirection(const QUrl
&oldUrl
, const QUrl
&newUrl
);
639 * Is emitted when the URL set by DolphinView::setUrl() represents a file.
640 * In this case no signal errorMessage() will be emitted.
642 void urlIsFileError(const QUrl
&url
);
645 * Is emitted when the write state of the folder has been changed. The application
646 * should disable all actions like "Create New..." that depend on the write
649 void writeStateChanged(bool isFolderWritable
);
652 * Is emitted if the URL should be changed to the previous URL of the
653 * history (e.g. because the "back"-mousebutton has been pressed).
655 void goBackRequested();
658 * Is emitted if the URL should be changed to the next URL of the
659 * history (e.g. because the "next"-mousebutton has been pressed).
661 void goForwardRequested();
664 * Used to request either entering or leaving of selection mode
665 * Entering is typically requested on press and hold.
666 * Leaving by pressing Escape when no item is selected.
668 void selectionModeChangeRequested(bool enabled
);
671 * Is emitted when the user wants to move the focus to another view.
673 void toggleActiveViewRequested();
676 * Is emitted when the user clicks a tag or a link
677 * in the metadata widget of a tooltip.
679 void urlActivated(const QUrl
&url
);
681 void goUpRequested();
683 void fileItemsChanged(const KFileItemList
&changedFileItems
);
686 * Emitted when the current directory of the model was removed.
688 void currentDirectoryRemoved();
691 * Emitted when the view's background is double-clicked.
692 * Used to trigger an user configured action.
694 void doubleClickViewBackground(Qt::MouseButton button
);
697 /** Changes the zoom level if Control is pressed during a wheel event. */
698 void wheelEvent(QWheelEvent
*event
) override
;
700 void hideEvent(QHideEvent
*event
) override
;
701 bool event(QEvent
*event
) override
;
705 * Marks the view as active (DolphinView:isActive() will return true)
706 * and emits the 'activated' signal if it is not already active.
710 void slotItemActivated(int index
);
711 void slotItemsActivated(const KItemSet
&indexes
);
712 void slotItemMiddleClicked(int index
);
713 void slotItemContextMenuRequested(int index
, const QPointF
&pos
);
714 void slotViewContextMenuRequested(const QPointF
&pos
);
715 void slotHeaderContextMenuRequested(const QPointF
&pos
);
716 void slotHeaderColumnWidthChangeFinished(const QByteArray
&role
, qreal current
);
717 void slotSidePaddingWidthChanged(qreal width
);
718 void slotItemHovered(int index
);
719 void slotItemUnhovered(int index
);
720 void slotItemDropEvent(int index
, QGraphicsSceneDragDropEvent
*event
);
721 void slotModelChanged(KItemModelBase
*current
, KItemModelBase
*previous
);
722 void slotMouseButtonPressed(int itemIndex
, Qt::MouseButtons buttons
);
723 void slotRenameDialogRenamingFinished(const QList
<QUrl
> &urls
);
724 void slotSelectedItemTextPressed(int index
);
725 void slotItemCreatedFromJob(KIO::Job
*, const QUrl
&, const QUrl
&to
);
726 void slotItemLinkCreatedFromJob(KIO::Job
*, const QUrl
&, const QString
&, const QUrl
&to
);
727 void slotIncreaseZoom();
728 void slotDecreaseZoom();
732 * Is called when new items get pasted or dropped.
734 void slotItemCreated(const QUrl
&url
);
736 * Is called after all pasted or dropped items have been copied to destination.
738 void slotJobResult(KJob
*job
);
741 * Emits the signal \a selectionChanged() with a small delay. This is
742 * because getting all file items for the selection can be an expensive
743 * operation. Fast selection changes are collected in this case and
744 * the signal is emitted only after no selection change has been done
745 * within a small delay.
747 void slotSelectionChanged(const KItemSet
¤t
, const KItemSet
&previous
);
750 * Is called by emitDelayedSelectionChangedSignal() and emits the
751 * signal \a selectionChanged() with all selected file items as parameter.
753 void emitSelectionChangedSignal();
756 * Helper method for DolphinView::requestStatusBarText().
757 * Calculates the amount of folders and files and their total size in
758 * response to a KStatJob::result(), then calls emitStatusBarText().
759 * @see requestStatusBarText()
760 * @see emitStatusBarText()
762 void slotStatJobResult(KJob
*job
);
765 * Updates the view properties of the current URL to the
766 * sorting of files and folders (separate with folders first or mixed) given by \a foldersFirst.
768 void updateSortFoldersFirst(bool foldersFirst
);
771 * Updates the view properties of the current URL to the
772 * sorting of hidden files given by \a hiddenLast.
774 void updateSortHiddenLast(bool hiddenLast
);
777 * Indicates in the status bar that the delete operation
778 * of the job \a job has been finished.
780 void slotDeleteFileFinished(KJob
*job
);
783 * Indicates in the status bar that the trash operation
784 * of the job \a job has been finished.
786 void slotTrashFileFinished(KJob
*job
);
789 * Invoked when the rename job is done, for error handling.
791 void slotRenamingResult(KJob
*job
);
794 * Invoked when the file item model has started the loading
795 * of the directory specified by DolphinView::url().
797 void slotDirectoryLoadingStarted();
800 * Invoked when the file item model indicates that the loading of a directory has
801 * been completed. Assures that pasted items and renamed items get selected.
803 void slotDirectoryLoadingCompleted();
806 * Invoked when the file item model indicates that the loading of a directory has
809 void slotDirectoryLoadingCanceled();
812 * Is invoked when items of KFileItemModel have been changed.
814 void slotItemsChanged();
817 * Is invoked when the sort order has been changed by the user by clicking
818 * on a header item. The view properties of the directory will get updated.
820 void slotSortOrderChangedByHeader(Qt::SortOrder current
, Qt::SortOrder previous
);
823 * Is invoked when the sort role has been changed by the user by clicking
824 * on a header item. The view properties of the directory will get updated.
826 void slotSortRoleChangedByHeader(const QByteArray
¤t
, const QByteArray
&previous
);
829 * Is invoked when the visible roles have been changed by the user by dragging
830 * a header item. The view properties of the directory will get updated.
832 void slotVisibleRolesChangedByHeader(const QList
<QByteArray
> ¤t
, const QList
<QByteArray
> &previous
);
834 void slotRoleEditingCanceled();
835 void slotRoleEditingFinished(int index
, const QByteArray
&role
, const QVariant
&value
);
838 * Observes the item with the URL \a url. As soon as the directory
839 * model indicates that the item is available, the item will
840 * get selected and it is assured that the item stays visible.
842 void observeCreatedItem(const QUrl
&url
);
845 * Selects the next item after prev selection deleted/trashed
847 void selectNextItem();
850 * Called when a redirection happens.
851 * Testcase: fish://localhost
853 void slotDirectoryRedirection(const QUrl
&oldUrl
, const QUrl
&newUrl
);
855 void slotTwoClicksRenamingTimerTimeout();
857 void onDirectoryLoadingCompletedAfterJob();
860 void loadDirectory(const QUrl
&url
, bool reload
= false);
863 * Applies the view properties which are defined by the current URL
864 * to the DolphinView properties. The view properties are read from a
865 * .directory file either in the current directory, or in the
866 * share/apps/dolphin/view_properties/ subfolder of the user's .kde folder.
868 void applyViewProperties();
871 * Applies the given view properties to the DolphinView.
873 void applyViewProperties(const ViewProperties
&props
);
876 * Applies the m_mode property to the corresponding
877 * itemlayout-property of the KItemListView.
879 void applyModeToView();
881 enum Selection
{ HasSelection
, NoSelection
};
883 * Helper method for DolphinView::requestStatusBarText().
884 * Generates the status bar text from the parameters and
885 * then emits statusBarTextChanged().
886 * @param totalFileSize the sum of the sizes of the files
887 * @param selection if HasSelection is passed, the emitted status bar text will say
888 * that the folders and files which are counted here are selected.
890 void emitStatusBarText(const int folderCount
, const int fileCount
, KIO::filesize_t totalFileSize
, const Selection selection
);
893 * Helper method for DolphinView::paste() and DolphinView::pasteIntoFolder().
894 * Pastes the clipboard data into the URL \a url.
896 void pasteToUrl(const QUrl
&url
);
899 * Returns a list of URLs for all selected items. The list is
900 * simplified, so that when the URLs are part of different tree
901 * levels, only the parent is returned.
903 QList
<QUrl
> simplifiedSelectedUrls() const;
906 * Returns the MIME data for all selected items.
908 QMimeData
*selectionMimeData() const;
911 * Updates m_isFolderWritable dependent on whether the folder represented by
912 * the current URL is writable. If the state has changed, the signal
913 * writeStateChanged() will be emitted.
915 void updateWritableState();
918 * @return The current URL if no viewproperties-context is given (see
919 * DolphinView::viewPropertiesContext(), otherwise the context
922 QUrl
viewPropertiesUrl() const;
925 * Clears the selection and updates current item and selection according to the parameters
927 * @param current URL to be set as current
928 * @param selected list of selected items
930 void forceUrlsSelection(const QUrl
¤t
, const QList
<QUrl
> &selected
);
932 void abortTwoClicksRenaming();
934 void updatePlaceholderLabel();
936 bool tryShowNameToolTip(QHelpEvent
*event
);
939 void updatePalette();
940 void showLoadingPlaceholder();
944 bool m_assureVisibleCurrentIndex
;
945 bool m_isFolderWritable
;
946 bool m_dragging
; // True if a dragging is done. Required to be able to decide whether a
947 // tooltip may be shown when hovering an item.
948 bool m_selectNextItem
;
950 enum class LoadingState
{ Idle
, Loading
, Canceled
, Completed
};
951 LoadingState m_loadingState
= LoadingState::Idle
;
954 QString m_viewPropertiesContext
;
956 QList
<QByteArray
> m_visibleRoles
;
958 QPointer
<KIO::StatJob
> m_statJobForStatusBarText
;
960 QVBoxLayout
*m_topLayout
;
962 KFileItemModel
*m_model
;
963 DolphinItemListView
*m_view
;
964 KItemListContainer
*m_container
;
966 ToolTipManager
*m_toolTipManager
;
968 QTimer
*m_selectionChangedTimer
;
970 QUrl m_currentItemUrl
; // Used for making the view to remember the current URL after F5
971 bool m_scrollToCurrentItem
; // Used for marking we need to scroll to current item or not
972 QPoint m_restoredContentsPosition
;
974 // Used for tracking the accumulated scroll amount (for zooming with high
975 // resolution scroll wheels)
976 int m_controlWheelAccumulatedDelta
;
978 QList
<QUrl
> m_selectedUrls
; // Used for making the view to remember selections after F5 and file operations
979 bool m_clearSelectionBeforeSelectingNewItems
;
980 bool m_markFirstNewlySelectedItemAsCurrent
;
981 /// Decides whether items created by jobs should automatically be selected.
982 bool m_selectJobCreatedItems
;
984 VersionControlObserver
*m_versionControlObserver
;
986 QTimer
*m_twoClicksRenamingTimer
;
987 QUrl m_twoClicksRenamingItemUrl
;
988 QLabel
*m_placeholderLabel
;
989 QTimer
*m_showLoadingPlaceholderTimer
;
991 /// The information roleIndex of the list column header currently hovered
992 std::optional
<int> m_hoveredColumnHeaderIndex
;
994 /// Used for selection mode. @see setSelectionMode()
995 std::unique_ptr
<QProxyStyle
> m_proxyStyle
;
998 friend class TestBase
;
999 friend class DolphinDetailsViewTest
;
1000 friend class DolphinMainWindowTest
;
1001 friend class DolphinPart
; // Accesses m_model
1002 void updateSelectionState();
1005 /// Allow using DolphinView::Mode in QVariant
1006 Q_DECLARE_METATYPE(DolphinView::Mode
)
1008 #endif // DOLPHINVIEW_H