remember username during guest login

This commit is contained in:
doitux
2010-09-07 12:52:30 +00:00
parent 11211332f9
commit 038bfdd2a2
2 changed files with 96 additions and 86 deletions
+2 -1
View File
@@ -50,7 +50,7 @@ ConfigFile::ConfigFile(char *argv0, bool readonly) : noWriteAccess(readonly)
myConfigState = OK;
// !!!! Revisionsnummer der Configdefaults !!!!!
configRev = 86;
configRev = 87;
//standard defaults
logOnOffDefault = "1";
@@ -237,6 +237,7 @@ ConfigFile::ConfigFile(char *argv0, bool readonly) : noWriteAccess(readonly)
configList.push_back(ConfigInfo("ChatCleanerUseIpv6", CONFIG_TYPE_INT, "0"));
configList.push_back(ConfigInfo("MyName", CONFIG_TYPE_STRING, "Human Player"));
configList.push_back(ConfigInfo("MyAvatar", CONFIG_TYPE_STRING, ""));
configList.push_back(ConfigInfo("MyRememberedNameDuringGuestLogin", CONFIG_TYPE_STRING, ""));
configList.push_back(ConfigInfo("Opponent1Name", CONFIG_TYPE_STRING, "Player 1"));
configList.push_back(ConfigInfo("Opponent1Avatar", CONFIG_TYPE_STRING, ""));
configList.push_back(ConfigInfo("Opponent2Name", CONFIG_TYPE_STRING, "Player 2"));
@@ -18,7 +18,12 @@ void internetGameLoginDialogImpl::regUserToggled(bool b) {
checkBox_guest->setChecked(!b);
if(b) {
if(QString::fromUtf8(myConfig->readConfigString("MyRememberedNameDuringGuestLogin").c_str()).isEmpty()) {
lineEdit_username->setText(QString::fromUtf8(myConfig->readConfigString("MyName").c_str()));
}
else {
lineEdit_username->setText(QString::fromUtf8(myConfig->readConfigString("MyRememberedNameDuringGuestLogin").c_str()));
}
if(myConfig->readConfigInt("InternetSavePassword")) {
checkBox_rememberPassword->setChecked(true);
lineEdit_password->setText(QString::fromUtf8(QByteArray::fromBase64(myConfig->readConfigString("InternetLoginPassword").c_str())));
@@ -37,9 +42,12 @@ void internetGameLoginDialogImpl::guestUserToggled(bool b) {
groupBox_reguser->setChecked(!b);
if(b) {
myConfig->writeConfigString("MyRememberedNameDuringGuestLogin", lineEdit_username->text().toUtf8().constData());
checkBox_rememberPassword->setChecked(false);
lineEdit_password->clear();
lineEdit_username->clear();
myConfig->writeBuffer();
}
okButtonCheck();
@@ -84,6 +92,7 @@ void internetGameLoginDialogImpl::accept() {
else {
myConfig->writeConfigInt("InternetSavePassword", 0);
}
}
else if(checkBox_guest->isChecked()) {
myConfig->writeConfigInt("InternetLoginMode", 1);