~ubuntu-branches/debian/sid/kde-baseapps/sid

« back to all changes in this revision

Viewing changes to dolphin/src/views/dolphinview.h

  • Committer: Package Import Robot
  • Author(s): Modestas Vainius, Eshat Cakar, Pino Toscano
  • Date: 2012-06-09 22:18:08 UTC
  • mfrom: (4.2.1) (6.1.1 experimental)
  • Revision ID: package-import@ubuntu.com-20120609221808-h1l0ekd5qmb8nefr
Tags: 4:4.8.4-1
* New upstream release.

[ Eshat Cakar ]
* Add watch file.
* Bump kde-sc-dev-latest build dependency to version 4:4.8.4.
* Update installed files.

[ Pino Toscano ]
* Move files of the konqueror documentation from kde-baseapps-data to
  konqueror itself.

Show diffs side-by-side

added added

removed removed

Lines of Context:
18
18
 *   51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA            *
19
19
 ***************************************************************************/
20
20
 
21
 
 
22
21
#ifndef DOLPHINVIEW_H
23
22
#define DOLPHINVIEW_H
24
23
 
35
34
#include <QBoxLayout>
36
35
#include <QKeyEvent>
37
36
#include <QLinkedList>
38
 
#include <QListView>
39
37
#include <QSet>
40
38
#include <QWidget>
41
39
 
42
40
typedef KIO::FileUndoManager::CommandType CommandType;
43
41
 
44
 
class DolphinColumnViewContainer;
45
 
class DolphinDetailsView;
46
 
class DolphinDetailsViewExpander;
47
 
class DolphinIconsView;
48
 
class DolphinModel;
49
 
class DolphinSortFilterProxyModel;
50
 
class DolphinViewController;
 
42
class DolphinDirLister;
 
43
class DolphinItemListContainer;
51
44
class KAction;
52
45
class KActionCollection;
53
 
class KDirLister;
 
46
class KFileItemModel;
 
47
class KItemModelBase;
54
48
class KUrl;
55
 
class ViewModeController;
 
49
class ToolTipManager;
 
50
class VersionControlObserver;
56
51
class ViewProperties;
 
52
class QGraphicsSceneDragDropEvent;
57
53
class QRegExp;
58
54
 
59
55
/**
60
56
 * @short Represents a view for the directory content.
61
57
 *
62
 
 * View modes for icons, details and columns are supported. It's
 
58
 * View modes for icons, compact and details are supported. It's
63
59
 * possible to adjust:
64
60
 * - sort order
65
61
 * - sort type
66
62
 * - show hidden files
67
63
 * - show previews
68
 
 *
69
 
 * @see DolphinIconsView
70
 
 * @see DolphinDetailsView
71
 
 * @see DolphinColumnView
 
64
 * - enable grouping
72
65
 */
73
66
class LIBDOLPHINPRIVATE_EXPORT DolphinView : public QWidget
74
67
{
76
69
 
77
70
public:
78
71
    /**
79
 
     * Defines the view mode for a directory. The view mode
80
 
     * can be defined when constructing a DolphinView. The
 
72
     * Defines the view mode for a directory. The
81
73
     * view mode is automatically updated if the directory itself
82
74
     * defines a view mode (see class ViewProperties for details).
83
75
     */
84
76
    enum Mode
85
77
    {
86
78
        /**
87
 
         * The directory items are shown as icons including an
88
 
         * icon name.
 
79
         * The items are shown as icons with a name-label below.
89
80
         */
90
81
        IconsView = 0,
91
82
 
92
83
        /**
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.
 
84
         * The icon, the name and the size of the items are
 
85
         * shown per default as a table.
96
86
         */
97
 
        DetailsView = 1,
 
87
        DetailsView,
98
88
 
99
89
        /**
100
 
         * Each folder is shown in a separate column.
 
90
         * The items are shown as icons with the name-label aligned
 
91
         * to the right side.
101
92
         */
102
 
        ColumnView = 2,
103
 
        MaxModeEnum = ColumnView
 
93
        CompactView
104
94
    };
105
95
 
106
96
    /** Defines the sort order for the items of a directory. */
114
104
        SortByGroup,
115
105
        SortByType,
116
106
        SortByDestination,
117
 
        SortByPath,
118
 
        MaxSortingEnum = SortByPath
 
107
        SortByPath
 
108
    };
 
