mirror of
https://invent.kde.org/system/dolphin
synced 2024-11-05 18:47:12 +00:00
use KDirModel::mimeData() for cut/copy operations as suggested by David Faure
CCMAIL: faure@kde.org svn path=/trunk/KDE/kdebase/apps/; revision=891865
This commit is contained in:
parent
fe06efe734
commit
add0f6db79
6 changed files with 41 additions and 2 deletions
|
@ -269,6 +269,11 @@ KFileItemList DolphinColumnView::selectedItems() const
|
|||
return activeColumn()->selectedItems();
|
||||
}
|
||||
|
||||
QMimeData* DolphinColumnView::selectionMimeData() const
|
||||
{
|
||||
return activeColumn()->selectionMimeData();
|
||||
}
|
||||
|
||||
void DolphinColumnView::selectAll()
|
||||
{
|
||||
activeColumn()->selectAll();
|
||||
|
|
|
@ -112,6 +112,12 @@ public:
|
|||
* Returns the selected items of the active column.
|
||||
*/
|
||||
KFileItemList selectedItems() const;
|
||||
|
||||
/**
|
||||
* Returns the MIME data for the selected items
|
||||
* of the active column.
|
||||
*/
|
||||
QMimeData* selectionMimeData() const;
|
||||
|
||||
public slots:
|
||||
/** @see QAbstractItemView::selectAll() */
|
||||
|
|
|
@ -277,6 +277,12 @@ KFileItemList DolphinColumnWidget::selectedItems() const
|
|||
return itemList;
|
||||
}
|
||||
|
||||
QMimeData* DolphinColumnWidget::selectionMimeData() const
|
||||
{
|
||||
const QItemSelection selection = m_proxyModel->mapSelectionToSource(selectionModel()->selection());
|
||||
return m_dolphinModel->mimeData(selection.indexes());
|
||||
}
|
||||
|
||||
QStyleOptionViewItem DolphinColumnWidget::viewOptions() const
|
||||
{
|
||||
QStyleOptionViewItem viewOptions = QListView::viewOptions();
|
||||
|
|
|
@ -111,6 +111,11 @@ public:
|
|||
KFileItem itemAt(const QPoint& pos) const;
|
||||
|
||||
KFileItemList selectedItems() const;
|
||||
|
||||
/**
|
||||
* Returns the MIME data for the selected items.
|
||||
*/
|
||||
QMimeData* selectionMimeData() const;
|
||||
|
||||
protected:
|
||||
virtual QStyleOptionViewItem viewOptions() const;
|
||||
|
|
|
@ -701,7 +701,7 @@ void DolphinView::deleteSelectedItems()
|
|||
|
||||
void DolphinView::cutSelectedItems()
|
||||
{
|
||||
QMimeData* mimeData = new QMimeData();
|
||||
QMimeData* mimeData = selectionMimeData();
|
||||
const KUrl::List kdeUrls = simplifiedSelectedUrls();
|
||||
const KUrl::List mostLocalUrls;
|
||||
KonqMimeData::populateMimeData(mimeData, kdeUrls, mostLocalUrls, true);
|
||||
|
@ -710,7 +710,7 @@ void DolphinView::cutSelectedItems()
|
|||
|
||||
void DolphinView::copySelectedItems()
|
||||
{
|
||||
QMimeData* mimeData = new QMimeData();
|
||||
QMimeData* mimeData = selectionMimeData();
|
||||
const KUrl::List kdeUrls = selectedUrls();
|
||||
const KUrl::List mostLocalUrls;
|
||||
KonqMimeData::populateMimeData(mimeData, kdeUrls, mostLocalUrls, false);
|
||||
|
@ -1424,4 +1424,16 @@ bool DolphinView::itemsExpandable() const
|
|||
return (m_detailsView != 0) && m_detailsView->itemsExpandable();
|
||||
}
|
||||
|
||||
QMimeData* DolphinView::selectionMimeData() const
|
||||
{
|
||||
if (isColumnViewActive()) {
|
||||
return m_columnView->selectionMimeData();
|
||||
}
|
||||
|
||||
const QAbstractItemView* view = itemView();
|
||||
Q_ASSERT((view != 0) && (view->selectionModel() != 0));
|
||||
const QItemSelection selection = m_proxyModel->mapSelectionToSource(view->selectionModel()->selection());
|
||||
return m_dolphinModel->mimeData(selection.indexes());
|
||||
}
|
||||
|
||||
#include "dolphinview.moc"
|
||||
|
|
|
@ -704,6 +704,11 @@ private:
|
|||
* is currently shown.
|
||||
*/
|
||||
void deleteExpandedViews();
|
||||
|
||||
/**
|
||||
* Returns the MIME data for all selected items.
|
||||
*/
|
||||
QMimeData* selectionMimeData() const;
|
||||
|
||||
private:
|
||||
bool m_active : 1;
|
||||
|
|
Loading…
Reference in a new issue