SVN: PLDLiveInstaller/trunk: PLDLiveInstaller.cpp PLDLiveInstaller.h
shadzik
shadzik at pld-linux.org
Mon Dec 6 19:30:32 CET 2010
Author: shadzik
Date: Mon Dec 6 19:30:31 2010
New Revision: 11965
Modified:
PLDLiveInstaller/trunk/PLDLiveInstaller.cpp
PLDLiveInstaller/trunk/PLDLiveInstaller.h
Log:
- add (no)autoLogin feature
- highly experimental right now and not tested yet
- should work though :)
- changed renameConfigFiles() function
Modified: PLDLiveInstaller/trunk/PLDLiveInstaller.cpp
==============================================================================
--- PLDLiveInstaller/trunk/PLDLiveInstaller.cpp (original)
+++ PLDLiveInstaller/trunk/PLDLiveInstaller.cpp Mon Dec 6 19:30:31 2010
@@ -769,6 +769,18 @@
"}");
*/
+ autoLogin = new QRadioButton;
+ autoLogin->setText("Log in automatically");
+ autoLogin->setChecked(false);
+
+ noAutoLogin = new QRadioButton;
+ noAutoLogin->setText("Require my password to log in");
+ noAutoLogin->setChecked(true);
+
+ QLabel *empty = new QLabel;
+ empty->setFixedWidth(200);
+ empty->setFixedHeight(23);
+
QLabel *userCredField = new QLabel(this);
userCredField->setText("<html>"
"Your name:"
@@ -849,6 +861,16 @@
hostnameLayout->addWidget(hostname);
hostnameLayout->addStretch();
+ QHBoxLayout *autologLayout = new QHBoxLayout;
+ autologLayout->addWidget(empty);
+ autologLayout->addWidget(autoLogin);
+ autologLayout->addStretch();
+
+ QHBoxLayout *noautologLayout = new QHBoxLayout;
+ noautologLayout->addWidget(empty);
+ noautologLayout->addWidget(noAutoLogin);
+ autologLayout->addStretch();
+
QVBoxLayout *credLayout = new QVBoxLayout;
credLayout->addLayout(usercredLayout);
credLayout->addLayout(usernameLayout);
@@ -856,6 +878,8 @@
credLayout->addLayout(passwordLayout2);
credLayout->addLayout(pwStrengthLayout);
credLayout->addLayout(hostnameLayout);
+ credLayout->addLayout(autologLayout);
+ credLayout->addLayout(noautologLayout);
QHBoxLayout *midLayout = new QHBoxLayout;
midLayout->addLayout(imageLayout);
@@ -874,6 +898,30 @@
return widget;
}
+void PLDLiveInstaller::substr(QString file, QString string1, QString string2)
+{
+ QFile readFile(file), writeFile(file);
+ QString line;
+ if(!readFile.open(QIODevice::ReadOnly | QIODevice::Text))
+ return;
+
+ QTextStream in(&readFile);
+ while(!in.atEnd())
+ {
+ line += in.readLine();
+ if(line.contains(QRegExp(".*" + string1 + ".*")))
+ line.replace(string1, string2);
+ }
+ readFile.close();
+
+ if(!writeFile.open(QIODevice::WriteOnly | QIODevice::Text))
+ return;
+
+ QTextStream out(&writeFile);
+ out << line;
+ writeFile.close();
+}
+
QWidget * PLDLiveInstaller::installingWidget()
{
pbarVal = 0;
@@ -1126,13 +1174,9 @@
orig.rename(to);
}
-void PLDLiveInstaller::renameConfigFiles()
+void PLDLiveInstaller::renameConfigFiles(QStringList files)
{
qDebug() << "Renaming files";
- QStringList files;
- files << DESTINATION"etc/pld-release.dest" << DESTINATION"etc/X11/kdm/kdmrc.dest" << DESTINATION"etc/fstab.dest"
- << DESTINATION"etc/sysconfig/network.dest" << DESTINATION"etc/issue.dest"
- << DESTINATION"etc/rc.d/rc.local.dest" << DESTINATION"etc/sudoers.dest";
foreach (QString file, files)
{
QString oldfile = file;
@@ -1583,7 +1627,19 @@
}
if(cont)
- renameConfigFiles();
+ {
+ QStringList files;
+ files << DESTINATION"etc/pld-release.dest" << DESTINATION"etc/fstab.dest"
+ << DESTINATION"etc/sysconfig/network.dest" << DESTINATION"etc/issue.dest"
+ << DESTINATION"etc/rc.d/rc.local.dest" << DESTINATION"etc/sudoers.dest";
+ if(noAutoLogin->isChecked())
+ files.append(DESTINATION"etc/X11/kdm/kdmrc.dest");
+ else if(autoLogin->isChecked())
+ substr(DESTINATION"etc/X11/kdm/kdmrc", LIVEUSER, selUser);
+ renameConfigFiles(files);
+ files.clear();
+ }
+
if(cont && !createFstabEntries())
{
cont = false;
Modified: PLDLiveInstaller/trunk/PLDLiveInstaller.h
==============================================================================
--- PLDLiveInstaller/trunk/PLDLiveInstaller.h (original)
+++ PLDLiveInstaller/trunk/PLDLiveInstaller.h Mon Dec 6 19:30:31 2010
@@ -5,6 +5,7 @@
#include <QLineEdit>
#include <QListWidgetItem>
#include <QProgressBar>
+#include <QRadioButton>
#include <KComboBox>
#include <KAssistantDialog>
#include <KDialog>
@@ -50,6 +51,7 @@
QLabel *memInfo2, *memInfoIcon2, *devSizeInfo, *devSizeInfoIcon, *samePartTwice, *samePartTwiceIcon;
QStringList availablePartitions, fsTypes, formatOpts;
KComboBox * rootPart,* swapPart, * fs;
+ QRadioButton *autoLogin, *noAutoLogin;
int rootPartPos, swapPartPos, pbarVal;
bool selHDDisRem, isPartBigEnough, isRamEnough, installBootLoader, pwMatch, userSet, doFormat;
QLabel *defimage, *image, *image2, *partImage, *partImage2, *partDescr;
@@ -62,11 +64,12 @@
void updateProgressBar();
char * genPasswd();
bool makeGrubConfig(), installGrub(), geninitrd(), mountProcSysDev(), umountProcSysDev();
- void move2dest(QString from, QString to), renameConfigFiles(), delUtmpx();
+ void move2dest(QString from, QString to), renameConfigFiles(QStringList files), delUtmpx();
bool createHostname(), createFstabEntries(), createUser(), copySettings(QString file), deleteLiveUser();
int getMemoryAmount();
int effectivePasswordLength(const QString& password);
void removeJunk(QString filedir, QString argstorm);
+ void substr(QString file, QString string1, QString string2);
public:
PLDLiveInstaller( QWidget * parent = 0 );
@@ -88,7 +91,6 @@
void checkPwStrength();
void checkPwMatch();
void startPM();
-
};
#endif // PLDLiveInstaller_H
More information about the pld-cvs-commit
mailing list