From e9ac1cf977ff838a35d4b8a2e8315d06828e943f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Andrius=20=C5=A0tikonas?= Date: Mon, 9 Apr 2018 15:14:48 +0100 Subject: [PATCH] Adjust to kpmcore enum changes. --- src/gui/editmountpointdialogwidget.cpp | 14 +++++++------- src/gui/editmountpointdialogwidget.h | 2 +- src/gui/mainwindow.cpp | 6 +++--- src/gui/partitionmanagerwidget.cpp | 8 ++++---- src/gui/partpropsdialog.cpp | 16 ++++++++-------- src/gui/resizedialog.cpp | 2 +- src/gui/sizedialogbase.cpp | 2 +- src/gui/smartdialog.cpp | 8 ++++---- src/gui/treelog.cpp | 4 ++-- src/gui/volumegroupdialog.cpp | 4 ++-- 10 files changed, 33 insertions(+), 33 deletions(-) diff --git a/src/gui/editmountpointdialogwidget.cpp b/src/gui/editmountpointdialogwidget.cpp index e4099bf..768aef4 100644 --- a/src/gui/editmountpointdialogwidget.cpp +++ b/src/gui/editmountpointdialogwidget.cpp @@ -127,7 +127,7 @@ void EditMountPointDialogWidget::setupOptions(const QStringList& options) m_Options = optTmpList.join(QLatin1Char(',')); } -void EditMountPointDialogWidget::setupRadio(const FstabEntryType entryType) +void EditMountPointDialogWidget::setupRadio(const FstabEntry::Type entryType) { if (partition().fileSystem().uuid().isEmpty()) { radioUUID().setEnabled(false); @@ -141,26 +141,26 @@ void EditMountPointDialogWidget::setupRadio(const FstabEntryType entryType) radioDeviceNode().setChecked(true); } switch (entryType) { - case FstabEntryType::uuid: + case FstabEntry::Type::uuid: radioUUID().setChecked(true); break; - case FstabEntryType::label: + case FstabEntry::Type::label: radioLabel().setChecked(true); break; - case FstabEntryType::partuuid: + case FstabEntry::Type::partuuid: radioUUID().setChecked(true); break; - case FstabEntryType::partlabel: + case FstabEntry::Type::partlabel: radioLabel().setChecked(true); break; - case FstabEntryType::deviceNode: + case FstabEntry::Type::deviceNode: radioDeviceNode().setChecked(true); break; - case FstabEntryType::comment: + case FstabEntry::Type::comment: break; } } diff --git a/src/gui/editmountpointdialogwidget.h b/src/gui/editmountpointdialogwidget.h index b1d7ad9..e248b21 100644 --- a/src/gui/editmountpointdialogwidget.h +++ b/src/gui/editmountpointdialogwidget.h @@ -84,7 +84,7 @@ protected: private: void setupOptions(const QStringList& options); - void setupRadio(const FstabEntryType entryType); + void setupRadio(const FstabEntry::Type entryType); std::map& boxOptions() { return m_BoxOptions; } diff --git a/src/gui/mainwindow.cpp b/src/gui/mainwindow.cpp index dbc8aff..29eb69b 100644 --- a/src/gui/mainwindow.cpp +++ b/src/gui/mainwindow.cpp @@ -704,7 +704,7 @@ void MainWindow::on_m_PartitionManagerWidget_selectedPartitionChanged(const Part 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()->version()); @@ -1054,11 +1054,11 @@ void MainWindow::onImportPartitionTable() if (fs->supportSetLabel() != FileSystem::cmdSupportNone && !volumeLabel.isEmpty()) 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)); } 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)) diff --git a/src/gui/partitionmanagerwidget.cpp b/src/gui/partitionmanagerwidget.cpp index 3c8243d..4bdb11d 100644 --- a/src/gui/partitionmanagerwidget.cpp +++ b/src/gui/partitionmanagerwidget.cpp @@ -569,11 +569,11 @@ void PartitionManagerWidget::onDeletePartition(bool shred) } 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) - operationStack().push(new DeleteOperation(*selectedDevice(), selectedPartition(), DeleteOperation::ZeroShred)); + operationStack().push(new DeleteOperation(*selectedDevice(), selectedPartition(), DeleteOperation::ShredAction::ZeroShred)); else - operationStack().push(new DeleteOperation(*selectedDevice(), selectedPartition(), DeleteOperation::NoShred)); + operationStack().push(new DeleteOperation(*selectedDevice(), selectedPartition(), DeleteOperation::ShredAction::NoShred)); } void PartitionManagerWidget::onShredPartition() @@ -614,7 +614,7 @@ void PartitionManagerWidget::onResizePartition() if (dlg->exec() == QDialog::Accepted) { if (dlg->resizedFirstSector() == p.firstSector() && dlg->resizedLastSector() == p.lastSector()) - Log(Log::information) << xi18nc("@info:status", "Partition %1 has the same position and size after resize/move. Ignoring operation.", p.deviceNode()); + Log(Log::Level::information) << xi18nc("@info:status", "Partition %1 has the same position and size after resize/move. Ignoring operation.", p.deviceNode()); else operationStack().push(new ResizeOperation(*selectedDevice(), p, dlg->resizedFirstSector(), dlg->resizedLastSector())); } diff --git a/src/gui/partpropsdialog.cpp b/src/gui/partpropsdialog.cpp index f8bb36e..e586fe1 100644 --- a/src/gui/partpropsdialog.cpp +++ b/src/gui/partpropsdialog.cpp @@ -51,7 +51,7 @@ PartPropsDialog::PartPropsDialog(QWidget* parent, Device& d, Partition& p) : m_Partition(p), m_WarnFileSystemChange(false), 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) { mainLayout = new QVBoxLayout(this); @@ -152,7 +152,7 @@ void PartPropsDialog::setupDialog() dialogWidget().label().setText(newLabel().isEmpty() ? partition().fileSystem().label() : newLabel()); 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 QString availString = QStringLiteral("%1% - %2") @@ -220,7 +220,7 @@ void PartPropsDialog::updateHideAndShow() // when do we show the uuid? 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 dialogWidget().showUuid(showUuid); @@ -229,7 +229,7 @@ void PartPropsDialog::updateHideAndShow() // when do we show available and used capacity? 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::Unallocated) && // or for unallocated 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 partition().fileSystem().supportCreate() != FileSystem::cmdSupportNone && // and support creating this file system 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 dialogWidget().showCheckRecreate(showCheckRecreate); // when do we show the list of partition flags? 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 dialogWidget().showListFlags(showListFlags); @@ -316,7 +316,7 @@ void PartPropsDialog::setupFileSystemComboBox() if (partition().fileSystem().type() == FileSystem::Type::Unknown) { name = FileSystem::nameForType(FileSystem::Type::Unformatted); 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; } @@ -346,7 +346,7 @@ void PartPropsDialog::updatePartitionFileSystem() 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", "You are about to lose all data on partition %1." "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 %1 will unrecoverably be lost.", partition().deviceNode()), xi18nc("@title:window", "Really Recreate %1 with File System %2?", partition().deviceNode(), dialogWidget().fileSystem().currentText()), diff --git a/src/gui/resizedialog.cpp b/src/gui/resizedialog.cpp index 6ab5aa8..6e45b6e 100644 --- a/src/gui/resizedialog.cpp +++ b/src/gui/resizedialog.cpp @@ -91,7 +91,7 @@ void ResizeDialog::accept() if (partition().roles().has(PartitionRole::Luks)) { FS::luks2* luksFs = dynamic_cast(&partition().fileSystem()); if (luksFs) { - if (luksFs->keyLocation() == FS::luks::keyring) { + if (luksFs->keyLocation() == FS::luks::KeyLocation::keyring) { bool validPassphrase = false; QString errorMessage; QString passphrase; diff --git a/src/gui/sizedialogbase.cpp b/src/gui/sizedialogbase.cpp index 02e89b2..7116756 100644 --- a/src/gui/sizedialogbase.cpp +++ b/src/gui/sizedialogbase.cpp @@ -467,6 +467,6 @@ static double sectorsToDialogUnit(const Device& d, qint64 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(); } diff --git a/src/gui/smartdialog.cpp b/src/gui/smartdialog.cpp index cacffbe..78c6c64 100644 --- a/src/gui/smartdialog.cpp +++ b/src/gui/smartdialog.cpp @@ -121,8 +121,8 @@ void SmartDialog::setupDialog() QStringList() << QLocale().toString(a.id()) << QStringLiteral("%1
%2").arg(a.name()).arg(st + a.desc() + QStringLiteral("")) - << (a.failureType() == SmartAttribute::PreFailure ? xi18nc("@item:intable", "Pre-Failure") : xi18nc("@item:intable", "Old-Age")) - << (a.updateType() == SmartAttribute::Online ? xi18nc("@item:intable", "Online") : xi18nc("@item:intable", "Offline")) + << (a.failureType() == SmartAttribute::FailureType::PreFailure ? xi18nc("@item:intable", "Pre-Failure") : xi18nc("@item:intable", "Old-Age")) + << (a.updateType() == SmartAttribute::UpdateType::Online ? xi18nc("@item:intable", "Online") : xi18nc("@item:intable", "Offline")) << QLocale().toString(a.worst()) << QLocale().toString(a.current()) << QLocale().toString(a.threshold()) @@ -187,8 +187,8 @@ QString SmartDialog::toHtml() const s << "" << QLocale().toString(a.id()) << "\n" << "" << QStringLiteral("%1
%2").arg(a.name()).arg(st + a.desc() + QStringLiteral("")) << "\n" - << "" << (a.failureType() == SmartAttribute::PreFailure ? xi18nc("@item:intable", "Pre-Failure") : xi18nc("@item:intable", "Old-Age")) << "\n" - << "" << (a.updateType() == SmartAttribute::Online ? xi18nc("@item:intable", "Online") : xi18nc("@item:intable", "Offline")) << "\n" + << "" << (a.failureType() == SmartAttribute::FailureType::PreFailure ? xi18nc("@item:intable", "Pre-Failure") : xi18nc("@item:intable", "Old-Age")) << "\n" + << "" << (a.updateType() == SmartAttribute::UpdateType::Online ? xi18nc("@item:intable", "Online") : xi18nc("@item:intable", "Offline")) << "\n" << "" << QLocale().toString(a.worst()) << "\n" << "" << QLocale().toString(a.current()) << "\n" << "" << QLocale().toString(a.threshold()) << "\n" diff --git a/src/gui/treelog.cpp b/src/gui/treelog.cpp index d1bb792..9cd0f6d 100644 --- a/src/gui/treelog.cpp +++ b/src/gui/treelog.cpp @@ -150,10 +150,10 @@ void TreeLog::onNewLogMessage(Log::Level logLevel, const QString& s) qDebug() << s; - if (logLevel >= Config::minLogLevel()) { + if (static_cast(logLevel) >= Config::minLogLevel()) { QTreeWidgetItem* item = new QTreeWidgetItem(); - item->setIcon(0, QIcon::fromTheme(icons[logLevel]).pixmap(IconSize(KIconLoader::Small))); + item->setIcon(0, QIcon::fromTheme(icons[static_cast(logLevel)]).pixmap(IconSize(KIconLoader::Small))); item->setText(1, QDateTime::currentDateTime().toString(QStringLiteral("yyyy-MM-dd hh:mm:ss"))); item->setText(2, s); diff --git a/src/gui/volumegroupdialog.cpp b/src/gui/volumegroupdialog.cpp index 8434bee..70edf02 100644 --- a/src/gui/volumegroupdialog.cpp +++ b/src/gui/volumegroupdialog.cpp @@ -127,7 +127,7 @@ void VolumeGroupDialog::updateSectorInfos() { qint32 totalSectors = 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) { totalSectors = m_TotalSize / m_ExtentSize; } @@ -139,7 +139,7 @@ void VolumeGroupDialog::updateSizeInfos() const QVector checkedPartitions = dialogWidget().listPV().checkedItems(); m_TotalSize = 0; 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));