mirror of
https://invent.kde.org/system/dolphin
synced 2024-09-12 12:54:29 +00:00
use QUrl::fromLocalFile() on devices
fixes being unable to access eg. removable drives
This commit is contained in:
parent
7a3310ce73
commit
b96def1856
|
@ -134,7 +134,7 @@ void PlacesItem::setBookmark(const KBookmark& bookmark)
|
||||||
const QString udi = bookmark.metaDataItem("UDI");
|
const QString udi = bookmark.metaDataItem("UDI");
|
||||||
if (udi.isEmpty()) {
|
if (udi.isEmpty()) {
|
||||||
setIcon(bookmark.icon());
|
setIcon(bookmark.icon());
|
||||||
setText(i18nc("KFile System Bookmarks", bookmark.text().toUtf8().data()));
|
setText(i18nc("KFile System Bookmarks", bookmark.text().toUtf8().constData()));
|
||||||
setUrl(bookmark.url());
|
setUrl(bookmark.url());
|
||||||
} else {
|
} else {
|
||||||
initializeDevice(udi);
|
initializeDevice(udi);
|
||||||
|
@ -269,26 +269,26 @@ void PlacesItem::initializeDevice(const QString& udi)
|
||||||
setUdi(udi);
|
setUdi(udi);
|
||||||
|
|
||||||
if (m_access) {
|
if (m_access) {
|
||||||
setUrl(m_access->filePath());
|
setUrl(QUrl::fromLocalFile(m_access->filePath()));
|
||||||
QObject::connect(m_access.data(), &Solid::StorageAccess::accessibilityChanged,
|
QObject::connect(m_access.data(), SIGNAL(accessibilityChanged(bool,QString)),
|
||||||
m_signalHandler.data(), &PlacesItemSignalHandler::onAccessibilityChanged);
|
m_signalHandler.data(), SLOT(onAccessibilityChanged()));
|
||||||
} else if (m_disc && (m_disc->availableContent() & Solid::OpticalDisc::Audio) != 0) {
|
} else if (m_disc && (m_disc->availableContent() & Solid::OpticalDisc::Audio) != 0) {
|
||||||
Solid::Block *block = m_device.as<Solid::Block>();
|
Solid::Block *block = m_device.as<Solid::Block>();
|
||||||
if (block) {
|
if (block) {
|
||||||
const QString device = block->device();
|
const QString device = block->device();
|
||||||
setUrl(QString("audiocd:/?device=%1").arg(device));
|
setUrl(QStringLiteral("audiocd:/?device=%1").arg(device));
|
||||||
} else {
|
} else {
|
||||||
setUrl(QString("audiocd:/"));
|
setUrl(QStringLiteral("audiocd:/"));
|
||||||
}
|
}
|
||||||
} else if (m_mtp) {
|
} else if (m_mtp) {
|
||||||
setUrl(QString("mtp:udi=%1").arg(m_device.udi()));
|
setUrl(QStringLiteral("mtp:udi=%1").arg(m_device.udi()));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void PlacesItem::onAccessibilityChanged()
|
void PlacesItem::onAccessibilityChanged()
|
||||||
{
|
{
|
||||||
setIconOverlays(m_device.emblems());
|
setIconOverlays(m_device.emblems());
|
||||||
setUrl(m_access->filePath());
|
setUrl(QUrl::fromLocalFile(m_access->filePath()));
|
||||||
}
|
}
|
||||||
|
|
||||||
void PlacesItem::onTrashDirListerCompleted()
|
void PlacesItem::onTrashDirListerCompleted()
|
||||||
|
|
|
@ -82,10 +82,10 @@ public:
|
||||||
protected:
|
protected:
|
||||||
virtual void onDataValueChanged(const QByteArray& role,
|
virtual void onDataValueChanged(const QByteArray& role,
|
||||||
const QVariant& current,
|
const QVariant& current,
|
||||||
const QVariant& previous);
|
const QVariant& previous) Q_DECL_OVERRIDE;
|
||||||
|
|
||||||
virtual void onDataChanged(const QHash<QByteArray, QVariant>& current,
|
virtual void onDataChanged(const QHash<QByteArray, QVariant>& current,
|
||||||
const QHash<QByteArray, QVariant>& previous);
|
const QHash<QByteArray, QVariant>& previous) Q_DECL_OVERRIDE;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
PlacesItem(const PlacesItem& item);
|
PlacesItem(const PlacesItem& item);
|
||||||
|
|
|
@ -657,7 +657,7 @@ void PlacesItemModel::updateBookmarks()
|
||||||
found = true;
|
found = true;
|
||||||
if (newBookmark.metaDataItem("UDI").isEmpty()) {
|
if (newBookmark.metaDataItem("UDI").isEmpty()) {
|
||||||
item->setBookmark(newBookmark);
|
item->setBookmark(newBookmark);
|
||||||
item->setText(i18nc("KFile System Bookmarks", newBookmark.text().toUtf8().data()));
|
item->setText(i18nc("KFile System Bookmarks", newBookmark.text().toUtf8().constData()));
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
@ -764,7 +764,7 @@ void PlacesItemModel::loadBookmarks()
|
||||||
// text, the retranslation will fail and the users custom text is still used.
|
// text, the retranslation will fail and the users custom text is still used.
|
||||||
// It is important to use "KFile System Bookmarks" as context (see
|
// It is important to use "KFile System Bookmarks" as context (see
|
||||||
// createSystemBookmarks()).
|
// createSystemBookmarks()).
|
||||||
item->setText(i18nc("KFile System Bookmarks", bookmark.text().toUtf8().data()));
|
item->setText(i18nc("KFile System Bookmarks", bookmark.text().toUtf8().constData()));
|
||||||
item->setSystemItem(true);
|
item->setSystemItem(true);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -29,7 +29,7 @@ class PlacesItem;
|
||||||
* and performing a corresponding action.
|
* and performing a corresponding action.
|
||||||
*
|
*
|
||||||
* PlacesItem is derived from KStandardItem, which is no QObject-class
|
* PlacesItem is derived from KStandardItem, which is no QObject-class
|
||||||
* on purpose. To be able to internally listening to signals and performing a
|
* on purpose. To be able to internally listen to signals and performing a
|
||||||
* corresponding action, PlacesItemSignalHandler is used.
|
* corresponding action, PlacesItemSignalHandler is used.
|
||||||
*
|
*
|
||||||
* E.g. if the PlacesItem wants to react on accessibility-changes of a storage-access,
|
* E.g. if the PlacesItem wants to react on accessibility-changes of a storage-access,
|
||||||
|
|
|
@ -117,7 +117,7 @@ void PlacesPanel::showEvent(QShowEvent* event)
|
||||||
m_controller->setSelectionBehavior(KItemListController::SingleSelection);
|
m_controller->setSelectionBehavior(KItemListController::SingleSelection);
|
||||||
m_controller->setSingleClickActivationEnforced(true);
|
m_controller->setSingleClickActivationEnforced(true);
|
||||||
|
|
||||||
readSettings();
|
readSettings();
|
||||||
|
|
||||||
connect(m_controller, &KItemListController::itemActivated, this, &PlacesPanel::slotItemActivated);
|
connect(m_controller, &KItemListController::itemActivated, this, &PlacesPanel::slotItemActivated);
|
||||||
connect(m_controller, &KItemListController::itemMiddleClicked, this, &PlacesPanel::slotItemMiddleClicked);
|
connect(m_controller, &KItemListController::itemMiddleClicked, this, &PlacesPanel::slotItemMiddleClicked);
|
||||||
|
@ -538,5 +538,3 @@ void PlacesPanel::triggerItem(int index, Qt::MouseButton button)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue