mirror of
https://github.com/tnodir/fort
synced 2024-11-15 03:56:18 +00:00
UI: Options: Fix password checking.
This commit is contained in:
parent
67a779e1ed
commit
4000db08b8
@ -65,6 +65,11 @@ OptionsPage::OptionsPage(OptionsController *ctrl, QWidget *parent) : OptBasePage
|
||||
setupUi();
|
||||
}
|
||||
|
||||
void OptionsPage::setPasswordEdited(bool v)
|
||||
{
|
||||
m_passwordEdited = v;
|
||||
}
|
||||
|
||||
void OptionsPage::onAboutToSave()
|
||||
{
|
||||
// Startup
|
||||
@ -72,8 +77,12 @@ void OptionsPage::onAboutToSave()
|
||||
saveService(m_cbService->isChecked());
|
||||
|
||||
// Password
|
||||
if (!settings()->hasPassword() && ini()->hasPassword() && ini()->password().isEmpty()) {
|
||||
m_cbPassword->setChecked(false);
|
||||
if (passwordEdited()) {
|
||||
if (!settings()->hasPassword() && ini()->hasPassword() && ini()->password().isEmpty()) {
|
||||
m_cbPassword->setChecked(false);
|
||||
}
|
||||
} else if (conf()->iniEdited()) {
|
||||
ini()->setHasPassword(settings()->hasPassword());
|
||||
}
|
||||
}
|
||||
|
||||
@ -125,6 +134,7 @@ void OptionsPage::saveService(bool isService)
|
||||
|
||||
void OptionsPage::onEditResetted()
|
||||
{
|
||||
setPasswordEdited(false);
|
||||
retranslateEditPassword();
|
||||
}
|
||||
|
||||
@ -385,13 +395,14 @@ QLayout *OptionsPage::setupPasswordLayout()
|
||||
auto layout = new QHBoxLayout();
|
||||
layout->setSpacing(6);
|
||||
|
||||
m_cbPassword = ControlUtil::createCheckBox(ini()->hasPassword(), [&](bool checked) {
|
||||
m_cbPassword = ControlUtil::createCheckBox(settings()->hasPassword(), [&](bool checked) {
|
||||
if (checked) {
|
||||
m_editPassword->setFocus();
|
||||
} else {
|
||||
m_editPassword->clear();
|
||||
}
|
||||
|
||||
setPasswordEdited(true);
|
||||
ini()->setHasPassword(checked);
|
||||
ctrl()->setIniEdited();
|
||||
});
|
||||
|
@ -10,6 +10,9 @@ class OptionsPage : public OptBasePage
|
||||
public:
|
||||
explicit OptionsPage(OptionsController *ctrl = nullptr, QWidget *parent = nullptr);
|
||||
|
||||
bool passwordEdited() const { return m_passwordEdited; }
|
||||
void setPasswordEdited(bool v);
|
||||
|
||||
protected slots:
|
||||
void onAboutToSave() override;
|
||||
void onEditResetted() override;
|
||||
@ -45,6 +48,8 @@ private:
|
||||
void setupNewVersionUpdate();
|
||||
|
||||
private:
|
||||
bool m_passwordEdited = false;
|
||||
|
||||
qint8 m_currentAutoRunMode = 0;
|
||||
|
||||
QGroupBox *m_gbStartup = nullptr;
|
||||
|
Loading…
Reference in New Issue
Block a user