]> cloud.milkyroute.net Git - dolphin.git/blobdiff - src/dolphindetailsview.h
Dolphin is now a KUniqueApplication. A lot of thanks go to Oscar Blumberg, who submit...
[dolphin.git] / src / dolphindetailsview.h
index 86f579cce6fb5ff978cd19ab0e5ab53ff18a1dda..e66adf5738bc34a7283eec3e6bfed2e4b9b02927 100644 (file)
  *   You should have received a copy of the GNU General Public License     *
  *   along with this program; if not, write to the                         *
  *   Free Software Foundation, Inc.,                                       *
- *   59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.             *
+ *   51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA            *
  ***************************************************************************/
 
 #ifndef DOLPHINDETAILSVIEW_H
 #define DOLPHINDETAILSVIEW_H
 
-#include <kfiledetailview.h>
-#include <itemeffectsmanager.h>
-//Added by qt3to4:
-#include <QPixmap>
-#include <QResizeEvent>
-#include <QEvent>
-#include <QDropEvent>
-#include <QMouseEvent>
-#include <QDragMoveEvent>
-#include <QPaintEvent>
+#include <dolphinview.h>
+#include <QTreeView>
 
-class QRect;
-class QTimer;
-class DolphinView;
+class DolphinController;
 
 /**
  * @brief Represents the details view which shows the name, size,
- * date, permissions, owner and group of an item.
+ *        date, permissions, owner and group of an item.
  *
- * The width of the columns are automatically adjusted in a way
+ * The width of the columns is automatically adjusted in a way
  * that full available width of the view is used by stretching the width
  * of the name column.
- *
- * @author Peter Penz
  */
