diff options
Diffstat (limited to 'src/panels')
| -rw-r--r-- | src/panels/folders/folderspanel.cpp | 3 | ||||
| -rw-r--r-- | src/panels/places/placesitem.cpp | 4 | ||||
| -rw-r--r-- | src/panels/places/placesitemmodel.cpp | 19 | ||||
| -rw-r--r-- | src/panels/places/placespanel.cpp | 23 |
4 files changed, 35 insertions, 14 deletions
diff --git a/src/panels/folders/folderspanel.cpp b/src/panels/folders/folderspanel.cpp index 98c06fb35..46c1b3450 100644 --- a/src/panels/folders/folderspanel.cpp +++ b/src/panels/folders/folderspanel.cpp @@ -236,7 +236,8 @@ void FoldersPanel::slotItemDropEvent(int index, QGraphicsSceneDragDropEvent* eve event->buttons(), event->modifiers()); - const QString error = DragAndDropHelper::dropUrls(destItem, destItem.url(), &dropEvent); + QString error; + DragAndDropHelper::dropUrls(destItem, destItem.url(), &dropEvent, error); if (!error.isEmpty()) { emit errorMessage(error); } diff --git a/src/panels/places/placesitem.cpp b/src/panels/places/placesitem.cpp index 75e14d0fb..5723b80a2 100644 --- a/src/panels/places/placesitem.cpp +++ b/src/panels/places/placesitem.cpp @@ -176,6 +176,10 @@ PlacesItem::GroupType PlacesItem::groupType() const return SearchForType; } + if (protocol == QLatin1String("bluetooth")) { + return DevicesType; + } + return PlacesType; } diff --git a/src/panels/places/placesitemmodel.cpp b/src/panels/places/placesitemmodel.cpp index caf6b7566..eae2095c9 100644 --- a/src/panels/places/placesitemmodel.cpp +++ b/src/panels/places/placesitemmodel.cpp @@ -444,6 +444,11 @@ void PlacesItemModel::dropMimeDataBefore(int index, const QMimeData* mimeData) text = url.host(); } + if (url.isLocalFile() && !QFileInfo(url.toLocalFile()).isDir()) { + // Only directories are allowed + continue; + } + PlacesItem* newItem = createPlacesItem(text, url); const int dropIndex = groupedDropIndex(index, newItem); insertItem(dropIndex, newItem); @@ -612,17 +617,13 @@ void PlacesItemModel::slotStorageSetupDone(Solid::ErrorType error, } if (error) { - // TODO: Request message-freeze exception if (errorData.isValid()) { - // emit errorMessage(i18nc("@info", "An error occurred while accessing '%1', the system responded: %2", - // item->text(), - // errorData.toString())); - emit errorMessage(QString("An error occurred while accessing '%1', the system responded: %2") - .arg(item->text()).arg(errorData.toString())); + emit errorMessage(i18nc("@info", "An error occurred while accessing '%1', the system responded: %2", + item->text(), + errorData.toString())); } else { - // emit errorMessage(i18nc("@info", "An error occurred while accessing '%1'", - // item->text())); - emit errorMessage(QString("An error occurred while accessing '%1'").arg(item->text())); + emit errorMessage(i18nc("@info", "An error occurred while accessing '%1'", + item->text())); } emit storageSetupDone(index, false); } else { diff --git a/src/panels/places/placespanel.cpp b/src/panels/places/placespanel.cpp index 56042d856..d5308eabe 100644 --- a/src/panels/places/placespanel.cpp +++ b/src/panels/places/placespanel.cpp @@ -332,6 +332,12 @@ void PlacesPanel::slotItemDropEvent(int index, QGraphicsSceneDragDropEvent* even return; } + const PlacesItem* destItem = m_model->placesItem(index); + const PlacesItem::GroupType group = destItem->groupType(); + if (group == PlacesItem::SearchForType || group == PlacesItem::RecentlyAccessedType) { + return; + } + if (m_model->storageSetupNeeded(index)) { connect(m_model, SIGNAL(storageSetupDone(int,bool)), this, SLOT(slotItemDropEventStorageSetupDone(int,bool))); @@ -356,14 +362,18 @@ void PlacesPanel::slotItemDropEvent(int index, QGraphicsSceneDragDropEvent* even return; } - KUrl destUrl = m_model->placesItem(index)->url(); + KUrl destUrl = destItem->url(); QDropEvent dropEvent(event->pos().toPoint(), event->possibleActions(), event->mimeData(), event->buttons(), event->modifiers()); - DragAndDropHelper::dropUrls(KFileItem(), destUrl, &dropEvent); + QString error; + DragAndDropHelper::dropUrls(KFileItem(), destUrl, &dropEvent, error); + if (!error.isEmpty()) { + emit errorMessage(error); + } } void PlacesPanel::slotItemDropEventStorageSetupDone(int index, bool success) @@ -375,7 +385,11 @@ void PlacesPanel::slotItemDropEventStorageSetupDone(int index, bool success) if (success) { KUrl destUrl = m_model->placesItem(index)->url(); - DragAndDropHelper::dropUrls(KFileItem(), destUrl, m_itemDropEvent); + QString error; + DragAndDropHelper::dropUrls(KFileItem(), destUrl, m_itemDropEvent, error); + if (!error.isEmpty()) { + emit errorMessage(error); + } } delete m_itemDropEventMimeData; @@ -395,7 +409,8 @@ void PlacesPanel::slotAboveItemDropEvent(int index, QGraphicsSceneDragDropEvent* void PlacesPanel::slotUrlsDropped(const KUrl& dest, QDropEvent* event, QWidget* parent) { Q_UNUSED(parent); - const QString error = DragAndDropHelper::dropUrls(KFileItem(), dest, event); + QString error; + DragAndDropHelper::dropUrls(KFileItem(), dest, event, error); if (!error.isEmpty()) { emit errorMessage(error); } |
