Skip to content

Commit

Permalink
Fix read-only preview
Browse files Browse the repository at this point in the history
Refactor EntryAttachmentsWidget and PreviewEntryAttachmentsDialog to remove unnecessary parent references

Fixes #11506
  • Loading branch information
w15dev committed Jan 9, 2025
1 parent e00aec9 commit 3f91ffe
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 6 deletions.
8 changes: 4 additions & 4 deletions src/gui/entry/EntryAttachmentsWidget.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,7 @@ EntryAttachmentsWidget::EntryAttachmentsWidget(QWidget* parent)
connect(m_ui->openAttachmentButton, SIGNAL(clicked()), SLOT(openSelectedAttachments()));
connect(m_ui->addAttachmentButton, SIGNAL(clicked()), SLOT(insertAttachments()));
connect(m_ui->newAttachmentButton, SIGNAL(clicked()), SLOT(newAttachments()));
connect(m_ui->previewButton, SIGNAL(clicked()), SLOT(previewAttachments()));
connect(m_ui->previewAttachmentButton, SIGNAL(clicked()), SLOT(previewAttachments()));
connect(m_ui->removeAttachmentButton, SIGNAL(clicked()), SLOT(removeSelectedAttachments()));
connect(m_ui->renameAttachmentButton, SIGNAL(clicked()), SLOT(renameSelectedAttachments()));

Expand Down Expand Up @@ -175,7 +175,7 @@ void EntryAttachmentsWidget::newAttachments()
return;
}

NewEntryAttachmentsDialog newEntryDialog{m_entryAttachments, this};
NewEntryAttachmentsDialog newEntryDialog{m_entryAttachments};
if (newEntryDialog.exec() == QDialog::Accepted) {
emit widgetUpdated();
}
Expand All @@ -191,7 +191,7 @@ void EntryAttachmentsWidget::previewAttachments()
return;
}

PreviewEntryAttachmentsDialog previewDialog{m_entryAttachments, this};
PreviewEntryAttachmentsDialog previewDialog{m_entryAttachments};
previewDialog.setAttachment(m_attachmentsModel->keyByIndex(index));

previewDialog.exec();
Expand Down Expand Up @@ -339,7 +339,7 @@ void EntryAttachmentsWidget::updateButtonsEnabled()
m_ui->renameAttachmentButton->setEnabled(hasSelection && !m_readOnly);

m_ui->saveAttachmentButton->setEnabled(hasSelection);
m_ui->previewButton->setEnabled(hasSelection);
m_ui->previewAttachmentButton->setEnabled(hasSelection);
m_ui->openAttachmentButton->setEnabled(hasSelection);
}

Expand Down
4 changes: 2 additions & 2 deletions src/gui/entry/EntryAttachmentsWidget.ui
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
<x>0</x>
<y>0</y>
<width>337</width>
<height>289</height>
<height>294</height>
</rect>
</property>
<property name="windowTitle">
Expand Down Expand Up @@ -101,7 +101,7 @@
</widget>
</item>
<item>
<widget class="QPushButton" name="previewButton">
<widget class="QPushButton" name="previewAttachmentButton">
<property name="enabled">
<bool>false</bool>
</property>
Expand Down
1 change: 1 addition & 0 deletions src/gui/entry/PreviewEntryAttachmentsDialog.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,7 @@ PreviewEntryAttachmentsDialog::PreviewEntryAttachmentsDialog(QPointer<EntryAttac

m_ui->titleEdit->setReadOnly(true);
m_ui->attachmentTextEdit->setReadOnly(true);
m_ui->errorLabel->setVisible(false);

m_ui->dialogButtons->clear();
m_ui->dialogButtons->addButton(QDialogButtonBox::Close);
Expand Down

0 comments on commit 3f91ffe

Please sign in to comment.