Commit 0505b346 authored by Ragnar Thomsen's avatar Ragnar Thomsen

Reset comment widget when opening an archive

When creating a new archive from an Ark instance where an archive with
comment already is opened, the comment widget from the previous archive
remains visible. This is now fixed by clearing and hiding the
QPlaintTextEdit in beginning of Part::openFile().

Part::slotCommentChanged() gets called when calling
QPlainTextEdit::clear(), so to avoid a segfault we need to check for an
invalid m_model.archive() and in that case return.

Differential Revision: D2114
parent 5d133a92
......@@ -197,6 +197,10 @@ Part::~Part()
void Part::slotCommentChanged()
{
if (!m_model->archive()) {
return;
}
if (m_commentMsgWidget->isHidden() && m_commentView->toPlainText() != m_model->archive()->comment()) {
m_commentMsgWidget->animatedShow();
} else if (m_commentMsgWidget->isVisible() && m_commentView->toPlainText() == m_model->archive()->comment()) {
......@@ -609,6 +613,9 @@ bool Part::openFile()
{
qCDebug(ARK) << "Attempting to open archive" << localFilePath();
m_commentView->clear();
m_commentBox->hide();
if (!isLocalFileValid()) {
return false;
}
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment