Adjust to kpmcore enum changes.

This commit is contained in:
Andrius Štikonas 2018-04-09 15:14:48 +01:00
parent 96693a8455
commit e9ac1cf977
10 changed files with 33 additions and 33 deletions

View File

@ -127,7 +127,7 @@ void EditMountPointDialogWidget::setupOptions(const QStringList& options)
m_Options = optTmpList.join(QLatin1Char(',')); m_Options = optTmpList.join(QLatin1Char(','));
} }
void EditMountPointDialogWidget::setupRadio(const FstabEntryType entryType) void EditMountPointDialogWidget::setupRadio(const FstabEntry::Type entryType)
{ {
if (partition().fileSystem().uuid().isEmpty()) { if (partition().fileSystem().uuid().isEmpty()) {
radioUUID().setEnabled(false); radioUUID().setEnabled(false);
@ -141,26 +141,26 @@ void EditMountPointDialogWidget::setupRadio(const FstabEntryType entryType)
radioDeviceNode().setChecked(true); radioDeviceNode().setChecked(true);
} }
switch (entryType) { switch (entryType) {
case FstabEntryType::uuid: case FstabEntry::Type::uuid:
radioUUID().setChecked(true); radioUUID().setChecked(true);
break; break;
case FstabEntryType::label: case FstabEntry::Type::label:
radioLabel().setChecked(true); radioLabel().setChecked(true);
break; break;
case FstabEntryType::partuuid: case FstabEntry::Type::partuuid:
radioUUID().setChecked(true); radioUUID().setChecked(true);
break; break;
case FstabEntryType::partlabel: case FstabEntry::Type::partlabel:
radioLabel().setChecked(true); radioLabel().setChecked(true);
break; break;
case FstabEntryType::deviceNode: case FstabEntry::Type::deviceNode:
radioDeviceNode().setChecked(true); radioDeviceNode().setChecked(true);
break; break;
case FstabEntryType::comment: case FstabEntry::Type::comment:
break; break;
} }
} }

View File

@ -84,7 +84,7 @@ protected:
private: private:
void setupOptions(const QStringList& options); void setupOptions(const QStringList& options);
void setupRadio(const FstabEntryType entryType); void setupRadio(const FstabEntry::Type entryType);
std::map<QString, QCheckBox*>& boxOptions() { std::map<QString, QCheckBox*>& boxOptions() {
return m_BoxOptions; return m_BoxOptions;
} }

View File

@ -704,7 +704,7 @@ void MainWindow::on_m_PartitionManagerWidget_selectedPartitionChanged(const Part
void MainWindow::scanDevices() void MainWindow::scanDevices()
{ {
Log(Log::information) << xi18nc("@info:progress", "Using backend plugin: %1 (%2)", Log(Log::Level::information) << xi18nc("@info:progress", "Using backend plugin: %1 (%2)",
CoreBackendManager::self()->backend()->id(), CoreBackendManager::self()->backend()->id(),
CoreBackendManager::self()->backend()->version()); CoreBackendManager::self()->backend()->version());
@ -1054,11 +1054,11 @@ void MainWindow::onImportPartitionTable()
if (fs->supportSetLabel() != FileSystem::cmdSupportNone && !volumeLabel.isEmpty()) if (fs->supportSetLabel() != FileSystem::cmdSupportNone && !volumeLabel.isEmpty())
fs->setLabel(volumeLabel); fs->setLabel(volumeLabel);
Partition* p = new Partition(parent, device, role, fs, firstSector, lastSector, QString(), PartitionTable::FlagNone, QString(), false, PartitionTable::FlagNone, Partition::StateNew); Partition* p = new Partition(parent, device, role, fs, firstSector, lastSector, QString(), PartitionTable::FlagNone, QString(), false, PartitionTable::FlagNone, Partition::State::New);
operationStack().push(new NewOperation(device, p)); operationStack().push(new NewOperation(device, p));
} else } else
Log(Log::warning) << xi18nc("@info:status", "Could not parse line %1 from import file. Ignoring it.", lineNo); Log(Log::Level::warning) << xi18nc("@info:status", "Could not parse line %1 from import file. Ignoring it.", lineNo);
} }
if (ptable->type() == PartitionTable::msdos && ptable->isSectorBased(device)) if (ptable->type() == PartitionTable::msdos && ptable->isSectorBased(device))

