Changeset View
Changeset View
Standalone View
Standalone View
src/panels/places/placesitemmodel.cpp
Show First 20 Lines • Show All 347 Lines • ▼ Show 20 Line(s) | |||||
348 | { | 348 | { | ||
349 | if (mimeData->hasFormat(internalMimeType())) { | 349 | if (mimeData->hasFormat(internalMimeType())) { | ||
350 | // The item has been moved inside the view | 350 | // The item has been moved inside the view | ||
351 | QByteArray itemData = mimeData->data(internalMimeType()); | 351 | QByteArray itemData = mimeData->data(internalMimeType()); | ||
352 | QDataStream stream(&itemData, QIODevice::ReadOnly); | 352 | QDataStream stream(&itemData, QIODevice::ReadOnly); | ||
353 | int oldIndex; | 353 | int oldIndex; | ||
354 | stream >> oldIndex; | 354 | stream >> oldIndex; | ||
355 | 355 | | |||
356 | m_sourceModel->movePlace(oldIndex, index); | 356 | QModelIndex sourceIndex = mapToSource(index); | ||
357 | QModelIndex oldSourceIndex = mapToSource(oldIndex); | ||||
358 | | ||||
359 | m_sourceModel->movePlace(oldSourceIndex.row(), sourceIndex.row()); | ||||
357 | } else if (mimeData->hasFormat(QStringLiteral("text/uri-list"))) { | 360 | } else if (mimeData->hasFormat(QStringLiteral("text/uri-list"))) { | ||
358 | // One or more items must be added to the model | 361 | // One or more items must be added to the model | ||
359 | const QList<QUrl> urls = KUrlMimeData::urlsFromMimeData(mimeData); | 362 | const QList<QUrl> urls = KUrlMimeData::urlsFromMimeData(mimeData); | ||
360 | for (int i = urls.count() - 1; i >= 0; --i) { | 363 | for (int i = urls.count() - 1; i >= 0; --i) { | ||
361 | const QUrl& url = urls[i]; | 364 | const QUrl& url = urls[i]; | ||
362 | 365 | | |||
363 | QString text = url.fileName(); | 366 | QString text = url.fileName(); | ||
364 | if (text.isEmpty()) { | 367 | if (text.isEmpty()) { | ||
▲ Show 20 Lines • Show All 409 Lines • Show Last 20 Lines |