Store keyboard layout information in GlobalStorage.

This commit is contained in:
Teo Mrnjavac 2014-08-01 12:38:27 +02:00
parent 7680578b61
commit cc2e49c6ae
3 changed files with 26 additions and 0 deletions

View File

@ -25,6 +25,9 @@
#include "ui_KeyboardPage.h"
#include "keyboardwidget/keyboardpreview.h"
#include "GlobalStorage.h"
#include "JobQueue.h"
#include <QComboBox>
#include <QProcess>
#include <QPushButton>
@ -184,6 +187,20 @@ KeyboardPage::prettyStatus() const
}
void
KeyboardPage::finalize()
{
Calamares::GlobalStorage* gs = Calamares::JobQueue::instance()->globalStorage();
if ( !m_selectedLayout.isEmpty() )
{
gs->insert( "keyboardLayout", m_selectedLayout );
gs->insert( "keyboardVariant", m_selectedVariant ); //empty means default variant
}
//FIXME: also store keyboard model for something?
}
void
KeyboardPage::onListLayoutCurrentItemChanged( QListWidgetItem* current, QListWidgetItem* previous )
{
@ -242,5 +259,8 @@ KeyboardPage::onListVariantCurrentItemChanged( QListWidgetItem* current, QListWi
// Set Xorg keyboard layout
QProcess::execute( QString( "setxkbmap -layout \"%1\" -variant \"%2\"" )
.arg( layout, variant ).toUtf8() );
m_selectedLayout = layout;
m_selectedVariant = variant;
}

View File

@ -46,6 +46,8 @@ public:
QString prettyStatus() const;
void finalize();
protected slots:
void onListLayoutCurrentItemChanged( QListWidgetItem* current,
QListWidgetItem* previous );
@ -63,6 +65,9 @@ private:
KeyBoardPreview* m_keyboardPreview;
int m_defaultIndex;
QMap< QString, QString > m_models;
QString m_selectedLayout;
QString m_selectedVariant;
};
#endif // KEYBOARDPAGE_H

View File

@ -104,5 +104,6 @@ KeyboardViewStep::jobs() const
void
KeyboardViewStep::onLeave()
{
m_widget->finalize();
m_prettyStatus = m_widget->prettyStatus();
}