mirror of
https://github.com/keepassxreboot/keepassxc.git
synced 2025-08-01 11:06:17 -04:00
Add "Apply" button to entry and group edit windows (#624)
This commit is contained in:
parent
107684e393
commit
6ffca842e6
8 changed files with 33 additions and 11 deletions
|
@ -18,6 +18,7 @@
|
|||
#include "EditWidget.h"
|
||||
#include "ui_EditWidget.h"
|
||||
#include <QScrollArea>
|
||||
#include <QPushButton>
|
||||
|
||||
#include "core/FilePath.h"
|
||||
|
||||
|
@ -102,7 +103,10 @@ void EditWidget::setReadOnly(bool readOnly)
|
|||
m_ui->buttonBox->setStandardButtons(QDialogButtonBox::Close);
|
||||
}
|
||||
else {
|
||||
m_ui->buttonBox->setStandardButtons(QDialogButtonBox::Ok | QDialogButtonBox::Cancel);
|
||||
m_ui->buttonBox->setStandardButtons(QDialogButtonBox::Ok | QDialogButtonBox::Cancel | QDialogButtonBox::Apply);
|
||||
// Find and connect the apply button
|
||||
QPushButton* applyButton = m_ui->buttonBox->button(QDialogButtonBox::Apply);
|
||||
connect(applyButton, SIGNAL(clicked()), SIGNAL(apply()));
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -48,6 +48,7 @@ public:
|
|||
bool readOnly() const;
|
||||
|
||||
signals:
|
||||
void apply();
|
||||
void accepted();
|
||||
void rejected();
|
||||
|
||||
|
|
|
@ -66,7 +66,7 @@
|
|||
<item>
|
||||
<widget class="QDialogButtonBox" name="buttonBox">
|
||||
<property name="standardButtons">
|
||||
<set>QDialogButtonBox::Cancel|QDialogButtonBox::Ok</set>
|
||||
<set>QDialogButtonBox::Apply|QDialogButtonBox::Cancel|QDialogButtonBox::Ok</set>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
|
|
|
@ -75,8 +75,9 @@ EditEntryWidget::EditEntryWidget(QWidget* parent)
|
|||
setupProperties();
|
||||
setupHistory();
|
||||
|
||||
connect(this, SIGNAL(accepted()), SLOT(saveEntry()));
|
||||
connect(this, SIGNAL(accepted()), SLOT(acceptEntry()));
|
||||
connect(this, SIGNAL(rejected()), SLOT(cancel()));
|
||||
connect(this, SIGNAL(apply()), SLOT(saveEntry()));
|
||||
connect(m_iconsWidget, SIGNAL(messageEditEntry(QString, MessageWidget::MessageType)), SLOT(showMessage(QString, MessageWidget::MessageType)));
|
||||
connect(m_iconsWidget, SIGNAL(messageEditEntryDismiss()), SLOT(hideMessage()));
|
||||
|
||||
|
@ -439,9 +440,12 @@ void EditEntryWidget::saveEntry()
|
|||
if (!m_create) {
|
||||
m_entry->endUpdate();
|
||||
}
|
||||
}
|
||||
|
||||
void EditEntryWidget::acceptEntry()
|
||||
{
|
||||
saveEntry();
|
||||
clear();
|
||||
|
||||
emit editFinished(true);
|
||||
}
|
||||
|
||||
|
|
|
@ -68,6 +68,7 @@ signals:
|
|||
void historyEntryActivated(Entry* entry);
|
||||
|
||||
private slots:
|
||||
void acceptEntry();
|
||||
void saveEntry();
|
||||
void cancel();
|
||||
void togglePasswordGeneratorButton(bool checked);
|
||||
|
|
|
@ -42,6 +42,7 @@ EditGroupWidget::EditGroupWidget(QWidget* parent)
|
|||
connect(m_mainUi->autoTypeSequenceCustomRadio, SIGNAL(toggled(bool)),
|
||||
m_mainUi->autoTypeSequenceCustomEdit, SLOT(setEnabled(bool)));
|
||||
|
||||
connect(this, SIGNAL(apply()), SLOT(apply()));
|
||||
connect(this, SIGNAL(accepted()), SLOT(save()));
|
||||
connect(this, SIGNAL(rejected()), SLOT(cancel()));
|
||||
|
||||
|
@ -101,6 +102,13 @@ void EditGroupWidget::loadGroup(Group* group, bool create, Database* database)
|
|||
}
|
||||
|
||||
void EditGroupWidget::save()
|
||||
{
|
||||
apply();
|
||||
clear();
|
||||
emit editFinished(true);
|
||||
}
|
||||
|
||||
void EditGroupWidget::apply()
|
||||
{
|
||||
m_group->setName(m_mainUi->editName->text());
|
||||
m_group->setNotes(m_mainUi->editNotes->toPlainText());
|
||||
|
@ -128,9 +136,6 @@ void EditGroupWidget::save()
|
|||
else {
|
||||
m_group->setIcon(iconStruct.uuid);
|
||||
}
|
||||
|
||||
clear();
|
||||
emit editFinished(true);
|
||||
}
|
||||
|
||||
void EditGroupWidget::cancel()
|
||||
|
|
|
@ -49,6 +49,7 @@ signals:
|
|||
void messageEditEntryDismiss();
|
||||
|
||||
private slots:
|
||||
void apply();
|
||||
void save();
|
||||
void cancel();
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue