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