mirror of
https://github.com/keepassxreboot/keepassxc.git
synced 2024-10-01 01:26:01 -04:00
Fix button highlighting in multiple dialogs
* Changed style so that only default buttons have full background highlight. This prevents confusion as to which button in various dialogs is the default/desired choice. * Move password generator popup into static function outside of PasswordEdit so other parts of the program can easily access it. * QDialog forces 'autoDefault' property on all buttons causing them to obtain background highlight when they are focused. Moved Password Generator outside of a QDialog and forced 'autoDefault' to false on Browser Access Dialog. * Fixed button ordering in Totp Setup Dialog * About dialog close button is now the default button
This commit is contained in:
parent
fbd78037ff
commit
243f68e0e8
@ -57,6 +57,7 @@ void BrowserAccessControlDialog::setItems(const QList<Entry*>& items, const QStr
|
||||
m_ui->itemsTable->setItem(row, 0, item);
|
||||
|
||||
auto disableButton = new QPushButton(tr("Disable for this site"));
|
||||
disableButton->setAutoDefault(false);
|
||||
connect(disableButton, &QAbstractButton::pressed, [&, item] {
|
||||
emit disableAccess(item);
|
||||
m_ui->itemsTable->removeRow(item->row());
|
||||
|
@ -88,6 +88,12 @@
|
||||
<property name="text">
|
||||
<string>Allow Selected</string>
|
||||
</property>
|
||||
<property name="autoDefault">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
<property name="default">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
@ -96,7 +102,7 @@
|
||||
<string>Deny All</string>
|
||||
</property>
|
||||
<property name="autoDefault">
|
||||
<bool>false</bool>
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
|
@ -823,11 +823,6 @@ QList<Entry*> BrowserService::confirmEntries(QList<Entry*>& pwEntriesToConfirm,
|
||||
|
||||
accessControlDialog.setItems(pwEntriesToConfirm, !submitHost.isEmpty() ? submitHost : url, httpAuth);
|
||||
|
||||
raiseWindow();
|
||||
accessControlDialog.show();
|
||||
accessControlDialog.activateWindow();
|
||||
accessControlDialog.raise();
|
||||
|
||||
QList<Entry*> allowedEntries;
|
||||
if (accessControlDialog.exec() == QDialog::Accepted) {
|
||||
const auto selectedEntries = accessControlDialog.getSelectedEntries();
|
||||
|
@ -218,6 +218,8 @@ AboutDialog::AboutDialog(QWidget* parent)
|
||||
setAttribute(Qt::WA_DeleteOnClose);
|
||||
connect(m_ui->buttonBox, SIGNAL(rejected()), SLOT(close()));
|
||||
connect(m_ui->copyToClipboard, SIGNAL(clicked()), SLOT(copyToClipboard()));
|
||||
|
||||
m_ui->buttonBox->button(QDialogButtonBox::Close)->setDefault(true);
|
||||
}
|
||||
|
||||
AboutDialog::~AboutDialog()
|
||||
|
@ -126,24 +126,14 @@ bool PasswordEdit::isPasswordVisible() const
|
||||
|
||||
void PasswordEdit::popupPasswordGenerator()
|
||||
{
|
||||
auto pwGenerator = new PasswordGeneratorWidget();
|
||||
QDialog pwDialog(this);
|
||||
pwDialog.setWindowTitle(tr("Generate Password"));
|
||||
auto layout = new QVBoxLayout();
|
||||
pwDialog.setLayout(layout);
|
||||
layout->addWidget(pwGenerator);
|
||||
auto generator = PasswordGeneratorWidget::popupGenerator(this);
|
||||
generator->setPasswordVisible(isPasswordVisible());
|
||||
generator->setPasswordLength(text().length());
|
||||
|
||||
pwGenerator->setStandaloneMode(false);
|
||||
pwGenerator->setPasswordVisible(isPasswordVisible());
|
||||
pwGenerator->setPasswordLength(text().length());
|
||||
|
||||
connect(pwGenerator, SIGNAL(closePasswordGenerator()), &pwDialog, SLOT(close()));
|
||||
connect(pwGenerator, SIGNAL(appliedPassword(QString)), SLOT(setText(QString)));
|
||||
connect(generator, SIGNAL(appliedPassword(QString)), SLOT(setText(QString)));
|
||||
if (m_repeatPasswordEdit) {
|
||||
connect(pwGenerator, SIGNAL(appliedPassword(QString)), m_repeatPasswordEdit, SLOT(setText(QString)));
|
||||
connect(generator, SIGNAL(appliedPassword(QString)), m_repeatPasswordEdit, SLOT(setText(QString)));
|
||||
}
|
||||
|
||||
pwDialog.exec();
|
||||
}
|
||||
|
||||
void PasswordEdit::updateRepeatStatus()
|
||||
|
@ -103,6 +103,22 @@ PasswordGeneratorWidget::~PasswordGeneratorWidget()
|
||||
{
|
||||
}
|
||||
|
||||
PasswordGeneratorWidget* PasswordGeneratorWidget::popupGenerator(QWidget* parent) {
|
||||
auto pwGenerator = new PasswordGeneratorWidget(parent);
|
||||
pwGenerator->setWindowModality(Qt::ApplicationModal);
|
||||
pwGenerator->setWindowFlags(Qt::Dialog | Qt::MSWindowsFixedSizeDialogHint);
|
||||
pwGenerator->setStandaloneMode(false);
|
||||
|
||||
connect(pwGenerator, SIGNAL(closePasswordGenerator()), pwGenerator, SLOT(deleteLater()));
|
||||
|
||||
pwGenerator->show();
|
||||
pwGenerator->raise();
|
||||
pwGenerator->activateWindow();
|
||||
pwGenerator->adjustSize();
|
||||
|
||||
return pwGenerator;
|
||||
}
|
||||
|
||||
void PasswordGeneratorWidget::loadSettings()
|
||||
{
|
||||
// Password config
|
||||
@ -341,6 +357,9 @@ void PasswordGeneratorWidget::setAdvancedMode(bool state)
|
||||
| m_ui->checkBoxLogograms->isChecked());
|
||||
m_ui->checkBoxExtASCII->setChecked(m_ui->checkBoxExtASCIIAdv->isChecked());
|
||||
}
|
||||
|
||||
QApplication::processEvents();
|
||||
adjustSize();
|
||||
}
|
||||
|
||||
void PasswordGeneratorWidget::excludeHexChars()
|
||||
|
@ -54,6 +54,8 @@ public:
|
||||
QString getGeneratedPassword();
|
||||
bool isPasswordVisible() const;
|
||||
|
||||
static PasswordGeneratorWidget* popupGenerator(QWidget* parent = nullptr);
|
||||
|
||||
public slots:
|
||||
void regeneratePassword();
|
||||
void applyPassword();
|
||||
|
@ -7,7 +7,7 @@
|
||||
<x>0</x>
|
||||
<y>0</y>
|
||||
<width>622</width>
|
||||
<height>404</height>
|
||||
<height>433</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="windowTitle">
|
||||
@ -96,7 +96,7 @@
|
||||
</property>
|
||||
<property name="minimumSize">
|
||||
<size>
|
||||
<width>350</width>
|
||||
<width>450</width>
|
||||
<height>0</height>
|
||||
</size>
|
||||
</property>
|
||||
@ -157,6 +157,9 @@ QProgressBar::chunk {
|
||||
</item>
|
||||
<item row="0" column="2">
|
||||
<widget class="QPushButton" name="buttonCopy">
|
||||
<property name="focusPolicy">
|
||||
<enum>Qt::TabFocus</enum>
|
||||
</property>
|
||||
<property name="toolTip">
|
||||
<string>Copy password</string>
|
||||
</property>
|
||||
@ -170,6 +173,9 @@ QProgressBar::chunk {
|
||||
</item>
|
||||
<item row="0" column="1">
|
||||
<widget class="QPushButton" name="buttonGenerate">
|
||||
<property name="focusPolicy">
|
||||
<enum>Qt::TabFocus</enum>
|
||||
</property>
|
||||
<property name="accessibleDescription">
|
||||
<string>Regenerate password</string>
|
||||
</property>
|
||||
@ -290,9 +296,6 @@ QProgressBar::chunk {
|
||||
<height>0</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="focusPolicy">
|
||||
<enum>Qt::TabFocus</enum>
|
||||
</property>
|
||||
<property name="title">
|
||||
<string>Character Types</string>
|
||||
</property>
|
||||
@ -323,9 +326,6 @@ QProgressBar::chunk {
|
||||
<height>25</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="focusPolicy">
|
||||
<enum>Qt::TabFocus</enum>
|
||||
</property>
|
||||
<property name="toolTip">
|
||||
<string>Upper-case letters</string>
|
||||
</property>
|
||||
@ -1200,6 +1200,7 @@ QProgressBar::chunk {
|
||||
<tabstop>sliderLength</tabstop>
|
||||
<tabstop>spinBoxLength</tabstop>
|
||||
<tabstop>buttonAdvancedMode</tabstop>
|
||||
<tabstop>groupBox</tabstop>
|
||||
<tabstop>checkBoxUpper</tabstop>
|
||||
<tabstop>checkBoxLower</tabstop>
|
||||
<tabstop>checkBoxNumbers</tabstop>
|
||||
@ -1215,6 +1216,11 @@ QProgressBar::chunk {
|
||||
<tabstop>checkBoxQuotes</tabstop>
|
||||
<tabstop>checkBoxDashes</tabstop>
|
||||
<tabstop>checkBoxExtASCIIAdv</tabstop>
|
||||
<tabstop>editAdditionalChars</tabstop>
|
||||
<tabstop>editExcludedChars</tabstop>
|
||||
<tabstop>buttonAddHex</tabstop>
|
||||
<tabstop>checkBoxExcludeAlike</tabstop>
|
||||
<tabstop>checkBoxEnsureEvery</tabstop>
|
||||
<tabstop>comboBoxWordList</tabstop>
|
||||
<tabstop>sliderWordCount</tabstop>
|
||||
<tabstop>spinBoxWordCount</tabstop>
|
||||
|
@ -216,7 +216,9 @@
|
||||
<tabstop>radioDefault</tabstop>
|
||||
<tabstop>radioSteam</tabstop>
|
||||
<tabstop>radioCustom</tabstop>
|
||||
<tabstop>algorithmComboBox</tabstop>
|
||||
<tabstop>stepSpinBox</tabstop>
|
||||
<tabstop>digitsSpinBox</tabstop>
|
||||
</tabstops>
|
||||
<resources/>
|
||||
<connections/>
|
||||
|
Loading…
Reference in New Issue
Block a user