From 562e9ce10890e717ae84f549b8469e5868906272 Mon Sep 17 00:00:00 2001 From: Nick Tiskov Date: Tue, 4 Jun 2013 18:28:58 +0400 Subject: [PATCH] Drag'n'Drop fixups. 1. Proper event handling 2. Allow folder moving 3. Allow moving into folders --- src/rss/feedlistwidget.cpp | 24 ++++++++++++++---------- 1 file changed, 14 insertions(+), 10 deletions(-) diff --git a/src/rss/feedlistwidget.cpp b/src/rss/feedlistwidget.cpp index 17f7e86a5..32546a54d 100644 --- a/src/rss/feedlistwidget.cpp +++ b/src/rss/feedlistwidget.cpp @@ -173,19 +173,23 @@ void FeedListWidget::updateCurrentFeed(QTreeWidgetItem* new_item) { } void FeedListWidget::dragMoveEvent(QDragMoveEvent * event) { + QTreeWidget::dragMoveEvent(event); + QTreeWidgetItem *item = itemAt(event->pos()); + // Prohibit dropping onto global unread counter if (item == m_unreadStickyItem) { event->ignore(); - } else { - if (item && isFolder(item)) - event->ignore(); - else { - if (selectedItems().contains(m_unreadStickyItem)) { - event->ignore(); - } else { - QTreeWidget::dragMoveEvent(event); - } - } + return; + } + // Prohibit dragging of global unread counter + if (selectedItems().contains(m_unreadStickyItem)) { + event->ignore(); + return; + } + // Prohibit dropping onto feeds + if (item && isFeed(item)) { + event->ignore(); + return; } }