Skip to content
This repository

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse code

When running the first-boot wizard, prime PCDM with the users

language / keyboard settings for initial login
  • Loading branch information...
commit dcfefbbeefd2ac468eea55a65bcfe816d7e5f2a0 1 parent 623b6e6
Kris Moore kmoore134 authored
2  src-qt4/pc-firstbootgui/dialogKeyboard.cpp
@@ -67,7 +67,7 @@ void widgetKeyboard::slotUpdateKbOnSys()
67 67 {
68 68 QString model, layout, variant;
69 69
70   - if ( ! (comboBoxKeyboardModel->currentIndex() == -1) )
  70 + if ( comboBoxKeyboardModel->currentIndex() == -1 )
71 71 return;
72 72 if ( ! listKbLayouts->currentItem() )
73 73 return;
52 src-qt4/pc-firstbootgui/firstboot.cpp
@@ -46,6 +46,21 @@ Installer::Installer(QWidget *parent) : QMainWindow(parent)
46 46 keyModels = Scripts::Backend::keyModels();
47 47 keyLayouts = Scripts::Backend::keyLayouts();
48 48
  49 + // If we have a saved keyboard layout from installation, use it first
  50 + QString kD;
  51 + if ( QFile::exists("/var/.wizardKeyboard") ) {
  52 + QFile kFile("/var/.wizardKeyboard");
  53 + if ( kFile.open(QIODevice::ReadOnly | QIODevice::Text) ) {
  54 + kD = kFile.readLine().simplified();
  55 + kFile.close();
  56 +
  57 + kbMod = kD.section(" ", 0, 0);
  58 + kbLay = kD.section(" ", 1, 1);
  59 + kbVar = kD.section(" ", 2, 2);
  60 + Scripts::Backend::changeKbMap(kbMod, kbLay, kbVar);
  61 + }
  62 + }
  63 +
49 64 // Load the timezones
50 65 comboBoxTimezone->clear();
51 66 QString curZone = Scripts::Backend::guessTimezone();
@@ -506,6 +521,43 @@ void Installer::saveSettings()
506 521 sethostname(lineHostname->text().toLatin1(), lineHostname->text().length());
507 522 }
508 523
  524 +
  525 + // Save the PCDM default lang / inputs
  526 + QString curLang;
  527 + if ( comboLanguage->currentIndex() != -1 ) {
  528 + // Figure out the language code
  529 + curLang = languages.at(comboLanguage->currentIndex());
  530 +
  531 + // Grab the language code
  532 + curLang.truncate(curLang.lastIndexOf(")"));
  533 + curLang.remove(0, curLang.lastIndexOf("(") + 1);
  534 + }
  535 +
  536 + system("mkdir -p /var/db/pcdm 2>/dev/null");
  537 + QFile pcdmfile("/var/db/pcdm/defaultInputs");
  538 + if (pcdmfile.open(QIODevice::WriteOnly | QIODevice::Text)) {
  539 + QTextStream out(&pcdmfile);
  540 + out << "Lang=" << curLang << "\n";
  541 +
  542 + if ( kbMod.isEmpty() )
  543 + out << "KeyModel=pc104\n";
  544 + else
  545 + out << "KeyModel=" << kbMod << "\n";
  546 +
  547 + if ( kbLay.isEmpty() )
  548 + out << "KeyLayout=us\n";
  549 + else
  550 + out << "KeyLayout=" << kbLay << "\n";
  551 +
  552 + if ( kbVar.isEmpty() )
  553 + out << "KeyVariant=";
  554 + else
  555 + out << "KeyVariant=" << kbVar;
  556 +
  557 + pcdmfile.close();
  558 + } else {
  559 + qDebug() << "Error opening /var/db/pcdm/defaultInputs";
  560 + }
509 561 }
510 562
511 563 void Installer::slotKeyLayoutUpdated(QString mod, QString lay, QString var)

0 comments on commit dcfefbb

Please sign in to comment.
Something went wrong with that request. Please try again.