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