From b7aba4a071ce087ba84dd1ff58bf97081010824a Mon Sep 17 00:00:00 2001 From: Konrad Rosenbaum Date: Mon, 7 Oct 2013 20:36:25 +0200 Subject: [PATCH] allow hints for user names --- src/dialogs/configdialog.cpp | 15 ++++++++++----- src/dialogs/configdialog.h | 2 +- src/dialogs/login.cpp | 1 + 3 files changed, 12 insertions(+), 6 deletions(-) diff --git a/src/dialogs/configdialog.cpp b/src/dialogs/configdialog.cpp index 896bad9..6b03e50 100644 --- a/src/dialogs/configdialog.cpp +++ b/src/dialogs/configdialog.cpp @@ -126,9 +126,12 @@ MConfigDialog::MConfigDialog() gl->addWidget(lab=new QLabel(tr("Hostkey:")),++lctr,0); lab->setAlignment(Qt::AlignRight); gl->addWidget(hostkey=new QLineEdit,lctr,1); - gl->addWidget(lab=new QLabel(tr("Default Username:")),++lctr,0); - lab->setAlignment(Qt::AlignRight); - gl->addWidget(username=new QLineEdit,lctr,1); + gl->addWidget(lab=new QLabel(tr("Default Username:")),++lctr,0); + lab->setAlignment(Qt::AlignRight); + gl->addWidget(username=new QLineEdit,lctr,1); + gl->addWidget(lab=new QLabel(tr("Hint for Username:")),++lctr,0); + lab->setAlignment(Qt::AlignRight); + gl->addWidget(userhint=new QLineEdit,lctr,1); gl->setRowStretch(++lctr,10); gl->addLayout(hl=new QHBoxLayout,++lctr,0,1,2); @@ -239,7 +242,8 @@ void MConfigDialog::loadProfile() proxyport->setEnabled(useproxy->isChecked()); proxyuser->setEnabled(useproxy->isChecked()); proxypass->setEnabled(useproxy->isChecked()); - username->setText(set.value("username").toString()); + username->setText(set.value("username").toString()); + userhint->setText(set.value("usernamehint").toString()); sslexcept=new MSslExceptions(dataDir+"/profile."+key+"/sslexceptions.xml"); sslFillModel(); abiscript->setChecked(set.value("script/allowbuiltin",true).toBool()); @@ -265,7 +269,8 @@ void MConfigDialog::saveProfile() set.setValue("proxyport",proxyport->value()); set.setValue("proxyuser",proxyuser->text()); set.setValue("proxypass",proxypass->text()); - set.setValue("username",username->text()); + set.setValue("username",username->text()); + set.setValue("usernamehint",userhint->text()); QDir(MApplication::dataDir()).mkdir("profile."+key); if(sslexcept)sslexcept->savesslexcept(); set.setValue("script/allowbuiltin",abiscript->isChecked()); diff --git a/src/dialogs/configdialog.h b/src/dialogs/configdialog.h index 43fbb93..6200948 100644 --- a/src/dialogs/configdialog.h +++ b/src/dialogs/configdialog.h @@ -38,7 +38,7 @@ class MConfigDialog:public QDialog private: QCheckBox*useproxy,*abiscript,*ausscript,*asrscript; QLineEdit*hostname,*hostkey,*serverurl,*proxyname,*username, - *proxyuser,*proxypass,*usrscript; + *userhint,*proxyuser,*proxypass,*usrscript; QSpinBox*proxyport,*pbiscript,*pusscript,*psrscript; QListView*profiles; QStandardItemModel*profilemodel,*sslmodel; diff --git a/src/dialogs/login.cpp b/src/dialogs/login.cpp index badc067..528c5ce 100644 --- a/src/dialogs/login.cpp +++ b/src/dialogs/login.cpp @@ -100,6 +100,7 @@ void MLogin::loadProfile() QSettings set; set.beginGroup("profiles/"+key); username->setText(set.value("username").toString()); + username->setPlaceholderText(set.value("usernamehint").toString()); password->setText(""); password->setFocus(); } -- 1.7.2.5