1
/***************************************************************************
2
* Copyright (C) 2007 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 DOLPHINCOLUMNWIDGET_H
21
#define DOLPHINCOLUMNWIDGET_H
23
#include "dolphinview.h"
28
#include <QStyleOption>
32
class DolphinColumnView;
34
class DolphinSortFilterProxyModel;
35
class DolphinDirLister;
36
class DolphinViewAutoScroller;
37
class KFilePreviewGenerator;
41
class SelectionManager;
46
* Represents one column inside the DolphinColumnView and has been
47
* extended to respect view options and hovering information.
49
class DolphinColumnWidget : public QListView
54
DolphinColumnWidget(QWidget* parent,
55
DolphinColumnView* columnView,
57
virtual ~DolphinColumnWidget();
59
/** Sets the size of the icons. */
60
void setDecorationSize(const QSize& size);
63
* An active column is defined as column, which shows the same URL
64
* as indicated by the URL navigator. The active column is usually
65
* drawn in a lighter color. All operations are applied to this column.
67
void setActive(bool active);
68
bool isActive() const;
71
* Sets the directory URL of the child column that is shown next to
72
* this column. This property is only used for a visual indication
73
* of the shown directory, it does not trigger a loading of the model.
75
void setChildUrl(const KUrl& url);
76
const KUrl& childUrl() const;
78
/** Sets the directory URL that is shown inside the column widget. */
79
void setUrl(const KUrl& url);
81
/** Returns the directory URL that is shown inside the column widget. */
82
const KUrl& url() const;
84
/** Reloads the directory DolphinColumnWidget::url(). */
87
void setSorting(DolphinView::Sorting sorting);
88
void setSortOrder(Qt::SortOrder order);
89
void setSortFoldersFirst(bool foldersFirst);
90
void setShowHiddenFiles(bool show);
91
void setShowPreview(bool show);
94
* Updates the background color dependent from the activation state
95
* \a isViewActive of the column view.
97
void updateBackground();
100
* Filters the currently shown items by \a nameFilter. All items
101
* which contain the given filter string will be shown.
103
void setNameFilter(const QString& nameFilter);
106
* Does an inline editing for the item \a item.
108
void editItem(const KFileItem& item);
111
* Returns the item on the position \a pos. The KFileItem instance
112
* is null if no item is below the position.
114
KFileItem itemAt(const QPoint& pos) const;
116
KFileItemList selectedItems() const;
119
* Returns the MIME data for the selected items.
121
QMimeData* selectionMimeData() const;
124
virtual QStyleOptionViewItem viewOptions() const;
125
virtual void startDrag(Qt::DropActions supportedActions);
126
virtual void dragEnterEvent(QDragEnterEvent* event);
127
virtual void dragLeaveEvent(QDragLeaveEvent* event);
128
virtual void dragMoveEvent(QDragMoveEvent* event);
129
virtual void dropEvent(QDropEvent* event);
130
virtual void paintEvent(QPaintEvent* event);
131
virtual void mousePressEvent(QMouseEvent* event);
132
virtual void keyPressEvent(QKeyEvent* event);
133
virtual void contextMenuEvent(QContextMenuEvent* event);
134
virtual void wheelEvent(QWheelEvent* event);
135
virtual void leaveEvent(QEvent* event);
136
virtual void selectionChanged(const QItemSelection& selected, const QItemSelection& deselected);
137
virtual void currentChanged(const QModelIndex& current, const QModelIndex& previous);
140
void slotEntered(const QModelIndex& index);
141
void requestActivation();
145
/** Used by DolphinColumnWidget::setActive(). */
148
/** Used by DolphinColumnWidget::setActive(). */
153
DolphinColumnView* m_view;
154
SelectionManager* m_selectionManager;
155
DolphinViewAutoScroller* m_autoScroller;
156
KUrl m_url; // URL of the directory that is shown
157
KUrl m_childUrl; // URL of the next column that is shown
160
QSize m_decorationSize;
162
DolphinDirLister* m_dirLister;
163
DolphinModel* m_dolphinModel;
164
DolphinSortFilterProxyModel* m_proxyModel;
166
KFilePreviewGenerator* m_previewGenerator;
168
ToolTipManager* m_toolTipManager;
172
friend class DolphinColumnView;
175
inline bool DolphinColumnWidget::isActive() const
180
inline void DolphinColumnWidget::setChildUrl(const KUrl& url)
185
inline const KUrl& DolphinColumnWidget::childUrl() const
190
inline void DolphinColumnWidget::setUrl(const KUrl& url)
198
inline const KUrl& DolphinColumnWidget::url() const