diff options
| author | Peter Penz <[email protected]> | 2007-03-11 11:13:07 +0000 |
|---|---|---|
| committer | Peter Penz <[email protected]> | 2007-03-11 11:13:07 +0000 |
| commit | 49f881f5ec01014e7b6b0c7fa14abd7e99f605fc (patch) | |
| tree | ea15d16c1285d6e7d724d2a7af22aebbe8850b54 /src/dolphinview.cpp | |
| parent | 277e385fd8a1f23cacf801f469e373b64e9443c0 (diff) | |
Fixed some drag & drop issues:
- allow drag & drop inside the view
- prevent a dragging from a directory into itself
- use QModelIndex instead of the position
svn path=/trunk/KDE/kdebase/apps/; revision=641451
Diffstat (limited to 'src/dolphinview.cpp')
| -rw-r--r-- | src/dolphinview.cpp | 17 |
1 files changed, 13 insertions, 4 deletions
diff --git a/src/dolphinview.cpp b/src/dolphinview.cpp index 50f56a478..3a6a2e757 100644 --- a/src/dolphinview.cpp +++ b/src/dolphinview.cpp @@ -132,8 +132,8 @@ DolphinView::DolphinView(DolphinMainWindow* mainWindow, m_controller = new DolphinController(this); connect(m_controller, SIGNAL(requestContextMenu(const QPoint&)), this, SLOT(openContextMenu(const QPoint&))); - connect(m_controller, SIGNAL(urlsDropped(const KUrl::List&, const QPoint&)), - this, SLOT(dropUrls(const KUrl::List&, 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(sortingChanged(DolphinView::Sorting)), this, SLOT(updateSorting(DolphinView::Sorting))); connect(m_controller, SIGNAL(sortOrderChanged(Qt::SortOrder)), @@ -971,10 +971,10 @@ void DolphinView::openContextMenu(const QPoint& pos) } void DolphinView::dropUrls(const KUrl::List& urls, - const QPoint& pos) + const QModelIndex& index, + QWidget* source) { KFileItem* directory = 0; - const QModelIndex index = itemView()->indexAt(pos); if (isValidNameIndex(index)) { KFileItem* item = fileItem(index); assert(item != 0); @@ -984,8 +984,17 @@ void DolphinView::dropUrls(const KUrl::List& urls, } } + if ((directory == 0) && (source == itemView())) { + // The dropping is done into the same viewport where + // the dragging has been started. Just ignore this... + return; + } + const KUrl& destination = (directory == 0) ? url() : directory->url(); + + kDebug() << "DolphinView::dropUrls() - destination: " << destination.prettyUrl() << endl; + dropUrls(urls, destination); } |
