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