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,10 @@ 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 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. + // Double clicking however will override this, regardless of single/double click mouse setting, + // see: _k_slotViewDoubleClicked if (operationMode == KFileWidget::Saving) { locationEdit->setFocus(); } else { @@ -1845,6 +1848,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(); @@ -2160,6 +2165,13 @@ QApplication::sendEvent(iconSizeSlider, &toolTipEvent); } +void KFileWidgetPrivate::_k_slotViewDoubleClicked(const QModelIndex &index) +{ + if (operationMode == KFileWidget::Saving && index.isValid()) { + q->slotOk(); + } +} + static QString getExtensionFromPatternList(const QStringList &patternList) { // qDebug();