109
 
 
110
    /** Defines the additional information shown for the items of a directory. */
 
111
    enum AdditionalInfo
 
112
    {
 
113
        NoInfo = 0,
 
114
        SizeInfo,
 
115
        DateInfo,
 
116
        PermissionsInfo,
 
117
        OwnerInfo,
 
118
        GroupInfo,
 
119
        TypeInfo,
 
120
        DestinationInfo,
 
121
        PathInfo
119
122
    };
120
123
 
121
124
    /**
122
125
     * @param url              Specifies the content which should be shown.
123
126
     * @param parent           Parent widget of the view.
124
127
     */
125
 
    DolphinView( const KUrl& url, QWidget* parent);
 
128
    DolphinView(const KUrl& url, QWidget* parent);
126
129
 
127
130
    virtual ~DolphinView();
128
131
 
133
136
    KUrl url() const;
134
137
 
135
138
    /**
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
139
     * If \a active is true, the view will marked as active. The active
148
140
     * view is defined as view where all actions are applied to.
149
141
     */
159
151
    void setMode(Mode mode);
160
152
    Mode mode() const;
161
153
 
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;
 
154
    /**
 
155
     * Turns on the file preview for the all files of the current directory,
 
156
     * if \a show is true.
 
157
     * If the view properties should be remembered for each directory
 
158
     * (GeneralSettings::globalViewProps() returns false), then the
 
159
     * preview setting will be stored automatically.
 
160
     */
 
161
    void setPreviewsShown(bool show);
 
162
    bool previewsShown() const;
 
163
 
 
164
    /**
 
165
     * Shows all hidden files of the current directory,
 
166
     * if \a show is true.
 
167
     * If the view properties should be remembered for each directory
 
168
     * (GeneralSettings::globalViewProps() returns false), then the
 
169
     * show hidden file setting will be stored automatically.
 
170
     */
 
171
    void setHiddenFilesShown(bool show);
 
172
    bool hiddenFilesShown() const;
 
173
 
 
174
    /**
 
175
     * Turns on sorting by groups if \a enable is true.
 
176
     */
 
177
    void setGroupedSorting(bool grouped);
 
178
    bool groupedSorting() const;
185
179
 
186
180
    /**
187
181
     * Returns the items of the view.
209
203
    void markUrlsAsSelected(const QList<KUrl>& urls);
210
204
 
211
205
    /**
 
206
     * Marks the item indicated by \p url as the current item after the
 
207
     * directory DolphinView::url() has been loaded.
 
208
     */
 
209
    void markUrlAsCurrent(const KUrl& url);
 
210
 
 
211
    /**
212
212
     * All items that match to the pattern \a pattern will get selected
213
213
     * if \a enabled is true and deselected if  \a enabled is false.
214
214
     */
234
234
     */
235
235
    bool isZoomOutPossible() const;
236
236
 
237
 
    /** Sets the sort order of the items inside a directory (see DolphinView::Sorting). */
 
237
    /** Sets the sorting criterion (e.g., SortByName, SortBySize,...) of the items inside a directory (see DolphinView::Sorting). */
238
238
    void setSorting(Sorting sorting);
239
239
 
240
 
    /** Returns the sort order of the items inside a directory (see DolphinView::Sorting). */
 
240
    /** Returns the sorting criterion (e.g., SortByName, SortBySize,...) of the items inside a directory (see DolphinView::Sorting). */
241
241
    Sorting sorting() const;
242
242
 
