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