Skip to content
This repository has been archived by the owner on Dec 4, 2020. It is now read-only.

Commit

Permalink
Fix some bugs setting the keyboard layout during installation
Browse files Browse the repository at this point in the history
When a new layout is set, save it for the desktop usage during the next
boot, I.E the first-boot wizard
  • Loading branch information
Kris Moore committed Dec 3, 2013
1 parent c2eb399 commit 618401b
Show file tree
Hide file tree
Showing 4 changed files with 30 additions and 1 deletion.
5 changes: 4 additions & 1 deletion src-qt4/pc-installgui/dialogKeyboard.cpp
Expand Up @@ -67,10 +67,12 @@ void widgetKeyboard::slotUpdateKbOnSys()
{
QString model, layout, variant;

if ( ! (comboBoxKeyboardModel->currentIndex() == -1) )
if ( comboBoxKeyboardModel->currentIndex() == -1 )
return;

if ( ! listKbLayouts->currentItem() )
return;

if ( ! listKbVariants->currentItem() )
return;

Expand All @@ -91,6 +93,7 @@ void widgetKeyboard::slotUpdateKbOnSys()
}

Scripts::Backend::changeKbMap(model, layout, variant);
emit saved(model, layout, variant);
}

void widgetKeyboard::slotCurrentKbVariantChanged(int row)
Expand Down
1 change: 1 addition & 0 deletions src-qt4/pc-installgui/dialogKeyboard.h
Expand Up @@ -39,6 +39,7 @@ private slots:
QStringList keyboardLayouts;

signals:
void saved(QString, QString, QString);

} ;
#endif // DIALOGKEY_H
20 changes: 20 additions & 0 deletions src-qt4/pc-installgui/installer.cpp
Expand Up @@ -93,10 +93,19 @@ void Installer::slotPushKeyLayout()
wKey = new widgetKeyboard();
wKey->programInit(keyModels, keyLayouts);
wKey->setWindowModality(Qt::ApplicationModal);
connect(wKey, SIGNAL(saved(QString, QString, QString)), this, SLOT(slotSaveKeyLayout(QString, QString, QString)));
wKey->show();
wKey->raise();
}

void Installer::slotSaveKeyLayout(QString model, QString layout, QString variant)
{
curKeyModel = model;
curKeyLayout = layout;
curKeyVariant = variant;
qDebug() << "Changed keyboard layout:" << curKeyModel << curKeyLayout << curKeyVariant;
}

void Installer::initInstall()
{
// load languages
Expand Down Expand Up @@ -796,10 +805,16 @@ void Installer::slotChangeLanguage()

// Change the default keyboard layout
if ( langCode == "en" ) {
curKeyModel="pc104";
curKeyLayout="us";
curKeyVariant="";
Scripts::Backend::changeKbMap("pc104", "us", "");
} else {
// TODO - At some point, add additional tests here and set more specific layouts
// based upon the language selected
curKeyModel="pc105";
curKeyLayout=langCode;
curKeyVariant="";
Scripts::Backend::changeKbMap("pc105", langCode, "" );
}

Expand Down Expand Up @@ -1016,6 +1031,11 @@ void Installer::startConfigGen()
cfgList << "runCommand=echo " + lang + " >/var/.wizardlang";
}

// If the user changed the keyboard layout, save it for first boot
if ( ! curKeyModel.isEmpty() ) {
cfgList << "runCommand=echo \"" + curKeyModel + " " + curKeyLayout + " " + curKeyVariant + "\" >/var/.wizardKeyboard";
}

} else {
// Doing TrueOS Install
cfgList+=getUsersCfgSettings();
Expand Down
5 changes: 5 additions & 0 deletions src-qt4/pc-installgui/installer.h
Expand Up @@ -75,6 +75,8 @@ private slots:
// Restore-related slots
void slotSaveRestoreSettings(QStringList);

// Slot to save keyboard layout
void slotSaveKeyLayout(QString, QString, QString);

private:

Expand Down Expand Up @@ -176,6 +178,9 @@ private slots:
widgetKeyboard *wKey;
QStringList keyModels;
QStringList keyLayouts;
QString curKeyLayout;
QString curKeyModel;
QString curKeyVariant;

// Disk setup wizard
wizardDisk *wDisk;
Expand Down

0 comments on commit 618401b

Please sign in to comment.