mirror of
https://github.com/keepassxreboot/keepassxc.git
synced 2025-12-04 15:39:34 +01:00
Add option to auto-generate a password for new entries (#12593)
* Closes #626 --------- Co-authored-by: Jonathan White <support@dmapps.us>
This commit is contained in:
@@ -577,6 +577,10 @@
|
|||||||
<source>Skip confirmation for main window Auto-Type actions</source>
|
<source>Skip confirmation for main window Auto-Type actions</source>
|
||||||
<translation type="unfinished"></translation>
|
<translation type="unfinished"></translation>
|
||||||
</message>
|
</message>
|
||||||
|
<message>
|
||||||
|
<source>Auto-generate password for new entries</source>
|
||||||
|
<translation type="unfinished"></translation>
|
||||||
|
</message>
|
||||||
</context>
|
</context>
|
||||||
<context>
|
<context>
|
||||||
<name>ApplicationSettingsWidgetSecurity</name>
|
<name>ApplicationSettingsWidgetSecurity</name>
|
||||||
|
|||||||
@@ -69,6 +69,7 @@ static const QHash<Config::ConfigKey, ConfigDirective> configStrings = {
|
|||||||
{Config::OpenURLOnDoubleClick, {QS("OpenURLOnDoubleClick"), Roaming, true}},
|
{Config::OpenURLOnDoubleClick, {QS("OpenURLOnDoubleClick"), Roaming, true}},
|
||||||
{Config::HideWindowOnCopy,{QS("HideWindowOnCopy"), Roaming, false}},
|
{Config::HideWindowOnCopy,{QS("HideWindowOnCopy"), Roaming, false}},
|
||||||
{Config::MinimizeOnCopy,{QS("MinimizeOnCopy"), Roaming, true}},
|
{Config::MinimizeOnCopy,{QS("MinimizeOnCopy"), Roaming, true}},
|
||||||
|
{Config::AutoGeneratePasswordForNewEntries,{QS("AutoGeneratePasswordForNewEntries"), Roaming, false}},
|
||||||
{Config::MinimizeAfterUnlock,{QS("MinimizeAfterUnlock"), Roaming, false}},
|
{Config::MinimizeAfterUnlock,{QS("MinimizeAfterUnlock"), Roaming, false}},
|
||||||
{Config::DropToBackgroundOnCopy,{QS("DropToBackgroundOnCopy"), Roaming, false}},
|
{Config::DropToBackgroundOnCopy,{QS("DropToBackgroundOnCopy"), Roaming, false}},
|
||||||
{Config::UseGroupIconOnEntryCreation,{QS("UseGroupIconOnEntryCreation"), Roaming, true}},
|
{Config::UseGroupIconOnEntryCreation,{QS("UseGroupIconOnEntryCreation"), Roaming, true}},
|
||||||
|
|||||||
@@ -53,6 +53,7 @@ public:
|
|||||||
HideWindowOnCopy,
|
HideWindowOnCopy,
|
||||||
MinimizeOnCopy,
|
MinimizeOnCopy,
|
||||||
MinimizeAfterUnlock,
|
MinimizeAfterUnlock,
|
||||||
|
AutoGeneratePasswordForNewEntries,
|
||||||
DropToBackgroundOnCopy,
|
DropToBackgroundOnCopy,
|
||||||
UseGroupIconOnEntryCreation,
|
UseGroupIconOnEntryCreation,
|
||||||
AutoTypeEntryTitleMatch,
|
AutoTypeEntryTitleMatch,
|
||||||
|
|||||||
@@ -226,6 +226,8 @@ void ApplicationSettingsWidget::loadSettings()
|
|||||||
!config()->get(Config::Security_NoConfirmMoveEntryToRecycleBin).toBool());
|
!config()->get(Config::Security_NoConfirmMoveEntryToRecycleBin).toBool());
|
||||||
m_generalUi->EnableCopyOnDoubleClickCheckBox->setChecked(
|
m_generalUi->EnableCopyOnDoubleClickCheckBox->setChecked(
|
||||||
config()->get(Config::Security_EnableCopyOnDoubleClick).toBool());
|
config()->get(Config::Security_EnableCopyOnDoubleClick).toBool());
|
||||||
|
m_generalUi->autoGeneratePasswordForNewEntriesCheckBox->setChecked(
|
||||||
|
config()->get(Config::AutoGeneratePasswordForNewEntries).toBool());
|
||||||
|
|
||||||
m_generalUi->languageComboBox->clear();
|
m_generalUi->languageComboBox->clear();
|
||||||
QList<QPair<QString, QString>> languages = Translator::availableLanguages();
|
QList<QPair<QString, QString>> languages = Translator::availableLanguages();
|
||||||
@@ -399,6 +401,8 @@ void ApplicationSettingsWidget::saveSettings()
|
|||||||
config()->set(Config::Security_NoConfirmMoveEntryToRecycleBin,
|
config()->set(Config::Security_NoConfirmMoveEntryToRecycleBin,
|
||||||
!m_generalUi->ConfirmMoveEntryToRecycleBinCheckBox->isChecked());
|
!m_generalUi->ConfirmMoveEntryToRecycleBinCheckBox->isChecked());
|
||||||
config()->set(Config::Security_EnableCopyOnDoubleClick, m_generalUi->EnableCopyOnDoubleClickCheckBox->isChecked());
|
config()->set(Config::Security_EnableCopyOnDoubleClick, m_generalUi->EnableCopyOnDoubleClickCheckBox->isChecked());
|
||||||
|
config()->set(Config::AutoGeneratePasswordForNewEntries,
|
||||||
|
m_generalUi->autoGeneratePasswordForNewEntriesCheckBox->isChecked());
|
||||||
|
|
||||||
auto language = m_generalUi->languageComboBox->currentData().toString();
|
auto language = m_generalUi->languageComboBox->currentData().toString();
|
||||||
if (config()->get(Config::GUI_Language) != language) {
|
if (config()->get(Config::GUI_Language) != language) {
|
||||||
|
|||||||
@@ -59,7 +59,7 @@
|
|||||||
<x>0</x>
|
<x>0</x>
|
||||||
<y>0</y>
|
<y>0</y>
|
||||||
<width>568</width>
|
<width>568</width>
|
||||||
<height>1202</height>
|
<height>1226</height>
|
||||||
</rect>
|
</rect>
|
||||||
</property>
|
</property>
|
||||||
<layout class="QVBoxLayout" name="verticalLayout_8">
|
<layout class="QVBoxLayout" name="verticalLayout_8">
|
||||||
@@ -539,6 +539,13 @@
|
|||||||
</property>
|
</property>
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
|
<item>
|
||||||
|
<widget class="QCheckBox" name="autoGeneratePasswordForNewEntriesCheckBox">
|
||||||
|
<property name="text">
|
||||||
|
<string>Auto-generate password for new entries</string>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
<item>
|
<item>
|
||||||
<widget class="QCheckBox" name="EnableCopyOnDoubleClickCheckBox">
|
<widget class="QCheckBox" name="EnableCopyOnDoubleClickCheckBox">
|
||||||
<property name="text">
|
<property name="text">
|
||||||
|
|||||||
@@ -38,6 +38,7 @@
|
|||||||
#include "core/EntryAttributes.h"
|
#include "core/EntryAttributes.h"
|
||||||
#include "core/Group.h"
|
#include "core/Group.h"
|
||||||
#include "core/Metadata.h"
|
#include "core/Metadata.h"
|
||||||
|
#include "core/PasswordGenerator.h"
|
||||||
#include "core/TimeDelta.h"
|
#include "core/TimeDelta.h"
|
||||||
#ifdef WITH_XC_SSHAGENT
|
#ifdef WITH_XC_SSHAGENT
|
||||||
#include "sshagent/OpenSSHKey.h"
|
#include "sshagent/OpenSSHKey.h"
|
||||||
@@ -948,6 +949,12 @@ void EditEntryWidget::loadEntry(Entry* entry,
|
|||||||
// Force the user to Save/Discard new entries
|
// Force the user to Save/Discard new entries
|
||||||
showApplyButton(!m_create);
|
showApplyButton(!m_create);
|
||||||
|
|
||||||
|
// Set an initial password for new entries if the option is enabled
|
||||||
|
if (create && config()->get(Config::AutoGeneratePasswordForNewEntries).toBool()) {
|
||||||
|
PasswordGenerator generator;
|
||||||
|
m_mainUi->passwordEdit->setText(generator.generatePassword());
|
||||||
|
}
|
||||||
|
|
||||||
setModified(false);
|
setModified(false);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user