243
243
    /** Sets the sort order (Qt::Ascending or Qt::Descending) for the items. */
244
244
    void setSortOrder(Qt::SortOrder order);
245
245
 
246
 
    /** Returns the current used sort order (Qt::Ascending or Qt::Descending). */
 
246
    /** Returns the currently used sort order (Qt::Ascending or Qt::Descending). */
247
247
    Qt::SortOrder sortOrder() const;
248
248
 
249
249
    /** Sets a separate sorting with folders first (true) or a mixed sorting of files and folders (false). */
253
253
    bool sortFoldersFirst() const;
254
254
 
255
255
    /** Sets the additional information which should be shown for the items. */
256
 
    void setAdditionalInfo(KFileItemDelegate::InformationList info);
 
256
    void setAdditionalInfoList(const QList<AdditionalInfo>& info);
257
257
 
258
258
    /** Returns the additional information which should be shown for the items. */
259
 
    KFileItemDelegate::InformationList additionalInfo() const;
 
259
    QList<AdditionalInfo> additionalInfoList() const;
260
260
 
261
261
    /** Reloads the current directory. */
262
262
    void reload();
264
264
    void stopLoading();
265
265
 
266
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();
 
267
     * Refreshes the view to get synchronized with the settings (e.g. icons size,
 
268
     * font, ...).
 
269
     */
 
270
    void readSettings();
 
271
 
 
272
    /**
 
273
     * Saves the current settings (e.g. icons size, font, ..).
 
274
     */
 
275
    void writeSettings();
272
276
 
273
277
    /**
274
278
     * Filters the currently shown items by \a nameFilter. All items
300
304
    QList<QAction*> versionControlActions(const KFileItemList& items) const;
301
305
 
302
306
    /**
303
 
     * Updates the state of the 'Additional Information' actions in \a collection.
304
 
     */
305
 
    void updateAdditionalInfoActions(KActionCollection* collection);
306
 
 
307
 
    /**
308
307
     * Returns the state of the paste action:
309
308
     * first is whether the action should be enabled
310
309
     * second is the text for the action
339
338
    /** Returns true, if at least one item is selected. */
340
339
    bool hasSelection() const;
341
340
 
 
341
    /**
 
342
     * Returns the root item which represents the current URL.
 
343
     */
 
344
    KFileItem rootItem() const;
 
345
 
342
346
public slots:
343
347
    /**
344
348
     * Changes the directory to \a url. If the current directory is equal to
396
400
     */
397
401
    void pasteIntoFolder();
398
402
 
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);
 
403
    /** Activates the view if the item list container gets focus. */
 
404
    virtual bool eventFilter(QObject* watched, QEvent* event);
425
405
 
426
406
signals:
427
407
    /**
429
409
     */
430
410
    void activated();
431
411
 
432
 
    /** Is emitted if URL of the view has been changed to \a url. */
 
412
    /**
 
413
     * Is emitted if the URL of the view will be changed to \a url.
 
414
     * After the URL has been changed the signal urlChanged() will
 
415
     * be emitted.
 
416
     */
 
417
    void urlAboutToBeChanged(const KUrl& url);
 
418
 
 
419
    /** Is emitted if the URL of the view has been changed to \a url. */
433
420
    void urlChanged(const KUrl& url);
434
421
 
435
422
    /**
436
423
     * Is emitted when clicking on an item with the left mouse button.
437
424
     */
438
 
    void itemTriggered(const KFileItem& item);
 
425
    void itemActivated(const KFileItem& item);
439
426
 
440
427
    /**
441
428
     * Is emitted if items have been added or deleted.
451
438
     * Is emitted if the view mode (IconsView, DetailsView,
452
439
     * PreviewsView) has been changed.
453
440
     */
454
 
    void modeChanged();
 
441
    void modeChanged(DolphinView::Mode current, DolphinView::Mode previous);
455
442
 
456
443
    /** Is emitted if the 'show preview' property has been changed. */
457
 
    void showPreviewChanged();
 