-class DolphinDetailsView : public KFileDetailView, public ItemEffectsManager
+class DolphinDetailsView : public QTreeView
 {
     Q_OBJECT
 
 public:
-    /**
-     * Maps the column indices of KFileDetailView to a
-     * descriptive column name.
-     */
-    enum ColumnName {
-        NameColumn        = 0,
-        SizeColumn        = 1,
-        DateColumn        = 2,
-        PermissionsColumn = 3,
-        OwnerColumn       = 4,
-        GroupColumn       = 5
-    };
-
-    DolphinDetailsView(DolphinView* parent);
-
+    explicit DolphinDetailsView(QWidget* parent, DolphinController* controller);
     virtual ~DolphinDetailsView();
 
-    /** @see ItemEffectsManager::updateItems */
-    virtual void beginItemUpdates();
-
-    /** @see ItemEffectsManager::updateItems */
-    virtual void endItemUpdates();
-
-    /** @see KFileView::insertItem */
-    virtual void insertItem(KFileItem* fileItem);
-
-    /**
-     * @return  True, if the position \a pos is above the name of
-     *          item \a item.
-     */
-    bool isOnFilename(const Q3ListViewItem* item, const QPoint& pos) const;
+protected:
+    virtual bool event(QEvent* event);
+    virtual QStyleOptionViewItem viewOptions() const;
+    virtual void contextMenuEvent(QContextMenuEvent* event);
+    virtual void mouseReleaseEvent(QMouseEvent* event);
+    virtual void dragEnterEvent(QDragEnterEvent* event);
+    virtual void dropEvent(QDropEvent* event);
 
+private slots:
     /**
-     * Reads out the dolphin settings for the details view and refreshs
-     * the details view.
+     * Sets the sort indicator section of the header view
+     * corresponding to \a sorting.
      */
-    // TODO: Other view implementations use a similar interface. When using
-    // Interview in Qt4 this method should be moved to a base class (currently
-    // not possible due to having different base classes for the views).
-    void refreshSettings();
-
-    /** @see ItemEffectsManager::zoomIn() */
-    virtual void zoomIn();
-
-    /** @see ItemEffectsManager::zoomOut() */
-    virtual void zoomOut();
+    void setSortIndicatorSection(DolphinView::Sorting sorting);
 
-    /** @see ItemEffectsManager::isZoomInPossible() */
-    virtual bool isZoomInPossible() const;
-
-    /** @see ItemEffectsManager::isZoomOutPossible() */
-    virtual bool isZoomOutPossible() const;
-
-signals:
     /**
-     * Is send, if the details view should be activated. Usually an activation
-     * is triggered by a mouse click.
+     * Sets the sort indicator order of the header view
+     * corresponding to \a sortOrder.
      */
-    void signalRequestActivation();
-
-public slots:
-    /** @see KFileDetailView::resizeContents */
-    virtual void resizeContents(int width, int height);
-
-    /** Is connected to the onItem-signal from KFileDetailView. */
-    void slotOnItem(Q3ListViewItem* item);
-
-    /** Is connected to the onViewport-signal from KFileDetailView. */
-    void slotOnViewport();
-
-protected:
-    /** @see ItemEffectsManager::setContextPixmap() */
-    virtual void setContextPixmap(void* context,
-                                  const QPixmap& pixmap);
-
-    /** @see ItemEffectsManager::setContextPixmap() */
-    virtual const QPixmap* contextPixmap(void* context);
-
-    /** @see ItemEffectsManager::setContextPixmap() */
-    virtual void* firstContext();
-
-    /** @see ItemEffectsManager::setContextPixmap() */
-    virtual void* nextContext(void* context);
-
-    /** @see ItemEffectsManager::setContextPixmap() */
-    virtual KFileItem* contextFileInfo(void* context);
-
-    /** @see KFileDetailView::contentsDragMoveEvent() */
-    virtual void contentsDragMoveEvent(QDragMoveEvent* event);
-
-    /** @see KFileDetailView::resizeEvent() */
-    virtual void resizeEvent(QResizeEvent* event);
-
-    /** @see KFileDetailView::acceptDrag() */
-    virtual bool acceptDrag (QDropEvent* event) const;
-
-    /** @see KFileDetailView::contentsDropEvent() */
-    virtual void contentsDropEvent(QDropEvent* event);
-
-    /** @see KFileDetailView::contentsMousePressEvent() */
-    virtual void contentsMousePressEvent(QMouseEvent* event);
-
-    /** @see KFileDetailView::contentsMouseMoveEvent() */
-    virtual void contentsMouseMoveEvent(QMouseEvent* event);
-
-    /** @see KFileDetailView::contentsMouseReleaseEvent() */
-    virtual void contentsMouseReleaseEvent(QMouseEvent* event);
-
-    /** @see QListView::paintEmptyArea() */
-    virtual void paintEmptyArea(QPainter* painter, const QRect& rect);
-
-    /** Draws the selection rubber. */
-    void drawRubber();
-
-    /** @see QListView::viewportPaintEvent() */
-    virtual void viewportPaintEvent(QPaintEvent* paintEvent);
-
-    /** @see QWidget::leaveEvent() */
-    virtual void leaveEvent(QEvent* event);
-
-private slots:
-    void slotActivationUpdate();
-    void slotContextMenuRequested(Q3ListViewItem* item,
-                                  const QPoint& pos,
-                                  int col);
-    void slotUpdateDisabledItems();
-    void slotAutoScroll();
-    void updateColumnsWidth();
-    void slotItemRenamed(Q3ListViewItem* item,
-                         const QString& name,
-                         int column);
+    void setSortIndicatorOrder(Qt::SortOrder sortOrder);
 
     /**
-     * Is invoked when a section from the header has
-     * been clicked and stores the sort column and sort
-     * order.
+     * Synchronizes the sorting state of the Dolphin menu 'View -> Sort'
+     * with the current state of the details view.
+     * @param column Index of the current sorting column.
      */
-    void slotHeaderClicked(int section);
+     void synchronizeSortingState(int column);
 
 private:
-    class DolphinListViewItem : public KFileListViewItem {
-    public:
-        DolphinListViewItem(Q3ListView* parent,
-                            KFileItem* fileItem);
-        virtual ~DolphinListViewItem();
-        virtual void paintCell(QPainter* painter,
-                               const QColorGroup& colorGroup,
-                               int column,
-                               int cellWidth,
-                               int alignment);
-
-        virtual void paintFocus(QPainter* painter,
-                                const QColorGroup& colorGroup,
-                                const QRect& rect);
-    };
-
-    DolphinView* m_dolphinView;
-    QTimer* m_resizeTimer;
-    QTimer* m_scrollTimer;
-    QRect* m_rubber;
-
-    /**
-     * Returns the width of the filename in pixels including
-     * the icon. It is assured that the returned width is
-     * <= the width of the filename column.
-     */
-    int filenameWidth(const Q3ListViewItem* item) const;
-
+    DolphinController* m_controller;
 };
 
 #endif