[partition] Make EncryptWidget::setFilesystem take a FileSystem::Type

This commit is contained in:
dalto 2023-02-23 16:47:39 -06:00
parent 2f8ef8fdf3
commit d88d2ce92e
3 changed files with 8 additions and 8 deletions

View File

@ -468,11 +468,11 @@ ChoicePage::onActionChanged()
{ {
if ( m_config->installChoice() == InstallChoice::Erase && m_eraseFsTypesChoiceComboBox ) if ( m_config->installChoice() == InstallChoice::Erase && m_eraseFsTypesChoiceComboBox )
{ {
m_encryptWidget->setFilesystem( m_eraseFsTypesChoiceComboBox->currentText() ); m_encryptWidget->setFilesystem( FileSystem::typeForName( m_eraseFsTypesChoiceComboBox->currentText() ) );
} }
else if ( m_config->installChoice() == InstallChoice::Replace && m_replaceFsTypesChoiceComboBox ) else if ( m_config->installChoice() == InstallChoice::Replace && m_replaceFsTypesChoiceComboBox )
{ {
m_encryptWidget->setFilesystem( m_replaceFsTypesChoiceComboBox->currentText() ); m_encryptWidget->setFilesystem( FileSystem::typeForName( m_replaceFsTypesChoiceComboBox->currentText() ) );
} }
} }

View File

@ -16,7 +16,6 @@
#include "Branding.h" #include "Branding.h"
#include "utils/CalamaresUtilsGui.h" #include "utils/CalamaresUtilsGui.h"
#include "utils/Retranslator.h" #include "utils/Retranslator.h"
#include <kpmcore/fs/filesystem.h>
constexpr int ZFS_MIN_LENGTH = 8; constexpr int ZFS_MIN_LENGTH = 8;
@ -153,13 +152,12 @@ EncryptWidget::updateState( const bool notify )
QString p1 = m_ui->m_passphraseLineEdit->text(); QString p1 = m_ui->m_passphraseLineEdit->text();
QString p2 = m_ui->m_confirmLineEdit->text(); QString p2 = m_ui->m_confirmLineEdit->text();
if ( p1.isEmpty() && p2.isEmpty() ) if ( p1.isEmpty() && p2.isEmpty() )
{ {
applyPixmap( m_ui->m_iconLabel, CalamaresUtils::StatusWarning ); applyPixmap( m_ui->m_iconLabel, CalamaresUtils::StatusWarning );
m_ui->m_iconLabel->setToolTip( tr( "Please enter the same passphrase in both boxes." ) ); m_ui->m_iconLabel->setToolTip( tr( "Please enter the same passphrase in both boxes." ) );
} }
else if ( FileSystem::typeForName( m_filesystem ) == FileSystem::Zfs && p1.length() < ZFS_MIN_LENGTH ) else if ( m_filesystem == FileSystem::Zfs && p1.length() < ZFS_MIN_LENGTH )
{ {
applyPixmap( m_ui->m_iconLabel, CalamaresUtils::StatusError ); applyPixmap( m_ui->m_iconLabel, CalamaresUtils::StatusError );
m_ui->m_iconLabel->setToolTip( tr( "Password must be a minimum of %1 characters" ).arg( ZFS_MIN_LENGTH ) ); m_ui->m_iconLabel->setToolTip( tr( "Password must be a minimum of %1 characters" ).arg( ZFS_MIN_LENGTH ) );
@ -215,7 +213,7 @@ EncryptWidget::onCheckBoxStateChanged( int checked )
} }
void void
EncryptWidget::setFilesystem( const QString& fs ) EncryptWidget::setFilesystem( const FileSystem::Type fs )
{ {
m_filesystem = fs; m_filesystem = fs;
if ( m_state != Encryption::Disabled ) if ( m_state != Encryption::Disabled )

View File

@ -14,6 +14,8 @@
#include <QWidget> #include <QWidget>
#include <kpmcore/fs/filesystem.h>
namespace Ui namespace Ui
{ {
class EncryptWidget; class EncryptWidget;
@ -42,7 +44,7 @@ public:
* @brief setFilesystem sets the filesystem name used for password validation * @brief setFilesystem sets the filesystem name used for password validation
* @param fs A QString containing the name of the filesystem * @param fs A QString containing the name of the filesystem
*/ */
void setFilesystem( const QString& fs ); void setFilesystem( const FileSystem::Type fs );
QString passphrase() const; QString passphrase() const;
@ -59,7 +61,7 @@ private:
Ui::EncryptWidget* m_ui; Ui::EncryptWidget* m_ui;
Encryption m_state; Encryption m_state;
QString m_filesystem; FileSystem::Type m_filesystem;
}; };
#endif // ENCRYPTWIDGET_H #endif // ENCRYPTWIDGET_H