]> cloud.milkyroute.net Git - dolphin.git/blob - src/views/dolphinview.h
Merge branch 'release/20.12'
[dolphin.git] / src / views / dolphinview.h
1 /*
2 * SPDX-FileCopyrightText: 2006-2009 Peter Penz <peter.penz19@gmail.com>
3 * SPDX-FileCopyrightText: 2006 Gregor Kališnik <gregor@podnapisi.net>
4 *
5 * SPDX-License-Identifier: GPL-2.0-or-later
6 */
7
8 #ifndef DOLPHINVIEW_H
9 #define DOLPHINVIEW_H
10
11 #include "dolphintabwidget.h"
12 #include "dolphin_export.h"
13 #include "tooltips/tooltipmanager.h"
14
15 #include <KFileItem>
16 #include <KIO/Job>
17 #include <config-baloo.h>
18 #include <kio/fileundomanager.h>
19 #include <kparts/part.h>
20
21 #include <QMimeData>
22 #include <QUrl>
23 #include <QWidget>
24
25 typedef KIO::FileUndoManager::CommandType CommandType;
26 class QVBoxLayout;
27 class DolphinItemListView;
28 class KFileItemModel;
29 class KItemListContainer;
30 class KItemModelBase;
31 class KItemSet;
32 class ToolTipManager;
33 class VersionControlObserver;
34 class ViewProperties;
35 class QLabel;
36 class QGraphicsSceneDragDropEvent;
37 class QRegularExpression;
38
39 /**
40 * @short Represents a view for the directory content.
41 *
42 * View modes for icons, compact and details are supported. It's
43 * possible to adjust:
44 * - sort order
45 * - sort type
46 * - show hidden files
47 * - show previews
48 * - enable grouping
49 */
50 class DOLPHIN_EXPORT DolphinView : public QWidget
51 {
52 Q_OBJECT
53
54 public:
55 /**
56 * Defines the view mode for a directory. The
57 * view mode is automatically updated if the directory itself
58 * defines a view mode (see class ViewProperties for details).
59 */
60 enum Mode
61 {
62 /**
63 * The items are shown as icons with a name-label below.
64 */
65 IconsView = 0,
66
67 /**
68 * The icon, the name and the size of the items are
69 * shown per default as a table.
70 */
71 DetailsView,
72
73 /**
74 * The items are shown as icons with the name-label aligned
75 * to the right side.
76 */
77 CompactView
78 };
79
80 /**
81 * @param url Specifies the content which should be shown.
82 * @param parent Parent widget of the view.
83 */
84 DolphinView(const QUrl& url, QWidget* parent);
85
86 ~DolphinView() override;
87
88 /**
89 * Returns the current active URL, where all actions are applied.
90 * The URL navigator is synchronized with this URL.
91 */
92 QUrl url() const;
93
94 /**
95 * If \a active is true, the view will marked as active. The active
96 * view is defined as view where all actions are applied to.
97 */
98 void setActive(bool active);
99 bool isActive() const;
100
101 /**
102 * Changes the view mode for the current directory to \a mode.
103 * If the view properties should be remembered for each directory
104 * (GeneralSettings::globalViewProps() returns false), then the
105 * changed view mode will be stored automatically.
106 */
107 void setMode(Mode mode);
108 Mode mode() const;
109
110 /**
111 * Turns on the file preview for the all files of the current directory,
112 * if \a show is true.
113 * If the view properties should be remembered for each directory
114 * (GeneralSettings::globalViewProps() returns false), then the
115 * preview setting will be stored automatically.
116 */
117 void setPreviewsShown(bool show);
118 bool previewsShown() const;
119
120 /**
121 * Shows all hidden 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 * show hidden file setting will be stored automatically.
126 */
127 void setHiddenFilesShown(bool show);
128 bool hiddenFilesShown() const;
129
130 /**
131 * Turns on sorting by groups if \a enable is true.
132 */
133 void setGroupedSorting(bool grouped);
134 bool groupedSorting() const;
135
136 /**
137 * Returns the items of the view.
138 */
139 KFileItemList items() const;
140
141 /**
142 * @return The number of items. itemsCount() is faster in comparison
143 * to items().count().
144 */
145 int itemsCount() const;
146
147 /**
148 * Returns the selected items. The list is empty if no item has been
149 * selected.
150 */
151 KFileItemList selectedItems() const;
152
153 /**
154 * Returns the number of selected items (this is faster than
155 * invoking selectedItems().count()).
156 */
157 int selectedItemsCount() const;
158
159 /**
160 * Marks the items indicated by \p urls to get selected after the
161 * directory DolphinView::url() has been loaded. Note that nothing
162 * gets selected if no loading of a directory has been triggered
163 * by DolphinView::setUrl() or DolphinView::reload().
164 */
165 void markUrlsAsSelected(const QList<QUrl> &urls);
166
167 /**
168 * Marks the item indicated by \p url to be scrolled to and as the
169 * current item after directory DolphinView::url() has been loaded.
170 */
171 void markUrlAsCurrent(const QUrl& url);
172
173 /**
174 * All items that match the regular expression \a regexp will get selected
175 * if \a enabled is true and deselected if \a enabled is false.
176 *
177 * Note that to match the whole string the pattern should be anchored:
178 * - you can anchor the pattern with QRegularExpression::anchoredPattern()
179 * - if you use QRegularExpresssion::wildcardToRegularExpression(), don't use
180 * QRegularExpression::anchoredPattern() as the former already returns an
181 * anchored pattern
182 */
183 void selectItems(const QRegularExpression &regexp, bool enabled);
184
185 /**
186 * Sets the zoom level to \a level. It is assured that the used
187 * level is adjusted to be inside the range ZoomLevelInfo::minimumLevel() and
188 * ZoomLevelInfo::maximumLevel().
189 */
190 void setZoomLevel(int level);
191 int zoomLevel() const;
192
193 /**
194 * Resets the view's icon size to the default value
195 */
196 void resetZoomLevel();
197
198 void setSortRole(const QByteArray& role);
199 QByteArray sortRole() const;
200
201 void setSortOrder(Qt::SortOrder order);
202 Qt::SortOrder sortOrder() const;
203
204 /** Sets a separate sorting with folders first (true) or a mixed sorting of files and folders (false). */
205 void setSortFoldersFirst(bool foldersFirst);
206 bool sortFoldersFirst() const;
207
208 /** Sets the additional information which should be shown for the items. */
209 void setVisibleRoles(const QList<QByteArray>& roles);
210
211 /** Returns the additional information which should be shown for the items. */
212 QList<QByteArray> visibleRoles() const;
213
214 void reload();
215
216 /**
217 * Refreshes the view to get synchronized with the settings (e.g. icons size,
218 * font, ...).
219 */
220 void readSettings();
221
222 /**
223 * Saves the current settings (e.g. icons size, font, ..).
224 */
225 void writeSettings();
226
227 /**
228 * Filters the currently shown items by \a nameFilter. All items
229 * which contain the given filter string will be shown.
230 */
231 void setNameFilter(const QString& nameFilter);
232 QString nameFilter() const;
233
234 /**
235 * Filters the currently shown items by \a filters. All items
236 * whose content-type matches those given by the list of filters
237 * will be shown.
238 */
239 void setMimeTypeFilters(const QStringList& filters);
240 QStringList mimeTypeFilters() const;
241
242 /**
243 * Returns a textual representation of the state of the current
244 * folder or selected items, suitable for use in the status bar.
245 */
246 QString statusBarText() const;
247
248 /**
249 * Returns the version control actions that are provided for the items \p items.
250 * Usually the actions are presented in the context menu.
251 */
252 QList<QAction*> versionControlActions(const KFileItemList& items) const;
253
254 /**
255 * Returns the state of the paste action:
256 * first is whether the action should be enabled
257 * second is the text for the action
258 */
259 QPair<bool, QString> pasteInfo() const;
260
261 /**
262 * If \a tabsForFiles is true, the signal tabRequested() will also
263 * emitted also for files. Per default tabs for files is disabled
264 * and hence the signal tabRequested() will only be emitted for
265 * directories.
266 */
267 void setTabsForFilesEnabled(bool tabsForFiles);
268 bool isTabsForFilesEnabled() const;
269
270 /**
271 * Returns true if the current view allows folders to be expanded,
272 * i.e. presents a hierarchical view to the user.
273 */
274 bool itemsExpandable() const;
275
276 /**
277 * Restores the view state (current item, contents position, details view expansion state)
278 */
279 void restoreState(QDataStream& stream);
280
281 /**
282 * Saves the view state (current item, contents position, details view expansion state)
283 */
284 void saveState(QDataStream& stream);
285
286 /**
287 * Returns the root item which represents the current URL.
288 */
289 KFileItem rootItem() const;
290
291 /**
292 * Sets a context that is used for remembering the view-properties.
293 * Per default the context is empty and the path of the currently set URL
294 * is used for remembering the view-properties. Setting a custom context
295 * makes sense if specific types of URLs (e.g. search-URLs) should
296 * share common view-properties.
297 */
298 void setViewPropertiesContext(const QString& context);
299 QString viewPropertiesContext() const;
300
301 /**
302 * Checks if the given \a item can be opened as folder (e.g. archives).
303 * This function will also adjust the \a url (e.g. change the protocol).
304 * @return a valid and adjusted url if the item can be opened as folder,
305 * otherwise return an empty url.
306 */
307 static QUrl openItemAsFolderUrl(const KFileItem& item, const bool browseThroughArchives = true);
308
309 /**
310 * Hides tooltip displayed over element.
311 */
312 void hideToolTip(const ToolTipManager::HideBehavior behavior = ToolTipManager::HideBehavior::Later);
313
314 public slots:
315 /**
316 * Changes the directory to \a url. If the current directory is equal to
317 * \a url, nothing will be done (use DolphinView::reload() instead).
318 */
319 void setUrl(const QUrl& url);
320
321 /**
322 * Selects all items.
323 * @see DolphinView::selectedItems()
324 */
325 void selectAll();
326
327 /**
328 * Inverts the current selection: selected items get unselected,
329 * unselected items get selected.
330 * @see DolphinView::selectedItems()
331 */
332 void invertSelection();
333
334 void clearSelection();
335
336 /**
337 * Triggers the renaming of the currently selected items, where
338 * the user must input a new name for the items.
339 */
340 void renameSelectedItems();
341
342 /**
343 * Moves all selected items to the trash.
344 */
345 void trashSelectedItems();
346
347 /**
348 * Deletes all selected items.
349 */
350 void deleteSelectedItems();
351
352 /**
353 * Copies all selected items to the clipboard and marks
354 * the items as cut.
355 */
356 void cutSelectedItemsToClipboard();
357
358 /** Copies all selected items to the clipboard. */
359 void copySelectedItemsToClipboard();
360
361 /**
362 * Copies all selected items to @p destinationUrl.
363 */
364 void copySelectedItems(const KFileItemList &selection, const QUrl &destinationUrl);
365
366 /**
367 * Moves all selected items to @p destinationUrl.
368 */
369 void moveSelectedItems(const KFileItemList &selection, const QUrl &destinationUrl);
370
371 /** Pastes the clipboard data to this view. */
372 void paste();
373
374 /**
375 * Pastes the clipboard data into the currently selected
376 * folder. If the current selection is not exactly one folder, no
377 * paste operation is done.
378 */
379 void pasteIntoFolder();
380
381 /**
382 * Copies the path of the first selected KFileItem into Clipboard.
383 */
384 void copyPathToClipboard();
385
386 /**
387 * Creates duplicates of selected items, appending "copy"
388 * to the end.
389 */
390 void duplicateSelectedItems();
391
392 /**
393 * Handles a drop of @p dropEvent onto widget @p dropWidget and destination @p destUrl
394 */
395 void dropUrls(const QUrl &destUrl, QDropEvent *dropEvent, QWidget *dropWidget);
396
397 void stopLoading();
398
399 /**
400 * Applies the state that has been restored by restoreViewState()
401 * to the view.
402 */
403 void updateViewState();
404
405 /** Activates the view if the item list container gets focus. */
406 bool eventFilter(QObject* watched, QEvent* event) override;
407
408 signals:
409 /**
410 * Is emitted if the view has been activated by e. g. a mouse click.
411 */
412 void activated();
413
414 /** Is emitted if the URL of the view has been changed to \a url. */
415 void urlChanged(const QUrl& url);
416
417 /**
418 * Is emitted when clicking on an item with the left mouse button.
419 */
420 void itemActivated(const KFileItem& item);
421
422 /**
423 * Is emitted when multiple items have been activated by e. g.
424 * context menu open with.
425 */
426 void itemsActivated(const KFileItemList& items);
427
428 /**
429 * Is emitted if items have been added or deleted.
430 */
431 void itemCountChanged();
432
433 /**
434 * Is emitted if a new tab should be opened for the URL \a url.
435 */
436 void tabRequested(const QUrl& url, DolphinTabWidget::TabPlacement tabPlacement);
437
438 /**
439 * Is emitted if the view mode (IconsView, DetailsView,
440 * PreviewsView) has been changed.
441 */
442 void modeChanged(DolphinView::Mode current, DolphinView::Mode previous);
443
444 /** Is emitted if the 'show preview' property has been changed. */
445 void previewsShownChanged(bool shown);
446
447 /** Is emitted if the 'show hidden files' property has been changed. */
448 void hiddenFilesShownChanged(bool shown);
449
450 /** Is emitted if the 'grouped sorting' property has been changed. */
451 void groupedSortingChanged(bool groupedSorting);
452
453 /** Is emitted if the sorting by name, size or date has been changed. */
454 void sortRoleChanged(const QByteArray& role);
455
456 /** Is emitted if the sort order (ascending or descending) has been changed. */
457 void sortOrderChanged(Qt::SortOrder order);
458
459 /**
460 * Is emitted if the sorting of files and folders (separate with folders
461 * first or mixed) has been changed.
462 */
463 void sortFoldersFirstChanged(bool foldersFirst);
464
465 /** Is emitted if the additional information shown for this view has been changed. */
466 void visibleRolesChanged(const QList<QByteArray>& current,
467 const QList<QByteArray>& previous);
468
469 /** Is emitted if the zoom level has been changed by zooming in or out. */
470 void zoomLevelChanged(int current, int previous);
471
472 /**
473 * Is emitted if information of an item is requested to be shown e. g. in the panel.
474 * If item is null, no item information request is pending.
475 */
476 void requestItemInfo(const KFileItem& item);
477
478 /**
479 * Is emitted whenever the selection has been changed.
480 */
481 void selectionChanged(const KFileItemList& selection);
482
483 /**
484 * Is emitted if a context menu is requested for the item \a item,
485 * which is part of \a url. If the item is null, the context menu
486 * for the URL should be shown and the custom actions \a customActions
487 * will be added.
488 */
489 void requestContextMenu(const QPoint& pos,
490 const KFileItem& item,
491 const QUrl& url,
492 const QList<QAction*>& customActions);
493
494 /**
495 * Is emitted if an information message with the content \a msg
496 * should be shown.
497 */
498 void infoMessage(const QString& msg);
499
500 /**
501 * Is emitted if an error message with the content \a msg
502 * should be shown.
503 */
504 void errorMessage(const QString& msg);
505
506 /**
507 * Is emitted if an "operation completed" message with the content \a msg
508 * should be shown.
509 */
510 void operationCompletedMessage(const QString& msg);
511
512 /**
513 * Is emitted after DolphinView::setUrl() has been invoked and
514 * the current directory is loaded. If this signal is emitted,
515 * it is assured that the view contains already the correct root
516 * URL and property settings.
517 */
518 void directoryLoadingStarted();
519
520 /**
521 * Is emitted after the directory triggered by DolphinView::setUrl()
522 * has been loaded.
523 */
524 void directoryLoadingCompleted();
525
526 /**
527 * Is emitted after the directory loading triggered by DolphinView::setUrl()
528 * has been canceled.
529 */
530 void directoryLoadingCanceled();
531
532 /**
533 * Is emitted after DolphinView::setUrl() has been invoked and provides
534 * the information how much percent of the current directory have been loaded.
535 */
536 void directoryLoadingProgress(int percent);
537
538 /**
539 * Is emitted if the sorting is done asynchronously and provides the
540 * progress information of the sorting.
541 */
542 void directorySortingProgress(int percent);
543
544 /**
545 * Emitted when the file-item-model emits redirection.
546 * Testcase: fish://localhost
547 */
548 void redirection(const QUrl& oldUrl, const QUrl& newUrl);
549
550 /**
551 * Is emitted when the URL set by DolphinView::setUrl() represents a file.
552 * In this case no signal errorMessage() will be emitted.
553 */
554 void urlIsFileError(const QUrl& url);
555
556 /**
557 * Is emitted when the write state of the folder has been changed. The application
558 * should disable all actions like "Create New..." that depend on the write
559 * state.
560 */
561 void writeStateChanged(bool isFolderWritable);
562
563 /**
564 * Is emitted if the URL should be changed to the previous URL of the
565 * history (e.g. because the "back"-mousebutton has been pressed).
566 */
567 void goBackRequested();
568
569 /**
570 * Is emitted if the URL should be changed to the next URL of the
571 * history (e.g. because the "next"-mousebutton has been pressed).
572 */
573 void goForwardRequested();
574
575 /**
576 * Is emitted when the user wants to move the focus to another view.
577 */
578 void toggleActiveViewRequested();
579
580 /**
581 * Is emitted when the user clicks a tag or a link
582 * in the metadata widget of a tooltip.
583 */
584 void urlActivated(const QUrl& url);
585
586 void goUpRequested();
587
588 protected:
589 /** Changes the zoom level if Control is pressed during a wheel event. */
590 void wheelEvent(QWheelEvent* event) override;
591
592 void hideEvent(QHideEvent* event) override;
593 bool event(QEvent* event) override;
594
595 private slots:
596 /**
597 * Marks the view as active (DolphinView:isActive() will return true)
598 * and emits the 'activated' signal if it is not already active.
599 */
600 void activate();
601
602 void slotItemActivated(int index);
603 void slotItemsActivated(const KItemSet& indexes);
604 void slotItemMiddleClicked(int index);
605 void slotItemContextMenuRequested(int index, const QPointF& pos);
606 void slotViewContextMenuRequested(const QPointF& pos);
607 void slotHeaderContextMenuRequested(const QPointF& pos);
608 void slotHeaderColumnWidthChangeFinished(const QByteArray& role, qreal current);
609 void slotItemHovered(int index);
610 void slotItemUnhovered(int index);
611 void slotItemDropEvent(int index, QGraphicsSceneDragDropEvent* event);
612 void slotModelChanged(KItemModelBase* current, KItemModelBase* previous);
613 void slotMouseButtonPressed(int itemIndex, Qt::MouseButtons buttons);
614 void slotRenameDialogRenamingFinished(const QList<QUrl>& urls);
615 void slotSelectedItemTextPressed(int index);
616 void slotCopyingDone(KIO::Job *, const QUrl &, const QUrl &to);
617 void slotIncreaseZoom();
618 void slotDecreaseZoom();
619 void slotSwipeUp();
620
621 /*
622 * Is called when new items get pasted or dropped.
623 */
624 void slotItemCreated(const QUrl &url);
625 /*
626 * Is called after all pasted or dropped items have been copied to destination.
627 */
628 void slotJobResult(KJob *job);
629
630 /**
631 * Emits the signal \a selectionChanged() with a small delay. This is
632 * because getting all file items for the selection can be an expensive
633 * operation. Fast selection changes are collected in this case and
634 * the signal is emitted only after no selection change has been done
635 * within a small delay.
636 */
637 void slotSelectionChanged(const KItemSet& current, const KItemSet& previous);
638
639 /**
640 * Is called by emitDelayedSelectionChangedSignal() and emits the
641 * signal \a selectionChanged() with all selected file items as parameter.
642 */
643 void emitSelectionChangedSignal();
644
645 /**
646 * Updates the view properties of the current URL to the
647 * sorting given by \a role.
648 */
649 void updateSortRole(const QByteArray& role);
650
651 /**
652 * Updates the view properties of the current URL to the
653 * sort order given by \a order.
654 */
655 void updateSortOrder(Qt::SortOrder order);
656
657 /**
658 * Updates the view properties of the current URL to the
659 * sorting of files and folders (separate with folders first or mixed) given by \a foldersFirst.
660 */
661 void updateSortFoldersFirst(bool foldersFirst);
662
663 /**
664 * Indicates in the status bar that the delete operation
665 * of the job \a job has been finished.
666 */
667 void slotDeleteFileFinished(KJob* job);
668
669 /**
670 * Indicates in the status bar that the trash operation
671 * of the job \a job has been finished.
672 */
673 void slotTrashFileFinished(KJob* job);
674
675 /**
676 * Invoked when the rename job is done, for error handling.
677 */
678 void slotRenamingResult(KJob* job);
679
680 /**
681 * Invoked when the file item model has started the loading
682 * of the directory specified by DolphinView::url().
683 */
684 void slotDirectoryLoadingStarted();
685
686 /**
687 * Invoked when the file item model indicates that the loading of a directory has
688 * been completed. Assures that pasted items and renamed items get selected.
689 */
690 void slotDirectoryLoadingCompleted();
691
692 /**
693 * Is invoked when items of KFileItemModel have been changed.
694 */
695 void slotItemsChanged();
696
697 /**
698 * Is invoked when the sort order has been changed by the user by clicking
699 * on a header item. The view properties of the directory will get updated.
700 */
701 void slotSortOrderChangedByHeader(Qt::SortOrder current, Qt::SortOrder previous);
702
703 /**
704 * Is invoked when the sort role has been changed by the user by clicking
705 * on a header item. The view properties of the directory will get updated.
706 */
707 void slotSortRoleChangedByHeader(const QByteArray& current, const QByteArray& previous);
708
709 /**
710 * Is invoked when the visible roles have been changed by the user by dragging
711 * a header item. The view properties of the directory will get updated.
712 */
713 void slotVisibleRolesChangedByHeader(const QList<QByteArray>& current,
714 const QList<QByteArray>& previous);
715
716 void slotRoleEditingCanceled();
717 void slotRoleEditingFinished(int index, const QByteArray& role, const QVariant& value);
718
719 /**
720 * Observes the item with the URL \a url. As soon as the directory
721 * model indicates that the item is available, the item will
722 * get selected and it is assured that the item stays visible.
723 */
724 void observeCreatedItem(const QUrl &url);
725
726 /**
727 * Called when a redirection happens.
728 * Testcase: fish://localhost
729 */
730 void slotDirectoryRedirection(const QUrl& oldUrl, const QUrl& newUrl);
731
732 /**
733 * Calculates the number of currently shown files into
734 * \a fileCount and the number of folders into \a folderCount.
735 * The size of all files is written into \a totalFileSize.
736 * It is recommend using this method instead of asking the
737 * directory lister or the model directly, as it takes
738 * filtering and hierarchical previews into account.
739 */
740 void calculateItemCount(int& fileCount, int& folderCount, KIO::filesize_t& totalFileSize) const;
741
742 void slotTwoClicksRenamingTimerTimeout();
743
744 private:
745 void loadDirectory(const QUrl& url, bool reload = false);
746
747 /**
748 * Applies the view properties which are defined by the current URL
749 * to the DolphinView properties. The view properties are read from a
750 * .directory file either in the current directory, or in the
751 * share/apps/dolphin/view_properties/ subfolder of the user's .kde folder.
752 */
753 void applyViewProperties();
754
755 /**
756 * Applies the given view properties to the DolphinView.
757 */
758 void applyViewProperties(const ViewProperties& props);
759
760 /**
761 * Applies the m_mode property to the corresponding
762 * itemlayout-property of the KItemListView.
763 */
764 void applyModeToView();
765
766 /**
767 * Helper method for DolphinView::paste() and DolphinView::pasteIntoFolder().
768 * Pastes the clipboard data into the URL \a url.
769 */
770 void pasteToUrl(const QUrl& url);
771
772 /**
773 * Returns a list of URLs for all selected items. The list is
774 * simplified, so that when the URLs are part of different tree
775 * levels, only the parent is returned.
776 */
777 QList<QUrl> simplifiedSelectedUrls() const;
778
779 /**
780 * Returns the MIME data for all selected items.
781 */
782 QMimeData* selectionMimeData() const;
783
784 /**
785 * Updates m_isFolderWritable dependent on whether the folder represented by
786 * the current URL is writable. If the state has changed, the signal
787 * writeableStateChanged() will be emitted.
788 */
789 void updateWritableState();
790
791 /**
792 * @return The current URL if no viewproperties-context is given (see
793 * DolphinView::viewPropertiesContext(), otherwise the context
794 * is returned.
795 */
796 QUrl viewPropertiesUrl() const;
797
798 /**
799 * Clears the selection and updates current item and selection according to the parameters
800 *
801 * @param current URL to be set as current
802 * @param selected list of selected items
803 */
804 void forceUrlsSelection(const QUrl& current, const QList<QUrl>& selected);
805
806 void abortTwoClicksRenaming();
807
808 void updatePlaceholderLabel();
809
810 private:
811 void updatePalette();
812
813 bool m_active;
814 bool m_tabsForFiles;
815 bool m_assureVisibleCurrentIndex;
816 bool m_isFolderWritable;
817 bool m_dragging; // True if a dragging is done. Required to be able to decide whether a
818 // tooltip may be shown when hovering an item.
819
820 QUrl m_url;
821 QString m_viewPropertiesContext;
822 Mode m_mode;
823 QList<QByteArray> m_visibleRoles;
824
825 QVBoxLayout* m_topLayout;
826
827 KFileItemModel* m_model;
828 DolphinItemListView* m_view;
829 KItemListContainer* m_container;
830
831 ToolTipManager* m_toolTipManager;
832
833 QTimer* m_selectionChangedTimer;
834
835 QUrl m_currentItemUrl; // Used for making the view to remember the current URL after F5
836 bool m_scrollToCurrentItem; // Used for marking we need to scroll to current item or not
837 QPoint m_restoredContentsPosition;
838
839 QList<QUrl> m_selectedUrls; // Used for making the view to remember selections after F5
840 bool m_clearSelectionBeforeSelectingNewItems;
841 bool m_markFirstNewlySelectedItemAsCurrent;
842
843 VersionControlObserver* m_versionControlObserver;
844
845 QTimer* m_twoClicksRenamingTimer;
846 QUrl m_twoClicksRenamingItemUrl;
847 QLabel* m_placeholderLabel;
848
849 // For unit tests
850 friend class TestBase;
851 friend class DolphinDetailsViewTest;
852 friend class DolphinPart; // Accesses m_model
853 };
854
855 /// Allow using DolphinView::Mode in QVariant
856 Q_DECLARE_METATYPE(DolphinView::Mode)
857
858 #endif // DOLPHINVIEW_H