Commit 712d12c1 authored by David Faure's avatar David Faure
Browse files

Move bookmarks in reverse order so that their address remains valid.

BUG: 287038
FIXED-IN: 4.10.4
parent e0c4b447
......@@ -370,10 +370,11 @@ bool KBookmarkModel::dropMimeData(const QMimeData * data, Qt::DropAction action,
if (data->hasFormat(s_mime_bookmark_addresses)) {
KBookmark::List bookmarks;
QList<QByteArray> addresses = data->data(s_mime_bookmark_addresses).split(';');
qSort(addresses);
Q_FOREACH(const QByteArray& address, addresses) {
KBookmark bk = bookmarkManager()->findByAddress(QString::fromLatin1(address));
kDebug() << "Extracted bookmark:" << bk.address();
bookmarks.push_back(bk);
bookmarks.prepend(bk); // reverse order, so that we don't invalidate addresses (#287038)
}
KEBMacroCommand * cmd = CmdGen::itemsMoved(this, bookmarks, addr, false);
......
......@@ -168,7 +168,7 @@ private Q_SLOTS:
QModelIndex firstIndex = m_model->indexForBookmark(m_bookmarkManager->findByAddress("/0/0"));
kdeIndex = m_model->indexForBookmark(m_bookmarkManager->findByAddress("/0/1"));
mimeData = m_model->mimeData(QModelIndexList() << kdeIndex << firstIndex); // TODO: swap
mimeData = m_model->mimeData(QModelIndexList() << firstIndex << kdeIndex);
QModelIndex folder2Index = m_model->indexForBookmark(m_bookmarkManager->findByAddress("/1"));
ok = m_model->dropMimeData(mimeData, Qt::MoveAction, -1, 0, folder2Index);
QVERIFY(ok);
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment