mirror of
https://invent.kde.org/system/dolphin
synced 2024-11-05 18:47:12 +00:00
PlacesItemListWidget: Use Solid to check if device is a network share
This commit is contained in:
parent
f6327ffec8
commit
880766bd56
1 changed files with 12 additions and 3 deletions
|
@ -12,6 +12,8 @@
|
||||||
#include <KColorScheme>
|
#include <KColorScheme>
|
||||||
|
|
||||||
#include <KIO/FileSystemFreeSpaceJob>
|
#include <KIO/FileSystemFreeSpaceJob>
|
||||||
|
#include <Solid/Device>
|
||||||
|
#include <Solid/NetworkShare>
|
||||||
|
|
||||||
#define CAPACITYBAR_HEIGHT 2
|
#define CAPACITYBAR_HEIGHT 2
|
||||||
#define CAPACITYBAR_MARGIN 2
|
#define CAPACITYBAR_MARGIN 2
|
||||||
|
@ -41,12 +43,19 @@ QPalette::ColorRole PlacesItemListWidget::normalTextColorRole() const
|
||||||
|
|
||||||
void PlacesItemListWidget::updateCapacityBar()
|
void PlacesItemListWidget::updateCapacityBar()
|
||||||
{
|
{
|
||||||
const bool isDevice = !data().value("udi").toString().isEmpty();
|
const QString udi = data().value("udi").toString();
|
||||||
const QUrl url = data().value("url").toUrl();
|
if (udi.isEmpty()) {
|
||||||
if (!(isDevice && url.isLocalFile())) {
|
|
||||||
resetCapacityBar();
|
resetCapacityBar();
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
const Solid::Device device = Solid::Device(udi);
|
||||||
|
if (device.isDeviceInterface(Solid::DeviceInterface::NetworkShare)
|
||||||
|
|| device.isDeviceInterface(Solid::DeviceInterface::OpticalDrive)
|
||||||
|
|| device.isDeviceInterface(Solid::DeviceInterface::OpticalDisc)) {
|
||||||
|
resetCapacityBar();
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
const QUrl url = data().value("url").toUrl();
|
||||||
|
|
||||||
if (m_freeSpaceInfo.job || !m_freeSpaceInfo.lastUpdated.hasExpired()) {
|
if (m_freeSpaceInfo.job || !m_freeSpaceInfo.lastUpdated.hasExpired()) {
|
||||||
// Job running or cache is still valid.
|
// Job running or cache is still valid.
|
||||||
|
|
Loading…
Reference in a new issue