Reactivate keyboard navigation again. Previously the Return key did not work, as the 'activated()' signal cannot be used (it ignores KDEs single vs. doubleclick setting).

svn path=/trunk/KDE/kdebase/apps/; revision=710356
This commit is contained in:
Peter Penz 2007-09-09 18:38:04 +00:00
parent fd9296c185
commit a69d7a3955
5 changed files with 28 additions and 0 deletions

View file

@ -69,6 +69,10 @@ DolphinDetailsView::DolphinDetailsView(QWidget* parent, DolphinController* contr
connect(parent, SIGNAL(sortOrderChanged(Qt::SortOrder)),
this, SLOT(setSortIndicatorOrder(Qt::SortOrder)));
// TODO: Connecting to the signal 'activated()' is not possible, as kstyle
// does not forward the single vs. doubleclick to it yet (KDE 4.1?). Hence it is
// necessary connecting the signal 'singleClick()' or 'doubleClick' and to handle the
// RETURN-key in keyPressEvent().
if (KGlobalSettings::singleClick()) {
connect(this, SIGNAL(clicked(const QModelIndex&)),
this, SLOT(slotItemActivated(const QModelIndex&)));
@ -271,6 +275,14 @@ void DolphinDetailsView::paintEvent(QPaintEvent* event)
}
}
void DolphinDetailsView::keyPressEvent(QKeyEvent* event)
{
QTreeView::keyPressEvent(event);
if (event->key() == Qt::Key_Return) {
m_controller->triggerItem(selectionModel()->currentIndex());
}
}
void DolphinDetailsView::setSortIndicatorSection(DolphinView::Sorting sorting)
{
QHeaderView* headerView = header();

View file

@ -56,6 +56,7 @@ protected:
virtual void dragMoveEvent(QDragMoveEvent* event);
virtual void dropEvent(QDropEvent* event);
virtual void paintEvent(QPaintEvent* event);
virtual void keyPressEvent(QKeyEvent* event);
private slots:
/**

View file

@ -46,6 +46,10 @@ DolphinIconsView::DolphinIconsView(QWidget* parent, DolphinController* controlle
setMouseTracking(true);
viewport()->setAttribute(Qt::WA_Hover);
// TODO: Connecting to the signal 'activated()' is not possible, as kstyle
// does not forward the single vs. doubleclick to it yet (KDE 4.1?). Hence it is
// necessary connecting the signal 'singleClick()' or 'doubleClick' and to handle the
// RETURN-key in keyPressEvent().
if (KGlobalSettings::singleClick()) {
connect(this, SIGNAL(clicked(const QModelIndex&)),
controller, SLOT(triggerItem(const QModelIndex&)));
@ -202,6 +206,14 @@ void DolphinIconsView::paintEvent(QPaintEvent* event)
}
}
void DolphinIconsView::keyPressEvent(QKeyEvent* event)
{
KCategorizedView::keyPressEvent(event);
if (event->key() == Qt::Key_Return) {
m_controller->triggerItem(selectionModel()->currentIndex());
}
}
void DolphinIconsView::slotShowPreviewChanged(bool showPreview)
{
updateGridSize(showPreview, m_controller->showAdditionalInfo());

View file

@ -56,6 +56,7 @@ protected:
virtual void dragMoveEvent(QDragMoveEvent* event);
virtual void dropEvent(QDropEvent* event);
virtual void paintEvent(QPaintEvent* event);
virtual void keyPressEvent(QKeyEvent* event);
private slots:
void slotShowPreviewChanged(bool show);

View file

@ -432,6 +432,7 @@ void DolphinView::setUrl(const KUrl& url)
applyViewProperties(url);
startDirLister(url);
itemView()->setFocus();
}
void DolphinView::mouseReleaseEvent(QMouseEvent* event)
@ -835,6 +836,7 @@ void DolphinView::createView()
this, SLOT(emitContentsMoved()));
connect(view->horizontalScrollBar(), SIGNAL(valueChanged(int)),
this, SLOT(emitContentsMoved()));
view->setFocus();
}
QAbstractItemView* DolphinView::itemView() const