444
    void previewsShownChanged(bool shown);
458
445
 
459
446
    /** Is emitted if the 'show hidden files' property has been changed. */
460
 
    void showHiddenFilesChanged();
 
447
    void hiddenFilesShownChanged(bool shown);
461
448
 
462
 
    /** Is emitted if the 'categorized sorting' property has been changed. */
463
 
    void categorizedSortingChanged();
 
449
    /** Is emitted if the 'grouped sorting' property has been changed. */
 
450
    void groupedSortingChanged(bool groupedSorting);
464
451
 
465
452
    /** Is emitted if the sorting by name, size or date has been changed. */
466
453
    void sortingChanged(DolphinView::Sorting sorting);
472
459
    void sortFoldersFirstChanged(bool foldersFirst);
473
460
 
474
461
    /** Is emitted if the additional information shown for this view has been changed. */
475
 
    void additionalInfoChanged();
 
462
    void additionalInfoListChanged(const QList<DolphinView::AdditionalInfo>& current,
 
463
                                   const QList<DolphinView::AdditionalInfo>& previous);
476
464
 
477
465
    /** Is emitted if the zoom level has been changed by zooming in or out. */
478
 
    void zoomLevelChanged(int level);
 
466
    void zoomLevelChanged(int current, int previous);
479
467
 
480
468
    /**
481
469
     * Is emitted if information of an item is requested to be shown e. g. in the panel.
494
482
     * for the URL should be shown and the custom actions \a customActions
495
483
     * will be added.
496
484
     */
