mirror of
https://github.com/keepassxreboot/keepassxc.git
synced 2025-07-26 00:05:34 -04:00
Merge pull request #538 from keepassxreboot/feature/extendedAscii
Add support for extended ASCII in password generator
This commit is contained in:
commit
7040bef27e
4 changed files with 74 additions and 6 deletions
|
@ -195,6 +195,24 @@ QVector<PasswordGroup> PasswordGenerator::passwordGroups() const
|
||||||
|
|
||||||
passwordGroups.append(group);
|
passwordGroups.append(group);
|
||||||
}
|
}
|
||||||
|
if (m_classes & EASCII) {
|
||||||
|
PasswordGroup group;
|
||||||
|
|
||||||
|
// [U+0080, U+009F] are C1 control characters,
|
||||||
|
// U+00A0 is non-breaking space
|
||||||
|
for (int i = 161; i <= 172; i++) {
|
||||||
|
group.append(i);
|
||||||
|
}
|
||||||
|
// U+00AD is soft hyphen (format character)
|
||||||
|
for (int i = 174; i <= 255; i++) {
|
||||||
|
if ((m_flags & ExcludeLookAlike) && (i == 249)) { // "﹒"
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
group.append(i);
|
||||||
|
}
|
||||||
|
|
||||||
|
passwordGroups.append(group);
|
||||||
|
}
|
||||||
|
|
||||||
return passwordGroups;
|
return passwordGroups;
|
||||||
}
|
}
|
||||||
|
@ -215,6 +233,9 @@ int PasswordGenerator::numCharClasses() const
|
||||||
if (m_classes & SpecialCharacters) {
|
if (m_classes & SpecialCharacters) {
|
||||||
numClasses++;
|
numClasses++;
|
||||||
}
|
}
|
||||||
|
if (m_classes & EASCII) {
|
||||||
|
numClasses++;
|
||||||
|
}
|
||||||
|
|
||||||
return numClasses;
|
return numClasses;
|
||||||
}
|
}
|
||||||
|
|
|
@ -32,7 +32,8 @@ public:
|
||||||
LowerLetters = 0x1,
|
LowerLetters = 0x1,
|
||||||
UpperLetters = 0x2,
|
UpperLetters = 0x2,
|
||||||
Numbers = 0x4,
|
Numbers = 0x4,
|
||||||
SpecialCharacters = 0x8
|
SpecialCharacters = 0x8,
|
||||||
|
EASCII = 0x10
|
||||||
};
|
};
|
||||||
Q_DECLARE_FLAGS(CharClasses, CharClass)
|
Q_DECLARE_FLAGS(CharClasses, CharClass)
|
||||||
|
|
||||||
|
|
|
@ -92,6 +92,7 @@ void PasswordGeneratorWidget::loadSettings()
|
||||||
m_ui->checkBoxUpper->setChecked(config()->get("generator/UpperCase", true).toBool());
|
m_ui->checkBoxUpper->setChecked(config()->get("generator/UpperCase", true).toBool());
|
||||||
m_ui->checkBoxNumbers->setChecked(config()->get("generator/Numbers", true).toBool());
|
m_ui->checkBoxNumbers->setChecked(config()->get("generator/Numbers", true).toBool());
|
||||||
m_ui->checkBoxSpecialChars->setChecked(config()->get("generator/SpecialChars", false).toBool());
|
m_ui->checkBoxSpecialChars->setChecked(config()->get("generator/SpecialChars", false).toBool());
|
||||||
|
m_ui->checkBoxExtASCII->setChecked(config()->get("generator/EASCII", false).toBool());
|
||||||
m_ui->checkBoxExcludeAlike->setChecked(config()->get("generator/ExcludeAlike", true).toBool());
|
m_ui->checkBoxExcludeAlike->setChecked(config()->get("generator/ExcludeAlike", true).toBool());
|
||||||
m_ui->checkBoxEnsureEvery->setChecked(config()->get("generator/EnsureEvery", true).toBool());
|
m_ui->checkBoxEnsureEvery->setChecked(config()->get("generator/EnsureEvery", true).toBool());
|
||||||
m_ui->spinBoxLength->setValue(config()->get("generator/Length", 16).toInt());
|
m_ui->spinBoxLength->setValue(config()->get("generator/Length", 16).toInt());
|
||||||
|
@ -112,6 +113,7 @@ void PasswordGeneratorWidget::saveSettings()
|
||||||
config()->set("generator/UpperCase", m_ui->checkBoxUpper->isChecked());
|
config()->set("generator/UpperCase", m_ui->checkBoxUpper->isChecked());
|
||||||
config()->set("generator/Numbers", m_ui->checkBoxNumbers->isChecked());
|
config()->set("generator/Numbers", m_ui->checkBoxNumbers->isChecked());
|
||||||
config()->set("generator/SpecialChars", m_ui->checkBoxSpecialChars->isChecked());
|
config()->set("generator/SpecialChars", m_ui->checkBoxSpecialChars->isChecked());
|
||||||
|
config()->set("generator/EASCII", m_ui->checkBoxExtASCII->isChecked());
|
||||||
config()->set("generator/ExcludeAlike", m_ui->checkBoxExcludeAlike->isChecked());
|
config()->set("generator/ExcludeAlike", m_ui->checkBoxExcludeAlike->isChecked());
|
||||||
config()->set("generator/EnsureEvery", m_ui->checkBoxEnsureEvery->isChecked());
|
config()->set("generator/EnsureEvery", m_ui->checkBoxEnsureEvery->isChecked());
|
||||||
config()->set("generator/Length", m_ui->spinBoxLength->value());
|
config()->set("generator/Length", m_ui->spinBoxLength->value());
|
||||||
|
@ -287,6 +289,10 @@ PasswordGenerator::CharClasses PasswordGeneratorWidget::charClasses()
|
||||||
classes |= PasswordGenerator::SpecialCharacters;
|
classes |= PasswordGenerator::SpecialCharacters;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (m_ui->checkBoxExtASCII->isChecked()) {
|
||||||
|
classes |= PasswordGenerator::EASCII;
|
||||||
|
}
|
||||||
|
|
||||||
return classes;
|
return classes;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -325,6 +331,9 @@ void PasswordGeneratorWidget::updateGenerator()
|
||||||
if (classes.testFlag(PasswordGenerator::SpecialCharacters)) {
|
if (classes.testFlag(PasswordGenerator::SpecialCharacters)) {
|
||||||
minLength++;
|
minLength++;
|
||||||
}
|
}
|
||||||
|
if (classes.testFlag(PasswordGenerator::EASCII)) {
|
||||||
|
minLength++;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
minLength = qMax(minLength, 1);
|
minLength = qMax(minLength, 1);
|
||||||
|
|
||||||
|
|
|
@ -222,11 +222,11 @@ QProgressBar::chunk {
|
||||||
</property>
|
</property>
|
||||||
<layout class="QVBoxLayout" name="verticalLayout">
|
<layout class="QVBoxLayout" name="verticalLayout">
|
||||||
<item>
|
<item>
|
||||||
<layout class="QHBoxLayout" name="alphabetLayout" stretch="0,0,0,0,1">
|
<layout class="QHBoxLayout" name="alphabetLayout" stretch="0,0,0,0,1,0">
|
||||||
<item>
|
<item>
|
||||||
<widget class="QToolButton" name="checkBoxUpper">
|
<widget class="QToolButton" name="checkBoxUpper">
|
||||||
<property name="sizePolicy">
|
<property name="sizePolicy">
|
||||||
<sizepolicy hsizetype="Preferred" vsizetype="MinimumExpanding">
|
<sizepolicy hsizetype="Maximum" vsizetype="MinimumExpanding">
|
||||||
<horstretch>0</horstretch>
|
<horstretch>0</horstretch>
|
||||||
<verstretch>0</verstretch>
|
<verstretch>0</verstretch>
|
||||||
</sizepolicy>
|
</sizepolicy>
|
||||||
|
@ -257,7 +257,7 @@ QProgressBar::chunk {
|
||||||
<item>
|
<item>
|
||||||
<widget class="QToolButton" name="checkBoxLower">
|
<widget class="QToolButton" name="checkBoxLower">
|
||||||
<property name="sizePolicy">
|
<property name="sizePolicy">
|
||||||
<sizepolicy hsizetype="Preferred" vsizetype="MinimumExpanding">
|
<sizepolicy hsizetype="Maximum" vsizetype="MinimumExpanding">
|
||||||
<horstretch>0</horstretch>
|
<horstretch>0</horstretch>
|
||||||
<verstretch>0</verstretch>
|
<verstretch>0</verstretch>
|
||||||
</sizepolicy>
|
</sizepolicy>
|
||||||
|
@ -288,7 +288,7 @@ QProgressBar::chunk {
|
||||||
<item>
|
<item>
|
||||||
<widget class="QToolButton" name="checkBoxNumbers">
|
<widget class="QToolButton" name="checkBoxNumbers">
|
||||||
<property name="sizePolicy">
|
<property name="sizePolicy">
|
||||||
<sizepolicy hsizetype="Preferred" vsizetype="MinimumExpanding">
|
<sizepolicy hsizetype="Maximum" vsizetype="MinimumExpanding">
|
||||||
<horstretch>0</horstretch>
|
<horstretch>0</horstretch>
|
||||||
<verstretch>0</verstretch>
|
<verstretch>0</verstretch>
|
||||||
</sizepolicy>
|
</sizepolicy>
|
||||||
|
@ -319,7 +319,7 @@ QProgressBar::chunk {
|
||||||
<item>
|
<item>
|
||||||
<widget class="QToolButton" name="checkBoxSpecialChars">
|
<widget class="QToolButton" name="checkBoxSpecialChars">
|
||||||
<property name="sizePolicy">
|
<property name="sizePolicy">
|
||||||
<sizepolicy hsizetype="Preferred" vsizetype="MinimumExpanding">
|
<sizepolicy hsizetype="Maximum" vsizetype="MinimumExpanding">
|
||||||
<horstretch>0</horstretch>
|
<horstretch>0</horstretch>
|
||||||
<verstretch>0</verstretch>
|
<verstretch>0</verstretch>
|
||||||
</sizepolicy>
|
</sizepolicy>
|
||||||
|
@ -347,6 +347,43 @@ QProgressBar::chunk {
|
||||||
</attribute>
|
</attribute>
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
|
<item>
|
||||||
|
<widget class="QToolButton" name="checkBoxExtASCII">
|
||||||
|
<property name="sizePolicy">
|
||||||
|
<sizepolicy hsizetype="Maximum" vsizetype="MinimumExpanding">
|
||||||
|
<horstretch>0</horstretch>
|
||||||
|
<verstretch>0</verstretch>
|
||||||
|
</sizepolicy>
|
||||||
|
</property>
|
||||||
|
<property name="minimumSize">
|
||||||
|
<size>
|
||||||
|
<width>0</width>
|
||||||
|
<height>25</height>
|
||||||
|
</size>
|
||||||
|
</property>
|
||||||
|
<property name="maximumSize">
|
||||||
|
<size>
|
||||||
|
<width>16777215</width>
|
||||||
|
<height>16777215</height>
|
||||||
|
</size>
|
||||||
|
</property>
|
||||||
|
<property name="focusPolicy">
|
||||||
|
<enum>Qt::StrongFocus</enum>
|
||||||
|
</property>
|
||||||
|
<property name="toolTip">
|
||||||
|
<string>Extended ASCII</string>
|
||||||
|
</property>
|
||||||
|
<property name="text">
|
||||||
|
<string notr="true">Extended ASCII</string>
|
||||||
|
</property>
|
||||||
|
<property name="checkable">
|
||||||
|
<bool>true</bool>
|
||||||
|
</property>
|
||||||
|
<attribute name="buttonGroup">
|
||||||
|
<string notr="true">optionButtons</string>
|
||||||
|
</attribute>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
<item>
|
<item>
|
||||||
<spacer name="horizontalSpacer">
|
<spacer name="horizontalSpacer">
|
||||||
<property name="orientation">
|
<property name="orientation">
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue