Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
N
nemo-qml-plugin-systemsettings
Project overview
Project overview
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
martyone
nemo-qml-plugin-systemsettings
Commits
c3c6d186
Commit
c3c6d186
authored
Dec 09, 2016
by
jpetrell
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
[storage] Notify view side when available space in partition changes during manual model refresh()
parent
254ef0d8
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
15 additions
and
6 deletions
+15
-6
src/partitionmanager.cpp
src/partitionmanager.cpp
+14
-5
src/partitionmanager_p.h
src/partitionmanager_p.h
+1
-1
No files found.
src/partitionmanager.cpp
View file @
c3c6d186
...
@@ -229,7 +229,7 @@ void PartitionManagerPrivate::refresh()
...
@@ -229,7 +229,7 @@ void PartitionManagerPrivate::refresh()
const
auto
removedPartitions
=
m_partitions
.
mid
(
index
);
const
auto
removedPartitions
=
m_partitions
.
mid
(
index
);
m_partitions
.
resize
(
index
);
m_partitions
.
resize
(
index
);
refresh
(
m_partitions
);
refresh
(
m_partitions
,
changedPartitions
);
for
(
const
auto
partition
:
removedPartitions
)
{
for
(
const
auto
partition
:
removedPartitions
)
{
emit
partitionRemoved
(
Partition
(
partition
));
emit
partitionRemoved
(
Partition
(
partition
));
...
@@ -249,12 +249,12 @@ void PartitionManagerPrivate::refresh()
...
@@ -249,12 +249,12 @@ void PartitionManagerPrivate::refresh()
void
PartitionManagerPrivate
::
refresh
(
PartitionPrivate
*
partition
)
void
PartitionManagerPrivate
::
refresh
(
PartitionPrivate
*
partition
)
{
{
refresh
(
Partitions
()
<<
QExplicitlySharedDataPointer
<
PartitionPrivate
>
(
partition
));
refresh
(
Partitions
()
<<
QExplicitlySharedDataPointer
<
PartitionPrivate
>
(
partition
)
,
Partitions
()
<<
QExplicitlySharedDataPointer
<
PartitionPrivate
>
(
partition
)
);
emit
partitionChanged
(
Partition
(
QExplicitlySharedDataPointer
<
PartitionPrivate
>
(
partition
)));
emit
partitionChanged
(
Partition
(
QExplicitlySharedDataPointer
<
PartitionPrivate
>
(
partition
)));
}
}
void
PartitionManagerPrivate
::
refresh
(
const
Partitions
&
partitions
)
void
PartitionManagerPrivate
::
refresh
(
const
Partitions
&
partitions
,
Partitions
&
changedPartitions
)
{
{
for
(
auto
partition
:
partitions
)
{
for
(
auto
partition
:
partitions
)
{
// Reset properties to the unmounted defaults. If the partition is mounted these will be restored
// Reset properties to the unmounted defaults. If the partition is mounted these will be restored
...
@@ -311,11 +311,20 @@ void PartitionManagerPrivate::refresh(const Partitions &partitions)
...
@@ -311,11 +311,20 @@ void PartitionManagerPrivate::refresh(const Partitions &partitions)
if
(
partition
->
status
==
Partition
::
Mounted
)
{
if
(
partition
->
status
==
Partition
::
Mounted
)
{
struct
statvfs64
stat
;
struct
statvfs64
stat
;
if
(
::
statvfs64
(
partition
->
mountPath
.
toUtf8
().
constData
(),
&
stat
)
==
0
)
{
if
(
::
statvfs64
(
partition
->
mountPath
.
toUtf8
().
constData
(),
&
stat
)
==
0
)
{
partition
->
bytesTotal
=
stat
.
f_blocks
*
stat
.
f_frsize
;
partition
->
bytesTotal
=
stat
.
f_blocks
*
stat
.
f_frsize
;
partition
->
bytesFree
=
stat
.
f_bfree
*
stat
.
f_frsize
;
qint64
bytesFree
=
stat
.
f_bfree
*
stat
.
f_frsize
;
partition
->
bytesAvailable
=
stat
.
f_bavail
*
stat
.
f_frsize
;
qint64
bytesAvailable
=
stat
.
f_bavail
*
stat
.
f_frsize
;
partition
->
readOnly
=
(
stat
.
f_flag
&
ST_RDONLY
)
!=
0
;
partition
->
readOnly
=
(
stat
.
f_flag
&
ST_RDONLY
)
!=
0
;
if
(
partition
->
bytesFree
!=
bytesFree
||
partition
->
bytesAvailable
!=
bytesAvailable
)
{
if
(
!
changedPartitions
.
contains
(
partition
))
{
changedPartitions
.
append
(
partition
);
}
}
partition
->
bytesFree
=
bytesFree
;
partition
->
bytesAvailable
=
bytesAvailable
;
}
}
}
else
if
(
partition
->
storageType
==
Partition
::
External
)
{
}
else
if
(
partition
->
storageType
==
Partition
::
External
)
{
// Presume the file system can be mounted, unless we can confirm otherwise.
// Presume the file system can be mounted, unless we can confirm otherwise.
...
...
src/partitionmanager_p.h
View file @
c3c6d186
...
@@ -53,7 +53,7 @@ public:
...
@@ -53,7 +53,7 @@ public:
void
refresh
();
void
refresh
();
void
refresh
(
PartitionPrivate
*
partition
);
void
refresh
(
PartitionPrivate
*
partition
);
void
refresh
(
const
Partitions
&
partitions
);
void
refresh
(
const
Partitions
&
partitions
,
Partitions
&
changedPartitions
);
signals:
signals:
void
partitionChanged
(
const
Partition
&
partition
);
void
partitionChanged
(
const
Partition
&
partition
);
...
...
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