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