Hide an already visible KMessageWidget message before showing a new one

1. Do some operation that causes the KMessageWidget to show an error message
2. Immediately Repeat the same action.

The user has no way to know whether the error message is from the second operation or
is a leftover from the first one. By hiding the widget first and then showing it using
animatedShow(), the user can clearly see that a new message was generated. Also once the
directory successfully loads, the widget should be hidden.

BUG: 323077
FIXED-IN: 4.14.1
REVIEW: 119401
This commit is contained in:
Arjun AK 2014-08-22 18:42:50 +05:30
parent b73aeb4598
commit 4290827540

View file

@ -110,6 +110,7 @@ DolphinViewContainer::DolphinViewContainer(const KUrl& url, QWidget* parent) :
m_view = new DolphinView(url, this);
connect(m_view, SIGNAL(urlChanged(KUrl)), m_urlNavigator, SLOT(setUrl(KUrl)));
connect(m_view, SIGNAL(urlChanged(KUrl)), m_messageWidget, SLOT(hide()));
connect(m_view, SIGNAL(directoryLoadingCompleted()), m_messageWidget, SLOT(hide()));
connect(m_view, SIGNAL(writeStateChanged(bool)), this, SIGNAL(writeStateChanged(bool)));
connect(m_view, SIGNAL(requestItemInfo(KFileItem)), this, SLOT(showItemInfo(KFileItem)));
connect(m_view, SIGNAL(itemActivated(KFileItem)), this, SLOT(slotItemActivated(KFileItem)));
@ -277,6 +278,9 @@ void DolphinViewContainer::showMessage(const QString& msg, MessageType type)
const int unwrappedWidth = m_messageWidget->sizeHint().width();
m_messageWidget->setWordWrap(unwrappedWidth > size().width());
if (m_messageWidget->isVisible()) {
m_messageWidget->hide();
}
m_messageWidget->animatedShow();
}