viewport()->setAttribute(Qt::WA_Hover);
setHorizontalScrollBarPolicy(Qt::ScrollBarAlwaysOff);
setVerticalScrollBarPolicy(Qt::ScrollBarAlwaysOn);
+ setSelectionBehavior(SelectItems);
setSelectionMode(QAbstractItemView::ExtendedSelection);
+ setDragDropMode(QAbstractItemView::DragDrop);
+ setDropIndicatorShown(false);
+ setFocusPolicy(Qt::NoFocus);
// apply the column mode settings to the widget
const ColumnModeSettings* settings = DolphinSettings::instance().columnModeSettings();
if (!urls.isEmpty()) {
event->acceptProposedAction();
m_view->m_controller->indicateDroppedUrls(urls,
+ url(),
indexAt(event->pos()),
event->source());
}
foreach (ColumnWidget* column, m_columns) {
const QPoint topLeft = column->frameGeometry().topLeft();
const QPoint adjustedPoint(point.x() - topLeft.x(), point.y() - topLeft.y());
- QModelIndex index = column->indexAt(adjustedPoint);
+ const QModelIndex index = column->indexAt(adjustedPoint);
if (index.isValid()) {
return index;
}
}
- return activeColumn()->indexAt(point);
return QModelIndex();
}
int DolphinColumnView::verticalOffset() const
{
- return 0; // activeColumn()->verticalOffset();
+ return 0;
}
void DolphinColumnView::mousePressEvent(QMouseEvent* event)
QAbstractItemView::mousePressEvent(event);
}
-void DolphinColumnView::dragEnterEvent(QDragEnterEvent* event)
-{
- if (event->mimeData()->hasUrls()) {
- event->acceptProposedAction();
- }
-}
-
-void DolphinColumnView::dropEvent(QDropEvent* event)
-{
- const KUrl::List urls = KUrl::List::fromMimeData(event->mimeData());
- if (!urls.isEmpty()) {
- m_controller->indicateDroppedUrls(urls,
- indexAt(event->pos()),
- event->source());
- event->acceptProposedAction();
- }
- QAbstractItemView::dropEvent(event);
-}
-
void DolphinColumnView::resizeEvent(QResizeEvent* event)
{
QAbstractItemView::resizeEvent(event);
m_index = index;
m_columns[m_index]->setActive(true);
+
+ m_controller->setUrl(m_columns[m_index]->url());
}
void DolphinColumnView::layoutColumns()
virtual int verticalOffset() const;
virtual void mousePressEvent(QMouseEvent* event);
- virtual void dragEnterEvent(QDragEnterEvent* event);
- virtual void dropEvent(QDropEvent* event);
virtual void resizeEvent(QResizeEvent* event);
private slots:
}
void DolphinController::indicateDroppedUrls(const KUrl::List& urls,
- const QModelIndex& index,
- QWidget* source)
+ const KUrl& destPath,
+ const QModelIndex& destIndex,
+ QWidget* source)
{
- emit urlsDropped(urls, index, source);
+ emit urlsDropped(urls, destPath, destIndex, source);
}
void triggerActivation();
void indicateDroppedUrls(const KUrl::List& urls,
- const QModelIndex& index,
+ const KUrl& destPath,
+ const QModelIndex& destIndex,
QWidget* source);
void indicateSortingChange(DolphinView::Sorting sorting);
void activated();
/**
- * Is emitted if the URLs \a urls have been dropped to the index
- * \a index. \a source indicates the widget where the dragging has
- * been started from.
+ * Is emitted if the URLs \a urls have been dropped to the destination
+ * path \a destPath. If the URLs have been dropped above an item of
+ * the destination path, the item is indicated by \a destIndex.
+ * \a source indicates the widget where the dragging has been started from.
*/
void urlsDropped(const KUrl::List& urls,
- const QModelIndex& index,
+ const KUrl& destPath,
+ const QModelIndex& destIndex,
QWidget* source);
/** Is emitted if the sorting has been changed to \a sorting. */
if (!urls.isEmpty()) {
event->acceptProposedAction();
m_controller->indicateDroppedUrls(urls,
+ m_controller->url(),
indexAt(event->pos()),
event->source());
}
const KUrl::List urls = KUrl::List::fromMimeData(event->mimeData());
if (!urls.isEmpty()) {
m_controller->indicateDroppedUrls(urls,
+ m_controller->url(),
indexAt(event->pos()),
event->source());
event->acceptProposedAction();
void DolphinMainWindow::dropUrls(const KUrl::List& urls,
const KUrl& destination)
{
+ kDebug() << "Source" << urls;
+ kDebug() << "Destination:" << destination;
+
Qt::DropAction action = Qt::CopyAction;
Qt::KeyboardModifiers modifier = QApplication::keyboardModifiers();
this, SIGNAL(urlChanged(const KUrl&)));
connect(m_controller, SIGNAL(requestContextMenu(const QPoint&)),
this, SLOT(openContextMenu(const QPoint&)));
- connect(m_controller, SIGNAL(urlsDropped(const KUrl::List&, const QModelIndex&, QWidget*)),
- this, SLOT(dropUrls(const KUrl::List&, const QModelIndex&, QWidget*)));
+ connect(m_controller, SIGNAL(urlsDropped(const KUrl::List&, const KUrl&, const QModelIndex&, QWidget*)),
+ this, SLOT(dropUrls(const KUrl::List&, const KUrl&, const QModelIndex&, QWidget*)));
connect(m_controller, SIGNAL(sortingChanged(DolphinView::Sorting)),
this, SLOT(updateSorting(DolphinView::Sorting)));
connect(m_controller, SIGNAL(sortOrderChanged(Qt::SortOrder)),
}
void DolphinView::dropUrls(const KUrl::List& urls,
- const QModelIndex& index,
+ const KUrl& destPath,
+ const QModelIndex& destIndex,
QWidget* source)
{
KFileItem directory;
- if (isValidNameIndex(index)) {
- KFileItem item = fileItem(index);
+ if (isValidNameIndex(destIndex)) {
+ KFileItem item = fileItem(destIndex);
Q_ASSERT(!item.isNull());
if (item.isDir()) {
// the URLs are dropped above a directory
}
const KUrl& destination = (directory.isNull()) ?
- url() : directory.url();
+ destPath : directory.url();
dropUrls(urls, destination);
}
void openContextMenu(const QPoint& pos);
/**
- * Drops the URLs \a urls to the index \a index. \a source
+ * Drops the URLs \a urls to the destination path \a destPath. If
+ * the URLs are dropped above an item inside the destination path,
+ * the item is indicated by \a destIndex. \a source
* indicates the widget where the dragging has been started from.
*/
void dropUrls(const KUrl::List& urls,
- const QModelIndex& index,
+ const KUrl& destPath,
+ const QModelIndex& destIndex,
QWidget* source);
/**