]> cloud.milkyroute.net Git - dolphin.git/blob - src/views/dolphinview.h
Details view: Fix jumping column-widths
[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
22 #ifndef DOLPHINVIEW_H
23 #define DOLPHINVIEW_H
24
25 #include <config-nepomuk.h>
26
27 #include "libdolphin_export.h"
28
29 #include <kparts/part.h>
30 #include <KFileItem>
31 #include <KFileItemDelegate>
32 #include <kio/fileundomanager.h>
33 #include <KIO/Job>
34
35 #include <QBoxLayout>
36 #include <QKeyEvent>
37 #include <QLinkedList>
38 #include <QListView>
39 #include <QSet>
40 #include <QWidget>
41
42 typedef KIO::FileUndoManager::CommandType CommandType;
43
44 class DolphinColumnViewContainer;
45 class DolphinDetailsView;
46 class DolphinDetailsViewExpander;
47 class DolphinIconsView;
48 class DolphinModel;
49 class DolphinSortFilterProxyModel;
50 class DolphinViewController;
51 class KAction;
52 class KActionCollection;
53 class KDirLister;
54 class KUrl;
55 class ViewModeController;
56 class ViewProperties;
57 class QRegExp;
58
59 /**
60 * @short Represents a view for the directory content.
61 *
62 * View modes for icons, details and columns are supported. It's
63 * possible to adjust:
64 * - sort order
65 * - sort type
66 * - show hidden files
67 * - show previews
68 *
69 * @see DolphinIconsView
70 * @see DolphinDetailsView
71 * @see DolphinColumnView
72 */
73 class LIBDOLPHINPRIVATE_EXPORT DolphinView : public QWidget
74 {
75 Q_OBJECT
76
77 public:
78 /**
79 * Defines the view mode for a directory. The view mode
80 * can be defined when constructing a DolphinView. The
81 * view mode is automatically updated if the directory itself
82 * defines a view mode (see class ViewProperties for details).
83 */
84 enum Mode
85 {
86 /**
87 * The directory items are shown as icons including an
88 * icon name.
89 */
90 IconsView = 0,
91
92 /**
93 * The icon, the name and at least the size of the directory
94 * items are shown in a table. It is possible to add columns
95 * for date, group and permissions.
96 */
97 DetailsView = 1,
98
99 /**
100 * Each folder is shown in a separate column.
101 */
102 ColumnView = 2,
103 MaxModeEnum = ColumnView
104 };
105
106 /** Defines the sort order for the items of a directory. */
107 enum Sorting
108 {
109 SortByName = 0,
110 SortBySize,
111 SortByDate,
112 SortByPermissions,
113 SortByOwner,
114 SortByGroup,
115 SortByType,
116 SortByDestination,
117 SortByPath,
118 MaxSortingEnum = SortByPath
119 };
120
121 /**
122 * @param url Specifies the content which should be shown.
123 * @param parent Parent widget of the view.
124 */
125 DolphinView( const KUrl& url, QWidget* parent);
126
127 virtual ~DolphinView();
128
129 /**
130 * Returns the current active URL, where all actions are applied.
131 * The URL navigator is synchronized with this URL.
132 */
133 KUrl url() const;
134
135 /**
136 * Returns the root URL of the view, which is defined as the first
137 * visible path of DolphinView::url(). Usually the root URL is
138 * equal to DolphinView::url(), but in the case of the column view
139 * when 2 columns are shown, the root URL might be:
140 * /home/peter/Documents
141 * and DolphinView::url() might return
142 * /home/peter/Documents/Music/
143 */
144 KUrl rootUrl() const;
145
146 /**
147 * If \a active is true, the view will marked as active. The active
148 * view is defined as view where all actions are applied to.
149 */
150 void setActive(bool active);
151 bool isActive() const;
152
153 /**
154 * Changes the view mode for the current directory to \a mode.
155 * If the view properties should be remembered for each directory
156 * (GeneralSettings::globalViewProps() returns false), then the
157 * changed view mode will be stored automatically.
158 */
159 void setMode(Mode mode);
160 Mode mode() const;
161
162 /** See setShowPreview */
163 bool showPreview() const;
164
165 /** See setShowHiddenFiles */
166 bool showHiddenFiles() const;
167
168 /** See setCategorizedSorting */
169 bool categorizedSorting() const;
170
171 /**
172 * Returns true, if the categorized sorting is supported by the current
173 * used mode (see DolphinView::setMode()). Currently only DolphinView::IconsView
174 * supports categorizations. To check whether the categorized
175 * sorting is set, use DolphinView::categorizedSorting().
176 */
177 bool supportsCategorizedSorting() const;
178
179 /**
180 * Returns the root item which represents the current URL. Note that the returned
181 * item can be null (KFileItem::isNull() will return true) in case that the directory
182 * has not been loaded.
183 */
184 KFileItem rootItem() const;
185
186 /**
187 * Returns the items of the view.
188 */
189 KFileItemList items() const;
190
191 /**
192 * Returns the selected items. The list is empty if no item has been
193 * selected.
194 */
195 KFileItemList selectedItems() const;
196
197 /**
198 * Returns the number of selected items (this is faster than
199 * invoking selectedItems().count()).
200 */
201 int selectedItemsCount() const;
202
203 /**
204 * Marks the items indicated by \p urls to get selected after the
205 * directory DolphinView::url() has been loaded. Note that nothing
206 * gets selected if no loading of a directory has been triggered
207 * by DolphinView::setUrl() or DolphinView::reload().
208 */
209 void markUrlsAsSelected(const QList<KUrl>& urls);
210
211 /**
212 * All items that match to the pattern \a pattern will get selected
213 * if \a enabled is true and deselected if \a enabled is false.
214 */
215 void setItemSelectionEnabled(const QRegExp& pattern, bool enabled);
216
217 /**
218 * Sets the zoom level to \a level. It is assured that the used
219 * level is adjusted to be inside the range ZoomLevelInfo::minimumLevel() and
220 * ZoomLevelInfo::maximumLevel().
221 */
222 void setZoomLevel(int level);
223 int zoomLevel() const;
224
225 /**
226 * Returns true, if zooming in is possible. If false is returned,
227 * the maximum zooming level has been reached.
228 */
229 bool isZoomInPossible() const;
230
231 /**
232 * Returns true, if zooming out is possible. If false is returned,
233 * the minimum zooming level has been reached.
234 */
235 bool isZoomOutPossible() const;
236
237 /** Sets the sort order of the items inside a directory (see DolphinView::Sorting). */
238 void setSorting(Sorting sorting);
239
240 /** Returns the sort order of the items inside a directory (see DolphinView::Sorting). */
241 Sorting sorting() const;
242
243 /** Sets the sort order (Qt::Ascending or Qt::Descending) for the items. */
244 void setSortOrder(Qt::SortOrder order);
245
246 /** Returns the current used sort order (Qt::Ascending or Qt::Descending). */
247 Qt::SortOrder sortOrder() const;
248
249 /** Sets a separate sorting with folders first (true) or a mixed sorting of files and folders (false). */
250 void setSortFoldersFirst(bool foldersFirst);
251
252 /** Returns if files and folders are sorted separately or not. */
253 bool sortFoldersFirst() const;
254
255 /** Sets the additional information which should be shown for the items. */
256 void setAdditionalInfo(KFileItemDelegate::InformationList info);
257
258 /** Returns the additional information which should be shown for the items. */
259 KFileItemDelegate::InformationList additionalInfo() const;
260
261 /** Reloads the current directory. */
262 void reload();
263
264 void stopLoading();
265
266 /**
267 * Refreshes the view to get synchronized with the (updated) Dolphin settings.
268 * This method only needs to get invoked if the view settings for the Icons View,
269 * Details View or Columns View have been changed.
270 */
271 void refresh();
272
273 /**
274 * Filters the currently shown items by \a nameFilter. All items
275 * which contain the given filter string will be shown.
276 */
277 void setNameFilter(const QString& nameFilter);
278 QString nameFilter() const;
279
280 /**
281 * Calculates the number of currently shown files into
282 * \a fileCount and the number of folders into \a folderCount.
283 * The size of all files is written into \a totalFileSize.
284 * It is recommend using this method instead of asking the
285 * directory lister or the model directly, as it takes
286 * filtering and hierarchical previews into account.
287 */
288 void calculateItemCount(int& fileCount, int& folderCount, KIO::filesize_t& totalFileSize) const;
289
290 /**
291 * Returns a textual representation of the state of the current
292 * folder or selected items, suitable for use in the status bar.
293 */
294 QString statusBarText() const;
295
296 /**
297 * Returns the version control actions that are provided for the items \p items.
298 * Usually the actions are presented in the context menu.
299 */
300 QList<QAction*> versionControlActions(const KFileItemList& items) const;
301
302 /**
303 * Updates the state of the 'Additional Information' actions in \a collection.
304 */
305 void updateAdditionalInfoActions(KActionCollection* collection);
306
307 /**
308 * Returns the state of the paste action:
309 * first is whether the action should be enabled
310 * second is the text for the action
311 */
312 QPair<bool, QString> pasteInfo() const;
313
314 /**
315 * If \a tabsForFiles is true, the signal tabRequested() will also
316 * emitted also for files. Per default tabs for files is disabled
317 * and hence the signal tabRequested() will only be emitted for
318 * directories.
319 */
320 void setTabsForFilesEnabled(bool tabsForFiles);
321 bool isTabsForFilesEnabled() const;
322
323 /**
324 * Returns true if the current view allows folders to be expanded,
325 * i.e. presents a hierarchical view to the user.
326 */
327 bool itemsExpandable() const;
328
329 /**
330 * Restores the view state (current item, contents position, details view expansion state)
331 */
332 void restoreState(QDataStream& stream);
333
334 /**
335 * Saves the view state (current item, contents position, details view expansion state)
336 */
337 void saveState(QDataStream& stream);
338
339 /** Returns true, if at least one item is selected. */
340 bool hasSelection() const;
341
342 public slots:
343 /**
344 * Changes the directory to \a url. If the current directory is equal to
345 * \a url, nothing will be done (use DolphinView::reload() instead).
346 */
347 void setUrl(const KUrl& url);
348
349 /**
350 * Selects all items.
351 * @see DolphinView::selectedItems()
352 */
353 void selectAll();
354
355 /**
356 * Inverts the current selection: selected items get unselected,
357 * unselected items get selected.
358 * @see DolphinView::selectedItems()
359 */
360 void invertSelection();
361
362 void clearSelection();
363
364 /**
365 * Triggers the renaming of the currently selected items, where
366 * the user must input a new name for the items.
367 */
368 void renameSelectedItems();
369
370 /**
371 * Moves all selected items to the trash.
372 */
373 void trashSelectedItems();
374
375 /**
376 * Deletes all selected items.
377 */
378 void deleteSelectedItems();
379
380 /**
381 * Copies all selected items to the clipboard and marks
382 * the items as cut.
383 */
384 void cutSelectedItems();
385
386 /** Copies all selected items to the clipboard. */
387 void copySelectedItems();
388
389 /** Pastes the clipboard data to this view. */
390 void paste();
391
392 /**
393 * Pastes the clipboard data into the currently selected
394 * folder. If the current selection is not exactly one folder, no
395 * paste operation is done.
396 */
397 void pasteIntoFolder();
398
399 /**
400 * Turns on the file preview for the all files of the current directory,
401 * if \a show is true.
402 * If the view properties should be remembered for each directory
403 * (GeneralSettings::globalViewProps() returns false), then the
404 * preview setting will be stored automatically.
405 */
406 void setShowPreview(bool show);
407
408 /**
409 * Shows all hidden files of the current directory,
410 * if \a show is true.
411 * If the view properties should be remembered for each directory
412 * (GeneralSettings::globalViewProps() returns false), then the
413 * show hidden file setting will be stored automatically.
414 */
415 void setShowHiddenFiles(bool show);
416
417 /**
418 * Summarizes all sorted items by their category \a categorized
419 * is true.
420 * If the view properties should be remembered for each directory
421 * (GeneralSettings::globalViewProps() returns false), then the
422 * categorized sorting setting will be stored automatically.
423 */
424 void setCategorizedSorting(bool categorized);
425
426 signals:
427 /**
428 * Is emitted if the view has been activated by e. g. a mouse click.
429 */
430 void activated();
431
432 /** Is emitted if URL of the view has been changed to \a url. */
433 void urlChanged(const KUrl& url);
434
435 /**
436 * Is emitted when clicking on an item with the left mouse button.
437 */
438 void itemTriggered(const KFileItem& item);
439
440 /**
441 * Is emitted if items have been added or deleted.
442 */
443 void itemCountChanged();
444
445 /**
446 * Is emitted if a new tab should be opened for the URL \a url.
447 */
448 void tabRequested(const KUrl& url);
449
450 /**
451 * Is emitted if the view mode (IconsView, DetailsView,
452 * PreviewsView) has been changed.
453 */
454 void modeChanged();
455
456 /** Is emitted if the 'show preview' property has been changed. */
457 void showPreviewChanged();
458
459 /** Is emitted if the 'show hidden files' property has been changed. */
460 void showHiddenFilesChanged();
461
462 /** Is emitted if the 'categorized sorting' property has been changed. */
463 void categorizedSortingChanged();
464
465 /** Is emitted if the sorting by name, size or date has been changed. */
466 void sortingChanged(DolphinView::Sorting sorting);
467
468 /** Is emitted if the sort order (ascending or descending) has been changed. */
469 void sortOrderChanged(Qt::SortOrder order);
470
471 /** Is emitted if the sorting of files and folders (separate with folders first or mixed) has been changed. */
472 void sortFoldersFirstChanged(bool foldersFirst);
473
474 /** Is emitted if the additional information shown for this view has been changed. */
475 void additionalInfoChanged();
476
477 /** Is emitted if the zoom level has been changed by zooming in or out. */
478 void zoomLevelChanged(int level);
479
480 /**
481 * Is emitted if information of an item is requested to be shown e. g. in the panel.
482 * If item is null, no item information request is pending.
483 */
484 void requestItemInfo(const KFileItem& item);
485
486 /**
487 * Is emitted whenever the selection has been changed.
488 */
489 void selectionChanged(const KFileItemList& selection);
490
491 /**
492 * Is emitted if a context menu is requested for the item \a item,
493 * which is part of \a url. If the item is null, the context menu
494 * for the URL should be shown and the custom actions \a customActions
495 * will be added.
496 */
497 void requestContextMenu(const KFileItem& item,
498 const KUrl& 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 path \a url is currently 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 startedPathLoading(const KUrl& url);
526
527 /**
528 * Is emitted after the path triggered by DolphinView::setUrl()
529 * has been loaded.
530 */
531 void finishedPathLoading(const KUrl& url);
532
533 /**
534 * Is emitted after DolphinView::setUrl() has been invoked and provides
535 * the information how much percent of the current path have been loaded.
536 */
537 void pathLoadingProgress(int percent);
538
539 /**
540 * Is emitted if the DolphinView::setUrl() is invoked but the URL is not
541 * a directory.
542 */
543 void urlIsFileError(const KUrl& file);
544
545 /**
546 * Emitted when KDirLister emits redirection.
547 * Testcase: fish://localhost
548 */
549 void redirection(const KUrl& oldUrl, const KUrl& newUrl);
550
551 /**
552 * Is emitted when the write state of the folder has been changed. The application
553 * should disable all actions like "Create New..." that depend on the write
554 * state.
555 */
556 void writeStateChanged(bool isFolderWritable);
557
558 protected:
559 /** @see QWidget::mouseReleaseEvent */
560 virtual void mouseReleaseEvent(QMouseEvent* event);
561 virtual bool eventFilter(QObject* watched, QEvent* event);
562 virtual void showEvent(QShowEvent* event);
563
564 private slots:
565 /**
566 * Marks the view as active (DolphinView:isActive() will return true)
567 * and emits the 'activated' signal if it is not already active.
568 */
569 void activate();
570
571 /**
572 * If the item \a item is a directory, then this
573 * directory will be loaded. If the item is a file, the corresponding
574 * application will get started.
575 */
576 void triggerItem(const KFileItem& index);
577
578 /**
579 * Emits the signal \a selectionChanged() with a small delay. This is
580 * because getting all file items for the signal can be an expensive
581 * operation. Fast selection changes are collected in this case and
582 * the signal is emitted only after no selection change has been done
583 * within a small delay.
584 */
585 void slotSelectionChanged(const QItemSelection& selected, const QItemSelection& deselected);
586
587 /**
588 * Is called by emitDelayedSelectionChangedSignal() and emits the
589 * signal \a selectionChanged() with all selected file items as parameter.
590 */
591 void emitSelectionChangedSignal();
592
593 /**
594 * Opens the context menu on position \a pos. The position
595 * is used to check whether the context menu is related to an
596 * item or to the viewport.
597 */
598 void openContextMenu(const QPoint& pos, const QList<QAction*>& customActions);
599
600 /**
601 * Drops dragged URLs to the destination path \a destPath. If
602 * the URLs are dropped above an item inside the destination path,
603 * the item is indicated by \a destItem.
604 */
605 void dropUrls(const KFileItem& destItem,
606 const KUrl& destPath,
607 QDropEvent* event);
608
609 /**
610 * Updates the view properties of the current URL to the
611 * sorting given by \a sorting.
612 */
613 void updateSorting(DolphinView::Sorting sorting);
614
615 /**
616 * Updates the view properties of the current URL to the
617 * sort order given by \a order.
618 */
619 void updateSortOrder(Qt::SortOrder order);
620
621 /**
622 * Updates the view properties of the current URL to the
623 * sorting of files and folders (separate with folders first or mixed) given by \a foldersFirst.
624 */
625 void updateSortFoldersFirst(bool foldersFirst);
626
627 /**
628 * Updates the view properties of the current URL to the
629 * additional information given by \a info.
630 */
631 void updateAdditionalInfo(const KFileItemDelegate::InformationList& info);
632
633 /**
634 * Updates the status bar to show hover information for the
635 * item \a item. If currently other items are selected,
636 * no hover information is shown.
637 * @see DolphinView::clearHoverInformation()
638 */
639 void showHoverInformation(const KFileItem& item);
640
641 /**
642 * Clears the hover information shown in the status bar.
643 * @see DolphinView::showHoverInformation().
644 */
645 void clearHoverInformation();
646
647 /**
648 * Indicates in the status bar that the delete operation
649 * of the job \a job has been finished.
650 */
651 void slotDeleteFileFinished(KJob* job);
652
653 /**
654 * Invoked when the directory lister has been started the
655 * loading of \a url.
656 */
657 void slotDirListerStarted(const KUrl& url);
658
659 /**
660 * Invoked when the directory lister has completed the loading of
661 * items. Assures that pasted items and renamed items get seleced.
662 */
663 void slotDirListerCompleted();
664
665 /**
666 * Invoked when the loading of the directory is finished.
667 * Restores the active item and the scroll position if possible.
668 */
669 void slotLoadingCompleted();
670
671 /**
672 * Is invoked when the KDirLister indicates refreshed items.
673 */
674 void slotRefreshItems();
675
676 /**
677 * Observes the item with the URL \a url. As soon as the directory
678 * model indicates that the item is available, the item will
679 * get selected and it is assure that the item stays visible.
680 *
681 * @see selectAndScrollToCreatedItem()
682 */
683 void observeCreatedItem(const KUrl& url);
684
685 /**
686 * Selects and scrolls to the item that got observed
687 * by observeCreatedItem().
688 */
689 void selectAndScrollToCreatedItem();
690
691 /**
692 * Called when a redirection happens.
693 * Testcase: fish://localhost
694 */
695 void slotRedirection(const KUrl& oldUrl, const KUrl& newUrl);
696
697 /**
698 * Restores the contents position, if history information about the old position is available.
699 */
700 void restoreContentsPosition();
701
702 void slotUrlChangeRequested(const KUrl& url);
703
704 private:
705 void loadDirectory(const KUrl& url, bool reload = false);
706
707 /**
708 * Applies the view properties which are defined by the current URL
709 * to the DolphinView properties.
710 */
711 void applyViewProperties();
712
713 /**
714 * Creates a new view representing the given view mode (DolphinView::mode()).
715 * The current view will get deleted.
716 */
717 void createView();
718
719 void deleteView();
720
721 /**
722 * Helper method for DolphinView::paste() and DolphinView::pasteIntoFolder().
723 * Pastes the clipboard data into the URL \a url.
724 */
725 void pasteToUrl(const KUrl& url);
726
727 /**
728 * Checks whether the current item view has the same zoom level
729 * as \a oldZoomLevel. If this is not the case, the zoom level
730 * of the controller is updated and a zoomLevelChanged() signal
731 * is emitted.
732 */
733 void updateZoomLevel(int oldZoomLevel);
734
735 /**
736 * Returns a list of URLs for all selected items. The list is
737 * simplified, so that when the URLs are part of different tree
738 * levels, only the parent is returned.
739 */
740 KUrl::List simplifiedSelectedUrls() const;
741
742 /**
743 * Returns the MIME data for all selected items.
744 */
745 QMimeData* selectionMimeData() const;
746
747 /**
748 * Is invoked after a paste operation or a drag & drop
749 * operation and adds the filenames of all URLs from \a mimeData to
750 * m_newFileNames. This allows to select all newly added
751 * items in slotDirListerCompleted().
752 */
753 void addNewFileNames(const QMimeData* mimeData);
754
755 /**
756 * Helper method for DolphinView::setItemSelectionEnabled(): Returns the selection for
757 * all items of \p parent that match with the regular expression defined by \p pattern.
758 */
759 QItemSelection childrenMatchingPattern(const QModelIndex& parent, const QRegExp& pattern) const;
760
761 void connectViewAccessor();
762 void disconnectViewAccessor();
763
764 /**
765 * Updates m_isFolderWritable dependent on whether the folder represented by
766 * the current URL is writable. If the state has changed, the signal
767 * writeableStateChanged() will be emitted.
768 */
769 void updateWritableState();
770
771 private:
772 /**
773 * Abstracts the access to the different view implementations
774 * for icons-, details- and column-view.
775 */
776 class ViewAccessor
777 {
778 public:
779 ViewAccessor();
780 ~ViewAccessor();
781
782 void createView(QWidget* parent,
783 DolphinViewController* dolphinViewController,
784 const ViewModeController* viewModeController,
785 Mode mode);
786 void deleteView();
787
788 /**
789 * Must be invoked before the URL has been changed and allows view implementations
790 * like the column view to create a new column.
791 */
792 void prepareUrlChange(const KUrl& url);
793
794 QAbstractItemView* itemView() const;
795 KFileItemDelegate* itemDelegate() const;
796
797 /**
798 * Returns the widget that should be added to the layout as target. Usually
799 * the item view itself is returned, but in the case of the column view
800 * a container widget is returned.
801 */
802 QWidget* layoutTarget() const;
803
804 void setRootUrl(const KUrl& rootUrl);
805 KUrl rootUrl() const;
806
807 bool supportsCategorizedSorting() const;
808 bool itemsExpandable() const;
809 QSet<KUrl> expandedUrls() const;
810 const DolphinDetailsViewExpander* setExpandedUrls(const QSet<KUrl>& urlsToExpand);
811
812 /**
813 * Returns true, if a reloading of the items is required
814 * when the additional information properties have been changed
815 * by the user.
816 */
817 bool reloadOnAdditionalInfoChange() const;
818
819 DolphinModel* dirModel() const;
820 DolphinSortFilterProxyModel* proxyModel() const;
821 KDirLister* dirLister() const;
822
823 private:
824 KUrl m_rootUrl;
825 DolphinIconsView* m_iconsView;
826 DolphinDetailsView* m_detailsView;
827 DolphinColumnViewContainer* m_columnsContainer;
828 DolphinModel* m_dolphinModel;
829 DolphinSortFilterProxyModel* m_proxyModel;
830 QAbstractItemView* m_dragSource;
831 QPointer<DolphinDetailsViewExpander> m_detailsViewExpander;
832
833 // For unit tests
834 friend class DolphinDetailsViewTest;
835 };
836
837 bool m_active : 1;
838 bool m_showPreview : 1;
839 bool m_storedCategorizedSorting : 1;
840 bool m_tabsForFiles : 1;
841 bool m_isContextMenuOpen : 1; // TODO: workaround for Qt-issue 207192
842 bool m_assureVisibleCurrentIndex : 1;
843 bool m_expanderActive : 1;
844 bool m_isFolderWritable : 1;
845
846 Mode m_mode;
847
848 QVBoxLayout* m_topLayout;
849
850 DolphinViewController* m_dolphinViewController;
851 ViewModeController* m_viewModeController;
852 ViewAccessor m_viewAccessor;
853
854 QTimer* m_selectionChangedTimer;
855
856 KUrl m_activeItemUrl;
857 QPoint m_restoredContentsPosition;
858 KUrl m_createdItemUrl; // URL for a new item that got created by the "Create New..." menu
859 KFileItemList m_selectedItems; // this is used for making the View to remember selections after F5
860
861 /**
862 * Remembers the filenames that have been added by a paste operation
863 * or a drag & drop operation. Allows to select the items in
864 * slotDirListerCompleted().
865 */
866 QSet<QString> m_newFileNames;
867
868 // For unit tests
869 friend class TestBase;
870 friend class DolphinDetailsViewTest;
871 };
872
873 /// Allow using DolphinView::Mode in QVariant
874 Q_DECLARE_METATYPE(DolphinView::Mode)
875
876 #endif // DOLPHINVIEW_H