1 /***************************************************************************
2 * Copyright (C) 2009 by Peter Penz <peter.penz@gmx.at> *
4 * This program is free software; you can redistribute it and/or modify *
5 * it under the terms of the GNU General Public License as published by *
6 * the Free Software Foundation; either version 2 of the License, or *
7 * (at your option) any later version. *
9 * This program is distributed in the hope that it will be useful, *
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of *
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
12 * GNU General Public License for more details. *
14 * You should have received a copy of the GNU General Public License *
15 * along with this program; if not, write to the *
16 * Free Software Foundation, Inc., *
17 * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA *
18 ***************************************************************************/
20 #ifndef VIEWEXTENSIONSFACTORY_H
21 #define VIEWEXTENSIONSFACTORY_H
25 #include "dolphinview.h"
27 class DolphinFileItemDelegate
;
28 class DolphinSortFilterProxyModel
;
29 class DolphinViewAutoScroller
;
30 class KFilePreviewGenerator
;
33 class SelectionManager
;
35 class QAbstractItemView
;
36 class VersionControlObserver
;
37 class ViewModeController
;
40 * @brief Responsible for creating extensions like tooltips and previews
41 * that are available in all view implementations.
43 * Each view implementation (iconsview, detailsview, columnview) must
44 * instantiate an instance of this class to assure having
45 * a common behavior that is independent from the custom functionality of
46 * a view implementation.
48 class ViewExtensionsFactory
: public QObject
53 explicit ViewExtensionsFactory(QAbstractItemView
* view
,
54 DolphinViewController
* dolphinViewController
,
55 const ViewModeController
* viewModeController
);
56 virtual ~ViewExtensionsFactory();
59 * Must be invoked by the item view, when QAbstractItemView::currentChanged()
60 * has been called. Assures that the current item stays visible when it has been
61 * changed by the keyboard.
63 void handleCurrentIndexChange(const QModelIndex
& current
, const QModelIndex
& previous
);
65 DolphinFileItemDelegate
* fileItemDelegate() const;
68 * Enables the automatically expanding of a folder when dragging
69 * items above the folder.
71 void setAutoFolderExpandingEnabled(bool enabled
);
72 bool autoFolderExpandingEnabled() const;
75 virtual bool eventFilter(QObject
* watched
, QEvent
* event
);
78 void slotZoomLevelChanged();
79 void cancelPreviews();
80 void slotShowPreviewChanged();
81 void slotShowHiddenFilesChanged();
82 void slotSortingChanged(DolphinView::Sorting sorting
);
83 void slotSortOrderChanged(Qt::SortOrder order
);
84 void slotSortFoldersFirstChanged(bool foldersFirst
);
85 void slotNameFilterChanged(const QString
& nameFilter
);
86 void slotRequestVersionControlActions(const KFileItemList
& items
);
87 void requestActivation();
90 DolphinSortFilterProxyModel
* proxyModel() const;
93 QAbstractItemView
* m_view
;
94 DolphinViewController
* m_dolphinViewController
;
95 ToolTipManager
* m_toolTipManager
;
96 KFilePreviewGenerator
* m_previewGenerator
;
97 SelectionManager
* m_selectionManager
;
98 DolphinViewAutoScroller
* m_autoScroller
;
99 DolphinFileItemDelegate
* m_fileItemDelegate
;
100 VersionControlObserver
* m_versionControlObserver
;
101 FolderExpander
* m_folderExpander
;