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
55 class DOLPHIN_EXPORT DolphinView
: public QWidget
61 * Defines the view mode for a directory. The
62 * view mode is automatically updated if the directory itself
63 * defines a view mode (see class ViewProperties for details).
67 * The items are shown as icons with a name-label below.
72 * The icon, the name and the size of the items are
73 * shown per default as a table.
78 * The items are shown as icons with the name-label aligned
85 * @param url Specifies the content which should be shown.
86 * @param parent Parent widget of the view.
88 DolphinView(const QUrl
&url
, QWidget
*parent
);
90 ~DolphinView() override
;
93 * Returns the current active URL, where all actions are applied.
94 * The URL navigator is synchronized with this URL.
99 * If \a active is true, the view will marked as active. The active
100 * view is defined as view where all actions are applied to.
102 void setActive(bool active
);
103 bool isActive() const;
106 * Changes the view mode for the current directory to \a mode.
107 * If the view properties should be remembered for each directory
108 * (GeneralSettings::globalViewProps() returns false), then the
109 * changed view mode will be stored automatically.
111 void setViewMode(Mode mode
);
112 Mode
viewMode() const;
115 * Enables or disables a mode for quick and easy selection of items.
117 void setSelectionModeEnabled(bool enabled
);
118 bool selectionMode() const;
121 * Turns on the file preview for the all files of the current directory,
122 * if \a show is true.
123 * If the view properties should be remembered for each directory
124 * (GeneralSettings::globalViewProps() returns false), then the
125 * preview setting will be stored automatically.
127 void setPreviewsShown(bool show
);
128 bool previewsShown() const;
131 * Shows all hidden files of the current directory,
132 * if \a show is true.
133 * If the view properties should be remembered for each directory
134 * (GeneralSettings::globalViewProps() returns false), then the
135 * show hidden file setting will be stored automatically.
137 void setHiddenFilesShown(bool show
);
138 bool hiddenFilesShown() const;
141 * Turns on sorting by groups if \a enable is true.
143 void setGroupedSorting(bool grouped
);
144 bool groupedSorting() const;
147 * Returns the items of the view.
149 KFileItemList
items() const;
152 * @return The number of items. itemsCount() is faster in comparison
153 * to items().count().
155 int itemsCount() const;
158 * Returns the selected items. The list is empty if no item has been
161 KFileItemList
selectedItems() const;
164 * Returns the number of selected items (this is faster than
165 * invoking selectedItems().count()).
167 int selectedItemsCount() const;
170 * Marks the items indicated by \p urls to get selected after the
171 * directory DolphinView::url() has been loaded. Note that nothing
172 * gets selected if no loading of a directory has been triggered
173 * by DolphinView::setUrl() or DolphinView::reload().
175 void markUrlsAsSelected(const QList
<QUrl
> &urls
);
178 * Marks the item indicated by \p url to be scrolled to and as the
179 * current item after directory DolphinView::url() has been loaded.
181 void markUrlAsCurrent(const QUrl
&url
);
184 * All items that match the regular expression \a regexp will get selected
185 * if \a enabled is true and deselected if \a enabled is false.
187 * Note that to match the whole string the pattern should be anchored:
188 * - you can anchor the pattern with QRegularExpression::anchoredPattern()
189 * - if you use QRegularExpresssion::wildcardToRegularExpression(), don't use
190 * QRegularExpression::anchoredPattern() as the former already returns an
193 void selectItems(const QRegularExpression
®exp
, bool enabled
);
196 * Sets the zoom level to \a level. It is assured that the used
197 * level is adjusted to be inside the range ZoomLevelInfo::minimumLevel() and
198 * ZoomLevelInfo::maximumLevel().
200 void setZoomLevel(int level
);
201 int zoomLevel() const;
204 * Resets the view's icon size to the default value
206 void resetZoomLevel();
209 * Updates the view properties of the current URL to the
210 * sorting given by \a role.
212 void setSortRole(const QByteArray
&role
);
213 QByteArray
sortRole() const;
216 * Updates the view properties of the current URL to the
217 * sort order given by \a order.
219 void setSortOrder(Qt::SortOrder order
);
220 Qt::SortOrder
sortOrder() const;
222 /** Sets a separate sorting with folders first (true) or a mixed sorting of files and folders (false). */
223 void setSortFoldersFirst(bool foldersFirst
);
224 bool sortFoldersFirst() const;
226 /** Sets a separate sorting with hidden files and folders last (true) or not (false). */
227 void setSortHiddenLast(bool hiddenLast
);
228 bool sortHiddenLast() const;
230 /** Sets the additional information which should be shown for the items. */
231 void setVisibleRoles(const QList
<QByteArray
> &roles
);
233 /** Returns the additional information which should be shown for the items. */
234 QList
<QByteArray
> visibleRoles() const;
237 * Refreshes the view to get synchronized with the settings (e.g. icons size,
243 * Saves the current settings (e.g. icons size, font, ..).
245 void writeSettings();
248 * Filters the currently shown items by \a nameFilter. All items
249 * which contain the given filter string will be shown.
251 void setNameFilter(const QString
&nameFilter
);
252 QString
nameFilter() const;
255 * Filters the currently shown items by \a filters. All items
256 * whose content-type matches those given by the list of filters
259 void setMimeTypeFilters(const QStringList
&filters
);
260 QStringList
mimeTypeFilters() const;
263 * Tells the view to generate an updated status bar text. The result
264 * is returned through the statusBarTextChanged(QString statusBarText) signal.
265 * It will carry a textual representation of the state of the current
266 * folder or selected items, suitable for use in the status bar.
267 * Any pending requests of status bar text are killed.
269 void requestStatusBarText();
272 * Returns the version control actions that are provided for the items \p items.
273 * Usually the actions are presented in the context menu.
275 QList
<QAction
*> versionControlActions(const KFileItemList
&items
) const;
278 * Returns the state of the paste action:
279 * first is whether the action should be enabled
280 * second is the text for the action
282 QPair
<bool, QString
> pasteInfo() const;
285 * If \a tabsForFiles is true, the signal tabRequested() will also
286 * emitted also for files. Per default tabs for files is disabled
287 * and hence the signal tabRequested() will only be emitted for
290 void setTabsForFilesEnabled(bool tabsForFiles
);
291 bool isTabsForFilesEnabled() const;
294 * Returns true if the current view allows folders to be expanded,
295 * i.e. presents a hierarchical view to the user.
297 bool itemsExpandable() const;
300 * @returns true if the @p item is one of the items() of this view and
301 * is currently expanded. false otherwise.
302 * Only directories in view modes that allow expanding can ever be expanded.
304 bool isExpanded(const KFileItem
&item
) const;
307 * Restores the view state (current item, contents position, details view expansion state)
309 void restoreState(QDataStream
&stream
);
312 * Saves the view state (current item, contents position, details view expansion state)
314 void saveState(QDataStream
&stream
);
317 * Returns the root item which represents the current URL.
319 KFileItem
rootItem() const;
322 * Sets a context that is used for remembering the view-properties.
323 * Per default the context is empty and the path of the currently set URL
324 * is used for remembering the view-properties. Setting a custom context
325 * makes sense if specific types of URLs (e.g. search-URLs) should
326 * share common view-properties.
328 void setViewPropertiesContext(const QString
&context
);
329 QString
viewPropertiesContext() const;
332 * Checks if the given \a item can be opened as folder (e.g. archives).
333 * This function will also adjust the \a url (e.g. change the protocol).
334 * @return a valid and adjusted url if the item can be opened as folder,
335 * otherwise return an empty url.
337 static QUrl
openItemAsFolderUrl(const KFileItem
&item
, const bool browseThroughArchives
= true);
340 * Hides tooltip displayed over element.
342 void hideToolTip(const ToolTipManager::HideBehavior behavior
= ToolTipManager::HideBehavior::Later
);
345 * Check if the space key should be handled as a normal key, even if it's
346 * used as a keyboard shortcut.
350 bool handleSpaceAsNormalKey() const;
352 /** Activates the view if the item list container gets focus. */
353 bool eventFilter(QObject
*watched
, QEvent
*event
) override
;
356 * Returns whether the folder represented by the current URL is writable.
358 bool isFolderWritable() const;
361 * @returns the height of the scrollbar at the bottom of the view or zero if no such scroll bar is visible.
363 int horizontalScrollBarHeight() const;
366 * Set the offset for any view items that small statusbar would otherwise
367 * cover. For example, in compact view this is used to make sure no
368 * item is covered by statusbar.
370 void setStatusBarOffset(int offset
);
377 * Changes the directory to \a url. If the current directory is equal to
378 * \a url, nothing will be done (use DolphinView::reload() instead).
380 void setUrl(const QUrl
&url
);
384 * @see DolphinView::selectedItems()
389 * Inverts the current selection: selected items get unselected,
390 * unselected items get selected.
391 * @see DolphinView::selectedItems()
393 void invertSelection();
395 void clearSelection();
398 * Triggers the renaming of the currently selected items, where
399 * the user must input a new name for the items.
401 void renameSelectedItems();
404 * Moves all selected items to the trash.
406 void trashSelectedItems();
409 * Deletes all selected items.
411 void deleteSelectedItems();
414 * Copies all selected items to the clipboard and marks
417 void cutSelectedItemsToClipboard();
419 /** Copies all selected items to the clipboard. */
420 void copySelectedItemsToClipboard();
423 * Copies all selected items to @p destinationUrl.
425 void copySelectedItems(const KFileItemList
&selection
, const QUrl
&destinationUrl
);
428 * Moves all selected items to @p destinationUrl.
430 void moveSelectedItems(const KFileItemList
&selection
, const QUrl
&destinationUrl
);
432 /** Pastes the clipboard data to this view. */
436 * Pastes the clipboard data into the currently selected
437 * folder. If the current selection is not exactly one folder, no
438 * paste operation is done.
440 void pasteIntoFolder();
443 * Copies the path of the first selected KFileItem into Clipboard.
445 void copyPathToClipboard();
448 * Creates duplicates of selected items, appending "copy"
451 void duplicateSelectedItems();
454 * Handles a drop of @p dropEvent onto widget @p dropWidget and destination @p destUrl
456 void dropUrls(const QUrl
&destUrl
, QDropEvent
*dropEvent
, QWidget
*dropWidget
);
461 * Applies the state that has been restored by restoreViewState()
464 void updateViewState();
468 * Is emitted if the view has been activated by e. g. a mouse click.
472 /** Is emitted if the URL of the view has been changed to \a url. */
473 void urlChanged(const QUrl
&url
);
476 * Is emitted when clicking on an item with the left mouse button.
478 void itemActivated(const KFileItem
&item
);
481 * Is emitted when clicking on a file with the middle mouse button.
482 * @note: This will not be emitted for folders or file archives that will/can be opened like folders.
484 void fileMiddleClickActivated(const KFileItem
&item
);
487 * Is emitted when multiple items have been activated by e. g.
488 * context menu open with.
490 void itemsActivated(const KFileItemList
&items
);
493 * Is emitted if items have been added or deleted.
495 void itemCountChanged();
498 * Is emitted if a new tab should be opened for the URL \a url.
500 void tabRequested(const QUrl
&url
);
503 * Is emitted if a new tab should be opened for the URL \a url and set as active.
505 void activeTabRequested(const QUrl
&url
);
508 * Is emitted if a new window should be opened for the URL \a url.
510 void windowRequested(const QUrl
&url
);
513 * Is emitted if the view mode (IconsView, DetailsView,
514 * PreviewsView) has been changed.
516 void modeChanged(DolphinView::Mode current
, DolphinView::Mode previous
);
518 /** Is emitted if the 'show preview' property has been changed. */
519 void previewsShownChanged(bool shown
);
521 /** Is emitted if the 'show hidden files' property has been changed. */
522 void hiddenFilesShownChanged(bool shown
);
524 /** Is emitted if the 'grouped sorting' property has been changed. */
525 void groupedSortingChanged(bool groupedSorting
);
527 /** Is emitted in reaction to a requestStatusBarText() call.
528 * @see requestStatusBarText() */
529 void statusBarTextChanged(QString statusBarText
);
531 /** Is emitted if the sorting by name, size or date has been changed. */
532 void sortRoleChanged(const QByteArray
&role
);
534 /** Is emitted if the sort order (ascending or descending) has been changed. */
535 void sortOrderChanged(Qt::SortOrder order
);
538 * Is emitted if the sorting of files and folders (separate with folders
539 * first or mixed) has been changed.
541 void sortFoldersFirstChanged(bool foldersFirst
);
544 * Is emitted if the sorting of hidden files has been changed.
546 void sortHiddenLastChanged(bool hiddenLast
);
548 /** Is emitted if the additional information shown for this view has been changed. */
549 void visibleRolesChanged(const QList
<QByteArray
> ¤t
, const QList
<QByteArray
> &previous
);
551 /** Is emitted if the zoom level has been changed by zooming in or out. */
552 void zoomLevelChanged(int current
, int previous
);
555 * Is emitted if information of an item is requested to be shown e. g. in the panel.
556 * If item is null, no item information request is pending.
558 void requestItemInfo(const KFileItem
&item
);
561 * Is emitted whenever the selection has been changed.
563 void selectionChanged(const KFileItemList
&selection
);
566 * Is emitted if a context menu is requested for the item \a item,
567 * which is part of \a url. If the item is null, the context menu
568 * for the URL should be shown.
570 void requestContextMenu(const QPoint
&pos
, const KFileItem
&item
, const KFileItemList
&selectedItems
, const QUrl
&url
);
573 * Is emitted if an information message with the content \a msg
576 void infoMessage(const QString
&msg
);
579 * Is emitted if an error message with the content \a msg
582 void errorMessage(const QString
&message
, const int kioErrorCode
);
585 * Is emitted if an "operation completed" message with the content \a msg
588 void operationCompletedMessage(const QString
&msg
);
591 * Is emitted after DolphinView::setUrl() has been invoked and
592 * the current directory is loaded. If this signal is emitted,
593 * it is assured that the view contains already the correct root
594 * URL and property settings.
596 void directoryLoadingStarted();
599 * Is emitted after the directory triggered by DolphinView::setUrl()
602 void directoryLoadingCompleted();
605 * Is emitted after the directory loading triggered by DolphinView::setUrl()
608 void directoryLoadingCanceled();
611 * Is emitted after DolphinView::setUrl() has been invoked and provides
612 * the information how much percent of the current directory have been loaded.
614 void directoryLoadingProgress(int percent
);
617 * Is emitted if the sorting is done asynchronously and provides the
618 * progress information of the sorting.
620 void directorySortingProgress(int percent
);
623 * Emitted when the file-item-model emits redirection.
624 * Testcase: fish://localhost
626 void redirection(const QUrl
&oldUrl
, const QUrl
&newUrl
);
629 * Is emitted when the URL set by DolphinView::setUrl() represents a file.
630 * In this case no signal errorMessage() will be emitted.
632 void urlIsFileError(const QUrl
&url
);
635 * Is emitted when the write state of the folder has been changed. The application
636 * should disable all actions like "Create New..." that depend on the write
639 void writeStateChanged(bool isFolderWritable
);
642 * Is emitted if the URL should be changed to the previous URL of the
643 * history (e.g. because the "back"-mousebutton has been pressed).
645 void goBackRequested();
648 * Is emitted if the URL should be changed to the next URL of the
649 * history (e.g. because the "next"-mousebutton has been pressed).
651 void goForwardRequested();
654 * Used to request either entering or leaving of selection mode
655 * Entering is typically requested on press and hold.
656 * Leaving by pressing Escape when no item is selected.
658 void selectionModeChangeRequested(bool enabled
);
661 * Is emitted when the user wants to move the focus to another view.
663 void toggleActiveViewRequested();
666 * Is emitted when the user clicks a tag or a link
667 * in the metadata widget of a tooltip.
669 void urlActivated(const QUrl
&url
);
671 void goUpRequested();
673 void fileItemsChanged(const KFileItemList
&changedFileItems
);
676 * Emitted when the current directory of the model was removed.
678 void currentDirectoryRemoved();
681 * Emitted when the view's background is double-clicked.
682 * Used to trigger an user configured action.
684 void doubleClickViewBackground(Qt::MouseButton button
);
687 /** Changes the zoom level if Control is pressed during a wheel event. */
688 void wheelEvent(QWheelEvent
*event
) override
;
690 void hideEvent(QHideEvent
*event
) override
;
691 bool event(QEvent
*event
) override
;
695 * Marks the view as active (DolphinView:isActive() will return true)
696 * and emits the 'activated' signal if it is not already active.
700 void slotItemActivated(int index
);
701 void slotItemsActivated(const KItemSet
&indexes
);
702 void slotItemMiddleClicked(int index
);
703 void slotItemContextMenuRequested(int index
, const QPointF
&pos
);
704 void slotViewContextMenuRequested(const QPointF
&pos
);
705 void slotHeaderContextMenuRequested(const QPointF
&pos
);
706 void slotHeaderColumnWidthChangeFinished(const QByteArray
&role
, qreal current
);
707 void slotSidePaddingWidthChanged(qreal leftPaddingWidth
, qreal rightPaddingWidth
);
708 void slotItemHovered(int index
);
709 void slotItemUnhovered(int index
);
710 void slotItemDropEvent(int index
, QGraphicsSceneDragDropEvent
*event
);
711 void slotModelChanged(KItemModelBase
*current
, KItemModelBase
*previous
);
712 void slotMouseButtonPressed(int itemIndex
, Qt::MouseButtons buttons
);
713 void slotSelectedItemTextPressed(int index
);
714 void slotItemCreatedFromJob(KIO::Job
*, const QUrl
&, const QUrl
&to
);
715 void slotItemLinkCreatedFromJob(KIO::Job
*, const QUrl
&, const QString
&, const QUrl
&to
);
716 void slotIncreaseZoom();
717 void slotDecreaseZoom();
721 * Is called when new items get pasted or dropped.
723 void slotItemCreated(const QUrl
&url
);
725 * Is called after all pasted or dropped items have been copied to destination.
727 void slotJobResult(KJob
*job
);
730 * Emits the signal \a selectionChanged() with a small delay. This is
731 * because getting all file items for the selection can be an expensive
732 * operation. Fast selection changes are collected in this case and
733 * the signal is emitted only after no selection change has been done
734 * within a small delay.
736 void slotSelectionChanged(const KItemSet
¤t
, const KItemSet
&previous
);
739 * Is called by emitDelayedSelectionChangedSignal() and emits the
740 * signal \a selectionChanged() with all selected file items as parameter.
742 void emitSelectionChangedSignal();
745 * Helper method for DolphinView::requestStatusBarText().
746 * Calculates the amount of folders and files and their total size in
747 * response to a KStatJob::result(), then calls emitStatusBarText().
748 * @see requestStatusBarText()
749 * @see emitStatusBarText()
751 void slotStatJobResult(KJob
*job
);
754 * Updates the view properties of the current URL to the
755 * sorting of files and folders (separate with folders first or mixed) given by \a foldersFirst.
757 void updateSortFoldersFirst(bool foldersFirst
);
760 * Updates the view properties of the current URL to the
761 * sorting of hidden files given by \a hiddenLast.
763 void updateSortHiddenLast(bool hiddenLast
);
766 * Indicates in the status bar that the delete operation
767 * of the job \a job has been finished.
769 void slotDeleteFileFinished(KJob
*job
);
772 * Indicates in the status bar that the trash operation
773 * of the job \a job has been finished.
775 void slotTrashFileFinished(KJob
*job
);
778 * Invoked when the rename job is done, for error handling.
780 void slotRenamingResult(KJob
*job
);
783 * Invoked when the file item model has started the loading
784 * of the directory specified by DolphinView::url().
786 void slotDirectoryLoadingStarted();
789 * Invoked when the file item model indicates that the loading of a directory has
790 * been completed. Assures that pasted items and renamed items get selected.
792 void slotDirectoryLoadingCompleted();
795 * Invoked when the file item model indicates that the loading of a directory has
798 void slotDirectoryLoadingCanceled();
801 * Is invoked when items of KFileItemModel have been changed.
803 void slotItemsChanged();
806 * Is invoked when the sort order has been changed by the user by clicking
807 * on a header item. The view properties of the directory will get updated.
809 void slotSortOrderChangedByHeader(Qt::SortOrder current
, Qt::SortOrder previous
);
812 * Is invoked when the sort role has been changed by the user by clicking
813 * on a header item. The view properties of the directory will get updated.
815 void slotSortRoleChangedByHeader(const QByteArray
¤t
, const QByteArray
&previous
);
818 * Is invoked when the visible roles have been changed by the user by dragging
819 * a header item. The view properties of the directory will get updated.
821 void slotVisibleRolesChangedByHeader(const QList
<QByteArray
> ¤t
, const QList
<QByteArray
> &previous
);
823 void slotRoleEditingCanceled();
824 void slotRoleEditingFinished(int index
, const QByteArray
&role
, const QVariant
&value
);
827 * Observes the item with the URL \a url. As soon as the directory
828 * model indicates that the item is available, the item will
829 * get selected and it is assured that the item stays visible.
831 void observeCreatedItem(const QUrl
&url
);
834 * Selects the next item after prev selection deleted/trashed
836 void selectNextItem();
839 * Called when a redirection happens.
840 * Testcase: fish://localhost
842 void slotDirectoryRedirection(const QUrl
&oldUrl
, const QUrl
&newUrl
);
844 void slotTwoClicksRenamingTimerTimeout();
846 void onDirectoryLoadingCompletedAfterJob();
849 void loadDirectory(const QUrl
&url
, bool reload
= false);
852 * Applies the view properties which are defined by the current URL
853 * to the DolphinView properties. The view properties are read from a
854 * .directory file either in the current directory, or in the
855 * share/apps/dolphin/view_properties/ subfolder of the user's .kde folder.
857 void applyViewProperties();
860 * Applies the given view properties to the DolphinView.
862 void applyViewProperties(const ViewProperties
&props
);
865 * Applies the m_mode property to the corresponding
866 * itemlayout-property of the KItemListView.
868 void applyModeToView();
870 enum Selection
{ HasSelection
, NoSelection
};
872 * Helper method for DolphinView::requestStatusBarText().
873 * Generates the status bar text from the parameters and
874 * then emits statusBarTextChanged().
875 * @param totalFileSize the sum of the sizes of the files
876 * @param selection if HasSelection is passed, the emitted status bar text will say
877 * that the folders and files which are counted here are selected.
879 void emitStatusBarText(const int folderCount
, const int fileCount
, KIO::filesize_t totalFileSize
, const Selection selection
);
882 * Helper method for DolphinView::paste() and DolphinView::pasteIntoFolder().
883 * Pastes the clipboard data into the URL \a url.
885 void pasteToUrl(const QUrl
&url
);
888 * Returns a list of URLs for all selected items. The list is
889 * simplified, so that when the URLs are part of different tree
890 * levels, only the parent is returned.
892 QList
<QUrl
> simplifiedSelectedUrls() const;
895 * Returns the MIME data for all selected items.
897 QMimeData
*selectionMimeData() const;
900 * Updates m_isFolderWritable dependent on whether the folder represented by
901 * the current URL is writable. If the state has changed, the signal
902 * writeStateChanged() will be emitted.
904 void updateWritableState();
907 * @return The current URL if no viewproperties-context is given (see
908 * DolphinView::viewPropertiesContext(), otherwise the context
911 QUrl
viewPropertiesUrl() const;
914 * Clears the selection and updates current item and selection according to the parameters
916 * @param current URL to be set as current
917 * @param selected list of selected items
919 void forceUrlsSelection(const QUrl
¤t
, const QList
<QUrl
> &selected
);
921 void abortTwoClicksRenaming();
923 void updatePlaceholderLabel();
925 bool tryShowNameToolTip(QHelpEvent
*event
);
928 void updatePalette();
929 void showLoadingPlaceholder();
933 bool m_assureVisibleCurrentIndex
;
934 bool m_isFolderWritable
;
935 bool m_dragging
; // True if a dragging is done. Required to be able to decide whether a
936 // tooltip may be shown when hovering an item.
937 bool m_selectNextItem
;
939 enum class LoadingState
{ Idle
, Loading
, Canceled
, Completed
};
940 LoadingState m_loadingState
= LoadingState::Idle
;
943 QString m_viewPropertiesContext
;
945 QList
<QByteArray
> m_visibleRoles
;
947 QPointer
<KIO::StatJob
> m_statJobForStatusBarText
;
949 QVBoxLayout
*m_topLayout
;
951 KFileItemModel
*m_model
;
952 DolphinItemListView
*m_view
;
953 KItemListContainer
*m_container
;
955 ToolTipManager
*m_toolTipManager
;
957 QTimer
*m_selectionChangedTimer
;
959 QUrl m_currentItemUrl
; // Used for making the view to remember the current URL after F5
960 bool m_scrollToCurrentItem
; // Used for marking we need to scroll to current item or not
961 QPoint m_restoredContentsPosition
;
963 // Used for tracking the accumulated scroll amount (for zooming with high
964 // resolution scroll wheels)
965 int m_controlWheelAccumulatedDelta
;
967 QList
<QUrl
> m_selectedUrls
; // Used for making the view to remember selections after F5 and file operations
968 bool m_clearSelectionBeforeSelectingNewItems
;
969 bool m_markFirstNewlySelectedItemAsCurrent
;
970 /// Decides whether items created by jobs should automatically be selected.
971 bool m_selectJobCreatedItems
;
973 VersionControlObserver
*m_versionControlObserver
;
975 QTimer
*m_twoClicksRenamingTimer
;
976 QUrl m_twoClicksRenamingItemUrl
;
977 QLabel
*m_placeholderLabel
;
978 QTimer
*m_showLoadingPlaceholderTimer
;
980 /// The information roleIndex of the list column header currently hovered
981 std::optional
<int> m_hoveredColumnHeaderIndex
;
983 /// Used for selection mode. @see setSelectionMode()
984 std::unique_ptr
<QProxyStyle
> m_proxyStyle
;
987 friend class TestBase
;
988 friend class DolphinDetailsViewTest
;
989 friend class DolphinMainWindowTest
;
990 friend class DolphinPart
; // Accesses m_model
991 void updateSelectionState();
994 /// Allow using DolphinView::Mode in QVariant
995 Q_DECLARE_METATYPE(DolphinView::Mode
)
997 #endif // DOLPHINVIEW_H