[PC-BSD Commits] r15337 - users/kris/pc-firstbootgui
svn at pcbsd.org
svn at pcbsd.org
Tue Feb 14 12:24:13 PST 2012
Author: kris
Date: 2012-02-14 20:24:13 +0000 (Tue, 14 Feb 2012)
New Revision: 15337
Modified:
users/kris/pc-firstbootgui/dialogKeyboard.cpp
users/kris/pc-firstbootgui/dialogKeyboard.h
users/kris/pc-firstbootgui/firstboot.cpp
users/kris/pc-firstbootgui/firstboot.h
users/kris/pc-firstbootgui/firstboot.ui
users/kris/pc-firstbootgui/pc-firstboot.pro
Log:
Add functionality to setup root password and user account in wizard
Modified: users/kris/pc-firstbootgui/dialogKeyboard.cpp
===================================================================
--- users/kris/pc-firstbootgui/dialogKeyboard.cpp 2012-02-14 18:18:22 UTC (rev 15336)
+++ users/kris/pc-firstbootgui/dialogKeyboard.cpp 2012-02-14 20:24:13 UTC (rev 15337)
@@ -91,6 +91,7 @@
}
Scripts::Backend::changeKbMap(model, layout, variant);
+ emit changedLayout(model, layout, variant);
}
void widgetKeyboard::slotCurrentKbVariantChanged(int row)
Modified: users/kris/pc-firstbootgui/dialogKeyboard.h
===================================================================
--- users/kris/pc-firstbootgui/dialogKeyboard.h 2012-02-14 18:18:22 UTC (rev 15336)
+++ users/kris/pc-firstbootgui/dialogKeyboard.h 2012-02-14 20:24:13 UTC (rev 15337)
@@ -39,6 +39,7 @@
QStringList keyboardLayouts;
signals:
+ void changedLayout(QString, QString, QString);
} ;
#endif // DIALOGKEY_H
Modified: users/kris/pc-firstbootgui/firstboot.cpp
===================================================================
--- users/kris/pc-firstbootgui/firstboot.cpp 2012-02-14 18:18:22 UTC (rev 15336)
+++ users/kris/pc-firstbootgui/firstboot.cpp 2012-02-14 20:24:13 UTC (rev 15337)
@@ -1,6 +1,7 @@
#include <QProcess>
#include <QTimer>
#include <QGraphicsPixmapItem>
+#include <QTemporaryFile>
#include <pcbsd-netif.h>
#include <pcbsd-utils.h>
@@ -76,6 +77,7 @@
wKey = new widgetKeyboard();
wKey->programInit(keyModels, keyLayouts);
wKey->setWindowModality(Qt::ApplicationModal);
+ connect(wKey, SIGNAL(changedLayout(QString, QString, QString)), this, SLOT(slotKeyLayoutUpdated(QString, QString, QString)));
wKey->show();
wKey->raise();
}
@@ -340,9 +342,42 @@
void Installer::saveSettings()
{
- if ( comboLanguage->currentIndex() != 0 )
- {
+ // Check if we need to change the language
+ if ( comboLanguage->currentIndex() != 0 ) {
+ QString lang = languages.at(comboLanguage->currentIndex());
+ // Grab the language code
+ lang.truncate(lang.lastIndexOf(")"));
+ lang.remove(0, lang.lastIndexOf("(") + 1);
+ qDebug() << "Set Lang:" << lang;
+ system("/usr/local/share/pcbsd/scripts/set-lang.sh " + lang.toLatin1());
+ }
+ // Set the root PW
+ QTemporaryFile rfile("/tmp/.XXXXXXXX");
+ if ( rfile.open() ) {
+ QTextStream stream( &rfile );
+ stream << lineRootPW->text();
+ rfile.close();
}
+ system("cat " + rfile.fileName().toLatin1() + " | pw usermod root -h 0 ");
+ rfile.remove();
+ // Create the new username
+ QTemporaryFile ufile("/tmp/.XXXXXXXX");
+ if ( ufile.open() ) {
+ QTextStream stream( &ufile );
+ stream << linePW->text();
+ ufile.close();
+ }
+ QString userCmd = " | pw useradd -n \"" + lineUsername->text() + "\" -c \"" + lineName->text() + "\" -h 0 -s \"/bin/csh\" -m -d \"/home/" + lineUsername->text() + "\" -G \"wheel,operator\"";
+ system("cat " + ufile.fileName().toLatin1() + userCmd.toLatin1());
+ ufile.remove();
+
}
+
+void Installer::slotKeyLayoutUpdated(QString mod, QString lay, QString var)
+{
+ kbMod = mod;
+ kbLay = lay;
+ kbVar = var;
+}
Modified: users/kris/pc-firstbootgui/firstboot.h
===================================================================
--- users/kris/pc-firstbootgui/firstboot.h 2012-02-14 18:18:22 UTC (rev 15336)
+++ users/kris/pc-firstbootgui/firstboot.h 2012-02-14 20:24:13 UTC (rev 15337)
@@ -36,6 +36,7 @@
// Keyboard selector
void slotPushKeyLayout();
+ void slotKeyLayoutUpdated(QString mod, QString lay, QString var);
// Root PW validator
void slotCheckRootPW();
@@ -77,6 +78,9 @@
widgetKeyboard *wKey;
QStringList keyModels;
QStringList keyLayouts;
+ QString kbMod;
+ QString kbLay;
+ QString kbVar;
};
Modified: users/kris/pc-firstbootgui/firstboot.ui
===================================================================
(Binary files differ)
Modified: users/kris/pc-firstbootgui/pc-firstboot.pro
===================================================================
--- users/kris/pc-firstbootgui/pc-firstboot.pro 2012-02-14 18:18:22 UTC (rev 15336)
+++ users/kris/pc-firstbootgui/pc-firstboot.pro 2012-02-14 20:24:13 UTC (rev 15337)
@@ -4,7 +4,7 @@
TARGET = pc-firstboot
DESTDIR=/usr/local/bin
LIBS += -lpcbsd
-INCLUDEPATH+= ../../pcbsd/current/src-qt4/libpcbsd/
+INCLUDEPATH+= ../../../pcbsd/current/src-qt4/libpcbsd/
TEMPLATE = app
SOURCES += main.cpp \
dialogInfoBox.cpp \
More information about the Commits
mailing list