diff --git a/src/filewidgets/kdiroperator.cpp b/src/filewidgets/kdiroperator.cpp --- a/src/filewidgets/kdiroperator.cpp +++ b/src/filewidgets/kdiroperator.cpp @@ -2599,7 +2599,7 @@ const int itemsInRow = qMax(1, viewPortWidth / minWidth); const int remainingWidth = viewPortWidth - (minWidth * itemsInRow); const int width = minWidth + (remainingWidth / itemsInRow); - + const QSize itemSize(width, height); view->setGridSize(itemSize); diff --git a/src/filewidgets/kfilewidget.h b/src/filewidgets/kfilewidget.h --- a/src/filewidgets/kfilewidget.h +++ b/src/filewidgets/kfilewidget.h @@ -612,6 +612,7 @@ Q_PRIVATE_SLOT(d, void _k_zoomInIconsSize()) Q_PRIVATE_SLOT(d, void _k_slotIconSizeSliderMoved(int)) Q_PRIVATE_SLOT(d, void _k_slotIconSizeChanged(int)) + Q_PRIVATE_SLOT(d, void _k_slotViewDoubleClicked(const QModelIndex&)) }; #endif diff --git a/src/filewidgets/kfilewidget.cpp b/src/filewidgets/kfilewidget.cpp --- a/src/filewidgets/kfilewidget.cpp +++ b/src/filewidgets/kfilewidget.cpp @@ -193,6 +193,7 @@ void _k_zoomInIconsSize(); void _k_slotIconSizeSliderMoved(int); void _k_slotIconSizeChanged(int); + void _k_slotViewDoubleClicked(const QModelIndex&); void addToRecentDocuments(); @@ -1173,8 +1174,6 @@ emit q->selectionChanged(); } - // if we are saving, let another chance to the user before accepting the dialog (or trying to - // accept). This way the user can choose a file and add a "_2" for instance to the filename if (operationMode == KFileWidget::Saving) { locationEdit->setFocus(); } else { @@ -1845,6 +1844,8 @@ d->ops->setView(KFile::Default); d->ops->view()->setSizePolicy(QSizePolicy(QSizePolicy::Maximum, QSizePolicy::Maximum)); d->hasView = true; + + connect(d->ops->view(), SIGNAL(doubleClicked(QModelIndex)), this, SLOT(_k_slotViewDoubleClicked(QModelIndex))); } d->ops->clearHistory(); @@ -2148,6 +2149,13 @@ } } +void KFileWidgetPrivate::_k_slotViewDoubleClicked(const QModelIndex &index) +{ + if (operationMode == KFileWidget::Saving && index.isValid()) { + q->slotOk(); + } +} + void KFileWidgetPrivate::_k_slotIconSizeSliderMoved(int _value) { // Force this to be called in case this slot is called first on the