mirror of
https://github.com/keepassxreboot/keepassxc.git
synced 2025-07-14 10:39:35 -04:00
Display a Close button for history items.
Previously we had Ok and Cancel with the same action.
This commit is contained in:
parent
b9c9c56059
commit
f3d956ceed
3 changed files with 22 additions and 0 deletions
|
@ -23,6 +23,7 @@ EditWidget::EditWidget(QWidget* parent)
|
||||||
, m_ui(new Ui::EditWidget())
|
, m_ui(new Ui::EditWidget())
|
||||||
{
|
{
|
||||||
m_ui->setupUi(this);
|
m_ui->setupUi(this);
|
||||||
|
setReadOnly(false);
|
||||||
|
|
||||||
QFont headerLabelFont = m_ui->headerLabel->font();
|
QFont headerLabelFont = m_ui->headerLabel->font();
|
||||||
headerLabelFont.setBold(true);
|
headerLabelFont.setBold(true);
|
||||||
|
@ -68,3 +69,20 @@ QLabel* EditWidget::headlineLabel()
|
||||||
{
|
{
|
||||||
return m_ui->headerLabel;
|
return m_ui->headerLabel;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void EditWidget::setReadOnly(bool readOnly)
|
||||||
|
{
|
||||||
|
m_readOnly = readOnly;
|
||||||
|
|
||||||
|
if (readOnly) {
|
||||||
|
m_ui->buttonBox->setStandardButtons(QDialogButtonBox::Close);
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
m_ui->buttonBox->setStandardButtons(QDialogButtonBox::Ok | QDialogButtonBox::Cancel);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
bool EditWidget::readOnly() const
|
||||||
|
{
|
||||||
|
return m_readOnly;
|
||||||
|
}
|
||||||
|
|
|
@ -41,6 +41,8 @@ public:
|
||||||
void setCurrentRow(int index);
|
void setCurrentRow(int index);
|
||||||
void setHeadline(const QString& text);
|
void setHeadline(const QString& text);
|
||||||
QLabel* headlineLabel();
|
QLabel* headlineLabel();
|
||||||
|
void setReadOnly(bool readOnly);
|
||||||
|
bool readOnly() const;
|
||||||
|
|
||||||
Q_SIGNALS:
|
Q_SIGNALS:
|
||||||
void accepted();
|
void accepted();
|
||||||
|
@ -48,6 +50,7 @@ Q_SIGNALS:
|
||||||
|
|
||||||
private:
|
private:
|
||||||
const QScopedPointer<Ui::EditWidget> m_ui;
|
const QScopedPointer<Ui::EditWidget> m_ui;
|
||||||
|
bool m_readOnly;
|
||||||
|
|
||||||
Q_DISABLE_COPY(EditWidget)
|
Q_DISABLE_COPY(EditWidget)
|
||||||
};
|
};
|
||||||
|
|
|
@ -277,6 +277,7 @@ void EditEntryWidget::loadEntry(Entry* entry, bool create, bool history, const Q
|
||||||
}
|
}
|
||||||
|
|
||||||
setForms(entry);
|
setForms(entry);
|
||||||
|
setReadOnly(m_history);
|
||||||
|
|
||||||
setCurrentRow(0);
|
setCurrentRow(0);
|
||||||
setRowHidden(m_historyWidget, m_history);
|
setRowHidden(m_historyWidget, m_history);
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue