mirror of
https://invent.kde.org/system/dolphin
synced 2024-08-21 09:20:13 +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");
|
||||
if (udi.isEmpty()) {
|
||||
setIcon(bookmark.icon());
|
||||
setText(i18nc("KFile System Bookmarks", bookmark.text().toUtf8().data()));
|
||||
setText(i18nc("KFile System Bookmarks", bookmark.text().toUtf8().constData()));
|
||||
setUrl(bookmark.url());
|
||||
} else {
|
||||
initializeDevice(udi);
|
||||
|
@ -269,26 +269,26 @@ void PlacesItem::initializeDevice(const QString& udi)
|
|||
setUdi(udi);
|
||||
|
||||
if (m_access) {
|
||||
setUrl(m_access->filePath());
|
||||
QObject::connect(m_access.data(), &Solid::StorageAccess::accessibilityChanged,
|
||||
m_signalHandler.data(), &PlacesItemSignalHandler::onAccessibilityChanged);
|
||||
setUrl(QUrl::fromLocalFile(m_access->filePath()));
|
||||
QObject::connect(m_access.data(), SIGNAL(accessibilityChanged(bool,QString)),
|
||||
m_signalHandler.data(), SLOT(onAccessibilityChanged()));
|
||||
} else if (m_disc && (m_disc->availableContent() & Solid::OpticalDisc::Audio) != 0) {
|
||||
Solid::Block *block = m_device.as<Solid::Block>();
|
||||
if (block) {
|
||||
const QString device = block->device();
|
||||
setUrl(QString("audiocd:/?device=%1").arg(device));
|
||||
setUrl(QStringLiteral("audiocd:/?device=%1").arg(device));
|
||||
} else {
|
||||
setUrl(QString("audiocd:/"));
|
||||
setUrl(QStringLiteral("audiocd:/"));
|
||||
}
|
||||
} 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()
|
||||
{
|
||||
setIconOverlays(m_device.emblems());
|
||||
setUrl(m_access->filePath());
|
||||
setUrl(QUrl::fromLocalFile(m_access->filePath()));
|
||||
}
|
||||
|
||||
void PlacesItem::onTrashDirListerCompleted()
|
||||
|
|
|
@ -82,10 +82,10 @@ public:
|
|||
protected:
|
||||
virtual void onDataValueChanged(const QByteArray& role,
|
||||
const QVariant& current,
|
||||
const QVariant& previous);
|
||||
const QVariant& previous) Q_DECL_OVERRIDE;
|
||||
|
||||
virtual void onDataChanged(const QHash<QByteArray, QVariant>& current,
|
||||
const QHash<QByteArray, QVariant>& previous);
|
||||
const QHash<QByteArray, QVariant>& previous) Q_DECL_OVERRIDE;
|
||||
|
||||
private:
|
||||
PlacesItem(const PlacesItem& item);
|
||||
|
|
|
@ -657,7 +657,7 @@ void PlacesItemModel::updateBookmarks()
|
|||
found = true;
|
||||
if (newBookmark.metaDataItem("UDI").isEmpty()) {
|
||||
item->setBookmark(newBookmark);
|
||||
item->setText(i18nc("KFile System Bookmarks", newBookmark.text().toUtf8().data()));
|
||||
item->setText(i18nc("KFile System Bookmarks", newBookmark.text().toUtf8().constData()));
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
@ -764,7 +764,7 @@ void PlacesItemModel::loadBookmarks()
|
|||
// text, the retranslation will fail and the users custom text is still used.
|
||||
// It is important to use "KFile System Bookmarks" as context (see
|
||||
// createSystemBookmarks()).
|
||||
item->setText(i18nc("KFile System Bookmarks", bookmark.text().toUtf8().data()));
|
||||
item->setText(i18nc("KFile System Bookmarks", bookmark.text().toUtf8().constData()));
|
||||
item->setSystemItem(true);
|
||||
}
|
||||
|
||||
|
|
|
@ -29,7 +29,7 @@ class PlacesItem;
|
|||
* and performing a corresponding action.
|
||||
*
|
||||
* 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.
|
||||
*
|
||||
* 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->setSingleClickActivationEnforced(true);
|
||||
|
||||
readSettings();
|
||||
readSettings();
|
||||
|
||||
connect(m_controller, &KItemListController::itemActivated, this, &PlacesPanel::slotItemActivated);
|
||||
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