diff --git a/src/core/feedsmodel.cpp b/src/core/feedsmodel.cpp index ac4905a2b..183ce17dd 100755 --- a/src/core/feedsmodel.cpp +++ b/src/core/feedsmodel.cpp @@ -138,96 +138,6 @@ void FeedsModel::updateAutoUpdateStatus() { } } -QMimeData *FeedsModel::mimeData(const QModelIndexList &indexes) const { - QMimeData *mime_data = new QMimeData(); - QByteArray encoded_data; - QDataStream stream(&encoded_data, QIODevice::WriteOnly); - - foreach (const QModelIndex &index, indexes) { - if (index.column() != 0) { - continue; - } - - RootItem *item_for_index = itemForIndex(index); - - if (item_for_index->kind() != RootItem::Root) { - stream << (quintptr) item_for_index; - } - } - - mime_data->setData(MIME_TYPE_ITEM_POINTER, encoded_data); - return mime_data; -} - -QStringList FeedsModel::mimeTypes() const { - return QStringList() << MIME_TYPE_ITEM_POINTER; -} - -bool FeedsModel::dropMimeData(const QMimeData *data, Qt::DropAction action, int row, int column, const QModelIndex &parent) { - Q_UNUSED(row) - Q_UNUSED(column) - - if (action == Qt::IgnoreAction) { - return true; - } - else if (action != Qt::MoveAction) { - return false; - } - - QByteArray dragged_items_data = data->data(MIME_TYPE_ITEM_POINTER); - - if (dragged_items_data.isEmpty()) { - return false; - } - else { - QDataStream stream(&dragged_items_data, QIODevice::ReadOnly); - - while (!stream.atEnd()) { - quintptr pointer_to_item; - stream >> pointer_to_item; - - // We have item we want to drag, we also determine the target item. - RootItem *dragged_item = (RootItem*) pointer_to_item; - RootItem *target_item = itemForIndex(parent); - - if (dragged_item == target_item || dragged_item->parent() == target_item) { - qDebug("Dragged item is equal to target item or its parent is equal to target item. Cancelling drag-drop action."); - return false; - } - - if (dragged_item->kind() == RootItem::Feeed) { - qDebug("Drag-drop action for feed '%s' detected, editing the feed.", qPrintable(dragged_item->title())); - - StandardFeed *actual_feed = dragged_item->toFeed(); - StandardFeed *feed_new = new StandardFeed(*actual_feed); - - feed_new->setParent(target_item); - editFeed(actual_feed, feed_new); - - emit requireItemValidationAfterDragDrop(indexForItem(actual_feed)); - } - else if (dragged_item->kind() == RootItem::Cattegory) { - qDebug("Drag-drop action for category '%s' detected, editing the feed.", qPrintable(dragged_item->title())); - - StandardCategory *actual_category = dragged_item->toCategory(); - StandardCategory *category_new = new StandardCategory(*actual_category); - - category_new->clearChildren(); - category_new->setParent(target_item); - editCategory(actual_category, category_new); - - emit requireItemValidationAfterDragDrop(indexForItem(actual_category)); - } - } - - return true; - } -} - -Qt::DropActions FeedsModel::supportedDropActions() const { - return Qt::MoveAction; -} - Qt::ItemFlags FeedsModel::flags(const QModelIndex &index) const { Qt::ItemFlags base_flags = QAbstractItemModel::flags(index); RootItem *item_for_index = itemForIndex(index); diff --git a/src/core/feedsmodel.h b/src/core/feedsmodel.h index 98ea28b7d..c0b8114d7 100755 --- a/src/core/feedsmodel.h +++ b/src/core/feedsmodel.h @@ -55,10 +55,6 @@ class FeedsModel : public QAbstractItemModel { return itemForIndex(index)->data(index.column(), role); } - QMimeData *mimeData(const QModelIndexList &indexes) const; - QStringList mimeTypes() const; - bool dropMimeData(const QMimeData *data, Qt::DropAction action, int row, int column, const QModelIndex &parent); - Qt::DropActions supportedDropActions() const; Qt::ItemFlags flags(const QModelIndex &index) const; QVariant headerData(int section, Qt::Orientation orientation, int role) const; QModelIndex index(int row, int column, const QModelIndex &parent) const; @@ -196,8 +192,6 @@ class FeedsModel : public QAbstractItemModel { void assembleFeeds(FeedAssignment feeds); signals: - void requireItemValidationAfterDragDrop(const QModelIndex &source_index); - // Emitted when model requests update of some feeds. void feedsUpdateRequested(const QList feeds); diff --git a/src/gui/feedsview.cpp b/src/gui/feedsview.cpp index cba9fa970..d7031146c 100755 --- a/src/gui/feedsview.cpp +++ b/src/gui/feedsview.cpp @@ -55,7 +55,6 @@ FeedsView::FeedsView(QWidget *parent) m_sourceModel = m_proxyModel->sourceModel(); // Connections. - connect(m_sourceModel, SIGNAL(requireItemValidationAfterDragDrop(QModelIndex)), this, SLOT(validateItemAfterDragDrop(QModelIndex))); connect(m_sourceModel, SIGNAL(feedsUpdateRequested(QList)), this, SIGNAL(feedsUpdateRequested(QList))); connect(header(), SIGNAL(sortIndicatorChanged(int,Qt::SortOrder)), this, SLOT(saveSortState(int,Qt::SortOrder)));