From 3f91ffea333cbcc9c427e336b9ef1788fb422191 Mon Sep 17 00:00:00 2001 From: w15dev Date: Thu, 9 Jan 2025 19:33:40 +0300 Subject: [PATCH] Fix read-only preview Refactor EntryAttachmentsWidget and PreviewEntryAttachmentsDialog to remove unnecessary parent references Fixes #11506 --- src/gui/entry/EntryAttachmentsWidget.cpp | 8 ++++---- src/gui/entry/EntryAttachmentsWidget.ui | 4 ++-- src/gui/entry/PreviewEntryAttachmentsDialog.cpp | 1 + 3 files changed, 7 insertions(+), 6 deletions(-) diff --git a/src/gui/entry/EntryAttachmentsWidget.cpp b/src/gui/entry/EntryAttachmentsWidget.cpp index c1688153a5..6b888a4d54 100644 --- a/src/gui/entry/EntryAttachmentsWidget.cpp +++ b/src/gui/entry/EntryAttachmentsWidget.cpp @@ -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())); @@ -175,7 +175,7 @@ void EntryAttachmentsWidget::newAttachments() return; } - NewEntryAttachmentsDialog newEntryDialog{m_entryAttachments, this}; + NewEntryAttachmentsDialog newEntryDialog{m_entryAttachments}; if (newEntryDialog.exec() == QDialog::Accepted) { emit widgetUpdated(); } @@ -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(); @@ -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); } diff --git a/src/gui/entry/EntryAttachmentsWidget.ui b/src/gui/entry/EntryAttachmentsWidget.ui index 16e578613c..99a16ca4e9 100644 --- a/src/gui/entry/EntryAttachmentsWidget.ui +++ b/src/gui/entry/EntryAttachmentsWidget.ui @@ -7,7 +7,7 @@ 0 0 337 - 289 + 294 @@ -101,7 +101,7 @@ - + false diff --git a/src/gui/entry/PreviewEntryAttachmentsDialog.cpp b/src/gui/entry/PreviewEntryAttachmentsDialog.cpp index 51d1180611..91ddb16737 100644 --- a/src/gui/entry/PreviewEntryAttachmentsDialog.cpp +++ b/src/gui/entry/PreviewEntryAttachmentsDialog.cpp @@ -37,6 +37,7 @@ PreviewEntryAttachmentsDialog::PreviewEntryAttachmentsDialog(QPointertitleEdit->setReadOnly(true); m_ui->attachmentTextEdit->setReadOnly(true); + m_ui->errorLabel->setVisible(false); m_ui->dialogButtons->clear(); m_ui->dialogButtons->addButton(QDialogButtonBox::Close);