497
 
    void requestContextMenu(const KFileItem& item,
 
485
    void requestContextMenu(const QPoint& pos,
 
486
                            const KFileItem& item,
498
487
                            const KUrl& url,
499
488
                            const QList<QAction*>& customActions);
500
489
 
556
545
    void writeStateChanged(bool isFolderWritable);
557
546
 
558
547
protected:
559
 
    /** @see QWidget::mouseReleaseEvent */
560
 
    virtual void mouseReleaseEvent(QMouseEvent* event);
561
 
    virtual bool eventFilter(QObject* watched, QEvent* event);
 
548
    /** Changes the zoom level if Control is pressed during a wheel event. */
 
549
    virtual void wheelEvent(QWheelEvent* event);
 
550
 
 
551
    /** @reimp */
 
552
    virtual void hideEvent(QHideEvent* event);
562
553
 
563
554
private slots:
564
555
    /**
567
558
     */
568
559
    void activate();
569
560
 
570
 
    /**
571
 
     * If the item \a item is a directory, then this
572
 
     * directory will be loaded. If the  item is a file, the corresponding
573
 
     * application will get started.
574
 
     */
575
 
    void triggerItem(const KFileItem& index);
 
561
    void slotItemActivated(int index);
 
562
    void slotItemsActivated(const QSet<int>& indexes);
 
563
    void slotItemMiddleClicked(int index);
 
564
    void slotItemContextMenuRequested(int index, const QPointF& pos);
 
565
    void slotViewContextMenuRequested(const QPointF& pos);
 
566
    void slotHeaderContextMenuRequested(const QPointF& pos);
 
567
    void slotItemHovered(int index);
 
568
    void slotItemUnhovered(int index);
 
569
    void slotItemDropEvent(int index, QGraphicsSceneDragDropEvent* event);
 
570
    void slotModelChanged(KItemModelBase* current, KItemModelBase* previous);
576
571
 
577
572
    /**
578
573
     * Emits the signal \a selectionChanged() with a small delay. This is
579
 
     * because getting all file items for the signal can be an expensive
 
574
     * because getting all file items for the selection can be an expensive
580
575
     * operation. Fast selection changes are collected in this case and
581
576
     * the signal is emitted only after no selection change has been done
582
577
     * within a small delay.
583
578
     */
584
 
    void slotSelectionChanged(const QItemSelection& selected, const QItemSelection& deselected);
 
579
    void slotSelectionChanged(const QSet<int>& current, const QSet<int>& previous);
585
580
 
586
581
    /**
587
582
     * Is called by emitDelayedSelectionChangedSignal() and emits the
590
585
    void emitSelectionChangedSignal();
591
586
 
592
587
    /**
593
 
     * Opens the context menu on position \a pos. The position
594
 
     * is used to check whether the context menu is related to an
595
 
     * item or to the viewport.
596
 
     */
597
 
    void openContextMenu(const QPoint& pos, const QList<QAction*>& customActions);
598
 
 
599
 
    /**
600
 
     * Drops dragged URLs to the destination path \a destPath. If
601
 
     * the URLs are dropped above an item inside the destination path,
602
 
     * the item is indicated by \a destItem.
603
 
     */
604
 
    void dropUrls(const KFileItem& destItem,
605
 
                  const KUrl& destPath,
606
 
                  QDropEvent* event);
607
 
 
608
 
    /**
609
588
     * Updates the view properties of the current URL to the
610
589
     * sorting given by \a sorting.
611
590
     */
624
603
    void updateSortFoldersFirst(bool foldersFirst);
625
604
 
626
605
    /**
627
 
     * Updates the view properties of the current URL to the
628
 
     * additional information given by \a info.
629
 
     */
630
 
    void updateAdditionalInfo(const KFileItemDelegate::InformationList& info);
631
 
 
632
 
    /**
633
606
     * Updates the status bar to show hover information for the
634
607
     * item \a item. If currently other items are selected,
635
608
     * no hover information is shown.
656
629
    void slotDirListerStarted(const KUrl& url);
657
630
 
658
631
    /**
659
 
     * Invoked when the directory lister has completed the loading of
660
 
     * items. Assures that pasted items and renamed items get seleced.
661
 
     */
662
 
    void slotDirListerCompleted();
663
 
 
664
 
    /**
665
 
     * Invoked when the loading of the directory is finished.
666
 
     * Restores the active item and the scroll position if possible.
 
632
     * Invoked when the file item model indicates that the directory lister has completed the loading
 
633
     * of items, and that expanded folders have been restored (if the view mode is 'Details', and the
 
634
     * view state is restored after navigating back or forward in history). Assures that pasted items
 
635
     * and renamed items get seleced.
667
636
     */
668
637
    void slotLoadingCompleted();
669
638
 
673
642
    void slotRefreshItems();
674
643
 
675
644
    /**
 
645
     * Is invoked when the sort order has been changed by the user by clicking
 
646
     * on a header item. The view properties of the directory will get updated.
 
647
     */
 
648
    void slotSortOrderChangedByHeader(Qt::SortOrder current, Qt::SortOrder previous);
 
649
 
 
650
    /**
 
651
     * Is invoked when the sort role has been changed by the user by clicking
 
652
     * on a header item. The view properties of the directory will get updated.
 
653
     */
 
654
    void slotSortRoleChangedByHeader(const QByteArray& current, const QByteArray& previous);
 
655
 
 
656
    /**
 
657
     * Is invoked when the visible roles have been changed by the user by dragging
 
658
     * a header item. The view properties of the directory will get updated.
 
659
     */
 
660
    void slotVisibleRolesChangedByHeader(const QList<QByteArray>& current,
 
661
                                         const QList<QByteArray>& previous);
 
662
 
 
663
    /**
676
664
     * Observes the item with the URL \a url. As soon as the directory
677
665
     * model indicates that the item is available, the item will
678
 
     * get selected and it is assure that the item stays visible.
 
666
     * get selected and it is assured that the item stays visible.
679
667
     *
680
668
     * @see selectAndScrollToCreatedItem()
681
669
     */
694
682
    void slotRedirection(const KUrl& oldUrl, const KUrl& newUrl);
695
683
 
696
684
    /**
697
 
     * Restores the contents position, if history information about the old position is available.
 
685
     * Applies the state that has been restored by restoreViewState()
 
686
     * to the view.
698
687
     */
699
 
    void restoreContentsPosition();
700
 
 
701
 
    void slotUrlChangeRequested(const KUrl& url);
 
688
    void updateViewState();
 
689
 
 
690
    void hideToolTip();
 
691
 
 
692
    //void slotUrlChangeRequested(const KUrl& url);
702
693
 
703
694
private:
 
695
    KFileItemModel* fileItemModel() const;
 
696
 
704
697
    void loadDirectory(const KUrl& url, bool reload = false);
705
698
 
706
699
    /**
709
702
     */
710
703
    void applyViewProperties();
711
704
 
712
 
    /**
713
 
     * Creates a new view representing the given view mode (DolphinView::mode()).
714
 
     * The current view will get deleted.
715
 
     */
716
 
    void createView();
717
 
 
718
 
    void deleteView();
 
705
    void applyAdditionalInfoListToView();
719
706
 
720
707
    /**
721
708
     * Helper method for DolphinView::paste() and DolphinView::pasteIntoFolder().
724
711
    void pasteToUrl(const KUrl& url);
725
712
 
726
713
    /**
727
 
     * Checks whether the current item view has the same zoom level
728
 
     * as \a oldZoomLevel. If this is not the case, the zoom level
729
 
     * of the controller is updated and a zoomLevelChanged() signal
730
 
     * is emitted.
731
 
     */
732
 
    void updateZoomLevel(int oldZoomLevel);
733
 
 
734
 
    /**
735
714
     * Returns a list of URLs for all selected items. The list is
736
715
     * simplified, so that when the URLs are part of different tree
737
716
     * levels, only the parent is returned.
745
724
 
746
725
    /**
747
726
     * Is invoked after a paste operation or a drag & drop
748
 
     * operation and adds the filenames of all URLs from \a mimeData to
749
 
     * m_newFileNames. This allows to select all newly added
750
 
     * items in slotDirListerCompleted().
751
 
     */
752
 
    void addNewFileNames(const QMimeData* mimeData);
753
 
 
754
 
    /**
755
 
     * Helper method for DolphinView::setItemSelectionEnabled(): Returns the selection for
756
 
     * all items of \p parent that match with the regular expression defined by \p pattern.
757
 
     */
758
 
    QItemSelection childrenMatchingPattern(const QModelIndex& parent, const QRegExp& pattern) const;
759
 
 
760
 
    void connectViewAccessor();
761
 
    void disconnectViewAccessor();
 
727
     * operation and URLs from \a mimeData as selected.
 
728
     * This allows to select all newly pasted
 
729
     * items in restoreViewState().
 
730
     */
 
731
    void markPastedUrlsAsSelected(const QMimeData* mimeData);
762
732
 
763
733
    /**
764
734
     * Updates m_isFolderWritable dependent on whether the folder represented by
767
737
     */
768
738
    void updateWritableState();
769
739
 
 
740
    QByteArray sortRoleForSorting(Sorting sorting) const;
 
741
    Sorting sortingForSortRole(const QByteArray& sortRole) const;
 
742
 
770
743
private:
771
 
    /**
772
 
     * Abstracts the access to the different view implementations
773
 
     * for icons-, details- and column-view.
774
 
     */
775
 
    class LIBDOLPHINPRIVATE_EXPORT ViewAccessor
776
 
    {
777
 
    public:
778
 
        ViewAccessor();
779
 
        ~ViewAccessor();
780
 
 
781
 
        void createView(QWidget* parent,
782
 
                        DolphinViewController* dolphinViewController,
783
 
                        const ViewModeController* viewModeController,
784
 
                        Mode mode);
785
 
        void deleteView();
786
 
 
787
 
        /**
788
 
         * Must be invoked before the URL has been changed and allows view implementations
789
 
         * like the column view to create a new column.
790
 
         */
791
 
        void prepareUrlChange(const KUrl& url);
792
 
 
793
 
        QAbstractItemView* itemView() const;
794
 
        KFileItemDelegate* itemDelegate() const;
795
 
 
796
 
        /**
797
 
         * Returns the widget that should be added to the layout as target. Usually
798
 
         * the item view itself is returned, but in the case of the column view
799
 
         * a container widget is returned.
800
 
         */
801
 
        QWidget* layoutTarget() const;
802
 
 
803
 
        void setRootUrl(const KUrl& rootUrl);
804
 
        KUrl rootUrl() const;
805
 
 
806
 
        bool supportsCategorizedSorting() const;
807
 
        bool itemsExpandable() const;
808
 
        QSet<KUrl> expandedUrls() const;
809
 
        const DolphinDetailsViewExpander* setExpandedUrls(const QSet<KUrl>& urlsToExpand);
810
 
 
811
 
        /**
812
 
         * Returns true, if a reloading of the items is required
813
 
         * when the additional information properties have been changed
814
 
         * by the user.
815
 
         */
816
 
        bool reloadOnAdditionalInfoChange() const;
817
 
 
818
 
        DolphinModel* dirModel() const;
819
 
        DolphinSortFilterProxyModel* proxyModel() const;
820
 
        KDirLister* dirLister() const;
821
 
 
822
 
    private:
823
 
        KUrl m_rootUrl;
824
 
        DolphinIconsView* m_iconsView;
825
 
        DolphinDetailsView* m_detailsView;
826
 
        DolphinColumnViewContainer* m_columnsContainer;
827
 
        DolphinModel* m_dolphinModel;
828
 
        DolphinSortFilterProxyModel* m_proxyModel;
829
 
        QAbstractItemView* m_dragSource;
830
 
        QPointer<DolphinDetailsViewExpander> m_detailsViewExpander;
831
 
 
832
 
        // For unit tests
833
 
        friend class DolphinDetailsViewTest;
834
 
    };
835
 
 
836
 
    bool m_active : 1;
837
 
    bool m_showPreview : 1;
838
 
    bool m_storedCategorizedSorting : 1;
839
 
    bool m_tabsForFiles : 1;
840
 
    bool m_isContextMenuOpen : 1;   // TODO: workaround for Qt-issue 207192
841
 
    bool m_assureVisibleCurrentIndex : 1;
842
 
    bool m_expanderActive : 1;
843
 
    bool m_isFolderWritable : 1;
844
 
 
 
744
    bool m_active;
 
745
    bool m_tabsForFiles;
 
746
    bool m_assureVisibleCurrentIndex;
 
747
    bool m_isFolderWritable;
 
748
    bool m_dragging; // True if a dragging is done. Required to be able to decide whether a
 
749
                     // tooltip may be shown when hovering an item.
 
750
 
 
751
    KUrl m_url;
845
752
    Mode m_mode;
 
753
    QList<AdditionalInfo> m_additionalInfoList;
846
754
 
847
755
    QVBoxLayout* m_topLayout;
848
756
 
849
 
    DolphinViewController* m_dolphinViewController;
850
 
    ViewModeController* m_viewModeController;
851
 
    ViewAccessor m_viewAccessor;
 
757
    DolphinDirLister* m_dirLister;
 
758
    DolphinItemListContainer* m_container;
 
759
 
 
760
    ToolTipManager* m_toolTipManager;
852
761
 
853
762
    QTimer* m_selectionChangedTimer;
854
763
 
855
 
    KUrl m_activeItemUrl;
 
764
    KUrl m_currentItemUrl; // Used for making the view to remember the current URL after F5
856
765
    QPoint m_restoredContentsPosition;
857
766
    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;
 
767
 
 
768
    QList<KUrl> m_selectedUrls; // Used for making the view to remember selections after F5
 
769
 
 
770
    VersionControlObserver* m_versionControlObserver;
866
771
 
867
772
    // For unit tests
868
773
    friend class TestBase;