┌   ┐
54
└   ┘

summaryrefslogtreecommitdiff
path: root/src/sidebartreeview.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/sidebartreeview.cpp')
-rw-r--r--src/sidebartreeview.cpp147
1 files changed, 0 insertions, 147 deletions
diff --git a/src/sidebartreeview.cpp b/src/sidebartreeview.cpp
deleted file mode 100644
index a876ee6c3..000000000
--- a/src/sidebartreeview.cpp
+++ /dev/null
@@ -1,147 +0,0 @@
-/***************************************************************************
- * Copyright (C) 2006 by Peter Penz <[email protected]> *
- * *
- * This program is free software; you can redistribute it and/or modify *
- * it under the terms of the GNU General Public License as published by *
- * the Free Software Foundation; either version 2 of the License, or *
- * (at your option) any later version. *
- * *
- * This program is distributed in the hope that it will be useful, *
- * but WITHOUT ANY WARRANTY; without even the implied warranty of *
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
- * GNU General Public License for more details. *
- * *
- * 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., *
- * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA *
- ***************************************************************************/
-
-#include "sidebartreeview.h"
-
-#include "dolphincontroller.h"
-#include "dolphinmodel.h"
-#include "draganddrophelper.h"
-
-#include <kfileitemdelegate.h>
-#include <QKeyEvent>
-#include <QPainter>
-#include <QHeaderView>
-#include <QScrollBar>
-
-SidebarTreeView::SidebarTreeView(QWidget* parent) :
- KTreeView(parent)
-{
- setAcceptDrops(true);
- setUniformRowHeights(true);
- setSelectionMode(QAbstractItemView::SingleSelection);
- setEditTriggers(QAbstractItemView::NoEditTriggers);
- setSortingEnabled(true);
- setFrameStyle(QFrame::NoFrame);
- setDragDropMode(QAbstractItemView::DragDrop);
- setDropIndicatorShown(false);
-
- setVerticalScrollMode(QListView::ScrollPerPixel);
- setHorizontalScrollMode(QListView::ScrollPerPixel);
-
- viewport()->setAttribute(Qt::WA_Hover);
-
- // make the background transparent and apply the window-text color
- // to the text color, so that enough contrast is given for all color
- // schemes
- QPalette p = palette();
- p.setColor(QPalette::Active, QPalette::Text, p.color(QPalette::Active, QPalette::WindowText));
- p.setColor(QPalette::Inactive, QPalette::Text, p.color(QPalette::Inactive, QPalette::WindowText));
- p.setColor(QPalette::Disabled, QPalette::Text, p.color(QPalette::Disabled, QPalette::WindowText));
- setPalette(p);
- viewport()->setAutoFillBackground(false);
-
- KFileItemDelegate* delegate = new KFileItemDelegate(this);
- setItemDelegate(delegate);
-}
-
-SidebarTreeView::~SidebarTreeView()
-{
-}
-
-bool SidebarTreeView::event(QEvent* event)
-{
- switch (event->type()) {
- case QEvent::Polish:
- // hide all columns except of the 'Name' column
- hideColumn(DolphinModel::Size);
- hideColumn(DolphinModel::ModifiedTime);
- hideColumn(DolphinModel::Permissions);
- hideColumn(DolphinModel::Owner);
- hideColumn(DolphinModel::Group);
- hideColumn(DolphinModel::Type);
- hideColumn(DolphinModel::Rating);
- hideColumn(DolphinModel::Tags);
- header()->hide();
- break;
-
- case QEvent::Show:
- // TODO: The opening/closing animation of subtrees flickers in combination with the
- // sidebar when using the Oxygen style. As workaround the animation is turned off:
- setAnimated(false);
- break;
-
- case QEvent::UpdateRequest:
- // a wheel movement will scroll 1 item
- if (model()->rowCount() > 0) {
- verticalScrollBar()->setSingleStep(sizeHintForRow(0) / 3);
- }
- break;
-
- default:
- break;
- }
-
- return KTreeView::event(event);
-}
-
-void SidebarTreeView::startDrag(Qt::DropActions supportedActions)
-{
- DragAndDropHelper::instance().startDrag(this, supportedActions);
-}
-
-void SidebarTreeView::dragEnterEvent(QDragEnterEvent* event)
-{
- KTreeView::dragEnterEvent(event);
- if (event->mimeData()->hasUrls()) {
- event->acceptProposedAction();
- }
-}
-
-void SidebarTreeView::dragLeaveEvent(QDragLeaveEvent* event)
-{
- KTreeView::dragLeaveEvent(event);
- setDirtyRegion(m_dropRect);
-}
-
-void SidebarTreeView::dragMoveEvent(QDragMoveEvent* event)
-{
- KTreeView::dragMoveEvent(event);
-
- // TODO: remove this code when the issue #160611 is solved in Qt 4.4
- const QModelIndex index = indexAt(event->pos());
- setDirtyRegion(m_dropRect);
- m_dropRect = visualRect(index);
- setDirtyRegion(m_dropRect);
-
- if (event->mimeData()->hasUrls()) {
- // accept url drops, independently from the destination item
- event->acceptProposedAction();
- }
-}
-
-void SidebarTreeView::dropEvent(QDropEvent* event)
-{
- const QModelIndex index = indexAt(event->pos());
- if (index.isValid()) {
- emit urlsDropped(index, event);
- }
- KTreeView::dropEvent(event);
-}
-
-#include "sidebartreeview.moc"