mirror of
https://github.com/keepassxreboot/keepassxc.git
synced 2025-02-04 08:55:31 -05:00
parent
22e0d8b442
commit
004f5d407f
@ -40,9 +40,7 @@ EntryAttachmentsWidget::EntryAttachmentsWidget(QWidget* parent)
|
||||
m_ui->attachmentsView->setSelectionBehavior(QAbstractItemView::SelectRows);
|
||||
m_ui->attachmentsView->setSelectionMode(QAbstractItemView::ExtendedSelection);
|
||||
|
||||
m_ui->actionsWidget->setVisible(m_buttonsVisible);
|
||||
connect(this, SIGNAL(buttonsVisibleChanged(bool)), m_ui->actionsWidget, SLOT(setVisible(bool)));
|
||||
|
||||
connect(this, SIGNAL(buttonsVisibleChanged(bool)), this, SLOT(updateButtonsVisible()));
|
||||
connect(this, SIGNAL(readOnlyChanged(bool)), SLOT(updateButtonsEnabled()));
|
||||
connect(m_attachmentsModel, SIGNAL(modelReset()), SLOT(updateButtonsEnabled()));
|
||||
|
||||
@ -58,6 +56,7 @@ EntryAttachmentsWidget::EntryAttachmentsWidget(QWidget* parent)
|
||||
connect(m_ui->addAttachmentButton, SIGNAL(clicked()), SLOT(insertAttachments()));
|
||||
connect(m_ui->removeAttachmentButton, SIGNAL(clicked()), SLOT(removeSelectedAttachments()));
|
||||
|
||||
updateButtonsVisible();
|
||||
updateButtonsEnabled();
|
||||
}
|
||||
|
||||
@ -295,6 +294,12 @@ void EntryAttachmentsWidget::updateButtonsEnabled()
|
||||
m_ui->openAttachmentButton->setEnabled(hasSelection);
|
||||
}
|
||||
|
||||
void EntryAttachmentsWidget::updateButtonsVisible()
|
||||
{
|
||||
m_ui->addAttachmentButton->setVisible(m_buttonsVisible && !m_readOnly);
|
||||
m_ui->removeAttachmentButton->setVisible(m_buttonsVisible && !m_readOnly);
|
||||
}
|
||||
|
||||
bool EntryAttachmentsWidget::insertAttachments(const QStringList& filenames, QString& errorMessage)
|
||||
{
|
||||
Q_ASSERT(!isReadOnly());
|
||||
|
@ -48,6 +48,7 @@ private slots:
|
||||
void saveSelectedAttachments();
|
||||
void openAttachment(const QModelIndex& index);
|
||||
void openSelectedAttachments();
|
||||
void updateButtonsVisible();
|
||||
void updateButtonsEnabled();
|
||||
|
||||
private:
|
||||
|
Loading…
x
Reference in New Issue
Block a user