X-Git-Url: https://cloud.milkyroute.net/gitweb/dolphin.git/blobdiff_plain/fc38ceacfbd7758c38aaff8b7141640cdcbddaec..d511752c9de4d9adc30a15ddf9bf89efc1924a7b:/src/dolphiniconsview.cpp diff --git a/src/dolphiniconsview.cpp b/src/dolphiniconsview.cpp index d2bac6b13..237a319c8 100644 --- a/src/dolphiniconsview.cpp +++ b/src/dolphiniconsview.cpp @@ -33,7 +33,7 @@ #include DolphinIconsView::DolphinIconsView(QWidget* parent, DolphinController* controller) : - KListView(parent), + KCategorizedView(parent), m_controller(controller), m_dragging(false) { @@ -51,8 +51,6 @@ DolphinIconsView::DolphinIconsView(QWidget* parent, DolphinController* controlle connect(this, SIGNAL(doubleClicked(const QModelIndex&)), controller, SLOT(triggerItem(const QModelIndex&))); } - connect(this, SIGNAL(activated(const QModelIndex&)), - controller, SLOT(triggerItem(const QModelIndex&))); connect(this, SIGNAL(entered(const QModelIndex&)), controller, SLOT(emitItemEntered(const QModelIndex&))); connect(this, SIGNAL(viewportEntered()), @@ -70,7 +68,7 @@ DolphinIconsView::DolphinIconsView(QWidget* parent, DolphinController* controlle const IconsModeSettings* settings = DolphinSettings::instance().iconsModeSettings(); Q_ASSERT(settings != 0); - m_viewOptions = KListView::viewOptions(); + m_viewOptions = KCategorizedView::viewOptions(); m_viewOptions.showDecorationSelected = true; QFont font(settings->fontFamily(), settings->fontSize()); @@ -102,7 +100,7 @@ QStyleOptionViewItem DolphinIconsView::viewOptions() const void DolphinIconsView::contextMenuEvent(QContextMenuEvent* event) { - KListView::contextMenuEvent(event); + KCategorizedView::contextMenuEvent(event); m_controller->triggerContextMenuRequest(event->pos()); } @@ -116,7 +114,7 @@ void DolphinIconsView::mousePressEvent(QMouseEvent* event) } } - KListView::mousePressEvent(event); + KCategorizedView::mousePressEvent(event); } void DolphinIconsView::dragEnterEvent(QDragEnterEvent* event) @@ -129,7 +127,7 @@ void DolphinIconsView::dragEnterEvent(QDragEnterEvent* event) void DolphinIconsView::dragLeaveEvent(QDragLeaveEvent* event) { - KListView::dragLeaveEvent(event); + KCategorizedView::dragLeaveEvent(event); // TODO: remove this code when the issue #160611 is solved in Qt 4.4 m_dragging = false; @@ -138,7 +136,7 @@ void DolphinIconsView::dragLeaveEvent(QDragLeaveEvent* event) void DolphinIconsView::dragMoveEvent(QDragMoveEvent* event) { - KListView::dragMoveEvent(event); + KCategorizedView::dragMoveEvent(event); // TODO: remove this code when the issue #160611 is solved in Qt 4.4 const QModelIndex index = indexAt(event->pos()); @@ -149,20 +147,22 @@ void DolphinIconsView::dragMoveEvent(QDragMoveEvent* event) void DolphinIconsView::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(); + if (!selectionModel()->isSelected(indexAt(event->pos()))) { + const KUrl::List urls = KUrl::List::fromMimeData(event->mimeData()); + if (!urls.isEmpty()) { + m_controller->indicateDroppedUrls(urls, + indexAt(event->pos()), + event->source()); + event->acceptProposedAction(); + } } - KListView::dropEvent(event); + KCategorizedView::dropEvent(event); m_dragging = false; } void DolphinIconsView::paintEvent(QPaintEvent* event) { - KListView::paintEvent(event); + KCategorizedView::paintEvent(event); // TODO: remove this code when the issue #160611 is solved in Qt 4.4 if (m_dragging) {