* Remove the workaround in DolphinIconsView::scrollTo() to bypass an issue in Qt 4.4 (-> fixed in Qt 4.5)
* Revert the "use the DolphinController"-parts of commit 930754 and just use QAbstractItemView::scrollTo() instead.
CCBUG: 185191
svn path=/trunk/KDE/kdebase/apps/; revision=930777
this, SLOT(setZoomLevel(int)));
connect(controller, SIGNAL(activationChanged(bool)),
this, SLOT(updateColumnsBackground(bool)));
- connect(controller, SIGNAL(scrollToCurrentItem()),
- this, SLOT(scrollToCurrentItem()));
const DolphinView* view = controller->dolphinView();
connect(view, SIGNAL(sortingChanged(DolphinView::Sorting)),
}
}
-void DolphinColumnView::scrollToCurrentItem()
-{
- const QModelIndex activeIndex = activeColumn()->currentIndex();
- activeColumn()->scrollTo(activeIndex);
-}
-
void DolphinColumnView::setActiveColumnIndex(int index)
{
if (m_index == index) {
void slotSortOrderChanged(Qt::SortOrder order);
void slotShowHiddenFilesChanged();
void slotShowPreviewChanged();
- void scrollToCurrentItem();
private:
DolphinColumnWidget* activeColumn() const;
}
}
-void DolphinController::triggerScrollToCurrentItem()
-{
- emit scrollToCurrentItem();
-}
-
void DolphinController::handleKeyPressEvent(QKeyEvent* event)
{
Q_ASSERT(m_itemView != 0);
* - setShowPreview()
* - indicateActivationChange()
* - setZoomLevel()
- * - triggerScrollToCurrentItem()
*/
class LIBDOLPHINPRIVATE_EXPORT DolphinController : public QObject
{
void setZoomLevel(int level);
int zoomLevel() const;
- /**
- * Triggers the view implementation to assure having a fully visible
- * current item. The signal scrollToCurrentItem() will be emitted.
- */
- void triggerScrollToCurrentItem();
-
/**
* Tells the view implementation to zoom out by emitting the signal zoomOut()
* and is invoked by the abstract Dolphin view.
*/
void hideToolTip();
- /**
- * Is emitted if the view implementation should scroll to the current item, so
- * that it is fully visible.
- */
- void scrollToCurrentItem();
-
private slots:
void updateMouseButtonState();
this, SLOT(updateColumnVisibility()));
connect(controller, SIGNAL(activationChanged(bool)),
this, SLOT(slotActivationChanged(bool)));
- connect(controller, SIGNAL(scrollToCurrentItem()),
- this, SLOT(scrollToCurrentItem()));
if (settings->useSystemFont()) {
m_font = KGlobalSettings::generalFont();
setItemsExpandable(expandable);
}
-void DolphinDetailsView::scrollToCurrentItem()
-{
- scrollTo(currentIndex());
-}
-
void DolphinDetailsView::updateDecorationSize(bool showPreview)
{
DetailsModeSettings* settings = DolphinSettings::instance().detailsModeSettings();
*/
void setFoldersExpandable(bool expandable);
- void scrollToCurrentItem();
-
private:
/**
* Updates the size of the decoration dependent on the
DolphinIconsView::DolphinIconsView(QWidget* parent, DolphinController* controller) :
KCategorizedView(parent),
- m_enableScrollTo(false),
m_controller(controller),
m_selectionManager(0),
m_autoScroller(0),
controller, SLOT(emitViewportEntered()));
connect(controller, SIGNAL(zoomLevelChanged(int)),
this, SLOT(setZoomLevel(int)));
- connect(controller, SIGNAL(scrollToCurrentItem()),
- this, SLOT(scrollToCurrentItem()));
const DolphinView* view = controller->dolphinView();
connect(view, SIGNAL(showPreviewChanged()),
m_categoryDrawer = 0;
}
-void DolphinIconsView::scrollTo(const QModelIndex& index, ScrollHint hint)
-{
- // Enable the QListView implementation of scrollTo() only if it has been
- // triggered by a key press. Otherwise QAbstractItemView wants to scroll to the current
- // index each time the layout has been changed. This becomes an issue when
- // previews are loaded and the scrollbar is used: the scrollbar will always
- // be reset to 0 on each new preview.
- if (m_enableScrollTo || (state() != QAbstractItemView::NoState)) {
- KCategorizedView::scrollTo(index, hint);
- m_enableScrollTo = false;
- }
-}
-
void DolphinIconsView::dataChanged(const QModelIndex& topLeft, const QModelIndex& bottomRight)
{
KCategorizedView::dataChanged(topLeft, bottomRight);
void DolphinIconsView::keyPressEvent(QKeyEvent* event)
{
- m_enableScrollTo = true; // see DolphinIconsView::scrollTo()
KCategorizedView::keyPressEvent(event);
m_controller->handleKeyPressEvent(event);
}
}
}
-void DolphinIconsView::scrollToCurrentItem()
-{
- m_enableScrollTo = true;
- scrollTo(currentIndex());
- m_enableScrollTo = false;
-}
-
void DolphinIconsView::updateGridSize(bool showPreview, int additionalInfoCount)
{
const IconsModeSettings* settings = DolphinSettings::instance().iconsModeSettings();
public:
explicit DolphinIconsView(QWidget* parent, DolphinController* controller);
virtual ~DolphinIconsView();
- virtual void scrollTo(const QModelIndex& index, ScrollHint hint = EnsureVisible);
protected slots:
virtual void dataChanged(const QModelIndex& topLeft, const QModelIndex& bottomRight);
void setZoomLevel(int level);
void requestActivation();
void slotGlobalSettingsChanged(int category);
- void scrollToCurrentItem();
private:
/**
int additionalInfoCount() const;
private:
- bool m_enableScrollTo;
DolphinController* m_controller;
SelectionManager* m_selectionManager;
DolphinViewAutoScroller* m_autoScroller;
{
if (m_assureVisibleCurrentIndex) {
m_assureVisibleCurrentIndex = false;
- // Invoking itemView()->scrollTo(itemView()->currentIndex()) is
- // not sufficient, as QListView and QTreeView have an inconsistent
- // default behavior.
- m_controller->triggerScrollToCurrentItem();
+ itemView()->scrollTo(itemView()->currentIndex());
}
}