View File

@ -569,11 +569,11 @@ void PartitionManagerWidget::onDeletePartition(bool shred)
} }
if (shred && Config::shredSource() == Config::EnumShredSource::random) if (shred && Config::shredSource() == Config::EnumShredSource::random)
operationStack().push(new DeleteOperation(*selectedDevice(), selectedPartition(), DeleteOperation::RandomShred)); operationStack().push(new DeleteOperation(*selectedDevice(), selectedPartition(), DeleteOperation::ShredAction::RandomShred));
else if (shred && Config::shredSource() == Config::EnumShredSource::zeros) else if (shred && Config::shredSource() == Config::EnumShredSource::zeros)
operationStack().push(new DeleteOperation(*selectedDevice(), selectedPartition(), DeleteOperation::ZeroShred)); operationStack().push(new DeleteOperation(*selectedDevice(), selectedPartition(), DeleteOperation::ShredAction::ZeroShred));
else else
operationStack().push(new DeleteOperation(*selectedDevice(), selectedPartition(), DeleteOperation::NoShred)); operationStack().push(new DeleteOperation(*selectedDevice(), selectedPartition(), DeleteOperation::ShredAction::NoShred));
} }
void PartitionManagerWidget::onShredPartition() void PartitionManagerWidget::onShredPartition()
@ -614,7 +614,7 @@ void PartitionManagerWidget::onResizePartition()
if (dlg->exec() == QDialog::Accepted) { if (dlg->exec() == QDialog::Accepted) {
if (dlg->resizedFirstSector() == p.firstSector() && dlg->resizedLastSector() == p.lastSector()) if (dlg->resizedFirstSector() == p.firstSector() && dlg->resizedLastSector() == p.lastSector())
Log(Log::information) << xi18nc("@info:status", "Partition <filename>%1</filename> has the same position and size after resize/move. Ignoring operation.", p.deviceNode()); Log(Log::Level::information) << xi18nc("@info:status", "Partition <filename>%1</filename> has the same position and size after resize/move. Ignoring operation.", p.deviceNode());
else else
operationStack().push(new ResizeOperation(*selectedDevice(), p, dlg->resizedFirstSector(), dlg->resizedLastSector())); operationStack().push(new ResizeOperation(*selectedDevice(), p, dlg->resizedFirstSector(), dlg->resizedLastSector()));
} }

View File

