mirror of
https://github.com/keepassxreboot/keepassxc.git
synced 2024-12-27 16:29:44 -05:00
Disable attachment buttons when none is selected.
This commit is contained in:
parent
c39898dad9
commit
876a75b572
@ -108,6 +108,8 @@ void EditEntryWidget::setupAdvanced()
|
||||
|
||||
m_attachmentsModel->setEntryAttachments(m_entryAttachments);
|
||||
m_advancedUi->attachmentsView->setModel(m_attachmentsModel);
|
||||
connect(m_advancedUi->attachmentsView->selectionModel(), SIGNAL(currentChanged(QModelIndex,QModelIndex)),
|
||||
SLOT(updateAttachmentButtonsEnabled(QModelIndex)));
|
||||
connect(m_advancedUi->attachmentsView, SIGNAL(doubleClicked(QModelIndex)), SLOT(openAttachment(QModelIndex)));
|
||||
connect(m_advancedUi->saveAttachmentButton, SIGNAL(clicked()), SLOT(saveCurrentAttachment()));
|
||||
connect(m_advancedUi->openAttachmentButton, SIGNAL(clicked()), SLOT(openCurrentAttachment()));
|
||||
@ -235,6 +237,15 @@ void EditEntryWidget::useExpiryPreset(QAction* action)
|
||||
m_mainUi->expireDatePicker->setDateTime(expiryDateTime);
|
||||
}
|
||||
|
||||
void EditEntryWidget::updateAttachmentButtonsEnabled(const QModelIndex& current)
|
||||
{
|
||||
bool enable = current.isValid();
|
||||
|
||||
m_advancedUi->saveAttachmentButton->setEnabled(enable);
|
||||
m_advancedUi->openAttachmentButton->setEnabled(enable);
|
||||
m_advancedUi->removeAttachmentButton->setEnabled(enable && !m_history);
|
||||
}
|
||||
|
||||
QString EditEntryWidget::entryTitle() const
|
||||
{
|
||||
if (m_entry) {
|
||||
@ -284,7 +295,7 @@ void EditEntryWidget::setForms(const Entry* entry, bool restore)
|
||||
m_mainUi->tooglePasswordGeneratorButton->setChecked(false);
|
||||
m_mainUi->passwordGenerator->reset();
|
||||
m_advancedUi->addAttachmentButton->setEnabled(!m_history);
|
||||
m_advancedUi->removeAttachmentButton->setEnabled(!m_history);
|
||||
updateAttachmentButtonsEnabled(m_advancedUi->attachmentsView->currentIndex());
|
||||
m_advancedUi->addAttributeButton->setEnabled(!m_history);
|
||||
m_advancedUi->editAttributeButton->setEnabled(false);
|
||||
m_advancedUi->removeAttributeButton->setEnabled(false);
|
||||
|
@ -93,6 +93,7 @@ private Q_SLOTS:
|
||||
void histEntryActivated(const QModelIndex& index);
|
||||
void updateHistoryButtons(const QModelIndex& current, const QModelIndex& previous);
|
||||
void useExpiryPreset(QAction* action);
|
||||
void updateAttachmentButtonsEnabled(const QModelIndex& current);
|
||||
|
||||
private:
|
||||
void setupMain();
|
||||
|
@ -101,6 +101,9 @@
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QPushButton" name="removeAttachmentButton">
|
||||
<property name="enabled">
|
||||
<bool>false</bool>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Remove</string>
|
||||
</property>
|
||||
@ -108,6 +111,9 @@
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QPushButton" name="openAttachmentButton">
|
||||
<property name="enabled">
|
||||
<bool>false</bool>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Open</string>
|
||||
</property>
|
||||
@ -115,6 +121,9 @@
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QPushButton" name="saveAttachmentButton">
|
||||
<property name="enabled">
|
||||
<bool>false</bool>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Save</string>
|
||||
</property>
|
||||
|
Loading…
Reference in New Issue
Block a user