┌   ┐
54
└   ┘

summaryrefslogtreecommitdiff
path: root/src/views/dolphinviewautoscroller.h
diff options
context:
space:
mode:
authorPeter Penz <[email protected]>2011-11-26 01:05:58 +0100
committerPeter Penz <[email protected]>2011-11-26 01:16:31 +0100
commit362817d1834f2ada3ea4552a25fa39bbbb540f8c (patch)
tree706f316224397b44f95516ba857bb8d380a0bb47 /src/views/dolphinviewautoscroller.h
parentbf1a8f989e75a50c9a5c839e69573a87ab9ad934 (diff)
Folders Panel fixes
The following functionality from Dolphin 1.x has been ported to the new view-engine: - Allow expanding/collapsing of items - Automatically select the current item - Context menu for items Related improvements to the view-engine: - Make the expanding/collapsing interface already accessible in the base classes KItemModelBase and KItemListView. If no expanding/collapsing is supported at all by derived models (which is usually the default case) simply not reimplementing those 3 methods is sufficient and it does not introduce an additional complexity like in QAbstractItemModel/QModelIndex. - Automatically handle the expanding/collapsing in KItemListController. This also includes the key-handling, which is quite special for expandable items. - Don't let KItemListView automatically scroll to the current item if the current item got changed. The automatic scrolling should only be done if the current item has been changed by the user. Hence this functionality has been moved to the KItemListController which currently only triggers the automatic scrolling if the current item has been changed by the keyboard (we might extend the usecases later if required).
Diffstat (limited to 'src/views/dolphinviewautoscroller.h')
-rw-r--r--src/views/dolphinviewautoscroller.h79
1 files changed, 0 insertions, 79 deletions
diff --git a/src/views/dolphinviewautoscroller.h b/src/views/dolphinviewautoscroller.h
deleted file mode 100644
index 04d91a8f6..000000000
--- a/src/views/dolphinviewautoscroller.h
+++ /dev/null
@@ -1,79 +0,0 @@
-/***************************************************************************
- * Copyright (C) 2008 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 *
- ***************************************************************************/
-
-#ifndef DOLPHINVIEWAUTOSCROLLER_H
-#define DOLPHINVIEWAUTOSCROLLER_H
-
-#include <QTime>
-#include <QObject>
-
-class QAbstractItemView;
-class QModelIndex;
-class QTimer;
-
-/**
- * @brief Assures that an autoscrolling is done for item views.
- *
- * This is a workaround as QAbstractItemView::setAutoScroll() is not usable
- * when selecting items (see Qt issue #214542).
- */
-class DolphinViewAutoScroller : public QObject
-{
- Q_OBJECT
-
-public:
- DolphinViewAutoScroller(QAbstractItemView* parent);
- virtual ~DolphinViewAutoScroller();
- bool isActive() const;
-
- /**
- * Must be invoked by the parent item view, when QAbstractItemView::currentChanged()
- * has been called. Assures that the current item stays visible when it has been
- * changed by the keyboard.
- */
- void handleCurrentIndexChange(const QModelIndex& current, const QModelIndex& previous);
-
-protected:
- virtual bool eventFilter(QObject* watched, QEvent* event);
-
-private slots:
- void scrollViewport();
-
-private:
- void triggerAutoScroll();
- void stopAutoScroll();
-
- /**
- * Calculates the scroll increment dependent from
- * the cursor position \a cursorPos and the range 0 - \a rangeSize - 1.
- */
- int calculateScrollIncrement(int cursorPos, int rangeSize) const;
-
-private:
- bool m_rubberBandSelection;
- bool m_keyPressed;
- bool m_initializedTimestamp;
- int m_horizontalScrollInc;
- int m_verticalScrollInc;
- QAbstractItemView* m_itemView;
- QTimer* m_timer;
- QTime m_timestamp;
-};
-
-#endif