@ -51,7 +51,7 @@ PartPropsDialog::PartPropsDialog(QWidget* parent, Device& d, Partition& p) :
m_Partition(p), m_Partition(p),
m_WarnFileSystemChange(false), m_WarnFileSystemChange(false),
m_DialogWidget(new PartPropsWidget(this)), m_DialogWidget(new PartPropsWidget(this)),
m_ReadOnly(partition().isMounted() || partition().state() == Partition::StateCopy || partition().state() == Partition::StateRestore || d.partitionTable()->isReadOnly()), m_ReadOnly(partition().isMounted() || partition().state() == Partition::State::Copy || partition().state() == Partition::State::Restore || d.partitionTable()->isReadOnly()),
m_ForceRecreate(false) m_ForceRecreate(false)
{ {
mainLayout = new QVBoxLayout(this); mainLayout = new QVBoxLayout(this);
@ -152,7 +152,7 @@ void PartPropsDialog::setupDialog()
dialogWidget().label().setText(newLabel().isEmpty() ? partition().fileSystem().label() : newLabel()); dialogWidget().label().setText(newLabel().isEmpty() ? partition().fileSystem().label() : newLabel());
dialogWidget().capacity().setText(Capacity::formatByteSize(partition().capacity())); dialogWidget().capacity().setText(Capacity::formatByteSize(partition().capacity()));
if (Capacity(partition(), Capacity::Available).isValid()) { if (Capacity(partition(), Capacity::Type::Available).isValid()) {
const qint64 availPercent = (partition().fileSystem().length() - partition().fileSystem().sectorsUsed()) * 100 / partition().fileSystem().length(); const qint64 availPercent = (partition().fileSystem().length() - partition().fileSystem().sectorsUsed()) * 100 / partition().fileSystem().length();
const QString availString = QStringLiteral("%1% - %2") const QString availString = QStringLiteral("%1% - %2")
@ -220,7 +220,7 @@ void PartPropsDialog::updateHideAndShow()
// when do we show the uuid? // when do we show the uuid?
const bool showUuid = const bool showUuid =
partition().state() != Partition::StateNew && // not for new partitions partition().state() != Partition::State::New && // not for new partitions
!(fs == nullptr || fs->supportGetUUID() == FileSystem::cmdSupportNone); // not if the FS doesn't support it !(fs == nullptr || fs->supportGetUUID() == FileSystem::cmdSupportNone); // not if the FS doesn't support it
dialogWidget().showUuid(showUuid); dialogWidget().showUuid(showUuid);
@ -229,7 +229,7 @@ void PartPropsDialog::updateHideAndShow()
// when do we show available and used capacity? // when do we show available and used capacity?
const bool showAvailableAndUsed = const bool showAvailableAndUsed =
partition().state() != Partition::StateNew && // not for new partitions partition().state() != Partition::State::New && // not for new partitions
!partition().roles().has(PartitionRole::Extended) && // neither for extended !partition().roles().has(PartitionRole::Extended) && // neither for extended
!partition().roles().has(PartitionRole::Unallocated) && // or for unallocated !partition().roles().has(PartitionRole::Unallocated) && // or for unallocated
newFileSystemType() != FileSystem::Type::Unformatted; // and not for unformatted file systems newFileSystemType() != FileSystem::Type::Unformatted; // and not for unformatted file systems
@ -250,14 +250,14 @@ void PartPropsDialog::updateHideAndShow()
showFileSystem && // only if we also show the file system showFileSystem && // only if we also show the file system
partition().fileSystem().supportCreate() != FileSystem::cmdSupportNone && // and support creating this file system partition().fileSystem().supportCreate() != FileSystem::cmdSupportNone && // and support creating this file system
partition().fileSystem().type() != FileSystem::Type::Unknown && // and not for unknown file systems partition().fileSystem().type() != FileSystem::Type::Unknown && // and not for unknown file systems
partition().state() != Partition::StateNew && // or new partitions partition().state() != Partition::State::New && // or new partitions
!partition().roles().has(PartitionRole::Luks); // or encrypted filesystems !partition().roles().has(PartitionRole::Luks); // or encrypted filesystems
dialogWidget().showCheckRecreate(showCheckRecreate); dialogWidget().showCheckRecreate(showCheckRecreate);
// when do we show the list of partition flags? // when do we show the list of partition flags?
const bool showListFlags = const bool showListFlags =
partition().state() != Partition::StateNew && // not for new partitions partition().state() != Partition::State::New && // not for new partitions
!partition().roles().has(PartitionRole::Unallocated); // and not for unallocated space !partition().roles().has(PartitionRole::Unallocated); // and not for unallocated space
dialogWidget().showListFlags(showListFlags); dialogWidget().showListFlags(showListFlags);
@ -316,7 +316,7 @@ void PartPropsDialog::setupFileSystemComboBox()
if (partition().fileSystem().type() == FileSystem::Type::Unknown) { if (partition().fileSystem().type() == FileSystem::Type::Unknown) {
name = FileSystem::nameForType(FileSystem::Type::Unformatted); name = FileSystem::nameForType(FileSystem::Type::Unformatted);
selected = name; selected = name;
} else if (partition().fileSystem().type() != FileSystem::Type::Unformatted && partition().state() != Partition::StateNew) } else if (partition().fileSystem().type() != FileSystem::Type::Unformatted && partition().state() != Partition::State::New)
continue; continue;
} }
@ -346,7 +346,7 @@ void PartPropsDialog::updatePartitionFileSystem()
void PartPropsDialog::onFilesystemChanged(int) void PartPropsDialog::onFilesystemChanged(int)
{ {
if (partition().state() == Partition::StateNew || warnFileSystemChange() || KMessageBox::warningContinueCancel(this, if (partition().state() == Partition::State::New || warnFileSystemChange() || KMessageBox::warningContinueCancel(this,
xi18nc("@info", "<para><warning>You are about to lose all data on partition <filename>%1</filename>.</warning></para>" xi18nc("@info", "<para><warning>You are about to lose all data on partition <filename>%1</filename>.</warning></para>"
"<para>Changing the file system on a partition already on disk will erase all its contents. If you continue now and apply the resulting operation in the main window, all data on <filename>%1</filename> will unrecoverably be lost.</para>", partition().deviceNode()), "<para>Changing the file system on a partition already on disk will erase all its contents. If you continue now and apply the resulting operation in the main window, all data on <filename>%1</filename> will unrecoverably be lost.</para>", partition().deviceNode()),
xi18nc("@title:window", "Really Recreate <filename>%1</filename> with File System %2?", partition().deviceNode(), dialogWidget().fileSystem().currentText()), xi18nc("@title:window", "Really Recreate <filename>%1</filename> with File System %2?", partition().deviceNode(), dialogWidget().fileSystem().currentText()),

View File

@ -91,7 +91,7 @@ void ResizeDialog::accept()
if (partition().roles().has(PartitionRole::Luks)) { if (partition().roles().has(PartitionRole::Luks)) {
FS::luks2* luksFs = dynamic_cast<FS::luks2*>(&partition().fileSystem()); FS::luks2* luksFs = dynamic_cast<FS::luks2*>(&partition().fileSystem());
if (luksFs) { if (luksFs) {
if (luksFs->keyLocation() == FS::luks::keyring) { if (luksFs->keyLocation() == FS::luks::KeyLocation::keyring) {
bool validPassphrase = false; bool validPassphrase = false;
QString errorMessage; QString errorMessage;
QString passphrase; QString passphrase;

View File

@ -467,6 +467,6 @@ static double sectorsToDialogUnit(const Device& d, qint64 v)
static qint64 dialogUnitToSectors(const Device& d, double v) static qint64 dialogUnitToSectors(const Device& d, double v)
{ {
return v * Capacity::unitFactor(Capacity::Byte, preferredUnit()) / d.logicalSize(); return v * Capacity::unitFactor(Capacity::Unit::Byte, preferredUnit()) / d.logicalSize();
} }

View File

@ -121,8 +121,8 @@ void SmartDialog::setupDialog()
QStringList() QStringList()
<< QLocale().toString(a.id()) << QLocale().toString(a.id())
<< QStringLiteral("<b>%1</b><br/>%2").arg(a.name()).arg(st + a.desc() + QStringLiteral("</span>")) << QStringLiteral("<b>%1</b><br/>%2").arg(a.name()).arg(st + a.desc() + QStringLiteral("</span>"))
<< (a.failureType() == SmartAttribute::PreFailure ? xi18nc("@item:intable", "Pre-Failure") : xi18nc("@item:intable", "Old-Age")) << (a.failureType() == SmartAttribute::FailureType::PreFailure ? xi18nc("@item:intable", "Pre-Failure") : xi18nc("@item:intable", "Old-Age"))
<< (a.updateType() == SmartAttribute::Online ? xi18nc("@item:intable", "Online") : xi18nc("@item:intable", "Offline")) << (a.updateType() == SmartAttribute::UpdateType::Online ? xi18nc("@item:intable", "Online") : xi18nc("@item:intable", "Offline"))
<< QLocale().toString(a.worst()) << QLocale().toString(a.worst())
<< QLocale().toString(a.current()) << QLocale().toString(a.current())
<< QLocale().toString(a.threshold()) << QLocale().toString(a.threshold())
@ -187,8 +187,8 @@ QString SmartDialog::toHtml() const
s << "<td>" << QLocale().toString(a.id()) << "</td>\n" s << "<td>" << QLocale().toString(a.id()) << "</td>\n"
<< "<td>" << QStringLiteral("<b>%1</b><br/>%2").arg(a.name()).arg(st + a.desc() + QStringLiteral("</span>")) << "</td>\n" << "<td>" << QStringLiteral("<b>%1</b><br/>%2").arg(a.name()).arg(st + a.desc() + QStringLiteral("</span>")) << "</td>\n"
<< "<td>" << (a.failureType() == SmartAttribute::PreFailure ? xi18nc("@item:intable", "Pre-Failure") : xi18nc("@item:intable", "Old-Age")) << "</td>\n" << "<td>" << (a.failureType() == SmartAttribute::FailureType::PreFailure ? xi18nc("@item:intable", "Pre-Failure") : xi18nc("@item:intable", "Old-Age")) << "</td>\n"
<< "<td>" << (a.updateType() == SmartAttribute::Online ? xi18nc("@item:intable", "Online") : xi18nc("@item:intable", "Offline")) << "</td>\n" << "<td>" << (a.updateType() == SmartAttribute::UpdateType::Online ? xi18nc("@item:intable", "Online") : xi18nc("@item:intable", "Offline")) << "</td>\n"
<< "<td>" << QLocale().toString(a.worst()) << "</td>\n" << "<td>" << QLocale().toString(a.worst()) << "</td>\n"
<< "<td>" << QLocale().toString(a.current()) << "</td>\n" << "<td>" << QLocale().toString(a.current()) << "</td>\n"
<< "<td>" << QLocale().toString(a.threshold()) << "</td>\n" << "<td>" << QLocale().toString(a.threshold()) << "</td>\n"

View File

@ -150,10 +150,10 @@ void TreeLog::onNewLogMessage(Log::Level logLevel, const QString& s)
qDebug() << s; qDebug() << s;
if (logLevel >= Config::minLogLevel()) { if (static_cast<int>(logLevel) >= Config::minLogLevel()) {
QTreeWidgetItem* item = new QTreeWidgetItem(); QTreeWidgetItem* item = new QTreeWidgetItem();
item->setIcon(0, QIcon::fromTheme(icons[logLevel]).pixmap(IconSize(KIconLoader::Small))); item->setIcon(0, QIcon::fromTheme(icons[static_cast<int>(logLevel)]).pixmap(IconSize(KIconLoader::Small)));
item->setText(1, QDateTime::currentDateTime().toString(QStringLiteral("yyyy-MM-dd hh:mm:ss"))); item->setText(1, QDateTime::currentDateTime().toString(QStringLiteral("yyyy-MM-dd hh:mm:ss")));
item->setText(2, s); item->setText(2, s);

View File

@ -127,7 +127,7 @@ void VolumeGroupDialog::updateSectorInfos()
{ {
qint32 totalSectors = 0; qint32 totalSectors = 0;
// we can't use LvmDevice mothod here because pv that is not in any VG will return 0 // we can't use LvmDevice mothod here because pv that is not in any VG will return 0
m_ExtentSize = dialogWidget().spinPESize().value() * Capacity::unitFactor(Capacity::Byte, Capacity::MiB); m_ExtentSize = dialogWidget().spinPESize().value() * Capacity::unitFactor(Capacity::Unit::Byte, Capacity::Unit::MiB);
if (m_ExtentSize > 0) { if (m_ExtentSize > 0) {
totalSectors = m_TotalSize / m_ExtentSize; totalSectors = m_TotalSize / m_ExtentSize;
} }
@ -139,7 +139,7 @@ void VolumeGroupDialog::updateSizeInfos()
const QVector<const Partition *> checkedPartitions = dialogWidget().listPV().checkedItems(); const QVector<const Partition *> checkedPartitions = dialogWidget().listPV().checkedItems();
m_TotalSize = 0; m_TotalSize = 0;
for (const auto &p : checkedPartitions) for (const auto &p : checkedPartitions)
m_TotalSize += p->capacity() - p->capacity() % (dialogWidget().spinPESize().value() * Capacity::unitFactor(Capacity::Byte, Capacity::MiB)); // subtract space which is too small to hold PE m_TotalSize += p->capacity() - p->capacity() % (dialogWidget().spinPESize().value() * Capacity::unitFactor(Capacity::Unit::Byte, Capacity::Unit::MiB)); // subtract space which is too small to hold PE
dialogWidget().totalSize().setText(Capacity::formatByteSize(m_TotalSize)); dialogWidget().totalSize().setText(Capacity::formatByteSize(m_TotalSize));