diff --git a/src/filewidgets/kdiroperator.h b/src/filewidgets/kdiroperator.h --- a/src/filewidgets/kdiroperator.h +++ b/src/filewidgets/kdiroperator.h @@ -553,7 +553,7 @@ * Reimplemented - allow dropping of files if @p b is true * @param b true if the widget should allow dropping of files */ - virtual void setAcceptDrops(bool b); + virtual void setAcceptDropping(bool b); /** * Sets the options for dropping files. diff --git a/src/filewidgets/kdiroperator.cpp b/src/filewidgets/kdiroperator.cpp --- a/src/filewidgets/kdiroperator.cpp +++ b/src/filewidgets/kdiroperator.cpp @@ -99,7 +99,7 @@ setResizeMode(QListView::Adjust); setSpacing(0); setMovement(QListView::Static); - setDragDropMode(QListView::DragOnly); + setDragDropMode(QListView::DragDrop); setVerticalScrollMode(QListView::ScrollPerPixel); setHorizontalScrollMode(QListView::ScrollPerPixel); setEditTriggers(QAbstractItemView::NoEditTriggers); @@ -127,6 +127,8 @@ void KDirOperatorIconView::dragEnterEvent(QDragEnterEvent *event) { + qDebug() << "dragEnterEvent"; + if (event->mimeData()->hasUrls()) { event->acceptProposedAction(); } @@ -1458,12 +1460,15 @@ return itemView; } -void KDirOperator::setAcceptDrops(bool b) +void KDirOperator::setAcceptDropping(bool b) { - // TODO: - //if (d->fileView) - // d->fileView->widget()->setAcceptDrops(b); - QWidget::setAcceptDrops(b); + if (d->itemView) { + qDebug() << "drops are ready to be accepted"; + d->itemView->setAcceptDrops(b); + d->itemView->setDragDropMode(QListView::DragDrop); + } + + setAcceptDrops(b); } void KDirOperator::setDropOptions(int options) @@ -1500,6 +1505,8 @@ QAbstractItemView *newView = createView(this, viewKind); setView(newView); + setAcceptDropping(true); + d->_k_togglePreview(preview); } @@ -2599,7 +2606,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.cpp b/src/filewidgets/kfilewidget.cpp --- a/src/filewidgets/kfilewidget.cpp +++ b/src/filewidgets/kfilewidget.cpp @@ -1154,6 +1154,7 @@ locationEdit->lineEdit()->setModified(false); locationEdit->lineEdit()->selectAll(); + locationEdit->setFocus(); } void KFileWidgetPrivate::_k_fileSelected(const KFileItem &i) @@ -1173,13 +1174,7 @@ 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 { - q->slotOk(); - } + q->slotOk(); } // I know it's slow to always iterate thru the whole filelist