Restore device scan progress.

This commit is contained in:
Andrius Štikonas 2015-02-03 17:38:00 +00:00
parent 2a120076d9
commit 79f7ef6494
1 changed files with 9 additions and 2 deletions

View File

@ -441,6 +441,8 @@ QList<Device*> LibPartedBackend::scanDevices()
ped_device_probe_all();
PedDevice* pedDevice = NULL;
QVector<QString> path;
quint32 totalDevices = 0;
while (true)
{
pedDevice = ped_device_get_next(pedDevice);
@ -448,8 +450,13 @@ QList<Device*> LibPartedBackend::scanDevices()
break;
if (pedDevice->type == PED_DEVICE_DM)
continue;
QString path = QString::fromUtf8(pedDevice->path);
Device* d = scanDevice(path);
path.push_back(QString::fromUtf8(pedDevice->path));
++totalDevices;
}
for (quint32 i = 0; i < totalDevices; ++i)
{
emitScanProgress(path[i], i * 100 / totalDevices);
Device* d = scanDevice(path[i]);
if (d)
result.append(d);
}