Fix catching LibParted exeptions

new_installer
ivan 14 years ago
parent b24aff4b42
commit e24bd9f61b

@ -58,7 +58,6 @@ QList<PartitionInfo> LibParted::getPartitionList(const QString& path) throw(LibP
{
QList<PartitionInfo> PartInfo;
if ( m_DeviceList.find(path) == m_DeviceList.end() )
throw LibPartedError();

@ -97,11 +97,9 @@ void PagePartitioning::show()
qDebug() << "parted version: " << libParted->getVersion();
QStringList disks;
try {
disks = libParted->getDevices();
}
catch(LibPartedError e)
QStringList disks = libParted->getDevices();
if ( disks.isEmpty() )
{
qDebug() << "disk not found";
QMessageBox::critical(m_Widget, tr("Error"), tr("Disks not found"));
@ -117,14 +115,24 @@ void PagePartitioning::show()
}
catch(LibPartedError e)
{
qDebug() << QString("partitions not found on disk %1").arg(dev);
qDebug() << QString("Cannot read disk info from %1").arg(dev);
continue;
}
QString disk_info = QString("%1 %2 %3").arg(dev, 10).arg(dev_info.size, 10).arg(dev_info.model, 25);
m_Disks->addItem(disk_info, QVariant(dev));
QList<PartitionInfo> part_list = libParted->getPartitionList(dev);
QList<PartitionInfo> part_list;
try {
part_list = libParted->getPartitionList(dev);
}
catch(LibPartedError e)
{
qDebug() << QString("Cannot read partition table from %1").arg(dev);
continue;
}
QList<PartitionDesc> partitions;
PartitionDesc part_desc;
@ -142,6 +150,13 @@ void PagePartitioning::show()
m_Disks->setCurrentIndex(0);
updatePartitions(0);
}
if ( m_Disks->count() == 0 )
{
qDebug() << "disk not found";
QMessageBox::critical(m_Widget, tr("Error"), tr("Disks not found"));
emit changeNext(false);
}
}
void PagePartitioning::updatePartitions(int num)

Loading…
Cancel
Save