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