Make writeEtcDefaultKeyboard an option in keyboard.conf.

This commit is contained in:
Teo Mrnjavac 2016-09-26 10:57:23 +02:00 committed by Philip
parent a37896da49
commit 36a96fedfb
7 changed files with 33 additions and 7 deletions

View File

@ -202,7 +202,8 @@ KeyboardPage::prettyStatus() const
QList< Calamares::job_ptr >
KeyboardPage::createJobs( const QString& xOrgConfFileName,
const QString& convertedKeymapPath )
const QString& convertedKeymapPath,
bool writeEtcDefaultKeyboard )
{
QList< Calamares::job_ptr > list;
QString selectedModel = m_models.value( ui->comboBoxModel->currentText(),
@ -212,7 +213,8 @@ KeyboardPage::createJobs( const QString& xOrgConfFileName,
m_selectedLayout,
m_selectedVariant,
xOrgConfFileName,
convertedKeymapPath );
convertedKeymapPath,
writeEtcDefaultKeyboard );
list.append( Calamares::job_ptr( j ) );
return list;

View File

@ -50,7 +50,8 @@ public:
QString prettyStatus() const;
QList< Calamares::job_ptr > createJobs( const QString& xOrgConfFileName,
const QString& convertedKeymapPath );
const QString& convertedKeymapPath,
bool writeEtcDefaultKeyboard );
void onActivate();
void finalize();

View File

@ -123,7 +123,9 @@ void
KeyboardViewStep::onLeave()
{
m_widget->finalize();
m_jobs = m_widget->createJobs( m_xOrgConfFileName, m_convertedKeymapPath );
m_jobs = m_widget->createJobs( m_xOrgConfFileName,
m_convertedKeymapPath,
m_writeEtcDefaultKeyboard );
m_prettyStatus = m_widget->prettyStatus();
}
@ -157,4 +159,14 @@ KeyboardViewStep::setConfigurationMap( const QVariantMap& configurationMap )
{
m_convertedKeymapPath = QString();
}
if ( configurationMap.contains( "writeEtcDefaultKeyboard" ) &&
configurationMap.value( "writeEtcDefaultKeyboard" ).type() == QVariant::Bool )
{
m_writeEtcDefaultKeyboard = configurationMap.value( "writeEtcDefaultKeyboard" ).toBool();
}
else
{
m_writeEtcDefaultKeyboard = true;
}
}

View File

@ -64,6 +64,7 @@ private:
QString m_xOrgConfFileName;
QString m_convertedKeymapPath;
bool m_writeEtcDefaultKeyboard;
QList< Calamares::job_ptr > m_jobs;
};

View File

@ -40,13 +40,15 @@ SetKeyboardLayoutJob::SetKeyboardLayoutJob( const QString& model,
const QString& layout,
const QString& variant,
const QString& xOrgConfFileName,
const QString& convertedKeymapPath )
const QString& convertedKeymapPath,
bool writeEtcDefaultKeyboard)
: Calamares::Job()
, m_model( model )
, m_layout( layout )
, m_variant( variant )
, m_xOrgConfFileName( xOrgConfFileName )
, m_convertedKeymapPath( convertedKeymapPath )
, m_writeEtcDefaultKeyboard( writeEtcDefaultKeyboard )
{
}
@ -322,7 +324,7 @@ SetKeyboardLayoutJob::exec()
return Calamares::JobResult::error( tr( "Failed to write keyboard configuration for X11." ),
tr( "Failed to write to %1" ).arg( keyboardConfPath ) );
if ( !defaultKeyboardPath.isEmpty() )
if ( !defaultKeyboardPath.isEmpty() && m_writeEtcDefaultKeyboard )
{
if ( !writeDefaultKeyboardData( defaultKeyboardPath ) )
return Calamares::JobResult::error( tr( "Failed to write keyboard configuration to existing /etc/default directory." ),

View File

@ -31,7 +31,8 @@ public:
const QString& layout,
const QString& variant,
const QString& xOrgConfFileName,
const QString& convertedKeymapPath );
const QString& convertedKeymapPath,
bool writeEtcDefaultKeyboard );
QString prettyName() const override;
Calamares::JobResult exec() override;
@ -49,6 +50,7 @@ private:
QString m_variant;
QString m_xOrgConfFileName;
QString m_convertedKeymapPath;
const bool m_writeEtcDefaultKeyboard;
};
#endif /* SETKEYBOARDLAYOUTJOB_H */

View File

@ -3,6 +3,12 @@
# The default value is the name used by upstream systemd-localed.
# Relative paths are assumed to be relative to /etc/X11/xorg.conf.d
xOrgConfFileName: "/etc/X11/xorg.conf.d/00-keyboard.conf"
# The path to search for keymaps converted from X11 to kbd format
# Leave this empty if the setting does not make sense on your distribution.
convertedKeymapPath: "/lib/kbd/keymaps/xkb"
# Write keymap configuration to /etc/default/keyboard, usually
# found on Debian-related systems.
# Defaults to true if nothing is set.
#writeEtcDefaultKeyboard: true