Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
System
Dolphin
Commits
880766bd
Commit
880766bd
authored
Nov 09, 2020
by
Méven Car
Browse files
PlacesItemListWidget: Use Solid to check if device is a network share
parent
f6327ffe
Changes
1
Hide whitespace changes
Inline
Side-by-side
src/panels/places/placesitemlistwidget.cpp
View file @
880766bd
...
...
@@ -12,6 +12,8 @@
#include <KColorScheme>
#include <KIO/FileSystemFreeSpaceJob>
#include <Solid/Device>
#include <Solid/NetworkShare>
#define CAPACITYBAR_HEIGHT 2
#define CAPACITYBAR_MARGIN 2
...
...
@@ -41,12 +43,19 @@ QPalette::ColorRole PlacesItemListWidget::normalTextColorRole() const
void
PlacesItemListWidget
::
updateCapacityBar
()
{
const
bool
isDevice
=
!
data
().
value
(
"udi"
).
toString
().
isEmpty
();
const
QUrl
url
=
data
().
value
(
"url"
).
toUrl
();
if
(
!
(
isDevice
&&
url
.
isLocalFile
()))
{
const
QString
udi
=
data
().
value
(
"udi"
).
toString
();
if
(
udi
.
isEmpty
())
{
resetCapacityBar
();
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
())
{
// Job running or cache is still valid.
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment