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