keyboard: Write the keyboard model and layout settings to the root mount point.

This is implemented as a new SetKeyboardLayout job that does the work.

Portions of the code are adapted from systemd-localed's source code,
which is under a compatible license (LGPLv2.1+, can be converted to our
GPLv3+ license). I ported it from C to to C++/Qt and made some minor
tweaks to the mapping logic (from X11 to vconsole layouts) though.

Fixes #31.

Tested on a Fedora Remix (Kannolo 21) with the default module settings
(finds the converted X11 keymaps for the virtual console) and with
convertedKeymapPath: "" (does the legacy keymap conversion as expected).
This commit is contained in:
Kevin Kofler 2014-11-11 02:58:14 +01:00
parent 54feddb330
commit 4f9f7d7858
10 changed files with 441 additions and 1 deletions

View file

@ -18,6 +18,9 @@
#include "KeyboardViewStep.h"
#include "JobQueue.h"
#include "GlobalStorage.h"
#include "KeyboardPage.h"
@ -97,7 +100,7 @@ KeyboardViewStep::isAtEnd() const
QList< Calamares::job_ptr >
KeyboardViewStep::jobs() const
{
return QList< Calamares::job_ptr >();
return m_jobs;
}
@ -105,5 +108,38 @@ void
KeyboardViewStep::onLeave()
{
m_widget->finalize();
m_jobs = m_widget->createJobs();
m_prettyStatus = m_widget->prettyStatus();
}
void
KeyboardViewStep::setConfigurationMap( const QVariantMap& configurationMap )
{
// Save the settings to the global settings for the SetKeyboardLayoutJob to use
Calamares::GlobalStorage* gs = Calamares::JobQueue::instance()->globalStorage();
if ( configurationMap.contains( "xOrgConfFileName" ) &&
configurationMap.value( "xOrgConfFileName" ).type() == QVariant::String &&
!configurationMap.value( "xOrgConfFileName" ).toString().isEmpty() )
{
gs->insert( "keyboardXOrgConfFileName",
configurationMap.value( "xOrgConfFileName" ) );
}
else
{
gs->insert( "keyboardXOrgConfFileName", "00-keyboard.conf" );
}
if ( configurationMap.contains( "convertedKeymapPath" ) &&
configurationMap.value( "convertedKeymapPath" ).type() == QVariant::String &&
!configurationMap.value( "convertedKeymapPath" ).toString().isEmpty() )
{
gs->insert( "keyboardConvertedKeymapPath",
configurationMap.value( "convertedKeymapPath" ) );
}
else
{
gs->remove( "keyboardConvertedKeymapPath" );
}
}