]>
cloud.milkyroute.net Git - dolphin.git/blob - src/dolphindetailsview.h
1 /***************************************************************************
2 * Copyright (C) 2006 by Peter Penz *
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. *
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. *
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 * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. *
19 ***************************************************************************/
21 #ifndef DOLPHINDETAILSVIEW_H
22 #define DOLPHINDETAILSVIEW_H
24 #include <kfiledetailview.h>
25 #include <itemeffectsmanager.h>
28 #include <QResizeEvent>
31 #include <QMouseEvent>
32 #include <QDragMoveEvent>
33 #include <QPaintEvent>
40 * @brief Represents the details view which shows the name, size,
41 * date, permissions, owner and group of an item.
43 * The width of the columns are automatically adjusted in a way
44 * that full available width of the view is used by stretching the width
49 class DolphinDetailsView
: public KFileDetailView
, public ItemEffectsManager
55 * Maps the column indices of KFileDetailView to a
56 * descriptive column name.
62 PermissionsColumn
= 3,
67 DolphinDetailsView(DolphinView
* parent
);
69 virtual ~DolphinDetailsView();
71 /** @see ItemEffectsManager::updateItems */
72 virtual void beginItemUpdates();
74 /** @see ItemEffectsManager::updateItems */
75 virtual void endItemUpdates();
77 /** @see KFileView::insertItem */
78 virtual void insertItem(KFileItem
* fileItem
);
81 * @return True, if the position \a pos is above the name of
84 bool isOnFilename(const Q3ListViewItem
* item
, const QPoint
& pos
) const;
87 * Reads out the dolphin settings for the details view and refreshs
90 // TODO: Other view implementations use a similar interface. When using
91 // Interview in Qt4 this method should be moved to a base class (currently
92 // not possible due to having different base classes for the views).
93 void refreshSettings();
95 /** @see ItemEffectsManager::zoomIn() */
96 virtual void zoomIn();
98 /** @see ItemEffectsManager::zoomOut() */
99 virtual void zoomOut();
101 /** @see ItemEffectsManager::isZoomInPossible() */
102 virtual bool isZoomInPossible() const;
104 /** @see ItemEffectsManager::isZoomOutPossible() */
105 virtual bool isZoomOutPossible() const;
109 * Is send, if the details view should be activated. Usually an activation
110 * is triggered by a mouse click.
112 void signalRequestActivation();
115 /** @see KFileDetailView::resizeContents */
116 virtual void resizeContents(int width
, int height
);
118 /** Is connected to the onItem-signal from KFileDetailView. */
119 void slotOnItem(Q3ListViewItem
* item
);
121 /** Is connected to the onViewport-signal from KFileDetailView. */
122 void slotOnViewport();
125 /** @see ItemEffectsManager::setContextPixmap() */
126 virtual void setContextPixmap(void* context
,
127 const QPixmap
& pixmap
);
129 /** @see ItemEffectsManager::setContextPixmap() */
130 virtual const QPixmap
* contextPixmap(void* context
);
132 /** @see ItemEffectsManager::setContextPixmap() */
133 virtual void* firstContext();
135 /** @see ItemEffectsManager::setContextPixmap() */
136 virtual void* nextContext(void* context
);
138 /** @see ItemEffectsManager::setContextPixmap() */
139 virtual KFileItem
* contextFileInfo(void* context
);
141 /** @see KFileDetailView::contentsDragMoveEvent() */
142 virtual void contentsDragMoveEvent(QDragMoveEvent
* event
);
144 /** @see KFileDetailView::resizeEvent() */
145 virtual void resizeEvent(QResizeEvent
* event
);
147 /** @see KFileDetailView::acceptDrag() */
148 virtual bool acceptDrag (QDropEvent
* event
) const;
150 /** @see KFileDetailView::contentsDropEvent() */
151 virtual void contentsDropEvent(QDropEvent
* event
);
153 /** @see KFileDetailView::contentsMousePressEvent() */
154 virtual void contentsMousePressEvent(QMouseEvent
* event
);
156 /** @see KFileDetailView::contentsMouseMoveEvent() */
157 virtual void contentsMouseMoveEvent(QMouseEvent
* event
);
159 /** @see KFileDetailView::contentsMouseReleaseEvent() */
160 virtual void contentsMouseReleaseEvent(QMouseEvent
* event
);
162 /** @see QListView::paintEmptyArea() */
163 virtual void paintEmptyArea(QPainter
* painter
, const QRect
& rect
);
165 /** Draws the selection rubber. */
168 /** @see QListView::viewportPaintEvent() */
169 virtual void viewportPaintEvent(QPaintEvent
* paintEvent
);
171 /** @see QWidget::leaveEvent() */
172 virtual void leaveEvent(QEvent
* event
);
175 void slotActivationUpdate();
176 void slotContextMenuRequested(Q3ListViewItem
* item
,
179 void slotUpdateDisabledItems();
180 void slotAutoScroll();
181 void updateColumnsWidth();
182 void slotItemRenamed(Q3ListViewItem
* item
,
187 * Is invoked when a section from the header has
188 * been clicked and stores the sort column and sort
191 void slotHeaderClicked(int section
);
194 class DolphinListViewItem
: public KFileListViewItem
{
196 DolphinListViewItem(Q3ListView
* parent
,
197 KFileItem
* fileItem
);
198 virtual ~DolphinListViewItem();
199 virtual void paintCell(QPainter
* painter
,
200 const QColorGroup
& colorGroup
,
205 virtual void paintFocus(QPainter
* painter
,
206 const QColorGroup
& colorGroup
,
210 DolphinView
* m_dolphinView
;
211 QTimer
* m_resizeTimer
;
212 QTimer
* m_scrollTimer
;
216 * Returns the width of the filename in pixels including
217 * the icon. It is assured that the returned width is
218 * <= the width of the filename column.
220 int filenameWidth(const Q3ListViewItem
* item
) const;